summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <owt1@cornell.edu>1998-03-10 21:43:30 +0000
committerOwen Taylor <otaylor@src.gnome.org>1998-03-10 21:43:30 +0000
commitdd37d3b4f94f12f807d7eb9158a3cf2c6c38636e (patch)
tree5fcbae7a330d4c90fa0457f3b11aa2b190397c2f
parent355e74fce49ce55ad77227a4154e8c46600a527f (diff)
downloadgtk+-dd37d3b4f94f12f807d7eb9158a3cf2c6c38636e.tar.gz
Tue MardlCr 10 14:24:09 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkselection.c (gtk_selection_clear): Make the return result reflect whether the clear event was out of data. * gtk/gtkeditable.c: Ignore out of date selection clear events. * gtk/gtkentry.c gtk/gtktext.c: Don't synthesize releases on [2/3]BUTTON presses, since we get the normal click as well. Claim the selection when selecting words/lines. Tue Mar 10 13:34:29 1998 Owen Taylor <owt1@cornell.edu> * gtk/gtkrange.c (gtk_range_default_[vh]trough_click): Take forward/back step arrows into account when computing position for middle button clicks. * gtk/gtktext.c gtk/gtkentry.c: - Fixes for deleting characters (don't subtract guints and get negative numbers!) - Reset cursor_virtual_x when moving by words and lines - Extra sanity checks - Fix to gtk_text_get_chars (from Tony Gale <gale@daedalus.dera.gov.uk>)
-rw-r--r--.cvsignore13
-rw-r--r--AUTHORS3
-rw-r--r--COPYING481
-rw-r--r--ChangeLog27
-rw-r--r--ChangeLog.pre-2-027
-rw-r--r--ChangeLog.pre-2-1027
-rw-r--r--ChangeLog.pre-2-227
-rw-r--r--ChangeLog.pre-2-427
-rw-r--r--ChangeLog.pre-2-627
-rw-r--r--ChangeLog.pre-2-827
-rw-r--r--HACKING50
-rw-r--r--INSTALL36
-rw-r--r--Makefile.am33
-rw-r--r--Makefile.in353
-rw-r--r--NEWS77
-rw-r--r--README18
-rw-r--r--TODO229
-rw-r--r--acconfig.h52
-rwxr-xr-xautogen.sh52
-rwxr-xr-xconfig.guess883
-rw-r--r--config.h.in50
-rwxr-xr-xconfig.sub954
-rw-r--r--configure.in263
-rw-r--r--docs/.cvsignore17
-rw-r--r--docs/Makefile.am22
-rw-r--r--docs/Makefile.gtkfaq16
-rw-r--r--docs/Makefile.in294
-rw-r--r--docs/debugging.txt98
-rw-r--r--docs/developers.txt69
-rw-r--r--docs/faq/gtkfaq.sgml930
-rw-r--r--docs/gdk.texi334
-rw-r--r--docs/glib.texi455
-rw-r--r--docs/gtk.texi5085
-rw-r--r--docs/gtkfaq.sgml930
-rwxr-xr-xdocs/gtkfaq_fix10
-rw-r--r--docs/macros.texi18
-rw-r--r--docs/refcounting.txt315
-rw-r--r--docs/styles.txt104
-rw-r--r--docs/texinfo.tex4692
-rw-r--r--docs/text_widget.txt487
-rw-r--r--docs/widget_system.txt493
-rw-r--r--gdk/.cvsignore9
-rw-r--r--gdk/Makefile.am82
-rw-r--r--gdk/MwmUtil.h131
-rw-r--r--gdk/gdk.c4035
-rw-r--r--gdk/gdk.h799
-rw-r--r--gdk/gdkcc.c1721
-rw-r--r--gdk/gdkcolor.c718
-rw-r--r--gdk/gdkcursor.c83
-rw-r--r--gdk/gdkcursors.h95
-rw-r--r--gdk/gdkdnd.c139
-rw-r--r--gdk/gdkdraw.c443
-rw-r--r--gdk/gdkfont.c374
-rw-r--r--gdk/gdkglobals.c54
-rw-r--r--gdk/gdki18n.h160
-rw-r--r--gdk/gdkimage.c495
-rw-r--r--gdk/gdkinput.c344
-rw-r--r--gdk/gdkinput.h152
-rw-r--r--gdk/gdkinputcommon.h882
-rw-r--r--gdk/gdkinputgxi.h629
-rw-r--r--gdk/gdkinputnone.h73
-rw-r--r--gdk/gdkinputxfree.h342
-rw-r--r--gdk/gdkkeysyms.h1316
-rw-r--r--gdk/gdkpixmap.c734
-rw-r--r--gdk/gdkprivate.h290
-rw-r--r--gdk/gdkproperty.c213
-rw-r--r--gdk/gdkrectangle.c83
-rw-r--r--gdk/gdkregion.c268
-rw-r--r--gdk/gdkselection.c245
-rw-r--r--gdk/gdktypes.h1196
-rw-r--r--gdk/gdkvisual.c433
-rw-r--r--gdk/gdkwindow.c1814
-rw-r--r--gdk/gdkx.h48
-rw-r--r--gdk/gdkxid.c74
-rw-r--r--gdk/gxid.c844
-rw-r--r--gdk/gxid_lib.c125
-rw-r--r--gdk/gxid_lib.h6
-rw-r--r--gdk/gxid_proto.h39
-rwxr-xr-xgdk/makecursors.awk4
-rwxr-xr-xgdk/makekeysyms.awk5
-rw-r--r--gdk/x11/MwmUtil.h131
-rw-r--r--gdk/x11/gdkcc-x11.c1721
-rw-r--r--gdk/x11/gdkcolor-x11.c718
-rw-r--r--gdk/x11/gdkcursor-x11.c83
-rw-r--r--gdk/x11/gdkdnd-x11.c139
-rw-r--r--gdk/x11/gdkfont-x11.c374
-rw-r--r--gdk/x11/gdkglobals-x11.c54
-rw-r--r--gdk/x11/gdkimage-x11.c495
-rw-r--r--gdk/x11/gdkinput-gxi.c629
-rw-r--r--gdk/x11/gdkinput-none.c73
-rw-r--r--gdk/x11/gdkinput-x11.c882
-rw-r--r--gdk/x11/gdkinput-xfree.c342
-rw-r--r--gdk/x11/gdkinput.c344
-rw-r--r--gdk/x11/gdkmain-x11.c4035
-rw-r--r--gdk/x11/gdkpixmap-x11.c734
-rw-r--r--gdk/x11/gdkproperty-x11.c213
-rw-r--r--gdk/x11/gdkregion-x11.c268
-rw-r--r--gdk/x11/gdkselection-x11.c245
-rw-r--r--gdk/x11/gdkvisual-x11.c433
-rw-r--r--gdk/x11/gdkwindow-x11.c1814
-rw-r--r--gdk/x11/gdkx.h48
-rw-r--r--gdk/x11/gdkxid.c74
-rw-r--r--gdk/x11/gxid.c844
-rw-r--r--gdk/x11/gxid_lib.c125
-rw-r--r--gdk/x11/gxid_lib.h6
-rw-r--r--gdk/x11/gxid_proto.h39
-rw-r--r--glib/.cvsignore17
-rw-r--r--glib/AUTHORS1
-rw-r--r--glib/COPYING0
-rw-r--r--glib/ChangeLog174
-rw-r--r--glib/INSTALL0
-rw-r--r--glib/Makefile.am39
-rw-r--r--glib/NEWS0
-rw-r--r--glib/README0
-rw-r--r--glib/acconfig.h68
-rwxr-xr-xglib/config.guess883
-rwxr-xr-xglib/config.sub954
-rw-r--r--glib/configure.in167
-rw-r--r--glib/garray.c142
-rw-r--r--glib/gcache.c211
-rw-r--r--glib/gerror.c257
-rw-r--r--glib/ghash.c418
-rw-r--r--glib/glib.h946
-rw-r--r--glib/glibconfig.h.in78
-rw-r--r--glib/glist.c414
-rw-r--r--glib/gmem.c824
-rw-r--r--glib/gprimes.c61
-rw-r--r--glib/gscanner.c1146
-rw-r--r--glib/gslist.c390
-rw-r--r--glib/gstring.c549
-rw-r--r--glib/gtimer.c119
-rw-r--r--glib/gtree.c718
-rw-r--r--glib/gutils.c911
-rwxr-xr-xglib/install-sh238
-rwxr-xr-xglib/ltconfig1415
-rw-r--r--glib/ltmain.sh2372
-rwxr-xr-xglib/missing134
-rwxr-xr-xglib/mkinstalldirs36
-rw-r--r--glib/stamp-h.in1
-rw-r--r--glib/testglib.c406
-rw-r--r--gtk+.prj334
-rw-r--r--gtk+.xconfig.in3
-rw-r--r--gtk/.cvsignore12
-rw-r--r--gtk/3DRings.xpm116
-rw-r--r--gtk/FilesQueue.xpm98
-rw-r--r--gtk/Makefile.am277
-rw-r--r--gtk/Makefile.in690
-rw-r--r--gtk/Modeller.xpm117
-rw-r--r--gtk/circles.xbm46
-rw-r--r--gtk/fnmatch.c207
-rw-r--r--gtk/fnmatch.h67
-rw-r--r--gtk/gentypeinfo.el137
-rw-r--r--gtk/gtk.defs1862
-rw-r--r--gtk/gtk.h114
-rw-r--r--gtk/gtkaccelerator.c345
-rw-r--r--gtk/gtkaccelerator.h72
-rw-r--r--gtk/gtkadjustment.c131
-rw-r--r--gtk/gtkadjustment.h78
-rw-r--r--gtk/gtkalignment.c194
-rw-r--r--gtk/gtkalignment.h72
-rw-r--r--gtk/gtkarrow.c166
-rw-r--r--gtk/gtkarrow.h66
-rw-r--r--gtk/gtkaspectframe.c345
-rw-r--r--gtk/gtkaspectframe.h75
-rw-r--r--gtk/gtkbbox.c233
-rw-r--r--gtk/gtkbbox.h99
-rw-r--r--gtk/gtkbin.c262
-rw-r--r--gtk/gtkbin.h60
-rw-r--r--gtk/gtkbox.c613
-rw-r--r--gtk/gtkbox.h106
-rw-r--r--gtk/gtkbutton.c909
-rw-r--r--gtk/gtkbutton.h76
-rw-r--r--gtk/gtkcheckbutton.c379
-rw-r--r--gtk/gtkcheckbutton.h66
-rw-r--r--gtk/gtkcheckmenuitem.c272
-rw-r--r--gtk/gtkcheckmenuitem.h72
-rw-r--r--gtk/gtkclist.c3784
-rw-r--r--gtk/gtkclist.h488
-rw-r--r--gtk/gtkcolorsel.c1476
-rw-r--r--gtk/gtkcolorsel.h149
-rw-r--r--gtk/gtkcombo.c541
-rw-r--r--gtk/gtkcombo.h91
-rw-r--r--gtk/gtkcontainer.h113
-rw-r--r--gtk/gtkcurve.c861
-rw-r--r--gtk/gtkcurve.h96
-rw-r--r--gtk/gtkdata.c74
-rw-r--r--gtk/gtkdata.h60
-rw-r--r--gtk/gtkdebug.h48
-rw-r--r--gtk/gtkdialog.c81
-rw-r--r--gtk/gtkdialog.h64
-rw-r--r--gtk/gtkdrawingarea.c149
-rw-r--r--gtk/gtkdrawingarea.h64
-rw-r--r--gtk/gtkeditable.c5
-rw-r--r--gtk/gtkeditable.h113
-rw-r--r--gtk/gtkentry.c47
-rw-r--r--gtk/gtkentry.h92
-rw-r--r--gtk/gtkenums.h216
-rw-r--r--gtk/gtkeventbox.c227
-rw-r--r--gtk/gtkeventbox.h57
-rw-r--r--gtk/gtkfilesel.c2571
-rw-r--r--gtk/gtkfilesel.h98
-rw-r--r--gtk/gtkfixed.c478
-rw-r--r--gtk/gtkfixed.h76
-rw-r--r--gtk/gtkframe.c505
-rw-r--r--gtk/gtkframe.h73
-rw-r--r--gtk/gtkgamma.c466
-rw-r--r--gtk/gtkgamma.h71
-rw-r--r--gtk/gtkgc.c382
-rw-r--r--gtk/gtkgc.h42
-rw-r--r--gtk/gtkhandlebox.c720
-rw-r--r--gtk/gtkhandlebox.h81
-rw-r--r--gtk/gtkhbbox.c273
-rw-r--r--gtk/gtkhbbox.h66
-rw-r--r--gtk/gtkhbox.c307
-rw-r--r--gtk/gtkhbox.h60
-rw-r--r--gtk/gtkhpaned.c359
-rw-r--r--gtk/gtkhpaned.h59
-rw-r--r--gtk/gtkhruler.c287
-rw-r--r--gtk/gtkhruler.h59
-rw-r--r--gtk/gtkhscale.c437
-rw-r--r--gtk/gtkhscale.h59
-rw-r--r--gtk/gtkhscrollbar.c392
-rw-r--r--gtk/gtkhscrollbar.h59
-rw-r--r--gtk/gtkhseparator.c91
-rw-r--r--gtk/gtkhseparator.h59
-rw-r--r--gtk/gtkimage.c185
-rw-r--r--gtk/gtkimage.h69
-rw-r--r--gtk/gtkinputdialog.c709
-rw-r--r--gtk/gtkinputdialog.h77
-rw-r--r--gtk/gtkitem.c192
-rw-r--r--gtk/gtkitem.h65
-rw-r--r--gtk/gtklabel.c371
-rw-r--r--gtk/gtklabel.h69
-rw-r--r--gtk/gtklist.c1040
-rw-r--r--gtk/gtklist.h102
-rw-r--r--gtk/gtklistitem.c397
-rw-r--r--gtk/gtklistitem.h62
-rw-r--r--gtk/gtkmain.c1603
-rw-r--r--gtk/gtkmain.h129
-rw-r--r--gtk/gtkmenu.c891
-rw-r--r--gtk/gtkmenu.h101
-rw-r--r--gtk/gtkmenubar.c311
-rw-r--r--gtk/gtkmenubar.h66
-rw-r--r--gtk/gtkmenufactory.c550
-rw-r--r--gtk/gtkmenufactory.h88
-rw-r--r--gtk/gtkmenuitem.c813
-rw-r--r--gtk/gtkmenuitem.h99
-rw-r--r--gtk/gtkmenushell.c605
-rw-r--r--gtk/gtkmenushell.h83
-rw-r--r--gtk/gtkmisc.c183
-rw-r--r--gtk/gtkmisc.h70
-rw-r--r--gtk/gtknotebook.c2952
-rw-r--r--gtk/gtknotebook.h136
-rw-r--r--gtk/gtkobject.c1653
-rw-r--r--gtk/gtkobject.h333
-rw-r--r--gtk/gtkoptionmenu.c643
-rw-r--r--gtk/gtkoptionmenu.h71
-rw-r--r--gtk/gtkpaned.c420
-rw-r--r--gtk/gtkpaned.h79
-rw-r--r--gtk/gtkpixmap.c203
-rw-r--r--gtk/gtkpixmap.h69
-rw-r--r--gtk/gtkpreview.c1631
-rw-r--r--gtk/gtkpreview.h151
-rw-r--r--gtk/gtkprivate.h70
-rw-r--r--gtk/gtkprogressbar.c260
-rw-r--r--gtk/gtkprogressbar.h64
-rw-r--r--gtk/gtkradiobutton.c333
-rw-r--r--gtk/gtkradiobutton.h65
-rw-r--r--gtk/gtkradiomenuitem.c246
-rw-r--r--gtk/gtkradiomenuitem.h64
-rw-r--r--gtk/gtkrange.c37
-rw-r--r--gtk/gtkrange.h146
-rw-r--r--gtk/gtkrc.c1425
-rw-r--r--gtk/gtkrc.h46
-rw-r--r--gtk/gtkruler.c308
-rw-r--r--gtk/gtkruler.h91
-rw-r--r--gtk/gtkscale.c213
-rw-r--r--gtk/gtkscale.h75
-rw-r--r--gtk/gtkscrollbar.c55
-rw-r--r--gtk/gtkscrollbar.h58
-rw-r--r--gtk/gtkscrolledwindow.c539
-rw-r--r--gtk/gtkscrolledwindow.h76
-rw-r--r--gtk/gtkselection.c2
-rw-r--r--gtk/gtkselection.h97
-rw-r--r--gtk/gtkseparator.c58
-rw-r--r--gtk/gtkseparator.h58
-rw-r--r--gtk/gtksignal.c1549
-rw-r--r--gtk/gtksignal.h166
-rw-r--r--gtk/gtkspinbutton.c1054
-rw-r--r--gtk/gtkspinbutton.h123
-rw-r--r--gtk/gtkstatusbar.c358
-rw-r--r--gtk/gtkstatusbar.h91
-rw-r--r--gtk/gtkstyle.c1791
-rw-r--r--gtk/gtkstyle.h220
-rw-r--r--gtk/gtktable.c1178
-rw-r--r--gtk/gtktable.h127
-rw-r--r--gtk/gtktext.c70
-rw-r--r--gtk/gtktext.h193
-rw-r--r--gtk/gtktipsquery.c543
-rw-r--r--gtk/gtktipsquery.h98
-rw-r--r--gtk/gtktogglebutton.c373
-rw-r--r--gtk/gtktogglebutton.h70
-rw-r--r--gtk/gtktoolbar.c951
-rw-r--r--gtk/gtktoolbar.h186
-rw-r--r--gtk/gtktooltips.c639
-rw-r--r--gtk/gtktooltips.h94
-rw-r--r--gtk/gtktree.c1187
-rw-r--r--gtk/gtktree.h121
-rw-r--r--gtk/gtktreeitem.c1069
-rw-r--r--gtk/gtktreeitem.h79
-rw-r--r--gtk/gtktypebuiltins.c59
-rw-r--r--gtk/gtktypebuiltins.h60
-rw-r--r--gtk/gtktypeutils.c511
-rw-r--r--gtk/gtktypeutils.h209
-rw-r--r--gtk/gtkvbbox.c276
-rw-r--r--gtk/gtkvbbox.h66
-rw-r--r--gtk/gtkvbox.c307
-rw-r--r--gtk/gtkvbox.h60
-rw-r--r--gtk/gtkviewport.c681
-rw-r--r--gtk/gtkviewport.h75
-rw-r--r--gtk/gtkvpaned.c360
-rw-r--r--gtk/gtkvpaned.h59
-rw-r--r--gtk/gtkvruler.c295
-rw-r--r--gtk/gtkvruler.h59
-rw-r--r--gtk/gtkvscale.c442
-rw-r--r--gtk/gtkvscale.h59
-rw-r--r--gtk/gtkvscrollbar.c391
-rw-r--r--gtk/gtkvscrollbar.h59
-rw-r--r--gtk/gtkvseparator.c91
-rw-r--r--gtk/gtkvseparator.h59
-rw-r--r--gtk/gtkwidget.c3997
-rw-r--r--gtk/gtkwidget.h540
-rw-r--r--gtk/gtkwindow.c1344
-rw-r--r--gtk/gtkwindow.h109
-rw-r--r--gtk/line-arrow.xbm4
-rw-r--r--gtk/line-wrap.xbm4
-rw-r--r--gtk/marble.xpm408
-rw-r--r--gtk/parent10
-rw-r--r--gtk/runelisp6
-rw-r--r--gtk/simple.c39
-rw-r--r--gtk/test.xpm92
-rw-r--r--gtk/testgtk.c5478
-rw-r--r--gtk/testgtkrc77
-rw-r--r--gtk/testinput.c393
-rw-r--r--gtk/testselection.c468
-rw-r--r--gtk/tree_minus.xbm5
-rw-r--r--gtk/tree_minus.xpm18
-rw-r--r--gtk/tree_plus.xbm5
-rw-r--r--gtk/tree_plus.xpm18
-rwxr-xr-xinstall-sh238
-rwxr-xr-xltconfig1418
-rw-r--r--ltmain.sh2372
-rwxr-xr-xmakecopyright124
-rwxr-xr-xmissing134
-rwxr-xr-xmkinstalldirs36
-rw-r--r--stamp-h.in1
-rw-r--r--tests/3DRings.xpm116
-rw-r--r--tests/FilesQueue.xpm98
-rw-r--r--tests/Modeller.xpm117
-rw-r--r--tests/circles.xbm46
-rw-r--r--tests/marble.xpm408
-rw-r--r--tests/simple.c39
-rw-r--r--tests/test.xpm92
-rw-r--r--tests/testgtk.c5478
-rw-r--r--tests/testgtkrc77
-rw-r--r--tests/testinput.c393
-rw-r--r--tests/testselection.c468
367 files changed, 293 insertions, 154893 deletions
diff --git a/.cvsignore b/.cvsignore
deleted file mode 100644
index f7cc4b6cb0..0000000000
--- a/.cvsignore
+++ /dev/null
@@ -1,13 +0,0 @@
-*.lo
-config.log
-config.h
-libtool
-config.status
-stamp-h
-Makefile
-Makefile.in
-aclocal.m4
-configure
-gtk+.xconfig
-config.cache
-
diff --git a/AUTHORS b/AUTHORS
deleted file mode 100644
index f1adbf18ab..0000000000
--- a/AUTHORS
+++ /dev/null
@@ -1,3 +0,0 @@
-Peter Mattis (petm@xcf.berkeley.edu)
-Spencer Kimball (spencer@xcf.berkeley.edu)
-Josh MacDonald (jmacd@xcf.berkeley.edu)
diff --git a/COPYING b/COPYING
deleted file mode 100644
index eb685a5ec9..0000000000
--- a/COPYING
+++ /dev/null
@@ -1,481 +0,0 @@
- GNU LIBRARY GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1991 Free Software Foundation, Inc.
- 675 Mass Ave, Cambridge, MA 02139, USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the library GPL. It is
- numbered 2 because it goes with version 2 of the ordinary GPL.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Library General Public License, applies to some
-specially designated Free Software Foundation software, and to any
-other libraries whose authors decide to use it. You can use it for
-your libraries, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if
-you distribute copies of the library, or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link a program with the library, you must provide
-complete object files to the recipients so that they can relink them
-with the library, after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- Our method of protecting your rights has two steps: (1) copyright
-the library, and (2) offer you this license which gives you legal
-permission to copy, distribute and/or modify the library.
-
- Also, for each distributor's protection, we want to make certain
-that everyone understands that there is no warranty for this free
-library. If the library is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original
-version, so that any problems introduced by others will not reflect on
-the original authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that companies distributing free
-software will individually obtain patent licenses, thus in effect
-transforming the program into proprietary software. To prevent this,
-we have made it clear that any patent must be licensed for everyone's
-free use or not licensed at all.
-
- Most GNU software, including some libraries, is covered by the ordinary
-GNU General Public License, which was designed for utility programs. This
-license, the GNU Library General Public License, applies to certain
-designated libraries. This license is quite different from the ordinary
-one; be sure to read it in full, and don't assume that anything in it is
-the same as in the ordinary license.
-
- The reason we have a separate public license for some libraries is that
-they blur the distinction we usually make between modifying or adding to a
-program and simply using it. Linking a program with a library, without
-changing the library, is in some sense simply using the library, and is
-analogous to running a utility program or application program. However, in
-a textual and legal sense, the linked executable is a combined work, a
-derivative of the original library, and the ordinary General Public License
-treats it as such.
-
- Because of this blurred distinction, using the ordinary General
-Public License for libraries did not effectively promote software
-sharing, because most developers did not use the libraries. We
-concluded that weaker conditions might promote sharing better.
-
- However, unrestricted linking of non-free programs would deprive the
-users of those programs of all benefit from the free status of the
-libraries themselves. This Library General Public License is intended to
-permit developers of non-free programs to use free libraries, while
-preserving your freedom as a user of such programs to change the free
-libraries that are incorporated in them. (We have not seen how to achieve
-this as regards changes in header files, but we have achieved it as regards
-changes in the actual functions of the Library.) The hope is that this
-will lead to faster development of free libraries.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, while the latter only
-works together with the library.
-
- Note that it is possible for a library to be covered by the ordinary
-General Public License rather than by this special one.
-
- GNU LIBRARY GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library which
-contains a notice placed by the copyright holder or other authorized
-party saying it may be distributed under the terms of this Library
-General Public License (also called "this License"). Each licensee is
-addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also compile or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- c) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- d) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the source code distributed need not include anything that is normally
-distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Library General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- Appendix: How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
diff --git a/ChangeLog b/ChangeLog
index d940555f65..0985f4d555 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,30 @@
+Tue Mar 10 14:24:09 1998 Owen Taylor <owt1@cornell.edu>
+
+ * gtk/gtkselection.c (gtk_selection_clear): Make the return
+ result reflect whether the clear event was out of data.
+
+ * gtk/gtkeditable.c: Ignore out of date selection clear
+ events.
+
+ * gtk/gtkentry.c gtk/gtktext.c: Don't synthesize releases
+ on [2/3]BUTTON presses, since we get the normal click as well.
+
+ Claim the selection when selecting words/lines.
+
+Tue Mar 10 13:34:29 1998 Owen Taylor <owt1@cornell.edu>
+
+ * gtk/gtkrange.c (gtk_range_default_[vh]trough_click):
+ Take forward/back step arrows into account when computing
+ position for middle button clicks.
+
+ * gtk/gtktext.c gtk/gtkentry.c:
+ - Fixes for deleting characters (don't subtract guints and get
+ negative numbers!)
+ - Reset cursor_virtual_x when moving by words and lines
+ - Extra sanity checks
+ - Fix to gtk_text_get_chars
+ (from Tony Gale <gale@daedalus.dera.gov.uk>)
+
Mon Mar 9 21:21:19 PST 1998 Shawn T. Amundson <amundson@gimp.org>
* Released 0.99.5
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index d940555f65..0985f4d555 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,30 @@
+Tue Mar 10 14:24:09 1998 Owen Taylor <owt1@cornell.edu>
+
+ * gtk/gtkselection.c (gtk_selection_clear): Make the return
+ result reflect whether the clear event was out of data.
+
+ * gtk/gtkeditable.c: Ignore out of date selection clear
+ events.
+
+ * gtk/gtkentry.c gtk/gtktext.c: Don't synthesize releases
+ on [2/3]BUTTON presses, since we get the normal click as well.
+
+ Claim the selection when selecting words/lines.
+
+Tue Mar 10 13:34:29 1998 Owen Taylor <owt1@cornell.edu>
+
+ * gtk/gtkrange.c (gtk_range_default_[vh]trough_click):
+ Take forward/back step arrows into account when computing
+ position for middle button clicks.
+
+ * gtk/gtktext.c gtk/gtkentry.c:
+ - Fixes for deleting characters (don't subtract guints and get
+ negative numbers!)
+ - Reset cursor_virtual_x when moving by words and lines
+ - Extra sanity checks
+ - Fix to gtk_text_get_chars
+ (from Tony Gale <gale@daedalus.dera.gov.uk>)
+
Mon Mar 9 21:21:19 PST 1998 Shawn T. Amundson <amundson@gimp.org>
* Released 0.99.5
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index d940555f65..0985f4d555 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,30 @@
+Tue Mar 10 14:24:09 1998 Owen Taylor <owt1@cornell.edu>
+
+ * gtk/gtkselection.c (gtk_selection_clear): Make the return
+ result reflect whether the clear event was out of data.
+
+ * gtk/gtkeditable.c: Ignore out of date selection clear
+ events.
+
+ * gtk/gtkentry.c gtk/gtktext.c: Don't synthesize releases
+ on [2/3]BUTTON presses, since we get the normal click as well.
+
+ Claim the selection when selecting words/lines.
+
+Tue Mar 10 13:34:29 1998 Owen Taylor <owt1@cornell.edu>
+
+ * gtk/gtkrange.c (gtk_range_default_[vh]trough_click):
+ Take forward/back step arrows into account when computing
+ position for middle button clicks.
+
+ * gtk/gtktext.c gtk/gtkentry.c:
+ - Fixes for deleting characters (don't subtract guints and get
+ negative numbers!)
+ - Reset cursor_virtual_x when moving by words and lines
+ - Extra sanity checks
+ - Fix to gtk_text_get_chars
+ (from Tony Gale <gale@daedalus.dera.gov.uk>)
+
Mon Mar 9 21:21:19 PST 1998 Shawn T. Amundson <amundson@gimp.org>
* Released 0.99.5
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index d940555f65..0985f4d555 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,30 @@
+Tue Mar 10 14:24:09 1998 Owen Taylor <owt1@cornell.edu>
+
+ * gtk/gtkselection.c (gtk_selection_clear): Make the return
+ result reflect whether the clear event was out of data.
+
+ * gtk/gtkeditable.c: Ignore out of date selection clear
+ events.
+
+ * gtk/gtkentry.c gtk/gtktext.c: Don't synthesize releases
+ on [2/3]BUTTON presses, since we get the normal click as well.
+
+ Claim the selection when selecting words/lines.
+
+Tue Mar 10 13:34:29 1998 Owen Taylor <owt1@cornell.edu>
+
+ * gtk/gtkrange.c (gtk_range_default_[vh]trough_click):
+ Take forward/back step arrows into account when computing
+ position for middle button clicks.
+
+ * gtk/gtktext.c gtk/gtkentry.c:
+ - Fixes for deleting characters (don't subtract guints and get
+ negative numbers!)
+ - Reset cursor_virtual_x when moving by words and lines
+ - Extra sanity checks
+ - Fix to gtk_text_get_chars
+ (from Tony Gale <gale@daedalus.dera.gov.uk>)
+
Mon Mar 9 21:21:19 PST 1998 Shawn T. Amundson <amundson@gimp.org>
* Released 0.99.5
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index d940555f65..0985f4d555 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,30 @@
+Tue Mar 10 14:24:09 1998 Owen Taylor <owt1@cornell.edu>
+
+ * gtk/gtkselection.c (gtk_selection_clear): Make the return
+ result reflect whether the clear event was out of data.
+
+ * gtk/gtkeditable.c: Ignore out of date selection clear
+ events.
+
+ * gtk/gtkentry.c gtk/gtktext.c: Don't synthesize releases
+ on [2/3]BUTTON presses, since we get the normal click as well.
+
+ Claim the selection when selecting words/lines.
+
+Tue Mar 10 13:34:29 1998 Owen Taylor <owt1@cornell.edu>
+
+ * gtk/gtkrange.c (gtk_range_default_[vh]trough_click):
+ Take forward/back step arrows into account when computing
+ position for middle button clicks.
+
+ * gtk/gtktext.c gtk/gtkentry.c:
+ - Fixes for deleting characters (don't subtract guints and get
+ negative numbers!)
+ - Reset cursor_virtual_x when moving by words and lines
+ - Extra sanity checks
+ - Fix to gtk_text_get_chars
+ (from Tony Gale <gale@daedalus.dera.gov.uk>)
+
Mon Mar 9 21:21:19 PST 1998 Shawn T. Amundson <amundson@gimp.org>
* Released 0.99.5
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index d940555f65..0985f4d555 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,30 @@
+Tue Mar 10 14:24:09 1998 Owen Taylor <owt1@cornell.edu>
+
+ * gtk/gtkselection.c (gtk_selection_clear): Make the return
+ result reflect whether the clear event was out of data.
+
+ * gtk/gtkeditable.c: Ignore out of date selection clear
+ events.
+
+ * gtk/gtkentry.c gtk/gtktext.c: Don't synthesize releases
+ on [2/3]BUTTON presses, since we get the normal click as well.
+
+ Claim the selection when selecting words/lines.
+
+Tue Mar 10 13:34:29 1998 Owen Taylor <owt1@cornell.edu>
+
+ * gtk/gtkrange.c (gtk_range_default_[vh]trough_click):
+ Take forward/back step arrows into account when computing
+ position for middle button clicks.
+
+ * gtk/gtktext.c gtk/gtkentry.c:
+ - Fixes for deleting characters (don't subtract guints and get
+ negative numbers!)
+ - Reset cursor_virtual_x when moving by words and lines
+ - Extra sanity checks
+ - Fix to gtk_text_get_chars
+ (from Tony Gale <gale@daedalus.dera.gov.uk>)
+
Mon Mar 9 21:21:19 PST 1998 Shawn T. Amundson <amundson@gimp.org>
* Released 0.99.5
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index d940555f65..0985f4d555 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,30 @@
+Tue Mar 10 14:24:09 1998 Owen Taylor <owt1@cornell.edu>
+
+ * gtk/gtkselection.c (gtk_selection_clear): Make the return
+ result reflect whether the clear event was out of data.
+
+ * gtk/gtkeditable.c: Ignore out of date selection clear
+ events.
+
+ * gtk/gtkentry.c gtk/gtktext.c: Don't synthesize releases
+ on [2/3]BUTTON presses, since we get the normal click as well.
+
+ Claim the selection when selecting words/lines.
+
+Tue Mar 10 13:34:29 1998 Owen Taylor <owt1@cornell.edu>
+
+ * gtk/gtkrange.c (gtk_range_default_[vh]trough_click):
+ Take forward/back step arrows into account when computing
+ position for middle button clicks.
+
+ * gtk/gtktext.c gtk/gtkentry.c:
+ - Fixes for deleting characters (don't subtract guints and get
+ negative numbers!)
+ - Reset cursor_virtual_x when moving by words and lines
+ - Extra sanity checks
+ - Fix to gtk_text_get_chars
+ (from Tony Gale <gale@daedalus.dera.gov.uk>)
+
Mon Mar 9 21:21:19 PST 1998 Shawn T. Amundson <amundson@gimp.org>
* Released 0.99.5
diff --git a/HACKING b/HACKING
deleted file mode 100644
index 22eaa0a0c2..0000000000
--- a/HACKING
+++ /dev/null
@@ -1,50 +0,0 @@
-If you want to hack on the Gtk+ project, it will make you life easier
-to have the following packages installed:
-
- - GNU autoconf 2.12
- - GNU automake 1.2d
- Available in ftp://ftp.cygnus.com/pub/tromey
- - GNU libtool 1.0h
- Available in ftp://alpha.gnu.org/gnu/
-
-These should be available by ftp from prep.ai.mit.edu or any of the
-fine GNU mirrors. Beta software can be found at alpha.gnu.org.
-
-If you are accessing gtk+ via CVS, then you will need to take several
-steps to get it to compile. You can do all these steps at once
-by running:
-
- cvsroot/gtk+# ./autogen.sh
-
-Basically this does the following for you:
-
- cvsroot/gtk+# aclocal; automake; autoconf
- cvsroot/gtk+/glib# aclocal; automake; autoconf
-
- The above commands create the "configure" script. Now you
- can run the configure script in cvsroot/gtk+ to create all
- the Makefiles. You only need to call "configure" in cvsroot/gtk+
- as the one in glib will be invoked automatically.
-
-Before running autogen.sh or configure, make sure you have libtool
-in your path.
-
-Note that autogen.sh runs configure for you. If you wish to pass
-options like --prefix=/usr to configure you can give those options
-to autogen.sh and they will be passed on to configure.
-
-If at all possible, please use CVS to get the latest development version of
-gtk+. You can do the following to get gtk+ from cvs:
-
- $ export CVSROOT=':pserver:anonymous@cvs.gimp.org:/debian/home/gnomecvs'
- $ cvs login
- (there is no password, just hit return)
- $ cvs -z9 checkout gtk+
-
-Please submit patches to the gtk-list@redhat.com mailing list (you must
-subscribe before you post, e-mail gtk-list-request@redhat.com with a
-subject of "subscribe"). All kinds of contributions are accepted.
-Patches that you wish to go into the distribution should also be uploaded
-to ftp://ftp.gimp.org/incoming. Follow the rules there for naming your
-patches.
-
diff --git a/INSTALL b/INSTALL
deleted file mode 100644
index 4fecd0a213..0000000000
--- a/INSTALL
+++ /dev/null
@@ -1,36 +0,0 @@
-The 'configure' script can be given a number of options to
-enable and disable various features. For a complete list,
-type:
- ./configure --help
-
-* --enable-xim support XIM [default=yes]
-
-Specifying --disable-xim will disable support for entering
-internationalized text using X Input Methods. This will give
-some slight savings in speed and memory use and might be necessary
-with older versions of X.
-
-* --with-locale=LOCALE locale name you want to use
-
-The --with-locale options is used to determine if your operating
-system has support for the locale you will be using. If not, X's built
-in locale support will be used.
-
-Because of bugs in autoconf, it is necessary to specify this option
-even if your LANG environment variable is correctly set.
-
-This option does not determine which locale GTK will use at
-runtime. That will be determined from the usual environment variables.
-If you will be using multiple locales with GTK, specify the one
-for which your operating system has the worst support for the
---with-locale option.
-
-
-Note for using XIM support with kinput2
----------------------------------------
-
-There is a bug in older versions of kinput2 that will cause
-GTK to hang when destroying a text entry. The latest versions
-of kinput is available from:
-
- ftp://ftp.sra.co.jp/pub/x11/kinput2
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index cb59e57a83..0000000000
--- a/Makefile.am
+++ /dev/null
@@ -1,33 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SRC_SUBDIRS = glib gdk gtk
-SUBDIRS = $(SRC_SUBDIRS) docs
-
-EXTRA_DIST = \
- gtk+.prj \
- makecopyright \
- TODO
-
-.PHONY: files populate checkin release
-
-files:
- @files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
- echo $$p; \
- done
- @for subdir in $(SUBDIRS); do \
- files=`cd $$subdir; $(MAKE) files | grep -v "make\[[1-9]\]"`; \
- for file in $$files; do \
- echo $$subdir/$$file; \
- done; \
- done
-
-populate:
- @echo "populating project"
- @files=`$(MAKE) files | grep -v "make\[[1-9]\]"`; prcs populate -d gtk+.prj $$files
-
-checkin: populate
- @echo "checking in project"
- @prcs checkin
-
-release:
- $(MAKE) dist distdir=$(PACKAGE)`date +"%y%m%d"`
diff --git a/Makefile.in b/Makefile.in
deleted file mode 100644
index cf35930636..0000000000
--- a/Makefile.in
+++ /dev/null
@@ -1,353 +0,0 @@
-# Makefile.in generated automatically by automake 1.2c from Makefile.am
-
-# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-
-SHELL = /bin/sh
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-bindir = @bindir@
-sbindir = @sbindir@
-libexecdir = @libexecdir@
-datadir = @datadir@
-sysconfdir = @sysconfdir@
-sharedstatedir = @sharedstatedir@
-localstatedir = @localstatedir@
-libdir = @libdir@
-infodir = @infodir@
-mandir = @mandir@
-includedir = @includedir@
-oldincludedir = /usr/include
-
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-
-top_builddir = .
-
-ACLOCAL = @ACLOCAL@
-AUTOCONF = @AUTOCONF@
-AUTOMAKE = @AUTOMAKE@
-AUTOHEADER = @AUTOHEADER@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-transform = @program_transform_name@
-
-NORMAL_INSTALL = true
-PRE_INSTALL = true
-POST_INSTALL = true
-NORMAL_UNINSTALL = true
-PRE_UNINSTALL = true
-POST_UNINSTALL = true
-host_alias = @host_alias@
-host_triplet = @host@
-CC = @CC@
-CPP = @CPP@
-LD = @LD@
-LIBTOOL = @LIBTOOL@
-LN_S = @LN_S@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-NM = @NM@
-PACKAGE = @PACKAGE@
-RANLIB = @RANLIB@
-VERSION = @VERSION@
-x_cflags = @x_cflags@
-x_includes = @x_includes@
-x_ldflags = @x_ldflags@
-x_libs = @x_libs@
-xinput_progs = @xinput_progs@
-
-SRC_SUBDIRS = glib gdk gtk
-SUBDIRS = $(SRC_SUBDIRS) docs
-
-EXTRA_DIST = gtk+.prj makecopyright TODO REFCOUNTING BUGS
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = config.h
-CONFIG_CLEAN_FILES = gtk+.xconfig
-DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
-Makefile.in NEWS TODO acconfig.h aclocal.m4 config.guess config.h.in \
-config.sub configure configure.in gtk+.xconfig.in install-sh ltconfig \
-ltmain.sh missing mkinstalldirs stamp-h.in
-
-
-DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-
-TAR = tar
-GZIP = --best
-default: all
-
-.SUFFIXES:
-$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
- cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile
-
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
- cd $(top_builddir) \
- && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
-
-$(ACLOCAL_M4): @MAINT@ configure.in
- cd $(srcdir) && $(ACLOCAL)
-
-config.status: $(srcdir)/configure
- $(SHELL) ./config.status --recheck
-$(srcdir)/configure: @MAINT@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
- cd $(srcdir) && $(AUTOCONF)
-
-config.h: stamp-h
- @:
-stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
- cd $(top_builddir) \
- && CONFIG_FILES= CONFIG_HEADERS=config.h \
- $(SHELL) ./config.status
- @echo timestamp > stamp-h
-$(srcdir)/config.h.in: @MAINT@$(srcdir)/stamp-h.in
-$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
- cd $(top_srcdir) && $(AUTOHEADER)
- @echo timestamp > $(srcdir)/stamp-h.in
-
-mostlyclean-hdr:
-
-clean-hdr:
-
-distclean-hdr:
- -rm -f config.h
-
-maintainer-clean-hdr:
-gtk+.xconfig: $(top_builddir)/config.status gtk+.xconfig.in
- cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
-
-# This directory's subdirectories are mostly independent; you can cd
-# into them and run `make' without going through this Makefile.
-# To change the values of `make' variables: instead of editing Makefiles,
-# (1) if the variable is set in `config.status', edit `config.status'
-# (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-
-@SET_MAKE@
-
-all-recursive install-data-recursive install-exec-recursive \
-installdirs-recursive install-recursive uninstall-recursive \
-check-recursive installcheck-recursive info-recursive dvi-recursive:
- @set fnord $(MAKEFLAGS); amf=$$2; \
- for subdir in $(SUBDIRS); do \
- target=`echo $@ | sed s/-recursive//`; \
- echo "Making $$target in $$subdir"; \
- (cd $$subdir && $(MAKE) $$target) \
- || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
- done && test -z "$$fail"
-
-mostlyclean-recursive clean-recursive distclean-recursive \
-maintainer-clean-recursive:
- @set fnord $(MAKEFLAGS); amf=$$2; \
- rev=''; for subdir in $(SUBDIRS); do rev="$$subdir $$rev"; done; \
- for subdir in $$rev; do \
- target=`echo $@ | sed s/-recursive//`; \
- echo "Making $$target in $$subdir"; \
- (cd $$subdir && $(MAKE) $$target) \
- || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
- done && test -z "$$fail"
-tags-recursive:
- list='$(SUBDIRS)'; for subdir in $$list; do \
- (cd $$subdir && $(MAKE) tags); \
- done
-
-tags: TAGS
-
-ID: $(HEADERS) $(SOURCES)
- here=`pwd` && cd $(srcdir) && mkid -f$$here/ID $(SOURCES) $(HEADERS)
-
-TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES)
- tags=; \
- here=`pwd`; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
- test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
- done; \
- test -z "$(ETAGS_ARGS)config.h.in$(SOURCES)$(HEADERS)$$tags" \
- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $(SOURCES) $(HEADERS) -o $$here/TAGS)
-
-mostlyclean-tags:
-
-clean-tags:
-
-distclean-tags:
- -rm -f TAGS ID
-
-maintainer-clean-tags:
-
-distdir = $(PACKAGE)-$(VERSION)
-top_distdir = $(distdir)
-
-# This target untars the dist file and tries a VPATH configuration. Then
-# it guarantees that the distribution is self-contained by making another
-# tarfile.
-distcheck: dist
- -rm -rf $(distdir)
- GZIP=$(GZIP) $(TAR) zxf $(distdir).tar.gz
- mkdir $(distdir)/=build
- mkdir $(distdir)/=inst
- dc_install_base=`cd $(distdir)/=inst && pwd`; \
- cd $(distdir)/=build \
- && ../configure --srcdir=.. --prefix=$$dc_install_base \
- && $(MAKE) \
- && $(MAKE) dvi \
- && $(MAKE) check \
- && $(MAKE) install \
- && $(MAKE) installcheck \
- && $(MAKE) dist
- -rm -rf $(distdir)
- @echo "========================"; \
- echo "$(distdir).tar.gz is ready for distribution"; \
- echo "========================"
-dist: distdir
- -chmod -R a+r $(distdir)
- GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir)
- -rm -rf $(distdir)
-dist-all: distdir
- -chmod -R a+r $(distdir)
- GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir)
- -rm -rf $(distdir)
-distdir: $(DISTFILES)
- -rm -rf $(distdir)
- mkdir $(distdir)
- -chmod 777 $(distdir)
- here=`cd $(top_builddir) && pwd`; \
- top_distdir=`cd $(distdir) && pwd`; \
- distdir=`cd $(distdir) && pwd`; \
- cd $(top_srcdir) \
- && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile
- @for file in $(DISTFILES); do \
- d=$(srcdir); \
- test -f $(distdir)/$$file \
- || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
- || cp -p $$d/$$file $(distdir)/$$file; \
- done
- for subdir in $(SUBDIRS); do \
- test -d $(distdir)/$$subdir \
- || mkdir $(distdir)/$$subdir \
- || exit 1; \
- chmod 777 $(distdir)/$$subdir; \
- (cd $$subdir && $(MAKE) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
- || exit 1; \
- done
-info: info-recursive
-dvi: dvi-recursive
-check: all-am
- $(MAKE) check-recursive
-installcheck: installcheck-recursive
-all-recursive-am: config.h
- $(MAKE) all-recursive
-
-all-am: Makefile config.h
-
-install-exec: install-exec-recursive
- @$(NORMAL_INSTALL)
-
-install-data: install-data-recursive
- @$(NORMAL_INSTALL)
-
-install: install-recursive
- @:
-
-uninstall: uninstall-recursive
-
-all: all-recursive-am all-am
-
-install-strip:
- $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
-installdirs: installdirs-recursive
-
-
-mostlyclean-generic:
- -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
-
-clean-generic:
- -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
-
-distclean-generic:
- -rm -f Makefile $(DISTCLEANFILES)
- -rm -f config.cache config.log stamp-h stamp-h[0-9]*
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
- -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
- -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic
-
-clean-am: clean-hdr clean-tags clean-generic mostlyclean-am
-
-distclean-am: distclean-hdr distclean-tags distclean-generic clean-am
-
-maintainer-clean-am: maintainer-clean-hdr maintainer-clean-tags \
- maintainer-clean-generic distclean-am
-
-mostlyclean: mostlyclean-recursive mostlyclean-am
-
-clean: clean-recursive clean-am
-
-distclean: distclean-recursive distclean-am
- -rm -f config.status
- -rm -f libtool
-
-maintainer-clean: maintainer-clean-recursive maintainer-clean-am
- @echo "This command is intended for maintainers to use;"
- @echo "it deletes files that may require special tools to rebuild."
- -rm -f config.status
-
-.PHONY: default mostlyclean-hdr distclean-hdr clean-hdr \
-maintainer-clean-hdr install-data-recursive uninstall-data-recursive \
-install-exec-recursive uninstall-exec-recursive installdirs-recursive \
-uninstalldirs-recursive all-recursive check-recursive \
-installcheck-recursive info-recursive dvi-recursive \
-mostlyclean-recursive distclean-recursive clean-recursive \
-maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
-distclean-tags clean-tags maintainer-clean-tags distdir info dvi \
-installcheck all-recursive-am all-am install-exec install-data install \
-uninstall all installdirs mostlyclean-generic distclean-generic \
-clean-generic maintainer-clean-generic clean mostlyclean distclean \
-maintainer-clean
-
-
-.PHONY: files populate checkin release
-
-files:
- @files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
- echo $$p; \
- done
- @for subdir in $(SUBDIRS); do \
- files=`cd $$subdir; $(MAKE) files | grep -v "make\[[1-9]\]"`; \
- for file in $$files; do \
- echo $$subdir/$$file; \
- done; \
- done
-
-populate:
- @echo "populating project"
- @files=`$(MAKE) files | grep -v "make\[[1-9]\]"`; prcs populate -d gtk+.prj $$files
-
-checkin: populate
- @echo "checking in project"
- @prcs checkin
-
-release:
- $(MAKE) dist distdir=$(PACKAGE)`date +"%y%m%d"`
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/NEWS b/NEWS
deleted file mode 100644
index 893d4cd478..0000000000
--- a/NEWS
+++ /dev/null
@@ -1,77 +0,0 @@
-Overview of Fixes in GTK+ 0.99.5:
-
-* Signal signedness and naming corrections
-* rc/style fixes
-* text, entry widget fixes
-* gtkeditable fixes
-* scrollbar flickering fixed
-* check casts are more descriptive
-* DND fixes
-* FAQ updates
-* Bug fixes
-
-Overview of Changes in GTK+ 0.99.4:
-
-* Reference counting revolution integrated.
- Refer to docs/refcounting.txt on this issue.
-* Implementation of a decent debugging system, you would want
- to export GTK_DEBUG=objects if you are going to develop gtk applications,
- refer to docs/debugging.txt for further information.
-* Additions on the signal code for querying information about certain signals,
- and pending handlers of signals.
-* Support for user signals, and major changes to internal signal handler
- handling for proper signal removal and invokation of after signals.
-* Additional signals for various widgets e.g, GtkHandleBox::child_attached,
- GtkHandleBox::child_detached, GtkWidget::style_set, GtkWidget::parent_set.
-* GtkTooltips became a true descendant of GtkObject via derivation from
- GtkData and facilitates an extra tip string which can be used as e.g. an
- index into context help.
-* Split up of the widget/object flags into a private and a public portion,
- consult docs/widget_system.txt on this.
-* Support for hot keys on gtk programs via gtk_key_snooper_install().
-* Reimplementation of the *_interp functions as *_full functions to provide
- simple callback functions as well.
-* Idle functions are now prioritized.
-* Many enhancements to GtkNotebook.
-* New widget GtkSpinButton, check out testgtk.
-* New widget GtkTipsQuery for letting the user query tooltips of widgets.
-* Addition of GtkEditable base widget to encapsulate selection and
- clipboard handling. (GtkEntry and GtkText use this)
-* Text widget more complete.
-* Additions to GtkStatusBar to make it complete.
-* Gdk now supports regions.
-* Access masks for widget arguments (GTK_ARG_READABLE/GTK_ARG_WRITABLE).
-* Function replacements:
- g_string_hash() -> g_str_hash()
- g_string_equal() -> g_str_equal()
- gtk_tooltips_set_tips() -> gtk_tooltips_set_tip()
-* Support for quit handlers in gtk_main().
-* Motif window mangaer hints support.
-* Widget arguments are now flagged for readability/writability.
-* Additions to documentation.
-* Various FAQ updates. (FAQ now included)
-* Clean ups and many many bug fixes by a lot of people all over the place.
-* New, long and descriptive ChangeLog entries for bored readers ;)
-
-Overview of Changes in GTK+ 0.99.3:
-
-* Filesel enhancement / stability changes
-* New widget, gtkcombo
-* Widgets in the toolbar do not get the focus
-* New widget, gtkstatusbar (still in-progress)
-* g_string_equal renamed g_str_equal
-* g_string_hash renamed g_str_hash
-* new gtkbox functions to allow modification of the child
- linkage after the widget tree is setup
-* gtk_*_get_arg() and gtk_*_set_arg() fixes and implementations
-* DND changes/fixes
-* Entry widget now has set_max_length function
-* Handlebox widget changes/fixes
-* Some work on text widget (still in-progress)
-* Now the toolbar supports arbitrary widgets as well
-* CList has resizable columns again
-* CList now looks consistant with scrolled windows
-* Remove flickering from entry widget
-* Added switch_page signal to notebook widget
-* Documentation additions
-* Other bug fixes...
diff --git a/README b/README
deleted file mode 100644
index 8dc36f8eac..0000000000
--- a/README
+++ /dev/null
@@ -1,18 +0,0 @@
-
-This is GTK+ version 0.99.5. GTK, which stands for the Gimp ToolKit,
-is a library for creating graphical user interfaces.
-
-The official ftp site is:
- ftp://ftp.gimp.org/pub/gtk
-
-The official web site is:
- http://www.gimp.org/gtk
-
-Patches can be uploaded to:
- ftp://ftp.gimp.org/incoming
-
-A mailing list is located at:
- gtk-list@redhat.com
-
-To subscribe: mail -s subscribe gtk-list-request@redhat.com < /dev/null
-(Send mail to gtk-list-request@redhat.com with the subject "subscribe")
diff --git a/TODO b/TODO
deleted file mode 100644
index ffb1e5a8c1..0000000000
--- a/TODO
+++ /dev/null
@@ -1,229 +0,0 @@
-TODO BEFORE GTK 1.0
--------------------
-
-Bugs:
- * pasting into a GtkEntry that already has a very long string,
- causes the app to hang.
-
- * Vertical scrollbar: the expose event looks hosed and is causing
- quite a bit of flickering
- Actually this affects both scrollbar implementation, you can best
- tell if you run the application with --sync (timj)
-
- * signal parameters don't seem to get refreshed on recursive invokations
- of GTK_NO_RECURSE signals, which causes the restarted emissions to loose
- their actual point, i.e. parameter changes on the restarted emission,
- needs further investigation.
-
- * Widget redrawing when the window resizes sometimes messes up.
- GtkLabels sometimes redraw without clearing up the underlying background on
- window resizes.
-
- * Are there still some GtkCList changes outstanding? (Jay Painter)
- GtkCList is derived from GtkContainer but doesn't implement the
- need_resize, focus, add and remove methods from containers.
- it should at least issue a warning upon invokation of not supported
- member functions.
-
- * GtkTree and GtkList should express in their *_add implementations,
- that they expect GtkListItems/GtkTreeItems as children. Similar
- things might apply to other containers.
-
- * delay dnd settings to take effect once a widget is realized, this is
- to avoid force realizations. i think this goes along with owens dnd
- changes?
- -timj
- The way DND data types are set in GtkWidget really needs to be fixed.
- This is pretty high on my priority list, and I'll get to it as soon as
- the column list widget is done. The correct way dnd data needs to be set
- is to have a additional keyed data type with GtkWidget, which is applied to
- the widget's window upon realize.
- There also needs to be a way to set dnd-data on widget windows which are
- not the main window (for widgets that create more than one window).
- -Jay Painter
- DnD seems to work for me, but yes, there needs to be some sort of
- gtk_widget layer that makes it easier... Also, adding support for drop
- zones might be nice.
- -Elliot
- This one is reproducabel for me:
- testgtk --sync
- popup colorselection
- drag/drop works
- start up preview color
- drag works but not dropping
- end preview color
- drag/drop works
- start up prewiev color
- segfault in malloc
- -timj
-
- * Change bitfields to guints from enums for C++ ?
-
- * Force paned window handle to be kept on screen
-
-Additions:
- * widgets which are redrawn because of a gtk_widget_draw(,NULL) should
- be removed from the redraw queue.
-
- * GScanner: it might be good to ues stdio and getch() instead of 1-character
- reads. so one can take advantage of buffering. Currently each read() takes
- a separate syscall.
-
- * implement gtk_default_draw_oval
-
- * Lists should scroll to center the recently selected item if it isn't
- visible.
-
- * enforce invariants on *_RESIZE* and *_REDRAW* flags.
-
- * asure that child widgets are really get gtk_widget_destroy()ed in their
- parents destroy handler, and not just unparented or somesuch.
-
- * GtkToolTips:
- allocate GtkTooltipsData from memchunks
- look into incorporation of outdated/gtk-dairiki-971208-[01].patch.gz
-
- * Make widget attributes configurable after the widget is created (timj).
-
- * Change gtk_widget_propagate_default_style() mechanism to
- void gtk_rc_string_export (const gchar *rc_additions,
- gboolean override_rc_styles);
-
- * Configure events for windows that no longer exist fail in
- XTranslateCoordinates
-
-TODO AFTER GTK 1.0
-------------------
-
- * Make all widget attributes configurable after the widget is created (timj).
-
- * Seperate GtkObject and signaling system from Gdk dependancies?
-
- * move *_input_add (wrappers for select(2)) mechanism into glib.
-
- * Make sure a widget added to a list is a list item and a widget added
- to a menu is a menu item, etc. GTK_BASIC was a first attempt at this,
- but it fails with subsequent container_add()s. maybe have another
- GTK_PARENT_BASIC (similar to GTK_PARENT_SENSITIVE) flag, to prevent
- tree iterations upon every container addition.
-
- * gdk_expose_compress: ala-Xt, this would really help for opaque moves and
- such
-
- * Entry should have a password mode (and it should show stars
- for user feedback).
-
- * More dialogs: Print, GtkFontSelector, maybe others...
-
- * Multiple document interface (MDI)?
-
- * Support another widget style? Should be possible using GtkStyle's, but
- there may be some work needed to remove any style dependencies in widget
- code. Maybe GtkStyle's should have 'draw_push_button', 'draw_check_button',
- etc, functions to draw the various widgets.
- This will be covered by upcoming themability, raster is working on it.
-
- * make the gtk_main callbacks consistent in their add/remove behaviour.
-
- * More work on Documentation
-
- * Check return values on all calls to XIC[Get/Set]Values
-
- * Rewrite the interface to the i18n stuff so GTK widgets don't need to
- retrieve X values, and so they don't have to know the value of the
- XNxxx character constants.
-
- * The "-geometry" option should be supported
-
- - Having gdk_init() parse the geometry option. (putting it into
- GDK means you can use XParseGeometry() without wrapping it)
-
- - Add a call gdk_get_geometry() that retrieves the results
- in a form like that returned by XParseGeometry()
-
- - The application then can modify the results (as would gemvt)
- then call a routine gtk_window_set_geometry() on whatever
- it considers to be its main window.
-
- - Then in some manner GtkWindow takes that into account when
- setting its hints. (Probably it uses the size and position
- as the current uposition and usize, and modulates that
- be the equivalents of the X flags
-
- XValue, YValue, WidthValue, HeightValue, XNegative, or YNegative
-
- ( You'd have to extend gdk_window_set_hints to accept the
- window gravity option to get it right. )
-
- * Text/Edit widget: (some of these might be bugs that should be fixed now)
-
- Bugs:
-
- - Who knows?
-
- Improvements:
-
- - Unify the key binding support in some fashion between the
- Entry and Text widget widgets (???)
-
- - Figure out a way not to recompute the geometry on insertions/deletions
- which are large, but not a significant fraction of the
- entire text. (e.g., compute the changes as when the widget
- is not frozen, but without the actual scrolling)
-
- - Prune the line start cache. But since it is only 68 bytes
- per line, and it is a lot faster when lines are in the cache,
- it may be better not to, at least for now.
-
- - Show the non-editable state by changing colors. (Use the
- style entries for insensitive?)
-
- - Multibyte support for the Text widget.
-
- - Unicode support to do the multi-byte right.
-
- - Support an .inputrc. (The readline one doesn't really work,
- unless it is extended because it can't represent X keysyms,
- just terminal type input)
-
- - A vi mode
-
- - Word wrap, instead of line folding. (Should the continuation
- characters be shown?)
-
- - Horizontal scrolling
-
- - Disable pasting compound text
-
- - When showing background pixmap (not editable) actually set
- the background pixmap as the windows bg pixmap, to improve
- appearance on exposes. But this would require using another
- window to get the origins.
-
- ? Allow moving the separator for paned widgets by dragging
- it directly instead of using the handle.
-
- ? Mark public use of gtk_tree_remove_item as deprecated - it should be used
- as:
- gtk_container_remove (GTK_CONTAINER(tree), widget);
-
- * Standardize that all strings should be passed as gchar *, not
- guchar *. But what about non-string data? (gdk_property_change,
- gtk_selection_data_set) X makes these sort of things guchar...
-
- * Check into XAddConnectionWatch - is this needed for XIM?
-
- * Places where a _full variant is needed:
-
- gtk_clist_set_row_data
- gtk_init_add
- gtk_menu_popup
- gtk_toolbar_prepend_element
- gtk_toolbar_insert_element
- gtk_widget_dnd_data_set (should be guchar * with a copy?
- shouldn't be there at all...)
- ??? GtkDrawingarea.draw_data
-
- * gtk_rc_add_[name/class]_style are broken for bg pixmaps, because
- styles are broken for bg pixmaps, and RC styles only hack around
- that.
diff --git a/acconfig.h b/acconfig.h
deleted file mode 100644
index f4393880cc..0000000000
--- a/acconfig.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* acconfig.h
- This file is in the public domain.
-
- Descriptive text for the C preprocessor macros that
- the distributed Autoconf macros can define.
- No software package will use all of them; autoheader copies the ones
- your configure.in uses into your configuration header file templates.
-
- The entries are in sort -df order: alphabetical, case insensitive,
- ignoring punctuation (such as underscores). Although this order
- can split up related entries, it makes it easier to check whether
- a given entry is in the file.
-
- Leave the following blank line there!! Autoheader needs it. */
-
-
-/* Other stuff */
-#undef HAVE_IPC_H
-#undef HAVE_SHM_H
-#undef HAVE_XPM
-#undef HAVE_XSHM_H
-#undef HAVE_SYS_SELECT_H
-
-#undef IPC_RMID_DEFERRED_RELEASE
-
-#undef NO_FD_SET
-
-#undef RESOURCE_BASE
-
-#undef XINPUT_NONE
-#undef XINPUT_GXI
-#undef XINPUT_XFREE
-
-#undef GTK_MAJOR_VERSION
-#undef GTK_MINOR_VERSION
-#undef GTK_MICRO_VERSION
-#undef GTK_VERSION
-
-/* Define as the return type of signal handlers (int or void). */
-#undef RETSIGTYPE
-
-/* Most machines will be happy with int or void. IRIX requires '...' */
-#undef SIGNAL_ARG_TYPE
-
-/* #undef PACKAGE */
-/* #undef VERSION */
-
-
-/* Leave that blank line there!! Autoheader needs it.
- If you're adding to this file, keep in mind:
- The entries are in sort -df order: alphabetical, case insensitive,
- ignoring punctuation (such as underscores). */
diff --git a/autogen.sh b/autogen.sh
deleted file mode 100755
index c298ddee64..0000000000
--- a/autogen.sh
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/sh
-# Run this to generate all the initial makefiles, etc.
-
-DIE=0
-
-(autoconf --version) < /dev/null > /dev/null 2>&1 || {
- echo
- echo "You must have autoconf installed to compile GTK+."
- echo "Download the appropriate package for your distribution,"
- echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
- DIE=1
-}
-
-(libtool --version) < /dev/null > /dev/null 2>&1 || {
- echo
- echo "You must have libtool installed to compile GTK+."
- echo "Get ftp://alpha.gnu.org/gnu/libtool-1.0h.tar.gz"
- echo "(or a newer version if it is available)"
- DIE=1
-}
-
-(automake --version) < /dev/null > /dev/null 2>&1 || {
- echo
- echo "You must have automake installed to compile GTK+."
- echo "Get ftp://ftp.cygnus.com/pub/home/tromey/automake-1.2d.tar.gz"
- echo "(or a newer version if it is available)"
- DIE=1
-}
-
-if test "$DIE" -eq 1; then
- exit 1
-fi
-
-(test -d gtk && test -d glib) || {
- echo "You must run this script in the top-level GTK+ directory"
- exit 1
-}
-
-if test -z "$*"; then
- echo "I am going to run ./configure with no arguments - if you wish "
- echo "to pass any to it, please specify them on the $0 command line."
-fi
-
-for i in glib .
-do
- echo processing $i
- (cd $i; aclocal; automake; autoconf)
-done
-./configure "$@"
-
-echo
-echo "Now type 'make' to compile GTK+."
diff --git a/config.guess b/config.guess
deleted file mode 100755
index 413ed41c0f..0000000000
--- a/config.guess
+++ /dev/null
@@ -1,883 +0,0 @@
-#! /bin/sh
-# Attempt to guess a canonical system name.
-# Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
-#
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# Written by Per Bothner <bothner@cygnus.com>.
-# The master version of this file is at the FSF in /home/gd/gnu/lib.
-#
-# This script attempts to guess a canonical system name similar to
-# config.sub. If it succeeds, it prints the system name on stdout, and
-# exits with 0. Otherwise, it exits with 1.
-#
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit system type (host/target name).
-#
-# Only a few systems have been added to this list; please add others
-# (but try to keep the structure clean).
-#
-
-# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 8/24/94.)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
- PATH=$PATH:/.attbin ; export PATH
-fi
-
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-
-trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
-
-# Note: order is significant - the case branches are not exclusive.
-
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
- alpha:OSF1:*:*)
- if test $UNAME_RELEASE = "V4.0"; then
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
- fi
- # A Vn.n version is a released version.
- # A Tn.n version is a released field test version.
- # A Xn.n version is an unreleased experimental baselevel.
- # 1.2 uses "1.2" for uname -r.
- cat <<EOF >dummy.s
- .globl main
- .ent main
-main:
- .frame \$30,0,\$26,0
- .prologue 0
- .long 0x47e03d80 # implver $0
- lda \$2,259
- .long 0x47e20c21 # amask $2,$1
- srl \$1,8,\$2
- sll \$2,2,\$2
- sll \$0,3,\$0
- addl \$1,\$0,\$0
- addl \$2,\$0,\$0
- ret \$31,(\$26),1
- .end main
-EOF
- ${CC-cc} dummy.s -o dummy 2>/dev/null
- if test "$?" = 0 ; then
- ./dummy
- case "$?" in
- 7)
- UNAME_MACHINE="alpha"
- ;;
- 15)
- UNAME_MACHINE="alphaev5"
- ;;
- 14)
- UNAME_MACHINE="alphaev56"
- ;;
- 10)
- UNAME_MACHINE="alphapca56"
- ;;
- 16)
- UNAME_MACHINE="alphaev6"
- ;;
- esac
- fi
- rm -f dummy.s dummy
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]`
- exit 0 ;;
- 21064:Windows_NT:50:3)
- echo alpha-dec-winnt3.5
- exit 0 ;;
- Amiga*:UNIX_System_V:4.0:*)
- echo m68k-cbm-sysv4
- exit 0;;
- amiga:NetBSD:*:*)
- echo m68k-cbm-netbsd${UNAME_RELEASE}
- exit 0 ;;
- amiga:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- arc64:OpenBSD:*:*)
- echo mips64el-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- arc:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- hkmips:OpenBSD:*:*)
- echo mips-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- pmax:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- sgi:OpenBSD:*:*)
- echo mips-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- wgrisc:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
- echo arm-acorn-riscix${UNAME_RELEASE}
- exit 0;;
- arm32:NetBSD:*:*)
- echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- exit 0 ;;
- SR2?01:HI-UX/MPP:*:*)
- echo hppa1.1-hitachi-hiuxmpp
- exit 0;;
- Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
- # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
- if test "`(/bin/universe) 2>/dev/null`" = att ; then
- echo pyramid-pyramid-sysv3
- else
- echo pyramid-pyramid-bsd
- fi
- exit 0 ;;
- NILE:*:*:dcosx)
- echo pyramid-pyramid-svr4
- exit 0 ;;
- sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
- echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- i86pc:SunOS:5.*:*)
- echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- sun4*:SunOS:6*:*)
- # According to config.sub, this is the proper way to canonicalize
- # SunOS6. Hard to guess exactly what SunOS6 will be like, but
- # it's likely to be more like Solaris than SunOS4.
- echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- sun4*:SunOS:*:*)
- case "`/usr/bin/arch -k`" in
- Series*|S4*)
- UNAME_RELEASE=`uname -v`
- ;;
- esac
- # Japanese Language versions have a version number like `4.1.3-JL'.
- echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
- exit 0 ;;
- sun3*:SunOS:*:*)
- echo m68k-sun-sunos${UNAME_RELEASE}
- exit 0 ;;
- sun*:*:4.2BSD:*)
- UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
- test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
- case "`/bin/arch`" in
- sun3)
- echo m68k-sun-sunos${UNAME_RELEASE}
- ;;
- sun4)
- echo sparc-sun-sunos${UNAME_RELEASE}
- ;;
- esac
- exit 0 ;;
- aushp:SunOS:*:*)
- echo sparc-auspex-sunos${UNAME_RELEASE}
- exit 0 ;;
- atari*:NetBSD:*:*)
- echo m68k-atari-netbsd${UNAME_RELEASE}
- exit 0 ;;
- atari*:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- sun3*:NetBSD:*:*)
- echo m68k-sun-netbsd${UNAME_RELEASE}
- exit 0 ;;
- sun3*:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mac68k:NetBSD:*:*)
- echo m68k-apple-netbsd${UNAME_RELEASE}
- exit 0 ;;
- mac68k:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvme68k:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvme88k:OpenBSD:*:*)
- echo m88k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- powerpc:machten:*:*)
- echo powerpc-apple-machten${UNAME_RELEASE}
- exit 0 ;;
- RISC*:Mach:*:*)
- echo mips-dec-mach_bsd4.3
- exit 0 ;;
- RISC*:ULTRIX:*:*)
- echo mips-dec-ultrix${UNAME_RELEASE}
- exit 0 ;;
- VAX*:ULTRIX*:*:*)
- echo vax-dec-ultrix${UNAME_RELEASE}
- exit 0 ;;
- 2020:CLIX:*:*)
- echo clipper-intergraph-clix${UNAME_RELEASE}
- exit 0 ;;
- mips:*:*:UMIPS | mips:*:*:RISCos)
- sed 's/^ //' << EOF >dummy.c
- int main (argc, argv) int argc; char **argv; {
- #if defined (host_mips) && defined (MIPSEB)
- #if defined (SYSTYPE_SYSV)
- printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_SVR4)
- printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
- printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
- #endif
- #endif
- exit (-1);
- }
-EOF
- ${CC-cc} dummy.c -o dummy \
- && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
- && rm dummy.c dummy && exit 0
- rm -f dummy.c dummy
- echo mips-mips-riscos${UNAME_RELEASE}
- exit 0 ;;
- Night_Hawk:Power_UNIX:*:*)
- echo powerpc-harris-powerunix
- exit 0 ;;
- m88k:CX/UX:7*:*)
- echo m88k-harris-cxux7
- exit 0 ;;
- m88k:*:4*:R4*)
- echo m88k-motorola-sysv4
- exit 0 ;;
- m88k:*:3*:R3*)
- echo m88k-motorola-sysv3
- exit 0 ;;
- AViiON:dgux:*:*)
- # DG/UX returns AViiON for all architectures
- UNAME_PROCESSOR=`/usr/bin/uname -p`
- if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
- if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
- -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
- echo m88k-dg-dgux${UNAME_RELEASE}
- else
- echo m88k-dg-dguxbcs${UNAME_RELEASE}
- fi
- else echo i586-dg-dgux${UNAME_RELEASE}
- fi
- exit 0 ;;
- M88*:DolphinOS:*:*) # DolphinOS (SVR3)
- echo m88k-dolphin-sysv3
- exit 0 ;;
- M88*:*:R3*:*)
- # Delta 88k system running SVR3
- echo m88k-motorola-sysv3
- exit 0 ;;
- XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
- echo m88k-tektronix-sysv3
- exit 0 ;;
- Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
- echo m68k-tektronix-bsd
- exit 0 ;;
- *:IRIX*:*:*)
- echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
- exit 0 ;;
- ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
- exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
- i?86:AIX:*:*)
- echo i386-ibm-aix
- exit 0 ;;
- *:AIX:2:3)
- if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
- sed 's/^ //' << EOF >dummy.c
- #include <sys/systemcfg.h>
-
- main()
- {
- if (!__power_pc())
- exit(1);
- puts("powerpc-ibm-aix3.2.5");
- exit(0);
- }
-EOF
- ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
- rm -f dummy.c dummy
- echo rs6000-ibm-aix3.2.5
- elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
- echo rs6000-ibm-aix3.2.4
- else
- echo rs6000-ibm-aix3.2
- fi
- exit 0 ;;
- *:AIX:*:4)
- if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
- IBM_ARCH=rs6000
- else
- IBM_ARCH=powerpc
- fi
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=4.${UNAME_RELEASE}
- fi
- echo ${IBM_ARCH}-ibm-aix${IBM_REV}
- exit 0 ;;
- *:AIX:*:*)
- echo rs6000-ibm-aix
- exit 0 ;;
- ibmrt:4.4BSD:*|romp-ibm:BSD:*)
- echo romp-ibm-bsd4.4
- exit 0 ;;
- ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
- echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
- exit 0 ;; # report: romp-ibm BSD 4.3
- *:BOSX:*:*)
- echo rs6000-bull-bosx
- exit 0 ;;
- DPX/2?00:B.O.S.:*:*)
- echo m68k-bull-sysv3
- exit 0 ;;
- 9000/[34]??:4.3bsd:1.*:*)
- echo m68k-hp-bsd
- exit 0 ;;
- hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
- echo m68k-hp-bsd4.4
- exit 0 ;;
- 9000/[3478]??:HP-UX:*:*)
- case "${UNAME_MACHINE}" in
- 9000/31? ) HP_ARCH=m68000 ;;
- 9000/[34]?? ) HP_ARCH=m68k ;;
- 9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;;
- 9000/8?? ) HP_ARCH=hppa1.0 ;;
- esac
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- echo ${HP_ARCH}-hp-hpux${HPUX_REV}
- exit 0 ;;
- 3050*:HI-UX:*:*)
- sed 's/^ //' << EOF >dummy.c
- #include <unistd.h>
- int
- main ()
- {
- long cpu = sysconf (_SC_CPU_VERSION);
- /* The order matters, because CPU_IS_HP_MC68K erroneously returns
- true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
- results, however. */
- if (CPU_IS_PA_RISC (cpu))
- {
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
- default: puts ("hppa-hitachi-hiuxwe2"); break;
- }
- }
- else if (CPU_IS_HP_MC68K (cpu))
- puts ("m68k-hitachi-hiuxwe2");
- else puts ("unknown-hitachi-hiuxwe2");
- exit (0);
- }
-EOF
- ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
- rm -f dummy.c dummy
- echo unknown-hitachi-hiuxwe2
- exit 0 ;;
- 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
- echo hppa1.1-hp-bsd
- exit 0 ;;
- 9000/8??:4.3bsd:*:*)
- echo hppa1.0-hp-bsd
- exit 0 ;;
- hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
- echo hppa1.1-hp-osf
- exit 0 ;;
- hp8??:OSF1:*:*)
- echo hppa1.0-hp-osf
- exit 0 ;;
- i?86:OSF1:*:*)
- if [ -x /usr/sbin/sysversion ] ; then
- echo ${UNAME_MACHINE}-unknown-osf1mk
- else
- echo ${UNAME_MACHINE}-unknown-osf1
- fi
- exit 0 ;;
- parisc*:Lites*:*:*)
- echo hppa1.1-hp-lites
- exit 0 ;;
- C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
- echo c1-convex-bsd
- exit 0 ;;
- C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit 0 ;;
- C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
- echo c34-convex-bsd
- exit 0 ;;
- C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
- echo c38-convex-bsd
- exit 0 ;;
- C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
- echo c4-convex-bsd
- exit 0 ;;
- CRAY*X-MP:*:*:*)
- echo xmp-cray-unicos
- exit 0 ;;
- CRAY*Y-MP:*:*:*)
- echo ymp-cray-unicos${UNAME_RELEASE}
- exit 0 ;;
- CRAY*[A-Z]90:*:*:*)
- echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
- | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
- -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
- exit 0 ;;
- CRAY*TS:*:*:*)
- echo t90-cray-unicos${UNAME_RELEASE}
- exit 0 ;;
- CRAY-2:*:*:*)
- echo cray2-cray-unicos
- exit 0 ;;
- F300:UNIX_System_V:*:*)
- FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
- echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit 0 ;;
- F301:UNIX_System_V:*:*)
- echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
- exit 0 ;;
- hp3[0-9][05]:NetBSD:*:*)
- echo m68k-hp-netbsd${UNAME_RELEASE}
- exit 0 ;;
- hp300:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- i?86:BSD/386:*:* | *:BSD/OS:*:*)
- echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
- exit 0 ;;
- *:FreeBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
- exit 0 ;;
- *:NetBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- exit 0 ;;
- *:OpenBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- exit 0 ;;
- i*:CYGWIN*:*)
- echo i386-pc-cygwin32
- exit 0 ;;
- i*:MINGW*:*)
- echo i386-pc-mingw32
- exit 0 ;;
- p*:CYGWIN*:*)
- echo powerpcle-unknown-cygwin32
- exit 0 ;;
- prep*:SunOS:5.*:*)
- echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- *:GNU:*:*)
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
- exit 0 ;;
- *:Linux:*:*)
- # The BFD linker knows what the default object file format is, so
- # first see if it will tell us.
- ld_help_string=`ld --help 2>&1`
- ld_supported_emulations=`echo $ld_help_string \
- | sed -ne '/supported emulations:/!d
- s/[ ][ ]*/ /g
- s/.*supported emulations: *//
- s/ .*//
- p'`
- case "$ld_supported_emulations" in
- i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;;
- i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;;
- sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
- m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
- elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;;
- esac
-
- if test "${UNAME_MACHINE}" = "alpha" ; then
- sed 's/^ //' <<EOF >dummy.s
- .globl main
- .ent main
- main:
- .frame \$30,0,\$26,0
- .prologue 0
- .long 0x47e03d80 # implver $0
- lda \$2,259
- .long 0x47e20c21 # amask $2,$1
- srl \$1,8,\$2
- sll \$2,2,\$2
- sll \$0,3,\$0
- addl \$1,\$0,\$0
- addl \$2,\$0,\$0
- ret \$31,(\$26),1
- .end main
-EOF
- LIBC=""
- ${CC-cc} dummy.s -o dummy 2>/dev/null
- if test "$?" = 0 ; then
- ./dummy
- case "$?" in
- 7)
- UNAME_MACHINE="alpha"
- ;;
- 15)
- UNAME_MACHINE="alphaev5"
- ;;
- 14)
- UNAME_MACHINE="alphaev56"
- ;;
- 10)
- UNAME_MACHINE="alphapca56"
- ;;
- 16)
- UNAME_MACHINE="alphaev6"
- ;;
- esac
-
- objdump --private-headers dummy | \
- grep ld.so.1 > /dev/null
- if test "$?" = 0 ; then
- LIBC="libc1"
- fi
- fi
- rm -f dummy.s dummy
- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
- elif test "${UNAME_MACHINE}" = "mips" ; then
- cat >dummy.c <<EOF
-main(argc, argv)
- int argc;
- char *argv[];
-{
-#ifdef __MIPSEB__
- printf ("%s-unknown-linux-gnu\n", argv[1]);
-#endif
-#ifdef __MIPSEL__
- printf ("%sel-unknown-linux-gnu\n", argv[1]);
-#endif
- return 0;
-}
-EOF
- ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
- rm -f dummy.c dummy
- else
- # Either a pre-BFD a.out linker (linux-gnuoldld)
- # or one that does not give us useful --help.
- # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
- # If ld does not provide *any* "supported emulations:"
- # that means it is gnuoldld.
- echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
- test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
-
- case "${UNAME_MACHINE}" in
- i?86)
- VENDOR=pc;
- ;;
- *)
- VENDOR=unknown;
- ;;
- esac
- # Determine whether the default compiler is a.out or elf
- cat >dummy.c <<EOF
-#include <features.h>
-main(argc, argv)
- int argc;
- char *argv[];
-{
-#ifdef __ELF__
-# ifdef __GLIBC__
-# if __GLIBC__ >= 2
- printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
-# else
- printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
-# endif
-# else
- printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
-# endif
-#else
- printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
-#endif
- return 0;
-}
-EOF
- ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
- rm -f dummy.c dummy
- fi ;;
-# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
-# are messed up and put the nodename in both sysname and nodename.
- i?86:DYNIX/ptx:4*:*)
- echo i386-sequent-sysv4
- exit 0 ;;
- i?86:UNIX_SV:4.2MP:2.*)
- # Unixware is an offshoot of SVR4, but it has its own version
- # number series starting with 2...
- # I am not positive that other SVR4 systems won't match this,
- # I just have to hope. -- rms.
- # Use sysv4.2uw... so that sysv4* matches it.
- echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
- exit 0 ;;
- i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
- if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
- echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
- else
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
- fi
- exit 0 ;;
- i?86:*:3.2:*)
- if test -f /usr/options/cb.name; then
- UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
- echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
- elif /bin/uname -X 2>/dev/null >/dev/null ; then
- UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
- (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
- (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
- && UNAME_MACHINE=i586
- echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
- else
- echo ${UNAME_MACHINE}-pc-sysv32
- fi
- exit 0 ;;
- pc:*:*:*)
- # uname -m prints for DJGPP always 'pc', but it prints nothing about
- # the processor, so we play safe by assuming i386.
- echo i386-pc-msdosdjgpp
- exit 0 ;;
- Intel:Mach:3*:*)
- echo i386-pc-mach3
- exit 0 ;;
- paragon:*:*:*)
- echo i860-intel-osf1
- exit 0 ;;
- i860:*:4.*:*) # i860-SVR4
- if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
- echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
- else # Add other i860-SVR4 vendors below as they are discovered.
- echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
- fi
- exit 0 ;;
- mini*:CTIX:SYS*5:*)
- # "miniframe"
- echo m68010-convergent-sysv
- exit 0 ;;
- M68*:*:R3V[567]*:*)
- test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
- 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
- OS_REL=''
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && echo i486-ncr-sysv4.3${OS_REL} && exit 0
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
- 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && echo i486-ncr-sysv4 && exit 0 ;;
- m68*:LynxOS:2.*:*)
- echo m68k-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
- mc68030:UNIX_System_V:4.*:*)
- echo m68k-atari-sysv4
- exit 0 ;;
- i?86:LynxOS:2.*:*)
- echo i386-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
- TSUNAMI:LynxOS:2.*:*)
- echo sparc-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
- rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
- echo rs6000-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
- SM[BE]S:UNIX_SV:*:*)
- echo mips-dde-sysv${UNAME_RELEASE}
- exit 0 ;;
- RM*:SINIX-*:*:*)
- echo mips-sni-sysv4
- exit 0 ;;
- *:SINIX-*:*:*)
- if uname -p 2>/dev/null >/dev/null ; then
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- echo ${UNAME_MACHINE}-sni-sysv4
- else
- echo ns32k-sni-sysv
- fi
- exit 0 ;;
- PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit 0 ;;
- *:UNIX_System_V:4*:FTX*)
- # From Gerald Hewes <hewes@openmarket.com>.
- # How about differentiating between stratus architectures? -djm
- echo hppa1.1-stratus-sysv4
- exit 0 ;;
- *:*:*:FTX*)
- # From seanf@swdc.stratus.com.
- echo i860-stratus-sysv4
- exit 0 ;;
- mc68*:A/UX:*:*)
- echo m68k-apple-aux${UNAME_RELEASE}
- exit 0 ;;
- news*:NEWS-OS:*:6*)
- echo mips-sony-newsos6
- exit 0 ;;
- R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
- if [ -d /usr/nec ]; then
- echo mips-nec-sysv${UNAME_RELEASE}
- else
- echo mips-unknown-sysv${UNAME_RELEASE}
- fi
- exit 0 ;;
-esac
-
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
-cat >dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
- /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
- I don't know.... */
- printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
- printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
- "4"
-#else
- ""
-#endif
- ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
- printf ("arm-acorn-riscix"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
- printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
- int version;
- version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
- printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
- exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
- printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
- printf ("ns32k-encore-mach\n"); exit (0);
-#else
- printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
- printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
- printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
- printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
- struct utsname un;
-
- uname(&un);
-
- if (strncmp(un.version, "V2", 2) == 0) {
- printf ("i386-sequent-ptx2\n"); exit (0);
- }
- if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
- printf ("i386-sequent-ptx1\n"); exit (0);
- }
- printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-#if !defined (ultrix)
- printf ("vax-dec-bsd\n"); exit (0);
-#else
- printf ("vax-dec-ultrix\n"); exit (0);
-#endif
-#endif
-
-#if defined (alliant) && defined (i860)
- printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
- exit (1);
-}
-EOF
-
-${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
-rm -f dummy.c dummy
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
- case `getsysinfo -f cpu_type` in
- c1*)
- echo c1-convex-bsd
- exit 0 ;;
- c2*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit 0 ;;
- c34*)
- echo c34-convex-bsd
- exit 0 ;;
- c38*)
- echo c38-convex-bsd
- exit 0 ;;
- c4*)
- echo c4-convex-bsd
- exit 0 ;;
- esac
-fi
-
-#echo '(Unable to guess system type)' 1>&2
-
-exit 1
diff --git a/config.h.in b/config.h.in
deleted file mode 100644
index 952f070cc5..0000000000
--- a/config.h.in
+++ /dev/null
@@ -1,50 +0,0 @@
-/* config.h.in. Generated automatically from configure.in by autoheader. */
-
-/* Define to empty if the keyword does not work. */
-#undef const
-
-/* Define if you have a working `mmap' system call. */
-#undef HAVE_MMAP
-
-/* Define as __inline if that's what the C compiler calls it. */
-#undef inline
-
-/* Define as the return type of signal handlers (int or void). */
-#undef RETSIGTYPE
-
-/* Define if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Define if the X Window System is missing or not being used. */
-#undef X_DISPLAY_MISSING
-
-/* Other stuff */
-#undef HAVE_IPC_H
-#undef HAVE_SHM_H
-#undef HAVE_XPM
-#undef HAVE_XSHM_H
-#undef HAVE_SYS_SELECT_H
-
-#undef IPC_RMID_DEFERRED_RELEASE
-
-#undef NO_FD_SET
-
-#undef RESOURCE_BASE
-
-#undef XINPUT_NONE
-#undef XINPUT_GXI
-#undef XINPUT_XFREE
-
-#undef GTK_MAJOR_VERSION
-#undef GTK_MINOR_VERSION
-#undef GTK_MICRO_VERSION
-#undef GTK_VERSION
-
-/* Define as the return type of signal handlers (int or void). */
-#undef RETSIGTYPE
-
-/* Define if you have the getpagesize function. */
-#undef HAVE_GETPAGESIZE
-
-/* Define if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
diff --git a/config.sub b/config.sub
deleted file mode 100755
index 213a6d47d6..0000000000
--- a/config.sub
+++ /dev/null
@@ -1,954 +0,0 @@
-#! /bin/sh
-# Configuration validation subroutine script, version 1.1.
-# Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine. It does not imply ALL GNU software can.
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# Configuration subroutine to validate and canonicalize a configuration type.
-# Supply the specified configuration type as an argument.
-# If it is invalid, we print an error message on stderr and exit with code 1.
-# Otherwise, we print the canonical config type on stdout and succeed.
-
-# This file is supposed to be the same for all GNU packages
-# and recognize all the CPU types, system types and aliases
-# that are meaningful with *any* GNU software.
-# Each package is responsible for reporting which valid configurations
-# it does not support. The user should be able to distinguish
-# a failure to support a valid configuration from a meaningless
-# configuration.
-
-# The goal of this file is to map all the various variations of a given
-# machine specification into a single specification in the form:
-# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or in some cases, the newer four-part form:
-# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# It is wrong to echo any other type of specification.
-
-if [ x$1 = x ]
-then
- echo Configuration name missing. 1>&2
- echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
- echo "or $0 ALIAS" 1>&2
- echo where ALIAS is a recognized configuration type. 1>&2
- exit 1
-fi
-
-# First pass through any local machine types.
-case $1 in
- *local*)
- echo $1
- exit 0
- ;;
- *)
- ;;
-esac
-
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
-case $maybe_os in
- linux-gnu*)
- os=-$maybe_os
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
- ;;
- *)
- basic_machine=`echo $1 | sed 's/-[^-]*$//'`
- if [ $basic_machine != $1 ]
- then os=`echo $1 | sed 's/.*-/-/'`
- else os=; fi
- ;;
-esac
-
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work. We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
- -sun*os*)
- # Prevent following clause from handling this invalid input.
- ;;
- -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
- -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
- -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
- -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
- -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
- -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple)
- os=
- basic_machine=$1
- ;;
- -hiux*)
- os=-hiuxwe2
- ;;
- -sco5)
- os=sco3.2v5
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco4)
- os=-sco3.2v4
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2.[4-9]*)
- os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2v[4-9]*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco*)
- os=-sco3.2v2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -isc)
- os=-isc2.2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -clix*)
- basic_machine=clipper-intergraph
- ;;
- -isc*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -lynx*)
- os=-lynxos
- ;;
- -ptx*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
- ;;
- -windowsnt*)
- os=`echo $os | sed -e 's/windowsnt/winnt/'`
- ;;
- -psos*)
- os=-psos
- ;;
-esac
-
-# Decode aliases for certain CPU-COMPANY combinations.
-case $basic_machine in
- # Recognize the basic CPU types without company name.
- # Some are omitted here because they have special meanings below.
- tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
- | arme[lb] | pyramid | mn10200 | mn10300 \
- | tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
- | alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \
- | i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \
- | mips64 | mipsel | mips64el | mips64orion | mips64orionel \
- | mipstx39 | mipstx39el \
- | sparc | sparclet | sparclite | sparc64 | v850)
- basic_machine=$basic_machine-unknown
- ;;
- # We use `pc' rather than `unknown'
- # because (1) that's what they normally are, and
- # (2) the word "unknown" tends to confuse beginning users.
- i[3456]86)
- basic_machine=$basic_machine-pc
- ;;
- # Object if more than one company name word.
- *-*-*)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
- # Recognize the basic CPU types with company name.
- vax-* | tahoe-* | i[3456]86-* | i860-* | m32r-* | m68k-* | m68000-* \
- | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
- | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
- | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
- | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* \
- | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \
- | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \
- | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
- | sparc64-* | mips64-* | mipsel-* \
- | mips64el-* | mips64orion-* | mips64orionel-* \
- | mipstx39-* | mipstx39el-* \
- | f301-*)
- ;;
- # Recognize the various machine names and aliases which stand
- # for a CPU type and a company and sometimes even an OS.
- 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
- basic_machine=m68000-att
- ;;
- 3b*)
- basic_machine=we32k-att
- ;;
- alliant | fx80)
- basic_machine=fx80-alliant
- ;;
- altos | altos3068)
- basic_machine=m68k-altos
- ;;
- am29k)
- basic_machine=a29k-none
- os=-bsd
- ;;
- amdahl)
- basic_machine=580-amdahl
- os=-sysv
- ;;
- amiga | amiga-*)
- basic_machine=m68k-cbm
- ;;
- amigaos | amigados)
- basic_machine=m68k-cbm
- os=-amigaos
- ;;
- amigaunix | amix)
- basic_machine=m68k-cbm
- os=-sysv4
- ;;
- apollo68)
- basic_machine=m68k-apollo
- os=-sysv
- ;;
- aux)
- basic_machine=m68k-apple
- os=-aux
- ;;
- balance)
- basic_machine=ns32k-sequent
- os=-dynix
- ;;
- convex-c1)
- basic_machine=c1-convex
- os=-bsd
- ;;
- convex-c2)
- basic_machine=c2-convex
- os=-bsd
- ;;
- convex-c32)
- basic_machine=c32-convex
- os=-bsd
- ;;
- convex-c34)
- basic_machine=c34-convex
- os=-bsd
- ;;
- convex-c38)
- basic_machine=c38-convex
- os=-bsd
- ;;
- cray | ymp)
- basic_machine=ymp-cray
- os=-unicos
- ;;
- cray2)
- basic_machine=cray2-cray
- os=-unicos
- ;;
- [ctj]90-cray)
- basic_machine=c90-cray
- os=-unicos
- ;;
- crds | unos)
- basic_machine=m68k-crds
- ;;
- da30 | da30-*)
- basic_machine=m68k-da30
- ;;
- decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
- basic_machine=mips-dec
- ;;
- delta | 3300 | motorola-3300 | motorola-delta \
- | 3300-motorola | delta-motorola)
- basic_machine=m68k-motorola
- ;;
- delta88)
- basic_machine=m88k-motorola
- os=-sysv3
- ;;
- dpx20 | dpx20-*)
- basic_machine=rs6000-bull
- os=-bosx
- ;;
- dpx2* | dpx2*-bull)
- basic_machine=m68k-bull
- os=-sysv3
- ;;
- ebmon29k)
- basic_machine=a29k-amd
- os=-ebmon
- ;;
- elxsi)
- basic_machine=elxsi-elxsi
- os=-bsd
- ;;
- encore | umax | mmax)
- basic_machine=ns32k-encore
- ;;
- fx2800)
- basic_machine=i860-alliant
- ;;
- genix)
- basic_machine=ns32k-ns
- ;;
- gmicro)
- basic_machine=tron-gmicro
- os=-sysv
- ;;
- h3050r* | hiux*)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- h8300hms)
- basic_machine=h8300-hitachi
- os=-hms
- ;;
- harris)
- basic_machine=m88k-harris
- os=-sysv3
- ;;
- hp300-*)
- basic_machine=m68k-hp
- ;;
- hp300bsd)
- basic_machine=m68k-hp
- os=-bsd
- ;;
- hp300hpux)
- basic_machine=m68k-hp
- os=-hpux
- ;;
- hp9k2[0-9][0-9] | hp9k31[0-9])
- basic_machine=m68000-hp
- ;;
- hp9k3[2-9][0-9])
- basic_machine=m68k-hp
- ;;
- hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][0-9] | hp8[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hppa-next)
- os=-nextstep3
- ;;
- i370-ibm* | ibm*)
- basic_machine=i370-ibm
- os=-mvs
- ;;
-# I'm not sure what "Sysv32" means. Should this be sysv3.2?
- i[3456]86v32)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv32
- ;;
- i[3456]86v4*)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv4
- ;;
- i[3456]86v)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv
- ;;
- i[3456]86sol2)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-solaris2
- ;;
- iris | iris4d)
- basic_machine=mips-sgi
- case $os in
- -irix*)
- ;;
- *)
- os=-irix4
- ;;
- esac
- ;;
- isi68 | isi)
- basic_machine=m68k-isi
- os=-sysv
- ;;
- m88k-omron*)
- basic_machine=m88k-omron
- ;;
- magnum | m3230)
- basic_machine=mips-mips
- os=-sysv
- ;;
- merlin)
- basic_machine=ns32k-utek
- os=-sysv
- ;;
- miniframe)
- basic_machine=m68000-convergent
- ;;
- mipsel*-linux*)
- basic_machine=mipsel-unknown
- os=-linux-gnu
- ;;
- mips*-linux*)
- basic_machine=mips-unknown
- os=-linux-gnu
- ;;
- mips3*-*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
- ;;
- mips3*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
- ;;
- ncr3000)
- basic_machine=i486-ncr
- os=-sysv4
- ;;
- news | news700 | news800 | news900)
- basic_machine=m68k-sony
- os=-newsos
- ;;
- news1000)
- basic_machine=m68030-sony
- os=-newsos
- ;;
- news-3600 | risc-news)
- basic_machine=mips-sony
- os=-newsos
- ;;
- next | m*-next )
- basic_machine=m68k-next
- case $os in
- -nextstep* )
- ;;
- -ns2*)
- os=-nextstep2
- ;;
- *)
- os=-nextstep3
- ;;
- esac
- ;;
- nh3000)
- basic_machine=m68k-harris
- os=-cxux
- ;;
- nh[45]000)
- basic_machine=m88k-harris
- os=-cxux
- ;;
- nindy960)
- basic_machine=i960-intel
- os=-nindy
- ;;
- np1)
- basic_machine=np1-gould
- ;;
- pa-hitachi)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- paragon)
- basic_machine=i860-intel
- os=-osf
- ;;
- pbd)
- basic_machine=sparc-tti
- ;;
- pbb)
- basic_machine=m68k-tti
- ;;
- pc532 | pc532-*)
- basic_machine=ns32k-pc532
- ;;
- pentium | p5)
- basic_machine=i586-intel
- ;;
- pentiumpro | p6)
- basic_machine=i686-intel
- ;;
- pentium-* | p5-*)
- basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumpro-* | p6-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- k5)
- # We don't have specific support for AMD's K5 yet, so just call it a Pentium
- basic_machine=i586-amd
- ;;
- nexen)
- # We don't have specific support for Nexgen yet, so just call it a Pentium
- basic_machine=i586-nexgen
- ;;
- pn)
- basic_machine=pn-gould
- ;;
- power) basic_machine=rs6000-ibm
- ;;
- ppc) basic_machine=powerpc-unknown
- ;;
- ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppcle | powerpclittle | ppc-le | powerpc-little)
- basic_machine=powerpcle-unknown
- ;;
- ppcle-* | powerpclittle-*)
- basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ps2)
- basic_machine=i386-ibm
- ;;
- rm[46]00)
- basic_machine=mips-siemens
- ;;
- rtpc | rtpc-*)
- basic_machine=romp-ibm
- ;;
- sequent)
- basic_machine=i386-sequent
- ;;
- sh)
- basic_machine=sh-hitachi
- os=-hms
- ;;
- sps7)
- basic_machine=m68k-bull
- os=-sysv2
- ;;
- spur)
- basic_machine=spur-unknown
- ;;
- sun2)
- basic_machine=m68000-sun
- ;;
- sun2os3)
- basic_machine=m68000-sun
- os=-sunos3
- ;;
- sun2os4)
- basic_machine=m68000-sun
- os=-sunos4
- ;;
- sun3os3)
- basic_machine=m68k-sun
- os=-sunos3
- ;;
- sun3os4)
- basic_machine=m68k-sun
- os=-sunos4
- ;;
- sun4os3)
- basic_machine=sparc-sun
- os=-sunos3
- ;;
- sun4os4)
- basic_machine=sparc-sun
- os=-sunos4
- ;;
- sun4sol2)
- basic_machine=sparc-sun
- os=-solaris2
- ;;
- sun3 | sun3-*)
- basic_machine=m68k-sun
- ;;
- sun4)
- basic_machine=sparc-sun
- ;;
- sun386 | sun386i | roadrunner)
- basic_machine=i386-sun
- ;;
- symmetry)
- basic_machine=i386-sequent
- os=-dynix
- ;;
- tx39)
- basic_machine=mipstx39-unknown
- ;;
- tx39el)
- basic_machine=mipstx39el-unknown
- ;;
- tower | tower-32)
- basic_machine=m68k-ncr
- ;;
- udi29k)
- basic_machine=a29k-amd
- os=-udi
- ;;
- ultra3)
- basic_machine=a29k-nyu
- os=-sym1
- ;;
- vaxv)
- basic_machine=vax-dec
- os=-sysv
- ;;
- vms)
- basic_machine=vax-dec
- os=-vms
- ;;
- vpp*|vx|vx-*)
- basic_machine=f301-fujitsu
- ;;
- vxworks960)
- basic_machine=i960-wrs
- os=-vxworks
- ;;
- vxworks68)
- basic_machine=m68k-wrs
- os=-vxworks
- ;;
- vxworks29k)
- basic_machine=a29k-wrs
- os=-vxworks
- ;;
- xmp)
- basic_machine=xmp-cray
- os=-unicos
- ;;
- xps | xps100)
- basic_machine=xps100-honeywell
- ;;
- none)
- basic_machine=none-none
- os=-none
- ;;
-
-# Here we handle the default manufacturer of certain CPU types. It is in
-# some cases the only manufacturer, in others, it is the most popular.
- mips)
- if [ x$os = x-linux-gnu ]; then
- basic_machine=mips-unknown
- else
- basic_machine=mips-mips
- fi
- ;;
- romp)
- basic_machine=romp-ibm
- ;;
- rs6000)
- basic_machine=rs6000-ibm
- ;;
- vax)
- basic_machine=vax-dec
- ;;
- pdp11)
- basic_machine=pdp11-dec
- ;;
- we32k)
- basic_machine=we32k-att
- ;;
- sparc)
- basic_machine=sparc-sun
- ;;
- cydra)
- basic_machine=cydra-cydrome
- ;;
- orion)
- basic_machine=orion-highlevel
- ;;
- orion105)
- basic_machine=clipper-highlevel
- ;;
- *)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
-esac
-
-# Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
- *-digital*)
- basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
- ;;
- *-commodore*)
- basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
- ;;
- *)
- ;;
-esac
-
-# Decode manufacturer-specific aliases for certain operating systems.
-
-if [ x"$os" != x"" ]
-then
-case $os in
- # First match some system type aliases
- # that might get confused with valid system types.
- # -solaris* is a basic system type, with this one exception.
- -solaris1 | -solaris1.*)
- os=`echo $os | sed -e 's|solaris1|sunos4|'`
- ;;
- -solaris)
- os=-solaris2
- ;;
- -svr4*)
- os=-sysv4
- ;;
- -unixware*)
- os=-sysv4.2uw
- ;;
- -gnu/linux*)
- os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
- ;;
- # First accept the basic system types.
- # The portable systems comes first.
- # Each alternative MUST END IN A *, to match a version number.
- # -sysv* is not here because it comes later, after sysvr4.
- -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
- | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
- | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
- | -aos* \
- | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
- | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
- | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
- | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
- | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
- | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -uxpv*)
- # Remember, each alternative MUST END IN *, to match a version number.
- ;;
- -linux*)
- os=`echo $os | sed -e 's|linux|linux-gnu|'`
- ;;
- -sunos5*)
- os=`echo $os | sed -e 's|sunos5|solaris2|'`
- ;;
- -sunos6*)
- os=`echo $os | sed -e 's|sunos6|solaris3|'`
- ;;
- -osfrose*)
- os=-osfrose
- ;;
- -osf*)
- os=-osf
- ;;
- -utek*)
- os=-bsd
- ;;
- -dynix*)
- os=-bsd
- ;;
- -acis*)
- os=-aos
- ;;
- -ctix* | -uts*)
- os=-sysv
- ;;
- -ns2 )
- os=-nextstep2
- ;;
- # Preserve the version number of sinix5.
- -sinix5.*)
- os=`echo $os | sed -e 's|sinix|sysv|'`
- ;;
- -sinix*)
- os=-sysv4
- ;;
- -triton*)
- os=-sysv3
- ;;
- -oss*)
- os=-sysv3
- ;;
- -svr4)
- os=-sysv4
- ;;
- -svr3)
- os=-sysv3
- ;;
- -sysvr4)
- os=-sysv4
- ;;
- # This must come after -sysvr4.
- -sysv*)
- ;;
- -xenix)
- os=-xenix
- ;;
- -none)
- ;;
- *)
- # Get rid of the `-' at the beginning of $os.
- os=`echo $os | sed 's/[^-]*-//'`
- echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
- exit 1
- ;;
-esac
-else
-
-# Here we handle the default operating systems that come with various machines.
-# The value should be what the vendor currently ships out the door with their
-# machine or put another way, the most popular os provided with the machine.
-
-# Note that if you're going to try to match "-MANUFACTURER" here (say,
-# "-sun"), then you have to tell the case statement up towards the top
-# that MANUFACTURER isn't an operating system. Otherwise, code above
-# will signal an error saying that MANUFACTURER isn't an operating
-# system, and we'll never get to this point.
-
-case $basic_machine in
- *-acorn)
- os=-riscix1.2
- ;;
- arm*-semi)
- os=-aout
- ;;
- pdp11-*)
- os=-none
- ;;
- *-dec | vax-*)
- os=-ultrix4.2
- ;;
- m68*-apollo)
- os=-domain
- ;;
- i386-sun)
- os=-sunos4.0.2
- ;;
- m68000-sun)
- os=-sunos3
- # This also exists in the configure program, but was not the
- # default.
- # os=-sunos4
- ;;
- *-tti) # must be before sparc entry or we get the wrong os.
- os=-sysv3
- ;;
- sparc-* | *-sun)
- os=-sunos4.1.1
- ;;
- *-ibm)
- os=-aix
- ;;
- *-hp)
- os=-hpux
- ;;
- *-hitachi)
- os=-hiux
- ;;
- i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
- os=-sysv
- ;;
- *-cbm)
- os=-amigaos
- ;;
- *-dg)
- os=-dgux
- ;;
- *-dolphin)
- os=-sysv3
- ;;
- m68k-ccur)
- os=-rtu
- ;;
- m88k-omron*)
- os=-luna
- ;;
- *-next )
- os=-nextstep
- ;;
- *-sequent)
- os=-ptx
- ;;
- *-crds)
- os=-unos
- ;;
- *-ns)
- os=-genix
- ;;
- i370-*)
- os=-mvs
- ;;
- *-next)
- os=-nextstep3
- ;;
- *-gould)
- os=-sysv
- ;;
- *-highlevel)
- os=-bsd
- ;;
- *-encore)
- os=-bsd
- ;;
- *-sgi)
- os=-irix
- ;;
- *-siemens)
- os=-sysv4
- ;;
- *-masscomp)
- os=-rtu
- ;;
- f301-fujitsu)
- os=-uxpv
- ;;
- *)
- os=-none
- ;;
-esac
-fi
-
-# Here we handle the case where we know the os, and the CPU type, but not the
-# manufacturer. We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
- *-unknown)
- case $os in
- -riscix*)
- vendor=acorn
- ;;
- -sunos*)
- vendor=sun
- ;;
- -aix*)
- vendor=ibm
- ;;
- -hpux*)
- vendor=hp
- ;;
- -hiux*)
- vendor=hitachi
- ;;
- -unos*)
- vendor=crds
- ;;
- -dgux*)
- vendor=dg
- ;;
- -luna*)
- vendor=omron
- ;;
- -genix*)
- vendor=ns
- ;;
- -mvs*)
- vendor=ibm
- ;;
- -ptx*)
- vendor=sequent
- ;;
- -vxsim* | -vxworks*)
- vendor=wrs
- ;;
- -aux*)
- vendor=apple
- ;;
- esac
- basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
- ;;
-esac
-
-echo $basic_machine$os
diff --git a/configure.in b/configure.in
deleted file mode 100644
index 504373599d..0000000000
--- a/configure.in
+++ /dev/null
@@ -1,263 +0,0 @@
-# Process this file with autoconf to produce a configure script.
-AC_INIT(gdk/gdktypes.h)
-
-# Save this value here, since automake will set cflags later
-cflags_set=${CFLAGS+set}
-
-GTK_MAJOR_VERSION=0
-GTK_MINOR_VERSION=99
-GTK_MICRO_VERSION=5
-GTK_VERSION=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION.$GTK_MICRO_VERSION
-
-# For automake.
-VERSION=$GTK_VERSION
-PACKAGE=gtk+
-
-# Configure glib
-AC_CONFIG_SUBDIRS(glib)
-
-# Save this value here, since automake will set cflags later
-cflags_set=${CFLAGS+set}
-
-dnl Initialize automake stuff
-AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
-
-# Specify a configuration file
-AM_CONFIG_HEADER(config.h)
-
-dnl Initialize libtool
-AM_PROG_LIBTOOL
-
-dnl Initialize maintainer mode
-AM_MAINTAINER_MODE
-
-AC_CANONICAL_HOST
-
-AC_ARG_ENABLE(shm, [ --enable-shm support shared memory if available [default=yes]],
- echo $enable_shm, enable_shm="yes")
-AC_ARG_ENABLE(debug, [ --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],,enable_debug=minimum)
-AC_ARG_ENABLE(ansi, [ --enable-ansi turn on strict ansi [default=no]],
- , enable_ansi=no)
-AC_ARG_ENABLE(xim, [ --enable-xim support XIM [default=yes]],
- echo $enable_xim, enable_xim="yes")
-AC_ARG_WITH(locale, [ --with-locale=LOCALE locale name you want to use ])
-
-AC_ARG_WITH(xinput, [ --with-xinput=[no/gxi/xfree] support XInput ])
-
-if test "x$enable_debug" = "xyes"; then
- test "$cflags_set" = set || CFLAGS="-g"
- CFLAGS="$CFLAGS -DG_ENABLE_DEBUG"
-else
- if test "x$enable_debug" = "xno"; then
- CFLAGS="$CFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DGTK_NO_CHECK_CASTS"
- else
- CFLAGS="$CFLAGS -DGTK_NO_CHECK_CASTS"
- fi
-fi
-
-# Build time sanity check...
-AM_SANITY_CHECK
-
-# Checks for programs.
-AC_PROG_CC
-AM_PROG_CC_STDC
-AC_PROG_INSTALL
-AC_PROG_MAKE_SET
-
-if test "x$GCC" = "xyes"; then
- if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
- CFLAGS="$CFLAGS -Wall"
- fi
-
- if test "x$enable_ansi" = "xyes"; then
- if test -z "`echo "$CFLAGS" | grep "\-ansi" 2> /dev/null`" ; then
- CFLAGS="$CFLAGS -ansi"
- fi
-
- if test -z "`echo "$CFLAGS" | grep "\-pedantic" 2> /dev/null`" ; then
- CFLAGS="$CFLAGS -pedantic"
- fi
- fi
-fi
-
-if test "x$enable_xim" = "xyes"; then
- CFLAGS="$CFLAGS -DUSE_XIM"
-fi
-
-AC_DEFINE_UNQUOTED(GTK_MAJOR_VERSION, $GTK_MAJOR_VERSION)
-AC_DEFINE_UNQUOTED(GTK_MINOR_VERSION, $GTK_MINOR_VERSION)
-AC_DEFINE_UNQUOTED(GTK_MICRO_VERSION, $GTK_MICRO_VERSION)
-AC_DEFINE_UNQUOTED(GTK_VERSION, "$GTK_VERSION")
-
-# Find the X11 include and library directories
-AC_PATH_X
-AC_PATH_XTRA
-
-if test "x$x_includes" = "x"; then
- x_includes="/usr/include"
-fi
-
-saved_cflags="$CFLAGS"
-saved_ldflags="$LDFLAGS"
-
-CFLAGS="$X_CFLAGS"
-LDFLAGS="$X_LDFLAGS $X_LIBS"
-
-# Checks for libraries.
-# Check for the X11 library
-AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", no_x11_lib=yes, $X_EXTRA_LIBS)
-
-if test "x$enable_shm" = "xyes"; then
- # Check for the Xext library (needed for XShm extention)
- AC_CHECK_LIB(Xext, XShmAttach, x_libs="-lXext $x_libs", no_xext_lib=yes, $x_libs)
-fi
-
-x_cflags="$X_CFLAGS"
-x_ldflags="$X_LDFLAGS $X_LIBS"
-
-# set up things for XInput
-
-if test "x$with_xinput" = "xgxi" || test "x$with_xinput" = "xyes"; then
- AC_DEFINE(XINPUT_GXI)
- xinput_progs=gxid
- x_libs="-lXi $x_libs"
-elif test "x$with_xinput" = "xxfree"; then
- AC_DEFINE(XINPUT_XFREE)
- x_libs="-lXi $x_libs"
-else
- AC_DEFINE(XINPUT_NONE)
-fi
-
-
-AC_SUBST(x_cflags)
-AC_SUBST(x_includes)
-AC_SUBST(x_ldflags)
-AC_SUBST(x_libs)
-AC_SUBST(xinput_progs)
-
-CFLAGS="$saved_cflags"
-LDFLAGS="$saved_ldflags"
-
-if test "x$enable_shm" = "xyes"; then
- # Check for shared memory
- AC_CHECK_HEADER(sys/ipc.h, AC_DEFINE(HAVE_IPC_H), no_sys_ipc=yes)
- AC_CHECK_HEADER(sys/shm.h, AC_DEFINE(HAVE_SHM_H), no_sys_shm=yes)
-
- # Check whether shmctl IPC_RMID allowes subsequent attaches
- if test "$ac_cv_header_sys_shm_h" = "yes"; then
- AC_MSG_CHECKING(whether shmctl IPC_RMID allowes subsequent attaches)
- AC_TRY_RUN([
- #include <sys/types.h>
- #include <sys/ipc.h>
- #include <sys/shm.h>
- int main()
- {
- int id;
- char *shmaddr;
- id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0777);
- if (id == -1)
- exit (2);
- shmaddr = shmat (id, 0, 0);
- shmctl (id, IPC_RMID, 0);
- if ((char*) shmat (id, 0, 0) == (char*) -1)
- {
- shmdt (shmaddr);
- exit (1);
- }
- shmdt (shmaddr);
- shmdt (shmaddr);
- exit (0);
- }
- ],
- AC_DEFINE(IPC_RMID_DEFERRED_RELEASE)
- AC_MSG_RESULT(yes),
- AC_MSG_RESULT(no),
- AC_MSG_RESULT(assuming no))
- fi
-
- # Check for the X shared memory extension header file
- AC_MSG_CHECKING(X11/extensions/XShm.h)
- if test "x$no_xext_lib" = "xyes"; then
- AC_MSG_RESULT(no)
- no_xshm=yes
- else
- if test -f "$x_includes/X11/extensions/XShm.h"; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_XSHM_H)
- else
- AC_MSG_RESULT(no)
- no_xshm=yes
- fi
- fi
-fi
-
-# Check for private display resource base variable
-AC_MSG_CHECKING(resource base field in XDisplay)
-AC_CACHE_VAL(gtk_cv_display_resource_base,
-[AC_TRY_RUN([
-#define XLIB_ILLEGAL_ACCESS
-#include <X11/Xlib.h>
-
-int
-main ()
-{
- Display *display;
-
- return 0;
-
- display->resource_base;
-}],
-gtk_cv_display_resource_base="resource_base",
-gtk_cv_display_resource_base="private3")])
-AC_MSG_RESULT($gtk_cv_display_resource_base)
-AC_DEFINE_UNQUOTED(RESOURCE_BASE, gdk_display->$gtk_cv_display_resource_base)
-
-# Check if X_LOCALE definition is necessary
-
-AC_MSG_CHECKING(need -DX_LOCALE)
-
-AC_TRY_RUN([
-#include <stdio.h>
-#include <locale.h>
-
-int
-main ()
-{
- return setlocale (LC_ALL, "${with_locale}") == NULL;
-}],
-need_x_locale=no,
-need_x_locale=yes)
-AC_MSG_RESULT($need_x_locale)
-
-if test $need_x_locale = yes; then
- CFLAGS="$CFLAGS -DX_LOCALE"
-fi
-
-# Checks for header files.
-AC_HEADER_STDC
-
-# Checks for typedefs, structures, and compiler characteristics.
-AC_C_CONST
-AC_C_INLINE
-
-# Checks for library functions.
-AC_TYPE_SIGNAL
-AC_FUNC_MMAP
-
-# Check for sys/select.h
-
-AC_MSG_CHECKING([fd_set and sys/select])
-AC_TRY_COMPILE([#include <sys/types.h>],
- [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
-if test $gtk_ok = no; then
- AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
- if test $gtk_ok = yes; then
- AC_DEFINE(HAVE_SYS_SELECT_H)
- fi
-fi
-AC_MSG_RESULT($gtk_ok)
-if test $gtk_ok = no; then
- AC_DEFINE(NO_FD_SET)
-fi
-
-AC_OUTPUT(Makefile gtk+.xconfig docs/Makefile gdk/Makefile gtk/Makefile)
diff --git a/docs/.cvsignore b/docs/.cvsignore
deleted file mode 100644
index d4cf0e5364..0000000000
--- a/docs/.cvsignore
+++ /dev/null
@@ -1,17 +0,0 @@
-Makefile
-Makefile.in
-*.info*
-*.dvi
-*.ps
-*.pg
-*.ky
-*.cp
-*.fn
-*.tp
-*.vr
-*.log
-*.aux
-*.toc
-*.cps
-*.fns
-*.vrs
diff --git a/docs/Makefile.am b/docs/Makefile.am
deleted file mode 100644
index 8d4592b427..0000000000
--- a/docs/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-info_TEXINFOS = gdk.texi gtk.texi glib.texi
-
-EXTRA_DIST = \
- texinfo.tex \
- macros.texi \
- Makefile.gtkfaq \
- gtkfaq.sgml \
- gtkfaq_fix \
- debugging.txt \
- developers.txt \
- refcounting.txt \
- styles.txt \
- text_widget.txt \
- widget_system.txt
-
-
-files:
- @files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
- echo $$p; \
- done
diff --git a/docs/Makefile.gtkfaq b/docs/Makefile.gtkfaq
deleted file mode 100644
index 2b2dfcb7a4..0000000000
--- a/docs/Makefile.gtkfaq
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# To use this makefile, do:
-# make -f Makefile.gtkfaq
-#
-# This is not done by default because you might
-# not have sgml2html installed... Perhaps we could
-# detect that in the future and combine it in with
-# the automake stuff...
-#
-
-all: sgml
-
-sgml:
- sgml2html gtkfaq.sgml
- cp gtkfaq.html index.html
- perl gtkfaq_fix *.html
diff --git a/docs/Makefile.in b/docs/Makefile.in
deleted file mode 100644
index 98094211aa..0000000000
--- a/docs/Makefile.in
+++ /dev/null
@@ -1,294 +0,0 @@
-# Makefile.in generated automatically by automake 1.2c from Makefile.am
-
-# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-
-SHELL = /bin/sh
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-bindir = @bindir@
-sbindir = @sbindir@
-libexecdir = @libexecdir@
-datadir = @datadir@
-sysconfdir = @sysconfdir@
-sharedstatedir = @sharedstatedir@
-localstatedir = @localstatedir@
-libdir = @libdir@
-infodir = @infodir@
-mandir = @mandir@
-includedir = @includedir@
-oldincludedir = /usr/include
-
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-
-top_builddir = ..
-
-ACLOCAL = @ACLOCAL@
-AUTOCONF = @AUTOCONF@
-AUTOMAKE = @AUTOMAKE@
-AUTOHEADER = @AUTOHEADER@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-transform = @program_transform_name@
-
-NORMAL_INSTALL = true
-PRE_INSTALL = true
-POST_INSTALL = true
-NORMAL_UNINSTALL = true
-PRE_UNINSTALL = true
-POST_UNINSTALL = true
-host_alias = @host_alias@
-host_triplet = @host@
-CC = @CC@
-CPP = @CPP@
-LD = @LD@
-LIBTOOL = @LIBTOOL@
-LN_S = @LN_S@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-NM = @NM@
-PACKAGE = @PACKAGE@
-RANLIB = @RANLIB@
-VERSION = @VERSION@
-x_cflags = @x_cflags@
-x_includes = @x_includes@
-x_ldflags = @x_ldflags@
-x_libs = @x_libs@
-xinput_progs = @xinput_progs@
-
-info_TEXINFOS = gdk.texi gtk.texi
-
-EXTRA_DIST = texinfo.tex macros.texi Makefile.gtkfaq gtkfaq.sgml gtkfaq_fix
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = ../config.h
-CONFIG_CLEAN_FILES =
-TEXI2DVI = texi2dvi
-TEXINFO_TEX = $(srcdir)/texinfo.tex
-INFO_DEPS = gdk.info gtk.info
-DVIS = gdk.dvi gtk.dvi
-TEXINFOS = gdk.texi gtk.texi
-DIST_COMMON = Makefile.am Makefile.in texinfo.tex
-
-
-DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-
-TAR = tar
-GZIP = --best
-default: all
-
-.SUFFIXES:
-.SUFFIXES: .dvi .info .ps .texi .texinfo
-$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
- cd $(top_srcdir) && $(AUTOMAKE) --gnu docs/Makefile
-
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
- cd $(top_builddir) \
- && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-
-
-gdk.info: gdk.texi
-gdk.dvi: gdk.texi
-
-
-gtk.info: gtk.texi
-gtk.dvi: gtk.texi
-
-
-DVIPS = dvips
-
-.texi.info:
- @cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
- cd $(srcdir) \
- && $(MAKEINFO) `echo $< | sed 's,.*/,,'`
-
-.texi.dvi:
- TEXINPUTS=$(srcdir):$$TEXINPUTS \
- MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
-
-.texi:
- @cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
- cd $(srcdir) \
- && $(MAKEINFO) `echo $< | sed 's,.*/,,'`
-
-.texinfo.info:
- @cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
- cd $(srcdir) \
- && $(MAKEINFO) `echo $< | sed 's,.*/,,'`
-
-.texinfo:
- @cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
- cd $(srcdir) \
- && $(MAKEINFO) `echo $< | sed 's,.*/,,'`
-
-.texinfo.dvi:
- TEXINPUTS=$(srcdir):$$TEXINPUTS \
- MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
-.dvi.ps:
- $(DVIPS) $< -o $@
-
-install-info-am: $(INFO_DEPS)
- @$(NORMAL_INSTALL)
- $(mkinstalldirs) $(infodir)
- @for file in $(INFO_DEPS); do \
- d=$(srcdir); \
- for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
- if test -f $$d/$$ifile; then \
- echo " $(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile"; \
- $(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile; \
- else : ; fi; \
- done; \
- done
- @$(POST_INSTALL)
- @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
- for file in $(INFO_DEPS); do \
- echo " install-info --info-dir=$(infodir) $(infodir)/$$file";\
- install-info --info-dir=$(infodir) $(infodir)/$$file || :;\
- done; \
- else : ; fi
-
-uninstall-info:
- $(PRE_UNINSTALL)
- @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
- ii=yes; \
- else ii=; fi; \
- for file in $(INFO_DEPS); do \
- test -z $ii || install-info --info-dir=$(infodir) --remove $$file; \
- done
- $(NORMAL_UNINSTALL)
- for file in $(INFO_DEPS); do \
- (cd $(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
- done
-
-dist-info: $(INFO_DEPS)
- for base in $(INFO_DEPS); do \
- d=$(srcdir); \
- for file in `cd $$d && eval echo $$base*`; do \
- test -f $(distdir)/$$file \
- || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
- || cp -p $$d/$$file $(distdir)/$$file; \
- done; \
- done
-
-mostlyclean-aminfo:
- -rm -f gdk.aux gdk.cp gdk.cps gdk.dvi gdk.fn gdk.fns gdk.ky gdk.kys \
- gdk.ps gdk.log gdk.pg gdk.toc gdk.tp gdk.tps gdk.vr gdk.vrs \
- gdk.op gdk.tr gdk.cv gdk.cn gtk.aux gtk.cp gtk.cps gtk.dvi \
- gtk.fn gtk.fns gtk.ky gtk.kys gtk.ps gtk.log gtk.pg gtk.toc \
- gtk.tp gtk.tps gtk.vr gtk.vrs gtk.op gtk.tr gtk.cv gtk.cn
-
-clean-aminfo:
-
-distclean-aminfo:
-
-maintainer-clean-aminfo:
- for i in $(INFO_DEPS); do \
- rm -f $$i; \
- if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \
- rm -f $$i-[0-9]*; \
- fi; \
- done
-tags: TAGS
-TAGS:
-
-
-distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
-
-subdir = docs
-
-distdir: $(DISTFILES)
- here=`cd $(top_builddir) && pwd`; \
- top_distdir=`cd $(top_distdir) && pwd`; \
- distdir=`cd $(distdir) && pwd`; \
- cd $(top_srcdir) \
- && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu docs/Makefile
- @for file in $(DISTFILES); do \
- d=$(srcdir); \
- test -f $(distdir)/$$file \
- || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
- || cp -p $$d/$$file $(distdir)/$$file; \
- done
- $(MAKE) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info
-info: $(INFO_DEPS)
-dvi: $(DVIS)
-check: all
- $(MAKE)
-installcheck:
-install-exec:
- @$(NORMAL_INSTALL)
-
-install-data: install-info-am
- @$(NORMAL_INSTALL)
-
-install: install-exec install-data all
- @:
-
-uninstall: uninstall-info
-
-all: Makefile $(INFO_DEPS)
-
-install-strip:
- $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
-installdirs:
- $(mkinstalldirs) $(infodir)
-
-
-mostlyclean-generic:
- -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
-
-clean-generic:
- -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
-
-distclean-generic:
- -rm -f Makefile $(DISTCLEANFILES)
- -rm -f config.cache config.log stamp-h stamp-h[0-9]*
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
- -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
- -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-mostlyclean: mostlyclean-aminfo mostlyclean-generic
-
-clean: clean-aminfo clean-generic mostlyclean
-
-distclean: distclean-aminfo distclean-generic clean
- -rm -f config.status
- -rm -f libtool
-
-maintainer-clean: maintainer-clean-aminfo maintainer-clean-generic \
- distclean
- @echo "This command is intended for maintainers to use;"
- @echo "it deletes files that may require special tools to rebuild."
-
-.PHONY: default install-info-am uninstall-info mostlyclean-aminfo \
-distclean-aminfo clean-aminfo maintainer-clean-aminfo tags distdir info \
-dvi installcheck install-exec install-data install uninstall all \
-installdirs mostlyclean-generic distclean-generic clean-generic \
-maintainer-clean-generic clean mostlyclean distclean maintainer-clean
-
-
-files:
- @files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
- echo $$p; \
- done
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/docs/debugging.txt b/docs/debugging.txt
deleted file mode 100644
index 68905895c2..0000000000
--- a/docs/debugging.txt
+++ /dev/null
@@ -1,98 +0,0 @@
-The GLIB, GDK, and GTK libraries have extensive support for
-debugging the library and your programs.
-
-The amount of debugging being done can be determined both
-at run time and compile time.
-
-COMPILE TIME OPTIONS
---------------------
-
-At compile time, the amount of debugging support included is
-determined by four macros:
-
-G_ENABLE_DEBUG
- If set, enable support for runtime checking.
-
-G_DISABLE_ASSERT
- If set, disable g_assert macros
-
-G_DISABLE_CHECKS
- If set, disable the g_return_if_fail and g_return_val_if_fail macros
-
-GTK_NO_CHECK_CASTS
- If set, don't check casts between different object types
-
-
-Whether these macros are defined is controlled at configuration
-time by the --enable-debug option.
-
---enable-debug=minimum [default]
- Enable only inexpensive sanity checking
- sets GTK_NO_CHECK_CASTS
-
---enable-debug=yes
- Enable all debugging support
- sets G_ENABLE_DEBUG
-
---enable-debug=no (or --disable-debug)
- Disable all debugging support (fastest)
- sets G_DISABLE_ASSERT, G_DISABLE_CHECKS, and GTK_NO_CHECK_CASTS
-
-
-RUN TIME OPTIONS
-----------------
-
-At run time, if GTK+ was compiled with debugging enabled, different
-types of debugging information can be printed out. This is controlled
-by the:
-
- GTK_DEBUG and GDK_DEBUG environment variables
- --gtk-debug and --gdk-debug command line options
- --gtk-no-debug and --gdk-no-debug command line options
-
-First the environment variables are applied, then the command line
-options are applied in the order given on the command line.
-
-Each of these can either be the special value ALL, or a sequence of
-':' separated options. (Note, case is significant). The environment
-variables and the --gtk-debug and --gdk-debug options add debugging
-options and the --gtk-no-debug and --gdk-no-debug options remove
-them.
-
-As noted below, some of these are useful in application debugging, but
-most are only interested to those debugging the libraries
-
-For instance:
-
- GDK_DEBUG_FLAGS=misc:dnd testgtk --gdk-no-debug dnd --gdk-debug events
-
-runs testgtk with the 'misc' and 'events' debugging options.
-
- GTK_DEBUG
- ---------
-
- Application relevant options:
-
- 'objects' - Trace the creation and destruction of objects, print
- out a summary at program termination
-
- Options only interesting to library maintainers:
-
- GDK_DEBUG
- ---------
-
- Application relevant options:
-
- 'events' - Show all events received by GTK
-
- Options only interesting to library maintainers:
-
- 'misc' - Miscellaneous information
- 'dnd' - Information about drag-and-drop
- 'color-context' - Information about the internal workings of
- GdkColorContext
- 'xim' - Information about X Input Method support
-
-
- - Owen Taylor <owt1@cornell.edu>
- 98/02/19 \ No newline at end of file
diff --git a/docs/developers.txt b/docs/developers.txt
deleted file mode 100644
index ee78bea4f8..0000000000
--- a/docs/developers.txt
+++ /dev/null
@@ -1,69 +0,0 @@
-Things to care about when using/programing for GTK+
-===================================================
-
-This file is meant to collect some frequently triggered failures when
-programming for/with Gtk, having the spirit of a developers FAQ.
-It is also the correct place to list up things that programmers should
-care about in general.
-
-In the hope that this text might be usefull to someone,
-
- - Tim Janik <timj@gimp.org>
- 1998/02/11
-
-
-Automatic destruction of widgets on removal from parent
--------------------------------------------------------
-
-This is a reference counting issue, you would want to refer
-to refcounting.txt on it.
-
-
-What are all the widget flags about?
-------------------------------------
-
-Refer to the file widget_system.txt which covers widget flags and the
-resulting invariants in a detailed way.
-
-
-GdkWindow pointers may be NULL in GdkEvents
--------------------------------------------
-
-The notification nature of the signal mechanism might cause events to
-be emitted that have their GdkWindow pointer set to NULL.
-This is due to the fact that certain events need to be emitted after the
-real GdkWindow of a widget is not any longer pertinent.
-It's up to the signal handling function (application) to check for the
-window field of the event structure to be != NULL, if it is going to
-perform any operations through Gdk calls on it.
-Events that a likely to trigger a missing check for the window pointer
-currently are (and correspond to the trailing signals):
-
-GDK_SELECTION_CLEAR GtkWidget::selection_clear_event
-GDK_FOCUS_CHANGE GtkWidget::focus_in_event
- GtkWidget::focus_out_event
-
-Events that are asured to have a valid GdkEvent.any.window field are
-
-GDK_EXPOSE GtkWidget::expose_event
-
-
-gtk_widget_ref() vs. gtk_object_ref()
--------------------------------------
-
-The widget referencing functions gtk_widget_ref() and gtk_widget_unref()
-are currently just wrappers about the corresponding referencing functions
-for objects. Still you should use the widget referencing functions if you
-are sure the referenced object is of type GTK_WIDGET_TYPE.
-
-
-Writing Gdk functions
----------------------
-
-When writing Gdk functions that operate on GdkWindow structures in any
-maeningfull sense, that is casting to a GdkWindowPrivate structure for
-access to fields other then GdkWindow.user_data, the programmer is
-recommended to check for the GdkWindowPrivate.destroyed field to be ==
-FALSE, especially if the GdkWindowPrivate.xwindow field is used.
-Silent abortion of the Gdk function is the correct behaviour if this
-condition isn't met.
diff --git a/docs/faq/gtkfaq.sgml b/docs/faq/gtkfaq.sgml
deleted file mode 100644
index 5fc139cbd3..0000000000
--- a/docs/faq/gtkfaq.sgml
+++ /dev/null
@@ -1,930 +0,0 @@
-<!doctype linuxdoc system>
-
-<article>
-
-<!-- Title information -->
-
-<title>GTK+ FAQ
-
-<!-- NOTE: Use only one author tag, otherwise sgml2txt barfs - TRG -->
-<author>Nathan Froyd, Tony Gale, Shawn T. Amundson.
-<date>March 9th 1998
-<abstract>
-This document is intended to answer questions that are likely to be
-frequently asked by programmers using GTK+ or people who are just
-looking at using GTK+.
-</abstract>
-
-<!-- Table of contents -->
-<toc>
-
-<!-- Begin the document -->
-
-<!-- ***************************************************************** -->
-<sect>General Information
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>Authors
-<p>
-The authors of GTK+ are:
-
-<itemize>
-<item>Peter Mattis (petm@xcf.berkeley.edu)
-<item>Spencer Kimball (spencer@xcf.berkeley.edu)
-<item>Josh MacDonald (jmacd@xcf.berkeley.edu)
-</itemize>
-GTK+ is distributed under the GNU Library General Public License
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>What is GTK+?
-<p>
-GTK+ is a small and efficient widget set designed with the general look
-and feel of Motif. In reality, it looks much better than Motif. It
-contains common widgets and some more complex widgets such as a file
-selection, and color selection widgets.
-
-GTK+ provides some unique features. (At least, I know of no other widget
-library which provides them). For
-example, a button does not contain a label, it contains a child widget,
-which in most instances will be a label.
-However, the child widget can also be a pixmap, image or any combination
-possible the programmer desires.
-This flexibility is adhered to throughout the library.
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>What is the + in GTK+?
-<P>
-Peter Mattis informed the gtk mailing list that:
-<quote>
-"I originally wrote gtk which included the three libraries, libglib,
-libgdk and libgtk. It featured a flat widget hierarchy. That is, you
-couldn't derive a new widget from an existing one. And it contained
-a more standard callback mechanism instead of the signal mechanism now
-present in gtk+. The + was added to distinguish between the original
-version of gtk and the new version. You can think of it as being an
-enhancement to the original gtk that adds object oriented features."
-</quote>
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>Does the G in GTK+ stand for General, Gimp, or GNU?
-<p>
-Peter Mattis informed the gtk mailing list that:
-<quote>
-"I think the last time Spencer and I talked about it we decided on
-GTK = Gimp ToolKit. But I don't know for sure. Its definately not
-GNU, though."
-</quote>
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>Where is the documentation for GTK+?
-<p>
-In the GTK+ distribution's doc/ directory you will find the
-reference material for both GTK and GDK, and this FAQ.
-
-There is also a GTK+ Tutorial which can be found at
-<htmlurl url="http://www.levien.com/~slow/gtk/"
-name="http://www.levien.com/~slow/gtk/">.
-
-The Tutorial and FAQ can also be found at
-<htmlurl url="http://www.geocities.com/ResearchTriangle/Lab/4299/"
-name="http://www.geocities.com/ResearchTriangle/Lab/4299/">.
-
-In addition, you can find links to all of these documents by going to
-<htmlurl url="http://www.gimp.org/gtk/docs"
-name="http://www.gimp.org/gtk/docs">.
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>Is there a mailing list (or mailing list archive) for GTK+?
-<p>
-There are two mailing lists:
-<itemize>
-<item>A mailing list for discussion of development of GTK based applications
-is hosted at gtk-app-devel-list@redhat.com. To subscribe send an
-email message to <htmlurl url="mailto:gtk-app-devel-list-request@redhat.com"
-name="gtk-app-devel-list-request@redhat.com">
-with <em>subscribe</em> in the <bf>subject</bf>.
-<p>
-<item>A mailing list for discussion of development of GTK is hosted
-at gtk-list@redhat.com. To subscribe send an
-email message to <htmlurl url="mailto:gtk-list-request@redhat.com"
-name="gtk-list-request@redhat.com">
-with <em>subscribe</em> in the <bf>subject</bf>.
-<p>
-A searchable archive of the mailing list can be found at <htmlurl url="http://www.redhat.com/linux-info/gtk/gtk-list/index.html" name="http://www.redhat.com/linux-info/gtk/gtk-list/index.html">
-</itemize>
-<!-- ----------------------------------------------------------------- -->
-<sect1>The gtk-list hasn't had any traffic for days, is it dead?
-<p>
-No, everyone's just busy coding.
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>How to get help with GTK+
-<p>
-First, make sure your question isn't answered in the documentation, this
-FAQ or the tutorial. Done that? You're sure you've done that, right? In
-that case, the best place to post questions is to the GTK+ mailing list.
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>How to report bugs in GTK+
-<p>
-Bug reports should be sent to the GTK+ mailing list.
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>What applications have been written with GTK+?
-<p>
-Some applications which use GTK+ are:
-<itemize>
-<item>GIMP (<htmlurl url="http://www.XCF.Berkeley.EDU/~gimp/"
- name="http://www.XCF.Berkeley.EDU/~gimp/"> ),
- an image manipulation program
-<item>Gsumi (<htmlurl url="http://www.msc.cornell.edu/~otaylor/gsumi/gsumi.html"
- name="http://www.msc.cornell.edu/~otaylor/gsumi/gsumi.html">),
- a fun B+W doodling program with XInput support.
-<item>GUBI (<htmlurl url="http://www.SoftHome.net/pub/users/timj/gubi/index.htm"
- name="http://www.SoftHome.net/pub/users/timj/gubi/index.htm">),
- a user interface builder
-<item>Gzilla (<htmlurl url="http://www.levien.com/gzilla/" name="http://www.levien.com/gzilla/">),
- a web browser
-<item>SANE (<htmlurl url="http://www.azstarnet.com/~axplinux/sane/" name="http://www.azstarnet.com/~axplinux/sane/"> ),
- a universal scanner interface
-<item>XQF (<htmlurl url="http://www.botik.ru/~roma/quake/" name="http://www.botik.ru/~roma/quake/">),
- a QuakeWorld/Quake2 server browser and launcher
-<item>ElectricEyes (<htmlurl url="http://www.labs.redhat.com/ee.shtml" name="http://www.labs.redhat.com/ee.shtml">),
- an image viewer that aims to be a free replacement for xv
-<item>GPK - the General Proxy Kit (<htmlurl url="http://www.humanfactor.com/gpk/" name="http://www.humanfactor.com/gpk/">),
- an add-on library to permit thread-safe access to GTK+
-<item>GCK - the General Convenience Kit (<htmlurl url="http://www.ii.uib.no/~tomb/gck.html" name="http://www.ii.uib.no/~tomb/gck.html">),
- miscellaneous functions intended to ease color handling, UI construction,
- vector operations, and math functions
-<item>GDK Imlib (<htmlurl url="http://www.labs.redhat.com/imlib/" name="http://www.labs.redhat.com/imlib/">),
- a fast image loading and manipulation library for GDK
-</itemize>
-<p>
-In addition to the above, the GNOME project (<htmlurl url="http://www.gnome.org"
-name="http://www.gnome.org">)
-is using GTK+ to build a free desktop for Linux. Many more programs can be found
-there.
-
-<!-- ***************************************************************** -->
-<sect>How to find, configure, install, and troubleshoot GTK+
-
-<!-- ***************************************************************** -->
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>What do I need to run GTK+?
-<p>
-To compile GTK+, all you need is a C compiler (gcc) and the X Window System
-and associated libraries on your system.
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>Where can I get GTK+?
-<p>
-The canonical site is:
-<verb>
-ftp://ftp.gimp.org/pub/gtk
-</verb>
-Of course, any mirrors of ftp.gimp.org should have the latest version, too.
-
-<sect1>How do I configure/compile GTK+?
-<p>
-Generally, all you will need to do is issue the commands:
-<verb>
-./configure
-make
-</verb>
-in the gtk+-version/ directory.
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>When compiling GTK+ I get an error like:
-<tt/make: file `Makefile' line 456: Syntax error/
-<p>
-Make sure that you are using GNU make (use <tt/make -v/ to check). There are
-many weird and wonderful versions of make out there, and not all of them
-handle the automatically generated Makefiles.
-
-<!-- ----------------------------------------------------------------- -->
-
-<sect1>I've compiled and installed GTK+, but I can't get any programs to link
-with it!
-<p>
-This problem is most often encountered when the GTK+ libraries can't be
-found or are the wrong version. Generally, the compiler will complain about an
-'unresolved symbol'. There are two things you need to check:
-<itemize>
-<item>Make sure that the libraries can be found. You want to edit
-/etc/ld.so.conf to include /usr/local/lib (or whereever you installed GTK+),
- so it looks something like:
-<verb>
-/usr/X11R6/lib
-/usr/local/lib
-</verb>
-Then you need to run /sbin/ldconfig as root.
-<p>
-<item>Make sure the linker is finding the correct set of libraries. If you
-have a Linux distribution that installs GTK+ (e.g. RedHat 5.0) then this
-older version may be used. Now (assuming you have a RedHat
-system), issue the command
-<verb>
-rpm -e gtk gtk-devel
-</verb>
-You may also want to remove the packages that depend on gtk (rpm will tell you
-which ones they are). If you don't have a RedHat Linux system, check to make sure
-that neither <verb>/usr/lib</verb> or <verb>/usr/local/lib</verb> contain any of
-the libraries libgtk, libgdk, libglib, or libgck. If they do exist, remove them
-(and any gtk include files, such as /usr/include/gtk and /usr/include/gdk)
-and reinstall gtk+.
-</itemize>
-
-<!-- ***************************************************************** -->
-<sect>Development of GTK+
-<!-- ***************************************************************** -->
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>When will it reach version 1.0?
-<p>
-The file 'TODO' in the gtk+ distribution lists the things that need to be done
-before version 1.0 is repleased. Not including bugs, this includes:
-
-<itemize>
-<item>New Features
-<itemize>
-<item>gdk_expose_compress: ala-Xt, this would really help for opaque moves and
- such
-</itemize>
-<p>
-
-<item>Widgets
-<itemize>
-<item>Column-list (Jay Painter)
-<item>Text widget (needs to be finished)
-<item>Entry should have a password mode (and it should show stars
- for user feedback)
-</itemize>
-<p>
-
-<item>Drag-and-Drop (DND)
-<itemize>
-<item> It seems to be having problems again. The way DND data types are set in
- GtkWidget really needs to be fixed. This is pretty high on my priority
- list, and I'll get to it as soon as the column list widget is done. The
- correct way dnd data needs to be set is to have a additional keyed data
- type with GtkWidget, which is applied to the widget's window upon realize.
- There also needs to be a way to set dnd-data on widget windows which are
- not the main window (for widgets that create more than one window).
- -- Jay Painter
-<item> DnD seems to work for me, but yes, there needs to be some sort of
- gtk_widget layer that makes it easier... Also, adding support for drop
- zones might be nice.
- -- Elliot
-</itemize>
-</itemize>
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>Whats this CVS thing that everyone keeps talking about, and how do I access it?
-<p>
-CVS is the Concurent Version System and is a very popular mean of
-version control for software projects. It is designed to allow multiple
-authors to be able to simultanously operate on the same source tree.
-This source tree is centrally maintained, but each developer has a
-local mirror of this repository that they make there changes to.
-
-The GTK+ developers use a CVS repository to store the master copy of
-the current development version of GTK+. As such, people wishing to
-contribute patches to GTK+ should generate them against the CVS version.
-Normal people should use the packaged releases.
-
-The CVS toolset is available as RPM packages from the usual RedHat sites.
-The latest version is available at
-<htmlurl url="http://download.cyclic.com/pub/"
-name="&lt;http://download.cyclic.com/pub/&gt;">
-
-Anyone can download the latest CVS version of GTK+ by using anonymous access
-using the following steps:
-<itemize>
-<item> In a bourne shell descendant (e.g. bash) type:
-<verb>
-export CVSROOT=':pserver:anonymous@cvs.gimp.org:/debian/home/gnomecvs'
-</verb>
-<item>Next, the first time the source tree is checked out, a cvs login
-is needed.
-<verb>
-cvs login
-</verb>
-This will ask you for a password. There is no password for cvs.gimp.org,
-so just enter a carriage return.
-<item>To get the tree and place it in a subdir of your current working directory, issue the command:
-<verb>
-cvs -z9 get gtk+
-</verb>
-</itemize>
-<!-- ----------------------------------------------------------------- -->
-<sect1>How can I contribute to GTK+?
-<p>
-It's simple. If something doesn't work like you think it should in a program,
-check the documentation to make sure you're not missing something. If it is a
-true bug or missing feature, track it down in the GTK+ source, change it,
-and then generate a patch in the form of a 'context diff'. This can be done
-using a command such as <tt/diff -ru &lt;oldfile&gt; &lt;newfile&gt;/.
-Then upload the patchfile to:
-<verb>
-ftp://ftp.gimp.org/incoming
-</verb>
-along with a README file. Make sure you follow the naming conventions or your
-patch will just be deleted! The filenames should be of this form:
-<verb>
-gtk-<username>-<date yymmdd-n>.patch.gz
-gtk-<username>-<date yymmdd-n>.patch.README
-</verb>
-The "n" in the date indicates a unique number (starting from 0)
-of patches you uploaded that day. It should be 0, unless you
-upload more than one patch in the same day.
-
-Example:
-<verb>
-gtk-gale-982701-0.patch.gz
-gtk-gale-982701-0.patch.README
-</verb>
-Once you upload <em>anything</em>, send the README to ftp-admin@gimp.org
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>How do I know if my patch got applied, and if not, why not?
-<p>
-Uploaded patches will be moved to <tt>ftp://ftp.gimp.org/pub/gtk/patches</tt>
-where one of the GTK+ development team will pick them up. If applied, they
-will be moved to <tt>/pub/gtk/patches/old</tt>.
-
-Patches that aren't applied, for whatever reason, are moved to
-<tt>/pub/gtk/patches/unapplied</tt> or <tt>/pub/gtk/patches/outdated</tt>.
-At this point you can ask on the <tt/gtk-list/ mailing list why your patch
-wasn't applied. There are many possible reasons why patches may not be
-applied, ranging from it doesn't apply cleanly, to it isn't right. Don't
-be put off if your patch didn't make it first time round.
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>What is the policy on incorporating new widgets into the library?
-<p>
-This is up to the authors, so you will have to ask them once you
-are done with your widget. As a general guideline, widgets that are
-generally useful, work, and are not a disgrace to the widget set will
-gladly be included.
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>Is anyone working on bindings for languages other than C?
-<p>
-Yes. There is
-<itemize>
-<item>a C++ wrapper for GTK+ called gtk--. You can find the home page at:
-<verb>
-http://www.cs.tut.fi/~p150650/gtk/gtk--.html
-</verb>
-The FTP site is:
-<verb>
-ftp://ftp.gimp.org/pub/gtk/gtk--/
-</verb>
-<p>
-
-<item>There are two Objective-c bindings currently in development:
-
- <itemize>
-
- <item>The <htmlurl url="http://www.gnome.org/" name="GNOME project's"> package
- of choice is obgtk. Objgtk is based on the Object class and is maintained by
- <htmlurl url="mailto:sopwith@cuc.edu" name="Elliot Lee">. Apparently, objgtk
- is being accepted as the `standard' Objective-C binding for GTK+.
-
- <item>If you are more inclined towards the
- <htmlurl url="http://www.gnustep.org/" name="GNUstep project">,
- you may want to check out GTKKit by
- <htmlurl url="mailto:helge@mdlink.de" name="Helge Heszlig">.
- The intention is to setup a GTK+ binding using the FoundationKit.
- GTKKit includes nicities like writing a XML-type template file to
- construct a GTK+ interface.
-
- </itemize>
-<p>
-<item>Perl bindings
-<verb>
-ftp://ftp.gimp.org/pub/gtk/perl
-</verb>
-
-<item>Guile bindings. The home page is at:
-<verb>
-http://www.ping.de/sites/zagadka/guile-gtk/
-</verb>
-By the way, Guile is the GNU Project's implemention of R4RS Scheme (the
-standard). If you like Scheme, you may want to take a look at this.
-<p>
-
-<item>David Monniaux reports:
-<quote>I've started a gtk-O'Caml binding system.
-The basics of the system, including callbacks, work fine.
-
-The current development is in
-http://www.ens-lyon.fr/~dmonniau/arcs/
-</quote>
-
-<item>
-Several python-gtk interfaces have been done. python-gtk is at:
-<verb>
-http://www.acs.ucalgary.cs/~nashceme/python-gtk/
-</verb>
-If you try python-gtk and don't like it, there's also pygtk located at:
-<verb>
-ftp://ftp.gimp.org/pub/gtk/python/
-</verb>
-
-<item>
-There's a OpenGL/Mesa widget available for GTK+. Grab it at:
-<verb>
-http://www.sakuranet.or.jp/~aozasa/shige/doc/comp/gtk/gtkGL/files-en.html
-</verb>
-
-</itemize>
-
-<!-- ***************************************************************** -->
-<sect>Development with GTK+
-<!-- ***************************************************************** -->
-<!-- ----------------------------------------------------------------- -->
-<sect1>How do I get started?
-<p>
-So, after you have installed GTK+ there are a couple of things that can
-ease you into developing applications with it. There is the
-GTK+ Tutorial <htmlurl url="http://www.levien.com/~slow/gtk/tutorial"
-name="&lt;http://www.levien.com/~slow/gtk/tutorial&gt;">, which is undergoing development. This will introduce you
-to writing applications using C.
-
-The Tutorial doesn't (yet) contain information on all of the widgets
-that are in GTK+. For example code on how to use the basics of all the
-GTK+ widgets you should look at the file gtk/testgtk.c (and associated
-source files) within the GTK+ distribution. Looking at these exmaples will
-give you a good grounding on what the widgets can do.
-
-<sect1>What widgets are in GTK?
-<p>
-The GTK+ Tutorial lists the following widgets:
-<verb>
- GtkObject
- +GtkData
- | +GtkAdjustment
- | `GtkTooltips
- `GtkWidget
- +GtkContainer
- | +GtkBin
- | | +GtkAlignment
- | | +GtkEventBox
- | | +GtkFrame
- | | | `GtkAspectFrame
- | | +GtkHandleBox
- | | +GtkItem
- | | | +GtkListItem
- | | | +GtkMenuItem
- | | | | `GtkCheckMenuItem
- | | | | `GtkRadioMenuItem
- | | | `GtkTreeItem
- | | +GtkViewport
- | | `GtkWindow
- | | +GtkColorSelectionDialog
- | | +GtkDialog
- | | | `GtkInputDialog
- | | `GtkFileSelection
- | +GtkBox
- | | +GtkButtonBox
- | | | +GtkHButtonBox
- | | | `GtkVButtonBox
- | | +GtkHBox
- | | | +GtkCombo
- | | | `GtkStatusbar
- | | `GtkVBox
- | | +GtkColorSelection
- | | `GtkGammaCurve
- | +GtkButton
- | | +GtkOptionMenu
- | | `GtkToggleButton
- | | `GtkCheckButton
- | | `GtkRadioButton
- | +GtkCList
- | +GtkFixed
- | +GtkList
- | +GtkMenuShell
- | | +GtkMenuBar
- | | `GtkMenu
- | +GtkNotebook
- | +GtkPaned
- | | +GtkHPaned
- | | `GtkVPaned
- | +GtkScrolledWindow
- | +GtkTable
- | +GtkToolbar
- | `GtkTree
- +GtkDrawingArea
- | `GtkCurve
- +GtkEditable
- | +GtkEntry
- | | `GtkSpinButton
- | `GtkText
- +GtkMisc
- | +GtkArrow
- | +GtkImage
- | +GtkLabel
- | | `GtkTipsQuery
- | `GtkPixmap
- +GtkPreview
- +GtkProgressBar
- +GtkRange
- | +GtkScale
- | | +GtkHScale
- | | `GtkVScale
- | `GtkScrollbar
- | +GtkHScrollbar
- | `GtkVScrollbar
- +GtkRuler
- | +GtkHRuler
- | `GtkVRuler
- `GtkSeparator
- +GtkHSeparator
- `GtkVSeparator
-</verb>
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>How can I prevent redrawing and resizing while I change multiple widgets?
-<p>
-Use gtk_container_disable_resize and gtk_container_enable_resize around the
-code where you are changing a lot of stuff. This will result in much faster
-speed since it will prevent resizing of the entire widget hierarchy.
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>How do I catch a double click event in a list widget?
-<p>
-Tim Janik wrote to gtk-list (slightly modified):
-
-Define a signal handler:
-
-<tscreen><verb>
-gint
-signal_handler_event(GtkWiget *widget, GdkEvenButton *event, gpointer func_data)
-{
- if (GTK_IS_LIST_ITEM(widget) &&
- (event->type==GDK_2BUTTON_PRESS ||
- event->type==GDK_3BUTTON_PRESS) ) {
- printf("I feel %s clicked on button %d\",
- event->type==GDK_2BUTTON_PRESS ? "double" : "triple",
- event->button);
- }
-
- return FALSE;
-}
-</verb></tscreen>
-
-And connect the handler to your object:
-
-<tscreen><verb>
-{
- /* list, list item init stuff */
-
- gtk_signal_connect(GTK_OBJECT(list_item),
- "button_press_event",
- GTK_SIGNAL_FUNC(signal_handler_event),
- NULL);
-
- /* and/or */
-
- gtk_signal_connect(GTK_OBJECT(list_item),
- "button_release_event",
- GTK_SIGNAL_FUNC(signal_handler_event),
- NULL);
-
- /* something else */
-}
-</verb></tscreen>
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>How do I find out about the selection of a GtkList?
-<p>
-
-Get the selection something like this:
-<tscreen><verb>
-GList *sel;
-sel = GTK_LIST(list)->selection;
-</verb></tscreen>
-
-This is how GList is defined (quoting glist.h):
-<tscreen><verb>
-typedef struct _GList GList;
-
-struct _GList
-{
- gpointer data;
- GList *next;
- GList *prev;
-};
-</verb></tscreen>
-
-A GList structure is just a simple structure for doubly linked lists.
-there exist several g_list_*() functions to modify a linked list in
-glib.h. However the GTK_LIST(MyGtkList)->selection is maintained
-by the gtk_list_*() functions and should not be modified.
-
-The selection_mode of the GtkList determines the selection
-facilities of a GtkList and therefore the contents
-of GTK_LIST(AnyGtkList)->selection:
-
-<verb>
-selection_mode GTK_LIST()->selection contents
-------------------------------------------------------
-
-GTK_SELECTION_SINGLE) selection is either NULL
- or contains a GList* pointer
- for a single selected item.
-
-GTK_SELECTION_BROWSE) selection is NULL if the list
- contains no widgets, otherwise
- it contains a GList* pointer
- for one GList structure.
-GTK_SELECTION_MULTIPLE) selection is NULL if no listitems
- are selected or a a GList* pointer
- for the first selected item. that
- in turn points to a GList structure
- for the second selected item and so
- on
-
-GTK_SELECTION_EXTENDED) selection is NULL.
-</verb>
-
-The data field of the GList structure GTK_LIST(MyGtkList)->selection points
-to the first GtkListItem that is selected. So if you would like to determine
-which listitems are selected you should go like this:
-
-Upon Initialization:
-<tscreen><verb>
-{
- gchar *list_items[]={
- "Item0",
- "Item1",
- "foo",
- "last Item",
- };
- guint nlist_items=sizeof(list_items)/sizeof(list_items[0]);
- GtkWidget *list_item;
- guint i;
-
- list=gtk_list_new();
- gtk_list_set_selection_mode(GTK_LIST(list), GTK_SELECTION_MULTIPLE);
- gtk_container_add(GTK_CONTAINER(AnyGtkContainer), list);
- gtk_widget_show (list);
-
- for (i = 0; i < nlist_items; i++)
- {
- list_item=gtk_list_item_new_with_label(list_items[i]);
- gtk_object_set_user_data(GTK_OBJECT(list_item), (gpointer)i);
- gtk_container_add(GTK_CONTAINER(list), list_item);
- gtk_widget_show(list_item);
- }
-}
-</verb></tscreen>
-
-To get known about the selection:
-<tscreen><verb>
-{
- GList *items;
-
- items=GTK_LIST(list)->selection;
-
- printf("Selected Items: ");
- while (items) {
- if (GTK_IS_LIST_ITEM(items->data))
- printf("%d ", (guint)
- gtk_object_get_user_data(items->data));
- items=items->next;
- }
- printf("\n");
-}
-</verb></tscreen>
-<!-- ----------------------------------------------------------------- -->
-<sect1>Is it possible to get some text displayed which is truncated to fit inside its allocation?
-<p>
-GTK's behavior (no clipping) is a consequence of its attempts to
-conserve X resources. Label widgets (among others) don't get their own
-X window - they just draw their contents on their parent's window.
-While it might be possible to have clipping occur by setting the clip
-mask before drawing the text, this would probably cause a substantial
-performance penalty.
-
-Its possible that, in the long term, the best solution to such
-problems might be just to change gtk to give labels X windows.
-A short term workaround is to put the label widget inside another
-widget that does get it's own window - one possible candidate would
-be the viewport widget.
-
-<tscreen><verb>
-viewport = gtk_viewport (NULL, NULL);
-gtk_widget_set_usize (viewport, 50, 25);
-gtk_viewport_set_shadow_type (GTK_VIEWPORT(viewport), GTK_SHADOW_NONE);
-gtk_widget_show(viewport);
-
-label = gtk_label ("a really long label that won't fit");
-gtk_container_add (GTK_CONTAINER(viewport), label);
-gtk_widget_show (label);
-</verb></tscreen>
-
-If you were doing this for a bunch of widgets, you might want to
-copy gtkviewport.c and strip out the adjustment and shadow
-functionality (perhaps you could call it GtkClipper).
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>Why don't the contents of a button move when the button is pressed? Here's a patch to make it work that way...
-<p>
-From: Peter Mattis
-
-The reason buttons don't move their child down and to the right when
-they are depressed is because I don't think that's what is happening
-visually. My view of buttons is that you are looking at them straight
-on. That is, the user interface lies in a plane and you're above it
-looking straight at it. When a button gets pressed it moves directly
-away from you. To be absolutely correct I guess the child should
-actually shrink a tiny amount. But I don't see why the child should
-shift down and to the left. Remember, the child is supposed to be
-attached to the buttons surface. Its not good for it to appear like
-the child is slipping on the surface of the button.
-
-On a more practical note, I did implement this at one point and
-determined it didn't look good and removed it.
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>How can I define a separation line in a menu?
-<p>
-See the <htmlurl url="http://www.levien.com/~slow/gtk/"
-name="Tutorial"> for information on how to create menus.
-However, to create a separation line in a menu, just insert an
-empty menu item:
-
-<tscreen><verb>
-menuitem = gtk_menu_item_new();
-gtk_menu_append(GTK_MENU(menu), menuitem);
-gtk_widget_show(menuitem);
-</verb></tscreen>
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>How can I right justify a menu, such as Help, when using the MenuFactory?
-<p>
-Use something like the following:
-
-<tscreen><verb>
-menu_path = gtk_menu_factory_find (factory, "<MyApp>/Help");
-gtk_menu_item_right_justify(menu_path->widget);
-</verb></tscreen>
-
-<!-- ***************************************************************** -->
-<sect>About gdk
-<!-- ***************************************************************** -->
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>What is gdk?
-<p>
-gdk is basically a wrapper around the standard Xlib function calls. If you are
-at all familiar with Xlib, a lot of the functions in gdk will require little
-or no getting used to. All functions are written to provide an easy way
-to access Xlib functions in an easier an slightly more intuitive manner.
-In addition, since gdk uses glib (see below), it will be more portable
-and safer to use on multiple platforms.
-
-<!-- Examples, anybody? I've been mulling some over. NF -->
-
-<sect1>How do I use color allocation?
-<p>
-One of the nice things about GDK is that it's based on top of Xlib; this is
-also a problem, especially in the area of color management. If you want
-to use color in your program (drawing a rectangle or such, your code
-should look something like this:
-<tscreen>
-<verb>
-{
- GdkColor *color;
- int width, height;
- GtkWidget *widget;
- GdkGC *gc;
-
- ...
-
- /* first, create a GC to draw on */
- gc = gdk_gc_new(widget->window);
-
- /* find proper dimensions for rectangle */
- gdk_window_get_size(widget->window, &amp;width, &amp;height);
-
- /* the color we want to use */
- color = (GdkColor *)malloc(sizeof(GdkColor));
-
- /* red, green, and blue are passed values, indicating the RGB triple
- * of the color we want to draw. Note that the values of the RGB components
- * within the GdkColor are taken from 0 to 65535, not 0 to 255.
- */
- color->red = red * (65535/255);
- color->green = green * (65535/255);
- color->blue = blue * (65535/255);
-
- /* the pixel value indicates the index in the colormap of the color.
- * it is simply a combination of the RGB values we set earlier
- */
- color->pixel = (gulong)(red*65536 + green*256 + blue);
-
- /* However, the pixel valule is only truly valid on 24-bit (TrueColor)
- * displays. Therefore, this call is required so that GDK and X can
- * give us the closest color available in the colormap
- */
- gdk_color_alloc(gtk_widget_get_colormap(widget), color);
-
- /* set the foreground to our color */
- gdk_gc_set_foreground(gc, color);
-
- /* draw the rectangle */
- gdk_draw_rectangle(widget->window, gc, 1, 0, 0, width, height);
-
- ...
-}
-</verb>
-</tscreen>
-
-<!-- ***************************************************************** -->
-<sect>About glib
-<!-- ***************************************************************** -->
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>What is glib?
-<p>
-glib is a library of useful functions and definitions available for use
-when creating GDK and GTK applications. It provides replacements for some
-standard libc functions, such as malloc, which are buggy on some systems.
-<p>
-It also provides routines for handling:
-<itemize>
-<item>Doubly Linked Lists
-<item>Singly Linked Lists
-<item>Timers
-<item>String Handling
-<item>A Lexical Scanner
-<item>Error Functions
-</itemize>
-
-<!-- Some Examples might be useful here! NF -->
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>Why use g_print, g_malloc, g_strdup and fellow glib functions ?
-<p>
-Thanks to Tim Janik who wrote to gtk-list: (slightly modified)
-<quote>
-Regarding g_malloc(), g_free() and siblings, these functions are much safer
-than thier libc equivalences. For example, g_free() just returns if called
-with NULL. Also, if USE_DMALLOC is defined, the definition for these
-functions changes (in glib.h) to use MALLOC(), FREE() etc... If MEM_PROFILE
-or MEM_CHECK are defined, there are even small statistics made counting
-the used block sizes (shown by g_mem_profile() / g_mem_check()).
-<p>
-Considering the fact that glib provides an interface for memory chunks
-to save space if you have lots of blocks that are always the same size
-and to mark them ALLOC_ONLY if needed, it is just straight forward to
-create a small saver (debug able) wrapper around the normal malloc/free
-stuff as well - just like gdk covers Xlib. ;)
-<p>
-Using g_error() and g_warning() inside of applications like the GIMP
-that fully rely on gtk even gives the opportunity to pop up a window
-showing the messages inside of a gtk window with your own handler
-(by using g_set_error_handler()) along the lines of gtk_print()
-(inside of gtkmain.c).
-</quote>
-
-<!-- ***************************************************************** -->
-<sect>GTK+ FAQ Contributions, Maintainers and Copyright
-<p>
-If you would like to make a contribution to the FAQ, send either one of us
-an e-mail message with the exact text you think should be included (question and
-answer). With your help, this document can grow and become more useful!
-
-This document is maintained by Nathan Froyd
-<htmlurl url="mailto:maestrox@geocities.com" name="&lt;maestrox@geocities.com&gt;">
-and Tony Gale <htmlurl url="mailto:gale@gimp.org" name="&lt;gale@gimp.org&gt;">.
-This FAQ was created by Shawn T. Amundson <htmlurl url="mailto:amundson@gimp.org"
-name="&lt;amundson@gimp.org&gt;">who continues to provide support.
-
-The GTK+ FAQ is Copyright (C) 1997,1998 by Shawn T. Amundson, Nathan Froyd and Tony Gale.
-
-Permission is granted to make and distribute verbatim copies of this manual provided the
-copyright notice and this permission notice are preserved on all copies.
-
-Permission is granted to copy and distribute modified versions of this document under the conditions
-for verbatim copying, provided that this copyright notice is included exactly as in the original,
-and that the entire resulting derived work is distributed under the terms of a permission
-notice identical to this one.
-
-Permission is granted to copy and distribute translations of this document into another language,
-under the above conditions for modified versions.
-
-If you are intending to incorporate this document into a published work, please contact one of
-the maintainers, and we will make an effort to ensure that you have the most up to date
-information available.
-
-There is no guarentee that this document lives up to its intended
-purpose. This is simply provided as a free resource. As such,
-the authors and maintainers of the information provided within can
-not make any guarentee that the information is even accurate.
-
-</article>
diff --git a/docs/gdk.texi b/docs/gdk.texi
deleted file mode 100644
index 4e4b84f5d7..0000000000
--- a/docs/gdk.texi
+++ /dev/null
@@ -1,334 +0,0 @@
-\input texinfo @c -*-texinfo-*-
-@c %**start of header
-@setfilename gdk.info
-@settitle GDK
-@setchapternewpage odd
-@c %**end of header
-
-@set edition 1.0
-@set update-date 16 May 1996
-@set update-month May 1996
-
-@ifinfo
-This file documents GDK, the General Drawing Kit
-
-Copyright (C) 1996 Peter Mattis
-
-Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice are
-preserved on all copies
-
-@ignore
-Permission is granted to process this file throught TeX and print the
-results, provided the printed document carries copying permission notice
-identical to this one except for the removal of this paragraph (this
-paragraph not being relevant to the printed manual).
-
-@end ignore
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided that the
-entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions,
-except that this permission notice may be stated in a translation
-approved by Peter Mattis.
-@end ifinfo
-
-@titlepage
-@title The General Drawing Kit
-@subtitle Version 1.0
-@subtitle @value{update-month}
-@author by Peter Mattis
-
-@page
-@vskip 0pt plus 1filll
-Copyright @copyright{} 1996 Peter Mattis
-
-Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice are
-preserved on all copies.
-
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided that the
-entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions,
-except that this permission notice may be stated in a translation
-approved by Peter Mattis.
-@end titlepage
-
-@dircategory User Interface Toolkit
-@direntry
-* GDK: (gdk). The General Drawing Kit
-@end direntry
-
-@node Top, Copying, (dir), (dir)
-@top The General Drawing Kit
-@ifinfo
-This is edition @value{edition} of the GDK documentation,
-@w{@value{update-date}}.
-@end ifinfo
-
-@menu
-* Copying:: Your rights.
-* Overview:: What is GDK?
-* Initialization:: Initialization and exit.
-* Events:: Event handling.
-* Visuals:: Understanding and using visuals.
-* Windows:: Creating and using windows.
-* Graphics Contexts:: Creating and modifying GCs.
-* Pixmaps:: Creating pixmaps.
-* Images:: Creating images.
-* Color:: Specifying color.
-* Fonts:: Creating fonts.
-* Drawing:: Drawing commands.
-* XInput Support:: Using extended devices.
-* Miscellany:: Other stuff.
-* Examples:: Using GDK.
-* Function Index:: Index of functions
-* Concept Index:: Index of concepts
-@end menu
-
-@node Copying, Overview, Top, Top
-@comment node-name, next, previous, up
-@chapter Copying
-
-GDK is @dfn{free}; this means that everyone is free to use it and free
-to redestribute it on a free basis. GDK is not in the public domain; it
-is copyrighted and there are restrictions on its distribution, but these
-restrictions are designed to permit everything that a good cooperating
-citizen would want to do. What is not allowed is to try to prevent
-others from further sharing any version of GDK that they might get from
-you.
-
-Specifically, we want to make sure that you have the right to give away
-copies of GDK, that you receive source code or else can get it if you
-want it, that you can change GDK or use pieces of it in new free
-programs, and that you know you can do these things.
-
-To make sure that everyone has such rights, we have to forbid you to
-deprive anyone else of these rights. For example, if you distribute
-copies of GDK, you must give the recipients all the rights that you
-have. You must make sure that they, too, receive or can get the source
-code. And you must tell them their rights.
-
-Also, for my own protection, we must make certain that everyone finds
-out that there is no warranty for GDK. If GDK is modified by someone
-else and passed on, we want their recipients to know that what they have
-is not what we distributed, so that any problems introduced by others
-will no reflect on our reputation.
-
-The precise conditions of the licenses for GDK are found in the General
-Public Licenses that accompanies it.
-
-
-@node Overview, Initialization, Copying, Top
-@comment node-name, next, previous, up
-@chapter What is GDK?
-@cindex Overview
-
-GDK is designed as a wrapper library that lies on top of Xlib. It
-performs many common and desired operations for a programmer instead
-of the programmer having to explicitly ask for such functionality from
-Xlib directly. For example, GDK provides a common interface to both
-regular and shared memory XImage types. By doing so, an application
-can nearly transparently use the fastest image type available. GDK
-also provides routines for determining the best available color depth
-and the best available visual which is not always the default visual
-for a screen.
-
-@node Initialization, Events, Overview, Top
-@comment node-name, next, previous, up
-@chapter Initialization and exit
-@cindex Initialization
-@cindex Exit
-
-Initializing GDK is easy. Simply call @code{gdk_init} passing in the
-@var{argc} and @var{argv} parameters. Exit is similarly easy. Just
-call @code{gdk_exit}.
-
-@deftypefun void gdk_init (int *@var{argc}, char ***@var{argv})
-Initializes the GDK library. The arguments @var{argc} and @var{argv}
-are scanned and any arguments that GDK recognizes are handled and
-removed. The @var{argc} and @var{argv} parameters are the values
-passed to @code{main} upon program invocation.
-@end deftypefun
-
-@deftypefun void gdk_exit (int @var{errorcode})
-Exit GDK and perform any necessary cleanup. @code{gdk_exit} will call
-the systems @code{exit} function passing @var{errorcode} as the
-parameter.
-@end deftypefun
-
-@example
-int
-main (int argc, char *argv[])
-@{
- /* Initialize GDK. */
- gdk_init (&argc, &argv);
-
- /* Exit from GDK...this call will never return. */
- gdk_exit (0);
-
- /* Keep compiler from issuing a warning */
- return 0;
-@}
-@end example
-
-
-@node Events, Visuals, Initialization, Top
-@comment node-name, next, previous, up
-@chapter Event handling
-@cindex Events
-
-Events are the means by which GDK lets the programmer know of user
-interaction. An event is normally a button or key press or some other
-indirect user action, such as a the mouse cursor entering or leaving a
-window.
-
-There exist only a few functions for getting events and event
-information. These are @code{gdk_events_pending},
-@code{gdk_event_get}, @code{gdk_events_record} and
-@code{gdk_events_playback}. The latter two functions are useful for
-automatic testing of a software package and should normally not be
-needed in a program.
-
-@deftypefun gint gdk_events_pending (void)
-Returns the number of events pending on the event queue.
-@end deftypefun
-
-@deftypefun gint gdk_event_get (GdkEvent *@var{event})
-Return the next available event in the @var{event}
-structure. @code{gdk_event_get} will return @code{TRUE} on success and
-@code{FALSE} on failure. Success and failure is determined by whether
-an event arrived before the timeout period expired.
-@end deftypefun
-
-@deftypefun void gdk_events_record (char *@var{filename})
-Turn on recording of events. User events and certain system events will
-be saved in the file named by the variable @var{filename}. This stream
-of events can later be played back and ``should'' produce the same
-results as when the original events were handled. However, the
-programmer does need to be careful in that the state of the program must
-be the same when @code{gdk_events_record} is called and when
-@code{gdk_events_playback} is called. For this reason,
-@code{gdk_events_record} is normally not called directly, but is instead
-invoked indirectly by specifying the ``-record'' command line option.
-@end deftypefun
-
-@deftypefun void gdk_events_playback (char *@var{filename})
-Start playback of events from a file. (See the above description of
-@code{gdk_events_record}). Normally this function is not called directly
-but is invoked by the ``-playback'' command line option.
-@end deftypefun
-
-@deftypefun void gdk_events_stop (void)
-Stop recording and playback of events.
-@end deftypefun
-
-@example
-void
-handle_event ()
-@{
- GdkEvent event;
-
- if (gdk_event_get (&event))
- @{
- switch (event.type)
- @{
- @dots{}
- @}
- @}
-@}
-@end example
-
-
-@node Visuals, Windows, Events, Top
-@comment node-name, next, previous, up
-@chapter Understanding and using visuals
-@cindex Visuals
-
-@node Windows, Graphics Contexts, Visuals, Top
-@comment node-name, next, previous, up
-@chapter Creating and using windows
-@cindex Windows
-
-@node Graphics Contexts, Pixmaps, Windows, Top
-@comment node-name, next, previous, up
-@chapter Creating and modifying GCs
-@cindex Graphics Contexts
-@cindex GC
-
-@node Pixmaps, Images, Graphics Contexts, Top
-@comment node-name, next, previous, up
-@chapter Creating pixmaps
-@cindex Pixmaps
-
-@node Images, Color, Pixmaps, Top
-@comment node-name, next, previous, up
-@chapter Creating images
-@cindex Images
-
-@node Color, Fonts, Images, Top
-@comment node-name, next, previous, up
-@chapter Specifying color
-@cindex Color
-
-@node Fonts, Drawing, Color, Top
-@comment node-name, next, previous, up
-@chapter Creating Fonts
-@cindex Fonts
-
-@node Drawing, XInput Support, Fonts, Top
-@comment node-name, next, previous, up
-@chapter Drawing Commands
-@cindex Drawing
-
-@node XInput Support, Miscellany, Drawing, Top
-@comment node-name, next, previous, up
-@chapter Using extended devices
-@cindex Overview
-@cindex Using extended device capabilities
-@cindex Controlling extended devices
-
-@node Miscellany, Examples, XInput Support, Top
-@comment node-name, next, previous, up
-@chapter Other stuff
-@cindex Timers
-@cindex Debugging
-@cindex Miscellaneous
-
-
-@node Examples, Function Index, Miscellany, Top
-@comment node-name, next, previous, up
-@chapter Using GDK
-@cindex Examples
-
-
-@node Function Index, Concept Index, Examples, Top
-@comment node-name, next, previous, up
-@unnumbered Variable Index
-
-@printindex fn
-
-@node Concept Index, , Function Index, Top
-@comment node-name, next, previous, up
-@unnumbered Concept Index
-
-@printindex cp
-
-@summarycontents
-@contents
-@bye
-
-
-
-
-
-
-
-
diff --git a/docs/glib.texi b/docs/glib.texi
deleted file mode 100644
index 1bf23e191b..0000000000
--- a/docs/glib.texi
+++ /dev/null
@@ -1,455 +0,0 @@
-\input texinfo @c -*-texinfo-*-
-@c %**start of header
-@setfilename glib.info
-@settitle GLIB
-@setchapternewpage odd
-
-@set edition 1.0
-@set update-date 3 Feburary 1998
-@set update-month Feburary 1998
-@c %**end of header
-
-@ifinfo
-This file documents GLIB, A library of useful routines for C programming
-
-Copyright (C) 1998 Gregory A McLean
-
-Permission is granted to make and distributed verbatim copies of this
-manual, provided the copyright notice and this permission notice are
-preserved on all copies.
-
-@ignore
-Permission is granted to process this file throught TeX and print the
-results, provided the printed document carries copying permission notice
-identical to this one except for the removal of this paragraph (this
-paragraph not being relevant to the printed manual).
-
-@end ignore
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided that the
-entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions,
-except that this permission notice may be stated in a translation
-approved by Gregory McLean.
-@end ifinfo
-
-@titlepage
-@title GLIB, Useful routines for C programming
-@subtitle Version 1.0
-@subtitle @value{update-month}
-@author by Gregory McLean
-
-@page
-@vskip 0pt plus 1filll
-Copyright @copyright{} 1998 Gregory McLean
-
-Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice are
-preserved on all copies.
-
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided that the
-entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions,
-except that this permission notice may be stated in a translation
-approved by Gregory McLean.
-@end titlepage
-
-@dircategory Library of useful routines for 'C' programing
-@direntry
-* GLIB: (glib). useful routines for 'C' programming
-@end direntry
-
-@node Top, Copying, (dir), (dir)
-@top useful routines for 'C' programming
-@ifinfo
-This is edition @value{edition} of the GLIB documentation,
-@w{@value{update-date}}.
-@end ifinfo
-
-@menu
-* Copying:: Your rights.
-* Overview:: What is GLIB?
-* Doubly linked lists:: Doubly linked lists
-* Signly linked lists:: Singly linked lists
-* List allocators:: List Allocators
-* Hash tables:: Hash tables
-* Caches:: Cache handling
-* Trees:: Tree handling
-* Memory:: Memory handling
-* Timers:: Timer functions
-* Output:: Output handling
-* Utilities:: Utilitiy functions
-* Errors:: Error handling
-* String Chunks:: String Chunks
-* Strings:: String handling
-* Resizable arrays:: Resizeable arrays
-* GScanner:: Flexible lexical scanner
-* Miscellany:: Other stuff
-* Function Index:: Index of functions
-* Concept Index:: Index of concepts
-@end menu
-
-@node Copying, Overview, Top, Top
-@comment node-name, next, previous, up
-@chapter Copying
-
-@node Overview, Doubly linked lists, Copying, Top
-@comment node-name, next, previous, up
-@chapter What is GLIB
-
-@node Doubly linked lists, Signly linked lists, Overview, Top
-@comment node-name, next, previous, up
-@chapter Doubly linked lists
-
-@subsection Functions
-
-@deftypefun GList* g_list_alloc (void)
-@end deftypefun
-
-@deftypefun void g_list_free (GList *@var{list})
-@end deftypefun
-
-@deftypefun void g_list_free_1 (GList *@var{list})
-@end deftypefun
-
-@deftypefun GList* g_list_append (GList *@var{list}, gpointer @var{data})
-@end deftypefun
-
-@deftypefun GList* g_list_prepend (GList *@var{list}, gpointer @var{data})
-@end deftypefun
-
-@deftypefun GList* g_list_insert (GList *@var{list}, gpointer @var{data}, gint @var{position})
-@end deftypefun
-
-@deftypefun GList* g_list_insert_sorted (GList *@var{list}, gpointer @var{data}, GCompareFunc @var{func})
-@end deftypefun
-
-@deftypefun GList* g_list_concat (GList *@var{list1}, GList *@var{list2})
-@end deftypefun
-
-@deftypefun GList* g_list_remove (GList *@var{list}, gpointer @var{data})
-@end deftypefun
-
-@deftypefun GList* g_list_remove_link (GList *@var{list}, GList *@var{link})
-@end deftypefun
-
-@deftypefun GList* g_list_reverse (GList *@var{list})
-@end deftypefun
-
-@deftypefun GList* g_list_nth (GList *@var{list}, gint @var{n})
-@end deftypefun
-
-@deftypefun GList* g_list_find (GList *@var{list}, gpointer @var{data})
-@end deftypefun
-
-@deftypefun GList* g_list_last (GList *@var{list})
-@end deftypefun
-
-@deftypefun GList* g_list_first (GList *@var{list})
-@end deftypefun
-
-@deftypefun gint g_list_length (GList *@var{list})
-@end deftypefun
-
-@deftypefun void g_list_foreach (GList *@var{list}, GFunc @var{func}, gpointer @var{user_data})
-@end deftypefun
-
-@node Signly linked lists, List allocators, Doubly linked lists, Top
-@comment node-name, next, previous, up
-@chapter Signly linked lists
-
-@subsection Functions
-@deftypefun GSList* g_slist_alloc (void)
-@end deftypefun
-
-@deftypefun void g_slist_free (GSList *@var{list})
-@end deftypefun
-
-@deftypefun void g_slist_free_1 (GSList *@var{list})
-@end deftypefun
-
-@deftypefun GSList* g_slist_append (GSList *@var{list}, gpointer @var{data})
-@end deftypefun
-
-@deftypefun GSList* g_slist_prepend (GSList *@var{list}, gpointer @var{data})
-@end deftypefun
-
-@deftypefun GSList* g_slist_insert (GSList *@var{list}, gpointer @var{data}, gint @var{position})
-@end deftypefun
-
-@deftypefun GSList* g_slist_insert_sorted (GSList *@var{list}, gpointer @var{data}, GCompareFunc @var{func})
-@end deftypefun
-
-@deftypefun GSList* g_slist_concat (GSList *@var{list1}, GSList *@var{list2})
-@end deftypefun
-
-@deftypefun GSList* g_slist_remove (GSList *@var{list}, gpointer @var{data})
-@end deftypefun
-
-@deftypefun GSList* g_slist_remove_link (GSList *@var{list}, GSList *@var{link})
-@end deftypefun
-
-@deftypefun GSList* g_slist_reverse (GSList *@var{list})
-@end deftypefun
-
-@deftypefun GSList* g_slist_nth (GSList *@var{list}, gint @var{n})
-@end deftypefun
-
-@deftypefun GSList* g_slist_find (GSList *@var{list}, gpointer @var{data})
-@end deftypefun
-
-@deftypefun GSList* g_slist_last (GSList *@var{list})
-@end deftypefun
-
-@deftypefun gint g_slist_length (GSList *@var{list})
-@end deftypefun
-
-@deftypefun void g_slist_foreach (GSList *@var{list}, GFunc @var{func}, gpointer @var{user_data})
-@end deftypefun
-
-@node List allocators, Hash tables, Signly linked lists, Top
-@comment node-name, next, previous, up
-@chapter List allocators
-
-@subsection Functions
-
-@deftypefun GListAllocator* g_list_allocator_new (void)
-@end deftypefun
-
-@deftypefun void g_list_allocator_free (GListAllocator *@var{allocator})
-@end deftypefun
-
-@deftypefun GListAllocator* g_slist_set_allocator (GListAllocator *@var{allocator})
-@end deftypefun
-
-@deftypefun GListAllocator* g_list_set_allocator (GListAllocator *@var{allocator})
-@end deftypefun
-
-@node Hash tables, Caches, List allocators, Top
-@comment node-name, next, previous, up
-@chapter Hash tables
-
-@subsection Functions
-
-@deftypefun GHashTable* g_hash_table_new (GHashFunc @var{hash_func}, GCompareFunc @var{key_compare_func})
-@end deftypefun
-
-@deftypefun void g_hash_table_destroy (GHashTable *@var{hash_table})
-@end deftypefun
-
-@deftypefun void g_hash_table_insert (GHashTable *@var{hash_table}, gpointer @var{key}, gpointer @var{value})
-@end deftypefun
-
-@deftypefun void g_hash_table_remove (GHashTable *@var{hash_table}, gpointer @var{key})
-@end deftypefun
-
-@deftypefun gpointer g_hash_table_lookup (GHashTable *@var{hash_table}, gpointer @var{key})
-@end deftypefun
-
-@deftypefun void g_hash_table_freeze (GHashTable *@var{hash_table})
-@end deftypefun
-
-@deftypefun void g_hash_table_thaw (GHashTable *@var{hash_table})
-@end deftypefun
-
-@deftypefun void g_hash_table_foreach (GHashTable *@var{hash_table}, GHFunc @var{func}, gpointer @var{user_data})
-@end deftypefun
-
-@node Caches, Trees, Hash tables, Top
-@comment node-name, next, previous, up
-@chapter Cache handling
-
-@subsection Functions
-
-@deftypefun GCache* g_cache_new (GCacheNewFunc @var{value_new_func}, GCacheDestroyFunc @var{value_destroy_func}, GCacheDupFunc @var{key_dup_func}, GCacheDestroyFunc @var{key_destroy_func}, GHashFunc @var{hash_key_func}, GHashFunc @var{hash_value_func}, GCompareFunc @var{key_compare_func})
-@end deftypefun
-
-@deftypefun void g_cache_destroy (GCache *@var{cache})
-@end deftypefun
-
-@deftypefun gpointer g_cache_insert (GCache *@var{cache}, gpointer @var{key})
-@end deftypefun
-
-@deftypefun void g_cache_remove (GCache *@var{cache}, gpointer @var{key})
-@end deftypefun
-
-@deftypefun void g_cache_key_foreach (GCache *@var{cache}, GHFunc @var{func}, gpointer @var{user_data})
-@end deftypefun
-
-@deftypefun void g_cache_value_foreach (GCache *@var{cache}, GHFunc @var{func}, gpointer @var{user_data})
-@end deftypefun
-
-@node Trees, Memory, Caches, Top
-@comment node-name, next, previous, up
-@chapter Tree handling
-
-@subsection Functions
-
-@deftypefun GTree* g_tree_new (GCompareFunc @var{key_compare_func})
-@end deftypefun
-
-@deftypefun void g_tree_destroy (GTree *@var{tree})
-@end deftypefun
-
-@deftypefun void g_tree_remove (GTree *@var{tree}, gpointer @var{key}, gpointer @var{value})
-@end deftypefun
-
-@deftypefun gpointer g_tree_lookup (GTree *@var{tree}, gpointer @var{key})
-@end deftypefun
-
-@deftypefun void g_tree_traverse (GTree *@var{tree}, GTraverseFunc @var{traverse_func}, GTraverseType @var{traverse_type}, gpointer @var{data}
-@end deftypefun
-
-@deftypefun gpointer g_tree_search (GTree *@var{tree}, GSearchFunc @var{search_func}, gpointer @var{data})
-@end deftypefun
-
-@deftypefun gint g_tree_height (GTree *@var{tree})
-@end deftypefun
-
-@deftypefun gint g_tree_nnodes (GTree *@var{tree})
-@end deftypefun
-
-@node Memory, Timers, Trees, Top
-@comment node-name, next, previous, up
-@chapter Memory handling
-
-@subsection Functions
-
-@deftypefun gpointer g_malloc (gulong @var{size})
-@end deftypefun
-
-@deftypefun gpointer g_malloc0 (gulong @var{size})
-@end deftypefun
-
-@deftypefun gpointer g_realloc (gpointer @var{mem}, gulong @var{size})
-@end deftypefun
-
-@deftypefun void g_mem_profile (void)
-@end deftypefun
-
-@deftypefun void g_mem_check (gpointer @var{mem})
-@end deftypefun
-
-@deftypefun GMemChunk* g_mem_chunk_new (gchar *@var{name}, gint @var{atom_size}, gulong @var{area_size}, gint @var{type})
-@end deftypefun
-
-@deftypefun void g_mem_chunk_destroy (GMemChunk *@var{mem_chunk})
-@end deftypefun
-
-@deftypefun gpointer g_mem_chunk_alloc (GMemChunk *@var{mem_chunk})
-@end deftypefun
-
-@deftypefun void g_mem_chunk_free (GMemChunk *@var{mem_chunk}, gpointer @var{mem})
-@end deftypefun
-
-@deftypefun void g_mem_chunk_clean (GMemChunk *@var{mem_chunk})
-@end deftypefun
-
-@deftypefun void g_mem_chunk_reset (GMemChunk *@var{mem_chunk})
-@end deftypefun
-
-@deftypefun void g_mem_chunk_print (GMemChunk *@var{mem_chunk})
-@end deftypefun
-
-@deftypefun void g_mem_chunk_info (void)
-@end deftypefun
-
-@deftypefun void g_blow_chunks (void)
-Not what you might be thinking, @code{g_blow_chunks()} simply compresses all
-the chunks. This operation consists of freeing every memory area that should
-be freed (but which we haven't gotten around to doing yet).
-@end deftypefun
-
-@node Timers, Output, Memory, Top
-@comment node-name, next, previous, up
-@chapter Timer functions
-
-@subsection Functions
-
-@deftypefun GTimer* g_timer_new (void)
-@end deftypefun
-
-@deftypefun void g_timer_destroy (GTimer *@var{timer})
-@end deftypefun
-
-@deftypefun void g_timer_start (GTimer *@var{timer})
-@end deftypefun
-
-@deftypefun void g_timer_stop (GTimer *@var{timer})
-@end deftypefun
-
-@deftypefun void g_timer_reset (GTimer *@var{timer})
-@end deftypefun
-
-@deftypefun gdouble g_timer_elapsed (GTimer *@var{timer}, gulong *@var{microseconds})
-@end deftypefun
-
-@node Output, Utilities, Timers, Top
-@comment node-name, next, previous, up
-@chapter Output functions
-
-@subsection Functions
-
-@deftypefun void g_error (gchar *@var{format}, @dots{})
-@end deftypefun
-
-@deftypefun void g_warning (gchar *@var{format}, @dots{})
-@end deftypefun
-
-@deftypefun void g_message (gchar *@var{format}, @dots{})
-@end deftypefun
-
-@deftypefun void g_print (gchar *@var{format}, @dots{})
-@end deftypefun
-
-@node Utilities, Errors, Output, Top
-@comment node-name, next, previous, up
-@chapter Utility functions
-
-@node Errors, String Chunks, Utilities, Top
-@comment node-name, next, previous, up
-@chapter Error handling
-
-@node String Chunks, Strings, Errors, Top
-@comment node-name, next, previous, up
-@chapter String chunks
-
-@node Strings, Resizable arrays, String Chunks, Top
-@comment node-name, next, previous, up
-@chapter String handling
-
-@node Resizable arrays, GScanner, Strings, Top
-@comment node-name, next, previous, up
-@chapter Resizable arrays
-
-@node GScanner, Miscellany, Resizable arrays, Top
-@comment node-name, next, previous, up
-@chapter Flexible lexical scanner
-
-@node Miscellany, Function Index, GScanner, Top
-@comment node-name, next, previous, up
-@chapter Other stuff
-
-@node Function Index, Concept Index, Miscellany, Top
-@comment node-name, next, previous, up
-@unnumbered Function Index
-
-@printindex fn
-
-@node Concept Index, , Function Index, Top
-@comment node-name, next, previous, up
-@unnumbered Concept Index
-
-@printindex cp
-
-@summarycontents
-@contents
-@bye
-
diff --git a/docs/gtk.texi b/docs/gtk.texi
deleted file mode 100644
index bc71aded7e..0000000000
--- a/docs/gtk.texi
+++ /dev/null
@@ -1,5085 +0,0 @@
-\input texinfo @c -*-texinfo-*-
-@c Copyright (C) 1996 by Peter Mattis. All rights reserved.
-@c
-@c %**start of header
-@setfilename gtk.info
-@settitle GTK
-@setchapternewpage odd
-@include macros.texi
-@c %**end of header
-
-@set edition 1.0
-@set update-date 29 January 1998
-@set update-month January 1998
-
-@ifinfo
-This file documents GTK, the General Toolkit
-
-Copyright (C) 1996 Peter Mattis
-Copyright (C) 1997 Peter Mattis
-
-Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice are
-preserved on all copies
-
-@ignore
-Permission is granted to process this file through TeX and print the
-results, provided the printed document carries copying permission notice
-identical to this one except for the removal of this paragraph (this
-paragraph not being relevant to the printed manual).
-
-@end ignore
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided that the
-entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions,
-except that this permission notice may be stated in a translation
-approved by Peter Mattis.
-@end ifinfo
-
-@titlepage
-@title The General Toolkit
-@subtitle Version @value{edition}
-@subtitle @value{update-month}
-@author by Peter Mattis
-
-@page
-@vskip 0pt plus 1filll
-Copyright @copyright{} 1996 Peter Mattis
-@vskip 0pt plus 1fill
-Copyright @copyright{} 1997 Peter Mattis
-
-Permission is granted to make and distribute verbatim copies of this
-manual provided the copyright notice and this permission notice are
-preserved on all copies.
-
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided that the
-entire resulting derived work is distributed under the terms of a
-permission notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions,
-except that this permission notice may be stated in a translation
-approved by Peter Mattis.
-@end titlepage
-
-@dircategory User Interface Toolkit
-@direntry
-* GTK: (gtk). The General Toolkit
-@end direntry
-
-@node Top, Copying, (dir), (dir)
-@top The General Toolkit
-@ifinfo
-This is edition @value{edition} of the GTK documentation,
-@w{@value{update-date}}.
-@end ifinfo
-@c FIXME: Do a introduction to the GTK?
-
-@menu
-* Copying:: Your rights.
-* Overview:: What is GTK?
-* Objects:: Object overview.
-* Signals:: Signals overview.
-* Widgets:: Widget overview.
-* Other Objects:: Utility objects.
-* Miscellaneous:: Initialization, exit and other features.
-* Examples:: Using GTK.
-* Object Implementation:: Object internals.
-* Signal Implementation:: Signal internals.
-* Widget Implementation:: Widget internals.
-* Function Index:: Index of functions.
-* Concept Index:: Index of concepts.
-@end menu
-
-@node Copying, Overview, Top, Top
-@comment node-name, next, previous, up
-@chapter Copying
-@cindex Copying
-
-GTK is @dfn{free}; this means that everyone is free to use it and free
-to redistribute it on a free basis. GTK is not in the public domain; it
-is copyrighted and there are restrictions on its distribution, but
-these restrictions are designed to permit everything that a good
-cooperating citizen would want to do. What is not allowed is to try to
-prevent others from further sharing any version of GTK that they might
-get from you.
-
-Specifically, we want to make sure that you have the right to give away
-copies of GTK, that you receive source code or else can get it if you
-want it, that you can change GTK or use pieces of it in new free
-programs, and that you know you can do these things.
-
-To make sure that everyone has such rights, we have to forbid you to
-deprive anyone else of these rights. For example, if you distribute
-copies of GTK, you must give the recipients all the rights that you
-have. You must make sure that they, too, receive or can get the source
-code. And you must tell them their rights.
-
-Also, for my own protection, we must make certain that everyone finds
-out that there is no warranty for GTK. If GTK is modified by someone
-else and passed on, we want their recipients to know that what they have
-is not what we distributed, so that any problems introduced by others
-will no reflect on our reputation.
-
-The precise conditions of the licenses for GTK are found in the General
-Public Licenses that accompanies it.
-
-
-@node Overview, Objects, Copying, Top
-@comment node-name, next, previous, up
-@chapter What is GTK?
-@cindex Overview
-
-GTK is a library for creating graphical user interfaces similar to the
-Motif ``look and feel''. It is designed to be small and efficient, but
-still flexible enough to allow the programmer freedom in the interfaces
-created. GTK allows the programmer to use a variety of standard user
-interface widgets (@pxref{Widgets}) such as push, radio and check
-buttons, menus, lists and frames. It also provides several ``container''
-widgets which can be used to control the layout of the user interface
-elements.
-
-GTK provides some unique features. (At least, I know of no other widget
-library which provides them). For example, a button does not contain a
-label, it contains a child widget, which in most instances will be a
-label. However, the child widget can also be a pixmap, image or any
-combination possible the programmer desires. This flexibility is adhered
-to throughout the library.
-
-
-@node Objects, Signals, Overview, Top
-@comment node-name, next, previous, up
-@chapter Object Overview
-@cindex Objects
-
-GTK implements a semi-simple class mechanism and an associated class
-hierarchy for widgets and several other useful objects. The GtkObject
-type is the root of the class hierarchy. It provides a few items needed
-by all classes, the foundation for the signal (@pxref{Signals})
-mechanism and the ``destroy'' method.
-
-The class hierarchy is defined by a type hierarchy. This hierarchy
-allows queries to be made in regards to a type. The basic query that can
-be performed is asking whether a given type has an ``is a'' relation
-with another type. For instance, it is common to ask whether a general
-widget pointer is a type of specific widget so that runtime sanity
-checks can be made.
-
-@section Type utility functions
-
-The @code{GtkTypeInfo} structure is used to communicate information to
-@code{gtk_type_unique} as opposed to passing in large numbers of
-parameters.
-
-@example
-typedef struct _GtkTypeInfo GtkTypeInfo;
-
-struct _GtkTypeInfo
-@{
- gchar *type_name;
- guint object_size;
- guint class_size;
- GtkClassInitFunc class_init_func;
- GtkObjectInitFunc object_init_func;
- GtkArgSetFunc arg_set_func;
- GtkArgGetFunc arg_get_func;
-@}
-@end example
-
-@itemize @bullet
-@item
-The @code{type_name} field refers to the name of the type. It is
-convention for the type name to be the same as the C structure type. For
-example, the type name of the @code{GtkObject} structure is
-``GtkObject''.
-
-@item
-The @code{object_size} field refers to the size in bytes of the C
-structure. The easiest (and portable) means of computing this size is by
-using the C @code{sizeof} operator. For instance, the sizeof of the
-@code{GtkObject} structure is computed by doing @code{sizeof
-(GtkObject)}.
-
-@item
-The @code{class_size} field refers to the size in bytes of the C
-structure for the class. Again, the @code{sizeof} operator should be
-used to compute this value.
-
-@item
-The @code{class_init_func} field is a callback which is used by the type
-mechanism to initialize class specific fields. The single argument this
-function takes is a pointer to a class structure.
-
-@item
-The @code{object_init_func} field is a callback which is used by the
-type mechanism to initialize object specific fields. The single argument
-this functions takes is a pointer to an object structure.
-
-@c FIXME!! Document the arg_set_func and arg_get_func..
-
-@end itemize
-
-@deftypefun guint gtk_type_unique (guint @var{parent_type}, GtkTypeInfo *@var{type_info})
-The @var{parent_type} is simply the value of the new types parent
-type. If @var{parent_type} is 0, then the new type is the root of the
-type hierarchy. @var{type_info} is a pointer to a structure which
-contains necessary information for construction of the new
-type. Specifically, the @code{type_name}, @code{object_size} and
-@code{class_size} fields are required. The @code{class_init_func},
-@code{object_init_func} and @code{value_init_func} fields may be NULL.
-@end deftypefun
-
-@deftypefun gchar* gtk_type_name (guint @var{type})
-The returned string is the name of @var{type} as specified to
-@code{gtk_type_unique}.
-@end deftypefun
-
-@deftypefun guint gtk_type_from_name (guchar *@var{name})
-Return the type associated with @var{name}. If there is no type
-associated with @var{name}, then 0 will be returned.
-@end deftypefun
-
-@deftypefun guint gtk_type_parent (guint @var{type})
-Returns the parent type of @var{type} or 0 if @var{type} is the root of
-the type hierarchy.
-@end deftypefun
-
-@deftypefun gpointer gtk_type_class (guint @var{type})
-Returns the initialized class structure for @var{type}. The class
-structure is actually created and initialized the first time it is
-needed. If creation and initialization occurs, the @code{class_size}
-field of the @code{GtkTypeInfo} structure used to initialize this type
-is used to determine how large the class structure is. The
-@code{class_init_func} field from the @code{GtkTypeInfo} structure is
-called for all the members in the types ancestry, including the
-type. The order of this invocation proceeds from the root on down. For
-example, the @code{GtkWidgetClass} is first initialized as an
-@code{GtkObjectClass} by the object class initialization routine and
-then by the widget class initialization routine. This allows the widget
-class initialization routine to override values set by the object class
-initialization routine. The returned structure is shared by all objects
-of @var{type} and, as such, should not be modified.
-@end deftypefun
-
-@deftypefun gpointer gtk_type_new (guint @var{type})
-Returns a new instance of an @var{type} object. The object structure is
-created and initialized similarly to the class structure (as described
-above). The @code{object_size} and @code{object_init_func} fields of the
-@code{GtkTypeInfo} structure are used to determine the objects allocated
-size and the object specific initialization routine. Similarly to the
-class initialization, all the object initialization routines from the
-root on down to the particular type being created are invoked.
-@end deftypefun
-
-@deftypefun void gtk_type_describe_heritage (guint @var{type})
-Prints the type heritage for @var{type}. The heritage for a type
-includes the type and all its parent types up the type tree.
-@end deftypefun
-
-@deftypefun void gtk_type_describe_tree (guint @var{type}, gint @var{show_size})
-Prints the type tree which starts at @var{type}. @var{show_size} is a
-boolean which determines whether type sizes are printed.
-@end deftypefun
-
-@deftypefun gint gtk_type_is_a (guint @var{type}, guint @var{is_a_type})
-A predicate function which determines whether the relation @var{type}
-is_a @var{is_a_type} is true.
-@end deftypefun
-
-@deftypefun void gtk_type_get_arg (GtkObject *@var{object}, GtkType @var{type}, GtkArg *@var{arg}, guint @var{arg_id})
-@end deftypefun
-
-@deftypefun void gtk_type_set_arg (GtkObject *@var{object}, GtkType @var{type}, GtkArg *@var{arg}, guint @var{arg_id})
-@end deftypefun
-
-@section Object functions
-
-The GtkObject type is the root of the type hierarchy used by GTK. It
-provides a minimal set of fields used to implement the actual
-object, class and signal mechanisms, as well as several utility routines
-which make dealing with objects easier.
-
-For the adventurous, see @ref{Object Implementation}.
-
-@deftypefun guint gtk_object_get_type (void)
-Returns the @code{GtkObject} type identifier.
-@end deftypefun
-
-@deftypefun void gtk_object_class_add_signals (GtkObjectClass *@var{class}, gint *@var{signals}, gint @var{nsignals})
-Adds @var{signals} to the @code{signals} field in the GtkObjectClass
-structure @var{class}. @xref{Signals}.
-@end deftypefun
-
-@deftypefun GtkObject* gtk_object_new (guint @var{type}, @dots{})
-@end deftypefun
-
-@deftypefun GtkObject* gtk_object_newv (guint @var{type}, guint @var{nargs}, GtkArg *@var{args})
-@end deftypefun
-
-@deftypefun void gtk_object_ref (GtkObject *@var{object});
-@end deftypefun
-
-@deftypefun void gtk_object_unref (GtkObject *@var{object});
-@end deftypefun
-
-@deftypefun void gtk_object_getv (GtkObject *@var{object}, guint @var{nargs}, GtkArg *@var{args})
-@end deftypefun
-
-@deftypefun void gtk_object_set (GtkObject *@var{object}, @dots{})
-@end deftypefun
-
-@deftypefun void gtk_object_setv (GtkObject *@var{object}, guint @var{nargs}, GtkArg *@var{args})
-@end deftypefun
-
-@deftypefun GtkArg* gtk_object_query_args (GtkType @var{class_type}, guint *@var{nargs})
-@end deftypefun
-
-@deftypefun void gtk_object_add_arg_type (gchar *@var{arg_name}, GtkType @var{arg_type}, guint @var{arg_id})
-@end deftypefun
-
-@deftypefun GtkType gtk_object_get_arg_type (gchar *@var{arg_name})
-@end deftypefun
-
-
-@deftypefun void gtk_object_destroy (GtkObject *@var{object})
-Performs checks to make sure it is alright to destroy @var{object} and
-then emits the @code{destroy} signal. The check which is performed is to
-make sure @var{object} is not already processing another signal. If this
-were the case then destroying the object immediately would undoubtedly
-cause problems as the other signal would not be able to tell the object
-was destroyed. The solution is that if @var{object} is processing another
-signal we mark @var{object} is needing to be destroyed. When we finish
-processing of the other signal we check whether the object needs to be
-destroyed.
-@end deftypefun
-
-The GtkObject type provides a mechanism for associating arbitrary
-amounts of data with an object. The data is associated with the object
-using a character string key. The functions @code{gtk_object_set_data},
-@code{gtk_object_get_data}, and @code{gtk_object_remove_data} are the
-interface to this mechanism. Two other routines,
-@code{gtk_object_set_user_data} and @code{gtk_object_get_user_data},
-exist as convenience functions which simply use the same mechanism.
-
-@deftypefun void gtk_object_set_data (GtkObject *@var{object}, const char *@var{key}, gpointer @var{data})
-Associate @var{data} with @var{key} in the data list of @var{object}.
-@end deftypefun
-
-@deftypefun gpointer gtk_object_get_data (GtkObject *@var{object}, const char *@var{key})
-Retrieve the data associated with @var{key} in the data list of @var{object}.
-@end deftypefun
-
-@deftypefun void gtk_object_remove_data (GtkObject *@var{object}, const char *@var{key})
-Remove the data associated with @var{key} in the data list of @var{object}.
-@end deftypefun
-
-@deftypefun void gtk_object_set_user_data (GtkObject *@var{object}, gpointer @var{data})
-Sets @var{data} into the @code{user_data} field of @var{object}.
-@end deftypefun
-
-@deftypefun gpointer gtk_object_get_user_data (GtkObject *@var{object})
-Returns the @code{user_data} field of @var{object}.
-@end deftypefun
-
-@c ------------ Is this deprecated? -----------------
-
-The GtkObject type also provides a mechanism for specifying
-initialization values for fields. This general mechanism is called
-object value stacks. The reason for using value stacks is that they can
-simplify the life of the programmer. For instance, by default widgets
-are non-visible when created. However, the ``visible'' value for widgets
-may be specified so that widgets are made visible when created. (FIXME:
-unfinished).
-
-@deftypefun void gtk_object_value_stack_new (guint @var{object_type}, const gchar *@var{value_id}, GtkParamType @var{value_type})
-@end deftypefun
-
-@deftypefun void gtk_object_push_value (guint @var{object_type}, const gchar *@var{value_id}, @dots{})
-Push a value on the value stack specified by @var{object_type} and
-@var{value_id}. The type of value is implicitly given in the context of
-@var{object_type} and @var{value_id}. (That is, it is not specified
-explicitly in the function call). Only a single extra argument is
-expected which is the data which is to be placed on the stack.
-@end deftypefun
-
-@deftypefun void gtk_object_pop_value (guint @var{object_type}, const gchar *@var{value_id})
-Pop a value of the value stack specified by @var{object_type} and
-@var{value_id}.
-@end deftypefun
-
-@deftypefun gint gtk_object_peek_value (guint @var{object_type}, const gchar *@var{value_id}, gpointer @var{data})
-Peek at the value on the top of the value stack specified by
-@var{object_type} and @var{value_id}. The @var{data} argument is
-interpreted as the location of where to place the ``peeked'' data. For
-instance, if the peeked data is of type @code{GTK_PARAM_POINTER}, then
-@var{data} will be a pointer to a pointer. If the value stack is empty
-or does not exist or an error occurs, @code{gtk_object_peek_value} will
-return @code{FALSE}. On success it will return @code{TRUE}.
-@end deftypefun
-
-
-@node Signals, Widgets, Objects, Top
-@comment node-name, next, previous, up
-@chapter Signals Overview
-@cindex Signals
-
-Signals are GTK's method for objects to perform callbacks. A signal is
-an event which occurs upon an object. The programmer can connect to a
-signal of an object which involves specifying a function to be called
-when that signal is emitted in the specified object.
-
-When a signal is emitted, both the class function associated with the
-signal (when it was defined) and all signal handlers installed for that
-signal on the particular object emitting the signal are called. The
-widget programmer can specify whether the class function is to be called
-before after or both before and after the signal handlers installed by
-the widget user. The widget user can, however, specify that their signal
-handler is to be run after the class function (using the ``_after''
-signal connection routines). Any signal handling function can emit the
-same signal on the same object while it is running causing that signal
-emission to either restart or to run recursively. Additionally, signal
-emission can be terminated prematurely. While both such abilities are
-rarely used, they do allow for greater flexibility in regards to
-signals. For instance, a programmer can attach to the key press event
-signal and intercept all tab key presses from a widget. This particular
-example is used in the file selection dialog to implement tab completion
-of filenames and prevent the entry widget from inserting the tab into
-its buffer.
-
-Signals are selected using either an integer identifier or a character
-string name. It is convention to name the signal the same as the class
-function which is associated with it. There are two versions of most of
-the signal functions, one which takes an integer identifier and one
-which takes a character string name for the signal.
-
-@deftypefun gint gtk_signal_new (gchar *@var{name}, GtkSignalRunType @var{run_type}, gint @var{object_type}, gint @var{function_offset}, GtkSignalMarshaller @var{marshaller}, GtkParamType @var{return_val}, gint @var{nparams}, @dots{})
-Create a new signal and give it the character string identifier
-@var{name}. @var{name} needs to be unique in the context of
-@var{object_type}'s branch of the class hierarchy. That is,
-@var{object_type} cannot create a signal type with the same name as a
-signal type created by one of its parent types.
-
-@var{run_type} specifies whether the class function should be run before
-(@code{GTK_RUN_FIRST}), after (@code{GTK_RUN_LAST}) or both before and
-after normal signal handlers (@code{GTK_RUN_BOTH}). Additionally, the
-@code{GTK_RUN_NO_RECURSE} value can be or'ed with any of those values to
-specify that the signal should not be recursive. By default, emitting
-the same signal on the same widget will cause the signal to be emitted
-twice. However, if the @code{GTK_RUN_NO_RECURSE} flag is specified,
-emitting the same signal on the same widget will cause the current
-signal emission to be restarted. This allows the widget programmer to
-specify the semantics of signal emission on a per signal
-basis. (The @code{GTK_RUN_NO_RECURSE} flag is used by the GtkAdjustment
-widget).
-
-The @var{function_offset} is the byte offset from the start of the class
-structure to the class function field within the class structure. The
-easiest means to compute this offset is by using the
-@code{GTK_SIGNAL_OFFSET} macro which takes the class structure type as
-the first argument and the field as the second argument. For example,
-@code{GTK_SIGNAL_OFFSET (GtkObjectClass, destroy)} will give the offset
-of the @code{destroy} class function within the
-@code{GtkObjectClass}. Note: An offset is specified instead of an
-absolute location since there will be multiple instances of a class
-structure being referenced. (The @code{GtkWidgetClass} structure ``is
-a'' @code{GtkObjectClass} structure, etc.)
-
-The @var{marshaller} function is used to invoke a signal handler. Since
-signal handlers may take different parameters and return values and a
-general mechanism for invoking them is not apparent, the approach of
-making the signal creator responsible for invoking the signal handler
-was taken. (FIXME: unfinished).
-
-The @var{return_val} and @var{nparams} and the remaining arguments
-specify the return value and the arguments to the signal handler
-respectively. Note: There is an implicit first argument to every signal
-handler which is the widget the signal has been emitted from. The
-variable argument list (@var{@dots{}}) specifies the types of the
-arguments. These can be one of @code{GTK_PARAM_CHAR},
-@code{GTK_PARAM_SHORT}, @code{GTK_PARAM_INT}, @code{GTK_PARAM_LONG},
-@code{GTK_PARAM_POINTER} or @code{GTK_PARAM_FUNCTION}. It is undefined
-to specify @code{GTK_PARAM_NONE} as an argument type, however it is OK
-to use @code{GTK_PARAM_NONE} for @var{return_val}. (This corresponds to
-returning a @code{void}).
-
-@code{gtk_signal_new} returns the integer identifier of the newly
-created signal. Signal identifiers start numbering at 1 and increase
-upwards. A value of -1 will be returned if an error occurs.
-
-@strong{Note:} @code{gtk_signal_new} is only needed by widget writers. A
-normal user of GTK will never needed to invoke this function.
-@end deftypefun
-
-@deftypefun gint gtk_signal_lookup (gchar *@var{name}, gint @var{object_type})
-Returns the integer identifier for the signal referenced by @var{name}
-and @var{object_type}. If @var{object_type} does not define the signal
-@var{name}, then the signal is looked for in @var{object_type}'s parent
-type recursively.
-@end deftypefun
-
-@deftypefun gchar* gtk_signal_name (gint @var{signal_num})
-@end deftypefun
-
-@deftypefun gint gtk_signal_emit (GtkObject *@var{object}, gint @var{signal_type}, @dots{})
-Emit the signal specified by the integer identifier @var{signal_type}
-from @var{object}. If an error occurs, @code{gtk_signal_emit} will
-return @code{FALSE} and will return @code{TRUE} on success. The signal
-definition determines the parameters passed in the variable argument
-list (@code{@dots{}}). For example, if the signal is defined as:
-
-@example
- gint (* event) (GtkWidget *widget, GdkEvent *event);
-@end example
-
-Then a call to emit the ``event'' signal would look like:
-
-@example
- GdkEvent event;
- gint return_val;
- @dots{}
- gtk_signal_emit (some_object,
- gtk_signal_lookup ("event",
- GTK_OBJECT_TYPE (some_object)),
- &event, &return_val);
-@end example
-
-Notice that the @code{widget} argument is implicit in that the first
-argument to every signal is a type derived from @code{GtkObject}. The
-@var{return_val} argument is actually a pointer to the return value type
-since the signal mechanism needs to be able to place the return value in
-an actual location. And lastly, the @code{gtk_signal_lookup} call is
-normally avoided by using the @code{gtk_signal_emit_by_name} function
-instead. @code{gtk_signal_emit} is normally used internally by widgets
-which know the signal identifier (since they defined the signal) and can
-therefore side-step the cost of calling @code{gtk_signal_lookup}.
-@end deftypefun
-
-@deftypefun gint gtk_signal_emit_by_name (GtkObject *@var{object}, gchar *@var{name}, @dots{})
-Similar to @code{gtk_signal_emit} except that the signal is referenced
-by @var{name} instead of by its integer identifier.
-@end deftypefun
-
-@deftypefun void gtk_signal_emit_stop (GtkObject *@var{object}, gint @var{signal_type})
-Stop the emission of the signal @var{signal_type} on
-@var{object}. @var{signal_type} is the integer identifier for the signal
-and can be determined using the function
-@code{gtk_signal_lookup}. Alternatively, the function
-@code{gtk_signal_emit_stop_by_name} can be used to refer to the signal
-by name. Attempting to stop the emission of a signal that isn't being
-emitted does nothing.
-@end deftypefun
-
-@deftypefun void gtk_signal_emit_stop_by_name (GtkObject *@var{object}, gchar *@var{name})
-Similar to @code{gtk_signal_emit_stop} except that the signal is
-referenced by @var{name} instead of by its integer identifier.
-@end deftypefun
-
-@deftypefun gint gtk_signal_connect (GtkObject *@var{object}, gchar *@var{name}, GtkSignalFunc @var{func}, gpointer @var{func_data})
-Connects a signal handling function to a signal emitting
-object. @var{func} is connected to the signal @var{name} emitted by
-@var{object}. The arguments and returns type of @var{func} should match
-the arguments and return type of the signal @var{name}. However,
-@var{func} may take the extra argument of @var{func_data}. Due to the C
-calling convention it is OK to ignore the extra argument. (It is OK to
-ignore all the arguments in fact).
-
-@code{gtk_signal_connect} returns an integer identifier for the
-connection which can be used to refer to it in the future. Specifically
-it is useful for removing the connection and/or blocking it from being
-used.
-@end deftypefun
-
-@deftypefun gint gtk_signal_connect_after (GtkObject *@var{object}, gchar *@var{name}, GtkSignalFunc @var{func}, gpointer @var{func_data})
-Similar to @code{gtk_signal_connect} except the signal handler is
-connected in the ``after'' slot. This allows a signal handler to be
-guaranteed to run after other signal handlers connected to the same
-signal on the same object and after the class function associated with
-the signal.
-
-Like @code{gtk_signal_connect}, @code{gtk_signal_connect_after} returns
-an integer identifier which can be used to refer to the connection.
-@end deftypefun
-
-@deftypefun gint gtk_signal_connect_object (GtkObject *@var{object}, gchar *@var{name}, GtkSignalFunc @var{func}, GtkObject *@var{slot_object})
-Connects @var{func} to the signal @var{name} emitted by
-@var{object}. Similar to @code{gtk_signal_connect} with the difference
-that @var{slot_object} is passed as the first parameter to @var{func}
-instead of the signal emitting object. This can be useful for connecting
-a signal emitted by one object to a signal in another object. A common
-usage is to connect the ``destroy'' signal of dialog to the ``clicked''
-signal emitted by a ``close'' button in the dialog. That is, the
-``clicked'' signal emitted by the button will caused the ``destroy''
-signal to be emitted for the dialog. This is also the ``right'' way to
-handle closing of a dialog since the ``destroy'' signal will be sent if
-the dialog is deleted using a window manager function and this enables
-the two methods of closing the window to be handled by the same
-mechanism. Returns an integer identifier which can be used to refer to
-the connection.
-@end deftypefun
-
-@deftypefun gint gtk_signal_connect_object_after (GtkObject *@var{object}, gchar *@var{name}, GtkSignalFunc @var{func}, GtkObject *@var{slot_object})
-Similar to @code{gtk_signal_connect_object} except the signal handler is
-connected in the ``after'' slot. This allows a signal handler to be
-guaranteed to run after other signal handlers connected to the same
-signal on the same object and after the class function associated with
-the signal. Returns an integer identifier which can be used to refer to
-the connection.
-@end deftypefun
-
-@deftypefun gint gtk_signal_connect_interp (GtkObject *@var{object}, gchar *@var{name}, GtkCallbackMarshal @var{func}, gpointer @var{data}, GtkDestroyNotify @var{destroy_func}, gint @var{after})
-@end deftypefun
-
-@deftypefun void gtk_signal_disconnect (GtkObject *@var{object}, gint @var{id})
-Disconnects a signal handler from an object. The signal handler is
-identified by the integer @var{id} which is returned by the
-@code{gtk_signal_connect*} family of functions.
-@end deftypefun
-
-@deftypefun void gtk_signal_disconnect_by_data (GtkObject *@var{object}, gpointer @var{data})
-Disconnects a signal handler from an object. The signal handler is
-identified by the @var{data} argument specified as the @var{func_data}
-argument to the @code{gtk_signal_connect*} family of functions. For the
-@code{gtk_signal_connect_object*} functions, @var{data} refers to the
-@var{slot_object}.
-
-@strong{Note:} This will remove all signal handlers connected to
-@var{object} which were connected using @var{data} as their
-@var{func_data} argument. Multiple signal handlers may be disconnected
-with this call.
-@end deftypefun
-
-@deftypefun void gtk_signal_handler_block (GtkObject *@var{object}, gint @var{id})
-Blocks calling of a signal handler during signal emission. The signal
-handler is identified by the integer @var{id} which is returned by the
-@code{gtk_signal_connect*} family of functions. If the signal is already
-blocked no change is made.
-@end deftypefun
-
-@deftypefun void gtk_signal_handler_block_by_data (GtkObject *@var{object}, gint @var{data})
-Blocks calling of a signal handler during signal emission. The signal
-handler is identified by the @var{data} argument specified as the
-@var{func_data} argument to the @code{gtk_signal_connect*} family of
-functions. For the @code{gtk_signal_connect_object*} functions,
-@var{data} refers to the @var{slot_object}. If the signal is already
-blocked no change is made.
-
-@strong{Note:} This will block all signal handlers connected to
-@var{object} which were connected using @var{data} as their
-@var{func_data} argument. Multiple signal handlers may be blocked
-with this call.
-@end deftypefun
-
-@deftypefun void gtk_signal_handler_unblock (GtkObject *@var{object}, gint @var{id})
-Unblocks calling of a signal handler during signal emission. The signal
-handler is identified by the integer @var{id} which is returned by the
-@code{gtk_signal_connect*} family of functions. If the signal is already
-unblocked no change is made.
-@end deftypefun
-
-@deftypefun void gtk_signal_handler_unblock_by_data (GtkObject *@var{object}, gint @var{data})
-Unblocks calling of a signal handler during signal emission. The signal
-handler is identified by the @var{data} argument specified as the
-@var{func_data} argument to the @code{gtk_signal_connect*} family of
-functions. For the @code{gtk_signal_connect_object*} functions,
-@var{data} refers to the @var{slot_object}. If the signal is already
-unblocked no change is made.
-
-@strong{Note:} This will unblock all signal handlers connected to
-@var{object} which were connected using @var{data} as their
-@var{func_data} argument. Multiple signal handlers may be unblocked
-with this call.
-@end deftypefun
-
-@deftypefun void gtk_signal_handlers_destroy (GtkObject *@var{object})
-Destroy all of the signal handlers connected to @var{object}. There
-should normally never be reason to call this function as it is called
-automatically when @var{object} is destroyed.
-@end deftypefun
-
-@deftypefun void gtk_signal_default_marshaller (GtkObject *@var{object}, GtkSignalFunc @var{func}, gpointer @var{func_data}, GtkSignalParam *@var{params})
-@code{gtk_signal_new} requires a callback in order to actually call a
-signal handler for a particular signal. The vast majority of signals are
-of the particular form:
-
-@example
- (* std_signal) (gpointer std_arg);
-@end example
-
-@code{gtk_signal_default_marshaller} is a signal marshaller which
-marshals arguments for a signal of that form.
-@end deftypefun
-
-@deftypefun void gtk_signal_set_funcs (GtkSignalMarshal @var{marshal_func}, GtkSignalDestroy @var{destroy_fun})
-@end deftypefun
-
-
-@node Widgets, Other Objects, Signals, Top
-@comment node-name, next, previous, up
-@chapter Widget Overview
-@cindex Widgets
-
-
-Widgets are the general term used to describe user interface objects. A
-widget defines a class interface that all user interface objects conform
-to. This interface allows a uniform method for dealing with operations
-common to all objects such as hiding and showing, size requisition and
-allocation and events.
-
-The common interface that widgets must adhere to is described by the
-GtkWidget and GtkWidgetClass structure. For the purposes of using GTK
-these structures can be considered read-only and, for the most part,
-opaque.
-
-All widget creation routines in GTK return pointers to GtkWidget
-structures. In reality, all widget creation routines create structures
-that can be viewed as equivalent to the GtkWidget structure, but often
-have contain additional information. @xref{Object Implementation}
-
-The widgets available for use are implemented in a hierarchy. Several
-widgets exist solely as common bases for more specific widgets. For
-example, it is not possible to create a ruler widget itself, but the
-ruler widget provides a base and functionality common to the horizontal
-and vertical rulers.
-
-The available widgets (in alphabetical order):
-
-@menu
-* GtkAlignment:: The alignment widget.
-* GtkArrow:: The arrow widget.
-* GtkAspectFrame:: The aspect frame widget.
-* GtkBin:: The bin widget.
-* GtkBox:: The box widget.
-* GtkButtonBox:: The button box widget.
-* GtkButton:: The button widget.
-* GtkCheckButton:: The check button widget.
-* GtkCheckMenuItem:: The check menu item widget.
-* GtkCList:: The compound list widget.
-* GtkColorSelection:: The color selector widget.
-* GtkCombo:: The combo box widget.
-* GtkContainer:: The container widget.
-* GtkCurve:: The curve widget.
-* GtkDialog:: The dialog widget.
-* GtkDrawingArea:: The drawing area widget.
-* GtkEntry:: The entry widget.
-* GtkEventBox:: The event box widget.
-* GtkFileSelection:: The file selection dialog widget.
-* GtkFixed:: The fixed widget.
-* GtkFrame:: The frame widget.
-* GtkGamma:: The gamma widget.
-* GtkHBox:: The horizontal box widget.
-* GtkHButtonBox:: The horizontal button box widget.
-* GtkHPaned:: The horizontal paned widget.
-* GtkHRuler:: The horizontal ruler widget.
-* GtkHScale:: The horizontal scale widget.
-* GtkHScrollbar:: The horizontal scrollbar widget.
-* GtkHSeparator:: The horizontal separator widget.
-* GtkImage:: The image widget.
-* GtkInputDialog:: The input dialog widget.
-* GtkItem:: The item widget.
-* GtkLabel:: The label widget.
-* GtkList:: The list widget.
-* GtkListItem:: The list item widget.
-* GtkMenu:: The menu widget.
-* GtkMenuBar:: The menu bar widget.
-* GtkMenuItem:: The menu item widget.
-* GtkMenuShell:: The menu shell widget.
-* GtkMisc:: The misc widget.
-* GtkNotebook:: The notebook widget.
-* GtkOptionMenu:: The option menu widget.
-* GtkPaned:: The paned widget.
-* GtkPixmap:: The pixmap widget.
-* GtkPreview:: The preview widget.
-* GtkProgressBar:: The progress bar widget.
-* GtkRadioButton:: The radio button widget.
-* GtkRadioMenuItem:: The radio menu item widget.
-* GtkRange:: The range widget.
-* GtkRuler:: The ruler widget.
-* GtkScale:: The scale widget.
-* GtkScrollbar:: The scrollbar widget.
-* GtkScrolledWindow:: The scrolled window widget.
-* GtkSeparator:: The separator widget.
-* GtkStatusbar:: The statusbar widget.
-* GtkTable:: The table widget.
-* GtkText:: The text widget.
-* GtkToggleButton:: The toggle button widget.
-* GtkToolbar:: The tool bar widget.
-* GtkTooltips:: The tool tips widget.
-* GtkTree:: The tree widget.
-* GtkTreeItem:: The tree item widget.
-* GtkVBox:: The vertical box widget.
-* GtkVButtonBox:: The vertical button box widget.
-* GtkViewport:: The viewport widget.
-* GtkVPaned:: The vertical paned widget.
-* GtkVRuler:: The vertical ruler widget.
-* GtkVScale:: The vertical scale widget.
-* GtkVScrollbar:: The vertical scrollbar widget.
-* GtkVSeparator:: The vertical separator widget.
-* GtkWidget:: The base widget type.
-* GtkWindow:: The window widget.
-@end menu
-
-@node GtkAlignment, GtkArrow, Widgets, Widgets
-@comment node-name, next, previous, up
-@section The alignment widget
-
-
-@subsection Description
-
-The alignment widget is a container (@pxref{GtkContainer}) derived from
-the bin widget (@pxref{GtkBin}). Its entire purpose is to give the
-programmer flexibility in how the child it manages is positioned when a
-window is resized.
-
-Normally, a widget is allocated at least as much size as it
-requests. (@pxref{GtkContainer} for a discussion of geometry
-management). When a widget is allocated more size than it requests there
-is a question of how the widget should expand. By convention, most GTK
-widgets expand to fill their allocated space. Sometimes this behavior is
-not desired. The alignment widget allows the programmer to specify how a
-widget should expand and position itself to fill the area it is
-allocated.
-
-@subsection Options
-
-@defopt xscale
-@defoptx yscale
-The @var{xscale} and @var{yscale} options specify how to scale the child
-widget. If the scale value is 0.0, the child widget is allocated exactly
-the size it requested in that dimension. If the scale value is 1.0, the
-child widget is allocated all of the space in a dimension. A scale value
-of 1.0 for both x and y is equivalent to not using an alignment widget.
-@end defopt
-
-@defopt xalign
-@defoptx yalign
-The @var{xalign} and @var{yalign} options specify how to position the
-child widget when it is not allocated all the space available to it
-(because the @var{xscale} and/or @var{yscale} options are less than
-1.0). If an alignment value is 0.0 the widget is positioned to the left
-(or top) of its allocated space. An alignment value of 1.0 positions the
-widget to the right (or bottom) of its allocated space. A common usage
-is to specify @var{xalign} and @var{yalign} to be 0.5 which causes the
-widget to be centered within its allocated area.
-@end defopt
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_alignment_get_type (void)
-Returns the @code{GtkAlignment} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_alignment_new (gfloat @var{xalign}, gfloat @var{yalign}, gfloat @var{xscale}, gfloat @var{yscale})
-Create a new @code{GtkAlignment} object and initialize it with the
-values @var{xalign}, @var{yalign}, @var{xscale} and @var{yscale}. The
-new widget is returned as a pointer to a @code{GtkWidget}
-object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_alignment_set (GtkAlignment *@var{alignment}, gfloat @var{xalign}, gfloat @var{yalign}, gfloat @var{xscale}, gfloat @var{yscale})
-Set the @var{xalign}, @var{yalign}, @var{xscale} and @var{yscale} options
-of an alignment widget. It is important to not set the fields of the
-@code{GtkAlignment} structure directly (or, for that matter, any type
-derived from @code{GtkObject}).
-@end deftypefun
-
-@gtkstdmacros{Alignment, ALIGNMENT}
-
-@page
-@node GtkArrow, GtkAspectFrame, GtkAlignment, Widgets
-@comment node-name, next, previous, up
-@section The arrow widget
-
-@subsection Description
-
-The arrow widget is derived from the misc widget (@pxref{GtkMisc}) and
-is intended for use where a directional arrow (in one of the four
-cardinal directions) is desired. As such, it has very limited
-functionality and basically only draws itself in a particular direction
-and with a particular shadow type. The arrow widget will expand to fill
-all the space it is allocated.
-
-@subsection Options
-
-@defopt arrow_type
-The @var{arrow_type} option specifies which direction the arrow will
-point. It can be one of @code{GTK_ARROW_UP}, @code{GTK_ARROW_DOWN},
-@code{GTK_ARROW_LEFT} or @code{GTK_ARROW_RIGHT}. This will set the arrow
-pointing in the direction specified.
-@end defopt
-
-@defopt shadow_type
-The @var{shadow_type} option specifies how to draw the shadow for the
-arrow. Currently, only the @code{GTK_SHADOW_IN} and
-@code{GTK_SHADOW_OUT} shadow types are supported for drawing
-arrows. Other shadow types will cause nothing to be drawn.
-@end defopt
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_arrow_get_type (void)
-Returns the @code{GtkArrow} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_arrow_new (GtkArrowType @var{arrow_type}, GtkShadowType @var{shadow_type})
-Create a new @code{GtkArrow} object and initialize it with the values
-@var{arrow_type} and @var{shadow_type}. The new widget is returned as a
-pointer to a @code{GtkWidget} object. @code{NULL} is returned on
-failure.
-@end deftypefun
-
-@deftypefun void gtk_arrow_set (GtkArrow *@var{arrow}, GtkArrowType @var{arrow_type}, GtkShadowType @var{shadow_type})
-Set the @var{arrow_type} and @var{shadow_type} options of an arrow
-widget. It is important to not set the fields of the @code{GtkArrow}
-structure directly (or, for that matter, any type derived from
-@code{GtkObject}).
-@end deftypefun
-
-@gtkstdmacros{Arrow, ARROW}
-
-
-@page
-@node GtkAspectFrame, GtkBin, GtkArrow, Widgets
-@comment node-name, next, previous, upa
-@section The aspect frame widget
-
-@subsection Description
-
-@subsection Options
-
-@defopt label
-@end defopt
-
-@defopt xalign
-@end defopt
-
-@defopt yalign
-@end defopt
-
-@defopt ratio
-@end defopt
-
-@defopt obey_child
-@end defopt
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_aspect_frame_get_type (void)
-Returns the @code{GtkAspectFrame} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_aspect_frame_new (gchar *@var{label}, gfloat @var{xalign}, gfloat @var{yalign}, gfloat @var{ratio}, gint @var{obey_child})
-Create a new @code{GtkAspectFrame} object and initialize it with the values
-@var{label}, @var{xalign}, @var{yalign}, @var{ratio} and @var{obey_child}.
-The new widget is returned as a pointer to a @code{GtkWidget} object.
-@code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_aspect_frame_set (GtkAspectFrame *@var{aspect_frame}, gfloat @var{xalign}, gfloat @var{yalign}, gfloat @var{ratio}, gint @var{obey_child})
-@end deftypefun
-
-
-@gtkstdmacros{AspectFrame, ASPECT_FRAME}
-
-@page
-@node GtkBin, GtkBox, GtkAspectFrame, Widgets
-@comment node-name, next, previous, up
-@section The bin widget
-
-@subsection Description
-
-The bin widget is a container (@pxref{GtkContainer}) derived from the
-container widget. It is an abstract base class. That is, it is not
-possible to create an actual bin widget. It exists only to provide a
-base of functionality for other widgets. Specifically, the bin widget
-provides a base for several other widgets that contain only a single
-child. These widgets include alignments (@pxref{GtkAlignment}), frames
-(@pxref{GtkFrame}), items (@pxref{GtkItem}), viewports
-(@pxref{GtkViewport}) and windows (@pxref{GtkWindow})
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_bin_get_type (void)
-Returns the @code{GtkBin} type identifier.
-@end deftypefun
-
-@gtkstdmacros{Bin, BIN}
-
-
-@page
-@node GtkBox, GtkButtonBox, GtkBin, Widgets
-@comment node-name, next, previous, up
-@section The box widget
-
-
-@subsection Description
-
-The box widget is a container (@pxref{GtkContainer}) derived from the
-container widget. It is an abstract base class used by the horizontal
-box (@pxref{GtkHBox}), the vertical box (@pxref{GtkVBox}) and the
-(@pxref{GtkButtonBox}) widgets to provide a base of common functionality.
-
-A box provides an abstraction for organizing the position and size of
-widgets. Widgets in a box are laid out horizontally or vertically. By
-using a box widget appropriately, a programmer can control how widgets
-are positioned and how they will be allocated space when a window gets
-resized.
-
-The key attribute of boxes is that they position their children in a
-single row (horizontal boxes) or column (vertical boxes). In the case of
-horizontal boxes, all children are stretched vertically. The vertical
-size of the box is determined by the largest vertical requisition of all
-of its children. Similarly, a vertical box stretches all of its children
-horizontally. The horizontal size (of the vertical box) is determined by
-the largest horizontal requisition of all of its children. An alignment
-widget (@pxref{GtkAlignment}) can be used to control child allocation
-more precisely on a per child basis.
-
-The second attribute of boxes is how they expand children. In the case
-of a horizontal box, the main control is over how children are expanded
-horizontally to fill the allocated area. (The rest of this discussion
-will focus on horizontal boxes but it applies to vertical boxes as
-well).
-
-There are two flags which can be set controlling how a widget is
-expanded horizontally in a horizontal box. These are the @code{expand}
-and @code{fill}. There operation is fairly simple. If @code{expand} is
-set, the child's potentially allocated area will expand to fill available
-space. If @code{fill} is set, the child's actual allocated area will be
-its potentially allocated area. There is a difference between
-the potentially area (which is the area the box widget sets aside for
-the child) and the actual allocated area (which is the area the box
-widget actual allocates for the widget via
-@code{gtk_widget_size_allocate}).
-
-The allocation of space to children occurs as follows (for horizontal
-boxes):
-@enumerate
-@item
-All children are allocated at least their requested size horizontally
-and the maximum requested child size vertically.
-
-@item
-Any child with the @code{expand} flag set is allocated @code{extra_width
-/ nexpand_children} extra pixels horizontally. If the @code{homogeneous}
-flag was set, all children are considered to have the @code{expand} flag
-set. That is, all children will be allocated the same area.The
-horizontal box is a fair widget and, as such, divides up any extra
-allocated space evenly among the ``expand'' children. (Those children
-which have the @code{expand} flag set). The exception occurs when
-@code{extra_width / nexpand_children} does not divide cleanly. The extra
-space is given to the last widget.
-
-@item
-@code{spacing} number of pixels separate each child. Note: The
-separation is between the potentially allocated area for each child and
-not the actual allocated area. The @code{padding} value associated with
-each child causes that many pixels to be left empty to each side of the
-child.
-
-@item
-If a child has the @code{fill} flag set it is allocated its potentially
-allocated area. If it does not, it is allocated its requested size
-horizontally and centered within its potentially allocated area. Its
-vertical allocation is still the maximum requested size of any child.
-
-@item
-Children placed at the start of the box are placed in order of addition
-to the box from left to right in the boxes allocated area.. Children
-placed at the end of the box are placed in order of addition from right
-to left in the boxes allocated area.
-@end enumerate
-
-@xref{GtkHBox}, and @ref{GtkVBox}, for code examples of using horizontal
-and vertical boxes.
-
-@subsection Options
-
-@defopt expand
-@end defopt
-
-@defopt fill
-@end defopt
-
-@defopt padding
-@end defopt
-
-@defopt expand
-@end defopt
-
-@c FIXME: options for GtkBox
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_box_get_type (void)
-Returns the @code{GtkBox} type identifier.
-@end deftypefun
-
-@deftypefun void gtk_box_pack_start (GtkBox *@var{box}, GtkWidget *@var{child}, gint @var{expand}, gint @var{fill}, gint @var{padding})
-Add @var{child} to the front of @var{box}. The flags @var{expand} and
-@var{fill} and the padding value of @var{padding} are associated with
-@var{child}.
-@end deftypefun
-
-@deftypefun void gtk_box_pack_end (GtkBox *@var{box}, GtkWidget *@var{child}, gint @var{expand}, gint @var{fill}, gint @var{padding})
-Add @var{child} to the end of @var{box}. The flags @var{expand} and
-@var{fill} and the padding value of @var{padding} are associated with
-@var{child}.
-@end deftypefun
-
-@deftypefun void gtk_box_pack_start_defaults (GtkBox *@var{box}, GtkWidget *@var{widget})
-A convenience function which is equivalent to the following:
-
-@example
- gtk_box_pack_start (@var{box}, @var{widget}, TRUE, TRUE, 0);
-@end example
-@end deftypefun
-
-@deftypefun void gtk_box_pack_end_defaults (GtkBox *@var{box}, GtkWidget *@var{widget})
-A convenience function which is equivalent to the following:
-
-@example
- gtk_box_pack_start (@var{box}, @var{widget}, TRUE, TRUE, 0);
-@end example
-@end deftypefun
-
-@deftypefun void gtk_box_set_homogeneous (GtkBox *@var{box}, gint @var{homogeneous})
-Set the homogeneous setting of this box to @var{homogeneous}.
-@end deftypefun
-
-@deftypefun void gtk_box_set_spacing (GtkBox *@var{box}, gint @var{spacing})
-@end deftypefun
-
-@deftypefun void gtk_box_reorder_child (GtkBox *@var{box}, GtkWidget *@var{child}, guint @var{pos})
-@end deftypefun
-
-@deftypefun void gtk_box_query_child_packing (GtkBox *@var{box}, GtkWidget *@var{child}, gint *@var{expand}, gint *@var{fill}, gint *@var{padding}, GtkPackType *@var{pack_type})
-@end deftypefun
-
-@deftypefun void gtk_box_set_child_packing (GtkBox *@var{box}, GtkWidget *@var{child}, gint @var{expand}, gint @var{fill}, gint @var{padding}, GtkPackType *@var{pack_type})
-@end deftypefun
-
-@gtkstdmacros{Box, BOX}
-
-
-@page
-@node GtkButtonBox, GtkButton, GtkBox, Widgets
-@comment node-name, next, previous, up
-@section The button box widget
-
-@subsection Description
-The button box widget is a container (@pxref{GtkContainer}) derived from the
-(@pxref{GtkBox}) widget. It is an abstract base class used by the horizontal
-button box (@pxref{GtkHButtonBox}) and the vertical button box
-(@pxref{GtkVButtonBox}) widgets to provide a base of common functionality.
-
-The button box, like the box widget, (@pxref{GtkBox}) provides an abstraction
-for organizing position and size of widgets. In the case of the button box
-it is targeted at the button widget,(@pxref{GtkButton}). Button widgets are
-laid out in the box horizontally or vertically. By using a button box widget
-appropriately, a programmer can control how the button widgets are positioned
-and how they will be allocated space when a window gets resized.
-
-@subsection Options
-@defopt layout_style
-@itemize @bullet
-@itemize @bullet
-@item
-@code{GTK_BUTTONBOX_SPREAD}
-@end itemize
-
-@item
-The layout style @code{GTK_BUTTONBOX_SPREAD} will spread the buttons out
-evenly within the button box. When the parent window is resized they will
-re-adjust to the new window dimensions. The @code{gtk_button_box_set_spacing}
-function will set the minimum space that the buttons will leave between
-themselves.
-
-@itemize @bullet
-@item
-@code{GTK_BUTTONBOX_EDGE}
-@end itemize
-@item
-
-@itemize @bullet
-@item
-@code{GTK_BUTTONBOX_START}
-@end itemize
-
-@item
-The layout style @code{GTK_BUTTONBOX_START} will place the buttons at the
-start of the button box, taking into account the spacing as set by the
-@code{gtk_button_box_set_spacing} function. The buttons will not move
-when the parent window is re-sized.
-
-@itemize @bullet
-@item
-@code{GTK_BUTTONBOX_END}
-@end itemize
-
-@item
-The layout style @code{GTK_BUTTONBOX_END} will place the buttons at the
-end of the button box, taking into account the spacing as set by the
-@code{gtk_button_box_set_spacing} function. Again like the
-@code{GTK_BUTTONBOX_START} layout style the buttons will not move when
-the parent window is re-sized.
-@end itemize
-@end defopt
-
-@defopt width
-@end defopt
-
-@defopt height
-@end defopt
-
-@defopt ipad_x
-@defoptx ipad_y
-@end defopt
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_button_box_get_type (void)
-Returns the @code{GtkButtonBox} type identifier.
-@end deftypefun
-
-@deftypefun void gtk_button_box_set_child_size_default (gint @var{width}, gint@var{height})
-@end deftypefun
-
-@deftypefun void gtk_button_box_set_child_ipadding_default (gint @var{ipad_x}, gint @var{ipad_y})
-@end deftypefun
-
-@deftypefun void gtk_button_box_get_child_size_default (gint *@var{width}, gint *@var{height})
-@end deftypefun
-
-@deftypefun void gtk_button_box_get_child_ipadding_default (gint *@var{ipad_x}, gint *@var{ipad_y})
-@end deftypefun
-
-@deftypefun void gtk_button_box_set_child_size (GtkButtonBox *@var{widget}, gint @var{width}, gint @var{height})
-@end deftypefun
-
-@deftypefun void gtk_button_box_set_child_ipadding (GtkButtonBox *@var{widget}, gint @var{ipad_x}, gint @var{ipad_y})
-@end deftypefun
-
-@deftypefun void gtk_button_box_set_layout (GtkButtonBox *@var{widget}, gint @var{layout_style})
-This will set the layout style of the buttons within this box. Currently it can
-be set to one of @code{GTK_BUTTONBOX_SPREAD}, @code{GTK_BUTTONBOX_EDGE},
-@code{GTK_BUTTONBOX_START} or @code{GTK_BUTTONBOX_END}.
-
-The following example:
-@example
- gtk_button_box_set_layout (GTK_BUTTON_BOX (box),
- GTK_BUTTONBOX_SPREAD);
-@end example
-Will set the @var{box} argument to the @dfn{SPREAD} layout style described
-above.
-@end deftypefun
-
-@deftypefun gint gtk_button_box_get_spacing (GtkButtonBox *@var{widget})
-Get the per widget value for spacing within the button box. This value is
-the amount of space that will be between the individual buttons contained by
-this box.
-@end deftypefun
-
-@deftypefun void gtk_button_box_get_child_size (GtkButtonBox *@var{widget}, gint *@var{width}, gint *@var{height})
-@end deftypefun
-
-@deftypefun void gtk_button_box_get_child_ipadding (GtkButtonBox *@var{widget}, gint *@var{ipad_x}, gint *@var{ipad_y})
-Get the per widget value for the padding inside the buttons. This value
-controls how large the buttons will be within the box.
-@end deftypefun
-
-@deftypefun gint gtk_button_box_get_layout (GtkButtonBox *@var{widget})
-Get the @var{layout_style} for the @code{GtkButtonBox} object passed to this
-function in the @var{widget} variable.
-
-@example
- layout = gtk_button_box_get_layout(GTK_BUTTON_BOX (box));
-@end example
-
-@end deftypefun
-
-@gtkstdmacros{ButtonBox, BUTTON_BOX}
-
-@page
-@node GtkButton, GtkCheckButton, GtkButtonBox, Widgets
-@comment node-name, next, previous, up
-@section The button widget
-
-
-@subsection Description
-
-@subsection Signals
-
-@deftypefn Signal void GtkButton::pressed (GtkButton *@var{button})
-@end deftypefn
-
-@deftypefn Signal void GtkButton::released (GtkButton *@var{button})
-@end deftypefn
-
-@deftypefn Signal void GtkButton::clicked (GtkButton *@var{button})
-@end deftypefn
-
-@deftypefn Signal void GtkButton::enter (GtkButton *@var{button})
-@end deftypefn
-
-@deftypefn Signal void GtkButton::leave (GtkButton *@var{button})
-@end deftypefn
-
-@subsection Functions
-
-@deftypefun guint gtk_button_get_type (void)
-Returns the @code{GtkButton} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_button_new (void)
-Create a new @code{GtkButton} object. The new widget is returned as a
-pointer to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_button_new_with_label (gchar *@var{label})
-Create a new @code{GtkButton} object and set the text that is
-on the button to @var{label}. The new widget is returned as a
-pointer to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_button_pressed (GtkButton *@var{button})
-@end deftypefun
-
-@deftypefun void gtk_button_released (GtkButton *@var{button})
-@end deftypefun
-
-@deftypefun void gtk_button_clicked (GtkButton *@var{button})
-@end deftypefun
-
-@deftypefun void gtk_button_enter (GtkButton *@var{button})
-@end deftypefun
-
-@deftypefun void gtk_button_leave (GtkButton *@var{button})
-@end deftypefun
-
-@gtkstdmacros{Button, BUTTON}
-
-
-@page
-@node GtkCheckButton, GtkCheckMenuItem, GtkButton, Widgets
-@comment node-name, next, previous, up
-@section The check button widget
-
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_check_button_get_type (void)
-Returns the @code{GtkCheckButton} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_check_button_new (void)
-Create a new @code{GtkCheckButton} object and initialize it with the
-default values in the library. The new widget is returned as a pointer
-to a @code{GtkWidget} object. A @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_check_button_new_with_label (gchar *@var{label})
-Create a new @code{GtkCheckButton} object and initialize it with the
-values @var{label}. The new widget is returned as a pointer to a
-@code{GtkWidget} object. @code{NULL} is returned on any failure.
-@end deftypefun
-
-@deftypefun GtkCheckButton* GTK_CHECK_BUTTON (gpointer @var{obj})
-@end deftypefun
-
-@deftypefun GtkCheckButtonClass* GTK_CHECK_BUTTON_CLASS (gpointer @var{class})
-@end deftypefun
-
-@deftypefun gint GTK_IS_CHECK_BUTTON (gpointer @var{obj})
-@end deftypefun
-
-@gtkstdmacros{CheckButton, CHECK_BUTTON}
-
-@page
-@node GtkCheckMenuItem, GtkCList, GtkCheckButton, Widgets,
-@comment node-name, next, previous, up
-@section The check menu item widget
-
-@subsection Description
-
-@subsection Options
-
-@defopt label
-@end defopt
-
-@defopt state
-@end defopt
-
-@subsection Signals
-
-@deftypefn Signal void GtkCheckMenuItem::toggled (GtkCheckMenuItem *@var{check_menu_item})
-@end deftypefn
-
-@subsection Functions
-
-@deftypefun guint gtk_check_menu_item_get_type (void)
-Returns the @code{GtkCheckMenuItem} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_check_menu_item_new (void)
-Create a new @code{GtkCheckMenuItem} object. The new widget is returned as a
-pointer to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_check_menu_item_new_with_label (gchar *@var{label})
-Create a new @code{GtkCheckMenuItem} object and initialize it with the values
-@var{label}. The new widget is returned as a pointer to a @code{GtkWidget}
-object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_check_menu_item_set_state (GtkCheckMenuItem *@var{check_menu_item}, gint @var{state})
-@end deftypefun
-
-@deftypefun void gtk_check_menu_item_toggled (GtkCheckMenuItem *@var{check_menu_item})
-@end deftypefun
-
-@gtkstdmacros{CheckMenuItem, CHECK_MENU_ITEM}
-
-@page
-@node GtkCList, GtkColorSelection, GtkCheckMenuItem, Widgets
-@comment node-name, next, previous, up
-@section The compound list widget
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_clist_get_type (void)
-Returns the @code{GtkCList} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_clist_new (int @var{columns})
-Create a new @code{GtkCList} initializing it with the value @var{columns}.
-The new widget is returned as a pointer to a @code{GtkWidget} object.
-@code{NULL} is returned on failure.
-@end deftypefun
-
-
-@deftypefun GtkWidget* gtk_clist_new_with_titles (int @var{columns}, gchar *@var{titles[]})
-@end deftypefun
-
-@deftypefun void gtk_clist_set_border (GtkCList *@var{clist}, GtkShadowType @var{border})
-Set the border style of the @var{clist} to the shadow type @var{border}.
-@end deftypefun
-
-@deftypefun void gtk_clist_set_selection_mode (GtkCList *@var{clist} GtkSelectionMode @var{mode})
-Set the selection mode on the @var{clist} to the @var{mode} selection mode.
-@end deftypefun
-
-@deftypefun void gtk_clist_set_policy (GtkCList *@var{clist}, GtkPolicyType @var{vscrollbar_policy}, GtkPolicyType @var{hscrollbar_policy})
-Set the policy on the scrollbars on the @var{clist} to @var{vscrollbar_policy} and @var{hscrollbar_policy}.
-@end deftypefun
-
-@deftypefun void gtk_clist_freeze (GtkCList *@var{clist})
-Stop all visual updates of the @var{clist}. Useful for when making a large
-number of changes to a @code{GtkCList}.
-@end deftypefun
-
-@deftypefun void gtk_clist_thaw (GtkCList *@var{clist})
-Allow all visual updates of the @var{clist} to resume.
-@end deftypefun
-
-@deftypefun void gtk_clist_column_titles_show (GtkCList *@var{clist})
-Show the column title buttons on the @var{clist}.
-@end deftypefun
-
-@deftypefun void gtk_clist_column_titles_hide (GtkCList *@var{clist})
-Hide the column title buttons on the @var{clist}.
-@end deftypefun
-
-@deftypefun void gtk_clist_set_column_title (GtkCList *@var{clist}, gint @var{column}, gchar *@var{title})
-Set the title in column @var{column} of the @var{clist} button to @var{title}.
-@end deftypefun
-
-@deftypefun void gtk_clist_set_column_widget (GtkCList *@var{clist}, gint @var{column}, GtkWidget *@var{widget})
-Set the @var{widget} instead of the title button for the column @var{column}
-in the @var{clist}.
-@end deftypefun
-
-@deftypefun void gtk_clist_set_column_justification (GtkCList *@var{clist}, gint @var{column}, GtkJustification @var{justification})
-Set the @var{column}'s justification, in the @var{clist} to @var{justification}.
-@end deftypefun
-
-@deftypefun void gtk_clist_set_column_width (GtkCList *@var{clist}, gint @var{column}, gint @var{width})
-Set the pixel width of column @var{column} in the @code{GtkCList} @var{clist}
-to @var{width}. This function is a necessary step in creating a
-@code{GtkCList} because otherwise the column width is chosen from the width
-of the column title, which is almost never correct.
-@end deftypefun
-
-@deftypefun void gtk_clist_set_row_height (GtkCList *@var{clist}, gint @var{height})
-Change the height of the rows in the @var{clist} to @var{height}. The default
-is the height of the current font.
-@end deftypefun
-
-@deftypefun void gtk_clist_moveto (GtkCList *@var{clist}, gint @var{row}, gint@var{column}, gfloat @var{row_align}, gfloat @var{col_align})
-Scroll the viewing area of the @code{GtkClist} in @var{clist} to @var{column}
-and @var{row}. The @var{row_align} and @var{col_align} are between zero and
-one, representing the location the row should appear on screen. Setting
-@var{row_align} or the @var{col_align} to 0.0 will be the top or left of the
-viewing area. Setting the @var{row_align} or @var{col_align} to 1.0 will
-be the bottom or right of the viewing area. If the @var{row} or @var{column}
-is -1 then there is no change.
-@end deftypefun
-
-@deftypefun void gtk_clist_set_text (GtkCList *@var{clist}, gint @var{row}, gint @var{column}, gchar *@var{text})
-Set a given cell's text, located by the @var{row} and @var{column}, to
-@var{text} replacing its current contents.
-@end deftypefun
-
-@deftypefun void gtk_clist_set_pixmap (GtkCList *@var{clist}, gint @var{row}, gint @var{column}, GdkPixmap *@var{pixmap}, GdkBitmap *@var{mask})
-Set a given cell's text, located by the @var{column} and @var{row} arguments,
-to the pixmap described by the @var{pixmap} argument using the @var{mask} as
-its mask. The current contents of the cell will be replaced.
-@end deftypefun
-
-@deftypefun void gtk_clist_setpixtext (GtkCList *@var{clist}, gint @var{row}, gint @var{column}, gchar *@var{text}, guint8 @var{spacing}, GdkPixmap *@var{pixmap}, GdkBitmap *@var{mask})
-Set a given cell's text and pixmap, located by the @var{row} and @var{column}
-arguments, to the text and pixmap described by the @var{pixmap} and @var{text}
-arguments. The @var{mask} will be used for the pixmap mask and the
-@var{spacing} argument specifies the spacing between the two.
-@end deftypefun
-
-@deftypefun void gtk_clist_set_foreground (GtkCList *@var{clist}, gint @var{row}, GdkColor *@var{color})
-Set the foreground color of row @var{row} to @var{color} in the
-@code{GtkCList} @var{clist}. The @var{color} must
-already be allocated.
-@end deftypefun
-
-@deftypefun void gtk_clist_set_background (GtkCList *@var{clist}, gint @var{row}, GdkColor *@var{color})
-Set the background color of row @var{row} to @var{color} in the
-@code{GtkCList} pointed to by @var{clist}. The color must be previously
-allocated.
-@end deftypefun
-
-@deftypefun void gtk_clist_set_shift (GtkCList *@var{clist}, gint @var{row}, gint @var{column}, gint @var{vertical}, gint @var{horizontal})
-Set the horizontal and vertical shift for drawing the contents of the cell
-located at @var{row} and @var{column}. The @var{vertical} and @var{horizontal}
-arguments can be positive or negative.
-@end deftypefun
-
-@deftypefun gint gtk_clist_append (GtkCList *@var{clist}, gchar *@var{text[]})
-Append the given text, in the @var{text[]} argument, to the @code{GtkCList}
-pointed to by the @var{clist}. The return value is the index of the row that
-was just added.
-@end deftypefun
-
-@deftypefun void gtk_clist_insert (GtkCList *@var{clist}, gint @var{row}, gchar *@var{text[]})
-Insert a row into the @code{GtkCList} pointed to by @var{clist} at row
-@var{row} with the text in @var{text[]}.
-@end deftypefun
-
-@deftypefun void gtk_clist_remove (GtkCList *@var{clist}, gint @var{row})
-Remove row index @var{row} from the @var{clist}.
-@end deftypefun
-
-@deftypefun void gtk_clist_set_row_data (GtkCList *@var{clist}, gint @var{row}, gpointer @var{data})
-Will set an arbitrary data pointer, @var{data}, for row @var{row} in the
-@code{GtkCList} pointed to by @var{clist}.
-@end deftypefun
-
-@deftypefun gpointer gtk_clist_get_row_data (GtkCList *@var{clist}, gint @var{row})
-Return the data that was set for row @var{row} from the @code{GtkCList} pointed
-to by @var{clist}. @code{NULL} is returned if no data was set.
-@end deftypefun
-
-@deftypefun void gtk_clist_select_row (GtkCList *@var{clist}, gint @var{row}, gint @var{column})
-Force selection of a row, located by @var{row} and @var{column}, in the
-@code{GtkCList} pointed to by @var{clist}.
-@end deftypefun
-
-@deftypefun void gtk_clist_unselect_row (GtkCList *@var{clist}, gint @var{row}, gint @var{column})
-Force the unselection of a row, located by @var{row} and @var{column}, in the
-@code{GtkCList} pointed to by @var{clist}.
-@end deftypefun
-
-@deftypefun void gtk_clist_clear (GtkCList *@var{clist})
-Clear the entire contents of the @code{GtkCList} pointed to by @var{clist}.
-This is much faster then removing each item separately with
-@code{gtk_clist_remove}.
-@end deftypefun
-
-@gtkstdmacros{CList, CLIST}
-
-@page
-@node GtkColorSelection, GtkCombo, GtkCList, Widgets
-@comment node-name, next, previous, up
-@section The color selector widget
-
-@subsection Description
-
-@subsection Options
-@defopt policy
-@itemize @bullet
-@item
-GTK_UPDATE_CONTINUOUS
-@item
-GTK_UPDATE_DISCONTINUOUS
-@item
-GTK_UPDATE_DELAYED
-@end itemize
-@end defopt
-
-@defopt color
-@end defopt
-
-@defopt use_opacity
-@end defopt
-
-@defopt title
-@end defopt
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_color_selection_get_type (void)
-Returns the @code{GtkColorSelection} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_color_selection_new (void)
-Create a new @code{GtkColorSelection} object. The new object is returned as a
-pointer to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_color_selection_set_update_policy (GtkColorSelection *@var{colorsel}, GtkUpdateType @var{policy})
-@end deftypefun
-
-@deftypefun void gtk_color_selection_set_color (GtkColorSelection *@var{colorsel}, gdouble *@var{color})
-@end deftypefun
-
-@deftypefun void gtk_color_selection_get_color (GtkColorSelection *@var{colorsel}, gdouble *@var{color})
-@end deftypefun
-
-@deftypefun void gtk_color_selection_set_opacity (GtkColorSelection *@var{colorsel}, gint @var{use_opacity})
-@end deftypefun
-
-@deftypefun guint gtk_color_selection_dialog_get_type (void)
-Returns the @code{GtkColorSelection} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_color_selection_dialog_new (gchar *@var{title})
-Create a new @code{GtkColorSelection} object initializing the title bar of
-the resulting dialog to @var{title}. The new widget is returned as a pointer
-to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@gtkstdmacros{ColorSelection, COLOR_SELECTION}
-
-@page
-@node GtkCombo, GtkContainer, GtkColorSelection, Widgets
-@comment node-name, next, previous, up
-@section The combo widget
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_combo_get_type (void)
-Returns the @code{GtkCombo} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_combo_new (void)
-Create a new @code{GtkCombo} object returning the new widget as a pointer to
-a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_combo_set_value_in_list (GtkCombo *@var{combo}, gint @var{val}, gint @var{ok_if_empty})
-@end deftypefun
-
-@deftypefun void gtk_combo_set_use_arrows (GtkCombo *@var{combo}, gint @var{val})
-@end deftypefun
-
-@deftypefun void gtk_combo_set_use_arrows_always (GtkCombo *@var{combo}, gint @var{val})
-@end deftypefun
-
-@deftypefun void gtk_combo_set_case_sensitive (GtkCombo *@var{combo}, gint @var{val})
-@end deftypefun
-
-@deftypefun void gtk_combo_set_item_string (GtkCombo *@var{combo}, GtkItem *@var{item}, gchar *@var{item_value})
-@end deftypefun
-
-@deftypefun void gtk_combo_set_popdown_strings (GtkCombo *@var{combo}, GList *@var{strings})
-@end deftypefun
-
-@gtkstdmacros{Combo, COMBO}
-
-@page
-@node GtkContainer, GtkCurve, GtkCombo, Widgets
-@comment node-name, next, previous, up
-@section The container widget
-
-@subsection Description
-
-@subsection Options
-
-@defopt border_width
-@end defopt
-
-@subsection Signals
-
-@deftypefn Signal void GtkContainer::add (GtkContainer *@var{container}, GtkWidget *@var{widget})
-@end deftypefn
-
-@deftypefn Signal void GtkContainer::remove (GtkContainer *@var{container}, GtkWidget *@var{widget})
-@end deftypefn
-
-@deftypefn Signal void GtkContainer::need_resize (GtkContainer *@var{container}, GtkWidget *@var{widget})
-@end deftypefn
-
-@deftypefn Signal void GtkContainer::foreach (GtkContainer *@var{container}, GtkCallback @var{callback}, gpointer @var{callback_data})
-@end deftypefn
-
-@deftypefn Signal gint GtkContainer::focus (GtkContainer *@var{container}, GtkDirectionType @var{direction})
-@end deftypefn
-
-@subsection Functions
-
-@deftypefun guint gtk_container_get_type (void)
-Returns the @code{GtkContainer} type identifier.
-@end deftypefun
-
-@deftypefun void gtk_container_border_width (GtkContainer *@var{container}, gint @var{border_width})
-@end deftypefun
-
-@deftypefun void gtk_container_add (GtkContainer *@var{container}, GtkWidget *@var{widget})
-Add @var{widget} to the @var{container}.
-@end deftypefun
-
-@deftypefun void gtk_container_remove (GtkContainer *@var{container}, GtkWidget *@var{widget})
-Remove @var{widget} from @var{container}.
-@end deftypefun
-
-@deftypefun void gtk_container_disable_resize (GtkContainer *@var{container})
-@end deftypefun
-
-@deftypefun void gtk_container_enable_resize (GtkContainer *@var{container})
-@end deftypefun
-
-@deftypefun void gtk_container_block_resize (GtkContainer *@var{container})
-@end deftypefun
-
-@deftypefun void gtk_container_unblock_resize (GtkContainer *@var{container})
-@end deftypefun
-
-@deftypefun gint gtk_container_need_resize (GtkContainer *@var{container}, GtkWidget *@var{widget})
-@end deftypefun
-
-@deftypefun void gtk_container_check_resize (GtkContainer *@var{container}, GtkWidget *@var{widget})
-@end deftypefun
-
-@deftypefun void gtk_container_foreach (GtkContainer *@var{container}, GtkCallback @var{callback}, gpointer @var{callback_data})
-@end deftypefun
-
-@deftypefun void gtk_container_focus (GtkContainer *@var{container}, GtkDirectionType @var{direction})
-@end deftypefun
-
-@deftypefun GList* gtk_container_children (GtkContainer @var{container})
-@end deftypefun
-
-@gtkstdmacros{Container, CONTAINER}
-
-@page
-@node GtkCurve, GtkDialog, GtkContainer, Widgets
-@comment node-name, next, previous, up
-@section The curve widget
-
-@subsection Description
-
-@subsection Options
-
-@defopt type
-@itemize @bullet
-@item GTK_CURVE_TYPE_LINEAR
-@item GTK_CURVE_TYPE_SPLINE
-@item GTK_CURVE_TYPE_FREE
-@end itemize
-@end defopt
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_curve_get_type (void)
-Returns the @code{GtkCurve} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_curve_new (void)
-Create a new @code{GtkCurve} returning the new widget as a pointer to a
-@code{GtkWidget} object.
-@end deftypefun
-
-@deftypefun void gtk_curve_reset (GtkCurve *@var{curve})
-@end deftypefun
-
-@deftypefun void gtk_curve_set_gamma (GtkCurve *@var{curve}, gfloat @var{gamma})
-@end deftypefun
-
-@deftypefun void gtk_curve_set_range (GtkCurve *@var{curve}, gfloat @var{min_x}, gfloat @var{max_x}, gfloat @var{min_y}, gfloat @var{max_y})
-@end deftypefun
-
-@deftypefun void gtk_curve_get_vector (GtkCurve *@var{curve}, int @var{veclen}, gfloat @var{vector[]})
-@end deftypefun
-
-@deftypefun void gtk_curve_set_vector (GtkCurve *@var{curve}, int @var{veclen}, gfloat @var{vector[]})
-@end deftypefun
-
-@deftypefun void gtk_curve_set_curve_type (GtkCurve *@var{curve}, GtkCurveType @var{type})
-@end deftypefun
-
-@gtkstdmacros{Curve, CURVE}
-
-@page
-@node GtkDialog, GtkDrawingArea, GtkCurve, Widgets
-@comment node-name, next, previous, up
-@section The dialog widget
-
-
-@subsection Description
-The dialog widget is a window (@pxref{GtkWindow}) that has a vertical box
-(@pxref{GtkVBox}), a horizontal box (@pxref{GtkHBox}), separated with a
-horizontal separator (@pxref{GtkHSeparator}).
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_dialog_get_type (void)
-Returns the @code{GtkDialog} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_dialog_new (void)
-Create a new @code{GtkDialog} object and return the new widget as a pointer
-to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@gtkstdmacros{Dialog, DIALOG}
-
-
-@page
-@node GtkDrawingArea, GtkEntry, GtkDialog, Widgets
-@comment node-name, next, previous, up
-@section The drawing area widget
-
-@subsection Description
-
-@subsection Options
-
-@defopt width
-@end defopt
-
-@defopt height
-@end defopt
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_drawing_area_get_type (void)
-Returns the @code{GtkDrawingArea} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_drawing_area_new (void)
-Create a new @code{GtkDrawingArea} object returning the new widget as a
-pointer to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_drawing_area_size (GtkDrawingArea *@var{darea}, gint @var{width}, gint @var{height})
-Set the size of the @var{darea} widget, created previously, to @var{width} and @var{height}.
-@end deftypefun
-
-@gtkstdmacros{DrawingArea, DRAWING_AREA}
-
-
-@page
-@node GtkEntry, GtkEventBox, GtkDrawingArea, Widgets
-@comment node-name, next, previous, up
-@section The entry widget
-
-
-@subsection Description
-
-@subsection Options
-
-@defopt max
-With this option it is possible to set the @var{text_max_length} to the
-value specified in the @var{max} option. This value is a guint16 value.
-@end defopt
-
-@defopt text
-With this option it is possible to 'preload' the text that will be displayed
-in the @code{entry} widget to the string pointed to by @var{text}.
-@end defopt
-
-@subsection Signals
-
-@deftypefn Signal void GtkEntry::insert_text (GtkEntry *@var{entry}, gchar *@var{text}, gint @var{length}, gint *@var{position})
-@end deftypefn
-
-@deftypefn Signal void GtkEntry::delete_text (GtkEntry *@var{entry}, gint @var{start_pos}, gint @var{end_pos})
-@end deftypefn
-
-@deftypefn Signal void GtkEntry::changed (GtkEntry *@var{entry})
-@end deftypefn
-
-@deftypefn Signal void GtkEntry::set_text (GtkEntry *@var{entry})
-@end deftypefn
-
-@deftypefn Signal void GtkEntry::activate (GtkEntry *@var{entry})
-@end deftypefn
-
-@subsection Functions
-
-@deftypefun guint gtk_entry_get_type (void)
-Returns the @code{GtkEntry} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_entry_new (void)
-Create a new @code{GtkEntry} object. The new widget is returned
-as a pointer to a @code{GtkWidget} object. @code{NULL} is returned on
-failure.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_entry_new_with_max_length (guint16 @var{max})
-Create a new @code{GtkEntry} object initializing it with the value @var{max}.
-The new widget is returned as a pointer to a @code{GtkWidget} object.
-@code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_entry_set_text (GtkEntry *@var{entry}, gchar *@var{text})
-Will set the text in the previously created @code{GtkEntry} object to
-@var{text}. It is important to not set the fields of the @code{GtkEntry}
-structure directly (or, for that matter, any type derived from
-@code{GtkObject}).
-@end deftypefun
-
-@deftypefun void gtk_entry_append_text (GtkEntry *@var{entry}, gchar *@var{text})
-Append the text that is in the @var{text} argument to the widgets text. It is
-important to not set the fields of the @code{GtkEntry} structure directly.
-@end deftypefun
-
-@deftypefun void gtk_entry_prepend_text (GtkEntry *@var{entry}, gchar *@var{text})
-Add the text in the @var{text} argument to the text in the @code{GtkEntry}
-widget. It is important to not set the fields of the @code{GtkEntry} structure
-directly.
-@end deftypefun
-
-@deftypefun void gtk_entry_set_position (GtkEntry *@var{entry}, gint @var{position})
-@end deftypefun
-
-@deftypefun void gtk_entry_set_visibility (GtkEntry *@var{entry}, gint @var{visible})
-Will make the keystrokes entered into the @code{GtkEntry} object invisible
-when @var{visible} is @code{TRUE}. Defaults to @code{FALSE}.
-@end deftypefun
-
-@deftypefun gchar* gtk_entry_get_text (GtkEntry *@var{entry})
-Returns the text that is contained in the @code{GtkEntry} as a pointer to a
-@code{gchar} variable.
-@end deftypefun
-
-@gtkstdmacros{Entry, ENTRY}
-
-@page
-@node GtkEventBox, GtkFileSelection, GtkEntry, Widgets
-@comment node-name, next, previous, up
-@section The event box widget
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-@deftypefun guint gtk_event_box_get_type (void)
-Returns the @code{GtkEventBox} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_event_box_new (void)
-Create a new @code{GtkEventBox} returning the new widget as a pointer to
-a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@gtkstdmacros{GtkEventBox, EVENT_BOX}
-
-@page
-@node GtkFileSelection, GtkFixed, GtkEventBox, Widgets
-@comment node-name, next, previous, up
-@section The file selection dialog widget
-
-@subsection Description
-
-@subsection Options
-
-@defopt title
-@end defopt
-
-@defopt filename
-@end defopt
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_file_selection_get_type (void)
-Returns the @code{GtkFileSelection} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_file_selection_new (gchar *@var{title})
-Create a new @code{GtkFileSelection} object and return the new widget as a
-pointer to a @code{GtkWidget}. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_file_selection_set_filename (GtkFileSelection *@var{filesel}, gchar *@var{filename})
-@end deftypefun
-
-@deftypefun gchar* gtk_file_selection_get_filename (GtkFileSelection *@var{filesel})
-@end deftypefun
-
-@gtkstdmacros{FileSelection, FILE_SELECTION}
-
-@page
-@node GtkFixed, GtkFrame, GtkFileSelection, Widgets
-@comment node-name, next, previous, up
-@section The fixed widget
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_fixed_get_type (void)
-Returns the @code{GtkFixed} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_fixed_new (void)
-Create a new @code{GtkFixed} object returning the new widget as a pointer to
-a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_fixed_put_new (GtkFixed *@var{fixed}, GtkWidget *@var{widget}, gint16 @var{x}, gint16 @var{y})
-@end deftypefun
-
-@deftypefun void gtk_fixed_move (GtkFixed *@var{fixed}, GtkWidget *@var{widget}, gint16 @var{x}, gint16 @var{y})
-@end deftypefun
-
-@gtkstdmacros{Fixed, FIXED}
-
-@page
-@node GtkFrame, GtkGamma, GtkFixed, Widgets
-@comment node-name, next, previous, up
-@section The frame widget
-
-
-@subsection Options
-@defopt label
-@end defopt
-
-@defopt xalign
-@end defopt
-
-@defopt yalign
-@end defopt
-
-@defopt type
-@end defopt
-
-@subsection Description
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_frame_get_type (void)
-Returns the @code{GtkFrame} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_frame_new (gchar *@var{label})
-Create a new @code{GtkFrame} object initializing it with the value in
-@var{label}. The new widget is returned as a pointer to a @code{GtkWidget}
-object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_frame_set_label (GtkFrame *@var{frame}, gchar *@var{label})
-@end deftypefun
-
-@deftypefun void gtk_frame_set_label_align (GtkFrame *@var{frame}, gfloat @var{xalign}, gfloat @var{yalign})
-@end deftypefun
-
-@deftypefun void gtk_frame_set_shadow_type (GtkFrame *@var{frame}, GtkShadowType @var{type})
-@end deftypefun
-
-@gtkstdmacros{Frame, FRAME}
-
-@page
-@node GtkGamma, GtkHBox, GtkFrame, Widgets
-@comment node-name, next, previous, up
-@section The gamma widget
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_gamma_curve_get_type (void)
-Returns the @code{GtkGamma} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_gamma_curve_new (void)
-Create a new @code{GtkGamma} object returning the new widget as a pointer
-to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@gtkstdmacros{Gamma, GAMMA}
-
-@page
-@node GtkHBox, GtkHButtonBox, GtkGamma, Widgets
-@comment node-name, next, previous, up
-@section The horizontal box widget
-
-
-@subsection Description
-
-@subsection Options
-
-@defopt homogeneous
-This option controls whether each object in the box has the same size. In the
-case of the @code{GtkHBox}, this effects the width. If this option is set then
-the @var{expand} option to the @code{gtk_box_pack} (@pxref{GtkBox}) routines
-is always set to @code{TRUE}.
-@end defopt
-
-@defopt spacing
-This option controls the amount of space that is added between the objects
-packed into this @code{GtkVBox} object.
-@end defopt
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_hbox_get_type (void)
-Returns the @code{GtkHBox} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_hbox_new (gint @var{homogeneous}, gint @var{spacing})
-Create a new @code{GtkHBox} object initializing it with the values in
-@var{homogeneous} and @var{spacing}. The new widget is returned as a pointer
-to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@gtkstdmacros{HBox, HBOX}
-
-@page
-@node GtkHButtonBox, GtkHPaned, GtkHBox, Widgets
-@comment node-name, next, previous, up
-@section The horizontal button box widget
-
-@subsection Description
-
-@subsection Options
-
-@defopt spacing
-@end defopt
-
-@defopt layout
-@end defopt
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_hbutton_box_get_type (void)
-Returns the @code{GtkHButtonBox} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_hbutton_box_new (void)
-Create a new @code{GtkHButtonBox} object returning the new widget as a pointer
-to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_hbutton_box_set_spacing_default (gint @var{spacing})
-@end deftypefun
-
-@deftypefun void gtk_hbutton_box_set_layout_default (gint @var{layout})
-@end deftypefun
-
-@deftypefun gint gtk_hbutton_box_get_spacing_default (void)
-@end deftypefun
-
-@deftypefun gint gtk_hbutton_box_get_layout_default (void)
-@end deftypefun
-
-@gtkstdmacros {HButtonBox, HBUTTON_BOX}
-
-@page
-@node GtkHPaned, GtkHRuler, GtkHButtonBox, Widgets
-@comment node-name, next, previous, up
-@section The horizontal paned widget
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun void gtk_hpaned_get_type (void)
-Returns the @code{GtkHPaned} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_hpaned_new (void)
-Create a new @code{GtkHPaned} object returning the new widget as a pointer
-to a @code{GtkWidget} object.
-@end deftypefun
-
-@gtkstdmacros{HPaned, HPANED}
-
-@page
-@node GtkHRuler, GtkHScale, GtkHPaned, Widgets
-@comment node-name, next, previous, up
-@section The horizontal ruler widget
-
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_hruler_get_type (void)
-Returns the @code{GtkHRuler} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_hruler_new (void)
-Create a new @code{GtkHRuler} object returning the new widget as a pointer
-to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@gtkstdmacros{HRuler, HRULER}
-
-
-@page
-@node GtkHScale, GtkHScrollbar, GtkHRuler, Widgets
-@comment node-name, next, previous, up
-@section The horizontal scale widget
-
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_hscale_get_type (void)
-Returns the @code{GtkHScale} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_hscale_new (GtkAdjustment *@var{adjustment})
-Create a new @code{GtkHScale} object returning the new widget as a pointer
-to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@gtkstdmacros{HScale, HSCALE}
-
-
-@page
-@node GtkHScrollbar, GtkHSeparator, GtkHScale, Widgets
-@comment node-name, next, previous, up
-@section The horizontal scrollbar widget
-
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_hscrollbar_get_type (void)
-Returns the @code{GtkHScrollbar} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_hscrollbar_new (GtkAdjustment *@var{adjustment})
-Create a new @code{GtkHScrollbar} object returning the new widget as a
-pointer to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@gtkstdmacros{HScrollbar, HSCROLLBAR}
-
-
-@page
-@node GtkHSeparator, GtkImage, GtkHScrollbar, Widgets
-@comment node-name, next, previous, up
-@section The horizontal separator widget
-
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_hseparator_get_type (void)
-Returns the @code{GtkHSeparator} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_hseparator_new (void)
-Create a new @code{GtkHSeparator} object returning the new widget as a pointer
-to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@gtkstdmacros{HSeparator, HSEPARATOR}
-
-
-@page
-@node GtkImage, GtkInputDialog, GtkHSeparator, Widgets
-@comment node-name, next, previous, up
-@section The image widget
-
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_image_get_type (void)
-Returns the @code{GtkImage} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_image_new (GdkImage *@var{val}, GdkBitmap *@var{mask})
-Create a new @code{GtkImage} object initializing it with the values in
-@var{val} and @var{mask}. The new widget is returned as a pointer to a
-@code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_image_set (GtkImage *@var{image}, GdkImage *@var{val}, GdkBitmap *@var{mask})
-@end deftypefun
-
-@deftypefun void gtk_image_get (GtkImage *@var{image}, GdkImage **@var{val}, GdkBitmap **@var{mask})
-@end deftypefun
-
-@gtkstdmacros{Image, IMAGE}
-
-@page
-@node GtkInputDialog, GtkItem, GtkImage, Widgets
-@comment node-name, next, previous, up
-@section The input dialog widget
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@deftypefn Signal void GtkInputDialog::enable_device (GtkInputDialog *@var{inputd}, guint32 @var{devid}, gpointer *@var{data})
-@end deftypefn
-
-@deftypefn Signal void GtkInputDialog::disable_device (GtkInputDialog *@var{inputd}, guint32 @var{devid}, gpointer *@var{data})
-@end deftypefn
-
-@subsection Functions
-
-@deftypefun guint gtk_input_dialog_get_type (void)
-Returns the @code{GtkInputDialog} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_input_dialog_new (void)
-Create a new @code{GtkInputDialog} object and return the new widget as a
-pointer to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-
-@gtkstdmacros{InputDialog, INPUTDIALOG}
-
-@page
-@node GtkItem, GtkLabel, GtkInputDialog, Widgets
-@comment node-name, next, previous, up
-@section The item widget
-
-
-@subsection Description
-
-@subsection Signals
-
-@deftypefn Signal void GtkItem::select (GtkItem *@var{item})
-@end deftypefn
-
-@deftypefn Signal void GtkItem::deselect (GtkItem *@var{item})
-@end deftypefn
-
-@deftypefn Signal void GtkItem::toggle (GtkItem *@var{toggle})
-@end deftypefn
-
-@subsection Functions
-
-@deftypefun guint gtk_item_get_type (void)
-Returns the @code{GtkItem} type identifier.
-@end deftypefun
-
-@deftypefun void gtk_item_select (GtkItem *@var{item})
-@end deftypefun
-
-@deftypefun void gtk_item_deselect (GtkItem *@var{item})
-@end deftypefun
-
-@deftypefun void gtk_item_toggle (GtkItem *@var{item})
-@end deftypefun
-
-@gtkstdmacros{Item, ITEM}
-
-
-@page
-@node GtkLabel, GtkList, GtkItem, Widgets
-@comment node-name, next, previous, up
-@section The label widget
-
-@subsection Description
-
-@subsection Options
-
-@defopt str
-@end defopt
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_label_get_type (void)
-Returns the @code{GtkLabel} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_label_new (GtkLabel *@var{label}, gchar *@var{str})
-Create a new @code{GtkLabel} object and initialize it with the
-text in @var{str}. The new widget is returned as a pointer to a
-@code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_label_set (GtkLabel *@var{label}, gchar *@var{str})
-Set the @code{GtkLabel} label value to the value passed in the @var{str}
-argument.
-@end deftypefun
-
-@deftypefun void gtk_label_get (GtkLabel *@var{label}, gchar **@var{str})
-Copies the current value in the @code{GtkLabel} label field to the variable
-passed in the @var{str} argument.
-@end deftypefun
-
-@gtkstdmacros{Label, LABEL}
-
-
-@page
-@node GtkList, GtkListItem, GtkLabel, Widgets
-@comment node-name, next, previous, up
-@section The list widget
-
-
-@subsection Description
-
-@subsection Signals
-
-@deftypefn Signal void GtkList::selection_changed (GtkList *@var{list})
-@end deftypefn
-
-@deftypefn Signal void GtkList::select_child (GtkList *@var{list}, GtkWidget *@var{child})
-@end deftypefn
-
-@deftypefn Signal void GtkList::unselect_child (GtkList *@var{list}, GtkWidget *@var{child})
-@end deftypefn
-
-@subsection Functions
-
-@deftypefun guint gtk_list_get_type (void)
-Returns the @code{GtkList} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_list_new (void)
-Create a new @code{GtkList} object and return the new widget as a pointer to
-a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_list_insert_items (GtkList *@var{list}, GList *@var{items}, gint @var{position})
-@end deftypefun
-
-@deftypefun void gtk_list_append_items (GtkList *@var{list}, GList *@var{items})
-@end deftypefun
-
-@deftypefun void gtk_list_prepend_items (GtkList *@var{list}, GList *@var{items})
-@end deftypefun
-
-@deftypefun void gtk_list_remove_items (GtkList *@var{list}, GList *@var{items})
-@end deftypefun
-
-@deftypefun void gtk_list_clear_items (GtkList *@var{list}, gint @var{start}, gint @var{end})
-@end deftypefun
-
-@deftypefun void gtk_list_select_item (GtkList *@var{list}, gint @var{item})
-@end deftypefun
-
-@deftypefun void gtk_list_unselect_item (GtkList *@var{list}, gint @var{item})
-@end deftypefun
-
-@deftypefun void gtk_list_select_child (GtkList *@var{list}, GtkWidget *@var{child})
-@end deftypefun
-
-@deftypefun void gtk_list_unselect_child (GtkList *@var{list}, GtkWidget *@var{child})
-@end deftypefun
-
-@deftypefun gint gtk_list_child_position (GtkList *@var{list}, GtkWidget *@var{child})
-@end deftypefun
-
-@deftypefun void gtk_list_set_selection_mode (GtkList *@var{list}, GtkSelectionMode @var{mode})
-@end deftypefun
-
-@gtkstdmacros{List, LIST}
-
-
-@page
-@node GtkListItem, GtkMenu, GtkList, Widgets
-@comment node-name, next, previous, up
-@section The list item widget
-
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_list_item_get_type (void)
-Returns the @code{GtkListItem} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_list_item_new (void)
-Create a new @code{GtkListItem} object and return the new widget as a
-pointer to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_list_item_new_with_label (gchar *@var{label})
-Create a new @code{GtkListItem} object initializing with the value @var{label}.
-The new widget is returned as a pointer to a @code{GtkWidget} object.
-@code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_list_item_select (GtkListItem *@var{list_item})
-@end deftypefun
-
-@deftypefun void gtk_list_item_deselect (GtkListItem *@var{list_item})
-@end deftypefun
-
-@gtkstdmacros{ListItem, LIST_ITEM}
-
-
-@page
-@node GtkMenu, GtkMenuBar, GtkListItem, Widgets
-@comment node-name, next, previous, up
-@section The menu widget
-
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_menu_get_type (void)
-Returns the @code{GtkMenu} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_menu_new (void)
-Create a new @code{GtkMenu} object returning the new widget as a pointer to
-a @code{GtkWidget}. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_menu_append (GtkMenu *@var{menu}, GtkWidget *@var{child})
-@end deftypefun
-
-@deftypefun void gtk_menu_prepend (GtkMenu *@var{menu}, GtkWidget *@var{child})
-@end deftypefun
-
-@deftypefun void gtk_menu_insert (GtkMenu *@var{menu}, GtkWidget *@var{child}, gint @var{position})
-@end deftypefun
-
-@deftypefun void gtk_menu_popup (GtkMenu *@var{menu}, GtkWidget *@var{parent_menu_shell}, GtkWidget *@var{parent_menu_item}, GtkMenuPositionFunc @var{func}, gpointer @var{data}, gint @var{button})
-@end deftypefun
-
-@deftypefun void gtk_menu_popdown (GtkMenu *@var{menu})
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_menu_get_active (GtkMenu *@var{menu})
-@end deftypefun
-
-@deftypefun void gtk_menu_set_active (GtkMenu *@var{menu})
-@end deftypefun
-
-@deftypefun void gtk_menu_set_accelerator_table (GtkMenu *@var{menu}, GtkAcceleratorTable *@var{table})
-@end deftypefun
-
-@gtkstdmacros{Menu, MENU}
-
-
-@page
-@node GtkMenuBar, GtkMenuItem, GtkMenu, Widgets
-@comment node-name, next, previous, up
-@section The menu bar widget
-
-@subsection Description
-
-@subsection Options
-
-@defopt position
-@end defopt
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_menu_bar_get_type (void)
-Returns the @code{GtkMenuBar} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_menu_bar_new (void)
-Create a new @code{GtkMenuBar} object returning the new widget as a pointer
-to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_menu_bar_append (GtkMenuBar *@var{menu_bar}, GtkWidget *@var{child})
-@end deftypefun
-
-@deftypefun void gtk_menu_bar_prepend (GtkMenuBar *@var{menu_bar}, GtkWidget *@var{child})
-@end deftypefun
-
-@deftypefun void gtk_menu_bar_insert (GtkMenuBar *@var{menu_bar}, GtkWidget *@var{child}, gint @var{position})
-@end deftypefun
-
-@gtkstdmacros{MenuBar, MENU_BAR}
-
-
-@page
-@node GtkMenuItem, GtkMenuShell, GtkMenuBar, Widgets
-@comment node-name, next, previous, up
-@section The menu item widget
-
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@deftypefn Signal void GtkMenuItem::activate (GtkMenuItem *@var{menu_item})
-@end deftypefn
-
-@subsection Functions
-
-@deftypefun guint gtk_menu_item_get_type (void)
-Returns the @code{GtkMenuItem} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_menu_item_new (void)
-Create a new @code{GtkMenuItem} object returning the new widget as a pointer
-to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_menu_item_new_with_label (gchar *@var{label})
-Create a new @code{GtkMenuItem} object initializing it with the value in
-@var{label}. The new widget is returned as a pointer to a @code{GtkWidget}
-object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_menu_item_set_submenu (GtkMenuItem *@var{menu_item}, GtkWidget *@var{submenu})
-@end deftypefun
-
-@deftypefun void gtk_menu_item_set_placement (GtkMenuItem *@var{menu_item}, GtkSubmenuPlacement @var{placement})
-@end deftypefun
-
-@deftypefun void gtk_menu_item_accelerator_size (GtkMenuItem *@var{menu_item})
-@end deftypefun
-
-@deftypefun void gtk_menu_item_accelerator_text (GtkMenuItem *@var{menu_item}, gchar *@var{buffer})
-@end deftypefun
-
-@deftypefun void gtk_menu_item_configure (GtkMenuItem *@var{menu_item}, gint @var{show_toggle_indicator}, gint @var{show_submenu_indicator})
-@end deftypefun
-
-@deftypefun void gtk_menu_item_select (GtkMenuItem *@var{menu_item})
-@end deftypefun
-
-@deftypefun void gtk_menu_item_deselect (GtkMenuItem *@var{menu_item})
-@end deftypefun
-
-@deftypefun void gtk_menu_item_activate (GtkMenuItem *@var{menu_item})
-@end deftypefun
-
-@gtkstdmacros{MenuItem, MENU_ITEM}
-
-
-@page
-@node GtkMenuShell, GtkMisc, GtkMenuItem, Widgets
-@comment node-name, next, previous, up
-@section The menu shell widget
-
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@deftypefn Signal void GtkMenuShell::deactivate (GtkMenuShell *@var{menu_shell})
-@end deftypefn
-
-@subsection Functions
-
-@deftypefun guint gtk_menu_shell_get_type (void)
-Returns the @code{GtkMenuShell} type identifier.
-@end deftypefun
-
-@deftypefun void gtk_menu_shell_append (GtkMenuShell *@var{menu_shell}, GtkWidget *@var{child})
-@end deftypefun
-
-@deftypefun void gtk_menu_shell_prepend (GtkMenuShell *@var{menu_shell}, GtkWidget *@var{child})
-@end deftypefun
-
-@deftypefun void gtk_menu_shell_insert (GtkMenuShell *@var{menu_shell}, GtkWidget *@var{child}, gint @var{position})
-@end deftypefun
-
-@deftypefun void gtk_menu_shell_deactivate (GtkMenuShell *@var{menu_shell})
-@end deftypefun
-
-@gtkstdmacros{MenuShell, MENU_SHELL}
-
-
-@page
-@node GtkMisc, GtkNotebook, GtkMenuShell, Widgets
-@comment node-name, next, previous, up
-@section The misc widget
-
-@subsection Description
-
-@subsection Options
-
-@defopt xalign
-@end defopt
-
-@defopt yalign
-@end defopt
-
-@defopt xpad
-@end defopt
-
-@defopt ypad
-@end defopt
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_misc_get_type (void)
-Returns the @code{GtkMisc} type identifier.
-@end deftypefun
-
-@deftypefun void gtk_misc_set_alignment (GtkMisc *@var{misc}, gfloat @var{xalign}, gfloat @var{yalign})
-@end deftypefun
-
-@deftypefun void gtk_misc_set_padding (GtkMisc *@var{misc}, gint @var{xpad}, gint @var{ypad})
-@end deftypefun
-
-@gtkstdmacros{Misc, MISC}
-
-
-@page
-@node GtkNotebook, GtkOptionMenu, GtkMisc, Widgets
-@comment node-name, next, previous, up
-@section The notebook widget
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_notebook_get_type (void)
-Returns the @code{GtkNotebook} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_notebook_new (void)
-Create a new @code{GtkNotebook} object returning the new widget as a pointer
-to a @code{GtkWidget} object. @code{NULL} is returned on a failure.
-@end deftypefun
-
-@deftypefun void gtk_notebook_append_page (GtkNotebook *@var{notebook}, GtkWidget *@var{child}, GtkWidget *@var{tab_label})
-@end deftypefun
-
-@deftypefun void gtk_notebook_prepend_page (GtkNotebook *@var{notebook}, GtkWidget *@var{child}, GtkWidget *@var{tab_label})
-@end deftypefun
-
-@deftypefun void gtk_notebook_insert_page (GtkNotebook *@var{notebook}, GtkWidget *@var{child}, GtkWidget *@var{tab_label}, gint @var{position})
-@end deftypefun
-
-@deftypefun void gtk_notebook_remove_page (GtkNotebook *@var{notebook}, gint @var{page_num})
-@end deftypefun
-
-@deftypefun void gtk_notebook_set_page (GtkNotebook *@var{notebook}, gint @var{page_num})
-@end deftypefun
-
-@deftypefun void gtk_notebook_next_page (GtkNotebook *@var{notebook})
-@end deftypefun
-
-@deftypefun void gtk_notebook_prev_page (GtkNotebook *@var{notebook})
-@end deftypefun
-
-@deftypefun void gtk_notebook_set_tab_pos (GtkNotebook *@var{notebook}, GtkPositionType @var{pos})
-@end deftypefun
-
-@deftypefun void gtk_notebook_set_show_tabs (GtkNotebook *@var{notebook}, gint @var{show_tabs})
-@end deftypefun
-
-@deftypefun void gtk_notebook_set_show_border (GtkNotebook *@var{notebook}, gint @var{show_border})
-@end deftypefun
-
-@gtkstdmacros{Notebook, NOTEBOOK}
-
-
-@page
-@node GtkOptionMenu, GtkPaned, GtkNotebook, Widgets
-@comment node-name, next, previous, up
-@section The option menu widget
-
-@subsection Description
-
-@subsection Options
-
-@defopt index
-@end defopt
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_option_menu_get_type (void)
-Returns the @code{GtkOptionMenu} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_option_menu_new (void)
-Create a new @code{GtkOptionMenu} object returning the new widget as a
-pointer to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_option_menu_get_menu (GtkOptionMenu *@var{option_menu})
-@end deftypefun
-
-@deftypefun void gtk_option_menu_set_menu (GtkOptionMenu *@var{option_menu}, GtkWidget *@var{menu})
-@end deftypefun
-
-@deftypefun void gtk_option_menu_remove_menu (GtkOptionMenu *@var{option_menu})
-@end deftypefun
-
-@deftypefun void gtk_option_menu_set_history (GtkOptionMenu *@var{option_menu}, gint @var{index})
-@end deftypefun
-
-@gtkstdmacros{OptionMenu, OPTION_MENU}
-
-@page
-@node GtkPaned, GtkPixmap, GtkOptionMenu, Widgets
-@comment node-name, next, previous, up
-@section The paned widget
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_paned_get_type (void)
-Returns the @code{GtkPaned} type identifier.
-@end deftypefun
-
-@deftypefun void gtk_paned_add1 (GtkPaned *@var{paned}, GtkWidget *@var{child})
-@end deftypefun
-
-@deftypefun void gtk_paned_add2 (GtkPaned *@var{paned}, GtkWidget *@var{child})
-@end deftypefun
-
-@deftypefun void gtk_paned_handle_size (GtkPaned *@var{paned}, guint16 @var{size})
-@end deftypefun
-
-
-@deftypefun void gtk_paned_gutter_size (GtkPaned *@var{paned}, guint16 @var{size})
-@end deftypefun
-
-@gtkstdmacros{Paned, PANED}
-
-@page
-@node GtkPixmap, GtkPreview, GtkPaned, Widgets
-@comment node-name, next, previous, up
-@section The pixmap widget
-
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_pixmap_get_type (void)
-Returns the @code{GtkPixmap} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_pixmap_new (GdkPixmap *@var{normal}, GdkPixmap *@var{active}, GdkPixmap *@var{prelight}, GdkPixmap *@var{selected}, GdkPixmap *@var{insensitive})
-@end deftypefun
-
-@deftypefun void gtk_pixmap_set (GtkPixmap *@var{pixmap}, GdkPixmap *@var{val}, GtkStateType @var{state})
-@end deftypefun
-
-@deftypefun void gtk_pixmap_get (GtkPixmap *@var{pixmap}, GdkPixmap **@var{val}, GtkStateType @var{state})
-@end deftypefun
-
-@gtkstdmacros{Pixmap, PIXMAP}
-
-
-@page
-@node GtkPreview, GtkProgressBar, GtkPixmap, Widgets
-@comment node-name, next, previous, up
-@section The preview widget
-
-@subsection Description
-
-@subsection Options
-
-@defopt type
-@end defopt
-
-@defopt width
-@end defopt
-
-@defopt height
-@end defopt
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_preview_get_type (void)
-Returns the @code{GtkPreview} type identifier.
-@end deftypefun
-
-@deftypefun void gtk_preview_uninit (void)
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_preview_new (GtkPreviewType @var{type})
-Create a new @code{GtkPreview} object initializing it with the values in
-@var{type}. The new widget is returned as a pointer to a @code{GtkWidget}
-object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_preview_size (GtkPreview *@var{preview}, gint @var{width}, gint @var{height})
-Set the size of the @var{preview} object to @var{width} and @var{height}.
-@end deftypefun
-
-@deftypefun void gtk_preview_put (GtkPreview *@var{preview}, GdkWindow *@var{window}, GdkGC *@var{gc}, gint @var{srcx}, gint @var{srcy}, gint @var{destx}, gint @var{desty}, gint @var{width}, gint @var{height})
-@end deftypefun
-
-@deftypefun void gtk_preview_put_row (GtkPreview *@var{preview}, guchar *@var{src}, guchar *@var{dest}, gint @var{x}, gint @var{y}, gint @var{w})
-@end deftypefun
-
-@deftypefun void gtk_preview_draw_row (GtkPreview *@var{preview}, guchar @var{data}, gint @var{x}, gint @var{y}, gint @var{w})
-@end deftypefun
-
-@deftypefun void gtk_preview_set_expand (GtkPreview *@var{preview}, gint @var{expand})
-@end deftypefun
-
-@deftypefun void gtk_preview_set_gamma (double @var{gamma})
-@end deftypefun
-
-@deftypefun void gtk_preview_set_color_cube (guint @var{nred_shades}, guint @var{ngreen_shades}, guint @var{nblue_shades}, guint @var{ngray_shades})
-@end deftypefun
-
-@deftypefun void gtk_preview_set_install_cmap (gint @var{install_cmap})
-@end deftypefun
-
-@deftypefun void gtk_preview_set_reserved (gint @var{nreserved})
-@end deftypefun
-
-@deftypefun GdkVisual* gtk_preview_get_visual (void)
-@end deftypefun
-
-@deftypefun GdkColormap* gtk_preview_get_cmap (void)
-@end deftypefun
-
-@deftypefun GtkPreviewInfo* gtk_preview_get_info (void)
-@end deftypefun
-
-@gtkstdmacros{Preview, PREVIEW}
-
-
-@page
-@node GtkProgressBar, GtkRadioButton, GtkPreview, Widgets
-@comment node-name, next, previous, up
-@section The progress bar widget
-
-
-@subsection Description
-
-@subsection Options
-
-@defopt percentage
-@end defopt
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_progress_bar_get_type (void)
-Returns the @code{GtkProgressBar} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_progress_bar_new (void)
-Create a new @code{GtkProgressBar} object returning the new widget as a
-pointer to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_progress_bar_update (GtkProgressBar *@var{pbar}, gfloat @var{percentage})
-Cause the @code{GtkProgressBar} to update its visual appearance to reflect the
-@var{percentage}.
-@end deftypefun
-
-@gtkstdmacros{ProgressBar, PROGRESS_BAR}
-
-
-@page
-@node GtkRadioButton, GtkRadioMenuItem, GtkProgressBar, Widgets
-@comment node-name, next, previous, up
-@section The radio button widget
-
-@subsection Description
-
-@subsection Options
-
-@defopt group
-@end defopt
-
-@defopt label
-@end defopt
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_radio_button_get_type (void)
-Returns the @code{GtkRadioButton} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_radio_button_new (GSList *@var{group})
-Create a new @code{GtkRadioButton} object initializing it with the value
-in the @var{group} argument. The new widget is returned as a pointer to a
-@code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_radio_button_new_with_label (GSList *@var{group}, gchar *@var{label})
-Create a new @code{GtkRadioButton} object initializing it with the values in
-the @var{group} and @var{label} arguments. The new widget is returned as a
-pointer to @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun GSList* gtk_radio_button_group (GtkRadioButton *@var{radio_button})
-@end deftypefun
-
-@gtkstdmacros{RadioButton, RADIO_BUTTON}
-
-
-@page
-@node GtkRadioMenuItem, GtkRange, GtkRadioButton, Widgets
-@comment node-name, next, previous, up
-@section The radio button widget
-
-
-@subsection Description
-
-@subsection Options
-
-@defopt group
-@end defopt
-
-@defopt label
-@end defopt
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_radio_menu_item_get_type (void)
-Returns the @code{GtkRadioMenuItem} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_radio_menu_item_new (GSList *@var{group})
-Create a new @code{GtkRadioMenuItem} object and initialize it with the
-values in @var{group}. The new widget is returned as a pointer to a
-@code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_radio_menu_item_new_with_label (GSList *@var{group}, gchar *@var{label})
-@end deftypefun
-
-@deftypefun GSList* gtk_radio_menu_item_group (GtkRadioMenuItem *@var{radio_menu_item})
-@end deftypefun
-
-@gtkstdmacros{RadioMenuItem, RADIO_MENU_ITEM}
-
-
-@page
-@node GtkRange, GtkRuler, GtkRadioMenuItem, Widgets
-@comment node-name, next, previous, up
-@section The range widget
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_range_get_type (void)
-Returns the @code{GtkRange} type identifier.
-@end deftypefun
-
-@deftypefun GtkAdjustment* gtk_range_get_adjustment (GtkRange *@var{range})
-@end deftypefun
-
-@deftypefun void gtk_range_set_update_policy (GtkRange *@var{range}, GtkUpdatePolicy @var{policy})
-@end deftypefun
-
-@deftypefun void gtk_range_set_adjustment (GtkRange *@var{range}, GtkAdjustment *@var{adjustment})
-@end deftypefun
-
-@deftypefun void gtk_range_draw_background (GtkRange *@var{range})
-@end deftypefun
-
-@deftypefun void gtk_range_draw_trough (GtkRange *@var{range})
-@end deftypefun
-
-@deftypefun void gtk_range_draw_slider (GtkRange *@var{range})
-@end deftypefun
-
-@deftypefun void gtk_range_draw_step_forw (GtkRange *@var{range})
-@end deftypefun
-
-@deftypefun void gtk_range_draw_step_back (GtkRange *@var{range})
-@end deftypefun
-
-@deftypefun void gtk_range_slider_update (GtkRange *@var{range})
-@end deftypefun
-
-@deftypefun gint gtk_range_trough_click (GtkRange *@var{range}, gint @var{x}, gint @var{y})
-@end deftypefun
-
-@deftypefun void gtk_range_default_hslider_update (GtkRange *@var{range})
-@end deftypefun
-
-@deftypefun void gtk_range_default_vslider_update (GtkRange *@var{range})
-@end deftypefun
-
-@deftypefun gint gtk_range_default_htrough_click (GtkRange *@var{range}, gint @var{x}, gint @var{y})
-@end deftypefun
-
-@deftypefun gint gtk_range_default_vtrough_click (GtkRange *@var{range}, gint @var{x}, gint @var{y})
-@end deftypefun
-
-@deftypefun void gtk_range_default_hmotion (GtkRange *@var{range}, gint @var{xdelta}, gint @var{ydelta})
-@end deftypefun
-
-@deftypefun void gtk_range_default_vmotion (GtkRange *@var{range}, gint @var{xdelta}, gint @var{ydelta})
-@end deftypefun
-
-@deftypefun gfloat gtk_range_calc_value (GtkRange *@var{range}, gint @var{position})
-@end deftypefun
-
-@gtkstdmacros{Range, RANGE}
-
-
-@page
-@node GtkRuler, GtkScale, GtkRange, Widgets
-@comment node-name, next, previous, up
-@section The ruler widget
-
-@subsection Description
-
-@subsection Options
-
-@defopt metric
-@end defopt
-
-@defopt lower
-@end defopt
-
-@defopt upper
-@end defopt
-
-@defopt position
-@end defopt
-
-@defopt max_size
-@end defopt
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_ruler_get_type (void)
-Returns the @code{GtkRuler} type identifier.
-@end deftypefun
-
-@deftypefun void gtk_ruler_set_metric (GtkRuler *@var{ruler}, GtkMetricType @var{metric})
-@end deftypefun
-
-@deftypefun void gtk_ruler_set_range (GtkRuler *@var{ruler}, gfloat @var{lower}, gfloat @var{upper}, gfloat @var{position}, gfloat @var{max_size})
-@end deftypefun
-
-@deftypefun void gtk_ruler_draw_ticks (GtkRuler *@var{ruler})
-@end deftypefun
-
-@deftypefun void gtk_ruler_draw_pos (GtkRuler *@var{ruler})
-@end deftypefun
-
-@gtkstdmacros{Ruler, RULER}
-
-
-@page
-@node GtkScale, GtkScrollbar, GtkRuler, Widgets
-@comment node-name, next, previous, up
-@section The scale widget
-
-
-@subsection Description
-
-@subsection Options
-
-@defopt digits
-@end defopt
-
-@defopt draw_value
-@end defopt
-
-@defopt pos
-@end defopt
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_scale_get_type (void)
-Returns the @code{GtkScale} type identifier.
-@end deftypefun
-
-@deftypefun void gtk_scale_set_digits (GtkScale *@var{scale}, gint @var{digits})
-@end deftypefun
-
-@deftypefun void gtk_scale_set_draw_value (GtkScale *@var{scale}, gint @var{draw_value})
-@end deftypefun
-
-@deftypefun void gtk_scale_set_value_pos (GtkScale *@var{scale}, gint @var{pos})
-@end deftypefun
-
-@deftypefun gint gtk_scale_value_width (GtkScale *@var{scale})
-@end deftypefun
-
-@deftypefun void gtk_scale_draw_value (GtkScale *@var{scale})
-@end deftypefun
-
-@gtkstdmacros{Scale, SCALE}
-
-
-@page
-@node GtkScrollbar, GtkScrolledWindow, GtkScale, Widgets
-@comment node-name, next, previous, up
-@section The scrollbar widget
-
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_scrollbar_get_type (void)a
-Returns the @code{GtkScrollbar} type identifier.
-@end deftypefun
-
-@gtkstdmacros{Scrollbar, SCROLLBAR}
-
-
-@page
-@node GtkScrolledWindow, GtkSeparator, GtkScrollbar, Widgets
-@comment node-name, next, previous, up
-@section The scrolled window widget
-
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_scrolled_window_get_type (void)
-Returns the @code{GtkScrolledWindow} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_scrolled_window_new (GtkAdjustment *@var{hadjustment}, GtkAdjustment *@var{vadjustment})
-Create a new @code{GtkScrolledWindow} object initializing it with the values in
-@var{adjustment} and @var{adjustment}. The new widget is returned as a
-pointer to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun GtkAdjustment* gtk_scrolled_window_get_hadjustment (GtkScrolledWindow *@var{scrolled_window})
-@end deftypefun
-
-@deftypefun GtkAdjustment* gtk_scrolled_window_get_vadjustment (GtkScrolledWindow *@var{scrolled_window})
-@end deftypefun
-
-@deftypefun void gtk_scrolled_window_set_policy (GtkScrolledWindow *@var{scrolled_window}, GtkPolicyType @var{hscrollbar_policy}, GtkPolicyType @var{vscrollbar_policy})
-@end deftypefun
-
-@gtkstdmacros{ScrolledWindow, SCROLLED_WINDOW}
-
-
-@page
-@node GtkSeparator, GtkStatusbar, GtkScrolledWindow, Widgets
-@comment node-name, next, previous, up
-@section The separator widget
-
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_separator_get_type (void)
-Returns the @code{GtkSeparator} type identifier.
-@end deftypefun
-
-@gtkstdmacros{Separator, SEPARATOR}
-
-@page
-@node GtkStatusbar, GtkTable, GtkSeparator, Widgets
-@comment node-name, next, previous, up
-@section The statusbar widget
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_statusbar_get_type (void)
-Returns the @code{GtkStatusbar} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_statusbar_new (void)
-Create a new @code{GtkStatusbar} object returning the new widget as a pointer
-to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun gint gtk_statusbar_push (GtkStatusbar *@var{statusbar}, gchar *@var{text})
-@end deftypefun
-
-@deftypefun void gtk_statusbar_pop (GtkStatusbar *@var{statusbar}, gint @var{context_id})
-@end deftypefun
-
-@gtkstdmacros{Statusbar, STATUSBAR}
-
-@page
-@node GtkTable, GtkText, GtkStatusbar, Widgets
-@comment node-name, next, previous, up
-@section The table widget
-
-@subsection Description
-
-@subsection Options
-
-@defopt rows
-@end defopt
-
-@defopt columns
-@end defopt
-
-@defopt homogeneous
-This option controls whether all child widgets in the @code{GtkTable} will
-be of the same size. The child widgets will be the size of the largest child.
-@end defopt
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_table_get_type (void)
-Returns the @code{GtkTable} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_table_new (gint @var{rows}, gint @var{columns}, gint @var{homogeneous})
-Create a new @code{GtkTable} object initializing it with the values in
-@var{rows}, @var{columns} and @var{homogeneous}. The new widget is returned
-as a pointer to a @code{GtkWidget}. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_table_attach (GtkTable *@var{table}, GtkWidget *@var{child}, gint @var{left_attach}, gint @var{right_attach}, gint @var{top_attach}, gint @var{bottom_attach}, gint @var{xoptions}, gint @var{yoptions}, gint @var{xpadding}, gint @var{ypadding})
-@end deftypefun
-
-@deftypefun void gtk_table_attach_defaults (GtkTable *@var{table}, GtkWidget *@var{widget}, gint @var{left_attach}, gint @var{right_attach}, gint @var{top_attach}, gint @var{bottom_attach})
-@end deftypefun
-
-@deftypefun void gtk_table_set_row_spacing (GtkTable *@var{table}, gint @var{row}, gint @var{spacing})
-@end deftypefun
-
-@deftypefun void gtk_table_set_col_spacing (GtkTable *@var{table}, gint @var{col}, gint @var{spacing})
-@end deftypefun
-
-@deftypefun void gtk_table_set_row_spacings (GtkTable *@var{table}, gint @var{spacing})
-@end deftypefun
-
-@deftypefun void gtk_table_set_col_spacings (GtkTable *@var{table}, gint @var{spacing})
-@end deftypefun
-
-@gtkstdmacros{Table, TABLE}
-
-
-@page
-@node GtkText, GtkToggleButton, GtkTable, Widgets
-@comment node-name, next, previous, up
-@section The text widget
-
-
-@subsection Description
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_text_get_type (void)
-Returns the @code{GtkText} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_text_new (GtkAdjustment *@var{hadj}, GtkAdjustment *@var{vadj});
-Create a new @code{GtkText} object initializing it with the values in
-@var{hadj} and @var{vadj}. The new widget is returned as a pointer to a
-@code{GtkWidget}. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_text_set_editable (GtkText *@var{text}, gint @var{editable})
-@end deftypefun
-
-@deftypefun void gtk_text_set_adjustments (GtkText *@var{text}, GtkAdjustment *@var{hadj}, GtkAdjustment *@var{vadj})
-@end deftypefun
-
-@deftypefun void gtk_text_set_point (GtkText *@var{text}, guint @var{index})
-@end deftypefun
-
-@deftypefun guint gtk_text_get_point (GtkText *@var{text})
-@end deftypefun
-
-@deftypefun guint gtk_text_get_length (GtkText *@var{text})
-@end deftypefun
-
-@deftypefun void gtk_text_freeze (GtkText *@var{text})
-@end deftypefun
-
-@deftypefun void gtk_text_thaw (GtkText *@var{text})
-@end deftypefun
-
-@deftypefun void gtk_text_insert (GtkText *@var{text}, GdkFont *@var{font}, GdkColor *@var{fore}, GdkColor *@var{back}, char *@var{chars}, gint @var{length})
-@end deftypefun
-
-@deftypefun gint gtk_text_forward_delete (GtkText *@var{text}, guint @var{nchars})
-@end deftypefun
-
-@deftypefun gint gtk_text_backward_delete (GtkText *@var{text}, guint @var{nchars})
-@end deftypefun
-
-
-@gtkstdmacros{Text, TEXT}
-
-
-@page
-@node GtkToggleButton, GtkToolbar, GtkText, Widgets
-@comment node-name, next, previous, up
-@section The toggle button widget
-
-
-@subsection Description
-
-@subsection Options
-
-@defopt state
-@end defopt
-
-@subsection Signals
-
-@deftypefn Signal void GtkToggleButton::toggled (GtkToggleButton *@var{toggle_button})
-@end deftypefn
-
-@subsection Functions
-
-@deftypefun guint gtk_toggle_button_get_type (void)
-Returns the @code{GtkToggleButton} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_toggle_button_new (void)
-Create a new @code{GtkToggleButton} object returning the new widget as a
-pointer to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_toggle_button_new_with_label (gchar *@var{label})
-Create a new @code{GtkToggleButton} object initializing it with the values in
-@var{label}. The new widget is returned as a pointer to a @code{GtkWidget}
-object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_toggle_button_set_mode (GtkToggleButton *@var{toggle_button}, gint @var{draw_indicator})
-@end deftypefun
-
-@deftypefun void gtk_toggle_button_set_state (GtkToggleButton *@var{toggle_button}, gint @var{state})
-@end deftypefun
-
-@deftypefun void gtk_toggle_button_toggled (GtkToggleButton *@var{toggle_button})
-@end deftypefun
-
-@gtkstdmacros{ToggleButton, TOGGLE_BUTTON}
-
-
-@page
-@node GtkToolbar, GtkTooltips, GtkToggleButton, Widgets
-@comment node-name, next, previous, up
-@section The tool bar widget
-
-@subsection Description
-
-@subsection Options
-
-@defopt orientation
-@itemize @bullet
-@item GTK_ORIENTATION_HORIZONTAL
-
-@item GTK_ORIENTATION_VERTICAL
-@end itemize
-@end defopt
-
-@defopt style
-@itemize @bullet
-@item GTK_TOOLBAR_ICONS
-@item GTK_TOOLBAR_TEXT
-@item GTK_TOOLBAR_BOTH
-@end itemize
-@end defopt
-
-@defopt space_size
-@end defopt
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_toolbar_get_type (void)
-Returns the @code{GtkToolbar} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_toolbar_new (GtkOrientation @var{orientation}, GtkToolbarStyle @var{style})
-Create a new @code{GtkToolbar} object initializing it with the values
-@var{orientation} and @var{style}. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_toolbar_append_item (GtkToolbar *@var{toolbar}, char *@var{text}, char *@var{tooltip_text}, GtkPixmap *@var{icon}, GtkSignalFunc @var{callback}, gpointer @var{user_data})
-@end deftypefun
-
-@deftypefun void gtk_toolbar_prepend_item (GtkToolbar *@var{toolbar}, char *@var{text}, char *@var{tooltip_text}, GtkPixmap *@var{icon}, GtkSignalFunc @var{callback}, gpointer @var{user_data})
-@end deftypefun
-
-@deftypefun void gtk_toolbar_insert_item (GtkToolbar *@var{toolbar}, char *@var{text}, char *@var{tooltip_text}, GtkPixmap *@var{icon}, GtkSignalFunc @var{callback}, gpointer @var{user_data}, gint @var{position})
-@end deftypefun
-
-@deftypefun void gtk_toolbar_append_space (GtkToolbar *@var{toolbar})
-@end deftypefun
-
-@deftypefun void gtk_toolbar_prepend_space (GtkToolbar *@var{toolbar})
-@end deftypefun
-
-@deftypefun void gtk_toolbar_insert_space (GtkToolbar *@var{toolbar}, gint @var{position})
-@end deftypefun
-
-@deftypefun void gtk_toolbar_set_orientation (GtkToolbar *@var{toolbar}, GtkOrientation @var{orientation})
-@end deftypefun
-
-@deftypefun void gtk_toolbar_set_style (GtkToolbar *@var{toolbar}, GtkToolbarStyle @var{style})
-Set the @var{style} of the @var{toolbar} to @var{style}.
-@end deftypefun
-
-@deftypefun void gtk_toolbar_set_space_size (GtkToolbar *@var{toolbar}, gint @var{space_size})
-@end deftypefun
-
-@deftypefun void gtk_toolbar_set_tooltips (GtkToolbar *@var{toolbar}, gint @var{enable})
-@end deftypefun
-
-
-@gtkstdmacros{Toolbar, TOOLBAR}
-
-
-@page
-@node GtkTooltips, GtkTree, GtkToolbar, Widgets
-@comment node-name, next, previous, up
-@section The tool tips widget
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun GtkTooltips* gtk_tooltips_new (void)
-Create a new @code{GtkTooltips} object returning the new widget as a
-pointer to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun GtkTooltips* gtk_tooltips_ref (GtkTooltips *@var{tooltips})
-@end deftypefun
-
-@deftypefun void gtk_tooltips_unref (GtkTooltips *@var{tooltips})
-@end deftypefun
-
-@deftypefun void gtk_tooltips_free_string (gpointer @var{data}, gpointer @var{user_data})
-@end deftypefun
-
-@deftypefun void gtk_tooltips_enable (GtkTooltips *@var{tooltips})
-@end deftypefun
-
-@deftypefun void gtk_tooltips_disable (GtkTooltips *@var{tooltips})
-@end deftypefun
-
-@deftypefun void gtk_tooltips_set_delay (GtkTooltips *@var{tooltips}, GtkWidget *@var{widget}, gchar *@var{tips_text})
-@end deftypefun
-
-@deftypefun void gtk_tooltips_set_colors (GtkTooltips *@var{tooltips}, GdkColor *@var{background}, GdkColor *@var{foreground})
-@end deftypefun
-
-
-@gtkstdmacros{Tooltips, TOOLTIPS}
-
-
-@page
-@node GtkTree, GtkTreeItem, GtkTooltips, Widgets
-@comment node-name, next, previous, up
-@section The tree widget
-
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_tree_get_type (void)
-Returns the @code{GtkTree} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_tree_new (void)
-Create a new @code{GtkTree} object returning the new widget as a pointer to
-a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_tree_append (GtkTree *@var{tree}, GtkWidget *@var{child})
-@end deftypefun
-
-@deftypefun void gtk_tree_prepend (GtkTree *@var{tree}, GtkWidget *@var{child})
-@end deftypefun
-
-@deftypefun void gtk_tree_insert (GtkTree *@var{tree}, GtkWidget *@var{child}, gint @var{position})
-@end deftypefun
-
-@deftypefun gint gtk_tree_child_position (GtkTree *@var{tree}, GtkWidget *@var{child})
-@end deftypefun
-
-@deftypefun void gtk_tree_clear_items (GtkTree *@var{tree}, gint @var{start}, gint @var{end})
-@end deftypefun
-
-@deftypefun void gtk_tree_remove_items (GtkTree *@var{tree}, GList *@var{items})
-@end deftypefun
-
-@deftypefun void gtk_tree_select_child (GtkTree *@var{tree}, GtkWidget *@var{child})
-@end deftypefun
-
-@deftypefun void gtk_tree_select_item (GtkTree *@var{tree}, gint @var{item})
-@end deftypefun
-
-@deftypefun void gtk_tree_unselect_child (GtkTree *@var{tree}, GtkWidget *@var{child})
-@end deftypefun
-
-@deftypefun void gtk_tree_unselect_item (GtkTree *@var{tree}, gint @var{item})
-@end deftypefun
-
-@deftypefun void gtk_tree_set_selection_mode (GtkTree *@var{tree}, GtkSelectionMode @var{mode})
-@end deftypefun
-
-@deftypefun void gtk_tree_set_view_mode (GtkTree *@var{tree}, GtkTreeViewMode @var{mode})
-@end deftypefun
-
-@deftypefun void gtk_tree_set_view_lines (GtkTree *@var{tree}, guint @var{flag})
-@end deftypefun
-
-
-@gtkstdmacros{Tree, TREE}
-
-
-@page
-@node GtkTreeItem, GtkVBox, GtkTree, Widgets
-@comment node-name, next, previous, up
-@section The tree item widget
-
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_tree_item_get_type (void)
-Returns the @code{GtkTreeItem} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_tree_item_new (void)
-Create a new @code{GtkTreeItem} object returning the new widget as a
-pointer to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_tree_item_new_with_label (gchar *@var{label})
-Create a new @code{GtkTreeItem} object initializing it with the values in
-@var{label}. The new widget is returned as a pointer to a @code{GtkWidget}
-object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_tree_item_set_subtree (GtkTreeItem *@var{tree_item}, GtkWidget *@var{subtree})
-@end deftypefun
-
-@deftypefun void gtk_tree_item_select (GtkTreeItem *@var{tree_item})
-@end deftypefun
-
-@deftypefun void gtk_tree_item_deselect (GtkTreeItem *@var{tree_item})
-@end deftypefun
-
-@deftypefun void gtk_tree_item_expand (GtkTreeItem *@var{tree_item})
-@end deftypefun
-
-@deftypefun void gtk_tree_item_collapse (GtkTreeItem *@var{tree_item})
-@end deftypefun
-
-@deftypefun void gtk_tree_item_remove_subtree (GtkTreeItem *@var{item})
-@end deftypefun
-
-
-@gtkstdmacros{TreeItem, TREE_ITEM}
-
-@page
-@node GtkVBox, GtkVButtonBox, GtkTreeItem, Widgets
-@comment node-name, next, previous, up
-@section The vertical box widget
-
-
-@subsection Description
-
-@subsection Options
-
-@defopt homogeneous
-This option controls whether each object in the box has the same size. In the
-case of the @code{GtkVBox}, this refers to the height. If this option is set
-then the @var{expand} option to the @code{gtk_box_pack} (@pxref{GtkBox})
-routines is always turned on.
-@end defopt
-
-@defopt spacing
-This option sets the amount of space that is added between the objects packed
-into this @code{GtkVBox} object.
-@end defopt
-
-
-@subsection Signals
-This widget does not define any new signals.
-
-@subsection Functions
-
-@deftypefun guint gtk_vbox_get_type (void)
-Returns the @code{GtkVBox} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_vbox_new (gint @var{homogeneous}, gint @var{spacing})
-Create a new @code{GtkVBox} object initializing it with the values in
-@var{homogeneous} and @var{spacing}. The new widget is returned as a
-pointer to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@gtkstdmacros{VBox, VBOX}
-
-@page
-@node GtkVButtonBox, GtkViewport, GtkVBox, Widgets
-@comment node-name, next, previous, up
-@section The vertical button box widget
-
-
-@subsection Description
-
-@subsection Options
-@defopt spacing
-@end defopt
-
-@defopt layout
-@end defopt
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_vbutton_box_get_type (void)
-Returns the @code{GtkVButtonBox} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_vbutton_box_new (void)
-Create a new @code{GtkVButtonBox} object returning the new widget as a
-pointer to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@deftypefun void gtk_vbutton_box_set_spacing_default (gint @var{spacing})
-@end deftypefun
-
-@deftypefun void gtk_vbutton_box_set_layout_default (gint @var{layout})
-@end deftypefun
-
-@deftypefun gint gtk_vbutton_box_get_spacing_default (void)
-@end deftypefun
-
-@deftypefun gint gtk_vbutton_box_get_layout_default (void)
-@end deftypefun
-
-@gtkstdmacros{VButtonBox, VBUTTON_BOX}
-
-
-@page
-@node GtkViewport, GtkVPaned, GtkVButtonBox, Widgets
-@comment node-name, next, previous, up
-@section The viewport widget
-
-
-@subsection Description
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_viewport_get_type (void)
-Returns the @code{GtkViewport} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_viewport_new (GtkAdjustment *@var{hadjustment}, GtkAdjustment *@var{vadjustment})
-@end deftypefun
-
-@deftypefun GtkAdjustment* gtk_viewport_get_hadjustment (GtkViewport *@var{viewport})
-@end deftypefun
-
-@deftypefun GtkAdjustment* gtk_viewport_get_vadjustment (GtkViewport *@var{viewport})
-@end deftypefun
-
-@deftypefun void gtk_viewport_set_hadjustment (GtkViewport *@var{viewport}, GtkAdjustment *@var{adjustment})
-@end deftypefun
-
-@deftypefun void gtk_viewport_set_vadjustment (GtkViewport *@var{viewport}, GtkAdjustment *@var{adjustment})
-@end deftypefun
-
-@deftypefun void gtk_viewport_set_shadow_type (GtkViewport *@var{viewport}, GtkShadowType @var{type})
-@end deftypefun
-
-@gtkstdmacros{Viewport, VIEWPORT}
-
-@page
-@node GtkVPaned, GtkVRuler, GtkViewport, Widgets
-@comment node-name, next, previous, up
-@section The vertical paned widget
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_vpaned_get_type (void)
-Returns the @code{GtkVPaned} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_vpaned_new (void)
-Create a new @code{GtkVPaned} object returning the new widget as a pointer
-to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@gtkstdmacros{VPaned, VPANED}
-
-@page
-@node GtkVRuler, GtkVScale, GtkVPaned, Widgets
-@comment node-name, next, previous, up
-@section The vertical ruler widget
-
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_vruler_get_type (void)
-Returns the @code{GtkVRuler} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_vruler_new (void)
-Create a new @code{GtkVRuler} object returning the new widget as a pointer to
-a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@gtkstdmacros{VRuler, VRULER}
-
-
-@page
-@node GtkVScale, GtkVScrollbar, GtkVRuler, Widgets
-@comment node-name, next, previous, up
-@section The vertical ruler widget
-
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_vscale_get_type (void)
-Returns the @code{GtkVScale} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_vscale_new (GtkAdjustment *@var{adjustment})
-Create a new @code{GtkVScale} object returning the new widget as a pointer
-to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@gtkstdmacros{VScale, VSCALE}
-
-
-@page
-@node GtkVScrollbar, GtkVSeparator, GtkVScale, Widgets
-@comment node-name, next, previous, up
-@section The vertical scrollbar widget
-
-
-@subsection Description
-
-@subsection Options
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_vscrollbar_get_type (void)
-Returns the @code{GtkVScrollbar} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_vscrollbar_new (GtkAdjustment *@var{adjustment})
-Create a new @code{GtkVScrollbar} object initializing it with the values in
-@var{adjustment}. The new widget is returned as a pointer to a @code{GtkWidget}
-object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@gtkstdmacros{VScrollbar, VSCROLLBAR}
-
-
-@page
-@node GtkVSeparator, GtkWidget, GtkVScrollbar, Widgets
-@comment node-name, next, previous, up
-@section The vertical separator widget
-
-
-@subsection Description
-
-@subsection Signals
-
-@subsection Functions
-
-@deftypefun guint gtk_vseparator_get_type (void)
-Returns the @code{GtkVSeparator} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_vseparator_new (void)
-Create a new @code{GtkVSeparator} object and return the new widget as a
-pointer to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-@end deftypefun
-
-@gtkstdmacros{VSeparator, VSEPARATOR}
-
-
-@page
-@node GtkWidget, GtkWindow, GtkVSeparator, Widgets
-@comment node-name, next, previous, up
-@section The base widget
-
-
-@subsection Description
-
-@subsection Signals
-
-@deftypefn Signal void GtkWidget::show (GtkWidget *@var{widget})
-@end deftypefn
-
-@deftypefn Signal void GtkWidget::hide (GtkWidget *@var{widget})
-@end deftypefn
-
-@deftypefn Signal void GtkWidget::map (GtkWidget *@var{widget})
-@end deftypefn
-
-@deftypefn Signal void GtkWidget::unmap (GtkWidget *@var{widget})
-@end deftypefn
-
-@deftypefn Signal void GtkWidget::realize (GtkWidget *@var{widget})
-@end deftypefn
-
-@deftypefn Signal void GtkWidget::unrealize (GtkWidget *@var{widget})
-@end deftypefn
-
-@deftypefn Signal void GtkWidget::draw (GtkWidget *@var{widget}, GdkRectangle *@var{area})
-@end deftypefn
-
-@deftypefn Signal void GtkWidget::draw_focus (GtkWidget *@var{widget})
-@end deftypefn
-
-@deftypefn Signal void GtkWidget::draw_default (GtkWidget *@var{widget})
-@end deftypefn
-
-@deftypefn Signal void GtkWidget::size_request (GtkWidget *@var{widget}, GtkRequisition *@var{requisition})
-@end deftypefn
-
-@deftypefn Signal void GtkWidget::size_allocate (GtkWidget *@var{widget}, GtkAllocation *@var{allocation})
-@end deftypefn
-
-@deftypefn Signal void GtkWidget::state_changed (GtkWidget *@var{widget})
-@end deftypefn
-
-@deftypefn Signal gint GtkWidget::install_accelerator (GtkWidget *@var{widget}, gchar *@var{signal_name}, gchar @var{key}, guint8 @var{modifiers})
-@end deftypefn
-
-@deftypefn Signal void GtkWidget::remove_accelerator (GtkWidget *@var{widget}, gchar *@var{signal_name})
-@end deftypefn
-
-@deftypefn Signal gint GtkWidget::event (GtkWidget *@var{widget}, GdkEvent *@var{event})
-@end deftypefn
-
-@deftypefn Signal gint GtkWidget::button_press_event (GtkWidget *@var{widget}, GdkEventButton *@var{event})
-@end deftypefn
-
-@deftypefn Signal gint GtkWidget::button_release_event (GtkWidget *@var{widget}, GdkEventButton *@var{event})
-@end deftypefn
-
-@deftypefn Signal gint GtkWidget::motion_notify_event (GtkWidget *@var{widget}, GdkEventMotion *@var{event})
-@end deftypefn
-
-@deftypefn Signal gint GtkWidget::delete_event (GtkWidget *@var{widget}, GdkEventAny *@var{event})
-@end deftypefn
-
-@deftypefn Signal gint GtkWidget::destroy_event (GtkWidget *@var{widget}, GdkEventAny *@var{event})
-@end deftypefn
-
-@deftypefn Signal gint GtkWidget::expose_event (GtkWidget *@var{widget}, GdkEventExpose *@var{event})
-@end deftypefn
-
-@deftypefn Signal gint GtkWidget::key_press_event (GtkWidget *@var{widget}, GdkEventKey *@var{event})
-@end deftypefn
-
-@deftypefn Signal gint GtkWidget::key_release_event (GtkWidget *@var{widget}, GdkEventKey *@var{event})
-@end deftypefn
-
-@deftypefn Signal gint GtkWidget::enter_notify_event (GtkWidget *@var{widget}, GdkEventCrossing *@var{event})
-@end deftypefn
-
-@deftypefn Signal gint GtkWidget::leave_notify_event (GtkWidget *@var{widget}, GdkEventCrossing *@var{event})
-@end deftypefn
-
-@deftypefn Signal gint GtkWidget::configure_event (GtkWidget *@var{widget}, GdkEventConfigure *@var{event})
-@end deftypefn
-
-@deftypefn Signal gint GtkWidget::focus_in_event (GtkWidget *@var{widget}, GdkEventFocus *@var{event})
-@end deftypefn
-
-@deftypefn Signal gint GtkWidget::focus_out_event (GtkWidget *@var{widget}, GdkEventFocus *@var{event})
-@end deftypefn
-
-@deftypefn Signal gint GtkWidget::map_event (GtkWidget *@var{widget}, GdkEventAny *@var{event})
-@end deftypefn
-
-@deftypefn Signal gint GtkWidget::unmap_event (GtkWidget *@var{widget}, GdkEventAny *@var{event})
-@end deftypefn
-
-@deftypefn Signal gint GtkWidget::property_notify_event (GtkWidget *@var{widget}, GdkEventProperty *@var{event})
-@end deftypefn
-
-@deftypefn Signal gint GtkWidget::selection_clear_event (GtkWidget *@var{widget}, GdkEventSelection *@var{event})
-@end deftypefn
-
-@deftypefn Signal gint GtkWidget::selection_request_event (GtkWidget *@var{widget}, GdkEventSelection *@var{event})
-@end deftypefn
-
-@deftypefn Signal gint GtkWidget::selection_notify_event (GtkWidget *@var{widget}, GdkEventSelection *@var{event})
-@end deftypefn
-
-@deftypefn Signal gint GtkWidget::drop_event (GtkWidget *@var{widget}, GdkEventDrop *@var{event})
-@end deftypefn
-
-@deftypefn Signal gint GtkWidget::drag_begin_event (GtkWidget *@var{widget}, GdkEventDragBegin *@var{event})
-@end deftypefn
-
-@deftypefn Signal gint GtkWidget::other_event (GtkWidget *@var{widget}, GdkEventOther *@var{event})
-@end deftypefn
-
-@subsection Functions
-
-@deftypefun guint gtk_widget_get_type (void)
-Returns the @code{GtkWidget} type identifier.
-@end deftypefun
-
-@deftypefun void gtk_widget_class_init (GtkWidgetClass *@var{class})
-@end deftypefun
-
-@deftypefun void gtk_widget_init (GtkWidget *@var{widget})
-@end deftypefun
-
-@deftypefun void gtk_widget_destroy (GtkWidget *@var{widget})
-@end deftypefun
-
-@deftypefun void gtk_widget_show (GtkWidget *@var{widget})
-@end deftypefun
-
-@deftypefun void gtk_widget_hide (GtkWidget *@var{widget})
-@end deftypefun
-
-@deftypefun void gtk_widget_map (GtkWidget *@var{widget})
-@end deftypefun
-
-@deftypefun void gtk_widget_unmap (GtkWidget *@var{widget})
-@end deftypefun
-
-@deftypefun void gtk_widget_realize (GtkWidget *@var{widget})
-@end deftypefun
-
-@deftypefun void gtk_widget_unrealize (GtkWidget *@var{widget})
-@end deftypefun
-
-@deftypefun void gtk_widget_draw (GtkWidget *@var{widget}, GdkRectangle *@var{area})
-@end deftypefun
-
-@deftypefun void gtk_widget_draw_focus (GtkWidget *@var{widget})
-@end deftypefun
-
-@deftypefun void gtk_widget_draw_children (GtkWidget *@var{widget})
-@end deftypefun
-
-@deftypefun void gtk_widget_size_request (GtkWidget *@var{widget}, GtkRequisition *@var{requisition})
-@end deftypefun
-
-@deftypefun void gtk_widget_size_allocate (GtkWidget *@var{widget}, GtkAllocation *@var{allocation})
-@end deftypefun
-
-@deftypefun void gtk_widget_install_accelerator (GtkWidget *@var{widget}, GtkAcceleratorTable *@var{table}, gchar *@var{signal_name}, gchar @var{key}, guint8 @var{modifiers})
-@end deftypefun
-
-@deftypefun void gtk_widget_remove_accelerator (GtkWidget *@var{widget}, GtkAcceleratorTable *@var{table}, gchar *@var{signal_name})
-@end deftypefun
-
-@deftypefun gint gtk_widget_event (GtkWidget *@var{widget}, GdkEvent *@var{event})
-@end deftypefun
-
-@deftypefun void gtk_widget_reparent (GtkWidget *@var{widget}, GtkWidget *@var{new_parent})
-@end deftypefun
-
-@deftypefun void gtk_widget_popup (GtkWidget *@var{widget}, gint @var{x}, gint @var{y})
-@end deftypefun
-
-@deftypefun gint gtk_widget_intersect (GtkWidget *@var{widget}, GdkRectangle *@var{area}, GdkRectangle *@var{intersection})
-@end deftypefun
-
-@deftypefun void gtk_widget_grab_focus (GtkWidget *@var{widget})
-@end deftypefun
-
-@deftypefun void gtk_widget_grab_default (GtkWidget *@var{widget})
-@end deftypefun
-
-@deftypefun void gtk_widget_restore_state (GtkWidget *@var{widget})
-@end deftypefun
-
-@deftypefun void gtk_widget_set_name (GtkWidget *@var{widget}, gchar *@var{name})
-@end deftypefun
-
-@deftypefun void gtk_widget_set_state (GtkWidget *@var{widget}, GtkStateType @var{state})
-@end deftypefun
-
-@deftypefun void gtk_widget_set_sensitive (GtkWidget *@var{widget}, gint sensitive)
-@end deftypefun
-
-@deftypefun void gtk_widget_set_parent (GtkWidget *@var{widget}, GtkWidget *@var{parent})
-@end deftypefun
-
-@deftypefun void gtk_widget_set_style (GtkWidget *@var{widget}, GtkStyle *@var{style})
-@end deftypefun
-
-@deftypefun void gtk_widget_set_uposition (GtkWidget *@var{widget}, gint @var{x}, gint @var{y})
-@end deftypefun
-
-@deftypefun void gtk_widget_set_usize (GtkWidget *@var{widget}, gint @var{width}, gint @var{height})
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_widget_get_toplevel (GtkWidget *@var{widget})
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_widget_get_ancestor (GtkWidget *@var{widget}, gint @var{type})
-@end deftypefun
-
-@deftypefun GdkColormap* gtk_widget_get_colormap (GtkWidget *@var{widget})
-@end deftypefun
-
-@deftypefun GdkVisual* gtk_widget_get_visual (GtkWidget *@var{visual})
-@end deftypefun
-
-@deftypefun GtkStyle* gtk_widget_get_style (GtkWidget *@var{style})
-@end deftypefun
-
-@gtkstdmacros{Widget, WIDGET}
-
-
-@page
-@node GtkWindow, , GtkWidget, Widgets
-@comment node-name, next, previous, up
-@section The window widget
-
-
-@subsection Description
-
-@subsection Options
-
-@defopt type
-The @var{type} options specify how this widget will interact with the
-window manager. Currently the following types and the effect they have
-on the window to window manager interaction is as follows.
-@itemize @bullet
-
-@item
-@code{GTK_WINDOW_TOPLEVEL}
-@itemize @bullet
-@item
-The option @code{GTK_WINDOW_TOPLEVEL} is usually used for the main application
-window that will remain for the entire application run.
-@end itemize
-@item
-@code{GTK_WINDOW_DIALOG}
-@itemize @bullet
-@item
-The option @code{GTK_WINDOW_DIALOG} is usually used for transient
-windows. These windows will open up, gather some input or provide some
-application specific updates, then close. The window manager is free not
-to provide all the 'normal' window functions to this window.
-@end itemize
-@item
-@code{GTK_WINDOW_POPUP}
-@itemize @bullet
-@item
-The option @code{GTK_WINDOW_POPUP} is usually used for transient windows.
-These windows are typically used for when no user interaction is required,
-to notify the user of some condition. Other uses for these types of windows
-are for 'about windows', startup windows and the like. Typically the window
-manager will @strong{not} provide the usual widgets that surround the
-window. At the most all that will be provided is a border. Also note that
-windows that set this @var{type} will not be in any window list of the window
-manager. Though this window will @strong{not} get the kill and close widgets
-of the window manager they still can receive said events and should be
-taken into account.
-@end itemize
-@end itemize
-@end defopt
-
-@defopt title
-The @var{title} option will set the title of the window in the window manager.
-@strong{Note:} On windows that have the @var{type} option set to
-@code{GTK_WINDOW_POPUP} there is a strong possibility that this will text
-will not be seen.
-@end defopt
-
-@defopt position
-The @var{position} option will determine where the window will be displayed
-when it is finally drawn to the screen. Currently the following positions
- and the effect they have on window placement can be specified.
-
-@itemize @bullet
-
-@item
-@code{GTK_WIN_POS_NONE}
-@itemize @bullet
-@item
-This @var{position} type will allow the window manager full freedom, depending
-on the current settings in the window manager. As to where the window will
-be placed.
-@end itemize
-@item
-@code{GTK_WIN_POS_CENTER}
-@itemize @bullet
-@item
-This @var{position} option will cause the window to center itself on the
-the screen. This option setting will take into account the @var{virtual screen}
-size when calculating the center. This is @strong{not} the same as the
-@var{virtual desktop} setting of many window managers. It will center itself
-on the current @var{virtual desktop}.
-@end itemize
-@item
-@code{GTK_WIN_POS_MOUSE}
-@itemize @bullet
-This @var{position} option will cause the window to center itself under the
-mouse pointers' current location. Typical uses for this setting is in
-warning/error/informational dialogs where user interaction is desired.
-@end itemize
-@end itemize
-@end defopt
-
-
-@subsection Signals
-
-@deftypefn Signal void GtkWindow::move_resize (GtkWindow *@var{window}, gint *@var{x}, gint *@var{y}, gint @var{width}, gint @var{height})
-@end deftypefn
-
-@deftypefn Signal void GtkWindow::set_focus (GtkWindow *@var{window}, GtkWidget *@var{focus})
-@end deftypefn
-
-@subsection Functions
-
-@deftypefun guint gtk_window_get_type (void)
-Returns the @code{GtkWindow} type identifier.
-@end deftypefun
-
-@deftypefun GtkWidget* gtk_window_new (GtkWindowType @var{type})
-Create a new @code{GtkWindow} object. The new widget is returned as a
-pointer to a @code{GtkWidget} object. @code{NULL} is returned on failure.
-The @var{type} can be one of @code{GTK_WINDOW_TOPLEVEL},
-@code{GTK_WINDOW_DIALOG} or, @code{GTK_WINDOW_POPUP}. The @var{type}
-value determines how this widget will interact with the window manager.
-@end deftypefun
-
-@deftypefun void gtk_window_set_title (GtkWindow *@var{window}, gchar *@var{title})
-Set the title of this window to the text in the @var{title} argument. It is
-important to not set the fields of the @code{GtkWindow} structure directly.
-@end deftypefun
-
-@deftypefun void gtk_window_set_focus (GtkWindow *@var{window}, GtkWidget *@var{focus})
-@end deftypefun
-
-@deftypefun void gtk_window_set_default (GtkWindow *@var{window}, GtkWidget *@var{defaultw})
-@end deftypefun
-
-@deftypefun void gtk_window_set_policy (GtkWindow *@var{window}, gint @var{allow_shrink}, gint @var{allow_grow}, gint @var{auto_shrink})
-@end deftypefun
-
-@deftypefun void gtk_window_add_accelerator_table (GtkWindow *@var{window}, GtkAcceleratorTable *@var{table})
-@end deftypefun
-
-@deftypefun void gtk_window_remove_accelerator_table (GtkWindow *@var{window}, GtkAcceleratorTable *@var{table})
-@end deftypefun
-
-@deftypefun void gtk_window_position (GtkWindow *@var{window}, GtkWindowPosition @var{position})
-Set the position that the window will be at when it is finally drawn to the
-screen. The @var{position} argument effects the the position as described
-above.
-@end deftypefun
-
-@gtkstdmacros{Window, WINDOW}
-
-
-@node Other Objects, Miscellaneous, Widgets, Top
-@comment node-name, next, previous, up
-@chapter Utility objects
-
-
-@menu
-* GtkAcceleratorTable:: The accelerator table object.
-* GtkAdjustment:: The adjustment object.
-* GtkGC:: The GC object.
-* GtkData:: The data object.
-* GtkStyle:: The style object.
-@end menu
-
-
-@node GtkAcceleratorTable, GtkAdjustment, Other Objects, Other Objects
-@comment node-name, next, previous, up
-@section The accelerator table object
-
-@subsection Description
-
-@subsection Functions
-
-@deftypefun GtkAcceleratorTable* gtk_accelerator_table_new (void)
-@end deftypefun
-
-@deftypefun GtkAcceleratorTable* gtk_accelerator_table_find (GtkObject *@var{object}, gchar *@var{signal_name}, guchar @var{accelerator_key}, guint8 @var{accelerator_mods})
-@end deftypefun
-
-@deftypefun GtkAccelerator *gtk_accelerator_table_ref (GtkAcceleratorTable *@var{table})
-@end deftypefun
-
-@deftypefun void gtk_accelerator_table_unref (GtkAcceleratorTable *@var{table})
-@end deftypefun
-
-@deftypefun void gtk_accelerator_table_install (GtkAcceleratorTable *@var{table}, GtkObject *@var{object}, gchar *@var{signal_name}, guchar @var{accelerator_key}, guint8 @var{accelerator_mods})
-@end deftypefun
-
-@deftypefun void gtk_accelerator_table_remove (GtkAcceleratorTable *@var{table}, GtkObject *@var{object}, gchar *@var{signal_name})
-@end deftypefun
-
-@deftypefun void gtk_accelerator_table_check (GtkAcceleratorTable *@var{table}, guchar @var{accelerator_key}, guint8 @var{accelerator_mods})
-@end deftypefun
-
-@deftypefun void gtk_accelerator_table_set_mod_mask (GtkAcceleratorTable *@var{table}, guint8 @var{modifier_mask})
-@end deftypefun
-
-@page
-@node GtkAdjustment, GtkGC, GtkAcceleratorTable, Other Objects
-@comment node-name, next, previous, up
-@section The adjustment object
-
-@subsection Description
-
-@subsection Functions
-
-@deftypefun guint gtk_adjustment_get_type (void)
-Returns the @code{GtkAdjustment} type identifier.
-@end deftypefun
-
-@deftypefun GtkObject* gtk_adjustment_new (gfloat @var{value}, gfloat @var{lower}, gfloat @var{upper}, gfloat @var{step_increment}, gfloat @var{page_increment}, gfloat @var{page_size})
-@end deftypefun
-
-@gtkstdmacros{GtkAdjustment, ADJUSTMENT}
-
-@page
-@node GtkGC, GtkData, GtkAdjustment, Other Objects
-@section The GC object
-
-@subsection Description
-
-@subsection Functions
-
-@deftypefun GdkGC* gtk_gc_get (gint @var{depth}, GdkColormap *@var{colormap}, GdkGCValues *@var{values}, GdkGCValuesMask @var{values_mask})
-@end deftypefun
-
-@deftypefun void gtk_gc_release (GdkGC *@var{gc})
-@end deftypefun
-
-@page
-@node GtkData, GtkStyle, GtkGC, Other Objects
-@comment node-name, next, previous, up
-@section The data object
-
-@subsection Description
-
-@subsection Functions
-
-@deftypefun guint gtk_data_get_type (void)
-Returns the @code{GtkData} type identifier.
-@end deftypefun
-
-@gtkstdmacros{Data, DATA}
-@page
-@node GtkStyle, ,GtkData, Other Objects
-@section The style object
-
-@subsection Description
-
-@subsection Functions
-
-@page
-@node Miscellaneous, Examples, Other Objects, Top
-@comment node-name, next, previous, up
-@chapter Initialization, exit and other features
-
-
-@menu
-* Initialization and exit:: Initializing and exiting GTK.
-* Customization:: Customizing the library.
-* Menu Factories:: Simplified menu creation.
-* Tree Factories:: Simplified tree creation.
-* Tool Tips:: Pop up help mechanism.
-* Resource Files:: Resource files.
-* Standard Macros:: Macros defined by all objects.
-@end menu
-
-
-@node Initialization and exit, Customization, Miscellaneous, Miscellaneous
-@comment node-name, next, previous, up
-@section Initializing and exiting GTK
-
-@subsection Initializing
-Before any GTK functions can be utilized the library must be initialized. This
-can be accomplished by calling the @code{gtk_init} function. The arguments
-you pass to this function should be the same arguments that were passed to
-your application. This function will parse the arguments that it understands
-and handle initializing the GDK library for you.
-
-@subsection Exiting
-
-@subsection Functions
-
-@deftypefun void gtk_init (int *@var{argc}, char **@var{argv})
-Function to initialize GTK and GDK for you. This function will remove any
-command line arguments from @var{argc} and @var{argv} that it understands.
-
-@example
-int main (int argc, char *argv[])
-@{
- @dots{Any local variables or non GTK/GDK initialization}
-
- /* Initialize GTK. */
- gtk_init(&argc, &argc);
-
-@}
-@end example
-@end deftypefun
-
-@deftypefun void gtk_exit (int @var{error_code})
-Exit GTK and perform any necessary cleanup. @code{gtk_exit} will call the
-systems @code{exit} function passing @var{error_code} as the parameter.
-@end deftypefun
-
-@deftypefun gint gtk_events_pending (void)
-Returns the number of events pending on the event queue.
-@end deftypefun
-
-@deftypefun void gtk_main (void)
-@end deftypefun
-
-@deftypefun guint gtk_main_level (void)
-@end deftypefun
-
-@deftypefun void gtk_main_quit (void)
-A call to this function will cause the @code{gtk_main} function to exit,
-thereby allowing your application to exit.
-@end deftypefun
-
-@page
-@node Customization, Menu Factories, Initialization and exit, Miscellaneous
-@comment node-name, next, previous, up
-@section Customization of the library
-
-@subsection Description
-Like other X-windows applications the GTK library provides a way for the
-user and application programmer to change the colors of just about any widget.
-You can also specify what pixmap should be tiled onto the background of some
-widgets. All this is handled through a similar method as in the standard
-X-windows environment, through the use of 'rc' files. The format and
-functions available in these files is discussed below.
-
-@subsection Functions
-The following functions are available to handle the rc files.
-
-@deftypefun void gtk_rc_parse (char *@var{filename})
-This function will parse the @var{filename} that is passed to it as its
-argument. It will use the style settings for the widget types defined there.
-@end deftypefun
-
-@deftypefun void gtk_rc_init (void)
-This function will initialize the rc file parser, normally this need not
-be called directly as the @code{gtk_rc_parse} function will handle this for
-you.
-@end deftypefun
-
-@page
-@node Menu Factories, Tree Factories, Customization, Miscellaneous
-@comment node-name, next, previous, up
-@section Simplified menu creation
-
-@page
-@node Tree Factories, Tool Tips, Menu Factories, Miscellaneous
-@comment node-name, next, previous, up
-@section Simplified tree creation
-
-@page
-@node Tool Tips, Resource Files, Tree Factories, Miscellaneous
-@comment node-name, next, previous, up
-@section Pop up help mechanism
-
-@subsection Description
-
-@page
-@node Resource Files, Standard Macros, Tool Tips, Miscellaneous
-@comment node-name, next, previous, up
-@section Resource Files
-
-@page
-@node Standard Macros, , Resource Files, Miscellaneous
-@comment node-name, next, previous, up
-@section Macros defined by all objects
-
-There are three macros that are defined by all object types. The first
-two are used for performing casts and the last is for querying whether
-an object is of a particular type. These macros are both conveniences
-and debugging tools. If the GTK library was compiled with @code{NDEBUG}
-defined as a preprocessor symbol (via the -DNDEBUG to cc), then the
-macros check the object type and emit a warning if the cast is
-invalid. Doing such checking is fairly expensive since the cast macros
-are used everywhere in GTK and would normally be turned off in a public
-release of a product. Note: The functions below are indeed macros, but
-they may be considered functions for most purposes.
-
-@deftypefun Gtk<ObjectType>* GTK_<OBJECT_TYPE> (gpointer @var{obj})
-Cast a generic pointer to @code{Gtk<ObjectType>*}. This function is
-provided in order to be able to provide checking during development
-stages of code development since it is possible to examine the actual
-type of object (using @code{gtk_type_is_a}) before performing the cast.
-@end deftypefun
-
-@deftypefun Gtk<ObjectType>Class* GTK_<OBJECT_TYPE>_CLASS (gpointer @var{class})
-Cast a generic pointer to @code{Gtk<ObjectType>Class*}. Like
-@code{GTK_<ObjectType>}, this function is, in reality, a macro.
-@end deftypefun
-
-@deftypefun gint GTK_IS_<ObjectType> (gpointer @var{obj})
-Determine if a generic pointer refers to a @code{Gtk<ObjectType>}
-object. This function is, in reality, a macro wrapper around the
-@code{gtk_type_is_a} function (@pxref{Objects}).
-@end deftypefun
-
-
-@node Examples, Object Implementation, Miscellaneous, Top
-@comment node-name, next, previous, up
-@chapter Using GTK
-@cindex Using GTK
-
-@menu
-* Simple:: The simplest GTK program.
-* Hello World:: Hello world in GTK.
-* Hello World II:: An enhanced hello world.
-* Hello World III:: Making Hello World II robust.
-@end menu
-
-
-@node Simple, Hello World, Examples, Examples
-@comment node-name, next, previous, up
-@section The simplest GTK program
-
-
-The 16 line GTK program shown below is just about the simplest possible
-program which uses GTK. (Well, technically, you don't have to create the
-window and it would still be a program which uses GTK). The program,
-when compiled and run, will create a single window 200x200 pixels in
-size. The program does not exit until its is explicitly killed using the
-shell or a window manager function.
-
-@example
-#include <gtk/gtk.h>
-
-int
-main (int argc, char *argv[])
-@{
- GtkWidget *window;
-
- gtk_init (&argc, &argv);
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_widget_show (window);
-
- gtk_main ();
-
- return 0;
-@}
-@end example
-
-The first point of interest in this program is the standard
-initialization line.
-
-@example
- gtk_init (&argc, &argv);
-@end example
-
-Almost every GTK program will contain such a line. GTK will initialize
-itself and GDK and remove any command line arguments it recognizes from
-@var{argc} and @var{argv}.
-
-The next two lines of code create and display a window.
-
-@example
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_widget_show (window);
-@end example
-
-The @code{GTK_WINDOW_TOPLEVEL} argument specifies that we want the
-window to undergo window manager decoration and placement. One might be
-lead to think that the window, since it has no children, would be 0x0
-pixels in size. But, this is not the case because a window that has no
-children defaults to 200x200 pixels in size. Mainly because 0x0 windows
-are annoying to manipulate or even see in some cases.
-
-The last line enters the GTK main processing loop.
-
-@example
- gtk_main ();
-@end example
-
-Normally, @code{gtk_main} is called once and the program should exit
-when it returns. @xref{Initialization and exit}.
-
-
-@node Hello World, Hello World II, Simple, Examples
-@comment node-name, next, previous, up
-@section Hello world in GTK
-
-
-@example
-#include <gtk/gtk.h>
-
-int
-main (int argc, char *argv[])
-@{
- GtkWidget *window;
- GtkWidget *label;
-
- gtk_init (&argc, &argv);
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_container_border_width (GTK_CONTAINER (window), 10);
-
- label = gtk_label_new ("Hello World");
- gtk_container_add (GTK_CONTAINER (window), label);
- gtk_widget_show (label);
-
- gtk_widget_show (window);
-
- gtk_main ();
-
- return 0;
-@}
-@end example
-
-
-@node Hello World II, Hello World III, Hello World, Examples
-@comment node-name, next, previous, up
-@section An enhanced hello world
-
-
-@example
-#include "gtk.h"
-
-void
-hello (void)
-@{
- g_print ("Hello World\n");
- gtk_exit (0);
-@}
-
-int
-main (int argc, char *argv[])
-@{
- GtkWidget *window;
- GtkWidget *button;
-
- gtk_init (&argc, &argv);
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_container_border_width (GTK_CONTAINER (window), 10);
-
- button = gtk_button_new_with_label ("Hello World");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (hello), NULL);
- gtk_container_add (GTK_CONTAINER (window), button);
- gtk_widget_show (button);
-
- gtk_widget_show (window);
-
- gtk_main ();
-
- return 0;
-@}
-@end example
-
-
-@node Hello World III, , Hello World II, Examples
-@comment node-name, next, previous, up
-@section Making Hello World II robust
-
-
-@example
-#include "gtk.h"
-
-void
-hello (void)
-@{
- g_print ("Hello World\n");
- gtk_exit (0);
-@}
-
-void
-destroy (void)
-@{
- gtk_exit (0);
-@}
-
-int
-main (int argc, char *argv[])
-@{
- GtkWidget *window;
- GtkWidget *button;
-
- gtk_init (&argc, &argv);
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (destroy), NULL);
- gtk_container_border_width (GTK_CONTAINER (window), 10);
-
- button = gtk_button_new_with_label ("Hello World");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (hello), NULL);
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_container_add (GTK_CONTAINER (window), button);
- gtk_widget_show (button);
-
- gtk_widget_show (window);
-
- gtk_main ();
-
- return 0;
-@}
-@end example
-
-
-@node Object Implementation, Signal Implementation, Examples, Top
-@comment node-name, next, previous, up
-@chapter Object internals
-@cindex Object Implementation
-
-Objects (or the @code{GtkObject} type) and the class hierarchy in
-general is implemented via a hierarchy of structs and type casting. Be
-aware that when classes are mentioned it is the conceptual idea of
-classes that is being referred to. GTK is written entirely in C which
-provides no direct support for classes.
-
-The first part to the class mechanism is the object fields. These are
-fields that will be used on a per object basis. For example, the widget
-type contains a field for the widgets parent. Every derived type needs a
-reference to its parent type. A descendant class of @code{GtkObject}
-would define itself like:
-
-@example
-struct Descendant
-@{
- GtkObject object;
-
- @dots{}
-@};
-@end example
-
-It is important to note that the @code{GtkObject} field needs to appear
-first in the descendant type structure. This allows pointers to objects
-of type @code{Descendant} to be cast to pointers to @code{GtkObject}'s
-and vice-versa.
-
-The second part to the class mechanism is the class fields. These fields
-are defined on a per class basis. In the case of widgets, the class
-fields are all the ``virtual'' functions for widgets. The
-@code{GtkObject} class defines the @code{destroy} virtual function and
-the necessary fields for the signal mechanism as well as a field for
-determining the runtime type of an object. A virtual function is
-semantically the same as it is in C++. That is, the actual function that
-is called is determined based on the type of the object. Or, more
-specifically, the actual function call depends on the class structure
-that is pointed to by the @code{klass} field of the @code{GtkObject}
-structure.
-
-To see how the class fields work it is necessary to see the object
-fields for a @code{GtkObject}. The @code{GtkObject} type is defined as
-follows:
-
-@example
-typedef struct _GtkObject GtkObject;
-
-struct _GtkObject
-@{
- guint32 flags;
- GtkObjectClass *klass;
- gpointer object_data;
-@};
-@end example
-
-The @code{class} field actually points to a class structure derived from
-@code{GtkObjectClass}. By convention, each new type defines its own
-class structure even if it is unnecessary. As an example, the
-hypothetical @code{Descendant} class would define its class structure
-as:
-
-@example
-struct DescendantClass
-@{
- GtkObjectClass parent_class;
-
- @dots{}
-@};
-@end example
-
-It is convention to name the parent class field (@code{GtkObjectClass}
-in this case), @code{parent_class}. For the same reason as stated above
-for the object structure, the parent class field must be the first field
-in the class structure.
-
-@strong{Note:} GTK assumes that the first field in a structure will be
-placed by the compiler at the start of the structure. This is certainly
-true for gcc, however, from my precursory reading of the C standard I
-was unable to come to a definite conclusion as to whether this was
-required or simply done for simplicity. I'm not too worried about this
-assumption, though, as every C compiler I've ever encountered would work
-with GTK.
-
-The @code{flags} field of the @code{GtkObject} structure is used to keep
-track of a relatively few object flags and is also used by the
-@code{GtkWidget} type to store additional flags. At this time, the upper
-16 bits of the flags field are reserved but unused.
-
-The @code{object_data} field of the @code{GtkObject} structure is an
-opaque pointer used by the object data mechanism. In truth, it is a
-pointer to the beginning of the data list which is composed of the
-following structures.
-
-@example
-typedef struct _GtkObjectData GtkObjectData;
-
-struct _GtkObjectData
-@{
- guint id;
- gpointer data;
- GtkObjectData *next;
-@};
-@end example
-
-The data mechanism allows arbitrary data to be associated with a
-character string key in any object. A hash table is used to transform
-the character string key into the data id and then a search through the
-list is made to see if the data exists. The assumption being that the
-data list will usually be short and therefore a linear search is
-OK. Future work on the data mechanism might make use of a resizable
-array instead of a linked list. This would shrink the overhead of the
-@code{GtkObjectData} structure by 4 bytes on 32 bit architectures.
-
-
-@node Signal Implementation, Widget Implementation, Object Implementation, Top
-@comment node-name, next, previous, up
-@chapter Signal internals
-@cindex Signal Implementation
-
-
-@node Widget Implementation, Function Index, Signal Implementation, Top
-@comment node-name, next, previous, up
-@chapter Widget internals
-@cindex Widget Implementation
-
-
-@node Function Index, Concept Index, Widget Implementation, Top
-@comment node-name, next, previous, up
-@unnumbered Function Index
-
-@printindex fn
-
-
-@node Concept Index, , Function Index, Top
-@comment node-name, next, previous, up
-@unnumbered Concept Index
-
-@printindex cp
-
-
-@summarycontents
-@contents
-@bye
diff --git a/docs/gtkfaq.sgml b/docs/gtkfaq.sgml
deleted file mode 100644
index 5fc139cbd3..0000000000
--- a/docs/gtkfaq.sgml
+++ /dev/null
@@ -1,930 +0,0 @@
-<!doctype linuxdoc system>
-
-<article>
-
-<!-- Title information -->
-
-<title>GTK+ FAQ
-
-<!-- NOTE: Use only one author tag, otherwise sgml2txt barfs - TRG -->
-<author>Nathan Froyd, Tony Gale, Shawn T. Amundson.
-<date>March 9th 1998
-<abstract>
-This document is intended to answer questions that are likely to be
-frequently asked by programmers using GTK+ or people who are just
-looking at using GTK+.
-</abstract>
-
-<!-- Table of contents -->
-<toc>
-
-<!-- Begin the document -->
-
-<!-- ***************************************************************** -->
-<sect>General Information
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>Authors
-<p>
-The authors of GTK+ are:
-
-<itemize>
-<item>Peter Mattis (petm@xcf.berkeley.edu)
-<item>Spencer Kimball (spencer@xcf.berkeley.edu)
-<item>Josh MacDonald (jmacd@xcf.berkeley.edu)
-</itemize>
-GTK+ is distributed under the GNU Library General Public License
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>What is GTK+?
-<p>
-GTK+ is a small and efficient widget set designed with the general look
-and feel of Motif. In reality, it looks much better than Motif. It
-contains common widgets and some more complex widgets such as a file
-selection, and color selection widgets.
-
-GTK+ provides some unique features. (At least, I know of no other widget
-library which provides them). For
-example, a button does not contain a label, it contains a child widget,
-which in most instances will be a label.
-However, the child widget can also be a pixmap, image or any combination
-possible the programmer desires.
-This flexibility is adhered to throughout the library.
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>What is the + in GTK+?
-<P>
-Peter Mattis informed the gtk mailing list that:
-<quote>
-"I originally wrote gtk which included the three libraries, libglib,
-libgdk and libgtk. It featured a flat widget hierarchy. That is, you
-couldn't derive a new widget from an existing one. And it contained
-a more standard callback mechanism instead of the signal mechanism now
-present in gtk+. The + was added to distinguish between the original
-version of gtk and the new version. You can think of it as being an
-enhancement to the original gtk that adds object oriented features."
-</quote>
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>Does the G in GTK+ stand for General, Gimp, or GNU?
-<p>
-Peter Mattis informed the gtk mailing list that:
-<quote>
-"I think the last time Spencer and I talked about it we decided on
-GTK = Gimp ToolKit. But I don't know for sure. Its definately not
-GNU, though."
-</quote>
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>Where is the documentation for GTK+?
-<p>
-In the GTK+ distribution's doc/ directory you will find the
-reference material for both GTK and GDK, and this FAQ.
-
-There is also a GTK+ Tutorial which can be found at
-<htmlurl url="http://www.levien.com/~slow/gtk/"
-name="http://www.levien.com/~slow/gtk/">.
-
-The Tutorial and FAQ can also be found at
-<htmlurl url="http://www.geocities.com/ResearchTriangle/Lab/4299/"
-name="http://www.geocities.com/ResearchTriangle/Lab/4299/">.
-
-In addition, you can find links to all of these documents by going to
-<htmlurl url="http://www.gimp.org/gtk/docs"
-name="http://www.gimp.org/gtk/docs">.
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>Is there a mailing list (or mailing list archive) for GTK+?
-<p>
-There are two mailing lists:
-<itemize>
-<item>A mailing list for discussion of development of GTK based applications
-is hosted at gtk-app-devel-list@redhat.com. To subscribe send an
-email message to <htmlurl url="mailto:gtk-app-devel-list-request@redhat.com"
-name="gtk-app-devel-list-request@redhat.com">
-with <em>subscribe</em> in the <bf>subject</bf>.
-<p>
-<item>A mailing list for discussion of development of GTK is hosted
-at gtk-list@redhat.com. To subscribe send an
-email message to <htmlurl url="mailto:gtk-list-request@redhat.com"
-name="gtk-list-request@redhat.com">
-with <em>subscribe</em> in the <bf>subject</bf>.
-<p>
-A searchable archive of the mailing list can be found at <htmlurl url="http://www.redhat.com/linux-info/gtk/gtk-list/index.html" name="http://www.redhat.com/linux-info/gtk/gtk-list/index.html">
-</itemize>
-<!-- ----------------------------------------------------------------- -->
-<sect1>The gtk-list hasn't had any traffic for days, is it dead?
-<p>
-No, everyone's just busy coding.
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>How to get help with GTK+
-<p>
-First, make sure your question isn't answered in the documentation, this
-FAQ or the tutorial. Done that? You're sure you've done that, right? In
-that case, the best place to post questions is to the GTK+ mailing list.
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>How to report bugs in GTK+
-<p>
-Bug reports should be sent to the GTK+ mailing list.
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>What applications have been written with GTK+?
-<p>
-Some applications which use GTK+ are:
-<itemize>
-<item>GIMP (<htmlurl url="http://www.XCF.Berkeley.EDU/~gimp/"
- name="http://www.XCF.Berkeley.EDU/~gimp/"> ),
- an image manipulation program
-<item>Gsumi (<htmlurl url="http://www.msc.cornell.edu/~otaylor/gsumi/gsumi.html"
- name="http://www.msc.cornell.edu/~otaylor/gsumi/gsumi.html">),
- a fun B+W doodling program with XInput support.
-<item>GUBI (<htmlurl url="http://www.SoftHome.net/pub/users/timj/gubi/index.htm"
- name="http://www.SoftHome.net/pub/users/timj/gubi/index.htm">),
- a user interface builder
-<item>Gzilla (<htmlurl url="http://www.levien.com/gzilla/" name="http://www.levien.com/gzilla/">),
- a web browser
-<item>SANE (<htmlurl url="http://www.azstarnet.com/~axplinux/sane/" name="http://www.azstarnet.com/~axplinux/sane/"> ),
- a universal scanner interface
-<item>XQF (<htmlurl url="http://www.botik.ru/~roma/quake/" name="http://www.botik.ru/~roma/quake/">),
- a QuakeWorld/Quake2 server browser and launcher
-<item>ElectricEyes (<htmlurl url="http://www.labs.redhat.com/ee.shtml" name="http://www.labs.redhat.com/ee.shtml">),
- an image viewer that aims to be a free replacement for xv
-<item>GPK - the General Proxy Kit (<htmlurl url="http://www.humanfactor.com/gpk/" name="http://www.humanfactor.com/gpk/">),
- an add-on library to permit thread-safe access to GTK+
-<item>GCK - the General Convenience Kit (<htmlurl url="http://www.ii.uib.no/~tomb/gck.html" name="http://www.ii.uib.no/~tomb/gck.html">),
- miscellaneous functions intended to ease color handling, UI construction,
- vector operations, and math functions
-<item>GDK Imlib (<htmlurl url="http://www.labs.redhat.com/imlib/" name="http://www.labs.redhat.com/imlib/">),
- a fast image loading and manipulation library for GDK
-</itemize>
-<p>
-In addition to the above, the GNOME project (<htmlurl url="http://www.gnome.org"
-name="http://www.gnome.org">)
-is using GTK+ to build a free desktop for Linux. Many more programs can be found
-there.
-
-<!-- ***************************************************************** -->
-<sect>How to find, configure, install, and troubleshoot GTK+
-
-<!-- ***************************************************************** -->
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>What do I need to run GTK+?
-<p>
-To compile GTK+, all you need is a C compiler (gcc) and the X Window System
-and associated libraries on your system.
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>Where can I get GTK+?
-<p>
-The canonical site is:
-<verb>
-ftp://ftp.gimp.org/pub/gtk
-</verb>
-Of course, any mirrors of ftp.gimp.org should have the latest version, too.
-
-<sect1>How do I configure/compile GTK+?
-<p>
-Generally, all you will need to do is issue the commands:
-<verb>
-./configure
-make
-</verb>
-in the gtk+-version/ directory.
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>When compiling GTK+ I get an error like:
-<tt/make: file `Makefile' line 456: Syntax error/
-<p>
-Make sure that you are using GNU make (use <tt/make -v/ to check). There are
-many weird and wonderful versions of make out there, and not all of them
-handle the automatically generated Makefiles.
-
-<!-- ----------------------------------------------------------------- -->
-
-<sect1>I've compiled and installed GTK+, but I can't get any programs to link
-with it!
-<p>
-This problem is most often encountered when the GTK+ libraries can't be
-found or are the wrong version. Generally, the compiler will complain about an
-'unresolved symbol'. There are two things you need to check:
-<itemize>
-<item>Make sure that the libraries can be found. You want to edit
-/etc/ld.so.conf to include /usr/local/lib (or whereever you installed GTK+),
- so it looks something like:
-<verb>
-/usr/X11R6/lib
-/usr/local/lib
-</verb>
-Then you need to run /sbin/ldconfig as root.
-<p>
-<item>Make sure the linker is finding the correct set of libraries. If you
-have a Linux distribution that installs GTK+ (e.g. RedHat 5.0) then this
-older version may be used. Now (assuming you have a RedHat
-system), issue the command
-<verb>
-rpm -e gtk gtk-devel
-</verb>
-You may also want to remove the packages that depend on gtk (rpm will tell you
-which ones they are). If you don't have a RedHat Linux system, check to make sure
-that neither <verb>/usr/lib</verb> or <verb>/usr/local/lib</verb> contain any of
-the libraries libgtk, libgdk, libglib, or libgck. If they do exist, remove them
-(and any gtk include files, such as /usr/include/gtk and /usr/include/gdk)
-and reinstall gtk+.
-</itemize>
-
-<!-- ***************************************************************** -->
-<sect>Development of GTK+
-<!-- ***************************************************************** -->
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>When will it reach version 1.0?
-<p>
-The file 'TODO' in the gtk+ distribution lists the things that need to be done
-before version 1.0 is repleased. Not including bugs, this includes:
-
-<itemize>
-<item>New Features
-<itemize>
-<item>gdk_expose_compress: ala-Xt, this would really help for opaque moves and
- such
-</itemize>
-<p>
-
-<item>Widgets
-<itemize>
-<item>Column-list (Jay Painter)
-<item>Text widget (needs to be finished)
-<item>Entry should have a password mode (and it should show stars
- for user feedback)
-</itemize>
-<p>
-
-<item>Drag-and-Drop (DND)
-<itemize>
-<item> It seems to be having problems again. The way DND data types are set in
- GtkWidget really needs to be fixed. This is pretty high on my priority
- list, and I'll get to it as soon as the column list widget is done. The
- correct way dnd data needs to be set is to have a additional keyed data
- type with GtkWidget, which is applied to the widget's window upon realize.
- There also needs to be a way to set dnd-data on widget windows which are
- not the main window (for widgets that create more than one window).
- -- Jay Painter
-<item> DnD seems to work for me, but yes, there needs to be some sort of
- gtk_widget layer that makes it easier... Also, adding support for drop
- zones might be nice.
- -- Elliot
-</itemize>
-</itemize>
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>Whats this CVS thing that everyone keeps talking about, and how do I access it?
-<p>
-CVS is the Concurent Version System and is a very popular mean of
-version control for software projects. It is designed to allow multiple
-authors to be able to simultanously operate on the same source tree.
-This source tree is centrally maintained, but each developer has a
-local mirror of this repository that they make there changes to.
-
-The GTK+ developers use a CVS repository to store the master copy of
-the current development version of GTK+. As such, people wishing to
-contribute patches to GTK+ should generate them against the CVS version.
-Normal people should use the packaged releases.
-
-The CVS toolset is available as RPM packages from the usual RedHat sites.
-The latest version is available at
-<htmlurl url="http://download.cyclic.com/pub/"
-name="&lt;http://download.cyclic.com/pub/&gt;">
-
-Anyone can download the latest CVS version of GTK+ by using anonymous access
-using the following steps:
-<itemize>
-<item> In a bourne shell descendant (e.g. bash) type:
-<verb>
-export CVSROOT=':pserver:anonymous@cvs.gimp.org:/debian/home/gnomecvs'
-</verb>
-<item>Next, the first time the source tree is checked out, a cvs login
-is needed.
-<verb>
-cvs login
-</verb>
-This will ask you for a password. There is no password for cvs.gimp.org,
-so just enter a carriage return.
-<item>To get the tree and place it in a subdir of your current working directory, issue the command:
-<verb>
-cvs -z9 get gtk+
-</verb>
-</itemize>
-<!-- ----------------------------------------------------------------- -->
-<sect1>How can I contribute to GTK+?
-<p>
-It's simple. If something doesn't work like you think it should in a program,
-check the documentation to make sure you're not missing something. If it is a
-true bug or missing feature, track it down in the GTK+ source, change it,
-and then generate a patch in the form of a 'context diff'. This can be done
-using a command such as <tt/diff -ru &lt;oldfile&gt; &lt;newfile&gt;/.
-Then upload the patchfile to:
-<verb>
-ftp://ftp.gimp.org/incoming
-</verb>
-along with a README file. Make sure you follow the naming conventions or your
-patch will just be deleted! The filenames should be of this form:
-<verb>
-gtk-<username>-<date yymmdd-n>.patch.gz
-gtk-<username>-<date yymmdd-n>.patch.README
-</verb>
-The "n" in the date indicates a unique number (starting from 0)
-of patches you uploaded that day. It should be 0, unless you
-upload more than one patch in the same day.
-
-Example:
-<verb>
-gtk-gale-982701-0.patch.gz
-gtk-gale-982701-0.patch.README
-</verb>
-Once you upload <em>anything</em>, send the README to ftp-admin@gimp.org
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>How do I know if my patch got applied, and if not, why not?
-<p>
-Uploaded patches will be moved to <tt>ftp://ftp.gimp.org/pub/gtk/patches</tt>
-where one of the GTK+ development team will pick them up. If applied, they
-will be moved to <tt>/pub/gtk/patches/old</tt>.
-
-Patches that aren't applied, for whatever reason, are moved to
-<tt>/pub/gtk/patches/unapplied</tt> or <tt>/pub/gtk/patches/outdated</tt>.
-At this point you can ask on the <tt/gtk-list/ mailing list why your patch
-wasn't applied. There are many possible reasons why patches may not be
-applied, ranging from it doesn't apply cleanly, to it isn't right. Don't
-be put off if your patch didn't make it first time round.
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>What is the policy on incorporating new widgets into the library?
-<p>
-This is up to the authors, so you will have to ask them once you
-are done with your widget. As a general guideline, widgets that are
-generally useful, work, and are not a disgrace to the widget set will
-gladly be included.
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>Is anyone working on bindings for languages other than C?
-<p>
-Yes. There is
-<itemize>
-<item>a C++ wrapper for GTK+ called gtk--. You can find the home page at:
-<verb>
-http://www.cs.tut.fi/~p150650/gtk/gtk--.html
-</verb>
-The FTP site is:
-<verb>
-ftp://ftp.gimp.org/pub/gtk/gtk--/
-</verb>
-<p>
-
-<item>There are two Objective-c bindings currently in development:
-
- <itemize>
-
- <item>The <htmlurl url="http://www.gnome.org/" name="GNOME project's"> package
- of choice is obgtk. Objgtk is based on the Object class and is maintained by
- <htmlurl url="mailto:sopwith@cuc.edu" name="Elliot Lee">. Apparently, objgtk
- is being accepted as the `standard' Objective-C binding for GTK+.
-
- <item>If you are more inclined towards the
- <htmlurl url="http://www.gnustep.org/" name="GNUstep project">,
- you may want to check out GTKKit by
- <htmlurl url="mailto:helge@mdlink.de" name="Helge Heszlig">.
- The intention is to setup a GTK+ binding using the FoundationKit.
- GTKKit includes nicities like writing a XML-type template file to
- construct a GTK+ interface.
-
- </itemize>
-<p>
-<item>Perl bindings
-<verb>
-ftp://ftp.gimp.org/pub/gtk/perl
-</verb>
-
-<item>Guile bindings. The home page is at:
-<verb>
-http://www.ping.de/sites/zagadka/guile-gtk/
-</verb>
-By the way, Guile is the GNU Project's implemention of R4RS Scheme (the
-standard). If you like Scheme, you may want to take a look at this.
-<p>
-
-<item>David Monniaux reports:
-<quote>I've started a gtk-O'Caml binding system.
-The basics of the system, including callbacks, work fine.
-
-The current development is in
-http://www.ens-lyon.fr/~dmonniau/arcs/
-</quote>
-
-<item>
-Several python-gtk interfaces have been done. python-gtk is at:
-<verb>
-http://www.acs.ucalgary.cs/~nashceme/python-gtk/
-</verb>
-If you try python-gtk and don't like it, there's also pygtk located at:
-<verb>
-ftp://ftp.gimp.org/pub/gtk/python/
-</verb>
-
-<item>
-There's a OpenGL/Mesa widget available for GTK+. Grab it at:
-<verb>
-http://www.sakuranet.or.jp/~aozasa/shige/doc/comp/gtk/gtkGL/files-en.html
-</verb>
-
-</itemize>
-
-<!-- ***************************************************************** -->
-<sect>Development with GTK+
-<!-- ***************************************************************** -->
-<!-- ----------------------------------------------------------------- -->
-<sect1>How do I get started?
-<p>
-So, after you have installed GTK+ there are a couple of things that can
-ease you into developing applications with it. There is the
-GTK+ Tutorial <htmlurl url="http://www.levien.com/~slow/gtk/tutorial"
-name="&lt;http://www.levien.com/~slow/gtk/tutorial&gt;">, which is undergoing development. This will introduce you
-to writing applications using C.
-
-The Tutorial doesn't (yet) contain information on all of the widgets
-that are in GTK+. For example code on how to use the basics of all the
-GTK+ widgets you should look at the file gtk/testgtk.c (and associated
-source files) within the GTK+ distribution. Looking at these exmaples will
-give you a good grounding on what the widgets can do.
-
-<sect1>What widgets are in GTK?
-<p>
-The GTK+ Tutorial lists the following widgets:
-<verb>
- GtkObject
- +GtkData
- | +GtkAdjustment
- | `GtkTooltips
- `GtkWidget
- +GtkContainer
- | +GtkBin
- | | +GtkAlignment
- | | +GtkEventBox
- | | +GtkFrame
- | | | `GtkAspectFrame
- | | +GtkHandleBox
- | | +GtkItem
- | | | +GtkListItem
- | | | +GtkMenuItem
- | | | | `GtkCheckMenuItem
- | | | | `GtkRadioMenuItem
- | | | `GtkTreeItem
- | | +GtkViewport
- | | `GtkWindow
- | | +GtkColorSelectionDialog
- | | +GtkDialog
- | | | `GtkInputDialog
- | | `GtkFileSelection
- | +GtkBox
- | | +GtkButtonBox
- | | | +GtkHButtonBox
- | | | `GtkVButtonBox
- | | +GtkHBox
- | | | +GtkCombo
- | | | `GtkStatusbar
- | | `GtkVBox
- | | +GtkColorSelection
- | | `GtkGammaCurve
- | +GtkButton
- | | +GtkOptionMenu
- | | `GtkToggleButton
- | | `GtkCheckButton
- | | `GtkRadioButton
- | +GtkCList
- | +GtkFixed
- | +GtkList
- | +GtkMenuShell
- | | +GtkMenuBar
- | | `GtkMenu
- | +GtkNotebook
- | +GtkPaned
- | | +GtkHPaned
- | | `GtkVPaned
- | +GtkScrolledWindow
- | +GtkTable
- | +GtkToolbar
- | `GtkTree
- +GtkDrawingArea
- | `GtkCurve
- +GtkEditable
- | +GtkEntry
- | | `GtkSpinButton
- | `GtkText
- +GtkMisc
- | +GtkArrow
- | +GtkImage
- | +GtkLabel
- | | `GtkTipsQuery
- | `GtkPixmap
- +GtkPreview
- +GtkProgressBar
- +GtkRange
- | +GtkScale
- | | +GtkHScale
- | | `GtkVScale
- | `GtkScrollbar
- | +GtkHScrollbar
- | `GtkVScrollbar
- +GtkRuler
- | +GtkHRuler
- | `GtkVRuler
- `GtkSeparator
- +GtkHSeparator
- `GtkVSeparator
-</verb>
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>How can I prevent redrawing and resizing while I change multiple widgets?
-<p>
-Use gtk_container_disable_resize and gtk_container_enable_resize around the
-code where you are changing a lot of stuff. This will result in much faster
-speed since it will prevent resizing of the entire widget hierarchy.
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>How do I catch a double click event in a list widget?
-<p>
-Tim Janik wrote to gtk-list (slightly modified):
-
-Define a signal handler:
-
-<tscreen><verb>
-gint
-signal_handler_event(GtkWiget *widget, GdkEvenButton *event, gpointer func_data)
-{
- if (GTK_IS_LIST_ITEM(widget) &&
- (event->type==GDK_2BUTTON_PRESS ||
- event->type==GDK_3BUTTON_PRESS) ) {
- printf("I feel %s clicked on button %d\",
- event->type==GDK_2BUTTON_PRESS ? "double" : "triple",
- event->button);
- }
-
- return FALSE;
-}
-</verb></tscreen>
-
-And connect the handler to your object:
-
-<tscreen><verb>
-{
- /* list, list item init stuff */
-
- gtk_signal_connect(GTK_OBJECT(list_item),
- "button_press_event",
- GTK_SIGNAL_FUNC(signal_handler_event),
- NULL);
-
- /* and/or */
-
- gtk_signal_connect(GTK_OBJECT(list_item),
- "button_release_event",
- GTK_SIGNAL_FUNC(signal_handler_event),
- NULL);
-
- /* something else */
-}
-</verb></tscreen>
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>How do I find out about the selection of a GtkList?
-<p>
-
-Get the selection something like this:
-<tscreen><verb>
-GList *sel;
-sel = GTK_LIST(list)->selection;
-</verb></tscreen>
-
-This is how GList is defined (quoting glist.h):
-<tscreen><verb>
-typedef struct _GList GList;
-
-struct _GList
-{
- gpointer data;
- GList *next;
- GList *prev;
-};
-</verb></tscreen>
-
-A GList structure is just a simple structure for doubly linked lists.
-there exist several g_list_*() functions to modify a linked list in
-glib.h. However the GTK_LIST(MyGtkList)->selection is maintained
-by the gtk_list_*() functions and should not be modified.
-
-The selection_mode of the GtkList determines the selection
-facilities of a GtkList and therefore the contents
-of GTK_LIST(AnyGtkList)->selection:
-
-<verb>
-selection_mode GTK_LIST()->selection contents
-------------------------------------------------------
-
-GTK_SELECTION_SINGLE) selection is either NULL
- or contains a GList* pointer
- for a single selected item.
-
-GTK_SELECTION_BROWSE) selection is NULL if the list
- contains no widgets, otherwise
- it contains a GList* pointer
- for one GList structure.
-GTK_SELECTION_MULTIPLE) selection is NULL if no listitems
- are selected or a a GList* pointer
- for the first selected item. that
- in turn points to a GList structure
- for the second selected item and so
- on
-
-GTK_SELECTION_EXTENDED) selection is NULL.
-</verb>
-
-The data field of the GList structure GTK_LIST(MyGtkList)->selection points
-to the first GtkListItem that is selected. So if you would like to determine
-which listitems are selected you should go like this:
-
-Upon Initialization:
-<tscreen><verb>
-{
- gchar *list_items[]={
- "Item0",
- "Item1",
- "foo",
- "last Item",
- };
- guint nlist_items=sizeof(list_items)/sizeof(list_items[0]);
- GtkWidget *list_item;
- guint i;
-
- list=gtk_list_new();
- gtk_list_set_selection_mode(GTK_LIST(list), GTK_SELECTION_MULTIPLE);
- gtk_container_add(GTK_CONTAINER(AnyGtkContainer), list);
- gtk_widget_show (list);
-
- for (i = 0; i < nlist_items; i++)
- {
- list_item=gtk_list_item_new_with_label(list_items[i]);
- gtk_object_set_user_data(GTK_OBJECT(list_item), (gpointer)i);
- gtk_container_add(GTK_CONTAINER(list), list_item);
- gtk_widget_show(list_item);
- }
-}
-</verb></tscreen>
-
-To get known about the selection:
-<tscreen><verb>
-{
- GList *items;
-
- items=GTK_LIST(list)->selection;
-
- printf("Selected Items: ");
- while (items) {
- if (GTK_IS_LIST_ITEM(items->data))
- printf("%d ", (guint)
- gtk_object_get_user_data(items->data));
- items=items->next;
- }
- printf("\n");
-}
-</verb></tscreen>
-<!-- ----------------------------------------------------------------- -->
-<sect1>Is it possible to get some text displayed which is truncated to fit inside its allocation?
-<p>
-GTK's behavior (no clipping) is a consequence of its attempts to
-conserve X resources. Label widgets (among others) don't get their own
-X window - they just draw their contents on their parent's window.
-While it might be possible to have clipping occur by setting the clip
-mask before drawing the text, this would probably cause a substantial
-performance penalty.
-
-Its possible that, in the long term, the best solution to such
-problems might be just to change gtk to give labels X windows.
-A short term workaround is to put the label widget inside another
-widget that does get it's own window - one possible candidate would
-be the viewport widget.
-
-<tscreen><verb>
-viewport = gtk_viewport (NULL, NULL);
-gtk_widget_set_usize (viewport, 50, 25);
-gtk_viewport_set_shadow_type (GTK_VIEWPORT(viewport), GTK_SHADOW_NONE);
-gtk_widget_show(viewport);
-
-label = gtk_label ("a really long label that won't fit");
-gtk_container_add (GTK_CONTAINER(viewport), label);
-gtk_widget_show (label);
-</verb></tscreen>
-
-If you were doing this for a bunch of widgets, you might want to
-copy gtkviewport.c and strip out the adjustment and shadow
-functionality (perhaps you could call it GtkClipper).
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>Why don't the contents of a button move when the button is pressed? Here's a patch to make it work that way...
-<p>
-From: Peter Mattis
-
-The reason buttons don't move their child down and to the right when
-they are depressed is because I don't think that's what is happening
-visually. My view of buttons is that you are looking at them straight
-on. That is, the user interface lies in a plane and you're above it
-looking straight at it. When a button gets pressed it moves directly
-away from you. To be absolutely correct I guess the child should
-actually shrink a tiny amount. But I don't see why the child should
-shift down and to the left. Remember, the child is supposed to be
-attached to the buttons surface. Its not good for it to appear like
-the child is slipping on the surface of the button.
-
-On a more practical note, I did implement this at one point and
-determined it didn't look good and removed it.
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>How can I define a separation line in a menu?
-<p>
-See the <htmlurl url="http://www.levien.com/~slow/gtk/"
-name="Tutorial"> for information on how to create menus.
-However, to create a separation line in a menu, just insert an
-empty menu item:
-
-<tscreen><verb>
-menuitem = gtk_menu_item_new();
-gtk_menu_append(GTK_MENU(menu), menuitem);
-gtk_widget_show(menuitem);
-</verb></tscreen>
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>How can I right justify a menu, such as Help, when using the MenuFactory?
-<p>
-Use something like the following:
-
-<tscreen><verb>
-menu_path = gtk_menu_factory_find (factory, "<MyApp>/Help");
-gtk_menu_item_right_justify(menu_path->widget);
-</verb></tscreen>
-
-<!-- ***************************************************************** -->
-<sect>About gdk
-<!-- ***************************************************************** -->
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>What is gdk?
-<p>
-gdk is basically a wrapper around the standard Xlib function calls. If you are
-at all familiar with Xlib, a lot of the functions in gdk will require little
-or no getting used to. All functions are written to provide an easy way
-to access Xlib functions in an easier an slightly more intuitive manner.
-In addition, since gdk uses glib (see below), it will be more portable
-and safer to use on multiple platforms.
-
-<!-- Examples, anybody? I've been mulling some over. NF -->
-
-<sect1>How do I use color allocation?
-<p>
-One of the nice things about GDK is that it's based on top of Xlib; this is
-also a problem, especially in the area of color management. If you want
-to use color in your program (drawing a rectangle or such, your code
-should look something like this:
-<tscreen>
-<verb>
-{
- GdkColor *color;
- int width, height;
- GtkWidget *widget;
- GdkGC *gc;
-
- ...
-
- /* first, create a GC to draw on */
- gc = gdk_gc_new(widget->window);
-
- /* find proper dimensions for rectangle */
- gdk_window_get_size(widget->window, &amp;width, &amp;height);
-
- /* the color we want to use */
- color = (GdkColor *)malloc(sizeof(GdkColor));
-
- /* red, green, and blue are passed values, indicating the RGB triple
- * of the color we want to draw. Note that the values of the RGB components
- * within the GdkColor are taken from 0 to 65535, not 0 to 255.
- */
- color->red = red * (65535/255);
- color->green = green * (65535/255);
- color->blue = blue * (65535/255);
-
- /* the pixel value indicates the index in the colormap of the color.
- * it is simply a combination of the RGB values we set earlier
- */
- color->pixel = (gulong)(red*65536 + green*256 + blue);
-
- /* However, the pixel valule is only truly valid on 24-bit (TrueColor)
- * displays. Therefore, this call is required so that GDK and X can
- * give us the closest color available in the colormap
- */
- gdk_color_alloc(gtk_widget_get_colormap(widget), color);
-
- /* set the foreground to our color */
- gdk_gc_set_foreground(gc, color);
-
- /* draw the rectangle */
- gdk_draw_rectangle(widget->window, gc, 1, 0, 0, width, height);
-
- ...
-}
-</verb>
-</tscreen>
-
-<!-- ***************************************************************** -->
-<sect>About glib
-<!-- ***************************************************************** -->
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>What is glib?
-<p>
-glib is a library of useful functions and definitions available for use
-when creating GDK and GTK applications. It provides replacements for some
-standard libc functions, such as malloc, which are buggy on some systems.
-<p>
-It also provides routines for handling:
-<itemize>
-<item>Doubly Linked Lists
-<item>Singly Linked Lists
-<item>Timers
-<item>String Handling
-<item>A Lexical Scanner
-<item>Error Functions
-</itemize>
-
-<!-- Some Examples might be useful here! NF -->
-
-<!-- ----------------------------------------------------------------- -->
-<sect1>Why use g_print, g_malloc, g_strdup and fellow glib functions ?
-<p>
-Thanks to Tim Janik who wrote to gtk-list: (slightly modified)
-<quote>
-Regarding g_malloc(), g_free() and siblings, these functions are much safer
-than thier libc equivalences. For example, g_free() just returns if called
-with NULL. Also, if USE_DMALLOC is defined, the definition for these
-functions changes (in glib.h) to use MALLOC(), FREE() etc... If MEM_PROFILE
-or MEM_CHECK are defined, there are even small statistics made counting
-the used block sizes (shown by g_mem_profile() / g_mem_check()).
-<p>
-Considering the fact that glib provides an interface for memory chunks
-to save space if you have lots of blocks that are always the same size
-and to mark them ALLOC_ONLY if needed, it is just straight forward to
-create a small saver (debug able) wrapper around the normal malloc/free
-stuff as well - just like gdk covers Xlib. ;)
-<p>
-Using g_error() and g_warning() inside of applications like the GIMP
-that fully rely on gtk even gives the opportunity to pop up a window
-showing the messages inside of a gtk window with your own handler
-(by using g_set_error_handler()) along the lines of gtk_print()
-(inside of gtkmain.c).
-</quote>
-
-<!-- ***************************************************************** -->
-<sect>GTK+ FAQ Contributions, Maintainers and Copyright
-<p>
-If you would like to make a contribution to the FAQ, send either one of us
-an e-mail message with the exact text you think should be included (question and
-answer). With your help, this document can grow and become more useful!
-
-This document is maintained by Nathan Froyd
-<htmlurl url="mailto:maestrox@geocities.com" name="&lt;maestrox@geocities.com&gt;">
-and Tony Gale <htmlurl url="mailto:gale@gimp.org" name="&lt;gale@gimp.org&gt;">.
-This FAQ was created by Shawn T. Amundson <htmlurl url="mailto:amundson@gimp.org"
-name="&lt;amundson@gimp.org&gt;">who continues to provide support.
-
-The GTK+ FAQ is Copyright (C) 1997,1998 by Shawn T. Amundson, Nathan Froyd and Tony Gale.
-
-Permission is granted to make and distribute verbatim copies of this manual provided the
-copyright notice and this permission notice are preserved on all copies.
-
-Permission is granted to copy and distribute modified versions of this document under the conditions
-for verbatim copying, provided that this copyright notice is included exactly as in the original,
-and that the entire resulting derived work is distributed under the terms of a permission
-notice identical to this one.
-
-Permission is granted to copy and distribute translations of this document into another language,
-under the above conditions for modified versions.
-
-If you are intending to incorporate this document into a published work, please contact one of
-the maintainers, and we will make an effort to ensure that you have the most up to date
-information available.
-
-There is no guarentee that this document lives up to its intended
-purpose. This is simply provided as a free resource. As such,
-the authors and maintainers of the information provided within can
-not make any guarentee that the information is even accurate.
-
-</article>
diff --git a/docs/gtkfaq_fix b/docs/gtkfaq_fix
deleted file mode 100755
index 5038cc9bab..0000000000
--- a/docs/gtkfaq_fix
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/perl -w
-
-# Stupid script to fix look of html files created with sgml2html...
-
-foreach (@ARGV) {
- print "Fixing... $_\n";
- system("mv $_ $_.orig");
- system("sed -e 's/<BODY>/<BODY BGCOLOR=\"#FFFFFF\">/g' -e 's/<HR>/<HR NOSHADE>/g' $_.orig > $_");
- unlink("$_.orig");
-}
diff --git a/docs/macros.texi b/docs/macros.texi
deleted file mode 100644
index f8df89a46f..0000000000
--- a/docs/macros.texi
+++ /dev/null
@@ -1,18 +0,0 @@
-@macro gtkstdmacros {p, q}
-
-@deftypefun Gtk\p\* GTK_\q\ (gpointer @var{obj})
-Cast a generic pointer to @code{Gtk\p\*}. @xref{Standard Macros}, for
-more info.
-@end deftypefun
-
-@deftypefun Gtk\p\Class* GTK_\q\_CLASS (gpointer @var{class})
-Cast a generic pointer to @code{Gtk\p\Class*}. @xref{Standard Macros},
-for more info.
-@end deftypefun
-
-@deftypefun gint GTK_IS_\q\ (gpointer @var{obj})
-Determine if a generic pointer refers to a @code{Gtk\p\}
-object. @xref{Standard Macros}, for more info.
-@end deftypefun
-
-@end macro
diff --git a/docs/refcounting.txt b/docs/refcounting.txt
deleted file mode 100644
index 7130f1654c..0000000000
--- a/docs/refcounting.txt
+++ /dev/null
@@ -1,315 +0,0 @@
-The Reference Counting Scheme of GDK an GTK+
-============================================
-
-Each data structure that provides reference counting offers a bunch of
-functions that follow these conventions:
-
- *_new: Create a new structure with a reference count of 1.
- *_ref: Increase ref count by one.
- *_unref: Decrease ref count by one. If the count drops to zero,
- run appropriate finalization code and free the memory.
- For data structures with a _destroy function, it will be
- invoked at this point, if the data structure is not
- already in a destroyed state.
-
-GtkObjects also provide the following functions:
-
- *_destroy: Render an object `unusable', but as long as there are
- references to it, it's allocated memory will not be freed.
- *_sink: Clear a GtkObjects `floating' state and decrement the
- reference count by 1.
-
-GdkWindow
----------
-
-A GdkWindow has to be explicitely destroyed with gdk_window_destroy.
-This will send out a request to destroy this window and all its
-children, and will decrement the ref_count of the GdkWindow by one.
-Thus, it releases the inital reference created by gdk_window_new.
-
-All GdkWindows are kept in a hash table to translate from their XId to
-the actual structure and the pointer in the hash table is reflected in
-the reference count. When a DestroyNotify event is received for a
-particular GdkWindow, it is removed from the hash table and the
-ref_count is updated accordingly.
-
-You can call gdk_window_destroy more than once on a particular
-GdkWindow, it will only be destroyed when it hasn't been yet. The
-ref_count is *always* decremented, tho. Be careful.
-
-Remark: When writing NO_WINDOW widgets, care should be taken about
- proper referencing/unreferencing of the parent's GdkWindow
- that is used by the widget.
-
-GdkPixmap
----------
-
-There is no gdk_pixmap_destroy function. The Pixmap is destroyed when
-the last reference to it vanishes.
-
-GdkPixmaps are kept in the same hash table as GdkWindows but the
-pointer in the hash table is *not* reflected in the ref_count.
-
-This works only when Pixmaps never get XEvents. I'm not sure if this
-is the case.
-
-GdkBitmap
----------
-
-A GdkBitmap is only another name for a special use of GdkPixmap.
-
-GdkVisual
----------
-
-There are no *_new or *_destroy functions and the *_ref and *_unref
-functions are noops. GdkVisuals are static structures and thus do not
-need reference counting. The ref counting functions are only there
-for extra defensive programming.
-
-GdkColormap
------------
-
-Nothing special. There is no gdk_colormap_destroy function.
-
-GdkFont / GdkFontSet
---------------------
-
-GdkFont and GdkFontSet are equivalent as far as ref counting is
-concerned. Use gdk_font_ref and gdk_font_unref for both.
-
-There is no gdk_font_free or gdk_fontset_free function.
-
-GtkAcceleratorTable
--------------------
-
-There is no gtk_accelerator_table_destroy function.
-
-GtkTooltips
------------
-
-There is no gtk_tooltips_destroy function.
-
-GtkStyle
---------
-
-There is no gtk_style_destroy function.
-
-GtkObject
----------
-
-GtkObjects follow the usual ref_counting strategy, but with a twist.
-
-They are created with a ref_count of 1. GtkObjects are able to
-run finalization code when the ref_count drops to zero but you cannot
-register arbitrary signal handlers to run at finalization time.
-
-There is also the old gtk_object_destroy function and the "destroy"
-signal but they are somewhat independent from finalization. Just as
-stated at the top of this text, gtk_object_destroy merely renders an
-object unusable. When the object is a container widget for example,
-it unrealizes that widget, removes all children and disconnects all
-signal handlers. The finalization code is different, it would for
-example free associated memory for text strings and release the
-attached style.
-
-This is the biggest change. Every widget must be revised to have a
-proper "destroy" function, etc. Such a destroy function will only
-be called once and is expected to leave the widget in a minimal but
-consistent state. Widgets that have been "destroyed" but not yet
-finalized are flagged with GTK_DESTROY. The "finalization" function
-is new and should perform last-minute cleanup actions, in contrast
-to the destroy function it will not be emitted as signal though.
-It can assume that the "destroy" function has been called as the
-last function on this widget.
-
-Essentially, the old "destroy" function has been split into a
-"finalize" plus a "destroy" function.
-
-It is not possible to create GtkObjects with a ref_count of 0
-because the first ref/unref pair will destroy it unintentionally.
-
-To be mostly backward compatible with existing practice, a GtkObject
-leads a more complicated life than the other reference counted structures.
-
-When a GtkObject is created, it starts out in a special state called
-"floating" (this is the twist). This means that it is alive and has a
-reference to it, but the `owner' of this reference is not known.
-There are certain `potential owners' that will adopt a floating
-GtkObject. For GtkWidgets the most common adopters are the parent
-widget.
-
-When you want to adopt a possibly floating GtkObject, you call
-gtk_object_sink on it. This clears the floating state of the
-GtkObject and decrements the ref_count by one, if it has been floating
-previously. Once the floating state has been cleared, it will never
-be set again.
-
-All widgets that are part of the display are linked into a
-parent/child tree. The link from the parent to a child is reflected
-in the ref_count of the child, but the link from the child to the
-parent is not reflected in the ref_count of the parent.
-
-Like a GtkObject, a GtkWidget is created with a ref_count of 1 and
-initially flagged as `floating'. As soon as it is added as a child to
-a parent, the `floating' flag is cleared and never will be set again.
-Not even when it is later unparented. The act of clearing the
-`floating' flag also decrements the ref_count of the widget by one.
-
-When the widget is unparented, its underlying GdkWindow is destroyed
-(when it has one), it loses its reference from the parent and
-naturally the ref_count is decremented.
-
-It is considered a bug if a widget still has a GdkWindow when it is
-being freed.
-
-Toplevel widgets, which don't have a `natural' parent, are adopted by
-special registering functions. Because the of the reference count that
-is set by the registering functions, toplevel widgets will have to be
-explicitly destroyed, with the exception of GtkMenus. GtkMenus are a
-special case of toplevel widgets in that they will be `attached' to and
-`detached' from other widgets. The act of attaching a GtkMenu to a
-widget will be reflected in its reference count. The act of detaching
-a GtkMenu will revert that. Therefore GtkMenus naturally get destroyed
-and finalized once they are detached from their reference holder.
-
-So, the typical career of a GtkWindow a GtMenu attached to a
-GtkOptionMenu looks like this:
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- /* window is created with ref_count == 1. It is not flagged as
- * `floating' because it has already been registered as a toplevel
- * widget.
- */
-
- option_menu = gtk_option_menu_new ();
- /* option_menu->ref_count == 1 and it is flagged as `floating'.
- */
-
- gtk_container_add (window, option_menu);
- /* option_menu->ref_count still == 1, but it is no longer `floating'.
- */
-
- menu = gtk_menu_new ();
- /* menu->ref_count == 1 and it is flagged as `floating'.
- */
-
- menu_item = gtk_menu_item_new_with_label ("Choose Me");
- /* menu_item->ref_count == 1 and it is flagged as `floating'.
- */
-
- gtk_menu_append (GTK_MENU (menu), menu_item);
- /* menu_item->ref_count still == 1, but it is no longer `floating'.
- */
-
- gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
- /* menu->ref_count still == 1, but it is no longer `floating'.
- */
-
- gtk_widget_show (menu_item);
- gtk_widget_show (option_menu);
- gtk_widget_show (window);
-
- /* The widgets get their GdkWindows, nothing significant happens to
- * the ref_counts.
- */
-
-Then, when the user wants to get rid of the window:
-
- gtk_widget_destroy (window);
-
- /* The GdkWindow of `window' and all its child GdkWindows are
- * destroyed.
- *
- * window is unregistered from the loplevel list and its ref_count
- * drops to zero. The destroy code of `window' destroyes `option_menu'.
- *
- * The destroy code of `option_menu' causes the `menu' to be detached
- * from it and its reference count drops to zero.
- *
- * The destroy code of `menu' destroyes `menu_item'.
- *
- * The destruction of `menu_item' removes it from its parent, the
- * menu_item->ref_count drops to zero and `menu_item' is finalized (freed).
- *
- * Now `menu', `option_menu' and `window' will be destroyed and finalized,
- * in this order, since the reference count of each is zero.
- */
-
-
-Taking care of proper referencing
----------------------------------
-
-There are some cases where referencing of widgets from outside the toolkit
-(on the application side is needed).
-Once the application performes an operation on a widget that will cause
-its reference count to drop, if it wants to take further actions on the
-widget, it needs to hold a reference to it.
-
-Example code sequences that require reference wraps:
-
- /* gtk_container_remove() will unparent the child and therefore
- * cause it's reference count to be decremented by one.
- */
- gtk_widget_ref (widget);
- gtk_container_remove (container, widget);
- /* without the reference count, the widget would have been destroyed here.
- */
- gtk_container_add (container, widget);
- gtk_widget_unref (widget);
-
-
- /* all items in item_list need to be referenced
- * before gtk_list_remove_items() is invoked.
- * this is somewhat tricky as gtk_list_append_items/gtk_list_prepend_items/
- * gtk_list_insert_items will take over the lists nodes.
- * we therefore have an extra GSList `*slist' for later unreferencing.
- */
- slist = NULL;
- for (list = item_list; list; list = list->next)
- {
- gtk_widget_ref (GTK_WIDGET (list->data));
- slist = g_slist_prepend (slist, list->data);
- }
- gtk_list_remove_items (list, item_list);
- gtk_list_append_items (other_list, item_list);
- /* gtk_list_prepend_items (other_list, item_list); */
- /* gtk_list_insert_items (other_list, item_list, 3); */
- while (slist)
- {
- GSList *tmp;
-
- tmp = slist;
- slist = slist->next;
- gtk_widget_unref (GTK_WIDGET (tmp->data));
- g_slist_free_1 (tmp);
- }
-
- /* Alternatively to the removal above you could just use
- * gtk_list_remove_items_no_unref() which will add the additional
- * reference count to the widget.
- */
- gtk_list_remove_items_no_unref (list, item_list);
- gtk_list_prepend_items (other_list, item_list);
-
-
-Now a (hopefully) complete list of functions that require
-wrappers similar to the examples above:
-
-void gtk_container_remove (GtkContainer *container,
- GtkWidget *widget);
-void gtk_list_remove_items (GtkList *list,
- GList *items);
-void gtk_tree_remove_items (GtkTree *tree,
- GList *items);
-void gtk_tree_item_remove_subtree (GtkTreeItem *tree_item);
-void gtk_menu_item_remove_submenu (GtkMenuItem *menu_item);
-void gtk_option_menu_remove_menu (GtkOptionMenu *option_menu);
-
-
-
-Initial proposal:
- - Marius Vollmer <mvo@zagadka.ping.de>
-
-Some modifications/additions, "Taking care of proper referencing" and
-reference counting solution for GtkMenus:
- - Tim Janik <timj@gimp.org>
diff --git a/docs/styles.txt b/docs/styles.txt
deleted file mode 100644
index 051dc4b107..0000000000
--- a/docs/styles.txt
+++ /dev/null
@@ -1,104 +0,0 @@
-HANDLING WIDGET STYLES
-======================
-
-
-A widget gets created with a default style.
-The global default style can be affected by gtk_widget_set_default_style()
-and can be queried by gtk_widget_get_default_style().
-The initial style that is assigned to a widget as default style upon
-creation can be affected by wrapping the widget's creation as follows:
-gtk_widget_push_style (my_style);
-widget = gtk_type_new (gtk_button_get_type ());
-gtk_widget_pop_style ();
-
-There are certain functions to affect widget styles after a widget's
-creation:
-
-gtk_widget_set_style ()
- Save the default style and set a user style.
- This will override a previously set user style or
- previously set rc styles.
-
-gtk_widget_set_rc_style ()
- Set GTK_RC_STYLE to indicate that an rc lookup has been performed.
- If there is an rc style for a widget, set it and save the default style,
- restore the default style otherwise.
- This will override a previously set user style or rc style.
-
-gtk_widget_restore_default_style ()
- Reset the widget's style to the default style, this is only usefull if
- the widgets default style had been saved by previous calls to
- gtk_widget_set_style() or gtk_widget_set_rc_style().
-
-gtk_widget_ensure_style ()
- Ensure taht the widget either has a user style set, or an rc lookup
- has been performed.
-
-gtk_rc_get_style ()
- Return an rc style for a widget if there is one.
-
-gtk_widget_set_name ()
- Change widget name, and perform a new rc lookup if no user style
- is set.
-
-gtk_widget_realize ()
- Besides realizing the widget this function will:
- - perform an rc lookup if neccessary,
- - attach a widget's style.
-
-gtk_widget_get_style ()
- Return a widgets style, this function will perform an rc lookup
- if neccessary.
-
-gtk_widget_set_parent ()
- This function will perform rc lookups recursively for all widgets
- that do not have a user style set.
-
-gtk_style_copy ()
- This function can be used to copy a widgets style.
- The style can subsequntly be changed (e.g., by modifications to the
- red/green/blue values of a certain color) and then be applied to the
- widget via gtk_widget_set_style().
-
-
-GtkWidget::style_set
- This signal will be emitted for a widget once its style changes with
- an additional argument previous_style wich will hold the widget->style
- avlue from a previous emission.
- The initial emission of this signal is guaranteed to happen prior
- to any GtkWidget::size_request emission, and will have the previous_style
- argument set to NULL.
- The GtkWidgetClass implements a default handler for this signal that
- will set the widget's window's background of widgets that provide their
- own windows according to the new style.
- Derived widgets need to overide this default handler, if:
- - their size requisition depends on the current style.
- (e.g., on the style's fonts)
- - they set the background of widget->window to something other than.
- style->bg. (e.g., GtkListItem)
- - the widget provides windows other than widget->window.
- - the widget has any other stored dependencies on the style.
-
-
-
-Flag indications:
-
-!GTK_RC_STYLE && !GTK_USER_STYLE:
- The widget has it's default style set, no rc lookup has been
- performed, the widget has not been size requested yet and is
- therefore not yet realized.
-
-GTK_USER_STYLE:
- GTK_RC_STYLE is not set.
- The widget has a user style assigned, and it's default style has been
- saved.
-
-GTK_RC_STYLE:
- GTK_USER_STYLE is not set.
- If the widget has a saved default style, it has been assigned an
- rc style. If the widget does not have a saved default style, it still
- has its default style but an rc lookup has already been performed.
-
-
- - Tim Janik <timj@gimp.org>
- 1998/02/27
diff --git a/docs/texinfo.tex b/docs/texinfo.tex
deleted file mode 100644
index 7d62f26f70..0000000000
--- a/docs/texinfo.tex
+++ /dev/null
@@ -1,4692 +0,0 @@
-%% TeX macros to handle texinfo files
-
-% Copyright (C) 1985, 86, 88, 90, 91, 92, 93,
-% 94, 95, 1996 Free Software Foundation, Inc.
-
-%This texinfo.tex file is free software; you can redistribute it and/or
-%modify it under the terms of the GNU General Public License as
-%published by the Free Software Foundation; either version 2, or (at
-%your option) any later version.
-
-%This texinfo.tex file is distributed in the hope that it will be
-%useful, but WITHOUT ANY WARRANTY; without even the implied warranty
-%of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-%General Public License for more details.
-
-%You should have received a copy of the GNU General Public License
-%along with this texinfo.tex file; see the file COPYING. If not, write
-%to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-%Boston, MA 02111-1307, USA.
-
-
-%In other words, you are welcome to use, share and improve this program.
-%You are forbidden to forbid anyone else to use, share and improve
-%what you give them. Help stamp out software-hoarding!
-
-
-% Send bug reports to bug-texinfo@prep.ai.mit.edu.
-% Please include a *precise* test case in each bug report.
-
-
-% Make it possible to create a .fmt file just by loading this file:
-% if the underlying format is not loaded, start by loading it now.
-% Added by gildea November 1993.
-\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
-
-% This automatically updates the version number based on RCS.
-\def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}}
-\deftexinfoversion$Revision$
-\message{Loading texinfo package [Version \texinfoversion]:}
-
-% If in a .fmt file, print the version number
-% and turn on active characters that we couldn't do earlier because
-% they might have appeared in the input file name.
-\everyjob{\message{[Texinfo version \texinfoversion]}\message{}
- \catcode`+=\active \catcode`\_=\active}
-
-% Save some parts of plain tex whose names we will redefine.
-
-\let\ptexb=\b
-\let\ptexbullet=\bullet
-\let\ptexc=\c
-\let\ptexcomma=\,
-\let\ptexdot=\.
-\let\ptexdots=\dots
-\let\ptexend=\end
-\let\ptexequiv = \equiv
-\let\ptexi=\i
-\let\ptexlbrace=\{
-\let\ptexrbrace=\}
-\let\ptexstar=\*
-\let\ptext=\t
-\let\ptextilde=\~
-
-% Be sure we're in horizontal mode when doing a tie, since we make space
-% equivalent to this in @example-like environments. Otherwise, a space
-% at the beginning of a line will start with \penalty -- and
-% since \penalty is valid in vertical mode, we'd end up putting the
-% penalty on the vertical list instead of in the new paragraph.
-{\catcode`@ = 11
- % Avoid using \@M directly, because that causes trouble
- % if the definition is written into an index file.
- \global\let\tiepenalty = \@M
- \gdef\tie{\leavevmode\penalty\tiepenalty\ }
-}
-\let\~ = \tie % And make it available as @~.
-
-
-\message{Basics,}
-\chardef\other=12
-
-% If this character appears in an error message or help string, it
-% starts a new line in the output.
-\newlinechar = `^^J
-
-% Set up fixed words for English.
-\ifx\putwordChapter\undefined{\gdef\putwordChapter{Chapter}}\fi%
-\def\putwordInfo{Info}%
-\ifx\putwordSee\undefined{\gdef\putwordSee{See}}\fi%
-\ifx\putwordsee\undefined{\gdef\putwordsee{see}}\fi%
-\ifx\putwordfile\undefined{\gdef\putwordfile{file}}\fi%
-\ifx\putwordpage\undefined{\gdef\putwordpage{page}}\fi%
-\ifx\putwordsection\undefined{\gdef\putwordsection{section}}\fi%
-\ifx\putwordSection\undefined{\gdef\putwordSection{Section}}\fi%
-\ifx\putwordTableofContents\undefined{\gdef\putwordTableofContents{Table of Contents}}\fi%
-\ifx\putwordShortContents\undefined{\gdef\putwordShortContents{Short Contents}}\fi%
-\ifx\putwordAppendix\undefined{\gdef\putwordAppendix{Appendix}}\fi%
-
-% Ignore a token.
-%
-\def\gobble#1{}
-
-\hyphenation{ap-pen-dix}
-\hyphenation{mini-buf-fer mini-buf-fers}
-\hyphenation{eshell}
-
-% Margin to add to right of even pages, to left of odd pages.
-\newdimen \bindingoffset
-\newdimen \normaloffset
-\newdimen\pagewidth \newdimen\pageheight
-
-% Sometimes it is convenient to have everything in the transcript file
-% and nothing on the terminal. We don't just call \tracingall here,
-% since that produces some useless output on the terminal.
-%
-\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
-\def\loggingall{\tracingcommands2 \tracingstats2
- \tracingpages1 \tracingoutput1 \tracinglostchars1
- \tracingmacros2 \tracingparagraphs1 \tracingrestores1
- \showboxbreadth\maxdimen\showboxdepth\maxdimen
-}%
-
-%---------------------Begin change-----------------------
-%
-%%%% For @cropmarks command.
-% Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986
-%
-\newdimen\cornerlong \newdimen\cornerthick
-\newdimen \topandbottommargin
-\newdimen \outerhsize \newdimen \outervsize
-\cornerlong=1pc\cornerthick=.3pt % These set size of cropmarks
-\outerhsize=7in
-%\outervsize=9.5in
-% Alternative @smallbook page size is 9.25in
-\outervsize=9.25in
-\topandbottommargin=.75in
-%
-%---------------------End change-----------------------
-
-% \onepageout takes a vbox as an argument. Note that \pagecontents
-% does insertions, but you have to call it yourself.
-\chardef\PAGE=255 \output={\onepageout{\pagecontents\PAGE}}
-\def\onepageout#1{%
- \hoffset=\normaloffset
- \ifodd\pageno \advance\hoffset by \bindingoffset
- \else \advance\hoffset by -\bindingoffset\fi
- {%
- \escapechar = `\\ % use backslash in output files.
- \indexdummies
- \shipout\vbox{%
- {\let\hsize=\pagewidth \makeheadline}%
- \pagebody{#1}%
- {\let\hsize=\pagewidth \makefootline}%
- }%
- }%
- \advancepageno
- \ifnum\outputpenalty>-20000 \else\dosupereject\fi
-}
-
-%%%% For @cropmarks command %%%%
-
-% Here is a modification of the main output routine for Near East Publications
-% This provides right-angle cropmarks at all four corners.
-% The contents of the page are centerlined into the cropmarks,
-% and any desired binding offset is added as an \hskip on either
-% site of the centerlined box. (P. A. MacKay, 12 November, 1986)
-%
-\def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up
-{\escapechar=`\\\relax % makes sure backslash is used in output files.
- \shipout
- \vbox to \outervsize{\hsize=\outerhsize
- \vbox{\line{\ewtop\hfill\ewtop}}
- \nointerlineskip
- \line{\vbox{\moveleft\cornerthick\nstop}
- \hfill
- \vbox{\moveright\cornerthick\nstop}}
- \vskip \topandbottommargin
- \centerline{\ifodd\pageno\hskip\bindingoffset\fi
- \vbox{
- {\let\hsize=\pagewidth \makeheadline}
- \pagebody{#1}
- {\let\hsize=\pagewidth \makefootline}}
- \ifodd\pageno\else\hskip\bindingoffset\fi}
- \vskip \topandbottommargin plus1fill minus1fill
- \boxmaxdepth\cornerthick
- \line{\vbox{\moveleft\cornerthick\nsbot}
- \hfill
- \vbox{\moveright\cornerthick\nsbot}}
- \nointerlineskip
- \vbox{\line{\ewbot\hfill\ewbot}}
- }}
- \advancepageno
- \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
-%
-% Do @cropmarks to get crop marks
-\def\cropmarks{\let\onepageout=\croppageout }
-
-\newinsert\margin \dimen\margin=\maxdimen
-
-\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
-{\catcode`\@ =11
-\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
-% marginal hacks, juha@viisa.uucp (Juha Takala)
-\ifvoid\margin\else % marginal info is present
- \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
-\dimen@=\dp#1 \unvbox#1
-\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
-\ifr@ggedbottom \kern-\dimen@ \vfil \fi}
-}
-
-%
-% Here are the rules for the cropmarks. Note that they are
-% offset so that the space between them is truly \outerhsize or \outervsize
-% (P. A. MacKay, 12 November, 1986)
-%
-\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
-\def\nstop{\vbox
- {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
-\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
-\def\nsbot{\vbox
- {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
-
-% Parse an argument, then pass it to #1. The argument is the rest of
-% the input line (except we remove a trailing comment). #1 should be a
-% macro which expects an ordinary undelimited TeX argument.
-%
-\def\parsearg#1{%
- \let\next = #1%
- \begingroup
- \obeylines
- \futurelet\temp\parseargx
-}
-
-% If the next token is an obeyed space (from an @example environment or
-% the like), remove it and recurse. Otherwise, we're done.
-\def\parseargx{%
- % \obeyedspace is defined far below, after the definition of \sepspaces.
- \ifx\obeyedspace\temp
- \expandafter\parseargdiscardspace
- \else
- \expandafter\parseargline
- \fi
-}
-
-% Remove a single space (as the delimiter token to the macro call).
-{\obeyspaces %
- \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
-
-{\obeylines %
- \gdef\parseargline#1^^M{%
- \endgroup % End of the group started in \parsearg.
- %
- % First remove any @c comment, then any @comment.
- % Result of each macro is put in \toks0.
- \argremovec #1\c\relax %
- \expandafter\argremovecomment \the\toks0 \comment\relax %
- %
- % Call the caller's macro, saved as \next in \parsearg.
- \expandafter\next\expandafter{\the\toks0}%
- }%
-}
-
-% Since all \c{,omment} does is throw away the argument, we can let TeX
-% do that for us. The \relax here is matched by the \relax in the call
-% in \parseargline; it could be more or less anything, its purpose is
-% just to delimit the argument to the \c.
-\def\argremovec#1\c#2\relax{\toks0 = {#1}}
-\def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
-
-% \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
-% @end itemize @c foo
-% will have two active spaces as part of the argument with the
-% `itemize'. Here we remove all active spaces from #1, and assign the
-% result to \toks0.
-%
-% This loses if there are any *other* active characters besides spaces
-% in the argument -- _ ^ +, for example -- since they get expanded.
-% Fortunately, Texinfo does not define any such commands. (If it ever
-% does, the catcode of the characters in questionwill have to be changed
-% here.) But this means we cannot call \removeactivespaces as part of
-% \argremovec{,omment}, since @c uses \parsearg, and thus the argument
-% that \parsearg gets might well have any character at all in it.
-%
-\def\removeactivespaces#1{%
- \begingroup
- \ignoreactivespaces
- \edef\temp{#1}%
- \global\toks0 = \expandafter{\temp}%
- \endgroup
-}
-
-% Change the active space to expand to nothing.
-%
-\begingroup
- \obeyspaces
- \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
-\endgroup
-
-
-\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
-
-%% These are used to keep @begin/@end levels from running away
-%% Call \inENV within environments (after a \begingroup)
-\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
-\def\ENVcheck{%
-\ifENV\errmessage{Still within an environment. Type Return to continue.}
-\endgroup\fi} % This is not perfect, but it should reduce lossage
-
-% @begin foo is the same as @foo, for now.
-\newhelp\EMsimple{Type <Return> to continue.}
-
-\outer\def\begin{\parsearg\beginxxx}
-
-\def\beginxxx #1{%
-\expandafter\ifx\csname #1\endcsname\relax
-{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
-\csname #1\endcsname\fi}
-
-% @end foo executes the definition of \Efoo.
-%
-\def\end{\parsearg\endxxx}
-\def\endxxx #1{%
- \removeactivespaces{#1}%
- \edef\endthing{\the\toks0}%
- %
- \expandafter\ifx\csname E\endthing\endcsname\relax
- \expandafter\ifx\csname \endthing\endcsname\relax
- % There's no \foo, i.e., no ``environment'' foo.
- \errhelp = \EMsimple
- \errmessage{Undefined command `@end \endthing'}%
- \else
- \unmatchedenderror\endthing
- \fi
- \else
- % Everything's ok; the right environment has been started.
- \csname E\endthing\endcsname
- \fi
-}
-
-% There is an environment #1, but it hasn't been started. Give an error.
-%
-\def\unmatchedenderror#1{%
- \errhelp = \EMsimple
- \errmessage{This `@end #1' doesn't have a matching `@#1'}%
-}
-
-% Define the control sequence \E#1 to give an unmatched @end error.
-%
-\def\defineunmatchedend#1{%
- \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
-}
-
-
-% Single-spacing is done by various environments (specifically, in
-% \nonfillstart and \quotations).
-\newskip\singlespaceskip \singlespaceskip = 12.5pt
-\def\singlespace{%
- % Why was this kern here? It messes up equalizing space above and below
- % environments. --karl, 6may93
- %{\advance \baselineskip by -\singlespaceskip
- %\kern \baselineskip}%
- \setleading \singlespaceskip
-}
-
-%% Simple single-character @ commands
-
-% @@ prints an @
-% Kludge this until the fonts are right (grr).
-\def\@{{\tt \char '100}}
-
-% This is turned off because it was never documented
-% and you can use @w{...} around a quote to suppress ligatures.
-%% Define @` and @' to be the same as ` and '
-%% but suppressing ligatures.
-%\def\`{{`}}
-%\def\'{{'}}
-
-% Used to generate quoted braces.
-\def\mylbrace {{\tt \char '173}}
-\def\myrbrace {{\tt \char '175}}
-\let\{=\mylbrace
-\let\}=\myrbrace
-\begingroup
- % Definitions to produce actual \{ & \} command in an index.
- \catcode`\{ = 12 \catcode`\} = 12
- \catcode`\[ = 1 \catcode`\] = 2
- \catcode`\@ = 0 \catcode`\\ = 12
- @gdef@lbracecmd[\{]%
- @gdef@rbracecmd[\}]%
-@endgroup
-
-% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
-% Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H.
-\let\, = \c
-\let\dotaccent = \.
-\def\ringaccent#1{{\accent23 #1}}
-\let\tieaccent = \t
-\let\ubaraccent = \b
-\let\udotaccent = \d
-
-% Other special characters: @questiondown @exclamdown
-% Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss.
-\def\questiondown{?`}
-\def\exclamdown{!`}
-
-% Dotless i and dotless j, used for accents.
-\def\imacro{i}
-\def\jmacro{j}
-\def\dotless#1{%
- \def\temp{#1}%
- \ifx\temp\imacro \ptexi
- \else\ifx\temp\jmacro \j
- \else \errmessage{@dotless can be used only with i or j}%
- \fi\fi
-}
-
-% @: forces normal size whitespace following.
-\def\:{\spacefactor=1000 }
-
-% @* forces a line break.
-\def\*{\hfil\break\hbox{}\ignorespaces}
-
-% @. is an end-of-sentence period.
-\def\.{.\spacefactor=3000 }
-
-% @enddots{} is an end-of-sentence ellipsis.
-\gdef\enddots{$\mathinner{\ldotp\ldotp\ldotp\ldotp}$\spacefactor=3000}
-
-% @! is an end-of-sentence bang.
-\gdef\!{!\spacefactor=3000 }
-
-% @? is an end-of-sentence query.
-\gdef\?{?\spacefactor=3000 }
-
-% @w prevents a word break. Without the \leavevmode, @w at the
-% beginning of a paragraph, when TeX is still in vertical mode, would
-% produce a whole line of output instead of starting the paragraph.
-\def\w#1{\leavevmode\hbox{#1}}
-
-% @group ... @end group forces ... to be all on one page, by enclosing
-% it in a TeX vbox. We use \vtop instead of \vbox to construct the box
-% to keep its height that of a normal line. According to the rules for
-% \topskip (p.114 of the TeXbook), the glue inserted is
-% max (\topskip - \ht (first item), 0). If that height is large,
-% therefore, no glue is inserted, and the space between the headline and
-% the text is small, which looks bad.
-%
-\def\group{\begingroup
- \ifnum\catcode13=\active \else
- \errhelp = \groupinvalidhelp
- \errmessage{@group invalid in context where filling is enabled}%
- \fi
- %
- % The \vtop we start below produces a box with normal height and large
- % depth; thus, TeX puts \baselineskip glue before it, and (when the
- % next line of text is done) \lineskip glue after it. (See p.82 of
- % the TeXbook.) Thus, space below is not quite equal to space
- % above. But it's pretty close.
- \def\Egroup{%
- \egroup % End the \vtop.
- \endgroup % End the \group.
- }%
- %
- \vtop\bgroup
- % We have to put a strut on the last line in case the @group is in
- % the midst of an example, rather than completely enclosing it.
- % Otherwise, the interline space between the last line of the group
- % and the first line afterwards is too small. But we can't put the
- % strut in \Egroup, since there it would be on a line by itself.
- % Hence this just inserts a strut at the beginning of each line.
- \everypar = {\strut}%
- %
- % Since we have a strut on every line, we don't need any of TeX's
- % normal interline spacing.
- \offinterlineskip
- %
- % OK, but now we have to do something about blank
- % lines in the input in @example-like environments, which normally
- % just turn into \lisppar, which will insert no space now that we've
- % turned off the interline space. Simplest is to make them be an
- % empty paragraph.
- \ifx\par\lisppar
- \edef\par{\leavevmode \par}%
- %
- % Reset ^^M's definition to new definition of \par.
- \obeylines
- \fi
- %
- % Do @comment since we are called inside an environment such as
- % @example, where each end-of-line in the input causes an
- % end-of-line in the output. We don't want the end-of-line after
- % the `@group' to put extra space in the output. Since @group
- % should appear on a line by itself (according to the Texinfo
- % manual), we don't worry about eating any user text.
- \comment
-}
-%
-% TeX puts in an \escapechar (i.e., `@') at the beginning of the help
-% message, so this ends up printing `@group can only ...'.
-%
-\newhelp\groupinvalidhelp{%
-group can only be used in environments such as @example,^^J%
-where each line of input produces a line of output.}
-
-% @need space-in-mils
-% forces a page break if there is not space-in-mils remaining.
-
-\newdimen\mil \mil=0.001in
-
-\def\need{\parsearg\needx}
-
-% Old definition--didn't work.
-%\def\needx #1{\par %
-%% This method tries to make TeX break the page naturally
-%% if the depth of the box does not fit.
-%{\baselineskip=0pt%
-%\vtop to #1\mil{\vfil}\kern -#1\mil\penalty 10000
-%\prevdepth=-1000pt
-%}}
-
-\def\needx#1{%
- % Go into vertical mode, so we don't make a big box in the middle of a
- % paragraph.
- \par
- %
- % Don't add any leading before our big empty box, but allow a page
- % break, since the best break might be right here.
- \allowbreak
- \nointerlineskip
- \vtop to #1\mil{\vfil}%
- %
- % TeX does not even consider page breaks if a penalty added to the
- % main vertical list is 10000 or more. But in order to see if the
- % empty box we just added fits on the page, we must make it consider
- % page breaks. On the other hand, we don't want to actually break the
- % page after the empty box. So we use a penalty of 9999.
- %
- % There is an extremely small chance that TeX will actually break the
- % page at this \penalty, if there are no other feasible breakpoints in
- % sight. (If the user is using lots of big @group commands, which
- % almost-but-not-quite fill up a page, TeX will have a hard time doing
- % good page breaking, for example.) However, I could not construct an
- % example where a page broke at this \penalty; if it happens in a real
- % document, then we can reconsider our strategy.
- \penalty9999
- %
- % Back up by the size of the box, whether we did a page break or not.
- \kern -#1\mil
- %
- % Do not allow a page break right after this kern.
- \nobreak
-}
-
-% @br forces paragraph break
-
-\let\br = \par
-
-% @dots{} output some dots
-
-\def\dots{$\ldots$}
-
-% @page forces the start of a new page
-
-\def\page{\par\vfill\supereject}
-
-% @exdent text....
-% outputs text on separate line in roman font, starting at standard page margin
-
-% This records the amount of indent in the innermost environment.
-% That's how much \exdent should take out.
-\newskip\exdentamount
-
-% This defn is used inside fill environments such as @defun.
-\def\exdent{\parsearg\exdentyyy}
-\def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
-
-% This defn is used inside nofill environments such as @example.
-\def\nofillexdent{\parsearg\nofillexdentyyy}
-\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
-\leftline{\hskip\leftskip{\rm#1}}}}
-
-% @inmargin{TEXT} puts TEXT in the margin next to the current paragraph.
-
-\def\inmargin#1{%
-\strut\vadjust{\nobreak\kern-\strutdepth
- \vtop to \strutdepth{\baselineskip\strutdepth\vss
- \llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}}
-\newskip\inmarginspacing \inmarginspacing=1cm
-\def\strutdepth{\dp\strutbox}
-
-%\hbox{{\rm#1}}\hfil\break}}
-
-% @include file insert text of that file as input.
-% Allow normal characters that we make active in the argument (a file name).
-\def\include{\begingroup
- \catcode`\\=12
- \catcode`~=12
- \catcode`^=12
- \catcode`_=12
- \catcode`|=12
- \catcode`<=12
- \catcode`>=12
- \catcode`+=12
- \parsearg\includezzz}
-% Restore active chars for included file.
-\def\includezzz#1{\endgroup\begingroup
- % Read the included file in a group so nested @include's work.
- \def\thisfile{#1}%
- \input\thisfile
-\endgroup}
-
-\def\thisfile{}
-
-% @center line outputs that line, centered
-
-\def\center{\parsearg\centerzzz}
-\def\centerzzz #1{{\advance\hsize by -\leftskip
-\advance\hsize by -\rightskip
-\centerline{#1}}}
-
-% @sp n outputs n lines of vertical space
-
-\def\sp{\parsearg\spxxx}
-\def\spxxx #1{\vskip #1\baselineskip}
-
-% @comment ...line which is ignored...
-% @c is the same as @comment
-% @ignore ... @end ignore is another way to write a comment
-
-\def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other%
-\parsearg \commentxxx}
-
-\def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 }
-
-\let\c=\comment
-
-% @paragraphindent is defined for the Info formatting commands only.
-\let\paragraphindent=\comment
-
-% Prevent errors for section commands.
-% Used in @ignore and in failing conditionals.
-\def\ignoresections{%
-\let\chapter=\relax
-\let\unnumbered=\relax
-\let\top=\relax
-\let\unnumberedsec=\relax
-\let\unnumberedsection=\relax
-\let\unnumberedsubsec=\relax
-\let\unnumberedsubsection=\relax
-\let\unnumberedsubsubsec=\relax
-\let\unnumberedsubsubsection=\relax
-\let\section=\relax
-\let\subsec=\relax
-\let\subsubsec=\relax
-\let\subsection=\relax
-\let\subsubsection=\relax
-\let\appendix=\relax
-\let\appendixsec=\relax
-\let\appendixsection=\relax
-\let\appendixsubsec=\relax
-\let\appendixsubsection=\relax
-\let\appendixsubsubsec=\relax
-\let\appendixsubsubsection=\relax
-\let\contents=\relax
-\let\smallbook=\relax
-\let\titlepage=\relax
-}
-
-% Used in nested conditionals, where we have to parse the Texinfo source
-% and so want to turn off most commands, in case they are used
-% incorrectly.
-%
-\def\ignoremorecommands{%
- \let\defcodeindex = \relax
- \let\defcv = \relax
- \let\deffn = \relax
- \let\deffnx = \relax
- \let\defindex = \relax
- \let\defivar = \relax
- \let\defmac = \relax
- \let\defmethod = \relax
- \let\defop = \relax
- \let\defopt = \relax
- \let\defspec = \relax
- \let\deftp = \relax
- \let\deftypefn = \relax
- \let\deftypefun = \relax
- \let\deftypevar = \relax
- \let\deftypevr = \relax
- \let\defun = \relax
- \let\defvar = \relax
- \let\defvr = \relax
- \let\ref = \relax
- \let\xref = \relax
- \let\printindex = \relax
- \let\pxref = \relax
- \let\settitle = \relax
- \let\setchapternewpage = \relax
- \let\setchapterstyle = \relax
- \let\everyheading = \relax
- \let\evenheading = \relax
- \let\oddheading = \relax
- \let\everyfooting = \relax
- \let\evenfooting = \relax
- \let\oddfooting = \relax
- \let\headings = \relax
- \let\include = \relax
- \let\lowersections = \relax
- \let\down = \relax
- \let\raisesections = \relax
- \let\up = \relax
- \let\set = \relax
- \let\clear = \relax
- \let\item = \relax
-}
-
-% Ignore @ignore ... @end ignore.
-%
-\def\ignore{\doignore{ignore}}
-
-% Also ignore @ifinfo, @ifhtml, @html, @menu, and @direntry text.
-%
-\def\ifinfo{\doignore{ifinfo}}
-\def\ifhtml{\doignore{ifhtml}}
-\def\html{\doignore{html}}
-\def\menu{\doignore{menu}}
-\def\direntry{\doignore{direntry}}
-
-% Also ignore @macro ... @end macro. The user must run texi2dvi,
-% which runs makeinfo to do macro expansion. Ignore @unmacro, too.
-\def\macro{\doignore{macro}}
-\let\unmacro = \comment
-
-
-% @dircategory CATEGORY -- specify a category of the dir file
-% which this file should belong to. Ignore this in TeX.
-\let\dircategory = \comment
-
-% Ignore text until a line `@end #1'.
-%
-\def\doignore#1{\begingroup
- % Don't complain about control sequences we have declared \outer.
- \ignoresections
- %
- % Define a command to swallow text until we reach `@end #1'.
- \long\def\doignoretext##1\end #1{\enddoignore}%
- %
- % Make sure that spaces turn into tokens that match what \doignoretext wants.
- \catcode32 = 10
- %
- % And now expand that command.
- \doignoretext
-}
-
-% What we do to finish off ignored text.
-%
-\def\enddoignore{\endgroup\ignorespaces}%
-
-\newif\ifwarnedobs\warnedobsfalse
-\def\obstexwarn{%
- \ifwarnedobs\relax\else
- % We need to warn folks that they may have trouble with TeX 3.0.
- % This uses \immediate\write16 rather than \message to get newlines.
- \immediate\write16{}
- \immediate\write16{***WARNING*** for users of Unix TeX 3.0!}
- \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
- \immediate\write16{If you are running another version of TeX, relax.}
- \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
- \immediate\write16{ Then upgrade your TeX installation if you can.}
- \immediate\write16{ (See ftp://ftp.gnu.ai.mit.edu/pub/gnu/TeX.README.)}
- \immediate\write16{If you are stuck with version 3.0, run the}
- \immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
- \immediate\write16{ to use a workaround.}
- \immediate\write16{}
- \global\warnedobstrue
- \fi
-}
-
-% **In TeX 3.0, setting text in \nullfont hangs tex. For a
-% workaround (which requires the file ``dummy.tfm'' to be installed),
-% uncomment the following line:
-%%%%%\font\nullfont=dummy\let\obstexwarn=\relax
-
-% Ignore text, except that we keep track of conditional commands for
-% purposes of nesting, up to an `@end #1' command.
-%
-\def\nestedignore#1{%
- \obstexwarn
- % We must actually expand the ignored text to look for the @end
- % command, so that nested ignore constructs work. Thus, we put the
- % text into a \vbox and then do nothing with the result. To minimize
- % the change of memory overflow, we follow the approach outlined on
- % page 401 of the TeXbook: make the current font be a dummy font.
- %
- \setbox0 = \vbox\bgroup
- % Don't complain about control sequences we have declared \outer.
- \ignoresections
- %
- % Define `@end #1' to end the box, which will in turn undefine the
- % @end command again.
- \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
- %
- % We are going to be parsing Texinfo commands. Most cause no
- % trouble when they are used incorrectly, but some commands do
- % complicated argument parsing or otherwise get confused, so we
- % undefine them.
- %
- % We can't do anything about stray @-signs, unfortunately;
- % they'll produce `undefined control sequence' errors.
- \ignoremorecommands
- %
- % Set the current font to be \nullfont, a TeX primitive, and define
- % all the font commands to also use \nullfont. We don't use
- % dummy.tfm, as suggested in the TeXbook, because not all sites
- % might have that installed. Therefore, math mode will still
- % produce output, but that should be an extremely small amount of
- % stuff compared to the main input.
- %
- \nullfont
- \let\tenrm = \nullfont \let\tenit = \nullfont \let\tensl = \nullfont
- \let\tenbf = \nullfont \let\tentt = \nullfont \let\smallcaps = \nullfont
- \let\tensf = \nullfont
- % Similarly for index fonts (mostly for their use in
- % smallexample)
- \let\indrm = \nullfont \let\indit = \nullfont \let\indsl = \nullfont
- \let\indbf = \nullfont \let\indtt = \nullfont \let\indsc = \nullfont
- \let\indsf = \nullfont
- %
- % Don't complain when characters are missing from the fonts.
- \tracinglostchars = 0
- %
- % Don't bother to do space factor calculations.
- \frenchspacing
- %
- % Don't report underfull hboxes.
- \hbadness = 10000
- %
- % Do minimal line-breaking.
- \pretolerance = 10000
- %
- % Do not execute instructions in @tex
- \def\tex{\doignore{tex}}
-}
-
-% @set VAR sets the variable VAR to an empty value.
-% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
-%
-% Since we want to separate VAR from REST-OF-LINE (which might be
-% empty), we can't just use \parsearg; we have to insert a space of our
-% own to delimit the rest of the line, and then take it out again if we
-% didn't need it. Make sure the catcode of space is correct to avoid
-% losing inside @example, for instance.
-%
-\def\set{\begingroup\catcode` =10 \parsearg\setxxx}
-\def\setxxx#1{\setyyy#1 \endsetyyy}
-\def\setyyy#1 #2\endsetyyy{%
- \def\temp{#2}%
- \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
- \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
- \fi
- \endgroup
-}
-% Can't use \xdef to pre-expand #2 and save some time, since \temp or
-% \next or other control sequences that we've defined might get us into
-% an infinite loop. Consider `@set foo @cite{bar}'.
-\def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
-
-% @clear VAR clears (i.e., unsets) the variable VAR.
-%
-\def\clear{\parsearg\clearxxx}
-\def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
-
-% @value{foo} gets the text saved in variable foo.
-%
-\def\value#1{\expandafter
- \ifx\csname SET#1\endcsname\relax
- {\{No value for ``#1''\}}
- \else \csname SET#1\endcsname \fi}
-
-% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
-% with @set.
-%
-\def\ifset{\parsearg\ifsetxxx}
-\def\ifsetxxx #1{%
- \expandafter\ifx\csname SET#1\endcsname\relax
- \expandafter\ifsetfail
- \else
- \expandafter\ifsetsucceed
- \fi
-}
-\def\ifsetsucceed{\conditionalsucceed{ifset}}
-\def\ifsetfail{\nestedignore{ifset}}
-\defineunmatchedend{ifset}
-
-% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
-% defined with @set, or has been undefined with @clear.
-%
-\def\ifclear{\parsearg\ifclearxxx}
-\def\ifclearxxx #1{%
- \expandafter\ifx\csname SET#1\endcsname\relax
- \expandafter\ifclearsucceed
- \else
- \expandafter\ifclearfail
- \fi
-}
-\def\ifclearsucceed{\conditionalsucceed{ifclear}}
-\def\ifclearfail{\nestedignore{ifclear}}
-\defineunmatchedend{ifclear}
-
-% @iftex always succeeds; we read the text following, through @end
-% iftex). But `@end iftex' should be valid only after an @iftex.
-%
-\def\iftex{\conditionalsucceed{iftex}}
-\defineunmatchedend{iftex}
-
-% We can't just want to start a group at @iftex (for example) and end it
-% at @end iftex, since then @set commands inside the conditional have no
-% effect (they'd get reverted at the end of the group). So we must
-% define \Eiftex to redefine itself to be its previous value. (We can't
-% just define it to fail again with an ``unmatched end'' error, since
-% the @ifset might be nested.)
-%
-\def\conditionalsucceed#1{%
- \edef\temp{%
- % Remember the current value of \E#1.
- \let\nece{prevE#1} = \nece{E#1}%
- %
- % At the `@end #1', redefine \E#1 to be its previous value.
- \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
- }%
- \temp
-}
-
-% We need to expand lots of \csname's, but we don't want to expand the
-% control sequences after we've constructed them.
-%
-\def\nece#1{\expandafter\noexpand\csname#1\endcsname}
-
-% @asis just yields its argument. Used with @table, for example.
-%
-\def\asis#1{#1}
-
-% @math means output in math mode.
-% We don't use $'s directly in the definition of \math because control
-% sequences like \math are expanded when the toc file is written. Then,
-% we read the toc file back, the $'s will be normal characters (as they
-% should be, according to the definition of Texinfo). So we must use a
-% control sequence to switch into and out of math mode.
-%
-% This isn't quite enough for @math to work properly in indices, but it
-% seems unlikely it will ever be needed there.
-%
-\let\implicitmath = $
-\def\math#1{\implicitmath #1\implicitmath}
-
-% @bullet and @minus need the same treatment as @math, just above.
-\def\bullet{\implicitmath\ptexbullet\implicitmath}
-\def\minus{\implicitmath-\implicitmath}
-
-\def\node{\ENVcheck\parsearg\nodezzz}
-\def\nodezzz#1{\nodexxx [#1,]}
-\def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
-\let\nwnode=\node
-\let\lastnode=\relax
-
-\def\donoderef{\ifx\lastnode\relax\else
-\expandafter\expandafter\expandafter\setref{\lastnode}\fi
-\global\let\lastnode=\relax}
-
-\def\unnumbnoderef{\ifx\lastnode\relax\else
-\expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
-\global\let\lastnode=\relax}
-
-\def\appendixnoderef{\ifx\lastnode\relax\else
-\expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi
-\global\let\lastnode=\relax}
-
-% @refill is a no-op.
-\let\refill=\relax
-
-% @setfilename is done at the beginning of every texinfo file.
-% So open here the files we need to have open while reading the input.
-% This makes it possible to make a .fmt file for texinfo.
-\def\setfilename{%
- \readauxfile
- \opencontents
- \openindices
- \fixbackslash % Turn off hack to swallow `\input texinfo'.
- \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
- \comment % Ignore the actual filename.
-}
-
-% @bye.
-\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
-
-% \def\macro#1{\begingroup\ignoresections\catcode`\#=6\def\macrotemp{#1}\parsearg\macroxxx}
-% \def\macroxxx#1#2 \end macro{%
-% \expandafter\gdef\macrotemp#1{#2}%
-% \endgroup}
-
-%\def\linemacro#1{\begingroup\ignoresections\catcode`\#=6\def\macrotemp{#1}\parsearg\linemacroxxx}
-%\def\linemacroxxx#1#2 \end linemacro{%
-%\let\parsearg=\relax
-%\edef\macrotempx{\csname M\butfirst\expandafter\string\macrotemp\endcsname}%
-%\expandafter\xdef\macrotemp{\parsearg\macrotempx}%
-%\expandafter\gdef\macrotempx#1{#2}%
-%\endgroup}
-
-%\def\butfirst#1{}
-
-
-\message{fonts,}
-
-% Font-change commands.
-
-% Texinfo supports the sans serif font style, which plain TeX does not.
-% So we set up a \sf analogous to plain's \rm, etc.
-\newfam\sffam
-\def\sf{\fam=\sffam \tensf}
-\let\li = \sf % Sometimes we call it \li, not \sf.
-
-% We don't need math for this one.
-\def\ttsl{\tenttsl}
-
-%% Try out Computer Modern fonts at \magstephalf
-\let\mainmagstep=\magstephalf
-
-% Set the font macro #1 to the font named #2, adding on the
-% specified font prefix (normally `cm').
-% #3 is the font's design size, #4 is a scale factor
-\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
-
-% Use cm as the default font prefix.
-% To specify the font prefix, you must define \fontprefix
-% before you read in texinfo.tex.
-\ifx\fontprefix\undefined
-\def\fontprefix{cm}
-\fi
-% Support font families that don't use the same naming scheme as CM.
-\def\rmshape{r}
-\def\rmbshape{bx} %where the normal face is bold
-\def\bfshape{b}
-\def\bxshape{bx}
-\def\ttshape{tt}
-\def\ttbshape{tt}
-\def\ttslshape{sltt}
-\def\itshape{ti}
-\def\itbshape{bxti}
-\def\slshape{sl}
-\def\slbshape{bxsl}
-\def\sfshape{ss}
-\def\sfbshape{ss}
-\def\scshape{csc}
-\def\scbshape{csc}
-
-\ifx\bigger\relax
-\let\mainmagstep=\magstep1
-\setfont\textrm\rmshape{12}{1000}
-\setfont\texttt\ttshape{12}{1000}
-\else
-\setfont\textrm\rmshape{10}{\mainmagstep}
-\setfont\texttt\ttshape{10}{\mainmagstep}
-\fi
-% Instead of cmb10, you many want to use cmbx10.
-% cmbx10 is a prettier font on its own, but cmb10
-% looks better when embedded in a line with cmr10.
-\setfont\textbf\bfshape{10}{\mainmagstep}
-\setfont\textit\itshape{10}{\mainmagstep}
-\setfont\textsl\slshape{10}{\mainmagstep}
-\setfont\textsf\sfshape{10}{\mainmagstep}
-\setfont\textsc\scshape{10}{\mainmagstep}
-\setfont\textttsl\ttslshape{10}{\mainmagstep}
-\font\texti=cmmi10 scaled \mainmagstep
-\font\textsy=cmsy10 scaled \mainmagstep
-
-% A few fonts for @defun, etc.
-\setfont\defbf\bxshape{10}{\magstep1} %was 1314
-\setfont\deftt\ttshape{10}{\magstep1}
-\def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
-
-% Fonts for indices and small examples (9pt).
-% We actually use the slanted font rather than the italic,
-% because texinfo normally uses the slanted fonts for that.
-% Do not make many font distinctions in general in the index, since they
-% aren't very useful.
-\setfont\ninett\ttshape{9}{1000}
-\setfont\indrm\rmshape{9}{1000}
-\setfont\indit\slshape{9}{1000}
-\let\indsl=\indit
-\let\indtt=\ninett
-\let\indttsl=\ninett
-\let\indsf=\indrm
-\let\indbf=\indrm
-\setfont\indsc\scshape{10}{900}
-\font\indi=cmmi9
-\font\indsy=cmsy9
-
-% Chapter (and unnumbered) fonts (17.28pt).
-\setfont\chaprm\rmbshape{12}{\magstep2}
-\setfont\chapit\itbshape{10}{\magstep3}
-\setfont\chapsl\slbshape{10}{\magstep3}
-\setfont\chaptt\ttbshape{12}{\magstep2}
-\setfont\chapttsl\ttslshape{10}{\magstep3}
-\setfont\chapsf\sfbshape{12}{\magstep2}
-\let\chapbf=\chaprm
-\setfont\chapsc\scbshape{10}{\magstep3}
-\font\chapi=cmmi12 scaled \magstep2
-\font\chapsy=cmsy10 scaled \magstep3
-
-% Section fonts (14.4pt).
-\setfont\secrm\rmbshape{12}{\magstep1}
-\setfont\secit\itbshape{10}{\magstep2}
-\setfont\secsl\slbshape{10}{\magstep2}
-\setfont\sectt\ttbshape{12}{\magstep1}
-\setfont\secttsl\ttslshape{10}{\magstep2}
-\setfont\secsf\sfbshape{12}{\magstep1}
-\let\secbf\secrm
-\setfont\secsc\scbshape{10}{\magstep2}
-\font\seci=cmmi12 scaled \magstep1
-\font\secsy=cmsy10 scaled \magstep2
-
-% \setfont\ssecrm\bxshape{10}{\magstep1} % This size an font looked bad.
-% \setfont\ssecit\itshape{10}{\magstep1} % The letters were too crowded.
-% \setfont\ssecsl\slshape{10}{\magstep1}
-% \setfont\ssectt\ttshape{10}{\magstep1}
-% \setfont\ssecsf\sfshape{10}{\magstep1}
-
-%\setfont\ssecrm\bfshape{10}{1315} % Note the use of cmb rather than cmbx.
-%\setfont\ssecit\itshape{10}{1315} % Also, the size is a little larger than
-%\setfont\ssecsl\slshape{10}{1315} % being scaled magstep1.
-%\setfont\ssectt\ttshape{10}{1315}
-%\setfont\ssecsf\sfshape{10}{1315}
-
-%\let\ssecbf=\ssecrm
-
-% Subsection fonts (13.15pt).
-\setfont\ssecrm\rmbshape{12}{\magstephalf}
-\setfont\ssecit\itbshape{10}{1315}
-\setfont\ssecsl\slbshape{10}{1315}
-\setfont\ssectt\ttbshape{12}{\magstephalf}
-\setfont\ssecttsl\ttslshape{10}{\magstep1}
-\setfont\ssecsf\sfbshape{12}{\magstephalf}
-\let\ssecbf\ssecrm
-\setfont\ssecsc\scbshape{10}{\magstep1}
-\font\sseci=cmmi12 scaled \magstephalf
-\font\ssecsy=cmsy10 scaled \magstep1
-% The smallcaps and symbol fonts should actually be scaled \magstep1.5,
-% but that is not a standard magnification.
-
-% Fonts for title page:
-\setfont\titlerm\rmbshape{12}{\magstep3}
-\let\authorrm = \secrm
-
-% In order for the font changes to affect most math symbols and letters,
-% we have to define the \textfont of the standard families. Since
-% texinfo doesn't allow for producing subscripts and superscripts, we
-% don't bother to reset \scriptfont and \scriptscriptfont (which would
-% also require loading a lot more fonts).
-%
-\def\resetmathfonts{%
- \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
- \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
- \textfont\ttfam = \tentt \textfont\sffam = \tensf
-}
-
-
-% The font-changing commands redefine the meanings of \tenSTYLE, instead
-% of just \STYLE. We do this so that font changes will continue to work
-% in math mode, where it is the current \fam that is relevant in most
-% cases, not the current font. Plain TeX does \def\bf{\fam=\bffam
-% \tenbf}, for example. By redefining \tenbf, we obviate the need to
-% redefine \bf itself.
-\def\textfonts{%
- \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
- \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
- \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
- \resetmathfonts}
-\def\chapfonts{%
- \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
- \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
- \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
- \resetmathfonts \setleading{19pt}}
-\def\secfonts{%
- \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
- \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
- \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
- \resetmathfonts \setleading{16pt}}
-\def\subsecfonts{%
- \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
- \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
- \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
- \resetmathfonts \setleading{15pt}}
-\let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
-\def\indexfonts{%
- \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
- \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
- \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy \let\tenttsl=\indttsl
- \resetmathfonts \setleading{12pt}}
-
-% Set up the default fonts, so we can use them for creating boxes.
-%
-\textfonts
-
-% Count depth in font-changes, for error checks
-\newcount\fontdepth \fontdepth=0
-
-% Fonts for short table of contents.
-\setfont\shortcontrm\rmshape{12}{1000}
-\setfont\shortcontbf\bxshape{12}{1000}
-\setfont\shortcontsl\slshape{12}{1000}
-
-%% Add scribe-like font environments, plus @l for inline lisp (usually sans
-%% serif) and @ii for TeX italic
-
-% \smartitalic{ARG} outputs arg in italics, followed by an italic correction
-% unless the following character is such as not to need one.
-\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
-\def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
-
-\let\i=\smartitalic
-\let\var=\smartitalic
-\let\dfn=\smartitalic
-\let\emph=\smartitalic
-\let\cite=\smartitalic
-
-\def\b#1{{\bf #1}}
-\let\strong=\b
-
-% We can't just use \exhyphenpenalty, because that only has effect at
-% the end of a paragraph. Restore normal hyphenation at the end of the
-% group within which \nohyphenation is presumably called.
-%
-\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
-\def\restorehyphenation{\hyphenchar\font = `- }
-
-\def\t#1{%
- {\tt \rawbackslash \frenchspacing #1}%
- \null
-}
-\let\ttfont=\t
-\def\samp #1{`\tclose{#1}'\null}
-\setfont\smallrm\rmshape{8}{1000}
-\font\smallsy=cmsy9
-\def\key#1{{\smallrm\textfont2=\smallsy \leavevmode\hbox{%
- \raise0.4pt\hbox{$\langle$}\kern-.08em\vtop{%
- \vbox{\hrule\kern-0.4pt
- \hbox{\raise0.4pt\hbox{\vphantom{$\langle$}}#1}}%
- \kern-0.4pt\hrule}%
- \kern-.06em\raise0.4pt\hbox{$\rangle$}}}}
-% The old definition, with no lozenge:
-%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
-\def\ctrl #1{{\tt \rawbackslash \hat}#1}
-
-\let\file=\samp
-\let\url=\samp % perhaps include a hypertex \special eventually
-\def\email#1{$\langle${\tt #1}$\rangle$}
-
-% @code is a modification of @t,
-% which makes spaces the same size as normal in the surrounding text.
-\def\tclose#1{%
- {%
- % Change normal interword space to be same as for the current font.
- \spaceskip = \fontdimen2\font
- %
- % Switch to typewriter.
- \tt
- %
- % But `\ ' produces the large typewriter interword space.
- \def\ {{\spaceskip = 0pt{} }}%
- %
- % Turn off hyphenation.
- \nohyphenation
- %
- \rawbackslash
- \frenchspacing
- #1%
- }%
- \null
-}
-
-% We *must* turn on hyphenation at `-' and `_' in \code.
-% Otherwise, it is too hard to avoid overfull hboxes
-% in the Emacs manual, the Library manual, etc.
-
-% Unfortunately, TeX uses one parameter (\hyphenchar) to control
-% both hyphenation at - and hyphenation within words.
-% We must therefore turn them both off (\tclose does that)
-% and arrange explicitly to hyphenate at a dash.
-% -- rms.
-{
-\catcode`\-=\active
-\catcode`\_=\active
-\global\def\code{\begingroup \catcode`\-=\active \let-\codedash \catcode`\_=\active \let_\codeunder \codex}
-% The following is used by \doprintindex to insure that long function names
-% wrap around. It is necessary for - and _ to be active before the index is
-% read from the file, as \entry parses the arguments long before \code is
-% ever called. -- mycroft
-\global\def\indexbreaks{\catcode`\-=\active \let-\realdash \catcode`\_=\active \let_\realunder}
-}
-
-\def\realdash{-}
-\def\realunder{_}
-\def\codedash{-\discretionary{}{}{}}
-\def\codeunder{\normalunderscore\discretionary{}{}{}}
-\def\codex #1{\tclose{#1}\endgroup}
-
-%\let\exp=\tclose %Was temporary
-
-% @kbd is like @code, except that if the argument is just one @key command,
-% then @kbd has no effect.
-%
-\def\xkey{\key}
-\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
-\ifx\one\xkey\ifx\threex\three \key{#2}%
-\else{\tclose{\ttsl\look}}\fi
-\else{\tclose{\ttsl\look}}\fi}
-
-% Check if we are currently using a typewriter font. Since all the
-% Computer Modern typewriter fonts have zero interword stretch (and
-% shrink), and it is reasonable to expect all typewriter fonts to have
-% this property, we can check that font parameter.
-%
-\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
-
-% Typeset a dimension, e.g., `in' or `pt'. The only reason for the
-% argument is to make the input look right: @dmn{pt} instead of
-% @dmn{}pt.
-%
-\def\dmn#1{\thinspace #1}
-
-\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
-
-% @l was never documented to mean ``switch to the Lisp font'',
-% and it is not used as such in any manual I can find. We need it for
-% Polish suppressed-l. --karl, 22sep96.
-%\def\l#1{{\li #1}\null}
-
-\def\r#1{{\rm #1}} % roman font
-% Use of \lowercase was suggested.
-\def\sc#1{{\smallcaps#1}} % smallcaps font
-\def\ii#1{{\it #1}} % italic font
-
-% @pounds{} is a sterling sign.
-\def\pounds{{\it\$}}
-
-
-\message{page headings,}
-
-\newskip\titlepagetopglue \titlepagetopglue = 1.5in
-\newskip\titlepagebottomglue \titlepagebottomglue = 2pc
-
-% First the title page. Must do @settitle before @titlepage.
-\def\titlefont#1{{\titlerm #1}}
-
-\newif\ifseenauthor
-\newif\iffinishedtitlepage
-
-\def\shorttitlepage{\parsearg\shorttitlepagezzz}
-\def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
- \endgroup\page\hbox{}\page}
-
-\def\titlepage{\begingroup \parindent=0pt \textfonts
- \let\subtitlerm=\tenrm
-% I deinstalled the following change because \cmr12 is undefined.
-% This change was not in the ChangeLog anyway. --rms.
-% \let\subtitlerm=\cmr12
- \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
- %
- \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
- %
- % Leave some space at the very top of the page.
- \vglue\titlepagetopglue
- %
- % Now you can print the title using @title.
- \def\title{\parsearg\titlezzz}%
- \def\titlezzz##1{\leftline{\titlefont{##1}}
- % print a rule at the page bottom also.
- \finishedtitlepagefalse
- \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
- % No rule at page bottom unless we print one at the top with @title.
- \finishedtitlepagetrue
- %
- % Now you can put text using @subtitle.
- \def\subtitle{\parsearg\subtitlezzz}%
- \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
- %
- % @author should come last, but may come many times.
- \def\author{\parsearg\authorzzz}%
- \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
- {\authorfont \leftline{##1}}}%
- %
- % Most title ``pages'' are actually two pages long, with space
- % at the top of the second. We don't want the ragged left on the second.
- \let\oldpage = \page
- \def\page{%
- \iffinishedtitlepage\else
- \finishtitlepage
- \fi
- \oldpage
- \let\page = \oldpage
- \hbox{}}%
-% \def\page{\oldpage \hbox{}}
-}
-
-\def\Etitlepage{%
- \iffinishedtitlepage\else
- \finishtitlepage
- \fi
- % It is important to do the page break before ending the group,
- % because the headline and footline are only empty inside the group.
- % If we use the new definition of \page, we always get a blank page
- % after the title page, which we certainly don't want.
- \oldpage
- \endgroup
- \HEADINGSon
-}
-
-\def\finishtitlepage{%
- \vskip4pt \hrule height 2pt width \hsize
- \vskip\titlepagebottomglue
- \finishedtitlepagetrue
-}
-
-%%% Set up page headings and footings.
-
-\let\thispage=\folio
-
-\newtoks \evenheadline % Token sequence for heading line of even pages
-\newtoks \oddheadline % Token sequence for heading line of odd pages
-\newtoks \evenfootline % Token sequence for footing line of even pages
-\newtoks \oddfootline % Token sequence for footing line of odd pages
-
-% Now make Tex use those variables
-\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
- \else \the\evenheadline \fi}}
-\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
- \else \the\evenfootline \fi}\HEADINGShook}
-\let\HEADINGShook=\relax
-
-% Commands to set those variables.
-% For example, this is what @headings on does
-% @evenheading @thistitle|@thispage|@thischapter
-% @oddheading @thischapter|@thispage|@thistitle
-% @evenfooting @thisfile||
-% @oddfooting ||@thisfile
-
-\def\evenheading{\parsearg\evenheadingxxx}
-\def\oddheading{\parsearg\oddheadingxxx}
-\def\everyheading{\parsearg\everyheadingxxx}
-
-\def\evenfooting{\parsearg\evenfootingxxx}
-\def\oddfooting{\parsearg\oddfootingxxx}
-\def\everyfooting{\parsearg\everyfootingxxx}
-
-{\catcode`\@=0 %
-
-\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
-\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
-\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
-
-\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
-\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
-\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
-
-\gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish}
-\gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{%
-\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
-\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
-
-\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
-\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
-\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
-
-\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
-\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
-\global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
-
-\gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish}
-\gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{%
-\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
-\global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
-%
-}% unbind the catcode of @.
-
-% @headings double turns headings on for double-sided printing.
-% @headings single turns headings on for single-sided printing.
-% @headings off turns them off.
-% @headings on same as @headings double, retained for compatibility.
-% @headings after turns on double-sided headings after this page.
-% @headings doubleafter turns on double-sided headings after this page.
-% @headings singleafter turns on single-sided headings after this page.
-% By default, they are off at the start of a document,
-% and turned `on' after @end titlepage.
-
-\def\headings #1 {\csname HEADINGS#1\endcsname}
-
-\def\HEADINGSoff{
-\global\evenheadline={\hfil} \global\evenfootline={\hfil}
-\global\oddheadline={\hfil} \global\oddfootline={\hfil}}
-\HEADINGSoff
-% When we turn headings on, set the page number to 1.
-% For double-sided printing, put current file name in lower left corner,
-% chapter name on inside top of right hand pages, document
-% title on inside top of left hand pages, and page numbers on outside top
-% edge of all pages.
-\def\HEADINGSdouble{
-\global\pageno=1
-\global\evenfootline={\hfil}
-\global\oddfootline={\hfil}
-\global\evenheadline={\line{\folio\hfil\thistitle}}
-\global\oddheadline={\line{\thischapter\hfil\folio}}
-\global\let\contentsalignmacro = \chapoddpage
-}
-\let\contentsalignmacro = \chappager
-
-% For single-sided printing, chapter title goes across top left of page,
-% page number on top right.
-\def\HEADINGSsingle{
-\global\pageno=1
-\global\evenfootline={\hfil}
-\global\oddfootline={\hfil}
-\global\evenheadline={\line{\thischapter\hfil\folio}}
-\global\oddheadline={\line{\thischapter\hfil\folio}}
-\global\let\contentsalignmacro = \chappager
-}
-\def\HEADINGSon{\HEADINGSdouble}
-
-\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
-\let\HEADINGSdoubleafter=\HEADINGSafter
-\def\HEADINGSdoublex{%
-\global\evenfootline={\hfil}
-\global\oddfootline={\hfil}
-\global\evenheadline={\line{\folio\hfil\thistitle}}
-\global\oddheadline={\line{\thischapter\hfil\folio}}
-\global\let\contentsalignmacro = \chapoddpage
-}
-
-\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
-\def\HEADINGSsinglex{%
-\global\evenfootline={\hfil}
-\global\oddfootline={\hfil}
-\global\evenheadline={\line{\thischapter\hfil\folio}}
-\global\oddheadline={\line{\thischapter\hfil\folio}}
-\global\let\contentsalignmacro = \chappager
-}
-
-% Subroutines used in generating headings
-% Produces Day Month Year style of output.
-\def\today{\number\day\space
-\ifcase\month\or
-January\or February\or March\or April\or May\or June\or
-July\or August\or September\or October\or November\or December\fi
-\space\number\year}
-
-% Use this if you want the Month Day, Year style of output.
-%\def\today{\ifcase\month\or
-%January\or February\or March\or April\or May\or June\or
-%July\or August\or September\or October\or November\or December\fi
-%\space\number\day, \number\year}
-
-% @settitle line... specifies the title of the document, for headings
-% It generates no output of its own
-
-\def\thistitle{No Title}
-\def\settitle{\parsearg\settitlezzz}
-\def\settitlezzz #1{\gdef\thistitle{#1}}
-
-
-\message{tables,}
-
-% @tabs -- simple alignment
-
-% These don't work. For one thing, \+ is defined as outer.
-% So these macros cannot even be defined.
-
-%\def\tabs{\parsearg\tabszzz}
-%\def\tabszzz #1{\settabs\+#1\cr}
-%\def\tabline{\parsearg\tablinezzz}
-%\def\tablinezzz #1{\+#1\cr}
-%\def\&{&}
-
-% Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
-
-% default indentation of table text
-\newdimen\tableindent \tableindent=.8in
-% default indentation of @itemize and @enumerate text
-\newdimen\itemindent \itemindent=.3in
-% margin between end of table item and start of table text.
-\newdimen\itemmargin \itemmargin=.1in
-
-% used internally for \itemindent minus \itemmargin
-\newdimen\itemmax
-
-% Note @table, @vtable, and @vtable define @item, @itemx, etc., with
-% these defs.
-% They also define \itemindex
-% to index the item name in whatever manner is desired (perhaps none).
-
-\newif\ifitemxneedsnegativevskip
-
-\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
-
-\def\internalBitem{\smallbreak \parsearg\itemzzz}
-\def\internalBitemx{\itemxpar \parsearg\itemzzz}
-
-\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
-\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
-
-\def\internalBkitem{\smallbreak \parsearg\kitemzzz}
-\def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
-
-\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
- \itemzzz {#1}}
-
-\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
- \itemzzz {#1}}
-
-\def\itemzzz #1{\begingroup %
- \advance\hsize by -\rightskip
- \advance\hsize by -\tableindent
- \setbox0=\hbox{\itemfont{#1}}%
- \itemindex{#1}%
- \nobreak % This prevents a break before @itemx.
- %
- % Be sure we are not still in the middle of a paragraph.
- %{\parskip = 0in
- %\par
- %}%
- %
- % If the item text does not fit in the space we have, put it on a line
- % by itself, and do not allow a page break either before or after that
- % line. We do not start a paragraph here because then if the next
- % command is, e.g., @kindex, the whatsit would get put into the
- % horizontal list on a line by itself, resulting in extra blank space.
- \ifdim \wd0>\itemmax
- %
- % Make this a paragraph so we get the \parskip glue and wrapping,
- % but leave it ragged-right.
- \begingroup
- \advance\leftskip by-\tableindent
- \advance\hsize by\tableindent
- \advance\rightskip by0pt plus1fil
- \leavevmode\unhbox0\par
- \endgroup
- %
- % We're going to be starting a paragraph, but we don't want the
- % \parskip glue -- logically it's part of the @item we just started.
- \nobreak \vskip-\parskip
- %
- % Stop a page break at the \parskip glue coming up. Unfortunately
- % we can't prevent a possible page break at the following
- % \baselineskip glue.
- \nobreak
- \endgroup
- \itemxneedsnegativevskipfalse
- \else
- % The item text fits into the space. Start a paragraph, so that the
- % following text (if any) will end up on the same line. Since that
- % text will be indented by \tableindent, we make the item text be in
- % a zero-width box.
- \noindent
- \rlap{\hskip -\tableindent\box0}\ignorespaces%
- \endgroup%
- \itemxneedsnegativevskiptrue%
- \fi
-}
-
-\def\item{\errmessage{@item while not in a table}}
-\def\itemx{\errmessage{@itemx while not in a table}}
-\def\kitem{\errmessage{@kitem while not in a table}}
-\def\kitemx{\errmessage{@kitemx while not in a table}}
-\def\xitem{\errmessage{@xitem while not in a table}}
-\def\xitemx{\errmessage{@xitemx while not in a table}}
-
-%% Contains a kludge to get @end[description] to work
-\def\description{\tablez{\dontindex}{1}{}{}{}{}}
-
-\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
-{\obeylines\obeyspaces%
-\gdef\tablex #1^^M{%
-\tabley\dontindex#1 \endtabley}}
-
-\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
-{\obeylines\obeyspaces%
-\gdef\ftablex #1^^M{%
-\tabley\fnitemindex#1 \endtabley
-\def\Eftable{\endgraf\afterenvbreak\endgroup}%
-\let\Etable=\relax}}
-
-\def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
-{\obeylines\obeyspaces%
-\gdef\vtablex #1^^M{%
-\tabley\vritemindex#1 \endtabley
-\def\Evtable{\endgraf\afterenvbreak\endgroup}%
-\let\Etable=\relax}}
-
-\def\dontindex #1{}
-\def\fnitemindex #1{\doind {fn}{\code{#1}}}%
-\def\vritemindex #1{\doind {vr}{\code{#1}}}%
-
-{\obeyspaces %
-\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
-\tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
-
-\def\tablez #1#2#3#4#5#6{%
-\aboveenvbreak %
-\begingroup %
-\def\Edescription{\Etable}% Necessary kludge.
-\let\itemindex=#1%
-\ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
-\ifnum 0#4>0 \tableindent=#4\mil \fi %
-\ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
-\def\itemfont{#2}%
-\itemmax=\tableindent %
-\advance \itemmax by -\itemmargin %
-\advance \leftskip by \tableindent %
-\exdentamount=\tableindent
-\parindent = 0pt
-\parskip = \smallskipamount
-\ifdim \parskip=0pt \parskip=2pt \fi%
-\def\Etable{\endgraf\afterenvbreak\endgroup}%
-\let\item = \internalBitem %
-\let\itemx = \internalBitemx %
-\let\kitem = \internalBkitem %
-\let\kitemx = \internalBkitemx %
-\let\xitem = \internalBxitem %
-\let\xitemx = \internalBxitemx %
-}
-
-% This is the counter used by @enumerate, which is really @itemize
-
-\newcount \itemno
-
-\def\itemize{\parsearg\itemizezzz}
-
-\def\itemizezzz #1{%
- \begingroup % ended by the @end itemsize
- \itemizey {#1}{\Eitemize}
-}
-
-\def\itemizey #1#2{%
-\aboveenvbreak %
-\itemmax=\itemindent %
-\advance \itemmax by -\itemmargin %
-\advance \leftskip by \itemindent %
-\exdentamount=\itemindent
-\parindent = 0pt %
-\parskip = \smallskipamount %
-\ifdim \parskip=0pt \parskip=2pt \fi%
-\def#2{\endgraf\afterenvbreak\endgroup}%
-\def\itemcontents{#1}%
-\let\item=\itemizeitem}
-
-% Set sfcode to normal for the chars that usually have another value.
-% These are `.?!:;,'
-\def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
- \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
-
-% \splitoff TOKENS\endmark defines \first to be the first token in
-% TOKENS, and \rest to be the remainder.
-%
-\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
-
-% Allow an optional argument of an uppercase letter, lowercase letter,
-% or number, to specify the first label in the enumerated list. No
-% argument is the same as `1'.
-%
-\def\enumerate{\parsearg\enumeratezzz}
-\def\enumeratezzz #1{\enumeratey #1 \endenumeratey}
-\def\enumeratey #1 #2\endenumeratey{%
- \begingroup % ended by the @end enumerate
- %
- % If we were given no argument, pretend we were given `1'.
- \def\thearg{#1}%
- \ifx\thearg\empty \def\thearg{1}\fi
- %
- % Detect if the argument is a single token. If so, it might be a
- % letter. Otherwise, the only valid thing it can be is a number.
- % (We will always have one token, because of the test we just made.
- % This is a good thing, since \splitoff doesn't work given nothing at
- % all -- the first parameter is undelimited.)
- \expandafter\splitoff\thearg\endmark
- \ifx\rest\empty
- % Only one token in the argument. It could still be anything.
- % A ``lowercase letter'' is one whose \lccode is nonzero.
- % An ``uppercase letter'' is one whose \lccode is both nonzero, and
- % not equal to itself.
- % Otherwise, we assume it's a number.
- %
- % We need the \relax at the end of the \ifnum lines to stop TeX from
- % continuing to look for a <number>.
- %
- \ifnum\lccode\expandafter`\thearg=0\relax
- \numericenumerate % a number (we hope)
- \else
- % It's a letter.
- \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
- \lowercaseenumerate % lowercase letter
- \else
- \uppercaseenumerate % uppercase letter
- \fi
- \fi
- \else
- % Multiple tokens in the argument. We hope it's a number.
- \numericenumerate
- \fi
-}
-
-% An @enumerate whose labels are integers. The starting integer is
-% given in \thearg.
-%
-\def\numericenumerate{%
- \itemno = \thearg
- \startenumeration{\the\itemno}%
-}
-
-% The starting (lowercase) letter is in \thearg.
-\def\lowercaseenumerate{%
- \itemno = \expandafter`\thearg
- \startenumeration{%
- % Be sure we're not beyond the end of the alphabet.
- \ifnum\itemno=0
- \errmessage{No more lowercase letters in @enumerate; get a bigger
- alphabet}%
- \fi
- \char\lccode\itemno
- }%
-}
-
-% The starting (uppercase) letter is in \thearg.
-\def\uppercaseenumerate{%
- \itemno = \expandafter`\thearg
- \startenumeration{%
- % Be sure we're not beyond the end of the alphabet.
- \ifnum\itemno=0
- \errmessage{No more uppercase letters in @enumerate; get a bigger
- alphabet}
- \fi
- \char\uccode\itemno
- }%
-}
-
-% Call itemizey, adding a period to the first argument and supplying the
-% common last two arguments. Also subtract one from the initial value in
-% \itemno, since @item increments \itemno.
-%
-\def\startenumeration#1{%
- \advance\itemno by -1
- \itemizey{#1.}\Eenumerate\flushcr
-}
-
-% @alphaenumerate and @capsenumerate are abbreviations for giving an arg
-% to @enumerate.
-%
-\def\alphaenumerate{\enumerate{a}}
-\def\capsenumerate{\enumerate{A}}
-\def\Ealphaenumerate{\Eenumerate}
-\def\Ecapsenumerate{\Eenumerate}
-
-% Definition of @item while inside @itemize.
-
-\def\itemizeitem{%
-\advance\itemno by 1
-{\let\par=\endgraf \smallbreak}%
-\ifhmode \errmessage{\in hmode at itemizeitem}\fi
-{\parskip=0in \hskip 0pt
-\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
-\vadjust{\penalty 1200}}%
-\flushcr}
-
-% @multitable macros
-% Amy Hendrickson, 8/18/94, 3/6/96
-%
-% @multitable ... @end multitable will make as many columns as desired.
-% Contents of each column will wrap at width given in preamble. Width
-% can be specified either with sample text given in a template line,
-% or in percent of \hsize, the current width of text on page.
-
-% Table can continue over pages but will only break between lines.
-
-% To make preamble:
-%
-% Either define widths of columns in terms of percent of \hsize:
-% @multitable @columnfractions .25 .3 .45
-% @item ...
-%
-% Numbers following @columnfractions are the percent of the total
-% current hsize to be used for each column. You may use as many
-% columns as desired.
-
-
-% Or use a template:
-% @multitable {Column 1 template} {Column 2 template} {Column 3 template}
-% @item ...
-% using the widest term desired in each column.
-%
-% For those who want to use more than one line's worth of words in
-% the preamble, break the line within one argument and it
-% will parse correctly, i.e.,
-%
-% @multitable {Column 1 template} {Column 2 template} {Column 3
-% template}
-% Not:
-% @multitable {Column 1 template} {Column 2 template}
-% {Column 3 template}
-
-% Each new table line starts with @item, each subsequent new column
-% starts with @tab. Empty columns may be produced by supplying @tab's
-% with nothing between them for as many times as empty columns are needed,
-% ie, @tab@tab@tab will produce two empty columns.
-
-% @item, @tab, @multitable or @end multitable do not need to be on their
-% own lines, but it will not hurt if they are.
-
-% Sample multitable:
-
-% @multitable {Column 1 template} {Column 2 template} {Column 3 template}
-% @item first col stuff @tab second col stuff @tab third col
-% @item
-% first col stuff
-% @tab
-% second col stuff
-% @tab
-% third col
-% @item first col stuff @tab second col stuff
-% @tab Many paragraphs of text may be used in any column.
-%
-% They will wrap at the width determined by the template.
-% @item@tab@tab This will be in third column.
-% @end multitable
-
-% Default dimensions may be reset by user.
-% @multitableparskip is vertical space between paragraphs in table.
-% @multitableparindent is paragraph indent in table.
-% @multitablecolmargin is horizontal space to be left between columns.
-% @multitablelinespace is space to leave between table items, baseline
-% to baseline.
-% 0pt means it depends on current normal line spacing.
-
-%%%%
-% Dimensions
-
-\newskip\multitableparskip
-\newskip\multitableparindent
-\newdimen\multitablecolspace
-\newskip\multitablelinespace
-\multitableparskip=0pt
-\multitableparindent=6pt
-\multitablecolspace=12pt
-\multitablelinespace=0pt
-
-%%%%
-% Macros used to set up halign preamble:
-\let\endsetuptable\relax
-\def\xendsetuptable{\endsetuptable}
-\let\columnfractions\relax
-\def\xcolumnfractions{\columnfractions}
-\newif\ifsetpercent
-
-%% 2/1/96, to allow fractions to be given with more than one digit.
-\def\pickupwholefraction#1 {\global\advance\colcount by1 %
-\expandafter\xdef\csname col\the\colcount\endcsname{.#1\hsize}%
-\setuptable}
-
-\newcount\colcount
-\def\setuptable#1{\def\firstarg{#1}%
-\ifx\firstarg\xendsetuptable\let\go\relax%
-\else
- \ifx\firstarg\xcolumnfractions\global\setpercenttrue%
- \else
- \ifsetpercent
- \let\go\pickupwholefraction % In this case arg of setuptable
- % is the decimal point before the
- % number given in percent of hsize.
- % We don't need this so we don't use it.
- \else
- \global\advance\colcount by1
- \setbox0=\hbox{#1 }% Add a normal word space as a separator;
- % typically that is always in the input, anyway.
- \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
- \fi%
- \fi%
-\ifx\go\pickupwholefraction\else\let\go\setuptable\fi%
-\fi\go}
-
-%%%%
-% multitable syntax
-\def\tab{&\hskip1sp\relax} % 2/2/96
- % tiny skip here makes sure this column space is
- % maintained, even if it is never used.
-
-
-%%%%
-% @multitable ... @end multitable definitions:
-
-\def\multitable{\parsearg\dotable}
-
-\def\dotable#1{\bgroup
-\let\item\cr
-\tolerance=9500
-\hbadness=9500
-\setmultitablespacing
-\parskip=\multitableparskip
-\parindent=\multitableparindent
-\overfullrule=0pt
-\global\colcount=0\relax%
-\def\Emultitable{\global\setpercentfalse\global\everycr{}\cr\egroup\egroup}%
- % To parse everything between @multitable and @item :
-\setuptable#1 \endsetuptable
- % Need to reset this to 0 after \setuptable.
-\global\colcount=0\relax%
- %
- % This preamble sets up a generic column definition, which will
- % be used as many times as user calls for columns.
- % \vtop will set a single line and will also let text wrap and
- % continue for many paragraphs if desired.
-\halign\bgroup&\global\advance\colcount by 1\relax%
-\multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
- % In order to keep entries from bumping into each other
- % we will add a \leftskip of \multitablecolspace to all columns after
- % the first one.
- % If a template has been used, we will add \multitablecolspace
- % to the width of each template entry.
- % If user has set preamble in terms of percent of \hsize
- % we will use that dimension as the width of the column, and
- % the \leftskip will keep entries from bumping into each other.
- % Table will start at left margin and final column will justify at
- % right margin.
-\ifnum\colcount=1
-\else
- \ifsetpercent
- \else
- % If user has <not> set preamble in terms of percent of \hsize
- % we will advance \hsize by \multitablecolspace
- \advance\hsize by \multitablecolspace
- \fi
- % In either case we will make \leftskip=\multitablecolspace:
-\leftskip=\multitablecolspace
-\fi
-\noindent##\multistrut}\cr%
- % \everycr will reset column counter, \colcount, at the end of
- % each line. Every column entry will cause \colcount to advance by one.
- % The table preamble
- % looks at the current \colcount to find the correct column width.
-\global\everycr{\noalign{%
-\filbreak%% keeps underfull box messages off when table breaks over pages.
-\global\colcount=0\relax}}
-}
-
-\def\setmultitablespacing{% test to see if user has set \multitablelinespace.
-% If so, do nothing. If not, give it an appropriate dimension based on
-% current baselineskip.
-\ifdim\multitablelinespace=0pt
-%% strut to put in table in case some entry doesn't have descenders,
-%% to keep lines equally spaced
-\let\multistrut = \strut
-%% Test to see if parskip is larger than space between lines of
-%% table. If not, do nothing.
-%% If so, set to same dimension as multitablelinespace.
-\else
-\gdef\multistrut{\vrule height\multitablelinespace depth\dp0
-width0pt\relax} \fi
-\ifdim\multitableparskip>\multitablelinespace
-\global\multitableparskip=\multitablelinespace
-\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
- %% than skip between lines in the table.
-\fi%
-\ifdim\multitableparskip=0pt
-\global\multitableparskip=\multitablelinespace
-\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
- %% than skip between lines in the table.
-\fi}
-
-
-\message{indexing,}
-% Index generation facilities
-
-% Define \newwrite to be identical to plain tex's \newwrite
-% except not \outer, so it can be used within \newindex.
-{\catcode`\@=11
-\gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
-
-% \newindex {foo} defines an index named foo.
-% It automatically defines \fooindex such that
-% \fooindex ...rest of line... puts an entry in the index foo.
-% It also defines \fooindfile to be the number of the output channel for
-% the file that accumulates this index. The file's extension is foo.
-% The name of an index should be no more than 2 characters long
-% for the sake of vms.
-
-\def\newindex #1{
-\expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
-\openout \csname#1indfile\endcsname \jobname.#1 % Open the file
-\expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
-\noexpand\doindex {#1}}
-}
-
-% @defindex foo == \newindex{foo}
-
-\def\defindex{\parsearg\newindex}
-
-% Define @defcodeindex, like @defindex except put all entries in @code.
-
-\def\newcodeindex #1{
-\expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
-\openout \csname#1indfile\endcsname \jobname.#1 % Open the file
-\expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
-\noexpand\docodeindex {#1}}
-}
-
-\def\defcodeindex{\parsearg\newcodeindex}
-
-% @synindex foo bar makes index foo feed into index bar.
-% Do this instead of @defindex foo if you don't want it as a separate index.
-\def\synindex #1 #2 {%
-\expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
-\expandafter\let\csname#1indfile\endcsname=\synindexfoo
-\expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
-\noexpand\doindex {#2}}%
-}
-
-% @syncodeindex foo bar similar, but put all entries made for index foo
-% inside @code.
-\def\syncodeindex #1 #2 {%
-\expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
-\expandafter\let\csname#1indfile\endcsname=\synindexfoo
-\expandafter\xdef\csname#1index\endcsname{% % Define \xxxindex
-\noexpand\docodeindex {#2}}%
-}
-
-% Define \doindex, the driver for all \fooindex macros.
-% Argument #1 is generated by the calling \fooindex macro,
-% and it is "foo", the name of the index.
-
-% \doindex just uses \parsearg; it calls \doind for the actual work.
-% This is because \doind is more useful to call from other macros.
-
-% There is also \dosubind {index}{topic}{subtopic}
-% which makes an entry in a two-level index such as the operation index.
-
-\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
-\def\singleindexer #1{\doind{\indexname}{#1}}
-
-% like the previous two, but they put @code around the argument.
-\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
-\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
-
-\def\indexdummies{%
-% Take care of the plain tex accent commands.
-\def\"{\realbackslash "}%
-\def\`{\realbackslash `}%
-\def\'{\realbackslash '}%
-\def\^{\realbackslash ^}%
-\def\~{\realbackslash ~}%
-\def\={\realbackslash =}%
-\def\b{\realbackslash b}%
-\def\c{\realbackslash c}%
-\def\d{\realbackslash d}%
-\def\u{\realbackslash u}%
-\def\v{\realbackslash v}%
-\def\H{\realbackslash H}%
-% Take care of the plain tex special European modified letters.
-\def\oe{\realbackslash oe}%
-\def\ae{\realbackslash ae}%
-\def\aa{\realbackslash aa}%
-\def\OE{\realbackslash OE}%
-\def\AE{\realbackslash AE}%
-\def\AA{\realbackslash AA}%
-\def\o{\realbackslash o}%
-\def\O{\realbackslash O}%
-\def\l{\realbackslash l}%
-\def\L{\realbackslash L}%
-\def\ss{\realbackslash ss}%
-% Take care of texinfo commands likely to appear in an index entry.
-% (Must be a way to avoid doing expansion at all, and thus not have to
-% laboriously list every single command here.)
-\def\@{@}% will be @@ when we switch to @ as escape char.
-%\let\{ = \lbracecmd
-%\let\} = \rbracecmd
-\def\_{{\realbackslash _}}%
-\def\w{\realbackslash w }%
-\def\bf{\realbackslash bf }%
-%\def\rm{\realbackslash rm }%
-\def\sl{\realbackslash sl }%
-\def\sf{\realbackslash sf}%
-\def\tt{\realbackslash tt}%
-\def\gtr{\realbackslash gtr}%
-\def\less{\realbackslash less}%
-\def\hat{\realbackslash hat}%
-%\def\char{\realbackslash char}%
-\def\TeX{\realbackslash TeX}%
-\def\dots{\realbackslash dots }%
-\def\copyright{\realbackslash copyright }%
-\def\tclose##1{\realbackslash tclose {##1}}%
-\def\code##1{\realbackslash code {##1}}%
-\def\dotless##1{\realbackslash dotless {##1}}%
-\def\samp##1{\realbackslash samp {##1}}%
-\def\,##1{\realbackslash ,{##1}}%
-\def\t##1{\realbackslash t {##1}}%
-\def\r##1{\realbackslash r {##1}}%
-\def\i##1{\realbackslash i {##1}}%
-\def\b##1{\realbackslash b {##1}}%
-\def\cite##1{\realbackslash cite {##1}}%
-\def\key##1{\realbackslash key {##1}}%
-\def\file##1{\realbackslash file {##1}}%
-\def\var##1{\realbackslash var {##1}}%
-\def\kbd##1{\realbackslash kbd {##1}}%
-\def\dfn##1{\realbackslash dfn {##1}}%
-\def\emph##1{\realbackslash emph {##1}}%
-\unsepspaces
-}
-
-% If an index command is used in an @example environment, any spaces
-% therein should become regular spaces in the raw index file, not the
-% expansion of \tie (\\leavevmode \penalty \@M \ ).
-{\obeyspaces
- \gdef\unsepspaces{\obeyspaces\let =\space}}
-
-% \indexnofonts no-ops all font-change commands.
-% This is used when outputting the strings to sort the index by.
-\def\indexdummyfont#1{#1}
-\def\indexdummytex{TeX}
-\def\indexdummydots{...}
-
-\def\indexnofonts{%
-% Just ignore accents.
-\let\,=\indexdummyfont
-\let\"=\indexdummyfont
-\let\`=\indexdummyfont
-\let\'=\indexdummyfont
-\let\^=\indexdummyfont
-\let\~=\indexdummyfont
-\let\==\indexdummyfont
-\let\b=\indexdummyfont
-\let\c=\indexdummyfont
-\let\d=\indexdummyfont
-\let\u=\indexdummyfont
-\let\v=\indexdummyfont
-\let\H=\indexdummyfont
-\let\dotless=\indexdummyfont
-% Take care of the plain tex special European modified letters.
-\def\oe{oe}%
-\def\ae{ae}%
-\def\aa{aa}%
-\def\OE{OE}%
-\def\AE{AE}%
-\def\AA{AA}%
-\def\o{o}%
-\def\O{O}%
-\def\l{l}%
-\def\L{L}%
-\def\ss{ss}%
-\let\w=\indexdummyfont
-\let\t=\indexdummyfont
-\let\r=\indexdummyfont
-\let\i=\indexdummyfont
-\let\b=\indexdummyfont
-\let\emph=\indexdummyfont
-\let\strong=\indexdummyfont
-\let\cite=\indexdummyfont
-\let\sc=\indexdummyfont
-%Don't no-op \tt, since it isn't a user-level command
-% and is used in the definitions of the active chars like <, >, |...
-%\let\tt=\indexdummyfont
-\let\tclose=\indexdummyfont
-\let\code=\indexdummyfont
-\let\file=\indexdummyfont
-\let\samp=\indexdummyfont
-\let\kbd=\indexdummyfont
-\let\key=\indexdummyfont
-\let\var=\indexdummyfont
-\let\TeX=\indexdummytex
-\let\dots=\indexdummydots
-\def\@{@}%
-}
-
-% To define \realbackslash, we must make \ not be an escape.
-% We must first make another character (@) an escape
-% so we do not become unable to do a definition.
-
-{\catcode`\@=0 \catcode`\\=\other
-@gdef@realbackslash{\}}
-
-\let\indexbackslash=0 %overridden during \printindex.
-
-\let\SETmarginindex=\relax %initialize!
-% workhorse for all \fooindexes
-% #1 is name of index, #2 is stuff to put there
-\def\doind #1#2{%
- % Put the index entry in the margin if desired.
- \ifx\SETmarginindex\relax\else
- \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
- \fi
- {%
- \count255=\lastpenalty
- {%
- \indexdummies % Must do this here, since \bf, etc expand at this stage
- \escapechar=`\\
- {%
- \let\folio=0 % We will expand all macros now EXCEPT \folio.
- \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
- % so it will be output as is; and it will print as backslash.
- %
- % First process the index-string with all font commands turned off
- % to get the string to sort by.
- {\indexnofonts \xdef\indexsorttmp{#2}}%
- %
- % Now produce the complete index entry, with both the sort key and the
- % original text, including any font commands.
- \toks0 = {#2}%
- \edef\temp{%
- \write\csname#1indfile\endcsname{%
- \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
- }%
- \temp
- }%
- }%
- \penalty\count255
- }%
-}
-
-\def\dosubind #1#2#3{%
-{\count10=\lastpenalty %
-{\indexdummies % Must do this here, since \bf, etc expand at this stage
-\escapechar=`\\%
-{\let\folio=0%
-\def\rawbackslashxx{\indexbackslash}%
-%
-% Now process the index-string once, with all font commands turned off,
-% to get the string to sort the index by.
-{\indexnofonts
-\xdef\temp1{#2 #3}%
-}%
-% Now produce the complete index entry. We process the index-string again,
-% this time with font commands expanded, to get what to print in the index.
-\edef\temp{%
-\write \csname#1indfile\endcsname{%
-\realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
-\temp }%
-}\penalty\count10}}
-
-% The index entry written in the file actually looks like
-% \entry {sortstring}{page}{topic}
-% or
-% \entry {sortstring}{page}{topic}{subtopic}
-% The texindex program reads in these files and writes files
-% containing these kinds of lines:
-% \initial {c}
-% before the first topic whose initial is c
-% \entry {topic}{pagelist}
-% for a topic that is used without subtopics
-% \primary {topic}
-% for the beginning of a topic that is used with subtopics
-% \secondary {subtopic}{pagelist}
-% for each subtopic.
-
-% Define the user-accessible indexing commands
-% @findex, @vindex, @kindex, @cindex.
-
-\def\findex {\fnindex}
-\def\kindex {\kyindex}
-\def\cindex {\cpindex}
-\def\vindex {\vrindex}
-\def\tindex {\tpindex}
-\def\pindex {\pgindex}
-
-\def\cindexsub {\begingroup\obeylines\cindexsub}
-{\obeylines %
-\gdef\cindexsub "#1" #2^^M{\endgroup %
-\dosubind{cp}{#2}{#1}}}
-
-% Define the macros used in formatting output of the sorted index material.
-
-% This is what you call to cause a particular index to get printed.
-% Write
-% @unnumbered Function Index
-% @printindex fn
-
-\def\printindex{\parsearg\doprintindex}
-
-\def\doprintindex#1{\begingroup
- \dobreak \chapheadingskip{10000}%
- %
- \indexfonts \rm
- \tolerance = 9500
- \indexbreaks
- \def\indexbackslash{\rawbackslashxx}%
- % Index files are almost Texinfo source, but we use \ as the escape
- % character. It would be better to use @, but that's too big a change
- % to make right now.
- \catcode`\\ = 0
- \catcode`\@ = 11
- \escapechar = `\\
- \begindoublecolumns
- %
- % See if the index file exists and is nonempty.
- \openin 1 \jobname.#1s
- \ifeof 1
- % \enddoublecolumns gets confused if there is no text in the index,
- % and it loses the chapter title and the aux file entries for the
- % index. The easiest way to prevent this problem is to make sure
- % there is some text.
- (Index is nonexistent)
- \else
- %
- % If the index file exists but is empty, then \openin leaves \ifeof
- % false. We have to make TeX try to read something from the file, so
- % it can discover if there is anything in it.
- \read 1 to \temp
- \ifeof 1
- (Index is empty)
- \else
- \input \jobname.#1s
- \fi
- \fi
- \closein 1
- \enddoublecolumns
-\endgroup}
-
-% These macros are used by the sorted index file itself.
-% Change them to control the appearance of the index.
-
-% Same as \bigskipamount except no shrink.
-% \balancecolumns gets confused if there is any shrink.
-\newskip\initialskipamount \initialskipamount 12pt plus4pt
-
-\def\initial #1{%
-{\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
-\ifdim\lastskip<\initialskipamount
-\removelastskip \penalty-200 \vskip \initialskipamount\fi
-\line{\secbf#1\hfill}\kern 2pt\penalty10000}}
-
-% This typesets a paragraph consisting of #1, dot leaders, and then #2
-% flush to the right margin. It is used for index and table of contents
-% entries. The paragraph is indented by \leftskip.
-%
-\def\entry #1#2{\begingroup
- %
- % Start a new paragraph if necessary, so our assignments below can't
- % affect previous text.
- \par
- %
- % Do not fill out the last line with white space.
- \parfillskip = 0in
- %
- % No extra space above this paragraph.
- \parskip = 0in
- %
- % Do not prefer a separate line ending with a hyphen to fewer lines.
- \finalhyphendemerits = 0
- %
- % \hangindent is only relevant when the entry text and page number
- % don't both fit on one line. In that case, bob suggests starting the
- % dots pretty far over on the line. Unfortunately, a large
- % indentation looks wrong when the entry text itself is broken across
- % lines. So we use a small indentation and put up with long leaders.
- %
- % \hangafter is reset to 1 (which is the value we want) at the start
- % of each paragraph, so we need not do anything with that.
- \hangindent=2em
- %
- % When the entry text needs to be broken, just fill out the first line
- % with blank space.
- \rightskip = 0pt plus1fil
- %
- % Start a ``paragraph'' for the index entry so the line breaking
- % parameters we've set above will have an effect.
- \noindent
- %
- % Insert the text of the index entry. TeX will do line-breaking on it.
- #1%
- % The following is kludged to not output a line of dots in the index if
- % there are no page numbers. The next person who breaks this will be
- % cursed by a Unix daemon.
- \def\tempa{{\rm }}%
- \def\tempb{#2}%
- \edef\tempc{\tempa}%
- \edef\tempd{\tempb}%
- \ifx\tempc\tempd\ \else%
- %
- % If we must, put the page number on a line of its own, and fill out
- % this line with blank space. (The \hfil is overwhelmed with the
- % fill leaders glue in \indexdotfill if the page number does fit.)
- \hfil\penalty50
- \null\nobreak\indexdotfill % Have leaders before the page number.
- %
- % The `\ ' here is removed by the implicit \unskip that TeX does as
- % part of (the primitive) \par. Without it, a spurious underfull
- % \hbox ensues.
- \ #2% The page number ends the paragraph.
- \fi%
- \par
-\endgroup}
-
-% Like \dotfill except takes at least 1 em.
-\def\indexdotfill{\cleaders
- \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
-
-\def\primary #1{\line{#1\hfil}}
-
-\newskip\secondaryindent \secondaryindent=0.5cm
-
-\def\secondary #1#2{
-{\parfillskip=0in \parskip=0in
-\hangindent =1in \hangafter=1
-\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
-}}
-
-% Define two-column mode, which we use to typeset indexes.
-% Adapted from the TeXbook, page 416, which is to say,
-% the manmac.tex format used to print the TeXbook itself.
-\catcode`\@=11
-
-\newbox\partialpage
-\newdimen\doublecolumnhsize
-
-\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
- % Grab any single-column material above us.
- \output = {\global\setbox\partialpage
- =\vbox{\unvbox255\kern -\topskip \kern \baselineskip}}%
- \eject
- %
- % Now switch to the double-column output routine.
- \output={\doublecolumnout}%
- %
- % Change the page size parameters. We could do this once outside this
- % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
- % format, but then we repeat the same computation. Repeating a couple
- % of assignments once per index is clearly meaningless for the
- % execution time, so we may as well do it once.
- %
- % First we halve the line length, less a little for the gutter between
- % the columns. We compute the gutter based on the line length, so it
- % changes automatically with the paper format. The magic constant
- % below is chosen so that the gutter has the same value (well, +- <
- % 1pt) as it did when we hard-coded it.
- %
- % We put the result in a separate register, \doublecolumhsize, so we
- % can restore it in \pagesofar, after \hsize itself has (potentially)
- % been clobbered.
- %
- \doublecolumnhsize = \hsize
- \advance\doublecolumnhsize by -.04154\hsize
- \divide\doublecolumnhsize by 2
- \hsize = \doublecolumnhsize
- %
- % Double the \vsize as well. (We don't need a separate register here,
- % since nobody clobbers \vsize.)
- \vsize = 2\vsize
-}
-\def\doublecolumnout{%
- \splittopskip=\topskip \splitmaxdepth=\maxdepth
- % Get the available space for the double columns -- the normal
- % (undoubled) page height minus any material left over from the
- % previous page.
- \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
- % box0 will be the left-hand column, box1 the right.
- \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
- \onepageout\pagesofar
- \unvbox255 \penalty\outputpenalty
-}
-\def\pagesofar{%
- % The contents of the output page -- any previous material,
- % followed by the two boxes we just split.
- \unvbox\partialpage
- \hsize = \doublecolumnhsize
- \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}%
-}
-\def\enddoublecolumns{%
- \output={\balancecolumns}\eject % split what we have
- \endgroup
- % Back to normal single-column typesetting, but take account of the
- % fact that we just accumulated some stuff on the output page.
- \pagegoal=\vsize
-}
-\def\balancecolumns{%
- % Called on the last page of the double column material.
- \setbox0=\vbox{\unvbox255}%
- \dimen@ = \ht0
- \advance\dimen@ by \topskip
- \advance\dimen@ by-\baselineskip
- \divide\dimen@ by 2
- \splittopskip = \topskip
- % Loop until we get a decent breakpoint.
- {\vbadness=10000 \loop \global\setbox3=\copy0
- \global\setbox1=\vsplit3 to\dimen@
- \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt \repeat}%
- \setbox0=\vbox to\dimen@{\unvbox1}%
- \setbox2=\vbox to\dimen@{\unvbox3}%
- \pagesofar
-}
-\catcode `\@=\other
-
-
-\message{sectioning,}
-% Define chapters, sections, etc.
-
-\newcount \chapno
-\newcount \secno \secno=0
-\newcount \subsecno \subsecno=0
-\newcount \subsubsecno \subsubsecno=0
-
-% This counter is funny since it counts through charcodes of letters A, B, ...
-\newcount \appendixno \appendixno = `\@
-\def\appendixletter{\char\the\appendixno}
-
-\newwrite \contentsfile
-% This is called from \setfilename.
-\def\opencontents{\openout \contentsfile = \jobname.toc}
-
-% Each @chapter defines this as the name of the chapter.
-% page headings and footings can use it. @section does likewise
-
-\def\thischapter{} \def\thissection{}
-\def\seccheck#1{\if \pageno<0 %
-\errmessage{@#1 not allowed after generating table of contents}\fi
-%
-}
-
-\def\chapternofonts{%
-\let\rawbackslash=\relax%
-\let\frenchspacing=\relax%
-\def\result{\realbackslash result}
-\def\equiv{\realbackslash equiv}
-\def\expansion{\realbackslash expansion}
-\def\print{\realbackslash print}
-\def\TeX{\realbackslash TeX}
-\def\dots{\realbackslash dots}
-\def\copyright{\realbackslash copyright}
-\def\tt{\realbackslash tt}
-\def\bf{\realbackslash bf }
-\def\w{\realbackslash w}
-\def\less{\realbackslash less}
-\def\gtr{\realbackslash gtr}
-\def\hat{\realbackslash hat}
-\def\char{\realbackslash char}
-\def\tclose##1{\realbackslash tclose {##1}}
-\def\code##1{\realbackslash code {##1}}
-\def\samp##1{\realbackslash samp {##1}}
-\def\r##1{\realbackslash r {##1}}
-\def\b##1{\realbackslash b {##1}}
-\def\key##1{\realbackslash key {##1}}
-\def\file##1{\realbackslash file {##1}}
-\def\kbd##1{\realbackslash kbd {##1}}
-% These are redefined because @smartitalic wouldn't work inside xdef.
-\def\i##1{\realbackslash i {##1}}
-\def\cite##1{\realbackslash cite {##1}}
-\def\var##1{\realbackslash var {##1}}
-\def\emph##1{\realbackslash emph {##1}}
-\def\dfn##1{\realbackslash dfn {##1}}
-}
-
-\newcount\absseclevel % used to calculate proper heading level
-\newcount\secbase\secbase=0 % @raise/lowersections modify this count
-
-% @raisesections: treat @section as chapter, @subsection as section, etc.
-\def\raisesections{\global\advance\secbase by -1}
-\let\up=\raisesections % original BFox name
-
-% @lowersections: treat @chapter as section, @section as subsection, etc.
-\def\lowersections{\global\advance\secbase by 1}
-\let\down=\lowersections % original BFox name
-
-% Choose a numbered-heading macro
-% #1 is heading level if unmodified by @raisesections or @lowersections
-% #2 is text for heading
-\def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
-\ifcase\absseclevel
- \chapterzzz{#2}
-\or
- \seczzz{#2}
-\or
- \numberedsubseczzz{#2}
-\or
- \numberedsubsubseczzz{#2}
-\else
- \ifnum \absseclevel<0
- \chapterzzz{#2}
- \else
- \numberedsubsubseczzz{#2}
- \fi
-\fi
-}
-
-% like \numhead, but chooses appendix heading levels
-\def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
-\ifcase\absseclevel
- \appendixzzz{#2}
-\or
- \appendixsectionzzz{#2}
-\or
- \appendixsubseczzz{#2}
-\or
- \appendixsubsubseczzz{#2}
-\else
- \ifnum \absseclevel<0
- \appendixzzz{#2}
- \else
- \appendixsubsubseczzz{#2}
- \fi
-\fi
-}
-
-% like \numhead, but chooses numberless heading levels
-\def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
-\ifcase\absseclevel
- \unnumberedzzz{#2}
-\or
- \unnumberedseczzz{#2}
-\or
- \unnumberedsubseczzz{#2}
-\or
- \unnumberedsubsubseczzz{#2}
-\else
- \ifnum \absseclevel<0
- \unnumberedzzz{#2}
- \else
- \unnumberedsubsubseczzz{#2}
- \fi
-\fi
-}
-
-
-\def\thischaptername{No Chapter Title}
-\outer\def\chapter{\parsearg\chapteryyy}
-\def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
-\def\chapterzzz #1{\seccheck{chapter}%
-\secno=0 \subsecno=0 \subsubsecno=0
-\global\advance \chapno by 1 \message{\putwordChapter \the\chapno}%
-\chapmacro {#1}{\the\chapno}%
-\gdef\thissection{#1}%
-\gdef\thischaptername{#1}%
-% We don't substitute the actual chapter name into \thischapter
-% because we don't want its macros evaluated now.
-\xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
-{\chapternofonts%
-\edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}%
-\escapechar=`\\%
-\write \contentsfile \temp %
-\donoderef %
-\global\let\section = \numberedsec
-\global\let\subsection = \numberedsubsec
-\global\let\subsubsection = \numberedsubsubsec
-}}
-
-\outer\def\appendix{\parsearg\appendixyyy}
-\def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
-\def\appendixzzz #1{\seccheck{appendix}%
-\secno=0 \subsecno=0 \subsubsecno=0
-\global\advance \appendixno by 1 \message{Appendix \appendixletter}%
-\chapmacro {#1}{\putwordAppendix{} \appendixletter}%
-\gdef\thissection{#1}%
-\gdef\thischaptername{#1}%
-\xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
-{\chapternofonts%
-\edef\temp{{\realbackslash chapentry
- {#1}{\putwordAppendix{} \appendixletter}{\noexpand\folio}}}%
-\escapechar=`\\%
-\write \contentsfile \temp %
-\appendixnoderef %
-\global\let\section = \appendixsec
-\global\let\subsection = \appendixsubsec
-\global\let\subsubsection = \appendixsubsubsec
-}}
-
-% @centerchap is like @unnumbered, but the heading is centered.
-\outer\def\centerchap{\parsearg\centerchapyyy}
-\def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}}
-
-\outer\def\top{\parsearg\unnumberedyyy}
-\outer\def\unnumbered{\parsearg\unnumberedyyy}
-\def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
-\def\unnumberedzzz #1{\seccheck{unnumbered}%
-\secno=0 \subsecno=0 \subsubsecno=0
-%
-% This used to be simply \message{#1}, but TeX fully expands the
-% argument to \message. Therefore, if #1 contained @-commands, TeX
-% expanded them. For example, in `@unnumbered The @cite{Book}', TeX
-% expanded @cite (which turns out to cause errors because \cite is meant
-% to be executed, not expanded).
-%
-% Anyway, we don't want the fully-expanded definition of @cite to appear
-% as a result of the \message, we just want `@cite' itself. We use
-% \the<toks register> to achieve this: TeX expands \the<toks> only once,
-% simply yielding the contents of the <toks register>.
-\toks0 = {#1}\message{(\the\toks0)}%
-%
-\unnumbchapmacro {#1}%
-\gdef\thischapter{#1}\gdef\thissection{#1}%
-{\chapternofonts%
-\edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}%
-\escapechar=`\\%
-\write \contentsfile \temp %
-\unnumbnoderef %
-\global\let\section = \unnumberedsec
-\global\let\subsection = \unnumberedsubsec
-\global\let\subsubsection = \unnumberedsubsubsec
-}}
-
-\outer\def\numberedsec{\parsearg\secyyy}
-\def\secyyy #1{\numhead1{#1}} % normally calls seczzz
-\def\seczzz #1{\seccheck{section}%
-\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
-\gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
-{\chapternofonts%
-\edef\temp{{\realbackslash secentry %
-{#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
-\escapechar=`\\%
-\write \contentsfile \temp %
-\donoderef %
-\penalty 10000 %
-}}
-
-\outer\def\appendixsection{\parsearg\appendixsecyyy}
-\outer\def\appendixsec{\parsearg\appendixsecyyy}
-\def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
-\def\appendixsectionzzz #1{\seccheck{appendixsection}%
-\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
-\gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
-{\chapternofonts%
-\edef\temp{{\realbackslash secentry %
-{#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
-\escapechar=`\\%
-\write \contentsfile \temp %
-\appendixnoderef %
-\penalty 10000 %
-}}
-
-\outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
-\def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
-\def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
-\plainsecheading {#1}\gdef\thissection{#1}%
-{\chapternofonts%
-\edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}%
-\escapechar=`\\%
-\write \contentsfile \temp %
-\unnumbnoderef %
-\penalty 10000 %
-}}
-
-\outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
-\def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
-\def\numberedsubseczzz #1{\seccheck{subsection}%
-\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
-\subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
-{\chapternofonts%
-\edef\temp{{\realbackslash subsecentry %
-{#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
-\escapechar=`\\%
-\write \contentsfile \temp %
-\donoderef %
-\penalty 10000 %
-}}
-
-\outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
-\def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
-\def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
-\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
-\subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
-{\chapternofonts%
-\edef\temp{{\realbackslash subsecentry %
-{#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
-\escapechar=`\\%
-\write \contentsfile \temp %
-\appendixnoderef %
-\penalty 10000 %
-}}
-
-\outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
-\def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
-\def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
-\plainsubsecheading {#1}\gdef\thissection{#1}%
-{\chapternofonts%
-\edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}%
-\escapechar=`\\%
-\write \contentsfile \temp %
-\unnumbnoderef %
-\penalty 10000 %
-}}
-
-\outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
-\def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
-\def\numberedsubsubseczzz #1{\seccheck{subsubsection}%
-\gdef\thissection{#1}\global\advance \subsubsecno by 1 %
-\subsubsecheading {#1}
- {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
-{\chapternofonts%
-\edef\temp{{\realbackslash subsubsecentry %
- {#1}
- {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}
- {\noexpand\folio}}}%
-\escapechar=`\\%
-\write \contentsfile \temp %
-\donoderef %
-\penalty 10000 %
-}}
-
-\outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
-\def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
-\def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
-\gdef\thissection{#1}\global\advance \subsubsecno by 1 %
-\subsubsecheading {#1}
- {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
-{\chapternofonts%
-\edef\temp{{\realbackslash subsubsecentry{#1}%
- {\appendixletter}
- {\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%
-\escapechar=`\\%
-\write \contentsfile \temp %
-\appendixnoderef %
-\penalty 10000 %
-}}
-
-\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
-\def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
-\def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
-\plainsubsubsecheading {#1}\gdef\thissection{#1}%
-{\chapternofonts%
-\edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}%
-\escapechar=`\\%
-\write \contentsfile \temp %
-\unnumbnoderef %
-\penalty 10000 %
-}}
-
-% These are variants which are not "outer", so they can appear in @ifinfo.
-% Actually, they should now be obsolete; ordinary section commands should work.
-\def\infotop{\parsearg\unnumberedzzz}
-\def\infounnumbered{\parsearg\unnumberedzzz}
-\def\infounnumberedsec{\parsearg\unnumberedseczzz}
-\def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
-\def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
-
-\def\infoappendix{\parsearg\appendixzzz}
-\def\infoappendixsec{\parsearg\appendixseczzz}
-\def\infoappendixsubsec{\parsearg\appendixsubseczzz}
-\def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
-
-\def\infochapter{\parsearg\chapterzzz}
-\def\infosection{\parsearg\sectionzzz}
-\def\infosubsection{\parsearg\subsectionzzz}
-\def\infosubsubsection{\parsearg\subsubsectionzzz}
-
-% These macros control what the section commands do, according
-% to what kind of chapter we are in (ordinary, appendix, or unnumbered).
-% Define them by default for a numbered chapter.
-\global\let\section = \numberedsec
-\global\let\subsection = \numberedsubsec
-\global\let\subsubsection = \numberedsubsubsec
-
-% Define @majorheading, @heading and @subheading
-
-% NOTE on use of \vbox for chapter headings, section headings, and
-% such:
-% 1) We use \vbox rather than the earlier \line to permit
-% overlong headings to fold.
-% 2) \hyphenpenalty is set to 10000 because hyphenation in a
-% heading is obnoxious; this forbids it.
-% 3) Likewise, headings look best if no \parindent is used, and
-% if justification is not attempted. Hence \raggedright.
-
-
-\def\majorheading{\parsearg\majorheadingzzz}
-\def\majorheadingzzz #1{%
-{\advance\chapheadingskip by 10pt \chapbreak }%
-{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
- \parindent=0pt\raggedright
- \rm #1\hfill}}\bigskip \par\penalty 200}
-
-\def\chapheading{\parsearg\chapheadingzzz}
-\def\chapheadingzzz #1{\chapbreak %
-{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
- \parindent=0pt\raggedright
- \rm #1\hfill}}\bigskip \par\penalty 200}
-
-% @heading, @subheading, @subsubheading.
-\def\heading{\parsearg\plainsecheading}
-\def\subheading{\parsearg\plainsubsecheading}
-\def\subsubheading{\parsearg\plainsubsubsecheading}
-
-% These macros generate a chapter, section, etc. heading only
-% (including whitespace, linebreaking, etc. around it),
-% given all the information in convenient, parsed form.
-
-%%% Args are the skip and penalty (usually negative)
-\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
-
-\def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
-
-%%% Define plain chapter starts, and page on/off switching for it
-% Parameter controlling skip before chapter headings (if needed)
-
-\newskip\chapheadingskip
-
-\def\chapbreak{\dobreak \chapheadingskip {-4000}}
-\def\chappager{\par\vfill\supereject}
-\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
-
-\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
-
-\def\CHAPPAGoff{
-\global\let\contentsalignmacro = \chappager
-\global\let\pchapsepmacro=\chapbreak
-\global\let\pagealignmacro=\chappager}
-
-\def\CHAPPAGon{
-\global\let\contentsalignmacro = \chappager
-\global\let\pchapsepmacro=\chappager
-\global\let\pagealignmacro=\chappager
-\global\def\HEADINGSon{\HEADINGSsingle}}
-
-\def\CHAPPAGodd{
-\global\let\contentsalignmacro = \chapoddpage
-\global\let\pchapsepmacro=\chapoddpage
-\global\let\pagealignmacro=\chapoddpage
-\global\def\HEADINGSon{\HEADINGSdouble}}
-
-\CHAPPAGon
-
-\def\CHAPFplain{
-\global\let\chapmacro=\chfplain
-\global\let\unnumbchapmacro=\unnchfplain
-\global\let\centerchapmacro=\centerchfplain}
-
-% Plain chapter opening.
-% #1 is the text, #2 the chapter number or empty if unnumbered.
-\def\chfplain#1#2{%
- \pchapsepmacro
- {%
- \chapfonts \rm
- \def\chapnum{#2}%
- \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}%
- \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
- \hangindent = \wd0 \centerparametersmaybe
- \unhbox0 #1\par}%
- }%
- \nobreak\bigskip % no page break after a chapter title
- \nobreak
-}
-
-% Plain opening for unnumbered.
-\def\unnchfplain#1{\chfplain{#1}{}}
-
-% @centerchap -- centered and unnumbered.
-\let\centerparametersmaybe = \relax
-\def\centerchfplain#1{{%
- \def\centerparametersmaybe{%
- \advance\rightskip by 3\rightskip
- \leftskip = \rightskip
- \parfillskip = 0pt
- }%
- \chfplain{#1}{}%
-}}
-
-\CHAPFplain % The default
-
-\def\unnchfopen #1{%
-\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
- \parindent=0pt\raggedright
- \rm #1\hfill}}\bigskip \par\penalty 10000 %
-}
-
-\def\chfopen #1#2{\chapoddpage {\chapfonts
-\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
-\par\penalty 5000 %
-}
-
-\def\centerchfopen #1{%
-\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
- \parindent=0pt
- \hfill {\rm #1}\hfill}}\bigskip \par\penalty 10000 %
-}
-
-\def\CHAPFopen{
-\global\let\chapmacro=\chfopen
-\global\let\unnumbchapmacro=\unnchfopen
-\global\let\centerchapmacro=\centerchfopen}
-
-
-% Section titles.
-\newskip\secheadingskip
-\def\secheadingbreak{\dobreak \secheadingskip {-1000}}
-\def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}}
-\def\plainsecheading#1{\sectionheading{sec}{}{#1}}
-
-% Subsection titles.
-\newskip \subsecheadingskip
-\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
-\def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}}
-\def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}}
-
-% Subsubsection titles.
-\let\subsubsecheadingskip = \subsecheadingskip
-\let\subsubsecheadingbreak = \subsecheadingbreak
-\def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}}
-\def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}}
-
-
-% Print any size section title.
-%
-% #1 is the section type (sec/subsec/subsubsec), #2 is the section
-% number (maybe empty), #3 the text.
-\def\sectionheading#1#2#3{%
- {%
- \expandafter\advance\csname #1headingskip\endcsname by \parskip
- \csname #1headingbreak\endcsname
- }%
- {%
- % Switch to the right set of fonts.
- \csname #1fonts\endcsname \rm
- %
- % Only insert the separating space if we have a section number.
- \def\secnum{#2}%
- \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}%
- %
- \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
- \hangindent = \wd0 % zero if no section number
- \unhbox0 #3}%
- }%
- \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak
-}
-
-
-\message{toc printing,}
-% Finish up the main text and prepare to read what we've written
-% to \contentsfile.
-
-\newskip\contentsrightmargin \contentsrightmargin=1in
-\def\startcontents#1{%
- % If @setchapternewpage on, and @headings double, the contents should
- % start on an odd page, unlike chapters. Thus, we maintain
- % \contentsalignmacro in parallel with \pagealignmacro.
- % From: Torbjorn Granlund <tege@matematik.su.se>
- \contentsalignmacro
- \immediate\closeout \contentsfile
- \ifnum \pageno>0
- \pageno = -1 % Request roman numbered pages.
- \fi
- % Don't need to put `Contents' or `Short Contents' in the headline.
- % It is abundantly clear what they are.
- \unnumbchapmacro{#1}\def\thischapter{}%
- \begingroup % Set up to handle contents files properly.
- \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11
- \catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
- \raggedbottom % Worry more about breakpoints than the bottom.
- \advance\hsize by -\contentsrightmargin % Don't use the full line length.
-}
-
-
-% Normal (long) toc.
-\outer\def\contents{%
- \startcontents{\putwordTableofContents}%
- \input \jobname.toc
- \endgroup
- \vfill \eject
-}
-
-% And just the chapters.
-\outer\def\summarycontents{%
- \startcontents{\putwordShortContents}%
- %
- \let\chapentry = \shortchapentry
- \let\unnumbchapentry = \shortunnumberedentry
- % We want a true roman here for the page numbers.
- \secfonts
- \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
- \rm
- \hyphenpenalty = 10000
- \advance\baselineskip by 1pt % Open it up a little.
- \def\secentry ##1##2##3##4{}
- \def\unnumbsecentry ##1##2{}
- \def\subsecentry ##1##2##3##4##5{}
- \def\unnumbsubsecentry ##1##2{}
- \def\subsubsecentry ##1##2##3##4##5##6{}
- \def\unnumbsubsubsecentry ##1##2{}
- \input \jobname.toc
- \endgroup
- \vfill \eject
-}
-\let\shortcontents = \summarycontents
-
-% These macros generate individual entries in the table of contents.
-% The first argument is the chapter or section name.
-% The last argument is the page number.
-% The arguments in between are the chapter number, section number, ...
-
-% Chapter-level things, for both the long and short contents.
-\def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
-
-% See comments in \dochapentry re vbox and related settings
-\def\shortchapentry#1#2#3{%
- \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}%
-}
-
-% Typeset the label for a chapter or appendix for the short contents.
-% The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
-% We could simplify the code here by writing out an \appendixentry
-% command in the toc file for appendices, instead of using \chapentry
-% for both, but it doesn't seem worth it.
-\setbox0 = \hbox{\shortcontrm \putwordAppendix }
-\newdimen\shortappendixwidth \shortappendixwidth = \wd0
-
-\def\shortchaplabel#1{%
- % We typeset #1 in a box of constant width, regardless of the text of
- % #1, so the chapter titles will come out aligned.
- \setbox0 = \hbox{#1}%
- \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
- %
- % This space should be plenty, since a single number is .5em, and the
- % widest letter (M) is 1em, at least in the Computer Modern fonts.
- % (This space doesn't include the extra space that gets added after
- % the label; that gets put in by \shortchapentry above.)
- \advance\dimen0 by 1.1em
- \hbox to \dimen0{#1\hfil}%
-}
-
-\def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
-\def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}}
-
-% Sections.
-\def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
-\def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
-
-% Subsections.
-\def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
-\def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
-
-% And subsubsections.
-\def\subsubsecentry#1#2#3#4#5#6{%
- \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
-\def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
-
-% This parameter controls the indentation of the various levels.
-\newdimen\tocindent \tocindent = 3pc
-
-% Now for the actual typesetting. In all these, #1 is the text and #2 is the
-% page number.
-%
-% If the toc has to be broken over pages, we want it to be at chapters
-% if at all possible; hence the \penalty.
-\def\dochapentry#1#2{%
- \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
- \begingroup
- \chapentryfonts
- \tocentry{#1}{\dopageno{#2}}%
- \endgroup
- \nobreak\vskip .25\baselineskip plus.1\baselineskip
-}
-
-\def\dosecentry#1#2{\begingroup
- \secentryfonts \leftskip=\tocindent
- \tocentry{#1}{\dopageno{#2}}%
-\endgroup}
-
-\def\dosubsecentry#1#2{\begingroup
- \subsecentryfonts \leftskip=2\tocindent
- \tocentry{#1}{\dopageno{#2}}%
-\endgroup}
-
-\def\dosubsubsecentry#1#2{\begingroup
- \subsubsecentryfonts \leftskip=3\tocindent
- \tocentry{#1}{\dopageno{#2}}%
-\endgroup}
-
-% Final typesetting of a toc entry; we use the same \entry macro as for
-% the index entries, but we want to suppress hyphenation here. (We
-% can't do that in the \entry macro, since index entries might consist
-% of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
-%
-% \turnoffactive is for the sake of @" used for umlauts.
-\def\tocentry#1#2{\begingroup
- \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
- \entry{\turnoffactive #1}{\turnoffactive #2}%
-\endgroup}
-
-% Space between chapter (or whatever) number and the title.
-\def\labelspace{\hskip1em \relax}
-
-\def\dopageno#1{{\rm #1}}
-\def\doshortpageno#1{{\rm #1}}
-
-\def\chapentryfonts{\secfonts \rm}
-\def\secentryfonts{\textfonts}
-\let\subsecentryfonts = \textfonts
-\let\subsubsecentryfonts = \textfonts
-
-
-\message{environments,}
-
-% Since these characters are used in examples, it should be an even number of
-% \tt widths. Each \tt character is 1en, so two makes it 1em.
-% Furthermore, these definitions must come after we define our fonts.
-\newbox\dblarrowbox \newbox\longdblarrowbox
-\newbox\pushcharbox \newbox\bullbox
-\newbox\equivbox \newbox\errorbox
-
-%{\tentt
-%\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
-%\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
-%\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
-%\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
-% Adapted from the manmac format (p.420 of TeXbook)
-%\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
-% depth .1ex\hfil}
-%}
-
-% @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
-\def\point{$\star$}
-\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
-\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
-\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
-\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
-
-% Adapted from the TeXbook's \boxit.
-{\tentt \global\dimen0 = 3em}% Width of the box.
-\dimen2 = .55pt % Thickness of rules
-% The text. (`r' is open on the right, `e' somewhat less so on the left.)
-\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
-
-\global\setbox\errorbox=\hbox to \dimen0{\hfil
- \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
- \advance\hsize by -2\dimen2 % Rules.
- \vbox{
- \hrule height\dimen2
- \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
- \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
- \kern3pt\vrule width\dimen2}% Space to right.
- \hrule height\dimen2}
- \hfil}
-
-% The @error{} command.
-\def\error{\leavevmode\lower.7ex\copy\errorbox}
-
-% @tex ... @end tex escapes into raw Tex temporarily.
-% One exception: @ is still an escape character, so that @end tex works.
-% But \@ or @@ will get a plain tex @ character.
-
-\def\tex{\begingroup
-\catcode `\\=0 \catcode `\{=1 \catcode `\}=2
-\catcode `\$=3 \catcode `\&=4 \catcode `\#=6
-\catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
-\catcode `\%=14
-\catcode 43=12 % plus
-\catcode`\"=12
-\catcode`\==12
-\catcode`\|=12
-\catcode`\<=12
-\catcode`\>=12
-\escapechar=`\\
-%
-\let\,=\ptexcomma
-\let\~=\ptextilde
-\let\{=\ptexlbrace
-\let\}=\ptexrbrace
-\let\.=\ptexdot
-\let\*=\ptexstar
-\let\dots=\ptexdots
-\def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}
-\def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}
-\def\@{@}%
-\let\bullet=\ptexbullet
-\let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext
-%
-\let\Etex=\endgroup}
-
-% Define @lisp ... @endlisp.
-% @lisp does a \begingroup so it can rebind things,
-% including the definition of @endlisp (which normally is erroneous).
-
-% Amount to narrow the margins by for @lisp.
-\newskip\lispnarrowing \lispnarrowing=0.4in
-
-% This is the definition that ^^M gets inside @lisp, @example, and other
-% such environments. \null is better than a space, since it doesn't
-% have any width.
-\def\lisppar{\null\endgraf}
-
-% Make each space character in the input produce a normal interword
-% space in the output. Don't allow a line break at this space, as this
-% is used only in environments like @example, where each line of input
-% should produce a line of output anyway.
-%
-{\obeyspaces %
-\gdef\sepspaces{\obeyspaces\let =\tie}}
-
-% Define \obeyedspace to be our active space, whatever it is. This is
-% for use in \parsearg.
-{\sepspaces%
-\global\let\obeyedspace= }
-
-% This space is always present above and below environments.
-\newskip\envskipamount \envskipamount = 0pt
-
-% Make spacing and below environment symmetrical. We use \parskip here
-% to help in doing that, since in @example-like environments \parskip
-% is reset to zero; thus the \afterenvbreak inserts no space -- but the
-% start of the next paragraph will insert \parskip
-%
-\def\aboveenvbreak{{\advance\envskipamount by \parskip
-\endgraf \ifdim\lastskip<\envskipamount
-\removelastskip \penalty-50 \vskip\envskipamount \fi}}
-
-\let\afterenvbreak = \aboveenvbreak
-
-% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins.
-\let\nonarrowing=\relax
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% \cartouche: draw rectangle w/rounded corners around argument
-\font\circle=lcircle10
-\newdimen\circthick
-\newdimen\cartouter\newdimen\cartinner
-\newskip\normbskip\newskip\normpskip\newskip\normlskip
-\circthick=\fontdimen8\circle
-%
-\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
-\def\ctr{{\hskip 6pt\circle\char'010}}
-\def\cbl{{\circle\char'012\hskip -6pt}}
-\def\cbr{{\hskip 6pt\circle\char'011}}
-\def\carttop{\hbox to \cartouter{\hskip\lskip
- \ctl\leaders\hrule height\circthick\hfil\ctr
- \hskip\rskip}}
-\def\cartbot{\hbox to \cartouter{\hskip\lskip
- \cbl\leaders\hrule height\circthick\hfil\cbr
- \hskip\rskip}}
-%
-\newskip\lskip\newskip\rskip
-
-\long\def\cartouche{%
-\begingroup
- \lskip=\leftskip \rskip=\rightskip
- \leftskip=0pt\rightskip=0pt %we want these *outside*.
- \cartinner=\hsize \advance\cartinner by-\lskip
- \advance\cartinner by-\rskip
- \cartouter=\hsize
- \advance\cartouter by 18pt % allow for 3pt kerns on either
-% side, and for 6pt waste from
-% each corner char
- \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
- % Flag to tell @lisp, etc., not to narrow margin.
- \let\nonarrowing=\comment
- \vbox\bgroup
- \baselineskip=0pt\parskip=0pt\lineskip=0pt
- \carttop
- \hbox\bgroup
- \hskip\lskip
- \vrule\kern3pt
- \vbox\bgroup
- \hsize=\cartinner
- \kern3pt
- \begingroup
- \baselineskip=\normbskip
- \lineskip=\normlskip
- \parskip=\normpskip
- \vskip -\parskip
-\def\Ecartouche{%
- \endgroup
- \kern3pt
- \egroup
- \kern3pt\vrule
- \hskip\rskip
- \egroup
- \cartbot
- \egroup
-\endgroup
-}}
-
-
-% This macro is called at the beginning of all the @example variants,
-% inside a group.
-\def\nonfillstart{%
- \aboveenvbreak
- \inENV % This group ends at the end of the body
- \hfuzz = 12pt % Don't be fussy
- \sepspaces % Make spaces be word-separators rather than space tokens.
- \singlespace
- \let\par = \lisppar % don't ignore blank lines
- \obeylines % each line of input is a line of output
- \parskip = 0pt
- \parindent = 0pt
- \emergencystretch = 0pt % don't try to avoid overfull boxes
- % @cartouche defines \nonarrowing to inhibit narrowing
- % at next level down.
- \ifx\nonarrowing\relax
- \advance \leftskip by \lispnarrowing
- \exdentamount=\lispnarrowing
- \let\exdent=\nofillexdent
- \let\nonarrowing=\relax
- \fi
-}
-
-% To ending an @example-like environment, we first end the paragraph
-% (via \afterenvbreak's vertical glue), and then the group. That way we
-% keep the zero \parskip that the environments set -- \parskip glue
-% will be inserted at the beginning of the next paragraph in the
-% document, after the environment.
-%
-\def\nonfillfinish{\afterenvbreak\endgroup}%
-
-% This macro is
-\def\lisp{\begingroup
- \nonfillstart
- \let\Elisp = \nonfillfinish
- \tt
- \rawbackslash % have \ input char produce \ char from current font
- \gobble
-}
-
-% Define the \E... control sequence only if we are inside the
-% environment, so the error checking in \end will work.
-%
-% We must call \lisp last in the definition, since it reads the
-% return following the @example (or whatever) command.
-%
-\def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
-\def\smallexample{\begingroup \def\Esmallexample{\nonfillfinish\endgroup}\lisp}
-\def\smalllisp{\begingroup \def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
-
-% @smallexample and @smalllisp. This is not used unless the @smallbook
-% command is given. Originally contributed by Pavel@xerox.
-%
-\def\smalllispx{\begingroup
- \nonfillstart
- \let\Esmalllisp = \nonfillfinish
- \let\Esmallexample = \nonfillfinish
- %
- % Smaller fonts for small examples.
- \indexfonts \tt
- \rawbackslash % make \ output the \ character from the current font (tt)
- \gobble
-}
-
-% This is @display; same as @lisp except use roman font.
-%
-\def\display{\begingroup
- \nonfillstart
- \let\Edisplay = \nonfillfinish
- \gobble
-}
-
-% This is @format; same as @display except don't narrow margins.
-%
-\def\format{\begingroup
- \let\nonarrowing = t
- \nonfillstart
- \let\Eformat = \nonfillfinish
- \gobble
-}
-
-% @flushleft (same as @format) and @flushright.
-%
-\def\flushleft{\begingroup
- \let\nonarrowing = t
- \nonfillstart
- \let\Eflushleft = \nonfillfinish
- \gobble
-}
-\def\flushright{\begingroup
- \let\nonarrowing = t
- \nonfillstart
- \let\Eflushright = \nonfillfinish
- \advance\leftskip by 0pt plus 1fill
- \gobble}
-
-% @quotation does normal linebreaking (hence we can't use \nonfillstart)
-% and narrows the margins.
-%
-\def\quotation{%
- \begingroup\inENV %This group ends at the end of the @quotation body
- {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
- \singlespace
- \parindent=0pt
- % We have retained a nonzero parskip for the environment, since we're
- % doing normal filling. So to avoid extra space below the environment...
- \def\Equotation{\parskip = 0pt \nonfillfinish}%
- %
- % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
- \ifx\nonarrowing\relax
- \advance\leftskip by \lispnarrowing
- \advance\rightskip by \lispnarrowing
- \exdentamount = \lispnarrowing
- \let\nonarrowing = \relax
- \fi
-}
-
-\message{defuns,}
-% Define formatter for defuns
-% First, allow user to change definition object font (\df) internally
-\def\setdeffont #1 {\csname DEF#1\endcsname}
-
-\newskip\defbodyindent \defbodyindent=.4in
-\newskip\defargsindent \defargsindent=50pt
-\newskip\deftypemargin \deftypemargin=12pt
-\newskip\deflastargmargin \deflastargmargin=18pt
-
-\newcount\parencount
-% define \functionparens, which makes ( and ) and & do special things.
-% \functionparens affects the group it is contained in.
-\def\activeparens{%
-\catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
-\catcode`\[=\active \catcode`\]=\active}
-
-% Make control sequences which act like normal parenthesis chars.
-\let\lparen = ( \let\rparen = )
-
-{\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
-
-% Be sure that we always have a definition for `(', etc. For example,
-% if the fn name has parens in it, \boldbrax will not be in effect yet,
-% so TeX would otherwise complain about undefined control sequence.
-\global\let(=\lparen \global\let)=\rparen
-\global\let[=\lbrack \global\let]=\rbrack
-
-\gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
-\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
-% This is used to turn on special parens
-% but make & act ordinary (given that it's active).
-\gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr}
-
-% Definitions of (, ) and & used in args for functions.
-% This is the definition of ( outside of all parentheses.
-\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested %
-\global\advance\parencount by 1 }
-%
-% This is the definition of ( when already inside a level of parens.
-\gdef\opnested{\char`\(\global\advance\parencount by 1 }
-%
-\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
-% also in that case restore the outer-level definition of (.
-\ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
-\global\advance \parencount by -1 }
-% If we encounter &foo, then turn on ()-hacking afterwards
-\gdef\amprm#1 {{\rm\&#1}\let(=\oprm \let)=\clrm\ }
-%
-\gdef\normalparens{\boldbrax\let&=\ampnr}
-} % End of definition inside \activeparens
-%% These parens (in \boldbrax) actually are a little bolder than the
-%% contained text. This is especially needed for [ and ]
-\def\opnr{{\sf\char`\(}} \def\clnr{{\sf\char`\)}} \def\ampnr{\&}
-\def\lbrb{{\bf\char`\[}} \def\rbrb{{\bf\char`\]}}
-
-% First, defname, which formats the header line itself.
-% #1 should be the function name.
-% #2 should be the type of definition, such as "Function".
-
-\def\defname #1#2{%
-% Get the values of \leftskip and \rightskip as they were
-% outside the @def...
-\dimen2=\leftskip
-\advance\dimen2 by -\defbodyindent
-\dimen3=\rightskip
-\advance\dimen3 by -\defbodyindent
-\noindent %
-\setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
-\dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
-\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
-\parshape 2 0in \dimen0 \defargsindent \dimen1 %
-% Now output arg 2 ("Function" or some such)
-% ending at \deftypemargin from the right margin,
-% but stuck inside a box of width 0 so it does not interfere with linebreaking
-{% Adjust \hsize to exclude the ambient margins,
-% so that \rightline will obey them.
-\advance \hsize by -\dimen2 \advance \hsize by -\dimen3
-\rlap{\rightline{{\rm #2}\hskip \deftypemargin}}}%
-% Make all lines underfull and no complaints:
-\tolerance=10000 \hbadness=10000
-\advance\leftskip by -\defbodyindent
-\exdentamount=\defbodyindent
-{\df #1}\enskip % Generate function name
-}
-
-% Actually process the body of a definition
-% #1 should be the terminating control sequence, such as \Edefun.
-% #2 should be the "another name" control sequence, such as \defunx.
-% #3 should be the control sequence that actually processes the header,
-% such as \defunheader.
-
-\def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
-\medbreak %
-% Define the end token that this defining construct specifies
-% so that it will exit this group.
-\def#1{\endgraf\endgroup\medbreak}%
-\def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
-\parindent=0in
-\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
-\exdentamount=\defbodyindent
-\begingroup %
-\catcode 61=\active % 61 is `='
-\obeylines\activeparens\spacesplit#3}
-
-\def\defmethparsebody #1#2#3#4 {\begingroup\inENV %
-\medbreak %
-% Define the end token that this defining construct specifies
-% so that it will exit this group.
-\def#1{\endgraf\endgroup\medbreak}%
-\def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
-\parindent=0in
-\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
-\exdentamount=\defbodyindent
-\begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
-
-\def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
-\medbreak %
-% Define the end token that this defining construct specifies
-% so that it will exit this group.
-\def#1{\endgraf\endgroup\medbreak}%
-\def#2##1 ##2 {\def#4{##1}%
-\begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
-\parindent=0in
-\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
-\exdentamount=\defbodyindent
-\begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
-
-% These parsing functions are similar to the preceding ones
-% except that they do not make parens into active characters.
-% These are used for "variables" since they have no arguments.
-
-\def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
-\medbreak %
-% Define the end token that this defining construct specifies
-% so that it will exit this group.
-\def#1{\endgraf\endgroup\medbreak}%
-\def#2{\begingroup\obeylines\spacesplit#3}%
-\parindent=0in
-\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
-\exdentamount=\defbodyindent
-\begingroup %
-\catcode 61=\active %
-\obeylines\spacesplit#3}
-
-% This is used for \def{tp,vr}parsebody. It could probably be used for
-% some of the others, too, with some judicious conditionals.
-%
-\def\parsebodycommon#1#2#3{%
- \begingroup\inENV %
- \medbreak %
- % Define the end token that this defining construct specifies
- % so that it will exit this group.
- \def#1{\endgraf\endgroup\medbreak}%
- \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
- \parindent=0in
- \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
- \exdentamount=\defbodyindent
- \begingroup\obeylines
-}
-
-\def\defvrparsebody#1#2#3#4 {%
- \parsebodycommon{#1}{#2}{#3}%
- \spacesplit{#3{#4}}%
-}
-
-% This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
-% type is just `struct', because we lose the braces in `{struct
-% termios}' when \spacesplit reads its undelimited argument. Sigh.
-% \let\deftpparsebody=\defvrparsebody
-%
-% So, to get around this, we put \empty in with the type name. That
-% way, TeX won't find exactly `{...}' as an undelimited argument, and
-% won't strip off the braces.
-%
-\def\deftpparsebody #1#2#3#4 {%
- \parsebodycommon{#1}{#2}{#3}%
- \spacesplit{\parsetpheaderline{#3{#4}}}\empty
-}
-
-% Fine, but then we have to eventually remove the \empty *and* the
-% braces (if any). That's what this does, putting the result in \tptemp.
-%
-\def\removeemptybraces\empty#1\relax{\def\tptemp{#1}}%
-
-% After \spacesplit has done its work, this is called -- #1 is the final
-% thing to call, #2 the type name (which starts with \empty), and #3
-% (which might be empty) the arguments.
-%
-\def\parsetpheaderline#1#2#3{%
- \removeemptybraces#2\relax
- #1{\tptemp}{#3}%
-}%
-
-\def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
-\medbreak %
-% Define the end token that this defining construct specifies
-% so that it will exit this group.
-\def#1{\endgraf\endgroup\medbreak}%
-\def#2##1 ##2 {\def#4{##1}%
-\begingroup\obeylines\spacesplit{#3{##2}}}%
-\parindent=0in
-\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
-\exdentamount=\defbodyindent
-\begingroup\obeylines\spacesplit{#3{#5}}}
-
-% Split up #2 at the first space token.
-% call #1 with two arguments:
-% the first is all of #2 before the space token,
-% the second is all of #2 after that space token.
-% If #2 contains no space token, all of it is passed as the first arg
-% and the second is passed as empty.
-
-{\obeylines
-\gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
-\long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
-\ifx\relax #3%
-#1{#2}{}\else #1{#2}{#3#4}\fi}}
-
-% So much for the things common to all kinds of definitions.
-
-% Define @defun.
-
-% First, define the processing that is wanted for arguments of \defun
-% Use this to expand the args and terminate the paragraph they make up
-
-\def\defunargs #1{\functionparens \sl
-% Expand, preventing hyphenation at `-' chars.
-% Note that groups don't affect changes in \hyphenchar.
-\hyphenchar\tensl=0
-#1%
-\hyphenchar\tensl=45
-\ifnum\parencount=0 \else \errmessage{unbalanced parens in @def arguments}\fi%
-\interlinepenalty=10000
-\advance\rightskip by 0pt plus 1fil
-\endgraf\penalty 10000\vskip -\parskip\penalty 10000%
-}
-
-\def\deftypefunargs #1{%
-% Expand, preventing hyphenation at `-' chars.
-% Note that groups don't affect changes in \hyphenchar.
-% Use \boldbraxnoamp, not \functionparens, so that & is not special.
-\boldbraxnoamp
-\tclose{#1}% avoid \code because of side effects on active chars
-\interlinepenalty=10000
-\advance\rightskip by 0pt plus 1fil
-\endgraf\penalty 10000\vskip -\parskip\penalty 10000%
-}
-
-% Do complete processing of one @defun or @defunx line already parsed.
-
-% @deffn Command forward-char nchars
-
-\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
-
-\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
-\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
-\catcode 61=\other % Turn off change made in \defparsebody
-}
-
-% @defun == @deffn Function
-
-\def\defun{\defparsebody\Edefun\defunx\defunheader}
-
-\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
-\begingroup\defname {#1}{Function}%
-\defunargs {#2}\endgroup %
-\catcode 61=\other % Turn off change made in \defparsebody
-}
-
-% @deftypefun int foobar (int @var{foo}, float @var{bar})
-
-\def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
-
-% #1 is the data type. #2 is the name and args.
-\def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
-% #1 is the data type, #2 the name, #3 the args.
-\def\deftypefunheaderx #1#2 #3\relax{%
-\doind {fn}{\code{#2}}% Make entry in function index
-\begingroup\defname {\defheaderxcond#1\relax$$$#2}{Function}%
-\deftypefunargs {#3}\endgroup %
-\catcode 61=\other % Turn off change made in \defparsebody
-}
-
-% @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
-
-\def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
-
-% \defheaderxcond#1\relax$$$
-% puts #1 in @code, followed by a space, but does nothing if #1 is null.
-\def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi}
-
-% #1 is the classification. #2 is the data type. #3 is the name and args.
-\def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
-% #1 is the classification, #2 the data type, #3 the name, #4 the args.
-\def\deftypefnheaderx #1#2#3 #4\relax{%
-\doind {fn}{\code{#3}}% Make entry in function index
-\begingroup
-\normalparens % notably, turn off `&' magic, which prevents
-% at least some C++ text from working
-\defname {\defheaderxcond#2\relax$$$#3}{#1}%
-\deftypefunargs {#4}\endgroup %
-\catcode 61=\other % Turn off change made in \defparsebody
-}
-
-% @defmac == @deffn Macro
-
-\def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
-
-\def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
-\begingroup\defname {#1}{Macro}%
-\defunargs {#2}\endgroup %
-\catcode 61=\other % Turn off change made in \defparsebody
-}
-
-% @defspec == @deffn Special Form
-
-\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
-
-\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
-\begingroup\defname {#1}{Special Form}%
-\defunargs {#2}\endgroup %
-\catcode 61=\other % Turn off change made in \defparsebody
-}
-
-% This definition is run if you use @defunx
-% anywhere other than immediately after a @defun or @defunx.
-
-\def\deffnx #1 {\errmessage{@deffnx in invalid context}}
-\def\defunx #1 {\errmessage{@defunx in invalid context}}
-\def\defmacx #1 {\errmessage{@defmacx in invalid context}}
-\def\defspecx #1 {\errmessage{@defspecx in invalid context}}
-\def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
-\def\deftypeunx #1 {\errmessage{@deftypeunx in invalid context}}
-
-% @defmethod, and so on
-
-% @defop {Funny Method} foo-class frobnicate argument
-
-\def\defop #1 {\def\defoptype{#1}%
-\defopparsebody\Edefop\defopx\defopheader\defoptype}
-
-\def\defopheader #1#2#3{%
-\dosubind {fn}{\code{#2}}{on #1}% Make entry in function index
-\begingroup\defname {#2}{\defoptype{} on #1}%
-\defunargs {#3}\endgroup %
-}
-
-% @defmethod == @defop Method
-
-\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
-
-\def\defmethodheader #1#2#3{%
-\dosubind {fn}{\code{#2}}{on #1}% entry in function index
-\begingroup\defname {#2}{Method on #1}%
-\defunargs {#3}\endgroup %
-}
-
-% @defcv {Class Option} foo-class foo-flag
-
-\def\defcv #1 {\def\defcvtype{#1}%
-\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
-
-\def\defcvarheader #1#2#3{%
-\dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
-\begingroup\defname {#2}{\defcvtype{} of #1}%
-\defvarargs {#3}\endgroup %
-}
-
-% @defivar == @defcv {Instance Variable}
-
-\def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
-
-\def\defivarheader #1#2#3{%
-\dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
-\begingroup\defname {#2}{Instance Variable of #1}%
-\defvarargs {#3}\endgroup %
-}
-
-% These definitions are run if you use @defmethodx, etc.,
-% anywhere other than immediately after a @defmethod, etc.
-
-\def\defopx #1 {\errmessage{@defopx in invalid context}}
-\def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
-\def\defcvx #1 {\errmessage{@defcvx in invalid context}}
-\def\defivarx #1 {\errmessage{@defivarx in invalid context}}
-
-% Now @defvar
-
-% First, define the processing that is wanted for arguments of @defvar.
-% This is actually simple: just print them in roman.
-% This must expand the args and terminate the paragraph they make up
-\def\defvarargs #1{\normalparens #1%
-\interlinepenalty=10000
-\endgraf\penalty 10000\vskip -\parskip\penalty 10000}
-
-% @defvr Counter foo-count
-
-\def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
-
-\def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
-\begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
-
-% @defvar == @defvr Variable
-
-\def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
-
-\def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
-\begingroup\defname {#1}{Variable}%
-\defvarargs {#2}\endgroup %
-}
-
-% @defopt == @defvr {User Option}
-
-\def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
-
-\def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
-\begingroup\defname {#1}{User Option}%
-\defvarargs {#2}\endgroup %
-}
-
-% @deftypevar int foobar
-
-\def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
-
-% #1 is the data type. #2 is the name.
-\def\deftypevarheader #1#2{%
-\doind {vr}{\code{#2}}% Make entry in variables index
-\begingroup\defname {\defheaderxcond#1\relax$$$#2}{Variable}%
-\interlinepenalty=10000
-\endgraf\penalty 10000\vskip -\parskip\penalty 10000
-\endgroup}
-
-% @deftypevr {Global Flag} int enable
-
-\def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
-
-\def\deftypevrheader #1#2#3{\doind {vr}{\code{#3}}%
-\begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1}
-\interlinepenalty=10000
-\endgraf\penalty 10000\vskip -\parskip\penalty 10000
-\endgroup}
-
-% This definition is run if you use @defvarx
-% anywhere other than immediately after a @defvar or @defvarx.
-
-\def\defvrx #1 {\errmessage{@defvrx in invalid context}}
-\def\defvarx #1 {\errmessage{@defvarx in invalid context}}
-\def\defoptx #1 {\errmessage{@defoptx in invalid context}}
-\def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
-\def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
-
-% Now define @deftp
-% Args are printed in bold, a slight difference from @defvar.
-
-\def\deftpargs #1{\bf \defvarargs{#1}}
-
-% @deftp Class window height width ...
-
-\def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
-
-\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
-\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
-
-% This definition is run if you use @deftpx, etc
-% anywhere other than immediately after a @deftp, etc.
-
-\def\deftpx #1 {\errmessage{@deftpx in invalid context}}
-
-
-\message{cross reference,}
-% Define cross-reference macros
-\newwrite \auxfile
-
-\newif\ifhavexrefs % True if xref values are known.
-\newif\ifwarnedxrefs % True if we warned once that they aren't known.
-
-% @inforef is simple.
-\def\inforef #1{\inforefzzz #1,,,,**}
-\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
- node \samp{\ignorespaces#1{}}}
-
-% \setref{foo} defines a cross-reference point named foo.
-
-\def\setref#1{%
-\dosetq{#1-title}{Ytitle}%
-\dosetq{#1-pg}{Ypagenumber}%
-\dosetq{#1-snt}{Ysectionnumberandtype}}
-
-\def\unnumbsetref#1{%
-\dosetq{#1-title}{Ytitle}%
-\dosetq{#1-pg}{Ypagenumber}%
-\dosetq{#1-snt}{Ynothing}}
-
-\def\appendixsetref#1{%
-\dosetq{#1-title}{Ytitle}%
-\dosetq{#1-pg}{Ypagenumber}%
-\dosetq{#1-snt}{Yappendixletterandtype}}
-
-% \xref, \pxref, and \ref generate cross-references to specified points.
-% For \xrefX, #1 is the node name, #2 the name of the Info
-% cross-reference, #3 the printed node name, #4 the name of the Info
-% file, #5 the name of the printed manual. All but the node name can be
-% omitted.
-%
-\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
-\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
-\def\ref#1{\xrefX[#1,,,,,,,]}
-\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
- \def\printedmanual{\ignorespaces #5}%
- \def\printednodename{\ignorespaces #3}%
- \setbox1=\hbox{\printedmanual}%
- \setbox0=\hbox{\printednodename}%
- \ifdim \wd0 = 0pt
- % No printed node name was explicitly given.
- \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
- % Use the node name inside the square brackets.
- \def\printednodename{\ignorespaces #1}%
- \else
- % Use the actual chapter/section title appear inside
- % the square brackets. Use the real section title if we have it.
- \ifdim \wd1>0pt%
- % It is in another manual, so we don't have it.
- \def\printednodename{\ignorespaces #1}%
- \else
- \ifhavexrefs
- % We know the real title if we have the xref values.
- \def\printednodename{\refx{#1-title}{}}%
- \else
- % Otherwise just copy the Info node name.
- \def\printednodename{\ignorespaces #1}%
- \fi%
- \fi
- \fi
- \fi
- %
- % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
- % insert empty discretionaries after hyphens, which means that it will
- % not find a line break at a hyphen in a node names. Since some manuals
- % are best written with fairly long node names, containing hyphens, this
- % is a loss. Therefore, we give the text of the node name again, so it
- % is as if TeX is seeing it for the first time.
- \ifdim \wd1 > 0pt
- \putwordsection{} ``\printednodename'' in \cite{\printedmanual}%
- \else
- % _ (for example) has to be the character _ for the purposes of the
- % control sequence corresponding to the node, but it has to expand
- % into the usual \leavevmode...\vrule stuff for purposes of
- % printing. So we \turnoffactive for the \refx-snt, back on for the
- % printing, back off for the \refx-pg.
- {\turnoffactive \refx{#1-snt}{}}%
- \space [\printednodename],\space
- \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
- \fi
-\endgroup}
-
-% \dosetq is the interface for calls from other macros
-
-% Use \turnoffactive so that punctuation chars such as underscore
-% work in node names.
-\def\dosetq #1#2{{\let\folio=0 \turnoffactive \auxhat%
-\edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
-\next}}
-
-% \internalsetq {foo}{page} expands into
-% CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
-% When the aux file is read, ' is the escape character
-
-\def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
-
-% Things to be expanded by \internalsetq
-
-\def\Ypagenumber{\folio}
-
-\def\Ytitle{\thissection}
-
-\def\Ynothing{}
-
-\def\Ysectionnumberandtype{%
-\ifnum\secno=0 \putwordChapter\xreftie\the\chapno %
-\else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno %
-\else \ifnum \subsubsecno=0 %
-\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno %
-\else %
-\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
-\fi \fi \fi }
-
-\def\Yappendixletterandtype{%
-\ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}%
-\else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno %
-\else \ifnum \subsubsecno=0 %
-\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
-\else %
-\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
-\fi \fi \fi }
-
-\gdef\xreftie{'tie}
-
-% Use TeX 3.0's \inputlineno to get the line number, for better error
-% messages, but if we're using an old version of TeX, don't do anything.
-%
-\ifx\inputlineno\thisisundefined
- \let\linenumber = \empty % Non-3.0.
-\else
- \def\linenumber{\the\inputlineno:\space}
-\fi
-
-% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
-% If its value is nonempty, SUFFIX is output afterward.
-
-\def\refx#1#2{%
- \expandafter\ifx\csname X#1\endcsname\relax
- % If not defined, say something at least.
- $\langle$un\-de\-fined$\rangle$%
- \ifhavexrefs
- \message{\linenumber Undefined cross reference `#1'.}%
- \else
- \ifwarnedxrefs\else
- \global\warnedxrefstrue
- \message{Cross reference values unknown; you must run TeX again.}%
- \fi
- \fi
- \else
- % It's defined, so just use it.
- \csname X#1\endcsname
- \fi
- #2% Output the suffix in any case.
-}
-
-% Read the last existing aux file, if any. No error if none exists.
-
-% This is the macro invoked by entries in the aux file.
-\def\xrdef #1#2{
-{\catcode`\'=\other\expandafter \gdef \csname X#1\endcsname {#2}}}
-
-\def\readauxfile{%
-\begingroup
-\catcode `\^^@=\other
-\catcode `\=\other
-\catcode `\=\other
-\catcode `\^^C=\other
-\catcode `\^^D=\other
-\catcode `\^^E=\other
-\catcode `\^^F=\other
-\catcode `\^^G=\other
-\catcode `\^^H=\other
-\catcode `\ =\other
-\catcode `\^^L=\other
-\catcode `\=\other
-\catcode `\=\other
-\catcode `\=\other
-\catcode `\=\other
-\catcode `\=\other
-\catcode `\=\other
-\catcode `\=\other
-\catcode `\=\other
-\catcode `\=\other
-\catcode `\=\other
-\catcode `\=\other
-\catcode `\=\other
-\catcode 26=\other
-\catcode `\^^[=\other
-\catcode `\^^\=\other
-\catcode `\^^]=\other
-\catcode `\^^^=\other
-\catcode `\^^_=\other
-\catcode `\@=\other
-\catcode `\^=\other
-\catcode `\~=\other
-\catcode `\[=\other
-\catcode `\]=\other
-\catcode`\"=\other
-\catcode`\_=\other
-\catcode`\|=\other
-\catcode`\<=\other
-\catcode`\>=\other
-\catcode `\$=\other
-\catcode `\#=\other
-\catcode `\&=\other
-% `\+ does not work, so use 43.
-\catcode 43=\other
-% Make the characters 128-255 be printing characters
-{%
- \count 1=128
- \def\loop{%
- \catcode\count 1=\other
- \advance\count 1 by 1
- \ifnum \count 1<256 \loop \fi
- }%
-}%
-% the aux file uses ' as the escape.
-% Turn off \ as an escape so we do not lose on
-% entries which were dumped with control sequences in their names.
-% For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
-% Reference to such entries still does not work the way one would wish,
-% but at least they do not bomb out when the aux file is read in.
-\catcode `\{=1 \catcode `\}=2
-\catcode `\%=\other
-\catcode `\'=0
-\catcode`\^=7 % to make ^^e4 etc usable in xref tags
-\catcode `\\=\other
-\openin 1 \jobname.aux
-\ifeof 1 \else \closein 1 \input \jobname.aux \global\havexrefstrue
-\global\warnedobstrue
-\fi
-% Open the new aux file. Tex will close it automatically at exit.
-\openout \auxfile=\jobname.aux
-\endgroup}
-
-
-% Footnotes.
-
-\newcount \footnoteno
-
-% The trailing space in the following definition for supereject is
-% vital for proper filling; pages come out unaligned when you do a
-% pagealignmacro call if that space before the closing brace is
-% removed. (Generally, numeric constants should always be followed by a
-% space to prevent strange expansion errors.)
-\def\supereject{\par\penalty -20000\footnoteno =0 }
-
-% @footnotestyle is meaningful for info output only..
-\let\footnotestyle=\comment
-
-\let\ptexfootnote=\footnote
-
-{\catcode `\@=11
-%
-% Auto-number footnotes. Otherwise like plain.
-\gdef\footnote{%
- \global\advance\footnoteno by \@ne
- \edef\thisfootno{$^{\the\footnoteno}$}%
- %
- % In case the footnote comes at the end of a sentence, preserve the
- % extra spacing after we do the footnote number.
- \let\@sf\empty
- \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
- %
- % Remove inadvertent blank space before typesetting the footnote number.
- \unskip
- \thisfootno\@sf
- \footnotezzz
-}%
-
-% Don't bother with the trickery in plain.tex to not require the
-% footnote text as a parameter. Our footnotes don't need to be so general.
-%
-\long\gdef\footnotezzz#1{\insert\footins{%
- % We want to typeset this text as a normal paragraph, even if the
- % footnote reference occurs in (for example) a display environment.
- % So reset some parameters.
- \interlinepenalty\interfootnotelinepenalty
- \splittopskip\ht\strutbox % top baseline for broken footnotes
- \splitmaxdepth\dp\strutbox
- \floatingpenalty\@MM
- \leftskip\z@skip
- \rightskip\z@skip
- \spaceskip\z@skip
- \xspaceskip\z@skip
- \parindent\defaultparindent
- %
- % Hang the footnote text off the number.
- \hang
- \textindent{\thisfootno}%
- %
- % Don't crash into the line above the footnote text. Since this
- % expands into a box, it must come within the paragraph, lest it
- % provide a place where TeX can split the footnote.
- \footstrut
- #1\strut}%
-}
-
-}%end \catcode `\@=11
-
-% Set the baselineskip to #1, and the lineskip and strut size
-% correspondingly. There is no deep meaning behind these magic numbers
-% used as factors; they just match (closely enough) what Knuth defined.
-%
-\def\lineskipfactor{.08333}
-\def\strutheightpercent{.70833}
-\def\strutdepthpercent {.29167}
-%
-\def\setleading#1{%
- \normalbaselineskip = #1\relax
- \normallineskip = \lineskipfactor\normalbaselineskip
- \normalbaselines
- \setbox\strutbox =\hbox{%
- \vrule width0pt height\strutheightpercent\baselineskip
- depth \strutdepthpercent \baselineskip
- }%
-}
-
-% @| inserts a changebar to the left of the current line. It should
-% surround any changed text. This approach does *not* work if the
-% change spans more than two lines of output. To handle that, we would
-% have adopt a much more difficult approach (putting marks into the main
-% vertical list for the beginning and end of each change).
-%
-\def\|{%
- % \vadjust can only be used in horizontal mode.
- \leavevmode
- %
- % Append this vertical mode material after the current line in the output.
- \vadjust{%
- % We want to insert a rule with the height and depth of the current
- % leading; that is exactly what \strutbox is supposed to record.
- \vskip-\baselineskip
- %
- % \vadjust-items are inserted at the left edge of the type. So
- % the \llap here moves out into the left-hand margin.
- \llap{%
- %
- % For a thicker or thinner bar, change the `1pt'.
- \vrule height\baselineskip width1pt
- %
- % This is the space between the bar and the text.
- \hskip 12pt
- }%
- }%
-}
-
-% For a final copy, take out the rectangles
-% that mark overfull boxes (in case you have decided
-% that the text looks ok even though it passes the margin).
-%
-\def\finalout{\overfullrule=0pt}
-
-
-% End of control word definitions.
-
-\message{and turning on texinfo input format.}
-
-\def\openindices{%
- \newindex{cp}%
- \newcodeindex{fn}%
- \newcodeindex{vr}%
- \newcodeindex{tp}%
- \newcodeindex{ky}%
- \newcodeindex{pg}%
-}
-
-% Set some numeric style parameters, for 8.5 x 11 format.
-
-\hsize = 6in
-\hoffset = .25in
-\newdimen\defaultparindent \defaultparindent = 15pt
-\parindent = \defaultparindent
-\parskip 3pt plus 2pt minus 1pt
-\setleading{13.2pt}
-\advance\topskip by 1.2cm
-
-\chapheadingskip = 15pt plus 4pt minus 2pt
-\secheadingskip = 12pt plus 3pt minus 2pt
-\subsecheadingskip = 9pt plus 2pt minus 2pt
-
-% Prevent underfull vbox error messages.
-\vbadness=10000
-
-% Following George Bush, just get rid of widows and orphans.
-\widowpenalty=10000
-\clubpenalty=10000
-
-% Use TeX 3.0's \emergencystretch to help line breaking, but if we're
-% using an old version of TeX, don't do anything. We want the amount of
-% stretch added to depend on the line length, hence the dependence on
-% \hsize. This makes it come to about 9pt for the 8.5x11 format.
-%
-\ifx\emergencystretch\thisisundefined
- % Allow us to assign to \emergencystretch anyway.
- \def\emergencystretch{\dimen0}%
-\else
- \emergencystretch = \hsize
- \divide\emergencystretch by 45
-\fi
-
-% Use @smallbook to reset parameters for 7x9.5 format (or else 7x9.25)
-\def\smallbook{
- \global\chapheadingskip = 15pt plus 4pt minus 2pt
- \global\secheadingskip = 12pt plus 3pt minus 2pt
- \global\subsecheadingskip = 9pt plus 2pt minus 2pt
- %
- \global\lispnarrowing = 0.3in
- \setleading{12pt}
- \advance\topskip by -1cm
- \global\parskip 2pt plus 1pt
- \global\hsize = 5in
- \global\vsize=7.5in
- \global\tolerance=700
- \global\hfuzz=1pt
- \global\contentsrightmargin=0pt
- \global\deftypemargin=0pt
- \global\defbodyindent=.5cm
- %
- \global\pagewidth=\hsize
- \global\pageheight=\vsize
- %
- \global\let\smalllisp=\smalllispx
- \global\let\smallexample=\smalllispx
- \global\def\Esmallexample{\Esmalllisp}
-}
-
-% Use @afourpaper to print on European A4 paper.
-\def\afourpaper{
-\global\tolerance=700
-\global\hfuzz=1pt
-\setleading{12pt}
-\global\parskip 15pt plus 1pt
-
-\global\vsize= 53\baselineskip
-\advance\vsize by \topskip
-%\global\hsize= 5.85in % A4 wide 10pt
-\global\hsize= 6.5in
-\global\outerhsize=\hsize
-\global\advance\outerhsize by 0.5in
-\global\outervsize=\vsize
-\global\advance\outervsize by 0.6in
-
-\global\pagewidth=\hsize
-\global\pageheight=\vsize
-}
-
-\bindingoffset=0pt
-\normaloffset=\hoffset
-\pagewidth=\hsize
-\pageheight=\vsize
-
-% Allow control of the text dimensions. Parameters in order: textheight;
-% textwidth; voffset; hoffset; binding offset; topskip.
-% All require a dimension;
-% header is additional; added length extends the bottom of the page.
-
-\def\changepagesizes#1#2#3#4#5#6{
- \global\vsize= #1
- \global\topskip= #6
- \advance\vsize by \topskip
- \global\voffset= #3
- \global\hsize= #2
- \global\outerhsize=\hsize
- \global\advance\outerhsize by 0.5in
- \global\outervsize=\vsize
- \global\advance\outervsize by 0.6in
- \global\pagewidth=\hsize
- \global\pageheight=\vsize
- \global\normaloffset= #4
- \global\bindingoffset= #5}
-
-% A specific text layout, 24x15cm overall, intended for A4 paper. Top margin
-% 29mm, hence bottom margin 28mm, nominal side margin 3cm.
-\def\afourlatex
- {\global\tolerance=700
- \global\hfuzz=1pt
- \setleading{12pt}
- \global\parskip 15pt plus 1pt
- \advance\baselineskip by 1.6pt
- \changepagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}
- }
-
-% Use @afourwide to print on European A4 paper in wide format.
-\def\afourwide{\afourpaper
-\changepagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}}
-
-% Define macros to output various characters with catcode for normal text.
-\catcode`\"=\other
-\catcode`\~=\other
-\catcode`\^=\other
-\catcode`\_=\other
-\catcode`\|=\other
-\catcode`\<=\other
-\catcode`\>=\other
-\catcode`\+=\other
-\def\normaldoublequote{"}
-\def\normaltilde{~}
-\def\normalcaret{^}
-\def\normalunderscore{_}
-\def\normalverticalbar{|}
-\def\normalless{<}
-\def\normalgreater{>}
-\def\normalplus{+}
-
-% This macro is used to make a character print one way in ttfont
-% where it can probably just be output, and another way in other fonts,
-% where something hairier probably needs to be done.
-%
-% #1 is what to print if we are indeed using \tt; #2 is what to print
-% otherwise. Since all the Computer Modern typewriter fonts have zero
-% interword stretch (and shrink), and it is reasonable to expect all
-% typewriter fonts to have this, we can check that font parameter.
-%
-\def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
-
-% Turn off all special characters except @
-% (and those which the user can use as if they were ordinary).
-% Most of these we simply print from the \tt font, but for some, we can
-% use math or other variants that look better in normal text.
-
-\catcode`\"=\active
-\def\activedoublequote{{\tt \char '042}}
-\let"=\activedoublequote
-\catcode`\~=\active
-\def~{{\tt \char '176}}
-\chardef\hat=`\^
-\catcode`\^=\active
-\def\auxhat{\def^{'hat}}
-\def^{{\tt \hat}}
-
-\catcode`\_=\active
-\def_{\ifusingtt\normalunderscore\_}
-% Subroutine for the previous macro.
-\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}}
-
-\catcode`\|=\active
-\def|{{\tt \char '174}}
-\chardef \less=`\<
-\catcode`\<=\active
-\def<{{\tt \less}}
-\chardef \gtr=`\>
-\catcode`\>=\active
-\def>{{\tt \gtr}}
-\catcode`\+=\active
-\def+{{\tt \char 43}}
-%\catcode 27=\active
-%\def^^[{$\diamondsuit$}
-
-% Set up an active definition for =, but don't enable it most of the time.
-{\catcode`\==\active
-\global\def={{\tt \char 61}}}
-
-\catcode`+=\active
-\catcode`\_=\active
-
-% If a .fmt file is being used, characters that might appear in a file
-% name cannot be active until we have parsed the command line.
-% So turn them off again, and have \everyjob (or @setfilename) turn them on.
-% \otherifyactive is called near the end of this file.
-\def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
-
-\catcode`\@=0
-
-% \rawbackslashxx output one backslash character in current font
-\global\chardef\rawbackslashxx=`\\
-%{\catcode`\\=\other
-%@gdef@rawbackslashxx{\}}
-
-% \rawbackslash redefines \ as input to do \rawbackslashxx.
-{\catcode`\\=\active
-@gdef@rawbackslash{@let\=@rawbackslashxx }}
-
-% \normalbackslash outputs one backslash in fixed width font.
-\def\normalbackslash{{\tt\rawbackslashxx}}
-
-% Say @foo, not \foo, in error messages.
-\escapechar=`\@
-
-% \catcode 17=0 % Define control-q
-\catcode`\\=\active
-
-% Used sometimes to turn off (effectively) the active characters
-% even after parsing them.
-@def@turnoffactive{@let"=@normaldoublequote
-@let\=@realbackslash
-@let~=@normaltilde
-@let^=@normalcaret
-@let_=@normalunderscore
-@let|=@normalverticalbar
-@let<=@normalless
-@let>=@normalgreater
-@let+=@normalplus}
-
-@def@normalturnoffactive{@let"=@normaldoublequote
-@let\=@normalbackslash
-@let~=@normaltilde
-@let^=@normalcaret
-@let_=@normalunderscore
-@let|=@normalverticalbar
-@let<=@normalless
-@let>=@normalgreater
-@let+=@normalplus}
-
-% Make _ and + \other characters, temporarily.
-% This is canceled by @fixbackslash.
-@otherifyactive
-
-% If a .fmt file is being used, we don't want the `\input texinfo' to show up.
-% That is what \eatinput is for; after that, the `\' should revert to printing
-% a backslash.
-%
-@gdef@eatinput input texinfo{@fixbackslash}
-@global@let\ = @eatinput
-
-% On the other hand, perhaps the file did not have a `\input texinfo'. Then
-% the first `\{ in the file would cause an error. This macro tries to fix
-% that, assuming it is called before the first `\' could plausibly occur.
-% Also back turn on active characters that might appear in the input
-% file name, in case not using a pre-dumped format.
-%
-@gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi
- @catcode`+=@active @catcode`@_=@active}
-
-%% These look ok in all fonts, so just make them not special. The @rm below
-%% makes sure that the current font starts out as the newly loaded cmr10
-@catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
-
-@textfonts
-@rm
-
-@c Local variables:
-@c page-delimiter: "^\\\\message"
-@c End:
diff --git a/docs/text_widget.txt b/docs/text_widget.txt
deleted file mode 100644
index 599431f2f4..0000000000
--- a/docs/text_widget.txt
+++ /dev/null
@@ -1,487 +0,0 @@
-Date: Sun, 14 Sep 1997 20:17:06 -0700 (PDT)
-From: Josh MacDonald <jmacd@CS.Berkeley.EDU>
-To: gnome@athena.nuclecu.unam.mx, gtk-list@redhat.com
-Subject: [gtk-list] gtktext widget internal documentation
-
-
-Pete convinced me to just write up the text widget and let someone else
-finish it. I'm pretty busy and have other commitments now. Sorry. I think
-I'm not the most qualified for some of the remaining work anyway, because I
-don't really know Gtk and it's event model very well. Most of the work so
-far was possible without knowing Gtk all that well, it was simply a data
-structure exercise (though after reading this you might say it was a fairly
-complicated data structure exercise). I'm happy to answer questions.
-
--josh
-
-
-High level description:
-
-There are several layers of data structure to the widget. They are
-seperated from each other as much as possible. The first is a gapped
-text segment similar to the data structure Emacs uses for representing
-text. Then there is a property list, which stores text properties for
-various ranges of text. There is no direct relation between the text
-property list and the gapped text segment. Finally there is a drawn
-line parameter cache to speed calculations when drawing and redrawing
-lines on screen. In addition to these data structures, there are
-structures to help iterate over text in the buffer.
-
-The gapped text segment is quite simple. It's parameters are (all
-parameters I mention here are in the structure GtkText):
-
- guchar* text;
- guint text_len;
- guint gap_position;
- guint gap_size;
- guint text_end;
-
-TEXT is the buffer, TEXT_LEN is its allocated length. TEXT_END is the
-length of the text, including the gap. GAP_POSITION is the start of
-the gap, and GAP_SIZE is the gap's length. Therefore, TEXT_END -
-GAP_SIZE is the length of the text in the buffer. The macro
-TEXT_LENGTH returns this value. To get the value of a character in
-the buffer, use the macro TEXT_INDEX(TEXT,INDEX). This macro tests
-whether the index is less than the GAP_POSITION and returns
-TEXT[INDEX] or returns TEXT[GAP_SIZE+INDEX]. The function
-MOVE_GAP_TO_POINT positions the gap to a particular index. The
-function MAKE_FORWARD_SPACE lengthens the gap to provide room for a
-certain number of characters.
-
-The property list is a doubly linked list (GList) of text property
-data for each contiguous set of characters with similar properties.
-The data field of the GList points to a TextProperty structure, which
-contains:
-
- TextFont* font;
- GdkColor* back_color;
- GdkColor* fore_color;
- guint length;
-
-Currently, only font and color data are contained in the property
-list, but it can be extended by modifying the INSERT_TEXT_PROPERTY,
-TEXT_PROPERTIES_EQUAL, and a few other procedures. The text property
-structure does not contain an absolute offset, only a length. As a
-result, inserting a character into the buffer simply requires moving
-the gap to the correct position, making room in the buffer, and either
-inserting a new property or extending the old one. This logic is done
-by INSERT_TEXT_PROPERTY. A similar procedure exists to delete from
-the text property list, DELETE_TEXT_PROPERTY. Since the property
-structure doesn't contain an offset, insertion into the list is an
-O(1) operation. All such operations act on the insertion point, which
-is the POINT field of the GtkText structure.
-
-The GtkPropertyMark structure is used for keeping track of the mapping
-between absolute buffer offsets and positions in the property list.
-These will be referred to as property marks. Generally, there are
-four property marks the system keeps track of. Two are trivial, the
-beginning and the end of the buffer are easy to find. The other two
-are the insertion point (POINT) and the cursor point (CURSOR_MARK).
-All operations on the text buffer are done using a property mark as a
-sort of cursor to keep track of the alignment of the property list and
-the absolute buffer offset. The GtkPropertyMark structure contains:
-
- GList* property;
- guint offset;
- guint index;
-
-PROPERTY is a pointer at the current property list element. INDEX is
-the absolute buffer index, and OFFSET is the offset of INDEX from the
-beginning of PROPERTY. It is essential to keep property marks valid,
-or else you will have the wrong text properties at each property mark
-transition. An important point is that all property marks are invalid
-after a buffer modification unless care is taken to keep them
-accurate. That is the difficulty of the insert and delete operations,
-because as the next section describes, line data is cached and by
-neccesity contains text property marks. The functions for operating
-and computing property marks are:
-
- void advance_mark (GtkPropertyMark* mark);
- void decrement_mark (GtkPropertyMark* mark);
- void advance_mark_n (GtkPropertyMark* mark, gint n);
- void decrement_mark_n (GtkPropertyMark* mark, gint n);
- void move_mark_n (GtkPropertyMark* mark, gint n);
-
- GtkPropertyMark find_mark (GtkText* text, guint mark_position);
- GtkPropertyMark find_mark_near (GtkText* text, guint mark_position,
- const GtkPropertyMark* near);
-
-ADVANCE_MARK and DECREMENT_MARK modify the mark by plus or minus one
-buffer index. ADVANCE_MARK_N and DECREMENT_MARK_N modify the mark by
-plus or minus N indices. MOVE_MARK_N accepts a positive or negative
-argument. FIND_MARK returns a mark at MARK_POSITION using a linear
-search from the nearest known property mark (the beginning, the end,
-the point, etc). FIND_MARK_NEAR also does a linear search, but
-searches from the NEAR argument. A number of macros exist at the top
-of the file for doing things like getting the current text property,
-or some component of the current property. See the MARK_* macros.
-
-Next there is a LineParams structure which contains all the
-information neccesary to draw one line of text on screen. When I say
-"line" here, I do not mean one line of text seperated by newlines,
-rather I mean one row of text on screen. It is a matter of policy how
-visible lines are chosen and there are currently two policies,
-line-wrap and no-line-wrap. I suspect it would not be difficult to
-implement new policies for doing such things as justification. The
-LineParams structure includes the following fields:
-
- guint font_ascent;
- guint font_descent;
- guint pixel_width;
- guint displayable_chars;
- guint wraps : 1;
-
- PrevTabCont tab_cont;
- PrevTabCont tab_cont_next;
-
- GtkPropertyMark start;
- GtkPropertyMark end;
-
-FONT_ASCENT and FONT_DESCENT are the maximum ascent and descent of any
-character in the line. PIXEL_WIDTH is the number of pixels wide the
-drawn region is, though I don't think it's actually being used
-currently. You may wish to remove this field, eventually, though I
-suspect it will come in handy implementing horizontal scrolling.
-DISPLAYABLE_CHARS is the number of characters in the line actually
-drawn. This may be less than the number of characters in the line
-when line wrapping is off (see below). The bitflag WRAPS tells
-whether the next line is a continuation of this line. START and END
-are the marks at the beginning and end of the line. Note that END is
-the actual last character, not one past it, so the smallest line
-(containing, for example, one newline) has START == END. TAB_CONT and
-TAB_CONT_NEXT are for computation of tab positions. I will discuss
-them later.
-
-A point about the end of the buffer. You may be tempted to consider
-working with the buffer as an array of length TEXT_LENGTH(TEXT), but
-you have to be careful that the editor allows you to position your
-cursor at the last index of the buffer, one past the last character.
-The macro LAST_INDEX(TEXT, MARK) returns true if MARK is positioned at
-this index. If you see or add a special case in the code for this
-end-of-buffer case, make sure to use LAST_INDEX if you can. Very
-often, the last index is treated as a newline.
-
-[ One way the last index is special is that, although it is always
- part of some property, it will never be part of a property of
- length 1 unless there are no other characters in the text. That
- is, its properties are always that of the preceding character,
- if any.
-
- There is a fair bit of special case code to mantain this condition -
- which is needed so that user has control over the properties of
- characters inserted at the last position. OWT 2/9/98 ]
-
-Tab stops are variable width. A list of tab stops is contained in the
-GtkText structure:
-
- GList *tab_stops;
- gint default_tab_width;
-
-The elements of tab_stops are integers casted to gpointer. This is a
-little bogus, but works. For example:
-
- text->default_tab_width = 4;
- text->tab_stops = NULL;
- text->tab_stops = g_list_prepend (text->tab_stops, (void*)8);
- text->tab_stops = g_list_prepend (text->tab_stops, (void*)8);
-
-is how these fields are initialized, currently. This means that the
-first two tabs occur at 8 and 16, and every 4 characters thereafter.
-Tab stops are used in the computation of line geometry (to fill in a
-LineParams structure), and the width of the space character in the
-current font is used. The PrevTabCont structure, of which two are
-stored per line, is used to compute the geometry of lines which may
-have wrapped and carried part of a tab with them:
-
- guint pixel_offset;
- TabStopMark tab_start;
-
-PIXEL_OFFSET is the number of pixels at which the line should start,
-and tab_start is a tab stop mark, which is similar to a property mark,
-only it keeps track of the mapping between line position (column) and
-the next tab stop. A TabStopMark contains:
-
- GList* tab_stops;
- gint to_next_tab;
-
-TAB_STOPS is a pointer into the TAB_STOPS field of the GtkText
-structure. TO_NEXT_TAB is the number of characters before the next
-tab. The functions ADVANCE_TAB_MARK and ADVANCE_TAB_MARK_N advance
-these marks. The LineParams structure contains two PrevTabCont
-structures, which each contain a tab stop. The first (TAB_CONT) is
-for computing the beginning pixel offset, as mentioned above. The
-second (TAB_CONT_NEXT) is used to initialize the TAB_CONT field of the
-next line if it wraps.
-
-Since computing the parameters of a line are fairly complicated, I
-have one interface that should be all you ever need to figure out
-something about a line. The function FIND_LINE_PARAMS computes the
-parameters of a single line. The function LINE_PARAMS_ITERATE is used
-for computing the properties of some number (> 0) of sequential lines.
-
-void
-line_params_iterate (GtkText* text,
- const GtkPropertyMark* mark0,
- const PrevTabCont* tab_mark0,
- gboolean alloc,
- gpointer data,
- LineIteratorFunction iter);
-
-where LineIteratorFunction is:
-
-typedef gint (*LineIteratorFunction) (GtkText* text,
- LineParams* lp,
- gpointer data);
-
-The arguments are a text widget (TEXT), the property mark at the
-beginning of the first line (MARK0), the tab stop mark at the
-beginning of that line (TAB_MARK0), whether to heap-allocate the
-LineParams structure (ALLOC), some client data (DATA), and a function
-to call with the parameters of each line. TAB_MARK0 may be NULL, but
-if so MARK0 MUST BE A REAL LINE START (not a continued line start; it
-is preceded by a newline). If TAB_MARK0 is not NULL, MARK0 may be any
-line start (continued or not). See the code for examples. The
-function ITER is called with each LineParams computed. If ALLOC was
-true, LINE_PARAMS_ITERATE heap-allocates the LineParams and does not
-free them. Otherwise, no storage is permanently allocated. ITER
-should return TRUE when it wishes to continue no longer.
-
-There are currently two uses of LINE_PARAMS_ITERATE:
-
-* Compute the total buffer height for setting the parameters of the
- scroll bars. This is done in SET_VERTICAL_SCROLL each time the
- window is resized. When horizontal scrolling is added, depending on
- the policy chosen, the max line width can be computed here as well.
-
-* Computing geometry of some pixel height worth of lines. This is
- done in FETCH_LINES, FETCH_LINES_BACKWARD, FETCH_LINES_FORWARD, etc.
-
-The GtkText structure contains a cache of the LineParams data for all
-visible lines:
-
- GList *current_line;
- GList *line_start_cache;
-
- guint first_line_start_index;
- guint first_cut_pixels;
- guint first_onscreen_hor_pixel;
- guint first_onscreen_ver_pixel;
-
-LINE_START_CACHE is a doubly linked list of LineParams. CURRENT_LINE
-is a transient piece of data which is set in varoius places such as
-the mouse click code. Generally, it is the line on which the cursor
-property mark CURSOR_MARK is on. LINE_START_CACHE points to the first
-visible line and may contain PREV pointers if the cached data of
-offscreen lines is kept around. I haven't come up with a policy. The
-cache can keep more lines than are visible if desired, but the result
-is that inserts and deletes will then become slower as the entire
-cache has to be "corrected". Right now it doesn't delete from the
-cache (it should). As a result, scrolling through the whole buffer
-once will fill the cache with an entry for each line, and subsequent
-modifications will be slower than they should
-be. FIRST_LINE_START_INDEX is the index of the *REAL* line start of
-the first line. That is, if the first visible line is a continued
-line, this is the index of the real line start (preceded by a
-newline). FIRST_CUT_PIXELS is the number of pixels which are not
-drawn on the first visible line. If FIRST_CUT_PIXELS is zero, the
-whole line is visible. FIRST_ONSCREEN_HOR_PIXEL is not used.
-FIRST_ONSCREEN_VER_PIXEL is the absolute pixel which starts the
-visible region. This is used for setting the vertical scroll bar.
-
-Other miscellaneous things in the GtkText structure:
-
-Gtk specific things:
-
- GtkWidget widget;
-
- GdkWindow *text_area;
-
- GtkAdjustment *hadj;
- GtkAdjustment *vadj;
-
- GdkGC *gc;
-
- GdkPixmap* line_wrap_bitmap;
- GdkPixmap* line_arrow_bitmap;
-
-These are pretty self explanatory, especially if you know Gtk.
-LINE_WRAP_BITMAP and LINE_ARROW_BITMAP are two bitmaps used to
-indicate that a line wraps and is continued offscreen, respectively.
-
-Some flags:
-
- guint has_cursor : 1;
- guint is_editable : 1;
- guint line_wrap : 1;
- guint freeze : 1;
- guint has_selection : 1;
- guint own_selection : 1;
-
-HAS_CURSOR is true iff the cursor is visible. IS_EDITABLE is true iff
-the user is allowed to modify the buffer. If IS_EDITABLE is false,
-HAS_CURSOR is guaranteed to be false. If IS_EDITABLE is true,
-HAS_CURSOR starts out false and is set to true the first time the user
-clicks in the window. LINE_WRAP is where the line-wrap policy is
-set. True means wrap lines, false means continue lines offscreen,
-horizontally.
-
-The text properties list:
-
- GList *text_properties;
- GList *text_properties_end;
-
-A scratch area used for constructing a contiguous piece of the buffer
-which may otherwise span the gap. It is not strictly neccesary
-but simplifies the drawing code because it does not need to deal with
-the gap.
-
- guchar* scratch_buffer;
- guint scratch_buffer_len;
-
-The last vertical scrollbar position. Currently this looks the same
-as FIRST_ONSCREEN_VER_PIXEL. I can't remember why I have two values.
-Perhaps someone should clean this up.
-
- gint last_ver_value;
-
-The cursor:
-
- gint cursor_pos_x;
- gint cursor_pos_y;
- GtkPropertyMark cursor_mark;
- gchar cursor_char;
- gchar cursor_char_offset;
- gint cursor_virtual_x;
- gint cursor_drawn_level;
-
-CURSOR_POS_X and CURSOR_POS_Y are the screen coordinates of the
-cursor. CURSOR_MARK is the buffer position. CURSOR_CHAR is
-TEXT_INDEX (TEXT, CURSOR_MARK.INDEX) if a drawable character, or 0 if
-it is whitespace, which is treated specially. CURSOR_CHAR_OFFSET is
-the pixel offset above the base of the line at which it should be
-drawn. Note that the base of the line is not the "baseline" in the
-traditional font metric sense. A line (LineParams) is
-FONT_ASCENT+FONT_DESCENT high (use the macro LINE_HEIGHT). The
-"baseline" is FONT_DESCENT below the base of the line. I think this
-requires a drawing.
-
-0 AAAAAAA
-1 AAAAAAA
-2 AAAAAAAAA
-3 AAAAAAAAA
-4 AAAAA AAAAA
-5 AAAAA AAAAA
-6 AAAAA AAAAA
-7 AAAAA AAAAA
-8 AAAAA AAAAA
-9 AAAAAAAAAAAAAAAAA
-10 AAAAAAAAAAAAAAAAA
-11 AAAAA AAAAA
-12 AAAAA AAAAA
-13 AAAAAA AAAAAA
-14______________AAAAA___________AAAAA__________________________________
-15
-16
-17
-18
-19
-20
-
-This line is 20 pixels high, has FONT_ASCENT=14, FONT_DESCENT=6. It's
-"base" is at y=20. Characters are drawn at y=14. The LINE_START
-macro returns the pixel height. The LINE_CONTAINS macro is true if
-the line contains a certain buffer index. The LINE_STARTS_AT macro is
-true if the line starts at a certain buffer index. The
-LINE_START_PIXEL is the pixel offset the line should be drawn at,
-according the the tab continuation of the previous line.
-
-Exposure and drawing:
-
-Exposure is handled from the EXPOSE_TEXT function. It assumes that
-the LINE_START_CACHE and all it's parameters are accurate and simply
-exposes any line which is in the exposure region. It calls the
-CLEAR_AREA function to clear the background and/or lay down a pixmap
-background. The text widget has a scrollable pixmap background, which
-is implemented in CLEAR_AREA. CLEAR_AREA does the math to figure out
-how to tile the pixmap itself so that it can scroll the text with a
-copy area call. If the CURSOR argument to EXPOSE_TEXT is true, it
-also draws the cursor.
-
-The function DRAW_LINE draws a single line, doing all the tab and
-color computations neccesary. The function DRAW_LINE_WRAP draws the
-line wrap bitmap at the end of the line if it wraps. TEXT_EXPOSE will
-expand the cached line data list if it has to by calling
-FETCH_LINES_FORWARD. The functions DRAW_CURSOR and UNDRAW_CURSOR draw
-and undraw the cursor. They count the number of draws and undraws so
-that the cursor may be undrawn even if the cursor is already undrawn
-and the re-draw will not occur too early. This is useful in handling
-scrolling.
-
-Handling of the cursor is a little messed up, I should add. It has to
-be undrawn and drawn at various places. Something better needs to be
-done about this, because it currently doesn't do the right thing in
-certain places. I can't remember where very well. Look for the calls
-to DRAW_CURSOR and UNDRAW_CURSOR.
-
-RECOMPUTE_GEOMETRY is called when the geometry of the window changes
-or when it is first drawn. This is probably not done right. My
-biggest weakness in writing this code is that I've never written a
-widget before so I got most of the event handling stuff wrong as far
-as Gtk is concerned. Fortunatly, most of the code is unrelated and
-simply an exercise in data structure manipulation.
-
-Scrolling:
-
-Scrolling is fairly straighforward. It looks at the top line, and
-advances it pixel by pixel until the FIRST_CUT_PIXELS equals the line
-height and then advances the LINE_START_CACHE. When it runs out of
-lines it fetches more. The function SCROLL_INT is used to scroll from
-inside the code, it calls the appropriate functions and handles
-updating the scroll bars. It dispatches a change event which causes
-Gtk to call the correct scroll action, which then enters SCROLL_UP or
-SCROLL_DOWN. Careful with the cursor during these changes.
-
-Insertion, deletion:
-
-There's some confusion right now over what to do with the cursor when
-it's offscreen due to scrolling. This is a policy decision. I don't
-know what's best. Spencer criticized me for forcing it to stay
-onscreen. It shouldn't be hard to make stuff work with the cursor
-offscreen.
-
-Currently I've got functions to do insertion and deletion of a single
-character. It's fairly complicated. In order to do efficient pasting
-into the buffer, or write code that modifies the buffer while the
-buffer is drawn, it needs to do multiple characters at at time. This
-is the hardest part of what remains. Currently, gtk_text_insert does
-not reexpose the modified lines. It needs to. Pete did this wrong at
-one point and I disabled modification completely, I don't know what
-the current state of things are. The functions
-INSERT_CHAR_LINE_EXPOSE and DELETE_CHAR_LINE_EXPOSE do the work.
-Here's pseudo code for insert. Delete is quite similar.
-
- insert character into the buffer
- update the text property list
- move the point
- undraw the cursor
- correct all LineParams cache entries after the insertion point
- compute the new height of the modified line
- compare with the old height of the modified line
- remove the old LineParams from the cache
- insert the new LineParams into the cache
- if the lines are of different height, do a copy area to move the
- area below the insertion down
- expose the current line
- update the cursor mark
- redraw the cursor
-
-What needs to be done:
-
-Horizintal scrolling, robustness, testing, selection handling. If you
-want to work in the text widget pay attention to the debugging
-facilities I've written at the end of gtktext.c. I'm sorry I waited
-so long to try and pass this off. I'm super busy with school and
-work, and when I have free time my highest priority is another version
-of PRCS.
-
-Feel free to ask me questions.
diff --git a/docs/widget_system.txt b/docs/widget_system.txt
deleted file mode 100644
index a11580c0fa..0000000000
--- a/docs/widget_system.txt
+++ /dev/null
@@ -1,493 +0,0 @@
-Notes about the inner workings of the widget system of GTK+
-===========================================================
-
-This file contains some notes as to how the widget system does
-and should work. It consists of three parts:
-
- I) A description of the meaning of the various flags
-
- II) A list of invariants about the states of the widgets.
- (Throughout this document, we refer to the states of the
- widgets by referring to the flags for GtkWidget)
-
- III) Some notes about the ways that a widget changes states
-
- IV) A list of responsibilities of various widget signals when
- the states change.
-
-Any action necessary to maintain the invariants in II which is not
-explicitly mentioned in IV), is the responsibility of the core GTK
-code, which is roughly defined as:
-
- gtkobject.c
- gtkwidget.c
- gtkcontainer.c
- gtkmain.c
- gtksignal.c
-
-Section II is mostly of interest to those maintaining GTK, the
-other sections may also be interesting to people writing
-new widgets.
-
-Main outline:
- - Owen Taylor <owt1@cornell.edu>
- 1998/02/03
-
-Flag descriptions:
- - Tim Janik <timj@gimp.org>
- 1998/02/04
-
-I. Flags
---------
-
-GtkObject:
-
-GTK_DESTROYED:
- This flagged is set for a GtkObject right before its
- destruction code is executed. Its main use is the
- prevention of multiple destruction invokations.
-
-GTK_FLOATING:
- This flag reflects the fact that the holder of the
- initial reference count is unknown. Refer to refcounting.txt
- for further details.
-
-GTK_RESERVED_1:
-GTK_RESERVED_2:
- Reserved flags.
-
-
-GtkWidget, public flags:
-
-GTK_TOPLEVEL:
- Widgets without a real parent, as there are GtkWindows and
- GtkMenus have this flag set throughout their lifetime.
- Toplevel widgets always contain their own GdkWindow.
-
-GTK_NO_WINDOW:
- This flag is indicative for a widget that does not provide
- its own GdkWindow. Visible action (e.g. drawing) is performed
- on the parent's GdkWindow.
-
-GTK_REALIZED:
- Set by gtk_widget_realize, unset by gtk_widget_unrealize.
- Relies on ((widget->parent && widget->parent->window)
- || GTK_WIDGET_TOPLEVEL (widget));
- Means: widget has an associated GdkWindow (XWindow).
-
-GTK_MAPPED:
- Set by gtk_widget_map, unset by gtk_widget_unmap.
- May only be set if GTK_WIDGET_REALIZED (widget).
- Means: gdk_window_show() has been called on the widgets window(s).
-
-GTK_VISIBLE:
- Set by gtk_widget_show.
- Implies that a widget will be flagged GTK_MAPPED as soon as its
- parent is mapped.
-!GTK_VISIBLE:
- Set by gtk_widget_hide.
- Implies that a widget is not onscreen, therefore !GTK_MAPPED.
-
-GTK_SENSITIVE:
- Set and unset by gtk_widget_set_sensitive.
- The sensitivity of a widget determines whether it will receive
- certain events (e.g. button or key presses). One premise for
- the widgets sensitivity is to have GTK_SENSITIVE set.
-
-GTK_PARENT_SENSITIVE:
- Set and unset by gtk_widget_set_sensitive operations on the
- parents of the widget.
- This is the second premise for the widgets sensitivity. Once
- it has GTK_SENSITIVE and GTK_PARENT_SENSITIVE set, its state is
- effectively sensitive. This is expressed (and can be examined) by
- the GTK_WIDGET_IS_SENSITIVE macro.
-
-GTK_CAN_FOCUS:
- There are no directly corresponding functions for setting/unsetting
- this flag, but it can be affected by the GtkWidget::has_focus argument
- via gtk_widget_set_arg.
- This flag determines whether a widget is able to handle focus grabs.
-
-GTK_HAS_FOCUS:
- This flag will be set by gtk_widget_grab_focus for widgets that also
- have GTK_CAN_FOCUS set. The flag will be unset once another widget
- grabs the focus.
-
-GTK_CAN_DEFAULT:
-GTK_HAS_DEFAULT:
- These two flags are mostly equal in functionality to their *_FOCUS
- counterparts, but for the default widget.
-
-GTK_HAS_GRAB:
- Set by gtk_grab_add, unset by gtk_grab_remove.
- Means: widget is in the grab_widgets stack, and will be the preferred
- one for receiving events other than ones of cosmetic value.
-
-GTK_BASIC:
- The GTK_BASIC flag is an attempt at making a distinction
- between widgets that handle user input e.g. key/button presses
- and those that don't. Subsequent parent<->child relation ships
- of non `basic' widgets should be avoided. The checking for
- this is currently not properly enforced in the code. For
- example GtkButton is a non `basic' widget, that will therefore
- disallow to act as a container for another GtkButton. Now the
- gnit is, one can add a GtkHBox (which is a `basic' widget) to
- the first button, and put the second into the box.
-
-GTK_RESERVED_3:
-
-GTK_RC_STYLE:
- This flag indicates that its style has been looked up through
- the rc mechanism. It does not imply that the widget actually
- had a style defined through the rc mechanism.
-
-
-GtkWidget, private flags:
-
-GTK_USER_STYLE:
- A widget is flagged to have a user style, once gtk_widget_set_style
- has been invoked for it. The use of this flag is to tell widgets
- wich share a global user style from the ones which got a certain
- style assign from outside the toolkit.
-
-GTK_REDRAW_PENDING:
- Relies on GTK_WIDGET_MAPPED (widget).
- [FIXME: this is not really enforced throughout the code, but should
- be. it only requires a few checks for GTK_WIDGET_MAPPED and
- minor changes to gtk_widget_unmap, we can then remove the check
- in gtk_widget_real_destroy]
- Means: there is an idle handler waiting for the widget, that
- will cause a full redraw (gtk_widget_draw (widget, NULL)).
-
-GTK_RESIZE_PENDING:
- First, this is only valid for GtkContainers.
- [some of the code should move to gtkcontainer.c therefore]
- Relies on GTK_WIDGET_REALIZED(widget)
- [this is not really enforced throughout the code, but should
- be. it only requires a few checks for GTK_WIDGET_RELIZED and
- minor changes to gtk_widget_unrealize, we can then remove the check
- in gtk_widget_real_destroy]
- Means: there is an idle handler waiting for the container to
- resize it.
-
-GTK_RESIZE_NEEDED:
- Relies on GTK_WIDGET_REALIZED(widget)
- [this is not really enforced throughout the code, but should
- be. once this is done special checking in gtk_widget_real_destroy
- can be avoided]
- Means: a widget has been added to the resize_widgets list of
- its _toplevel_ container (keep this in mind for GtkViewport).
- Remark: this flag is also used internaly by gtkwindow.c during
- the evaluation of resizing worthy widgets.
-
-GTK_LEAVE_PENDING:
- A widget is flagged as such if there is a leave_notify event
- pending for it. It will receive this event regardless of a grab
- through another widget or its current sensitivity.
- [this should be made relying on GTK_REALIZED]
-
-GTK_HAS_SHAPE_MASK:
- Set by gtk_widget_shape_combine_mask if a widget got a shape mask
- assigned (making use of the X11 shaped window extension).
-
-GTK_IN_REPARENT:
- During the act of reparentation widgets which are already
- realized and will be added to an already realized parent need
- to have this flag set to prevent natural unrealization on the
- process of getting unparented.
-
-Related Macros:
-
-GTK_WIDGET_DRAWABLE:
- This macro examines whether a widget is flagged as GTK_WIDGET_VISIBLE
- and GTK_WIDGET_MAPPED.
- Means: it _makes sense_ to draw in a widgets window.
-
-GTK_WIDGET_IS_SENSITIVE:
- This macro tells the real sensitivity state of a widget. It returns
- whether both the widget and all its parents are in sensitive state.
-
-
-II. Invariants:
----------------
-
-This section describes various constraints on the states of
-the widget:
-
-In the following
-
- A => B means if A is true, than B is true
- A <=> B means A is true, if and only if B is true
- (equivalent to A => B and A <= B)
-
-
-1) GTK_WIDGET_DESTROYED (widget) => !GTK_WIDGET_REALIZED (widget)
- => !GTK_WIDGET_VISIBLE (widget)
-[ The latter is not currently in place, but it should be ]
-
-2) GTK_WIDGET_MAPPED (widget) => GTK_WIDGET_REALIZED (widget)
-
-3) if GTK_WIDGET_TOPLEVEL (widget):
- GTK_WIDGET_VISIBLE (widget) <=> GTK_WIDGET_MAPPED (widget)
-
-4) if !GTK_WIDGET_TOPLEVEL (widget):
- widget->parent && GTK_WIDGET_REALIZED (widget->parent) <=>
- GTK_WIDGET_REALIZED (widget)
-
-5) if !GTK_WIDGET_TOPLEVEL (widget):
-
- GTK_WIDGET_MAPPED (widget) => GTK_WIDGET_VISIBLE (widget)
- => GTK_WIDGET_REALIZED (widget)
-
- widget->parent && GTK_WIDGET_MAPPED (widget->parent) &&
- GTK_WIDGET_VISIBLE (widget) => GTK_WIDGET_MAPPED (widget)
-
-Note:, the definition
-
-[ GTK_WIDGET_DRAWABLE = GTK_WIDGET_VISIBLE && GTK_WIDGET_MAPPED
- is made in gtkwidget.c, but by 3) and 5),
-
- GTK_WIDGET_MAPPED => GTK_WIDGET_VISIBLE
-]
-
-6) GTK_REDRAW_PENDING => GTK_WIDGET_REALIZED
- GTK_RESIZE_PENDING => "
- GTK_LEAVE_PENDING => "
- GTK_RESIZE_NEEDED => "
-
-III. How states are changed:
-----------------------------
-
-How can the user control the state of a widget:
------------------------------------------------
-
-(In the following, set flag means set the flag, do appropriate
-actions, and enforce above invariants)
-
-gtk_widget_show:
- if !GTK_DESTROYED sets GTK_VISIBLE
-
-gtk_widget_hide:
- if !GTK_VISIBLE for widget
-
-gtk_widget_destroy:
- sets GTK_DESTROYED
- For a top-level widget
-
-gtk_widget_realize:
- if !GTK_DESTROYED sets GTK_REALIZED
-- Calling gtk_widget_realize when the widget is not a descendent
- of a toplevel is an ERROR.
-
-gtk_container_add (container, widget) [ and container-specific variants ]
- Sets widget->parent
-
-gtk_container_remove (container, widget)
- unsets widget->parent
-
-gtk_widget_reparent (widget, new_parent)
- Equivalent to removing widget from old parent and adding it to
- the new parent, except that the widget will not be temporarily
- unrealized if both the old parent and the new parent are realized.
-
-
-gtk_widget_unrealize
-gtk_widget_map
-gtk_widget_unmap
-
-These functions are not meant to be used by applications - they
-are used only by GTK and widgets to enforce invariants on the
-state.
-
-When The X window corresponding to a GTK window is destroyed:
--------------------------------------------------------------
-
-gtk_widget_destroy is called (as above).
-
-
-
-IV. Responsibilities of widgets
---------------------------------
-
-Adding to a container
----------------------
-
-When a widget is added to a container, the container:
-
- 1) calls gtk_widget_set_parent (widget, container)
- 2) calls gtk_widget_set_parent_window (widget, window) if
- the widget is being added to something other than container->window
- 3) if container is realized, and not widget, realizes widget
- 4) if container is mapped, and not widget and widget is GTK_VISIBLE,
- maps widget
- 5) Queues a resize if the widget is mapped
-
-Note: It would be nice to remove 3) and 4) out of widget specific code
- since they are of the invariant-enforcing nature, but it is
- a bit hard, since they can't be done until after 2)
-
-
-Removing from a container
--------------------------
-
-When a widget is removed to a container, the container:
-
- 1) Calls gtk_widget_unparent (widget)
- 2) Sets widget->parent to NULL
- 3) Queues a resize.
-
-Notes:
-
- gtk_widget_unparent unrealizes the widget except in the
- special case GTK_IN_REPARENT is set.
-
-
-At widget creation
-------------------
-
-Widgets are created in an unrealized state.
-
- 1) The widget should allocate and initialize needed data structures
-
-
-The Realize signal
-------------------
-
-When a widget recieves the "realize" signal it should:
-
- NO_WINDOW widgets: (probably OK to use default handler)
-
- 1) set the realized flag
- 2) set widget->window
- widget->window = gtk_widget_get_parent_window (widget);
- gdk_window_ref (widget->window);
- 3) attach the widget's style
-
- widget->style = gtk_style_attach (widget->style, widget->window);
-
- widget with window(s)
-
- 1) set the REALIZED flag
- 2) create windows with the parent obtained from
- gtk_widget_get_parent_window (widget);
- 3) attach the widget's style
- 4) set the background color for the new window based on the style
-
-The Map signal
---------------
-
- 1) Set the MAPPED flag
- 2) If the widget has any windows, gdk_window_show those windows
- 3) call gtk_widget_map for all child windows that are
- VISIBLE and !MAPPED.
- 3) Do any other functions related to putting the widget onscreen.
- (for instance, showing extra popup windows...)
-
-The Unmap signal
-----------------
-
-When a widget receives the unmap signal, it must:
-
- 1) If the widget has a window, gdk_window_hide that window,
- 2) If the widget does not have a window, unmap all child widgets
- 3) Do any other functions related to taking the widget offscreen
- (for instance, removing popup windows...)
- 3) Unset GTK_MAPPED
-
-
-The Unrealize signal
---------------------
-
-When a widget receives the unrealize signal, it must
-
- 1) For any windows other than widget->window do:
-
- gdk_window_set_user_data (window, NULL);
- gdk_window_destroy (window);
-
- 2) Call the parent's unrealize handler
-
-
-The Widget class unrealize handler will take care of unrealizing
-all children if necessary. [should this be made consistent with
-unmap???]
-
-
-The Destroy Signal
-------------------
-
-Commentary:
-
- The destroy signal probably shouldn't exist at all. A widget
- should merely be unrealized and removed from its parent
- when the user calls gtk_widget_destroy or a GDK_DESTROY event
- is received. However, a large body of code depends on
- getting a definitive signal when a widget goes away.
-
- That could be put in the finalization step, but, especially
- with language bindings, the cleanup step may need to refer
- back to the widget. (To use gtk_widget_get_data, for instance)
- If it does so via a pointer in a closure (natural for
- Scheme, or Perl), then the finalization procedure will never
- be called.
-
- Also, if we made that the finalization step, we would have
- to propagate the GDK_DESTROY event in any case, since it is
- at that point at which user-visible actions need to be taken.
-
-
-When a widget receives the destroy signal, it must:
-
- 1) If the widget "owns" any widgets other than its child
- widgets, (for instance popup windows) it should
- call gtk_widget_destroy () for them.
-
- 2) Call the parent class's destroy handler.
-
-
-The "destroy" signal will only be received once. A widget
-will never receive any other signals after the destroy
-signal (but see the sectionalize on "Finalize" below)
-
-The widget must handle calls to all publically accessible
-functions in an innocuous manner even after a "destroy"
-signal. (A widget can assume that it will not be realized
-after a "destroy" signal is received, which may simplify
-handling this requirement)
-
-
-The Finalize Pseudo-signal
---------------------------
-
-The finalize pseudo-signal is received after all references
-to the widget have been removed. The finalize callback
-cannot make any GTK calls with the widget as a parameter.
-
-1) Free any memory allocated by the widget. (But _not_
- the widget structure itself.
-
-2) Call the parent class's finalize signal
-
-
-A note on chaining "destroy" signals and finalize signals:
----------------------------------------------------------
-
-This is done by code like:
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-
-It may not be completely obvious why this works. Note
-that parent_class is a static variable on a per-class
-basis. So say: we have
-
- GtkFoo <- GtkBar <- GtkWidget <-GtkObject
-
-And that Foo, Widget, and Object all have destructors, but
-not Bar.
-
-Then gtk_foo_destroy will call gtk_widget_destroy (because
-it was not overridden in the Bar class structure) and
-gtk_widget_destroy will call gtk_object_destroy because
-the parent_class variable referenced by gtk_foo_destroy is the
-static variable in gtkwidget.c: GtkObjectClass.
diff --git a/gdk/.cvsignore b/gdk/.cvsignore
deleted file mode 100644
index bf7462512e..0000000000
--- a/gdk/.cvsignore
+++ /dev/null
@@ -1,9 +0,0 @@
-*.lo
-Makefile
-Makefile.in
-.deps
-_libs
-.libs
-libgdk.la
-gdkcursors.h
-gdkkeysyms.h
diff --git a/gdk/Makefile.am b/gdk/Makefile.am
deleted file mode 100644
index a0c4116f1f..0000000000
--- a/gdk/Makefile.am
+++ /dev/null
@@ -1,82 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-gdkincludedir = $(includedir)/gdk
-
-lib_LTLIBRARIES = libgdk.la
-
-libgdk_la_SOURCES = \
- gdk.c \
- gdkcc.c \
- gdkcolor.c \
- gdkcursor.c \
- gdkdnd.c \
- gdkdraw.c \
- gdkfont.c \
- gdkgc.c \
- gdkglobals.c \
- gdkimage.c \
- gdkinput.c \
- gdkinput.h \
- gdkinputnone.h \
- gdkinputcommon.h\
- gdkinputgxi.h \
- gdkinputxfree.h \
- gdkpixmap.c \
- gdkproperty.c \
- gdkrectangle.c \
- gdkregion.c \
- gdkselection.c \
- gdkvisual.c \
- gdkwindow.c \
- gdkxid.c \
- MwmUtil.h \
- gxid_lib.h \
- gxid_proto.h \
- gxid_lib.c
-## this last one is ifdef'd out unless XINPUT_GXI is defined
-## It's easier than trying to get automake to handle compiling
-## it conditionally
-
-gdkinclude_HEADERS = \
- gdk.h \
- gdkcursors.h \
- gdki18n.h \
- gdkkeysyms.h \
- gdkprivate.h \
- gdktypes.h \
- gdkx.h
-
-libgdk_la_LDFLAGS = -version-info 1:0:0 \
- @x_ldflags@ @x_libs@
-
-INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/glib -I../glib @x_cflags@
-
-EXTRA_PROGRAMS = gxid
-
-bin_PROGRAMS = @xinput_progs@
-
-gxid_SOURCES = gxid.c
-
-gxid_LDADD = \
- @x_ldflags@ \
- @x_libs@ \
- -lm
-
-BUILT_SOURCES = gdkcursors.h gdkkeysyms.h
-
-EXTRA_DIST = makecursors.awk makekeysyms.awk
-
-gdkcursors.h:
- awk -f $(srcdir)/makecursors.awk @x_includes@/X11/cursorfont.h > $@
-
-gdkkeysyms.h:
- awk -f $(srcdir)/makekeysyms.awk @x_includes@/X11/keysymdef.h > $@
-
-.PHONY: files
-
-files:
- @files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
- echo $$p; \
- done
-
-$(DEP_FILES) : $(BUILT_SOURCES)
diff --git a/gdk/MwmUtil.h b/gdk/MwmUtil.h
deleted file mode 100644
index 3628e9c0ce..0000000000
--- a/gdk/MwmUtil.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/**
- *
- * $Id$
- *
- * Copyright (C) 1995 Free Software Foundation, Inc.
- *
- * This file is part of the GNU LessTif Library.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- **/
-
-#ifndef MWMUTIL_H_INCLUDED
-#define MWMUTIL_H_INCLUDED
-
-#include <X11/Xmd.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
- CARD32 flags;
- CARD32 functions;
- CARD32 decorations;
- INT32 input_mode;
- CARD32 status;
-} MotifWmHints, MwmHints;
-
-#define MWM_HINTS_FUNCTIONS (1L << 0)
-#define MWM_HINTS_DECORATIONS (1L << 1)
-#define MWM_HINTS_INPUT_MODE (1L << 2)
-#define MWM_HINTS_STATUS (1L << 3)
-
-#define MWM_FUNC_ALL (1L << 0)
-#define MWM_FUNC_RESIZE (1L << 1)
-#define MWM_FUNC_MOVE (1L << 2)
-#define MWM_FUNC_MINIMIZE (1L << 3)
-#define MWM_FUNC_MAXIMIZE (1L << 4)
-#define MWM_FUNC_CLOSE (1L << 5)
-
-#define MWM_DECOR_ALL (1L << 0)
-#define MWM_DECOR_BORDER (1L << 1)
-#define MWM_DECOR_RESIZEH (1L << 2)
-#define MWM_DECOR_TITLE (1L << 3)
-#define MWM_DECOR_MENU (1L << 4)
-#define MWM_DECOR_MINIMIZE (1L << 5)
-#define MWM_DECOR_MAXIMIZE (1L << 6)
-
-#define MWM_INPUT_MODELESS 0
-#define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1
-#define MWM_INPUT_SYSTEM_MODAL 2
-#define MWM_INPUT_FULL_APPLICATION_MODAL 3
-#define MWM_INPUT_APPLICATION_MODAL MWM_INPUT_PRIMARY_APPLICATION_MODAL
-
-#define MWM_TEAROFF_WINDOW (1L<<0)
-
-/*
- * atoms
- */
-#define _XA_MOTIF_BINDINGS "_MOTIF_BINDINGS"
-#define _XA_MOTIF_WM_HINTS "_MOTIF_WM_HINTS"
-#define _XA_MOTIF_WM_MESSAGES "_MOTIF_WM_MESSAGES"
-#define _XA_MOTIF_WM_OFFSET "_MOTIF_WM_OFFSET"
-#define _XA_MOTIF_WM_MENU "_MOTIF_WM_MENU"
-#define _XA_MOTIF_WM_INFO "_MOTIF_WM_INFO"
-#define _XA_MWM_HINTS _XA_MOTIF_WM_HINTS
-#define _XA_MWM_MESSAGES _XA_MOTIF_WM_MESSAGES
-#define _XA_MWM_MENU _XA_MOTIF_WM_MENU
-#define _XA_MWM_INFO _XA_MOTIF_WM_INFO
-
-
-/*
- * _MWM_INFO property
- */
-typedef struct {
- long flags;
- Window wm_window;
-} MotifWmInfo;
-
-typedef MotifWmInfo MwmInfo;
-
-#define MWM_INFO_STARTUP_STANDARD (1L<<0)
-#define MWM_INFO_STARTUP_CUSTOM (1L<<1)
-
-/*
- * _MWM_HINTS property
- */
-typedef struct {
- CARD32 flags;
- CARD32 functions;
- CARD32 decorations;
- INT32 inputMode;
- CARD32 status;
-} PropMotifWmHints;
-
-typedef PropMotifWmHints PropMwmHints;
-
-#define PROP_MOTIF_WM_HINTS_ELEMENTS 5
-#define PROP_MWM_HINTS_ELEMENTS PROP_MOTIF_WM_HINTS_ELEMENTS
-
-/*
- * _MWM_INFO property, slight return
- */
-typedef struct {
- CARD32 flags;
- CARD32 wmWindow;
-} PropMotifWmInfo;
-
-typedef PropMotifWmInfo PropMwmInfo;
-
-#define PROP_MOTIF_WM_INFO_ELEMENTS 2
-#define PROP_MWM_INFO_ELEMENTS PROP_MOTIF_WM_INFO_ELEMENTS
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* MWMUTIL_H_INCLUDED */
diff --git a/gdk/gdk.c b/gdk/gdk.c
deleted file mode 100644
index 16d43da2bf..0000000000
--- a/gdk/gdk.c
+++ /dev/null
@@ -1,4035 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "../config.h"
-
-/* If you don't want to use gdk's signal handlers define this */
-/* #define I_NEED_TO_ACTUALLY_DEBUG_MY_PROGRAMS 1 */
-
-#include <X11/Xlocale.h>
-#include <ctype.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#ifdef USE_XIM
-#include <stdarg.h>
-#endif
-
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif /* HAVE_SYS_SELECT_H_ */
-
-#define XLIB_ILLEGAL_ACCESS
-#include <X11/Xatom.h>
-#include <X11/Xlib.h>
-#include <X11/Xos.h>
-#include <X11/Xutil.h>
-#include <X11/Xmu/WinUtil.h>
-#ifdef USE_XIM
-#include <X11/Xresource.h>
-#endif
-#include <X11/cursorfont.h>
-#include "gdk.h"
-#include "gdkprivate.h"
-#include "gdkinput.h"
-#ifdef USE_XIM
-#include "gdkx.h"
-#include "gdkkeysyms.h"
-#endif
-#include "gdki18n.h"
-
-#ifndef X_GETTIMEOFDAY
-#define X_GETTIMEOFDAY(tv) gettimeofday (tv, NULL)
-#endif /* X_GETTIMEOFDAY */
-
-
-#define DOUBLE_CLICK_TIME 250
-#define TRIPLE_CLICK_TIME 500
-#define DOUBLE_CLICK_DIST 5
-#define TRIPLE_CLICK_DIST 5
-
-
-#ifndef NO_FD_SET
-# define SELECT_MASK fd_set
-#else
-# ifndef _AIX
- typedef long fd_mask;
-# endif
-# if defined(_IBMR2)
-# define SELECT_MASK void
-# else
-# define SELECT_MASK int
-# endif
-#endif
-
-
-typedef struct _GdkInput GdkInput;
-typedef struct _GdkPredicate GdkPredicate;
-
-struct _GdkInput
-{
- gint tag;
- gint source;
- GdkInputCondition condition;
- GdkInputFunction function;
- gpointer data;
- GdkDestroyNotify destroy;
-};
-
-struct _GdkPredicate
-{
- GdkEventFunc func;
- gpointer data;
-};
-
-/*
- * Private function declarations
- */
-
-static GdkEvent *gdk_event_new (void);
-static gint gdk_event_wait (void);
-static gint gdk_event_apply_filters (XEvent *xevent,
- GdkEvent *event,
- GList *filters);
-static gint gdk_event_translate (GdkEvent *event,
- XEvent *xevent);
-#if 0
-static Bool gdk_event_get_type (Display *display,
- XEvent *xevent,
- XPointer arg);
-#endif
-static void gdk_synthesize_click (GdkEvent *event,
- gint nclicks);
-
-static void gdk_dnd_drag_begin (GdkWindow *initial_window);
-static void gdk_dnd_drag_enter (Window dest);
-static void gdk_dnd_drag_leave (Window dest);
-static void gdk_dnd_drag_end (Window dest,
- GdkPoint coords);
-static GdkAtom gdk_dnd_check_types (GdkWindow *window,
- XEvent *xevent);
-#ifdef DEBUG_DND
-static void gdk_print_atom (GdkAtom anatom);
-#endif
-
-/*
- * old junk from offix, we might use it though so leave it
- */
-Window gdk_get_client_window (Display *dpy,
- Window win);
-#ifdef WE_HAVE_MOTIF_DROPS_DONE
-static GdkWindow * gdk_drop_get_real_window (GdkWindow *w,
- guint16 *x,
- guint16 *y);
-#endif
-static void gdk_exit_func (void);
-static int gdk_x_error (Display *display,
- XErrorEvent *error);
-static int gdk_x_io_error (Display *display);
-static RETSIGTYPE gdk_signal (int signum);
-
-
-#ifdef USE_XIM
-static GdkIM gdk_im_get (void);
-static gint gdk_im_open (XrmDatabase db,
- gchar* res_name,
- gchar* rec_class);
-static void gdk_im_close (void);
-static void gdk_ic_cleanup (void);
-#endif /* USE_XIM */
-
-/* Private variable declarations
- */
-static int initialized = 0; /* 1 if the library is initialized,
- * 0 otherwise.
- */
-static int connection_number = 0; /* The file descriptor number of our
- * connection to the X server. This
- * is used so that we may determine
- * when events are pending by using
- * the "select" system call.
- */
-
-
-static struct timeval start; /* The time at which the library was
- * last initialized.
- */
-static struct timeval timer; /* Timeout interval to use in the call
- * to "select". This is used in
- * conjunction with "timerp" to create
- * a maximum time to wait for an event
- * to arrive.
- */
-static struct timeval *timerp; /* The actual timer passed to "select"
- * This may be NULL, in which case
- * "select" will block until an event
- * arrives.
- */
-static guint32 timer_val; /* The timeout length as specified by
- * the user in milliseconds.
- */
-static GList *inputs; /* A list of the input file descriptors
- * that we care about. Each list node
- * contains a GdkInput struct that describes
- * when we are interested in the specified
- * file descriptor. That is, when it is
- * available for read, write or has an
- * exception pending.
- */
-static guint32 button_click_time[2]; /* The last 2 button click times. Used
- * to determine if the latest button click
- * is part of a double or triple click.
- */
-static GdkWindow *button_window[2]; /* The last 2 windows to receive button presses.
- * Also used to determine if the latest button
- * click is part of a double or triple click.
- */
-static guint button_number[2]; /* The last 2 buttons to be pressed.
- */
-static GdkWindowPrivate *xgrab_window = NULL; /* Window that currently holds the
- * x pointer grab
- */
-
-#ifdef USE_XIM
-static gint xim_using; /* using XIM Protocol if TRUE */
-static GdkIM xim_im; /* global IM */
-static XIMStyles* xim_styles; /* im supports these styles */
-static XIMStyle xim_best_allowed_style;
-static GdkICPrivate *xim_ic; /* currently using IC */
-static GdkWindow* xim_window; /* currently using Widow */
-static GList* xim_ic_list;
-
-#endif
-
-#define OTHER_XEVENT_BUFSIZE 4
-static XEvent other_xevent[OTHER_XEVENT_BUFSIZE]; /* XEvents passed along to user */
-static int other_xevent_i = 0;
-static GList *putback_events = NULL;
-
-static gulong base_id;
-static gint autorepeat;
-
-#ifdef G_ENABLE_DEBUG
-static GDebugKey gdk_debug_keys[] = {
- {"events", GDK_DEBUG_EVENTS},
- {"misc", GDK_DEBUG_MISC},
- {"dnd", GDK_DEBUG_DND},
- {"color-context", GDK_DEBUG_COLOR_CONTEXT},
- {"xim", GDK_DEBUG_XIM}
-};
-
-static const int gdk_ndebug_keys = sizeof(gdk_debug_keys)/sizeof(GDebugKey);
-
-#endif /* G_ENABLE_DEBUG */
-
-/*
- *--------------------------------------------------------------
- * gdk_init
- *
- * Initialize the library for use.
- *
- * Arguments:
- * "argc" is the number of arguments.
- * "argv" is an array of strings.
- *
- * Results:
- * "argc" and "argv" are modified to reflect any arguments
- * which were not handled. (Such arguments should either
- * be handled by the application or dismissed).
- *
- * Side effects:
- * The library is initialized.
- *
- *--------------------------------------------------------------
- */
-
-void
-gdk_init (int *argc,
- char ***argv)
-{
- XKeyboardState keyboard_state;
- gint synchronize;
- gint i, j, k;
- XClassHint *class_hint;
- gint argc_orig = *argc;
- gchar **argv_orig;
-
- argv_orig = g_malloc ((argc_orig + 1) * sizeof (char*));
- for (i = 0; i < argc_orig; i++)
- argv_orig[i] = g_strdup ((*argv)[i]);
- argv_orig[argc_orig] = NULL;
-
- X_GETTIMEOFDAY (&start);
-
-#ifndef I_NEED_TO_ACTUALLY_DEBUG_MY_PROGRAMS
- signal (SIGHUP, gdk_signal);
- signal (SIGINT, gdk_signal);
- signal (SIGQUIT, gdk_signal);
- signal (SIGBUS, gdk_signal);
- signal (SIGSEGV, gdk_signal);
- signal (SIGPIPE, gdk_signal);
- signal (SIGTERM, gdk_signal);
-#endif
-
- gdk_display_name = NULL;
-
- XSetErrorHandler (gdk_x_error);
- XSetIOErrorHandler (gdk_x_io_error);
-
- synchronize = FALSE;
-
-#ifdef G_ENABLE_DEBUG
- {
- gchar *debug_string = getenv("GDK_DEBUG");
- if (debug_string != NULL)
- gdk_debug_flags = g_parse_debug_string (debug_string,
- gdk_debug_keys,
- gdk_ndebug_keys);
- }
-#endif /* G_ENABLE_DEBUG */
-
- if (argc && argv)
- {
- if (*argc > 0)
- gdk_progname = (*argv)[0];
-
- for (i = 1; i < *argc;)
- {
- if ((*argv)[i] == NULL)
- {
- i += 1;
- continue;
- }
-
-#ifdef G_ENABLE_DEBUG
- if (strcmp ("--gdk-debug", (*argv)[i]) == 0)
- {
- (*argv)[i] = NULL;
-
- if ((i + 1) < *argc && (*argv)[i + 1])
- {
- gdk_debug_flags |= g_parse_debug_string ((*argv)[i+1],
- gdk_debug_keys,
- gdk_ndebug_keys);
- (*argv)[i + 1] = NULL;
- i += 1;
- }
- }
- else if (strcmp ("--gdk-no-debug", (*argv)[i]) == 0)
- {
- (*argv)[i] = NULL;
-
- if ((i + 1) < *argc && (*argv)[i + 1])
- {
- gdk_debug_flags &= ~g_parse_debug_string ((*argv)[i+1],
- gdk_debug_keys,
- gdk_ndebug_keys);
- (*argv)[i + 1] = NULL;
- i += 1;
- }
- }
-#endif /* G_ENABLE_DEBUG */
- else if (strcmp ("--display", (*argv)[i]) == 0)
- {
- (*argv)[i] = NULL;
-
- if ((i + 1) < *argc && (*argv)[i + 1])
- {
- gdk_display_name = g_strdup ((*argv)[i + 1]);
- (*argv)[i + 1] = NULL;
- i += 1;
- }
- }
- else if (strcmp ("--sync", (*argv)[i]) == 0)
- {
- (*argv)[i] = NULL;
- synchronize = TRUE;
- }
- else if (strcmp ("--no-xshm", (*argv)[i]) == 0)
- {
- (*argv)[i] = NULL;
- gdk_use_xshm = FALSE;
- }
- else if (strcmp ("--name", (*argv)[i]) == 0)
- {
- if ((i + 1) < *argc && (*argv)[i + 1])
- {
- (*argv)[i++] = NULL;
- gdk_progname = (*argv)[i];
- (*argv)[i] = NULL;
- }
- }
- else if (strcmp ("--class", (*argv)[i]) == 0)
- {
- if ((i + 1) < *argc && (*argv)[i + 1])
- {
- (*argv)[i++] = NULL;
- gdk_progclass = (*argv)[i];
- (*argv)[i] = NULL;
- }
- }
-#ifdef XINPUT_GXI
- else if (strcmp ("--gxid_host", (*argv)[i]) == 0)
- {
- if ((i + 1) < *argc && (*argv)[i + 1])
- {
- (*argv)[i++] = NULL;
- gdk_input_gxid_host = ((*argv)[i]);
- (*argv)[i] = NULL;
- }
- }
- else if (strcmp ("--gxid_port", (*argv)[i]) == 0)
- {
- if ((i + 1) < *argc && (*argv)[i + 1])
- {
- (*argv)[i++] = NULL;
- gdk_input_gxid_port = atoi ((*argv)[i]);
- (*argv)[i] = NULL;
- }
- }
-#endif
-#ifdef USE_XIM
- else if (strcmp ("--xim-preedit", (*argv)[i]) == 0)
- {
- if ((i + 1) < *argc && (*argv)[i + 1])
- {
- (*argv)[i++] = NULL;
- if (strcmp ("none", (*argv)[i]) == 0)
- gdk_im_set_best_style (GdkIMPreeditNone);
- else if (strcmp ("nothing", (*argv)[i]) == 0)
- gdk_im_set_best_style (GdkIMPreeditNothing);
- else if (strcmp ("area", (*argv)[i]) == 0)
- gdk_im_set_best_style (GdkIMPreeditArea);
- else if (strcmp ("position", (*argv)[i]) == 0)
- gdk_im_set_best_style (GdkIMPreeditPosition);
- else if (strcmp ("callbacks", (*argv)[i]) == 0)
- gdk_im_set_best_style (GdkIMPreeditCallbacks);
- }
- }
- else if (strcmp ("--xim-status", (*argv)[i]) == 0)
- {
- if ((i + 1) < *argc && (*argv)[i + 1])
- {
- (*argv)[i++] = NULL;
- if (strcmp ("none", (*argv)[i]) == 0)
- gdk_im_set_best_style (GdkIMStatusNone);
- else if (strcmp ("nothing", (*argv)[i]) == 0)
- gdk_im_set_best_style (GdkIMStatusNothing);
- else if (strcmp ("area", (*argv)[i]) == 0)
- gdk_im_set_best_style (GdkIMStatusArea);
- else if (strcmp ("callbacks", (*argv)[i]) == 0)
- gdk_im_set_best_style (GdkIMStatusCallbacks);
- }
- }
-#endif
-
- i += 1;
- }
-
- for (i = 1; i < *argc; i++)
- {
- for (k = i; k < *argc; k++)
- if ((*argv)[k] != NULL)
- break;
-
- if (k > i)
- {
- k -= i;
- for (j = i + k; j < *argc; j++)
- (*argv)[j-k] = (*argv)[j];
- *argc -= k;
- }
- }
- }
- else
- {
- gdk_progname = "<unknown>";
- }
-
- gdk_display = XOpenDisplay (gdk_display_name);
- if (!gdk_display)
- {
- g_warning ("cannot open display: %s", XDisplayName (gdk_display_name));
- exit(1);
- }
-
- /* This is really crappy. We have to look into the display structure
- * to find the base resource id. This is only needed for recording
- * and playback of events.
- */
- /* base_id = RESOURCE_BASE; */
- base_id = 0;
- GDK_NOTE (EVENTS, g_print ("base id: %lu\n", base_id));
-
- connection_number = ConnectionNumber (gdk_display);
- GDK_NOTE (MISC,
- g_print ("connection number: %d\n", connection_number));
-
- if (synchronize)
- XSynchronize (gdk_display, True);
-
- gdk_screen = DefaultScreen (gdk_display);
- gdk_root_window = RootWindow (gdk_display, gdk_screen);
-
- gdk_leader_window = XCreateSimpleWindow(gdk_display, gdk_root_window,
- 10, 10, 10, 10, 0, 0 , 0);
- class_hint = XAllocClassHint();
- class_hint->res_name = gdk_progname;
- if (gdk_progclass == NULL)
- {
- gdk_progclass = g_strdup (gdk_progname);
- gdk_progclass[0] = toupper (gdk_progclass[0]);
- }
- class_hint->res_class = gdk_progclass;
- XSetClassHint(gdk_display, gdk_leader_window, class_hint);
- XSetCommand(gdk_display, gdk_leader_window, argv_orig, argc_orig);
- XFree (class_hint);
-
- for (i = 0; i < argc_orig; i++)
- g_free(argv_orig[i]);
- g_free(argv_orig);
-
- gdk_wm_delete_window = XInternAtom (gdk_display, "WM_DELETE_WINDOW", True);
- gdk_wm_take_focus = XInternAtom (gdk_display, "WM_TAKE_FOCUS", True);
- gdk_wm_protocols = XInternAtom (gdk_display, "WM_PROTOCOLS", True);
- gdk_wm_window_protocols[0] = gdk_wm_delete_window;
- gdk_wm_window_protocols[1] = gdk_wm_take_focus;
- gdk_selection_property = XInternAtom (gdk_display, "GDK_SELECTION", False);
-
- gdk_dnd.gdk_XdeEnter = gdk_atom_intern("_XDE_ENTER", FALSE);
- gdk_dnd.gdk_XdeLeave = gdk_atom_intern("_XDE_LEAVE", FALSE);
- gdk_dnd.gdk_XdeRequest = gdk_atom_intern("_XDE_REQUEST", FALSE);
- gdk_dnd.gdk_XdeDataAvailable = gdk_atom_intern("_XDE_DATA_AVAILABLE", FALSE);
- gdk_dnd.gdk_XdeTypelist = gdk_atom_intern("_XDE_TYPELIST", FALSE);
- gdk_dnd.c->gdk_cursor_dragdefault = XCreateFontCursor(gdk_display, XC_bogosity);
- gdk_dnd.c->gdk_cursor_dragok = XCreateFontCursor(gdk_display, XC_heart);
-
- XGetKeyboardControl (gdk_display, &keyboard_state);
- autorepeat = keyboard_state.global_auto_repeat;
-
- timer.tv_sec = 0;
- timer.tv_usec = 0;
- timerp = NULL;
-
- button_click_time[0] = 0;
- button_click_time[1] = 0;
- button_window[0] = NULL;
- button_window[1] = NULL;
- button_number[0] = -1;
- button_number[1] = -1;
-
- if (ATEXIT (gdk_exit_func))
- g_warning ("unable to register exit function");
-
- gdk_visual_init ();
- gdk_window_init ();
- gdk_image_init ();
- gdk_input_init ();
-
-#ifdef USE_XIM
- /* initialize XIM Protocol variables */
- xim_using = FALSE;
- xim_im = NULL;
- xim_styles = NULL;
- if (!(xim_best_allowed_style & GdkIMPreeditMask))
- gdk_im_set_best_style (GdkIMPreeditCallbacks);
- if (!(xim_best_allowed_style & GdkIMStatusMask))
- gdk_im_set_best_style (GdkIMStatusCallbacks);
- xim_ic = NULL;
- xim_window = (GdkWindow*)NULL;
-
- gdk_im_open (NULL, NULL, NULL);
-#endif
-
- initialized = 1;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_exit
- *
- * Restores the library to an un-itialized state and exits
- * the program using the "exit" system call.
- *
- * Arguments:
- * "errorcode" is the error value to pass to "exit".
- *
- * Results:
- * Allocated structures are freed and the program exits
- * cleanly.
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-void
-gdk_exit (int errorcode)
-{
- /* de-initialisation is done by the gdk_exit_funct(),
- no need to do this here (Alex J.) */
- exit (errorcode);
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_set_locale
- *
- * Arguments:
- *
- * Results:
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-gchar*
-gdk_set_locale ()
-{
- if (!setlocale (LC_ALL,""))
- g_print ("locale not supported by C library\n");
-
- if (!XSupportsLocale ())
- {
- g_print ("locale not supported by Xlib, locale set to C\n");
- setlocale (LC_ALL, "C");
- }
-
- if (!XSetLocaleModifiers (""))
- {
- g_print ("can not set locale modifiers\n");
- }
-
- return setlocale (LC_ALL,NULL);
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_events_pending
- *
- * Returns the number of events pending on the queue.
- * These events have already been read from the server
- * connection.
- *
- * Arguments:
- *
- * Results:
- * Returns the number of events on XLib's event queue.
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-gint
-gdk_events_pending ()
-{
- gint result;
- GList *tmp_list;
-
- result = XPending (gdk_display);
-
- tmp_list = putback_events;
- while (tmp_list)
- {
- result++;
- tmp_list = tmp_list->next;
- }
-
- return result;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_event_get_graphics_expose
- *
- * Waits for a GraphicsExpose or NoExpose event
- *
- * Arguments:
- *
- * Results:
- * For GraphicsExpose events, returns a pointer to the event
- * converted into a GdkEvent Otherwise, returns NULL.
- *
- * Side effects:
- *
- *-------------------------------------------------------------- */
-
-static Bool
-graphics_expose_predicate (Display *display,
- XEvent *xevent,
- XPointer arg)
-{
- GdkWindowPrivate *private = (GdkWindowPrivate *)arg;
-
- g_return_val_if_fail (private != NULL, False);
-
- if ((xevent->xany.window == private->xwindow) &&
- ((xevent->xany.type == GraphicsExpose) ||
- (xevent->xany.type == NoExpose)))
- return True;
- else
- return False;
-}
-
-GdkEvent *
-gdk_event_get_graphics_expose (GdkWindow *window)
-{
- XEvent xevent;
- GdkEvent *event;
-
- g_return_val_if_fail (window != NULL, NULL);
-
- XIfEvent (gdk_display, &xevent, graphics_expose_predicate, (XPointer)window);
-
- if (xevent.xany.type == GraphicsExpose)
- {
- event = gdk_event_new ();
-
- if (gdk_event_translate (event, &xevent))
- return event;
- else
- gdk_event_free (event);
- }
-
- return NULL;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_event_get
- *
- * Gets the next event.
- *
- * Arguments:
- *
- * Results:
- * If an event was received that we care about, returns
- * a pointer to that event, to be freed with gdk_event_free.
- * Otherwise, returns NULL. This function will also return
- * before an event is received if the timeout interval
- * runs out.
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-GdkEvent *
-gdk_event_get (void)
-{
- GdkEvent *event;
- GList *temp_list;
- XEvent xevent;
-
-#if 0
- if (pred)
- {
- temp_list = putback_events;
- while (temp_list)
- {
- temp_event = temp_list->data;
-
- if ((* pred) (temp_event, data))
- {
- if (event)
- *event = *temp_event;
- putback_events = g_list_remove_link (putback_events, temp_list);
- g_list_free (temp_list);
- return TRUE;
- }
-
- temp_list = temp_list->next;
- }
-
- event_pred.func = pred;
- event_pred.data = data;
-
- if (XCheckIfEvent (gdk_display, &xevent, gdk_event_get_type, (XPointer) & event_pred))
- if (event)
- return gdk_event_translate (event, &xevent);
- }
- else
-#endif
- if (putback_events)
- {
- event = putback_events->data;
-
- temp_list = putback_events;
- putback_events = g_list_remove_link (putback_events, temp_list);
- g_list_free_1 (temp_list);
-
- return event;
- }
-
- /* Wait for an event to occur or the timeout to elapse.
- * If an event occurs "gdk_event_wait" will return TRUE.
- * If the timeout elapses "gdk_event_wait" will return
- * FALSE.
- */
- if (gdk_event_wait ())
- {
- /* If we get here we can rest assurred that an event
- * has occurred. Read it.
- */
-#ifdef USE_XIM
- gint filter_status;
- if (xim_using && xim_window)
- do
- { /* don't dispatch events used by IM */
- XNextEvent (gdk_display, &xevent);
- filter_status = XFilterEvent (&xevent,
- GDK_WINDOW_XWINDOW (xim_window));
- } while (filter_status == True);
- else
- XNextEvent (gdk_display, &xevent);
-#else
- XNextEvent (gdk_display, &xevent);
-#endif
- event = gdk_event_new ();
-
- event->any.type = GDK_NOTHING;
- event->any.window = NULL;
- event->any.send_event = FALSE;
- event->any.send_event = xevent.xany.send_event;
-
- if (gdk_event_translate (event, &xevent))
- return event;
- else
- gdk_event_free (event);
- }
-
- return NULL;
-}
-
-void
-gdk_event_put (GdkEvent *event)
-{
- GdkEvent *new_event;
-
- g_return_if_fail (event != NULL);
-
- new_event = gdk_event_copy (event);
-
- putback_events = g_list_prepend (putback_events, new_event);
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_event_copy
- *
- * Copy a event structure into new storage.
- *
- * Arguments:
- * "event" is the event struct to copy.
- *
- * Results:
- * A new event structure. Free it with gdk_event_free.
- *
- * Side effects:
- * The reference count of the window in the event is increased.
- *
- *--------------------------------------------------------------
- */
-
-static GMemChunk *event_chunk;
-
-static GdkEvent*
-gdk_event_new (void)
-{
- GdkEvent *new_event;
-
- if (event_chunk == NULL)
- event_chunk = g_mem_chunk_new ("events",
- sizeof (GdkEvent),
- 4096,
- G_ALLOC_AND_FREE);
-
- new_event = g_chunk_new (GdkEvent, event_chunk);
-
- return new_event;
-}
-
-GdkEvent*
-gdk_event_copy (GdkEvent *event)
-{
- GdkEvent *new_event;
-
- g_return_val_if_fail (event != NULL, NULL);
-
- new_event = gdk_event_new ();
-
- *new_event = *event;
- gdk_window_ref (new_event->any.window);
-
- switch (event->any.type)
- {
- case GDK_KEY_PRESS:
- case GDK_KEY_RELEASE:
- new_event->key.string = g_strdup (event->key.string);
- break;
-
- case GDK_ENTER_NOTIFY:
- case GDK_LEAVE_NOTIFY:
- if (event->crossing.subwindow != NULL)
- gdk_window_ref (event->crossing.subwindow);
- break;
-
- case GDK_DROP_DATA_AVAIL:
- new_event->dropdataavailable.data_type = g_strdup (event->dropdataavailable.data_type);
- new_event->dropdataavailable.data = g_malloc (event->dropdataavailable.data_numbytes);
- memcpy (new_event->dropdataavailable.data,
- event->dropdataavailable.data,
- event->dropdataavailable.data_numbytes);
- break;
-
- default:
- break;
- }
-
- return new_event;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_event_free
- *
- * Free a event structure obtained from gdk_event_copy. Do not use
- * with other event structures.
- *
- * Arguments:
- * "event" is the event struct to free.
- *
- * Results:
- *
- * Side effects:
- * The reference count of the window in the event is decreased and
- * might be freed, too.
- *
- *-------------------------------------------------------------- */
-
-void
-gdk_event_free (GdkEvent *event)
-{
- g_assert (event_chunk != NULL);
- g_return_if_fail (event != NULL);
-
- if (event->any.window)
- gdk_window_unref (event->any.window);
-
- switch (event->any.type)
- {
- case GDK_KEY_PRESS:
- case GDK_KEY_RELEASE:
- g_free (event->key.string);
- break;
-
- case GDK_ENTER_NOTIFY:
- case GDK_LEAVE_NOTIFY:
- if (event->crossing.subwindow != NULL)
- gdk_window_unref (event->crossing.subwindow);
- break;
-
- case GDK_DROP_DATA_AVAIL:
- g_free (event->dropdataavailable.data_type);
- g_free (event->dropdataavailable.data);
- break;
-
- case GDK_DRAG_REQUEST:
- g_free (event->dragrequest.data_type);
- break;
-
- default:
- break;
- }
-
- g_mem_chunk_free (event_chunk, event);
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_set_show_events
- *
- * Turns on/off the showing of events.
- *
- * Arguments:
- * "show_events" is a boolean describing whether or
- * not to show the events gdk receives.
- *
- * Results:
- *
- * Side effects:
- * When "show_events" is TRUE, calls to "gdk_event_get"
- * will output debugging informatin regarding the event
- * received to stdout.
- *
- *--------------------------------------------------------------
- */
-
-void
-gdk_set_show_events (int show_events)
-{
- if (show_events)
- gdk_debug_flags |= GDK_DEBUG_EVENTS;
- else
- gdk_debug_flags &= ~GDK_DEBUG_EVENTS;
-}
-
-void
-gdk_set_use_xshm (gint use_xshm)
-{
- gdk_use_xshm = use_xshm;
-}
-
-gint
-gdk_get_show_events ()
-{
- return gdk_debug_flags & GDK_DEBUG_EVENTS;
-}
-
-gint
-gdk_get_use_xshm ()
-{
- return gdk_use_xshm;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_time_get
- *
- * Get the number of milliseconds since the library was
- * initialized.
- *
- * Arguments:
- *
- * Results:
- * The time since the library was initialized is returned.
- * This time value is accurate to milliseconds even though
- * a more accurate time down to the microsecond could be
- * returned.
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-guint32
-gdk_time_get ()
-{
- struct timeval end;
- struct timeval elapsed;
- guint32 milliseconds;
-
- X_GETTIMEOFDAY (&end);
-
- if (start.tv_usec > end.tv_usec)
- {
- end.tv_usec += 1000000;
- end.tv_sec--;
- }
- elapsed.tv_sec = end.tv_sec - start.tv_sec;
- elapsed.tv_usec = end.tv_usec - start.tv_usec;
-
- milliseconds = (elapsed.tv_sec * 1000) + (elapsed.tv_usec / 1000);
-
- return milliseconds;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_timer_get
- *
- * Returns the current timer.
- *
- * Arguments:
- *
- * Results:
- * Returns the current timer interval. This interval is
- * in units of milliseconds.
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-guint32
-gdk_timer_get ()
-{
- return timer_val;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_timer_set
- *
- * Sets the timer interval.
- *
- * Arguments:
- * "milliseconds" is the new value for the timer.
- *
- * Results:
- *
- * Side effects:
- * Calls to "gdk_event_get" will last for a maximum
- * of time of "milliseconds". However, a value of 0
- * milliseconds will cause "gdk_event_get" to block
- * indefinately until an event is received.
- *
- *--------------------------------------------------------------
- */
-
-void
-gdk_timer_set (guint32 milliseconds)
-{
- timer_val = milliseconds;
- timer.tv_sec = milliseconds / 1000;
- timer.tv_usec = (milliseconds % 1000) * 1000;
-
-}
-
-void
-gdk_timer_enable ()
-{
- timerp = &timer;
-}
-
-void
-gdk_timer_disable ()
-{
- timerp = NULL;
-}
-
-gint
-gdk_input_add_full (gint source,
- GdkInputCondition condition,
- GdkInputFunction function,
- gpointer data,
- GdkDestroyNotify destroy)
-{
- static gint next_tag = 1;
- GList *list;
- GdkInput *input;
- gint tag;
-
- tag = 0;
- list = inputs;
-
- while (list)
- {
- input = list->data;
- list = list->next;
-
- if ((input->source == source) && (input->condition == condition))
- {
- if (input->destroy)
- (input->destroy) (input->data);
- input->function = function;
- input->data = data;
- input->destroy = destroy;
- tag = input->tag;
- }
- }
-
- if (!tag)
- {
- input = g_new (GdkInput, 1);
- input->tag = next_tag++;
- input->source = source;
- input->condition = condition;
- input->function = function;
- input->data = data;
- input->destroy = destroy;
- tag = input->tag;
-
- inputs = g_list_prepend (inputs, input);
- }
-
- return tag;
-}
-
-gint
-gdk_input_add (gint source,
- GdkInputCondition condition,
- GdkInputFunction function,
- gpointer data)
-{
- return gdk_input_add_interp (source, condition, function, data, NULL);
-}
-
-void
-gdk_input_remove (gint tag)
-{
- GList *list;
- GList *temp_list;
- GdkInput *input;
-
- list = inputs;
- while (list)
- {
- input = list->data;
-
- if (input->tag == tag)
- {
- if (input->destroy)
- (input->destroy) (input->data);
-
- temp_list = list;
-
- if (list->next)
- list->next->prev = list->prev;
- if (list->prev)
- list->prev->next = list->next;
- if (inputs == list)
- inputs = list->next;
-
- temp_list->next = NULL;
- temp_list->prev = NULL;
-
- g_free (temp_list->data);
- g_list_free (temp_list);
- break;
- }
-
- list = list->next;
- }
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_pointer_grab
- *
- * Grabs the pointer to a specific window
- *
- * Arguments:
- * "window" is the window which will receive the grab
- * "owner_events" specifies whether events will be reported as is,
- * or relative to "window"
- * "event_mask" masks only interesting events
- * "confine_to" limits the cursor movement to the specified window
- * "cursor" changes the cursor for the duration of the grab
- * "time" specifies the time
- *
- * Results:
- *
- * Side effects:
- * requires a corresponding call to gdk_pointer_ungrab
- *
- *--------------------------------------------------------------
- */
-
-gint
-gdk_pointer_grab (GdkWindow * window,
- gint owner_events,
- GdkEventMask event_mask,
- GdkWindow * confine_to,
- GdkCursor * cursor,
- guint32 time)
-{
- /* From gdkwindow.c */
- extern int nevent_masks;
- extern int event_mask_table[];
-
- gint return_val;
- GdkWindowPrivate *window_private;
- GdkWindowPrivate *confine_to_private;
- GdkCursorPrivate *cursor_private;
- guint xevent_mask;
- Window xwindow;
- Window xconfine_to;
- Cursor xcursor;
- int i;
-
- g_return_val_if_fail (window != NULL, 0);
-
- window_private = (GdkWindowPrivate*) window;
- confine_to_private = (GdkWindowPrivate*) confine_to;
- cursor_private = (GdkCursorPrivate*) cursor;
-
- xwindow = window_private->xwindow;
-
- if (!confine_to || confine_to_private->destroyed)
- xconfine_to = None;
- else
- xconfine_to = confine_to_private->xwindow;
-
- if (!cursor)
- xcursor = None;
- else
- xcursor = cursor_private->xcursor;
-
-
- xevent_mask = 0;
- for (i = 0; i < nevent_masks; i++)
- {
- if (event_mask & (1 << (i + 1)))
- xevent_mask |= event_mask_table[i];
- }
-
- if (((GdkWindowPrivate *)window)->extension_events &&
- gdk_input_vtable.grab_pointer)
- return_val = gdk_input_vtable.grab_pointer (window,
- owner_events,
- event_mask,
- confine_to,
- time);
- else
- return_val = Success;
-
- if (return_val == Success)
- {
- if (!window_private->destroyed)
- return_val = XGrabPointer (window_private->xdisplay,
- xwindow,
- owner_events,
- xevent_mask,
- GrabModeAsync, GrabModeAsync,
- xconfine_to,
- xcursor,
- time);
- else
- return_val = AlreadyGrabbed;
- }
-
- if (return_val == GrabSuccess)
- xgrab_window = window_private;
-
- return return_val;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_pointer_ungrab
- *
- * Releases any pointer grab
- *
- * Arguments:
- *
- * Results:
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-void
-gdk_pointer_ungrab (guint32 time)
-{
- if (gdk_input_vtable.ungrab_pointer)
- gdk_input_vtable.ungrab_pointer (time);
-
- XUngrabPointer (gdk_display, time);
- xgrab_window = NULL;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_pointer_is_grabbed
- *
- * Tell wether there is an active x pointer grab in effect
- *
- * Arguments:
- *
- * Results:
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-gint
-gdk_pointer_is_grabbed (void)
-{
- return xgrab_window != NULL;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_keyboard_grab
- *
- * Grabs the keyboard to a specific window
- *
- * Arguments:
- * "window" is the window which will receive the grab
- * "owner_events" specifies whether events will be reported as is,
- * or relative to "window"
- * "time" specifies the time
- *
- * Results:
- *
- * Side effects:
- * requires a corresponding call to gdk_keyboard_ungrab
- *
- *--------------------------------------------------------------
- */
-
-gint
-gdk_keyboard_grab (GdkWindow * window,
- gint owner_events,
- guint32 time)
-{
- GdkWindowPrivate *window_private;
- Window xwindow;
-
- g_return_val_if_fail (window != NULL, 0);
-
- window_private = (GdkWindowPrivate*) window;
- xwindow = window_private->xwindow;
-
- if (!window_private->destroyed)
- return XGrabKeyboard (window_private->xdisplay,
- xwindow,
- owner_events,
- GrabModeAsync, GrabModeAsync,
- time);
- else
- return AlreadyGrabbed;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_keyboard_ungrab
- *
- * Releases any keyboard grab
- *
- * Arguments:
- *
- * Results:
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-void
-gdk_keyboard_ungrab (guint32 time)
-{
- XUngrabKeyboard (gdk_display, time);
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_screen_width
- *
- * Return the width of the screen.
- *
- * Arguments:
- *
- * Results:
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-gint
-gdk_screen_width ()
-{
- gint return_val;
-
- return_val = DisplayWidth (gdk_display, gdk_screen);
-
- return return_val;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_screen_height
- *
- * Return the height of the screen.
- *
- * Arguments:
- *
- * Results:
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-gint
-gdk_screen_height ()
-{
- gint return_val;
-
- return_val = DisplayHeight (gdk_display, gdk_screen);
-
- return return_val;
-}
-
-void
-gdk_key_repeat_disable ()
-{
- XAutoRepeatOff (gdk_display);
-}
-
-void
-gdk_key_repeat_restore ()
-{
- if (autorepeat)
- XAutoRepeatOn (gdk_display);
- else
- XAutoRepeatOff (gdk_display);
-}
-
-
-/*
- *--------------------------------------------------------------
- * gdk_flush
- *
- * Flushes the Xlib output buffer and then waits
- * until all requests have been received and processed
- * by the X server. The only real use for this function
- * is in dealing with XShm.
- *
- * Arguments:
- *
- * Results:
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-void gdk_flush ()
-{
- XSync (gdk_display, False);
-}
-
-
-void
-gdk_beep ()
-{
- XBell(gdk_display, 100);
-}
-
-
-/*
- *--------------------------------------------------------------
- * gdk_event_wait
- *
- * Waits until an event occurs or the timer runs out.
- *
- * Arguments:
- *
- * Results:
- * Returns TRUE if an event is ready to be read and FALSE
- * if the timer ran out.
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-static gint
-gdk_event_wait ()
-{
- GList *list;
- GdkInput *input;
- GdkInputCondition condition;
- SELECT_MASK readfds;
- SELECT_MASK writefds;
- SELECT_MASK exceptfds;
- int max_input;
- int nfd;
-
- /* If there are no events pending we will wait for an event.
- * The time we wait is dependant on the "timer". If no timer
- * has been specified then we'll block until an event arrives.
- * If a timer has been specified we'll block until an event
- * arrives or the timer expires. (This is all done using the
- * "select" system call).
- */
-
- if (XPending (gdk_display) == 0)
- {
- FD_ZERO (&readfds);
- FD_ZERO (&writefds);
- FD_ZERO (&exceptfds);
-
- FD_SET (connection_number, &readfds);
- max_input = connection_number;
-
- list = inputs;
- while (list)
- {
- input = list->data;
- list = list->next;
-
- if (input->condition & GDK_INPUT_READ)
- FD_SET (input->source, &readfds);
- if (input->condition & GDK_INPUT_WRITE)
- FD_SET (input->source, &writefds);
- if (input->condition & GDK_INPUT_EXCEPTION)
- FD_SET (input->source, &exceptfds);
-
- max_input = MAX (max_input, input->source);
- }
-
- nfd = select (max_input+1, &readfds, &writefds, &exceptfds, timerp);
-
- timerp = NULL;
- timer_val = 0;
-
- if (nfd > 0)
- {
- if (FD_ISSET (connection_number, &readfds))
- {
- if (XPending (gdk_display) == 0)
- {
- if (nfd == 1)
- {
- XNoOp (gdk_display);
- XFlush (gdk_display);
- }
- return FALSE;
- }
- else
- return TRUE;
- }
-
- list = inputs;
- while (list)
- {
- input = list->data;
- list = list->next;
-
- condition = 0;
- if (FD_ISSET (input->source, &readfds))
- condition |= GDK_INPUT_READ;
- if (FD_ISSET (input->source, &writefds))
- condition |= GDK_INPUT_WRITE;
- if (FD_ISSET (input->source, &exceptfds))
- condition |= GDK_INPUT_EXCEPTION;
-
- if (condition && input->function)
- (* input->function) (input->data, input->source, condition);
- }
- }
- }
- else
- return TRUE;
-
- return FALSE;
-}
-
-static gint
-gdk_event_apply_filters (XEvent *xevent,
- GdkEvent *event,
- GList *filters)
-{
- GdkEventFilter *filter;
- GList *tmp_list;
- GdkFilterReturn result;
-
- tmp_list = filters;
-
- while (tmp_list)
- {
- filter = (GdkEventFilter *)tmp_list->data;
-
- result = (*filter->function)(xevent, event, filter->data);
- if (result != GDK_FILTER_CONTINUE)
- return result;
-
- tmp_list = tmp_list->next;
- }
-
- return GDK_FILTER_CONTINUE;
-}
-
-static gint
-gdk_event_translate (GdkEvent *event,
- XEvent *xevent)
-{
-
- GdkWindow *window;
- GdkWindowPrivate *window_private;
- XComposeStatus compose;
- int charcount;
-#ifdef USE_XIM
- static gchar* buf = NULL;
- static gint buf_len= 0;
-#else
- char buf[16];
-#endif
- gint return_val;
-
- /* Are static variables used for this purpose thread-safe? */
-
- return_val = FALSE;
-
- /* Find the GdkWindow that this event occurred in.
- * All events occur in some GdkWindow (otherwise, why
- * would we be receiving them). It really is an error
- * to receive an event for which we cannot find the
- * corresponding GdkWindow. We handle events with window=None
- * specially - they are generated by XFree86's XInput under
- * some circumstances.
- */
-
- if ((xevent->xany.window == None) &&
- gdk_input_vtable.window_none_event)
- {
- return_val = gdk_input_vtable.window_none_event (event,xevent);
-
- if (return_val >= 0) /* was handled */
- return return_val;
- else
- return_val = FALSE;
- }
-
- window = gdk_window_lookup (xevent->xany.window);
- window_private = (GdkWindowPrivate *) window;
-
- if (window != NULL)
- gdk_window_ref (window);
- else if(gdk_null_window_warnings) /* Special purpose programs that
- get events for other windows may
- want to disable this */
- g_warning ("%#lx -> NULL\n", xevent->xany.window);
-
- /* Check for filters for this window */
-
- {
- GdkFilterReturn result;
- result = gdk_event_apply_filters (xevent, event,
- window_private
- ?window_private->filters
- :gdk_default_filters);
-
- if (result != GDK_FILTER_CONTINUE)
- {
- return (result == GDK_FILTER_TRANSLATE) ? TRUE : FALSE;
- }
- }
-
- /* We do a "manual" conversion of the XEvent to a
- * GdkEvent. The structures are mostly the same so
- * the conversion is fairly straightforward. We also
- * optionally print debugging info regarding events
- * received.
- */
- /* Addendum:
- * During drag & drop you get events where the pointer is
- * in other windows. Need to just do finer-grained checking
- */
- switch (xevent->type)
- {
- case KeyPress:
- /* Lookup the string corresponding to the given keysym.
- */
-#ifdef USE_XIM
- if (buf_len == 0)
- {
- buf_len = 128;
- buf = g_new (gchar, buf_len);
- }
- if (xim_using == TRUE && xim_ic)
- {
- Status status;
-
- /* Clear keyval. Depending on status, may not be set */
- event->key.keyval = GDK_VoidSymbol;
- charcount = XmbLookupString(xim_ic->xic,
- &xevent->xkey, buf, buf_len-1,
- (KeySym*) &event->key.keyval,
- &status);
- if (status == XBufferOverflow)
- { /* retry */
- /* alloc adequate size of buffer */
- GDK_NOTE (XIM,
- g_print("XIM: overflow (required %i)\n", charcount));
-
- while (buf_len <= charcount)
- buf_len *= 2;
- buf = (gchar *) g_realloc (buf, buf_len);
-
- charcount = XmbLookupString (xim_ic->xic,
- &xevent->xkey, buf, buf_len-1,
- (KeySym*) &event->key.keyval,
- &status);
- }
- if (status == XLookupNone)
- {
- return_val = FALSE;
- break;
- }
- }
- else
- charcount = XLookupString (&xevent->xkey, buf, buf_len,
- (KeySym*) &event->key.keyval,
- &compose);
-#else
- charcount = XLookupString (&xevent->xkey, buf, 16,
- (KeySym*) &event->key.keyval,
- &compose);
-#endif
- if (charcount > 0 && buf[charcount-1] == '\0')
- charcount --;
- else
- buf[charcount] = '\0';
-
- /* Print debugging info.
- */
-#ifdef G_ENABLE_DEBUG
- if (gdk_debug_flags & GDK_DEBUG_EVENTS)
- {
- g_print ("key press:\twindow: %ld key: %12s %d\n",
- xevent->xkey.window - base_id,
- event->key.keyval ? XKeysymToString (event->key.keyval) : "(none)",
- event->key.keyval);
- if (charcount > 0)
- g_print ("\t\tlength: %4d string: \"%s\"\n",
- charcount, buf);
- }
-#endif /* G_ENABLE_DEBUG */
-
- event->key.type = GDK_KEY_PRESS;
- event->key.window = window;
- event->key.time = xevent->xkey.time;
- event->key.state = (GdkModifierType) xevent->xkey.state;
- event->key.string = g_strdup (buf);
- event->key.length = charcount;
-
- return_val = window_private && !window_private->destroyed;
-
- if (!return_val)
- g_free (event->key.string);
-
- break;
-
- case KeyRelease:
- /* Lookup the string corresponding to the given keysym.
- */
- charcount = XLookupString (&xevent->xkey, buf, 16,
- (KeySym*) &event->key.keyval,
- &compose);
-
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("key release:\t\twindow: %ld key: %12s %d\n",
- xevent->xkey.window - base_id,
- XKeysymToString (event->key.keyval),
- event->key.keyval));
-
- event->key.type = GDK_KEY_RELEASE;
- event->key.window = window;
- event->key.time = xevent->xkey.time;
- event->key.state = (GdkModifierType) xevent->xkey.state;
- event->key.length = 0;
- event->key.string = NULL;
-
- return_val = window_private && !window_private->destroyed;
- break;
-
- case ButtonPress:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("button press[%d]:\t\twindow: %ld x,y: %d %d button: %d\n",
- window_private?window_private->dnd_drag_enabled:0,
- xevent->xbutton.window - base_id,
- xevent->xbutton.x, xevent->xbutton.y,
- xevent->xbutton.button));
-
- if (window_private &&
- (window_private->extension_events != 0) &&
- gdk_input_ignore_core)
- break;
-
- event->button.type = GDK_BUTTON_PRESS;
- event->button.window = window;
- event->button.time = xevent->xbutton.time;
- event->button.x = xevent->xbutton.x;
- event->button.y = xevent->xbutton.y;
- event->button.x_root = (gfloat)xevent->xbutton.x_root;
- event->button.y_root = (gfloat)xevent->xbutton.y_root;
- event->button.pressure = 0.5;
- event->button.xtilt = 0;
- event->button.ytilt = 0;
- event->button.state = (GdkModifierType) xevent->xbutton.state;
- event->button.button = xevent->xbutton.button;
- event->button.source = GDK_SOURCE_MOUSE;
- event->button.deviceid = GDK_CORE_POINTER;
-
- if ((event->button.time < (button_click_time[1] + TRIPLE_CLICK_TIME)) &&
- (event->button.window == button_window[1]) &&
- (event->button.button == button_number[1]))
- {
- gdk_synthesize_click (event, 3);
-
- button_click_time[1] = 0;
- button_click_time[0] = 0;
- button_window[1] = NULL;
- button_window[0] = 0;
- button_number[1] = -1;
- button_number[0] = -1;
- }
- else if ((event->button.time < (button_click_time[0] + DOUBLE_CLICK_TIME)) &&
- (event->button.window == button_window[0]) &&
- (event->button.button == button_number[0]))
- {
- gdk_synthesize_click (event, 2);
-
- button_click_time[1] = button_click_time[0];
- button_click_time[0] = event->button.time;
- button_window[1] = button_window[0];
- button_window[0] = event->button.window;
- button_number[1] = button_number[0];
- button_number[0] = event->button.button;
- }
- else
- {
- button_click_time[1] = 0;
- button_click_time[0] = event->button.time;
- button_window[1] = NULL;
- button_window[0] = event->button.window;
- button_number[1] = -1;
- button_number[0] = event->button.button;
- }
- if(window_private
- && window_private->dnd_drag_enabled
- && !gdk_dnd.drag_perhaps
- && event->button.button == 1
- && !gdk_dnd.drag_really)
- {
- gdk_dnd.drag_perhaps = 1;
- gdk_dnd.dnd_drag_start.x = xevent->xbutton.x_root;
- gdk_dnd.dnd_drag_start.y = xevent->xbutton.y_root;
- gdk_dnd.real_sw = window_private;
-
- if(gdk_dnd.drag_startwindows)
- {
- g_free(gdk_dnd.drag_startwindows);
- gdk_dnd.drag_startwindows = NULL;
- }
- gdk_dnd.drag_numwindows = gdk_dnd.drag_really = 0;
- gdk_dnd.dnd_grabbed = FALSE;
-
- {
- /* Set motion mask for first DnD'd window, since it
- will be the one that is actually dragged */
- XWindowAttributes dnd_winattr;
- XSetWindowAttributes dnd_setwinattr;
-
- /* We need to get motion events while the button is down, so
- we can know whether to really start dragging or not... */
- XGetWindowAttributes(gdk_display, (Window)window_private->xwindow,
- &dnd_winattr);
-
- window_private->dnd_drag_savedeventmask = dnd_winattr.your_event_mask;
- dnd_setwinattr.event_mask =
- window_private->dnd_drag_eventmask = ButtonMotionMask |
- EnterWindowMask | LeaveWindowMask;
- XChangeWindowAttributes(gdk_display, window_private->xwindow,
- CWEventMask, &dnd_setwinattr);
- }
- }
- return_val = window_private && !window_private->destroyed;
- break;
-
- case ButtonRelease:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("button release[%d]:\twindow: %ld x,y: %d %d button: %d\n",
- window_private?window_private->dnd_drag_enabled:0,
- xevent->xbutton.window - base_id,
- xevent->xbutton.x, xevent->xbutton.y,
- xevent->xbutton.button));
-
- if (window_private &&
- (window_private->extension_events != 0) &&
- gdk_input_ignore_core)
- break;
-
- event->button.type = GDK_BUTTON_RELEASE;
- event->button.window = window;
- event->button.time = xevent->xbutton.time;
- event->button.x = xevent->xbutton.x;
- event->button.y = xevent->xbutton.y;
- event->button.x_root = (gfloat)xevent->xbutton.x_root;
- event->button.y_root = (gfloat)xevent->xbutton.y_root;
- event->button.pressure = 0.5;
- event->button.xtilt = 0;
- event->button.ytilt = 0;
- event->button.state = (GdkModifierType) xevent->xbutton.state;
- event->button.button = xevent->xbutton.button;
- event->button.source = GDK_SOURCE_MOUSE;
- event->button.deviceid = GDK_CORE_POINTER;
-
- gdk_dnd.last_drop_time = xevent->xbutton.time;
- if(gdk_dnd.drag_perhaps)
- {
- {
- XSetWindowAttributes attrs;
- /* Reset event mask to pre-drag value, assuming event_mask
- doesn't change during drag */
- attrs.event_mask = gdk_dnd.real_sw->dnd_drag_savedeventmask;
- XChangeWindowAttributes(gdk_display, gdk_dnd.real_sw->xwindow,
- CWEventMask, &attrs);
- }
-
- if (gdk_dnd.dnd_grabbed)
- {
- gdk_dnd_display_drag_cursor(-2,
- -2,
- FALSE, TRUE);
- XUngrabPointer(gdk_display, CurrentTime);
- gdk_dnd.dnd_grabbed = FALSE;
- }
-
- if(gdk_dnd.drag_really)
- {
- GdkPoint foo;
- foo.x = xevent->xbutton.x_root;
- foo.y = xevent->xbutton.y_root;
-
- if(gdk_dnd.dnd_drag_target != None)
- gdk_dnd_drag_end(gdk_dnd.dnd_drag_target, foo);
- gdk_dnd.drag_really = 0;
-
- gdk_dnd.drag_numwindows = 0;
- if(gdk_dnd.drag_startwindows)
- {
- g_free(gdk_dnd.drag_startwindows);
- gdk_dnd.drag_startwindows = NULL;
- }
-
- gdk_dnd.real_sw = NULL;
- }
-
- gdk_dnd.drag_perhaps = 0;
- gdk_dnd.dnd_drag_start.x = gdk_dnd.dnd_drag_start.y = 0;
- gdk_dnd.dnd_drag_dropzone.x = gdk_dnd.dnd_drag_dropzone.y = 0;
- gdk_dnd.dnd_drag_dropzone.width = gdk_dnd.dnd_drag_dropzone.height = 0;
- gdk_dnd.dnd_drag_curwin = None;
- return_val = window_private?TRUE:FALSE;
- } else
- return_val = window_private && !window_private->destroyed;
- break;
-
- case MotionNotify:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("motion notify:\t\twindow: %ld x,y: %d %d hint: %s d:%d r%d\n",
- xevent->xmotion.window - base_id,
- xevent->xmotion.x, xevent->xmotion.y,
- (xevent->xmotion.is_hint) ? "true" : "false",
- gdk_dnd.drag_perhaps, gdk_dnd.drag_really));
-
- if (window_private &&
- (window_private->extension_events != 0) &&
- gdk_input_ignore_core)
- break;
-
- event->motion.type = GDK_MOTION_NOTIFY;
- event->motion.window = window;
- event->motion.time = xevent->xmotion.time;
- event->motion.x = xevent->xmotion.x;
- event->motion.y = xevent->xmotion.y;
- event->motion.x_root = (gfloat)xevent->xmotion.x_root;
- event->motion.y_root = (gfloat)xevent->xmotion.y_root;
- event->motion.pressure = 0.5;
- event->motion.xtilt = 0;
- event->motion.ytilt = 0;
- event->motion.state = (GdkModifierType) xevent->xmotion.state;
- event->motion.is_hint = xevent->xmotion.is_hint;
- event->motion.source = GDK_SOURCE_MOUSE;
- event->motion.deviceid = GDK_CORE_POINTER;
-
-#define IS_IN_ZONE(cx, cy) (cx >= gdk_dnd.dnd_drag_dropzone.x \
- && cy >= gdk_dnd.dnd_drag_dropzone.y \
- && cx < (gdk_dnd.dnd_drag_dropzone.x + gdk_dnd.dnd_drag_dropzone.width) \
- && cy < (gdk_dnd.dnd_drag_dropzone.y + gdk_dnd.dnd_drag_dropzone.height))
-
- if(gdk_dnd.drag_perhaps && gdk_dnd.drag_really
- /* && event->motion.is_hint */ /* HINTME */)
- {
- /* First, we have to find what window the motion was in... */
- /* XXX there has to be a better way to do this, perhaps with
- XTranslateCoordinates or XQueryTree - I don't know how,
- and this sort of works */
- static Window lastwin = None, curwin = None, twin;
- Window childwin = gdk_root_window;
- int x, y, ox, oy;
-
- /* Interlude - display cursor for the drag ASAP */
- gdk_dnd_display_drag_cursor(xevent->xmotion.x_root,
- xevent->xmotion.y_root,
- gdk_dnd.dnd_drag_target?TRUE:FALSE,
- FALSE);
-
- lastwin = curwin;
- curwin = gdk_root_window;
- ox = x = xevent->xmotion.x_root;
- oy = y = xevent->xmotion.y_root;
- while(childwin != None)
- {
- ox = x; oy = y;
- curwin = childwin;
- XTranslateCoordinates(gdk_display, curwin, curwin,
- x, y, &x, &y, &childwin);
- if(childwin != None)
- {
- XTranslateCoordinates(gdk_display, curwin, childwin,
- x, y, &x, &y, &twin);
- }
- }
- GDK_NOTE (DND,
- g_print("Drag is now in window %#lx, lastwin was %#lx, ddc = %#lx\n",
- curwin, lastwin, gdk_dnd.dnd_drag_curwin));
- if(curwin != gdk_dnd.dnd_drag_curwin && curwin != lastwin)
- {
- /* We have left one window and entered another
- (do leave & enter bits) */
- if(gdk_dnd.dnd_drag_curwin != None)
- gdk_dnd_drag_leave(gdk_dnd.dnd_drag_curwin);
- gdk_dnd.dnd_drag_curwin = curwin;
- gdk_dnd_drag_enter(gdk_dnd.dnd_drag_curwin);
- gdk_dnd.dnd_drag_dropzone.x = gdk_dnd.dnd_drag_dropzone.y = 0;
- gdk_dnd.dnd_drag_dropzone.width = gdk_dnd.dnd_drag_dropzone.height = 0;
- gdk_dnd.dnd_drag_target = None;
- GDK_NOTE (DND,
- g_print("curwin = %#lx, lastwin = %#lx, dnd_drag_curwin = %#lx\n",
- curwin, lastwin, gdk_dnd.dnd_drag_curwin));
-
- gdk_dnd_display_drag_cursor(xevent->xmotion.x_root,
- xevent->xmotion.y_root,
- FALSE, TRUE);
- }
- else if(gdk_dnd.dnd_drag_dropzone.width > 0
- && gdk_dnd.dnd_drag_dropzone.height > 0
- && curwin == gdk_dnd.dnd_drag_curwin)
- {
- /* Handle all that dropzone stuff - thanks John ;-) */
- if (gdk_dnd.dnd_drag_target != None)
- {
- gboolean in_zone = IS_IN_ZONE(xevent->xmotion.x_root,
- xevent->xmotion.y_root);
- gboolean old_in_zone = IS_IN_ZONE(gdk_dnd.dnd_drag_oldpos.x,
- gdk_dnd.dnd_drag_oldpos.y);
-
- if (!in_zone && old_in_zone)
- {
- /* We were in the drop zone and moved out */
- gdk_dnd.dnd_drag_target = None;
- gdk_dnd_drag_leave(curwin);
- gdk_dnd_display_drag_cursor(xevent->xmotion.x_root,
- xevent->xmotion.y_root,
- FALSE, TRUE);
- }
- else if (!in_zone && !old_in_zone)
- {
- /* We were outside drop zone but in the window
- - have to send enter events */
- gdk_dnd_drag_enter(curwin);
- gdk_dnd.dnd_drag_curwin = curwin;
- gdk_dnd.dnd_drag_dropzone.x = gdk_dnd.dnd_drag_dropzone.y = 0;
- gdk_dnd.dnd_drag_target = None;
- }
- }
- } /* else
- dnd_drag_curwin = None; */
- return_val = FALSE;
- }
- else
- return_val = window_private && !window_private->destroyed;
- break;
-
- case EnterNotify:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("enter notify:\t\twindow: %ld detail: %d subwin: %ld\n",
- xevent->xcrossing.window - base_id,
- xevent->xcrossing.detail,
- xevent->xcrossing.subwindow - base_id));
-
- /* Tell XInput stuff about it if appropriate */
- if (window_private &&
- (window_private->extension_events != 0) &&
- gdk_input_vtable.enter_event)
- gdk_input_vtable.enter_event (&xevent->xcrossing, window);
-
- event->crossing.type = GDK_ENTER_NOTIFY;
- event->crossing.window = window;
-
- /* If the subwindow field of the XEvent is non-NULL, then
- * lookup the corresponding GdkWindow.
- */
- if (xevent->xcrossing.subwindow != None)
- event->crossing.subwindow = gdk_window_lookup (xevent->xcrossing.subwindow);
- else
- event->crossing.subwindow = NULL;
-
- /* Translate the crossing detail into Gdk terms.
- */
- switch (xevent->xcrossing.detail)
- {
- case NotifyInferior:
- event->crossing.detail = GDK_NOTIFY_INFERIOR;
- break;
- case NotifyAncestor:
- event->crossing.detail = GDK_NOTIFY_ANCESTOR;
- break;
- case NotifyVirtual:
- event->crossing.detail = GDK_NOTIFY_VIRTUAL;
- break;
- case NotifyNonlinear:
- event->crossing.detail = GDK_NOTIFY_NONLINEAR;
- break;
- case NotifyNonlinearVirtual:
- event->crossing.detail = GDK_NOTIFY_NONLINEAR_VIRTUAL;
- break;
- default:
- event->crossing.detail = GDK_NOTIFY_UNKNOWN;
- break;
- }
-
-#ifdef G_ENABLE_DEBUG
- if ((gdk_debug_flags & GDK_DEBUG_DND) & gdk_dnd.drag_perhaps)
- {
- g_print("We may[%d] have a drag into %#lx = %#lx\n",
- gdk_dnd.drag_really,
- xevent->xcrossing.window, gdk_dnd.real_sw->xwindow);
- }
-#endif /* G_ENABLE_DEBUG */
-
- if (gdk_dnd.drag_perhaps && gdk_dnd.drag_really &&
- (xevent->xcrossing.window == gdk_dnd.real_sw->xwindow))
- {
- gdk_dnd.drag_really = 0;
-
- GDK_NOTE (DND, g_print("Ungrabbed\n"));
-
- gdk_dnd.drag_numwindows = 0;
- g_free(gdk_dnd.drag_startwindows);
- gdk_dnd.drag_startwindows = NULL;
- /* We don't want to ungrab the pointer here, or we'll
- * start getting spurious enter/leave events */
-#if 0
- XChangeActivePointerGrab (gdk_display, 0, None, CurrentTime);
-#endif
- }
-
- return_val = window_private && !window_private->destroyed;
- break;
-
- case LeaveNotify:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("leave notify:\t\twindow: %ld detail: %d subwin: %ld\n",
- xevent->xcrossing.window - base_id,
- xevent->xcrossing.detail, xevent->xcrossing.subwindow - base_id));
-
- event->crossing.type = GDK_LEAVE_NOTIFY;
- event->crossing.window = window;
-
- /* If the subwindow field of the XEvent is non-NULL, then
- * lookup the corresponding GdkWindow.
- */
- if (xevent->xcrossing.subwindow != None)
- event->crossing.subwindow = gdk_window_lookup (xevent->xcrossing.subwindow);
- else
- event->crossing.subwindow = NULL;
-
- /* Translate the crossing detail into Gdk terms.
- */
- switch (xevent->xcrossing.detail)
- {
- case NotifyInferior:
- event->crossing.detail = GDK_NOTIFY_INFERIOR;
- break;
- case NotifyAncestor:
- event->crossing.detail = GDK_NOTIFY_ANCESTOR;
- break;
- case NotifyVirtual:
- event->crossing.detail = GDK_NOTIFY_VIRTUAL;
- break;
- case NotifyNonlinear:
- event->crossing.detail = GDK_NOTIFY_NONLINEAR;
- break;
- case NotifyNonlinearVirtual:
- event->crossing.detail = GDK_NOTIFY_NONLINEAR_VIRTUAL;
- break;
- default:
- event->crossing.detail = GDK_NOTIFY_UNKNOWN;
- break;
- }
-#ifdef G_ENABLE_DEBUG
- if ((gdk_debug_flags & GDK_DEBUG_DND) & gdk_dnd.drag_perhaps)
- {
- g_print("We may[%d] have a drag out of %#lx = %#lx\n",
- gdk_dnd.drag_really,
- xevent->xcrossing.window, gdk_dnd.real_sw->xwindow);
- }
-#endif /* G_ENABLE_DEBUG */
- if (gdk_dnd.drag_perhaps && !gdk_dnd.drag_really &&
- (xevent->xcrossing.window == gdk_dnd.real_sw->xwindow))
- {
- gboolean xgpret;
- gdk_dnd_drag_addwindow((GdkWindow *) gdk_dnd.real_sw);
- gdk_dnd_drag_begin((GdkWindow *) gdk_dnd.real_sw);
- xgpret =
- XGrabPointer(gdk_display, gdk_dnd.real_sw->xwindow, False,
- ButtonMotionMask | PointerMotionMask |
- /* PointerMotionHintMask | */ /* HINTME */
- ButtonPressMask | ButtonReleaseMask,
- GrabModeAsync, GrabModeAsync, gdk_root_window,
- None, CurrentTime);
-#ifdef G_ENABLE_DEBUG
- GDK_NOTE(DND, g_print("xgpret = %d\n", xgpret));
-#endif
- gdk_dnd.dnd_grabbed = TRUE;
- gdk_dnd.drag_really = 1;
- gdk_dnd_display_drag_cursor(xevent->xmotion.x_root,
- xevent->xmotion.y_root,
- FALSE, TRUE);
- }
-
- return_val = window_private && !window_private->destroyed;
- break;
-
- case FocusIn:
- case FocusOut:
- /* We only care about focus events that indicate that _this_
- * window (not a ancestor or child) got or lost the focus
- */
- switch (xevent->xfocus.detail)
- {
- case NotifyAncestor:
- case NotifyInferior:
- case NotifyNonlinear:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("focus %s:\t\twindow: %ld\n",
- (xevent->xany.type == FocusIn) ? "in" : "out",
- xevent->xfocus.window - base_id));
-
- event->focus_change.type = GDK_FOCUS_CHANGE;
- event->focus_change.window = window;
- event->focus_change.in = (xevent->xany.type == FocusIn);
-
- return_val = window_private && !window_private->destroyed;
- break;
- default:
- ;
- }
- break;
-
- case KeymapNotify:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("keymap notify\n"));
-
- /* Not currently handled */
- break;
-
- case Expose:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("expose:\t\twindow: %ld %d x,y: %d %d w,h: %d %d\n",
- xevent->xexpose.window - base_id, xevent->xexpose.count,
- xevent->xexpose.x, xevent->xexpose.y,
- xevent->xexpose.width, xevent->xexpose.height));
-
- event->expose.type = GDK_EXPOSE;
- event->expose.window = window;
- event->expose.area.x = xevent->xexpose.x;
- event->expose.area.y = xevent->xexpose.y;
- event->expose.area.width = xevent->xexpose.width;
- event->expose.area.height = xevent->xexpose.height;
- event->expose.count = xevent->xexpose.count;
-
- return_val = window_private && !window_private->destroyed;
- break;
-
- case GraphicsExpose:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("graphics expose:\tdrawable: %ld\n",
- xevent->xgraphicsexpose.drawable - base_id));
-
- event->expose.type = GDK_EXPOSE;
- event->expose.window = window;
- event->expose.area.x = xevent->xgraphicsexpose.x;
- event->expose.area.y = xevent->xgraphicsexpose.y;
- event->expose.area.width = xevent->xgraphicsexpose.width;
- event->expose.area.height = xevent->xgraphicsexpose.height;
- event->expose.count = xevent->xexpose.count;
-
- return_val = window_private && !window_private->destroyed;
- break;
-
- case NoExpose:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("no expose:\t\tdrawable: %ld\n",
- xevent->xnoexpose.drawable - base_id));
-
- event->no_expose.type = GDK_NO_EXPOSE;
- event->no_expose.window = window;
-
- return_val = window_private && !window_private->destroyed;
- break;
-
- case VisibilityNotify:
- /* Print debugging info.
- */
-#ifdef G_ENABLE_DEBUG
- if (gdk_debug_flags & GDK_DEBUG_EVENTS)
- switch (xevent->xvisibility.state)
- {
- case VisibilityFullyObscured:
- g_print ("visibility notify:\twindow: %ld none\n",
- xevent->xvisibility.window - base_id);
- break;
- case VisibilityPartiallyObscured:
- g_print ("visibility notify:\twindow: %ld partial\n",
- xevent->xvisibility.window - base_id);
- break;
- case VisibilityUnobscured:
- g_print ("visibility notify:\twindow: %ld full\n",
- xevent->xvisibility.window - base_id);
- break;
- }
-#endif /* G_ENABLE_DEBUG */
-
- event->visibility.type = GDK_VISIBILITY_NOTIFY;
- event->visibility.window = window;
-
- switch (xevent->xvisibility.state)
- {
- case VisibilityFullyObscured:
- event->visibility.state = GDK_VISIBILITY_FULLY_OBSCURED;
- break;
-
- case VisibilityPartiallyObscured:
- event->visibility.state = GDK_VISIBILITY_PARTIAL;
- break;
-
- case VisibilityUnobscured:
- event->visibility.state = GDK_VISIBILITY_UNOBSCURED;
- break;
- }
-
- return_val = window_private && !window_private->destroyed;
- break;
-
- case CreateNotify:
- /* Not currently handled */
- break;
-
- case DestroyNotify:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("destroy notify:\twindow: %ld\n",
- xevent->xdestroywindow.window - base_id));
-
- event->any.type = GDK_DESTROY;
- event->any.window = window;
-
- return_val = window_private && !window_private->destroyed;
-
- gdk_window_destroy_notify (window);
- break;
-
- case UnmapNotify:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("unmap notify:\t\twindow: %ld\n",
- xevent->xmap.window - base_id));
-
- event->any.type = GDK_UNMAP;
- event->any.window = window;
-
- if (xgrab_window == window_private)
- xgrab_window = NULL;
-
- return_val = window_private && !window_private->destroyed;
- break;
-
- case MapNotify:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("map notify:\t\twindow: %ld\n",
- xevent->xmap.window - base_id));
-
- event->any.type = GDK_MAP;
- event->any.window = window;
-
- return_val = window_private && !window_private->destroyed;
- break;
-
- case ReparentNotify:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("reparent notify:\twindow: %ld\n",
- xevent->xreparent.window - base_id));
-
- /* Not currently handled */
- break;
-
- case ConfigureNotify:
- /* Print debugging info.
- */
- while ((XPending (gdk_display) > 0) &&
- XCheckTypedWindowEvent(gdk_display, xevent->xany.window,
- ConfigureNotify, xevent))
- /*XSync (gdk_display, 0)*/;
-
- GDK_NOTE (EVENTS,
- g_print ("configure notify:\twindow: %ld x,y: %d %d w,h: %d %d b-w: %d above: %ld ovr: %d\n",
- xevent->xconfigure.window - base_id,
- xevent->xconfigure.x,
- xevent->xconfigure.y,
- xevent->xconfigure.width,
- xevent->xconfigure.height,
- xevent->xconfigure.border_width,
- xevent->xconfigure.above - base_id,
- xevent->xconfigure.override_redirect));
-
- if (window_private)
- {
- if ((window_private->extension_events != 0) &&
- gdk_input_vtable.configure_event)
- gdk_input_vtable.configure_event (&xevent->xconfigure, window);
-
- if (window_private->window_type != GDK_WINDOW_CHILD)
- {
- event->configure.type = GDK_CONFIGURE;
- event->configure.window = window;
- event->configure.width = xevent->xconfigure.width;
- event->configure.height = xevent->xconfigure.height;
-
- if (!xevent->xconfigure.x &&
- !xevent->xconfigure.y)
- {
- gint tx = 0;
- gint ty = 0;
- Window child_window = 0;
-
- if (!XTranslateCoordinates (window_private->xdisplay,
- window_private->xwindow,
- gdk_root_window,
- 0, 0,
- &tx, &ty,
- &child_window))
- g_warning ("GdkWindow %ld doesn't share root windows display?",
- window_private->xwindow - base_id);
- event->configure.x = tx;
- event->configure.y = ty;
- }
- else
- {
- event->configure.x = xevent->xconfigure.x;
- event->configure.y = xevent->xconfigure.y;
- }
- window_private->x = event->configure.x;
- window_private->y = event->configure.y;
- window_private->width = xevent->xconfigure.width;
- window_private->height = xevent->xconfigure.height;
- if (window_private->resize_count > 1)
- window_private->resize_count -= 1;
-
- return_val = !window_private->destroyed;
- }
- }
- break;
-
- case PropertyNotify:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("property notify:\twindow: %ld\n",
- xevent->xproperty.window - base_id));
-
- event->property.type = GDK_PROPERTY_NOTIFY;
- event->property.window = window;
- event->property.atom = xevent->xproperty.atom;
- event->property.time = xevent->xproperty.time;
- event->property.state = xevent->xproperty.state;
-
- return_val = window_private && !window_private->destroyed;
- break;
-
- case SelectionClear:
- GDK_NOTE (EVENTS,
- g_print ("selection clear:\twindow: %ld\n",
- xevent->xproperty.window - base_id));
-
- event->selection.type = GDK_SELECTION_CLEAR;
- event->selection.window = window;
- event->selection.selection = xevent->xselectionclear.selection;
- event->selection.time = xevent->xselectionclear.time;
-
- return_val = window_private && !window_private->destroyed;
- break;
-
- case SelectionRequest:
- GDK_NOTE (EVENTS,
- g_print ("selection request:\twindow: %ld\n",
- xevent->xproperty.window - base_id));
-
- event->selection.type = GDK_SELECTION_REQUEST;
- event->selection.window = window;
- event->selection.selection = xevent->xselectionrequest.selection;
- event->selection.target = xevent->xselectionrequest.target;
- event->selection.property = xevent->xselectionrequest.property;
- event->selection.requestor = xevent->xselectionrequest.requestor;
- event->selection.time = xevent->xselectionrequest.time;
-
- return_val = window_private && !window_private->destroyed;
- break;
-
- case SelectionNotify:
- GDK_NOTE (EVENTS,
- g_print ("selection notify:\twindow: %ld\n",
- xevent->xproperty.window - base_id));
-
-
- event->selection.type = GDK_SELECTION_NOTIFY;
- event->selection.window = window;
- event->selection.selection = xevent->xselection.selection;
- event->selection.target = xevent->xselection.target;
- event->selection.property = xevent->xselection.property;
- event->selection.time = xevent->xselection.time;
-
- return_val = window_private && !window_private->destroyed;
- break;
-
- case ColormapNotify:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("colormap notify:\twindow: %ld\n",
- xevent->xcolormap.window - base_id));
-
- /* Not currently handled */
- break;
-
- case ClientMessage:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("client message:\twindow: %ld\n",
- xevent->xclient.window - base_id));
-
- /* Client messages are the means of the window manager
- * communicating with a program. We'll first check to
- * see if this is really the window manager talking
- * to us.
- */
- if (xevent->xclient.message_type == gdk_wm_protocols)
- {
- if ((Atom) xevent->xclient.data.l[0] == gdk_wm_delete_window)
- {
- /* The delete window request specifies a window
- * to delete. We don't actually destroy the
- * window because "it is only a request". (The
- * window might contain vital data that the
- * program does not want destroyed). Instead
- * the event is passed along to the program,
- * which should then destroy the window.
- */
-
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("delete window:\t\twindow: %ld\n",
- xevent->xclient.window - base_id));
-
- event->any.type = GDK_DELETE;
- event->any.window = window;
-
- return_val = window_private && !window_private->destroyed;
- }
- else if ((Atom) xevent->xclient.data.l[0] == gdk_wm_take_focus)
- {
- }
- }
- else if (xevent->xclient.message_type == gdk_dnd.gdk_XdeEnter)
- {
- Atom reptype = 0;
-
- event->dropenter.u.allflags = xevent->xclient.data.l[1];
-
- GDK_NOTE (DND, g_print ("GDK_DROP_ENTER [%d][%d]\n",
- window_private->dnd_drop_enabled, event->dropenter.u.flags.sendreply));
- return_val = FALSE;
-
- /* Now figure out if we really want this drop...
- * If someone is trying funky clipboard stuff, ignore
- */
- if (window_private
- && window_private->dnd_drop_enabled
- && event->dropenter.u.flags.sendreply
- && (reptype = gdk_dnd_check_types (window, xevent)))
- {
- XEvent replyev;
-
- replyev.xclient.type = ClientMessage;
- replyev.xclient.window = xevent->xclient.data.l[0];
- replyev.xclient.format = 32;
- replyev.xclient.message_type = gdk_dnd.gdk_XdeRequest;
- replyev.xclient.data.l[0] = window_private->xwindow;
-
- event->dragrequest.u.allflags = 0;
- event->dragrequest.u.flags.protocol_version =
- DND_PROTOCOL_VERSION;
- event->dragrequest.u.flags.willaccept = 1;
- event->dragrequest.u.flags.delete_data =
- (window_private->dnd_drop_destructive_op) ? 1 : 0;
-
- replyev.xclient.data.l[1] = event->dragrequest.u.allflags;
- replyev.xclient.data.l[2] = replyev.xclient.data.l[3] = 0;
- replyev.xclient.data.l[4] = reptype;
-
- if (!gdk_send_xevent (replyev.xclient.window, False,
- NoEventMask, &replyev))
- GDK_NOTE (DND, g_print("Sending XdeRequest to %#lx failed\n",
- replyev.xclient.window));
-
- event->any.type = GDK_DROP_ENTER;
- event->any.window = window;
- event->dropenter.requestor = replyev.xclient.window;
- event->dropenter.u.allflags = xevent->xclient.data.l[1];
-
- GDK_NOTE (DND, g_print("We sent a GDK_DROP_ENTER on to Gtk\n"));
- return_val = TRUE;
- }
- }
- else if (xevent->xclient.message_type == gdk_dnd.gdk_XdeLeave)
- {
-#ifdef G_ENABLE_DEBUG
- if (gdk_debug_flags & (GDK_DEBUG_EVENTS | GDK_DEBUG_DND))
- g_print ("GDK_DROP_LEAVE\n");
-#endif
-
- if (window_private && window_private->dnd_drop_enabled)
- {
- event->dropleave.type = GDK_DROP_LEAVE;
- event->dropleave.window = window;
- event->dropleave.requestor = xevent->xclient.data.l[0];
- event->dropleave.u.allflags = xevent->xclient.data.l[1];
- return_val = TRUE;
- }
- else
- return_val = FALSE;
- }
- else if (xevent->xclient.message_type == gdk_dnd.gdk_XdeRequest)
- {
- /*
- * make sure to only handle requests from the window the cursor is
- * over
- */
-#ifdef G_ENABLE_DEBUG
- if (gdk_debug_flags & (GDK_DEBUG_EVENTS | GDK_DEBUG_DND))
- g_print ("GDK_DRAG_REQUEST\n");
-#endif
- event->dragrequest.u.allflags = xevent->xclient.data.l[1];
- return_val = FALSE;
-
- if (window && gdk_dnd.drag_really &&
- xevent->xclient.data.l[0] == gdk_dnd.dnd_drag_curwin &&
- event->dragrequest.u.flags.sendreply == 0)
- {
- /* Got request - do we need to ask user? */
- if (!event->dragrequest.u.flags.willaccept
- && event->dragrequest.u.flags.senddata)
- {
- /* Yes we do :) */
- event->dragrequest.type = GDK_DRAG_REQUEST;
- event->dragrequest.window = window;
- event->dragrequest.requestor = xevent->xclient.data.l[0];
- event->dragrequest.isdrop = 0;
- event->dragrequest.drop_coords.x =
- event->dragrequest.drop_coords.y = 0;
- return_val = TRUE;
- }
- else if (event->dragrequest.u.flags.willaccept)
- {
- window_private->dnd_drag_destructive_op =
- event->dragrequest.u.flags.delete_data;
- window_private->dnd_drag_accepted = 1;
- window_private->dnd_drag_data_type =
- xevent->xclient.data.l[4];
-
- gdk_dnd.dnd_drag_target = gdk_dnd.dnd_drag_curwin;
- gdk_dnd_display_drag_cursor(-1, -1, TRUE, TRUE);
- }
- gdk_dnd.dnd_drag_dropzone.x = xevent->xclient.data.l[2] & 65535;
- gdk_dnd.dnd_drag_dropzone.y =
- (xevent->xclient.data.l[2] >> 16) & 65535;
- gdk_dnd.dnd_drag_dropzone.width = xevent->xclient.data.l[3] & 65535;
- gdk_dnd.dnd_drag_dropzone.height =
- (xevent->xclient.data.l[3] >> 16) & 65535;
- }
- }
- else if(xevent->xclient.message_type == gdk_dnd.gdk_XdeDataAvailable)
- {
- gint tmp_int; Atom tmp_atom;
- gulong tmp_long;
- guchar *tmp_charptr;
-
-#ifdef G_ENABLE_DEBUG
- if (gdk_debug_flags & (GDK_DEBUG_EVENTS | GDK_DEBUG_DND))
- g_print("GDK_DROP_DATA_AVAIL\n");
-#endif
- event->dropdataavailable.u.allflags = xevent->xclient.data.l[1];
- event->dropdataavailable.timestamp = xevent->xclient.data.l[4];
- event->dropdataavailable.coords.x =
- xevent->xclient.data.l[3] & 0xffff;
- event->dropdataavailable.coords.y =
- (xevent->xclient.data.l[3] >> 16) & 0xffff;
- if(window
- /* No preview of data ATM */
- && event->dropdataavailable.u.flags.isdrop)
- {
- event->dropdataavailable.type = GDK_DROP_DATA_AVAIL;
- event->dropdataavailable.window = window;
- event->dropdataavailable.requestor = xevent->xclient.data.l[0];
- event->dropdataavailable.data_type =
- gdk_atom_name(xevent->xclient.data.l[2]);
- if(XGetWindowProperty (gdk_display,
- event->dropdataavailable.requestor,
- xevent->xclient.data.l[2],
- 0, LONG_MAX - 1,
- False, XA_PRIMARY, &tmp_atom,
- &tmp_int,
- &event->dropdataavailable.data_numbytes,
- &tmp_long,
- &tmp_charptr)
- != Success)
- {
- g_warning("XGetWindowProperty on %#x may have failed\n",
- event->dropdataavailable.requestor);
- event->dropdataavailable.data = NULL;
- }
- else
- {
- GDK_NOTE (DND, g_print("XGetWindowProperty got us %ld bytes\n",
- event->dropdataavailable.data_numbytes));
- event->dropdataavailable.data =
- g_malloc (event->dropdataavailable.data_numbytes);
- memcpy (event->dropdataavailable.data,
- tmp_charptr, event->dropdataavailable.data_numbytes);
- XFree(tmp_charptr);
- return_val = TRUE;
- }
- return_val = TRUE;
- }
- }
- else
- {
- /* Send unknown ClientMessage's on to Gtk for it to use */
- event->client.type = GDK_CLIENT_EVENT;
- event->client.window = window;
- event->client.message_type = xevent->xclient.message_type;
- event->client.data_format = xevent->xclient.format;
- memcpy(&event->client.data, &xevent->xclient.data,
- sizeof(event->client.data));
- if(window)
- return_val = TRUE;
- else
- return_val = FALSE;
- }
- if(window_private)
- return_val = return_val && !window_private->destroyed;
- break;
-
- case MappingNotify:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("mapping notify\n"));
-
- /* Let XLib know that there is a new keyboard mapping.
- */
- XRefreshKeyboardMapping (&xevent->xmapping);
- break;
-
- default:
- /* something else - (e.g., a Xinput event) */
-
- if (window_private &&
- (window_private->extension_events != 0) &&
- gdk_input_vtable.other_event)
- return_val = gdk_input_vtable.other_event(event, xevent, window);
- else
- return_val = -1;
-
- if (return_val < 0) /* not an XInput event, convert */
- {
- event->other.type = GDK_OTHER_EVENT;
- event->other.window = window;
- event->other.xevent = (GdkXEvent *)&other_xevent[other_xevent_i];
- memcpy (&other_xevent[other_xevent_i], xevent, sizeof (XEvent));
- other_xevent_i = (other_xevent_i+1) % OTHER_XEVENT_BUFSIZE;
- return_val = TRUE;
- }
- else
- return_val = return_val && !window_private->destroyed;
-
- break;
- }
-
- if (return_val)
- {
- if (event->any.window)
- gdk_window_ref (event->any.window);
- if (((event->any.type == GDK_ENTER_NOTIFY) ||
- (event->any.type == GDK_LEAVE_NOTIFY)) &&
- (event->crossing.subwindow != NULL))
- gdk_window_ref (event->crossing.subwindow);
- }
- else
- {
- /* Mark this event as having no resources to be freed */
- event->any.window = NULL;
- event->any.type = GDK_NOTHING;
- }
-
- if (window)
- gdk_window_unref (window);
-
- return return_val;
-}
-
-#if 0
-static Bool
-gdk_event_get_type (Display *display,
- XEvent *xevent,
- XPointer arg)
-{
- GdkEvent event;
- GdkPredicate *pred;
-
- if (gdk_event_translate (&event, xevent))
- {
- pred = (GdkPredicate*) arg;
- return (* pred->func) (&event, pred->data);
- }
-
- return FALSE;
-}
-#endif
-
-static void
-gdk_synthesize_click (GdkEvent *event,
- gint nclicks)
-{
- GdkEvent temp_event;
-
- g_return_if_fail (event != NULL);
-
- temp_event = *event;
- temp_event.type = (nclicks == 2) ? GDK_2BUTTON_PRESS : GDK_3BUTTON_PRESS;
-
- gdk_event_put (&temp_event);
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_exit_func
- *
- * This is the "atexit" function that makes sure the
- * library gets a chance to cleanup.
- *
- * Arguments:
- *
- * Results:
- *
- * Side effects:
- * The library is un-initialized and the program exits.
- *
- *--------------------------------------------------------------
- */
-
-static void
-gdk_exit_func ()
-{
- static gboolean in_gdk_exit_func = FALSE;
-
- /* This is to avoid an infinite loop if a program segfaults in
- an atexit() handler (and yes, it does happen, especially if a program
- has trounced over memory too badly for even g_print to work) */
- if(in_gdk_exit_func == TRUE) return;
- in_gdk_exit_func = TRUE;
-
- if (initialized)
- {
-#ifdef USE_XIM
- /* cleanup IC */
- gdk_ic_cleanup ();
- /* close IM */
- gdk_im_close ();
-#endif
- gdk_image_exit ();
- gdk_input_exit ();
- gdk_key_repeat_restore ();
-
- XCloseDisplay (gdk_display);
- initialized = 0;
- }
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_x_error
- *
- * The X error handling routine.
- *
- * Arguments:
- * "display" is the X display the error orignated from.
- * "error" is the XErrorEvent that we are handling.
- *
- * Results:
- * Either we were expecting some sort of error to occur,
- * in which case we set the "gdk_error_code" flag, or this
- * error was unexpected, in which case we will print an
- * error message and exit. (Since trying to continue will
- * most likely simply lead to more errors).
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-static int
-gdk_x_error (Display *display,
- XErrorEvent *error)
-{
- char buf[64];
-
- if (gdk_error_warnings)
- {
- XGetErrorText (display, error->error_code, buf, 63);
- g_error ("%s", buf);
- }
-
- gdk_error_code = -1;
- return 0;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_x_io_error
- *
- * The X I/O error handling routine.
- *
- * Arguments:
- * "display" is the X display the error orignated from.
- *
- * Results:
- * An X I/O error basically means we lost our connection
- * to the X server. There is not much we can do to
- * continue, so simply print an error message and exit.
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-static int
-gdk_x_io_error (Display *display)
-{
- g_error ("an x io error occurred");
- return 0;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_signal
- *
- * The signal handler.
- *
- * Arguments:
- * "sig_num" is the number of the signal we received.
- *
- * Results:
- * The signals we catch are all fatal. So we simply build
- * up a nice little error message and print it and exit.
- * If in the process of doing so another signal is received
- * we notice that we are already exiting and simply kill
- * our process.
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-static RETSIGTYPE
-gdk_signal (int sig_num)
-{
- static int caught_fatal_sig = 0;
- char *sig;
-
- if (caught_fatal_sig)
- kill (getpid (), sig_num);
- caught_fatal_sig = 1;
-
- switch (sig_num)
- {
- case SIGHUP:
- sig = "sighup";
- break;
- case SIGINT:
- sig = "sigint";
- break;
- case SIGQUIT:
- sig = "sigquit";
- break;
- case SIGBUS:
- sig = "sigbus";
- break;
- case SIGSEGV:
- sig = "sigsegv";
- break;
- case SIGPIPE:
- sig = "sigpipe";
- break;
- case SIGTERM:
- sig = "sigterm";
- break;
- default:
- sig = "unknown signal";
- break;
- }
-
- g_print ("\n** ERROR **: %s caught\n", sig);
-#ifdef G_ENABLE_DEBUG
- abort ();
-#else /* !G_ENABLE_DEBUG */
- gdk_exit (1);
-#endif /* !G_ENABLE_DEBUG */
-}
-
-static void
-gdk_dnd_drag_begin (GdkWindow *initial_window)
-{
- GdkEventDragBegin tev;
- tev.type = GDK_DRAG_BEGIN;
- tev.window = initial_window;
- tev.u.allflags = 0;
- tev.u.flags.protocol_version = DND_PROTOCOL_VERSION;
-
- gdk_event_put ((GdkEvent *) &tev);
-}
-
-static void
-gdk_dnd_drag_enter (Window dest)
-{
- XEvent sev;
- GdkEventDropEnter tev;
- int i;
- GdkWindowPrivate *wp;
-
- sev.xclient.type = ClientMessage;
- sev.xclient.format = 32;
- sev.xclient.message_type = gdk_dnd.gdk_XdeEnter;
- sev.xclient.window = dest;
-
- tev.u.allflags = 0;
- tev.u.flags.protocol_version = DND_PROTOCOL_VERSION;
- tev.u.flags.sendreply = 1;
- for (i = 0; i < gdk_dnd.drag_numwindows; i++)
- {
- wp = (GdkWindowPrivate *) gdk_dnd.drag_startwindows[i];
- if (wp->dnd_drag_data_numtypesavail)
- {
- sev.xclient.data.l[0] = wp->xwindow;
- tev.u.flags.extended_typelist = (wp->dnd_drag_data_numtypesavail > 3)?1:0;
- sev.xclient.data.l[1] = tev.u.allflags;
- sev.xclient.data.l[2] = wp->dnd_drag_data_typesavail[0];
- if (wp->dnd_drag_data_numtypesavail > 1)
- {
- sev.xclient.data.l[3] = wp->dnd_drag_data_typesavail[1];
- if (wp->dnd_drag_data_numtypesavail > 2)
- {
- sev.xclient.data.l[4] = wp->dnd_drag_data_typesavail[2];
- }
- else
- sev.xclient.data.l[4] = None;
- }
- else
- sev.xclient.data.l[3] = sev.xclient.data.l[4] = None;
- if (!gdk_send_xevent (dest, False, NoEventMask, &sev))
- GDK_NOTE (DND, g_print("Sending XdeEnter to %#lx failed\n",
- dest));
- }
-
- }
-}
-
-
-#ifdef USE_XIM
-
-/*
- *--------------------------------------------------------------
- * gdk_im_begin
- *
- * Begin using input method with XIM Protocol(X11R6 standard)
- *
- * Arguments:
- * "ic" is the "Input Context" which is created by gtk_ic_new.
- * The input area is specified with "window".
- *
- * Results:
- * The gdk's event handling routine is switched to XIM based routine.
- * XIM based routine uses XFilterEvent to get rid of events used by IM,
- * and uses XmbLookupString instead of XLookupString.
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-void
-gdk_im_begin (GdkIC ic, GdkWindow* window)
-{
- GdkICPrivate *private;
- Window xwin;
-
- g_return_if_fail (ic != NULL);
- g_return_if_fail (window);
-
- private = (GdkICPrivate *) ic;
-
- xim_using = TRUE;
- xim_ic = private;
- xim_window = window;
- if (gdk_im_ready())
- {
- XGetICValues (private->xic, XNFocusWindow, &xwin, NULL);
- if (xwin != GDK_WINDOW_XWINDOW(window))
- XSetICValues (private->xic, XNFocusWindow,
- GDK_WINDOW_XWINDOW(window), NULL);
- if (private != xim_ic)
- XSetICFocus (private->xic);
- }
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_im_end
- *
- * End using input method with XIM Protocol(X11R6 standard)
- *
- * Arguments:
- *
- * Results:
- * The gdk's event handling routine is switched to normal routine.
- * User should call this function before ic and window will be destroyed.
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-void
-gdk_im_end (void)
-{
- xim_using = FALSE;
- xim_ic = NULL;
- xim_window = NULL;
-}
-
-static GdkIM
-gdk_im_get (void)
-{
- return xim_im;
-}
-
-static GdkIMStyle
-gdk_im_choose_better_style (GdkIMStyle style1, GdkIMStyle style2)
-{
- GdkIMStyle s1, s2, u;
-
- if (style1 == 0) return style2;
- if (style2 == 0) return style1;
- if ((style1 & (GdkIMPreeditMask | GdkIMStatusMask))
- == (style2 & (GdkIMPreeditMask | GdkIMStatusMask)))
- return style1;
-
- s1 = style1 & GdkIMPreeditMask;
- s2 = style2 & GdkIMPreeditMask;
- u = s1 | s2;
- if (s1 != s2) {
- if (u & GdkIMPreeditCallbacks)
- return (s1 == GdkIMPreeditCallbacks)? style1:style2;
- else if (u & GdkIMPreeditPosition)
- return (s1 == GdkIMPreeditPosition)? style1:style2;
- else if (u & GdkIMPreeditArea)
- return (s1 == GdkIMPreeditArea)? style1:style2;
- else if (u & GdkIMPreeditNothing)
- return (s1 == GdkIMPreeditNothing)? style1:style2;
- } else {
- s1 = style1 & GdkIMStatusMask;
- s2 = style2 & GdkIMStatusMask;
- u = s1 | s2;
- if ( u & GdkIMStatusCallbacks)
- return (s1 == GdkIMStatusCallbacks)? style1:style2;
- else if ( u & GdkIMStatusArea)
- return (s1 == GdkIMStatusArea)? style1:style2;
- else if ( u & GdkIMStatusNothing)
- return (s1 == GdkIMStatusNothing)? style1:style2;
- else if ( u & GdkIMStatusNone)
- return (s1 == GdkIMStatusNone)? style1:style2;
- }
- return 0; /* Get rid of stupid warning */
-}
-
-GdkIMStyle
-gdk_im_decide_style (GdkIMStyle supported_style)
-{
- gint i;
- GdkIMStyle style, tmp;
-
- g_return_val_if_fail (xim_styles != NULL, 0);
-
- style = 0;
- for (i=0; i<xim_styles->count_styles; i++)
- {
- tmp = xim_styles->supported_styles[i];
- if (tmp == (tmp & supported_style & xim_best_allowed_style))
- style = gdk_im_choose_better_style (style, tmp);
- }
- return style;
-}
-
-GdkIMStyle
-gdk_im_set_best_style (GdkIMStyle style)
-{
- if (style & GdkIMPreeditMask)
- {
- xim_best_allowed_style &= ~GdkIMPreeditMask;
-
- xim_best_allowed_style |= GdkIMPreeditNone;
- if (!(style & GdkIMPreeditNone))
- {
- xim_best_allowed_style |= GdkIMPreeditNothing;
- if (!(style & GdkIMPreeditNothing))
- {
- xim_best_allowed_style |= GdkIMPreeditArea;
- if (!(style & GdkIMPreeditArea))
- {
- xim_best_allowed_style |= GdkIMPreeditPosition;
- if (!(style & GdkIMPreeditPosition))
- xim_best_allowed_style |= GdkIMPreeditCallbacks;
- }
- }
- }
- }
- if (style & GdkIMStatusMask)
- {
- xim_best_allowed_style &= ~GdkIMStatusMask;
-
- xim_best_allowed_style |= GdkIMStatusNone;
- if (!(style & GdkIMStatusNone))
- {
- xim_best_allowed_style |= GdkIMStatusNothing;
- if (!(style & GdkIMStatusNothing))
- {
- xim_best_allowed_style |= GdkIMStatusArea;
- if (!(style & GdkIMStatusArea))
- xim_best_allowed_style |= GdkIMStatusCallbacks;
- }
- }
- }
-
- return xim_best_allowed_style;
-}
-
-static gint
-gdk_im_open (XrmDatabase db, gchar* res_name, gchar* res_class)
-{
- xim_im = XOpenIM (GDK_DISPLAY(), db, res_name, res_class);
- if (xim_im == NULL)
- {
- GDK_NOTE (XIM, g_warning ("Unable to open open IM."));
- return FALSE;
- }
- XGetIMValues (xim_im, XNQueryInputStyle, &xim_styles, NULL, NULL);
-
- return TRUE;
-}
-
-static void
-gdk_im_close (void)
-{
- if (xim_im)
- {
- XCloseIM (xim_im);
- xim_im = NULL;
- }
- if (xim_styles)
- {
- XFree (xim_styles);
- xim_styles = NULL;
- }
-}
-
-gint
-gdk_im_ready (void)
-{
- return (xim_im != NULL);
-}
-
-GdkIC
-gdk_ic_new (GdkWindow* client_window,
- GdkWindow* focus_window,
- GdkIMStyle style, ...)
-{
- va_list list;
- GdkICPrivate *private;
- XVaNestedList preedit_attr;
-
- g_return_val_if_fail (client_window != NULL, NULL);
- g_return_val_if_fail (focus_window != NULL, NULL);
- g_return_val_if_fail (gdk_im_ready(), NULL);
-
- private = g_new (GdkICPrivate, 1);
-
- va_start (list, style);
- preedit_attr = (XVaNestedList) & (va_arg (list, void *));
- va_end (list);
-
- private->style = gdk_im_decide_style (style);
- if (private->style != style)
- {
- g_warning ("can not create input context with specified input style.");
- g_free (private);
- return NULL;
- }
-
- private->xic = XCreateIC(gdk_im_get (),
- XNInputStyle, style,
- XNClientWindow, GDK_WINDOW_XWINDOW (client_window),
- XNFocusWindow, GDK_WINDOW_XWINDOW (focus_window),
- preedit_attr? XNPreeditAttributes : NULL, preedit_attr,
- NULL);
- if (!private->xic)
- {
- g_free (private);
- return NULL;
- }
-
- xim_ic_list = g_list_append (xim_ic_list, private);
- return private;
-}
-
-void
-gdk_ic_destroy (GdkIC ic)
-{
- GdkICPrivate *private;
-
- g_return_if_fail (ic != NULL);
-
- private = (GdkICPrivate *) ic;
-
- if (xim_ic == private)
- gdk_im_end ();
-
- XDestroyIC (private->xic);
- xim_ic_list = g_list_remove (xim_ic_list, private);
- g_free (private);
-}
-
-GdkIMStyle
-gdk_ic_get_style (GdkIC ic)
-{
- GdkICPrivate *private;
-
- g_return_val_if_fail (ic != NULL, 0);
-
- private = (GdkICPrivate *) ic;
-
- return private->style;
-}
-
-void
-gdk_ic_set_values (GdkIC ic, ...)
-{
- va_list list;
- XVaNestedList args;
- GdkICPrivate *private;
-
- g_return_if_fail (ic != NULL);
-
- private = (GdkICPrivate *) ic;
-
- va_start (list, ic);
- args = (XVaNestedList) & (va_arg (list, void *));
- va_end (list);
-
- XSetICValues (private->xic, XNVaNestedList, args, NULL);
-}
-
-void
-gdk_ic_get_values (GdkIC ic, ...)
-{
- va_list list;
- XVaNestedList args;
- GdkICPrivate *private;
-
- g_return_if_fail (ic != NULL);
-
- private = (GdkICPrivate *) ic;
-
- va_start (list, ic);
- args = (XVaNestedList) & (va_arg (list, void *));
- va_end (list);
-
- XGetICValues (private->xic, XNVaNestedList, args, NULL);
-}
-
-void
-gdk_ic_set_attr (GdkIC ic, const char *target, ...)
-{
- va_list list;
- XVaNestedList attr;
- GdkICPrivate *private;
-
- g_return_if_fail (ic != NULL);
- g_return_if_fail (target != NULL);
-
- private = (GdkICPrivate *) ic;
-
- va_start (list, target);
- attr = (XVaNestedList) & (va_arg (list, void *));
- va_end (list);
-
- XSetICValues (private->xic, target, attr, NULL);
-}
-
-void
-gdk_ic_get_attr (GdkIC ic, const char *target, ...)
-{
- va_list list;
- XVaNestedList attr;
- GdkICPrivate *private;
-
- g_return_if_fail (ic != NULL);
- g_return_if_fail (target != NULL);
-
- private = (GdkICPrivate *) ic;
-
- va_start (list, target);
- attr = (XVaNestedList) & (va_arg (list, void *));
- va_end (list);
-
- XGetICValues (private->xic, target, attr, NULL);
-}
-
-GdkEventMask
-gdk_ic_get_events (GdkIC ic)
-{
- GdkEventMask mask;
- glong xmask;
- glong bit;
- GdkICPrivate *private;
- gint i;
-
- /* From gdkwindow.c */
- extern int nevent_masks;
- extern int event_mask_table[];
-
- g_return_val_if_fail (ic != NULL, 0);
-
- private = (GdkICPrivate *) ic;
-
- if (XGetICValues (private->xic, XNFilterEvents, &xmask, NULL) != NULL)
- {
- GDK_NOTE (XIM, g_warning ("Call to XGetICValues: %s failed", XNFilterEvents));
- return 0;
- }
-
- mask = 0;
- for (i=0, bit=2; i < nevent_masks; i++, bit <<= 1)
- if (xmask & event_mask_table [i])
- {
- mask |= bit;
- xmask &= ~ event_mask_table [i];
- }
-
- if (xmask)
- g_warning ("ic requires events not supported by the application (%#04lx)", xmask);
-
- return mask;
-}
-
-static void
-gdk_ic_cleanup (void)
-{
- GList* node;
- gint destroyed;
- GdkICPrivate *private;
-
- destroyed = 0;
- for (node = xim_ic_list; node != NULL; node = node->next)
- {
- if (node->data)
- {
- private = (GdkICPrivate *) (node->data);
- XDestroyIC (private->xic);
- g_free (private);
- destroyed++;
- }
- }
-#ifdef G_ENABLE_DEBUG
- if ((gdk_debug_flags & GDK_DEBUG_XIM) && destroyed > 0)
- {
- g_warning ("Cleaned up %i IC(s)\n", destroyed);
- }
-#endif /* G_ENABLE_DEBUG */
- g_list_free(xim_ic_list);
- xim_ic_list = NULL;
-}
-
-#else /* !USE_XIM */
-
-void
-gdk_im_begin (GdkIC ic, GdkWindow* window)
-{
-}
-
-void
-gdk_im_end (void)
-{
-}
-
-GdkIMStyle
-gdk_im_decide_style (GdkIMStyle supported_style)
-{
- return GdkIMPreeditNone | GdkIMStatusNone;
-}
-
-GdkIMStyle
-gdk_im_set_best_style (GdkIMStyle style)
-{
- return GdkIMPreeditNone | GdkIMStatusNone;
-}
-
-gint
-gdk_im_ready (void)
-{
- return FALSE;
-}
-
-GdkIC
-gdk_ic_new (GdkWindow* client_window,
- GdkWindow* focus_window,
- GdkIMStyle style, ...)
-{
- return NULL;
-}
-
-void
-gdk_ic_destroy (GdkIC ic)
-{
-}
-
-GdkIMStyle
-gdk_ic_get_style (GdkIC ic)
-{
- return GdkIMPreeditNone | GdkIMStatusNone;
-}
-
-void
-gdk_ic_set_values (GdkIC ic, ...)
-{
-}
-
-void
-gdk_ic_get_values (GdkIC ic, ...)
-{
-}
-
-void
-gdk_ic_set_attr (GdkIC ic, const char *target, ...)
-{
-}
-
-void
-gdk_ic_get_attr (GdkIC ic, const char *target, ...)
-{
-}
-
-GdkEventMask
-gdk_ic_get_events (GdkIC ic)
-{
- return 0;
-}
-
-#endif /* USE_XIM */
-
-#ifdef X_LOCALE
-
-gint
-_g_mbtowc (wchar_t *wstr, const char *str, size_t len)
-{
- static wchar_t wcs[MB_CUR_MAX + 1];
- static gchar mbs[MB_CUR_MAX + 1];
-
- wcs[0] = (wchar_t) NULL;
- mbs[0] = '\0';
-
- len = _Xmbstowcs (wcs, str, (len<MB_CUR_MAX)? len:MB_CUR_MAX);
- if (len < 1)
- return len;
- else if (wcs[0] == (wchar_t) NULL)
- return -1;
-
- len = _Xwctomb (mbs, wcs[0]);
- if (mbs[0] == '\0')
- return -1;
- if (wstr)
- *wstr = wcs[0];
-
- return len;
-}
-
-#endif /* X_LOCALE */
-
-static void
-gdk_dnd_drag_leave (Window dest)
-{
- XEvent sev;
- GdkEventDropLeave tev;
- int i;
- GdkWindowPrivate *wp;
-
- tev.u.allflags = 0;
-
- tev.u.flags.protocol_version = DND_PROTOCOL_VERSION;
- sev.xclient.type = ClientMessage;
- sev.xclient.window = dest;
- sev.xclient.format = 32;
- sev.xclient.message_type = gdk_dnd.gdk_XdeLeave;
- sev.xclient.data.l[1] = tev.u.allflags;
- for (i = 0; i < gdk_dnd.drag_numwindows; i++)
- {
- wp = (GdkWindowPrivate *) gdk_dnd.drag_startwindows[i];
- sev.xclient.data.l[0] = wp->xwindow;
- if (!gdk_send_xevent (dest, False, NoEventMask, &sev))
- GDK_NOTE (DND, g_print("Sending XdeLeave to %#lx failed\n",
- dest));
- wp->dnd_drag_accepted = 0;
- }
-}
-
-/*
- * when a drop occurs, we go through the list of windows being dragged and
- * tell them that it has occurred, so that they can set things up and reply
- * to 'dest' window
- */
-static void
-gdk_dnd_drag_end (Window dest,
- GdkPoint coords)
-{
- GdkWindowPrivate *wp;
- GdkEventDragRequest tev;
- int i;
-
- tev.type = GDK_DRAG_REQUEST;
- tev.drop_coords = coords;
- tev.requestor = dest;
- tev.u.allflags = 0;
- tev.u.flags.protocol_version = DND_PROTOCOL_VERSION;
- tev.isdrop = 1;
-
- for (i = 0; i < gdk_dnd.drag_numwindows; i++)
- {
- wp = (GdkWindowPrivate *) gdk_dnd.drag_startwindows[i];
- if (wp->dnd_drag_accepted)
- {
- tev.window = (GdkWindow *) wp;
- tev.u.flags.delete_data = wp->dnd_drag_destructive_op;
- tev.timestamp = gdk_dnd.last_drop_time;
- tev.data_type =
- gdk_atom_name(wp->dnd_drag_data_type);
-
- gdk_event_put((GdkEvent *) &tev);
- }
- }
-}
-
-static GdkAtom
-gdk_dnd_check_types (GdkWindow *window,
- XEvent *xevent)
-{
- GdkWindowPrivate *wp = (GdkWindowPrivate *) window;
- int i, j;
- GdkEventDropEnter event;
-
- g_return_val_if_fail(window != NULL, 0);
- g_return_val_if_fail(xevent != NULL, 0);
- g_return_val_if_fail(xevent->type == ClientMessage, 0);
- g_return_val_if_fail(xevent->xclient.message_type == gdk_dnd.gdk_XdeEnter, 0);
-
- if(wp->dnd_drop_data_numtypesavail <= 0 ||
- !wp->dnd_drop_data_typesavail)
- return 0;
-
- for (i = 2; i <= 4; i++)
- {
- for (j = 0; j < wp->dnd_drop_data_numtypesavail; j++)
- {
- if (xevent->xclient.data.l[i] == wp->dnd_drop_data_typesavail[j])
- return xevent->xclient.data.l[i];
- }
- }
-
- /* Now we get the extended type list if it's available */
- event.u.allflags = xevent->xclient.data.l[1];
- if (event.u.flags.extended_typelist)
- {
- Atom *exttypes, realtype;
- gulong nitems, nbar;
- gint realfmt;
-
- if (XGetWindowProperty(gdk_display, xevent->xclient.data.l[0],
- gdk_dnd.gdk_XdeTypelist, 0L, LONG_MAX - 1,
- False, AnyPropertyType, &realtype, &realfmt,
- &nitems, &nbar, (unsigned char **) &exttypes)
- != Success)
- return 0;
-
- if (realfmt != (sizeof(Atom) * 8))
- {
- g_warning("XdeTypelist property had format of %d instead of the expected %d, on window %#lx\n",
- realfmt, sizeof(Atom) * 8, xevent->xclient.data.l[0]);
- return 0;
- }
-
- for (i = 0; i <= nitems; i++)
- {
- for (j = 0; j < wp->dnd_drop_data_numtypesavail; j++)
- {
- if (exttypes[i] == wp->dnd_drop_data_typesavail[j])
- {
- XFree (exttypes);
- return exttypes[i];
- }
- }
- }
- XFree (exttypes);
- }
- return 0;
-}
-
-/*
- * used for debugging only
- */
-#ifdef DEBUG_DND
-static void
-gdk_print_atom (GdkAtom anatom)
-{
- gchar *tmpstr = NULL;
- tmpstr = (anatom!=None)?gdk_atom_name(anatom):"(none)";
- g_print("Atom %lu has name %s\n", anatom, tmpstr);
- if(tmpstr)
- g_free(tmpstr);
-}
-#endif
-
-/*
- * used only by below routine and itself
- */
-static Window
-getchildren (Display *dpy,
- Window win,
- Atom WM_STATE)
-{
- Window root, parent, *children, inf = 0;
- Atom type = None;
- unsigned int nchildren, i;
- int format;
- unsigned long nitems, after;
- unsigned char *data;
-
- if (XQueryTree(dpy, win, &root, &parent, &children, &nchildren) == 0)
- return 0;
-
- for (i = 0; !inf && (i < nchildren); i++)
- {
- XGetWindowProperty (dpy, children[i], WM_STATE, 0, 0, False,
- AnyPropertyType, &type, &format, &nitems,
- &after, &data);
- if (type != 0)
- inf = children[i];
- XFree(data);
- }
-
- for (i = 0; !inf && (i < nchildren); i++)
- inf = getchildren (dpy, children[i], WM_STATE);
-
- if (children != None)
- XFree ((char *) children);
-
- return inf;
-}
-
-/*
- * find a window with WM_STATE, else return win itself, as per ICCCM
- *
- * modification of the XmuClientWindow() routine from X11R6.3
- */
-Window
-gdk_get_client_window (Display *dpy,
- Window win)
-{
- Atom WM_STATE;
- Atom type = None;
- int format;
- unsigned long nitems, after;
- unsigned char *data;
- Window inf;
-
- if (win == 0)
- return DefaultRootWindow(dpy);
-
- if ((WM_STATE = XInternAtom (dpy, "WM_STATE", True)) == 0)
- return win;
-
- XGetWindowProperty (dpy, win, WM_STATE, 0, 0, False, AnyPropertyType,
- &type, &format, &nitems, &after, &data);
- if (type)
- return win;
-
- inf = getchildren (dpy, win, WM_STATE);
-
- if (inf == 0)
- return win;
- else
- return inf;
-}
-
-#ifdef WE_HAVE_MOTIF_DROPS_DONE
-static GdkWindow *
-gdk_drop_get_real_window (GdkWindow *w,
- guint16 *x,
- guint16 *y)
-{
- GdkWindow *retval = w;
- GdkWindowPrivate *awin;
- GList *children;
- gint16 myx = *x, myy = *y;
-
- g_return_val_if_fail(w != NULL && x != NULL && y != NULL, NULL);
-
- myx = *x;
- myy = *y;
-
-descend:
- for (children = gdk_window_get_children(retval);
- children && children->next;
- children = children->next)
- {
- awin = (GdkWindowPrivate *) children->data;
- if ((myx >= awin->x) && (myy >= awin->y)
- && (myx < (awin->x + awin->width))
- && (myy < (awin->y + awin->height)))
- {
- retval = (GdkWindow *) awin;
- myx -= awin->x;
- myy -= awin->y;
- goto descend;
- }
- }
-
- *x = myx;
- *y = myy;
-
- return retval;
-}
-#endif
-
-/* Sends a ClientMessage to all toplevel client windows */
-void
-gdk_event_send_clientmessage_toall(GdkEvent *event)
-{
- XEvent sev;
- Window *ret_children, ret_root, ret_parent, curwin;
- unsigned int ret_nchildren;
- int i;
-
- g_return_if_fail(event != NULL);
-
- /* Set up our event to send, with the exception of its target window */
- sev.xclient.type = ClientMessage;
- sev.xclient.display = gdk_display;
- sev.xclient.format = event->client.data_format;
- sev.xclient.serial = CurrentTime;
- memcpy(&sev.xclient.data, &event->client.data, sizeof(sev.xclient.data));
- sev.xclient.message_type = event->client.message_type;
-
- /* OK, we're all set, now let's find some windows to send this to */
- if(XQueryTree(gdk_display, gdk_root_window, &ret_root, &ret_parent,
- &ret_children, &ret_nchildren) != True)
- return;
-
- /* foreach true child window of the root window, send an event to it */
- for(i = 0; i < ret_nchildren; i++) {
- curwin = gdk_get_client_window(gdk_display, ret_children[i]);
- sev.xclient.window = curwin;
- if (!gdk_send_xevent (curwin, False, NoEventMask, &sev))
- GDK_NOTE (MISC, g_print("Sending client message %ld to %#lx failed\n",
- event->client.message_type, curwin));
- }
-
- XFree(ret_children);
-}
-
-gchar *
-gdk_get_display(void)
-{
- return (gchar *)XDisplayName (gdk_display_name);
-}
-
-gint
-gdk_send_xevent (Window window, gboolean propagate, glong event_mask,
- XEvent *event_send)
-{
- Status result;
-
- gdk_error_code = 0;
-
- gdk_error_warnings = 0;
- result = XSendEvent (gdk_display, window, propagate, event_mask, event_send);
- XSync (gdk_display, False);
- gdk_error_warnings = 1;
-
- return result && (gdk_error_code != -1);
-}
diff --git a/gdk/gdk.h b/gdk/gdk.h
deleted file mode 100644
index b22570aa10..0000000000
--- a/gdk/gdk.h
+++ /dev/null
@@ -1,799 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GDK_H__
-#define __GDK_H__
-
-
-#include <gdk/gdktypes.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/* Initialization, exit and events
- */
-void gdk_init (int *argc,
- char ***argv);
-void gdk_exit (int error_code);
-gchar* gdk_set_locale (void);
-
-gint gdk_events_pending (void);
-GdkEvent *gdk_event_get (void);
-GdkEvent *gdk_event_get_graphics_expose (GdkWindow *window);
-void gdk_event_put (GdkEvent *event);
-
-GdkEvent *gdk_event_copy (GdkEvent *event);
-void gdk_event_free (GdkEvent *event);
-
-void gdk_set_show_events (gint show_events);
-void gdk_set_use_xshm (gint use_xshm);
-
-gint gdk_get_show_events (void);
-gint gdk_get_use_xshm (void);
-gchar *gdk_get_display (void);
-
-guint32 gdk_time_get (void);
-guint32 gdk_timer_get (void);
-void gdk_timer_set (guint32 milliseconds);
-void gdk_timer_enable (void);
-void gdk_timer_disable (void);
-
-gint gdk_input_add_full (gint source,
- GdkInputCondition condition,
- GdkInputFunction function,
- gpointer data,
- GdkDestroyNotify destroy);
-#define gdk_input_add_interp gdk_input_add_full
-gint gdk_input_add (gint source,
- GdkInputCondition condition,
- GdkInputFunction function,
- gpointer data);
-void gdk_input_remove (gint tag);
-
-gint gdk_pointer_grab (GdkWindow * window,
- gint owner_events,
- GdkEventMask event_mask,
- GdkWindow * confine_to,
- GdkCursor * cursor,
- guint32 time);
-void gdk_pointer_ungrab (guint32 time);
-
-gint gdk_keyboard_grab (GdkWindow * window,
- gint owner_events,
- guint32 time);
-void gdk_keyboard_ungrab (guint32 time);
-
-gint gdk_pointer_is_grabbed (void);
-
-gint gdk_screen_width (void);
-gint gdk_screen_height (void);
-
-void gdk_flush (void);
-void gdk_beep (void);
-
-void gdk_key_repeat_disable (void);
-void gdk_key_repeat_restore (void);
-
-
-/* Visuals
- */
-gint gdk_visual_get_best_depth (void);
-GdkVisualType gdk_visual_get_best_type (void);
-GdkVisual* gdk_visual_get_system (void);
-GdkVisual* gdk_visual_get_best (void);
-GdkVisual* gdk_visual_get_best_with_depth (gint depth);
-GdkVisual* gdk_visual_get_best_with_type (GdkVisualType visual_type);
-GdkVisual* gdk_visual_get_best_with_both (gint depth,
- GdkVisualType visual_type);
-
-/* Actually, these are no-ops... */
-GdkVisual* gdk_visual_ref (GdkVisual *visual);
-void gdk_visual_unref (GdkVisual *visual);
-
-void gdk_query_depths (gint **depths,
- gint *count);
-void gdk_query_visual_types (GdkVisualType **visual_types,
- gint *count);
-void gdk_query_visuals (GdkVisual **visuals,
- gint *count);
-
-
-/* Windows
- */
-GdkWindow* gdk_window_new (GdkWindow *parent,
- GdkWindowAttr *attributes,
- gint attributes_mask);
-
-GdkWindow * gdk_window_foreign_new (guint32 anid);
-void gdk_window_destroy (GdkWindow *window);
-GdkWindow* gdk_window_ref (GdkWindow *window);
-void gdk_window_unref (GdkWindow *window);
-
-void gdk_window_show (GdkWindow *window);
-void gdk_window_hide (GdkWindow *window);
-void gdk_window_withdraw (GdkWindow *window);
-void gdk_window_move (GdkWindow *window,
- gint x,
- gint y);
-void gdk_window_resize (GdkWindow *window,
- gint width,
- gint height);
-void gdk_window_move_resize (GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height);
-void gdk_window_reparent (GdkWindow *window,
- GdkWindow *new_parent,
- gint x,
- gint y);
-void gdk_window_clear (GdkWindow *window);
-void gdk_window_clear_area (GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height);
-void gdk_window_clear_area_e(GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height);
-void gdk_window_copy_area (GdkWindow *window,
- GdkGC *gc,
- gint x,
- gint y,
- GdkWindow *source_window,
- gint source_x,
- gint source_y,
- gint width,
- gint height);
-void gdk_window_raise (GdkWindow *window);
-void gdk_window_lower (GdkWindow *window);
-
-void gdk_window_set_user_data (GdkWindow *window,
- gpointer user_data);
-void gdk_window_set_override_redirect(GdkWindow *window,
- gboolean override_redirect);
-
-void gdk_window_add_filter (GdkWindow *window,
- GdkFilterFunc function,
- gpointer data);
-void gdk_window_remove_filter (GdkWindow *window,
- GdkFilterFunc function,
- gpointer data);
-
-/*
- * This allows for making shaped (partially transparent) windows
- * - cool feature, needed for Drag and Drag for example.
- * The shape_mask can be the mask
- * from gdk_pixmap_create_from_xpm. Stefan Wille
- */
-void gdk_window_shape_combine_mask (GdkWindow *window,
- GdkBitmap *shape_mask,
- gint offset_x,
- gint offset_y);
-
-/*
- * Drag & Drop
- * Algorithm (drop source):
- * A window being dragged will be sent a GDK_DRAG_BEGIN message.
- * It will then do gdk_dnd_drag_addwindow() for any other windows that are to be
- * dragged.
- * When we get a DROP_ENTER incoming, we send it on to the window in question.
- * That window needs to use gdk_dnd_drop_enter_reply() to indicate the state of
- * things (it must call that even if it's not going to accept the drop)
- *
- * These two turn on/off drag or drop, and if enabling it also
- * sets the list of types supported. The list of types passed in
- * should be in order of decreasing preference.
- */
-void gdk_window_dnd_drag_set (GdkWindow *window,
- guint8 drag_enable,
- gchar **typelist,
- guint numtypes);
-
-/*
- *XXX todo: add a GDK_DROP_ENTER which can look at actual data
- */
-void gdk_window_dnd_drop_set (GdkWindow *window,
- guint8 drop_enable,
- gchar **typelist,
- guint numtypes,
- guint8 destructive_op);
-
-/*
- * This is used by the GDK_DRAG_BEGIN handler. An example of usage would be a
- * file manager where multiple icons were selected and the drag began.
- * The icon that the drag actually began on would gdk_dnd_drag_addwindow
- * for all the other icons that were being dragged...
- */
-void gdk_dnd_drag_addwindow (GdkWindow *window);
-void gdk_window_dnd_data_set (GdkWindow *window,
- GdkEvent *event,
- gpointer data,
- gulong data_numbytes);
-void gdk_dnd_set_drag_cursors(GdkCursor *default_cursor,
- GdkCursor *goahead_cursor);
-void gdk_dnd_set_drag_shape(GdkWindow *default_pixmapwin,
- GdkPoint *default_hotspot,
- GdkWindow *goahead_pixmapwin,
- GdkPoint *goahead_hotspot);
-
-void gdk_window_set_hints (GdkWindow *window,
- gint x,
- gint y,
- gint min_width,
- gint min_height,
- gint max_width,
- gint max_height,
- gint flags);
-void gdk_window_set_title (GdkWindow *window,
- const gchar *title);
-void gdk_window_set_background (GdkWindow *window,
- GdkColor *color);
-void gdk_window_set_back_pixmap (GdkWindow *window,
- GdkPixmap *pixmap,
- gint parent_relative);
-void gdk_window_set_cursor (GdkWindow *window,
- GdkCursor *cursor);
-void gdk_window_set_colormap (GdkWindow *window,
- GdkColormap *colormap);
-void gdk_window_get_user_data (GdkWindow *window,
- gpointer *data);
-void gdk_window_get_geometry (GdkWindow *window,
- gint *x,
- gint *y,
- gint *width,
- gint *height,
- gint *depth);
-void gdk_window_get_position (GdkWindow *window,
- gint *x,
- gint *y);
-void gdk_window_get_size (GdkWindow *window,
- gint *width,
- gint *height);
-GdkVisual* gdk_window_get_visual (GdkWindow *window);
-GdkColormap* gdk_window_get_colormap (GdkWindow *window);
-GdkWindowType gdk_window_get_type (GdkWindow *window);
-gint gdk_window_get_origin (GdkWindow *window,
- gint *x,
- gint *y);
-GdkWindow* gdk_window_get_pointer (GdkWindow *window,
- gint *x,
- gint *y,
- GdkModifierType *mask);
-GdkWindow* gdk_window_get_parent (GdkWindow *window);
-GdkWindow* gdk_window_get_toplevel (GdkWindow *window);
-GList* gdk_window_get_children (GdkWindow *window);
-GdkEventMask gdk_window_get_events (GdkWindow *window);
-void gdk_window_set_events (GdkWindow *window,
- GdkEventMask event_mask);
-
-void gdk_window_set_icon (GdkWindow *window,
- GdkWindow *icon_window,
- GdkPixmap *pixmap,
- GdkBitmap *mask);
-void gdk_window_set_icon_name (GdkWindow *window,
- gchar *name);
-void gdk_window_set_group (GdkWindow *window,
- GdkWindow *leader);
-void gdk_window_set_decorations (GdkWindow *window,
- GdkWMDecoration decorations);
-void gdk_window_set_functions (GdkWindow *window,
- GdkWMFunction functions);
-
-/* Cursors
- */
-GdkCursor* gdk_cursor_new (GdkCursorType cursor_type);
-GdkCursor* gdk_cursor_new_from_pixmap (GdkPixmap *source,
- GdkPixmap *mask,
- GdkColor *fg,
- GdkColor *bg,
- gint x,
- gint y);
-void gdk_cursor_destroy (GdkCursor *cursor);
-
-
-/* GCs
- */
-GdkGC* gdk_gc_new (GdkWindow *window);
-GdkGC* gdk_gc_new_with_values (GdkWindow *window,
- GdkGCValues *values,
- GdkGCValuesMask values_mask);
-GdkGC* gdk_gc_ref (GdkGC *gc);
-void gdk_gc_unref (GdkGC *gc);
-void gdk_gc_destroy (GdkGC *gc);
-void gdk_gc_get_values (GdkGC *gc,
- GdkGCValues *values);
-void gdk_gc_set_foreground (GdkGC *gc,
- GdkColor *color);
-void gdk_gc_set_background (GdkGC *gc,
- GdkColor *color);
-void gdk_gc_set_font (GdkGC *gc,
- GdkFont *font);
-void gdk_gc_set_function (GdkGC *gc,
- GdkFunction function);
-void gdk_gc_set_fill (GdkGC *gc,
- GdkFill fill);
-void gdk_gc_set_tile (GdkGC *gc,
- GdkPixmap *tile);
-void gdk_gc_set_stipple (GdkGC *gc,
- GdkPixmap *stipple);
-void gdk_gc_set_ts_origin (GdkGC *gc,
- gint x,
- gint y);
-void gdk_gc_set_clip_origin (GdkGC *gc,
- gint x,
- gint y);
-void gdk_gc_set_clip_mask (GdkGC *gc,
- GdkBitmap *mask);
-void gdk_gc_set_clip_rectangle (GdkGC *gc,
- GdkRectangle *rectangle);
-void gdk_gc_set_clip_region (GdkGC *gc,
- GdkRegion *region);
-void gdk_gc_set_subwindow (GdkGC *gc,
- GdkSubwindowMode mode);
-void gdk_gc_set_exposures (GdkGC *gc,
- gint exposures);
-void gdk_gc_set_line_attributes (GdkGC *gc,
- gint line_width,
- GdkLineStyle line_style,
- GdkCapStyle cap_style,
- GdkJoinStyle join_style);
-void gdk_gc_copy (GdkGC *dst_gc,
- GdkGC *src_gc);
-
-
-/* Pixmaps
- */
-GdkPixmap* gdk_pixmap_new (GdkWindow *window,
- gint width,
- gint height,
- gint depth);
-GdkBitmap* gdk_bitmap_create_from_data (GdkWindow *window,
- gchar *data,
- gint width,
- gint height);
-GdkPixmap* gdk_pixmap_create_from_data (GdkWindow *window,
- gchar *data,
- gint width,
- gint height,
- gint depth,
- GdkColor *fg,
- GdkColor *bg);
-GdkPixmap* gdk_pixmap_create_from_xpm (GdkWindow *window,
- GdkBitmap **mask,
- GdkColor *transparent_color,
- const gchar *filename);
-GdkPixmap* gdk_pixmap_colormap_create_from_xpm
- (GdkWindow *window,
- GdkColormap *colormap,
- GdkBitmap **mask,
- GdkColor *transparent_color,
- const gchar *filename);
-GdkPixmap* gdk_pixmap_create_from_xpm_d (GdkWindow *window,
- GdkBitmap **mask,
- GdkColor *transparent_color,
- gchar **data);
-GdkPixmap* gdk_pixmap_colormap_create_from_xpm_d
- (GdkWindow *window,
- GdkColormap *colormap,
- GdkBitmap **mask,
- GdkColor *transparent_color,
- gchar **data);
-GdkPixmap *gdk_pixmap_ref (GdkPixmap *pixmap);
-void gdk_pixmap_unref (GdkPixmap *pixmap);
-
-GdkBitmap *gdk_bitmap_ref (GdkBitmap *pixmap);
-void gdk_bitmap_unref (GdkBitmap *pixmap);
-
-
-/* Images
- */
-GdkImage* gdk_image_new_bitmap(GdkVisual *,
- gpointer,
- gint,
- gint);
-GdkImage* gdk_image_new (GdkImageType type,
- GdkVisual *visual,
- gint width,
- gint height);
-GdkImage* gdk_image_get (GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height);
-void gdk_image_put_pixel (GdkImage *image,
- gint x,
- gint y,
- guint32 pixel);
-guint32 gdk_image_get_pixel (GdkImage *image,
- gint x,
- gint y);
-void gdk_image_destroy (GdkImage *image);
-
-
-/* Color
- */
-GdkColormap* gdk_colormap_new (GdkVisual *visual,
- gint allocate);
-GdkColormap* gdk_colormap_ref (GdkColormap *cmap);
-void gdk_colormap_unref (GdkColormap *cmap);
-
-GdkColormap* gdk_colormap_get_system (void);
-gint gdk_colormap_get_system_size (void);
-
-void gdk_colormap_change (GdkColormap *colormap,
- gint ncolors);
-void gdk_colors_store (GdkColormap *colormap,
- GdkColor *colors,
- gint ncolors);
-gint gdk_colors_alloc (GdkColormap *colormap,
- gint contiguous,
- gulong *planes,
- gint nplanes,
- gulong *pixels,
- gint npixels);
-void gdk_colors_free (GdkColormap *colormap,
- gulong *pixels,
- gint npixels,
- gulong planes);
-gint gdk_color_white (GdkColormap *colormap,
- GdkColor *color);
-gint gdk_color_black (GdkColormap *colormap,
- GdkColor *color);
-gint gdk_color_parse (const gchar *spec,
- GdkColor *color);
-gint gdk_color_alloc (GdkColormap *colormap,
- GdkColor *color);
-gint gdk_color_change (GdkColormap *colormap,
- GdkColor *color);
-gint gdk_color_equal (GdkColor *colora,
- GdkColor *colorb);
-
-
-/* Fonts
- */
-GdkFont* gdk_font_load (const gchar *font_name);
-GdkFont* gdk_fontset_load (gchar *fontset_name);
-GdkFont* gdk_font_ref (GdkFont *font);
-void gdk_font_unref (GdkFont *font);
-gint gdk_font_id (GdkFont *font);
-gint gdk_font_equal (GdkFont *fonta,
- GdkFont *fontb);
-gint gdk_string_width (GdkFont *font,
- const gchar *string);
-gint gdk_text_width (GdkFont *font,
- const gchar *text,
- gint text_length);
-gint gdk_char_width (GdkFont *font,
- gchar character);
-gint gdk_string_measure (GdkFont *font,
- const gchar *string);
-gint gdk_text_measure (GdkFont *font,
- const gchar *text,
- gint text_length);
-gint gdk_char_measure (GdkFont *font,
- gchar character);
-
-
-/* Drawing
- */
-void gdk_draw_point (GdkDrawable *drawable,
- GdkGC *gc,
- gint x,
- gint y);
-void gdk_draw_line (GdkDrawable *drawable,
- GdkGC *gc,
- gint x1,
- gint y1,
- gint x2,
- gint y2);
-void gdk_draw_rectangle (GdkDrawable *drawable,
- GdkGC *gc,
- gint filled,
- gint x,
- gint y,
- gint width,
- gint height);
-void gdk_draw_arc (GdkDrawable *drawable,
- GdkGC *gc,
- gint filled,
- gint x,
- gint y,
- gint width,
- gint height,
- gint angle1,
- gint angle2);
-void gdk_draw_polygon (GdkDrawable *drawable,
- GdkGC *gc,
- gint filled,
- GdkPoint *points,
- gint npoints);
-void gdk_draw_string (GdkDrawable *drawable,
- GdkFont *font,
- GdkGC *gc,
- gint x,
- gint y,
- const gchar *string);
-void gdk_draw_text (GdkDrawable *drawable,
- GdkFont *font,
- GdkGC *gc,
- gint x,
- gint y,
- const gchar *text,
- gint text_length);
-void gdk_draw_pixmap (GdkDrawable *drawable,
- GdkGC *gc,
- GdkDrawable *src,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
-void gdk_draw_bitmap (GdkDrawable *drawable,
- GdkGC *gc,
- GdkDrawable *src,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
-void gdk_draw_image (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
-void gdk_draw_points (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPoint *points,
- gint npoints);
-void gdk_draw_segments (GdkDrawable *drawable,
- GdkGC *gc,
- GdkSegment *segs,
- gint nsegs);
-void gdk_draw_lines (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPoint *points,
- gint npoints);
-
-
-
-
-/* Selections
- */
-gint gdk_selection_owner_set (GdkWindow *owner,
- GdkAtom selection,
- guint32 time,
- gint send_event);
-GdkWindow* gdk_selection_owner_get (GdkAtom selection);
-void gdk_selection_convert (GdkWindow *requestor,
- GdkAtom selection,
- GdkAtom target,
- guint32 time);
-gint gdk_selection_property_get (GdkWindow *requestor,
- guchar **data,
- GdkAtom *prop_type,
- gint *prop_format);
-void gdk_selection_send_notify (guint32 requestor,
- GdkAtom selection,
- GdkAtom target,
- GdkAtom property,
- guint32 time);
-
-gint gdk_text_property_to_text_list (GdkAtom encoding, gint format,
- guchar *text, gint length,
- gchar ***list);
-void gdk_free_text_list (gchar **list);
-gint gdk_string_to_compound_text (gchar *str,
- GdkAtom *encoding, gint *format,
- guchar **ctext, gint *length);
-void gdk_free_compound_text (guchar *ctext);
-
-/* Properties
- */
-GdkAtom gdk_atom_intern (const gchar *atom_name,
- gint only_if_exists);
-gchar* gdk_atom_name (GdkAtom atom);
-gint gdk_property_get (GdkWindow *window,
- GdkAtom property,
- GdkAtom type,
- gulong offset,
- gulong length,
- gint pdelete,
- GdkAtom *actual_property_type,
- gint *actual_format,
- gint *actual_length,
- guchar **data);
-
-void gdk_property_change (GdkWindow *window,
- GdkAtom property,
- GdkAtom type,
- gint format,
- GdkPropMode mode,
- guchar *data,
- gint nelements);
-void gdk_property_delete (GdkWindow *window,
- GdkAtom property);
-
-
-/* Rectangle utilities
- */
-gint gdk_rectangle_intersect (GdkRectangle *src1,
- GdkRectangle *src2,
- GdkRectangle *dest);
-
-/* XInput support
- */
-
-void gdk_input_init (void);
-void gdk_input_exit (void);
-GList *gdk_input_list_devices (void);
-void gdk_input_set_extension_events (GdkWindow *window,
- gint mask,
- GdkExtensionMode mode);
-void gdk_input_set_source (guint32 deviceid,
- GdkInputSource source);
-gint gdk_input_set_mode (guint32 deviceid,
- GdkInputMode mode);
-void gdk_input_set_axes (guint32 deviceid,
- GdkAxisUse *axes);
-void gdk_input_set_key (guint32 deviceid,
- guint index,
- guint keyval,
- GdkModifierType modifiers);
-void gdk_input_window_get_pointer (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask);
-
-GdkTimeCoord *gdk_input_motion_events (GdkWindow *window,
- guint32 deviceid,
- guint32 start,
- guint32 stop,
- gint *nevents_return);
-
-/* International Input Method Support Functions
- */
-
-gint gdk_im_ready (void);
-
-void gdk_im_begin (GdkIC ic, GdkWindow* window);
-void gdk_im_end (void);
-GdkIMStyle gdk_im_decide_style (GdkIMStyle supported_style);
-GdkIMStyle gdk_im_set_best_style (GdkIMStyle best_allowed_style);
-GdkIC gdk_ic_new (GdkWindow* client_window,
- GdkWindow* focus_window,
- GdkIMStyle style, ...);
-void gdk_ic_destroy (GdkIC ic);
-GdkIMStyle gdk_ic_get_style (GdkIC ic);
-void gdk_ic_set_values (GdkIC ic, ...);
-void gdk_ic_get_values (GdkIC ic, ...);
-void gdk_ic_set_attr (GdkIC ic, const char *target, ...);
-void gdk_ic_get_attr (GdkIC ic, const char *target, ...);
-GdkEventMask gdk_ic_get_events (GdkIC ic);
-
-/* Miscellaneous */
-void gdk_event_send_clientmessage_toall(GdkEvent *event);
-
-/* Color Context */
-
-GdkColorContext *gdk_color_context_new (GdkVisual *visual,
- GdkColormap *colormap);
-
-GdkColorContext *gdk_color_context_new_mono (GdkVisual *visual,
- GdkColormap *colormap);
-
-void gdk_color_context_free (GdkColorContext *cc);
-
-gulong gdk_color_context_get_pixel (GdkColorContext *cc,
- gushort red,
- gushort green,
- gushort blue,
- gint *failed);
-void gdk_color_context_get_pixels (GdkColorContext *cc,
- gushort *reds,
- gushort *greens,
- gushort *blues,
- gint ncolors,
- gulong *colors,
- gint *nallocated);
-void gdk_color_context_get_pixels_incremental (GdkColorContext *cc,
- gushort *reds,
- gushort *greens,
- gushort *blues,
- gint ncolors,
- gint *used,
- gulong *colors,
- gint *nallocated);
-
-gint gdk_color_context_query_color (GdkColorContext *cc,
- GdkColor *color);
-gint gdk_color_context_query_colors (GdkColorContext *cc,
- GdkColor *colors,
- gint num_colors);
-
-gint gdk_color_context_add_palette (GdkColorContext *cc,
- GdkColor *palette,
- gint num_palette);
-
-void gdk_color_context_init_dither (GdkColorContext *cc);
-void gdk_color_context_free_dither (GdkColorContext *cc);
-
-gulong gdk_color_context_get_pixel_from_palette (GdkColorContext *cc,
- gushort *red,
- gushort *green,
- gushort *blue,
- gint *failed);
-guchar gdk_color_context_get_index_from_palette (GdkColorContext *cc,
- gint *red,
- gint *green,
- gint *blue,
- gint *failed);
-/* Regions
- */
-
-GdkRegion* gdk_region_new (void);
-void gdk_region_destroy (GdkRegion *region);
-
-gboolean gdk_region_empty (GdkRegion *region);
-gboolean gdk_region_equal (GdkRegion *region1,
- GdkRegion *region2);
-gboolean gdk_region_point_in (GdkRegion *region,
- int x,
- int y);
-GdkOverlapType gdk_region_rect_in (GdkRegion *region,
- GdkRectangle *rect);
-
-void gdk_region_offset (GdkRegion *region,
- gint dx,
- gint dy);
-void gdk_region_shrink (GdkRegion *region,
- gint dx,
- gint dy);
-
-GdkRegion* gdk_region_union_with_rect (GdkRegion *region,
- GdkRectangle *rect);
-GdkRegion* gdk_regions_intersect (GdkRegion *source1,
- GdkRegion *source2);
-GdkRegion* gdk_regions_union (GdkRegion *source1,
- GdkRegion *source2);
-GdkRegion* gdk_regions_subtract (GdkRegion *source1,
- GdkRegion *source2);
-GdkRegion* gdk_regions_xor (GdkRegion *source1,
- GdkRegion *source2);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GDK_H__ */
diff --git a/gdk/gdkcc.c b/gdk/gdkcc.c
deleted file mode 100644
index 28ecad7feb..0000000000
--- a/gdk/gdkcc.c
+++ /dev/null
@@ -1,1721 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/* Color Context module
- * Copyright 1994,1995 John L. Cwikla
- * Copyright (C) 1997 by Ripley Software Development
- * Copyright (C) 1997 by Federico Mena (port to Gtk/Gdk)
- */
-
-/* Copyright 1994,1995 John L. Cwikla
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appears in all copies and that
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of John L. Cwikla or
- * Wolfram Research, Inc not be used in advertising or publicity
- * pertaining to distribution of the software without specific, written
- * prior permission. John L. Cwikla and Wolfram Research, Inc make no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- * John L. Cwikla and Wolfram Research, Inc disclaim all warranties with
- * regard to this software, including all implied warranties of
- * merchantability and fitness, in no event shall John L. Cwikla or
- * Wolfram Research, Inc be liable for any special, indirect or
- * consequential damages or any damages whatsoever resulting from loss of
- * use, data or profits, whether in an action of contract, negligence or
- * other tortious action, arising out of or in connection with the use or
- * performance of this software.
- *
- * Author:
- * John L. Cwikla
- * X Programmer
- * Wolfram Research Inc.
- *
- * cwikla@wri.com
- */
-
-
-#include <X11/Xlib.h>
-#include <stdlib.h>
-#include <string.h>
-#include "gdk.h"
-#include "gdkprivate.h"
-#include "gdkx.h"
-
-
-#define MAX_IMAGE_COLORS 256
-
-
-static guint
-hash_color (gpointer key)
-{
- GdkColor *color = key;
-
- return (color->red * 33023 + color->green * 30013 + color->blue * 27011);
-}
-
-static gint
-compare_colors (gpointer a,
- gpointer b)
-{
- GdkColor *aa = a;
- GdkColor *bb = b;
-
- return ((aa->red == bb->red) && (aa->green == bb->green) && (aa->blue == bb->blue));
-}
-
-static void
-free_hash_entry (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- g_free (key); /* key and value are the same GdkColor */
-}
-
-static int
-pixel_sort (const void *a, const void *b)
-{
- return ((GdkColor *) a)->pixel - ((GdkColor *) b)->pixel;
-}
-
-/* XXX: This function does an XQueryColors() the hard way, because there is
- * no corresponding function in Gdk.
- */
-
-static void
-my_x_query_colors (GdkColormap *colormap,
- GdkColor *colors,
- gint ncolors)
-{
- XColor *xcolors;
- gint i;
-
- xcolors = g_new (XColor, ncolors);
- for (i = 0; i < ncolors; i++)
- xcolors[i].pixel = colors[i].pixel;
-
- XQueryColors (gdk_display, GDK_COLORMAP_XCOLORMAP (colormap), xcolors, ncolors);
-
- for (i = 0; i < ncolors; i++)
- {
- colors[i].red = xcolors[i].red;
- colors[i].green = xcolors[i].green;
- colors[i].blue = xcolors[i].blue;
- }
-
- g_free (xcolors);
-}
-
-static void
-query_colors (GdkColorContext *cc)
-{
- gint i;
- GdkColorContextPrivate *ccp = (GdkColorContextPrivate *) cc;
- cc->cmap = g_new (GdkColor, cc->num_colors);
-
- for (i = 0; i < cc->num_colors; i++)
- cc->cmap[i].pixel = cc->clut ? cc->clut[i] : ccp->std_cmap.base_pixel + i;
-
- my_x_query_colors (cc->colormap, cc->cmap, cc->num_colors);
-
- qsort (cc->cmap, cc->num_colors, sizeof (GdkColor), pixel_sort);
-}
-
-static void
-init_bw (GdkColorContext *cc)
-{
- GdkColor color;
-
- g_warning ("init_bw: failed to allocate colors, falling back to black and white");
-
- cc->mode = GDK_CC_MODE_BW;
-
- color.red = color.green = color.blue = 0;
-
- if (!gdk_color_alloc (cc->colormap, &color))
- cc->black_pixel = 0;
- else
- cc->black_pixel = color.pixel;
-
- color.red = color.green = color.blue = 0xffff;
-
- if (!gdk_color_alloc (cc->colormap, &color))
- cc->white_pixel = cc->black_pixel ? 0 : 1;
- else
- cc->white_pixel = color.pixel;
-
- cc->num_colors = 2;
-}
-
-static void
-init_gray (GdkColorContext *cc)
-{
- GdkColorContextPrivate *ccp = (GdkColorContextPrivate *) cc;
- GdkColor *clrs, *cstart;
- gint i;
- gdouble dinc;
-
- cc->num_colors = GDK_VISUAL_XVISUAL (cc->visual)->map_entries;
-
- cc->clut = g_new (gulong, cc->num_colors);
- cstart = g_new (GdkColor, cc->num_colors);
-
-retrygray:
-
- dinc = 65535.0 / (cc->num_colors - 1);
-
- clrs = cstart;
-
- for (i = 0; i < cc->num_colors; i++)
- {
- clrs->red = clrs->green = clrs->blue = dinc * i;
-
- if (!gdk_color_alloc (cc->colormap, clrs))
- {
- gdk_colors_free (cc->colormap, cc->clut, i, 0);
-
- cc->num_colors /= 2;
-
- if (cc->num_colors > 1)
- goto retrygray;
- else
- {
- g_free (cc->clut);
- cc->clut = NULL;
- init_bw (cc);
- g_free (cstart);
- return;
- }
- }
-
- cc->clut[i] = clrs++->pixel;
- }
-
- g_free (cstart);
-
- /* XXX: is this the right thing to do? */
- ccp->std_cmap.colormap = GDK_COLORMAP_XCOLORMAP (cc->colormap);
- ccp->std_cmap.base_pixel = 0;
- ccp->std_cmap.red_max = cc->num_colors - 1;
- ccp->std_cmap.green_max = 0;
- ccp->std_cmap.blue_max = 0;
- ccp->std_cmap.red_mult = 1;
- ccp->std_cmap.green_mult = 0;
- ccp->std_cmap.blue_mult = 0;
-
- cc->white_pixel = WhitePixel (ccp->xdisplay, gdk_screen);
- cc->black_pixel = BlackPixel (ccp->xdisplay, gdk_screen);
-
- query_colors (cc);
-
- cc->mode = GDK_CC_MODE_MY_GRAY;
-}
-
-static void
-init_color (GdkColorContext *cc)
-{
- GdkColorContextPrivate *ccp = (GdkColorContextPrivate *) cc;
- gint cubeval;
-
- cubeval = 1;
- while ((cubeval * cubeval * cubeval) < GDK_VISUAL_XVISUAL (cc->visual)->map_entries)
- cubeval++;
- cubeval--;
-
- cc->num_colors = cubeval * cubeval * cubeval;
-
- ccp->std_cmap.red_max = cubeval - 1;
- ccp->std_cmap.green_max = cubeval - 1;
- ccp->std_cmap.blue_max = cubeval - 1;
- ccp->std_cmap.red_mult = cubeval * cubeval;
- ccp->std_cmap.green_mult = cubeval;
- ccp->std_cmap.blue_mult = 1;
- ccp->std_cmap.base_pixel = 0;
-
- cc->white_pixel = WhitePixel (ccp->xdisplay, gdk_screen);
- cc->black_pixel = BlackPixel (ccp->xdisplay, gdk_screen);
- cc->num_colors = DisplayCells (ccp->xdisplay, gdk_screen);
-
- /* a CLUT for storing allocated pixel indices */
-
- cc->max_colors = cc->num_colors;
- cc->clut = g_new (gulong, cc->max_colors);
-
- for (cubeval = 0; cubeval < cc->max_colors; cubeval++)
- cc->clut[cubeval] = cubeval;
-
- query_colors (cc);
-
- cc->mode = GDK_CC_MODE_STD_CMAP;
-}
-
-
-static void
-init_true_color (GdkColorContext *cc)
-{
- GdkColorContextPrivate *ccp = (GdkColorContextPrivate *) cc;
- gulong rmask, gmask, bmask;
-
- cc->mode = GDK_CC_MODE_TRUE;
-
- /* Red */
-
- rmask = cc->masks.red = cc->visual->red_mask;
-
- cc->shifts.red = 0;
- cc->bits.red = 0;
-
- while (!(rmask & 1))
- {
- rmask >>= 1;
- cc->shifts.red++;
- }
-
- while (rmask & 1)
- {
- rmask >>= 1;
- cc->bits.red++;
- }
-
- /* Green */
-
- gmask = cc->masks.green = cc->visual->green_mask;
-
- cc->shifts.green = 0;
- cc->bits.green = 0;
-
- while (!(gmask & 1))
- {
- gmask >>= 1;
- cc->shifts.green++;
- }
-
- while (gmask & 1)
- {
- gmask >>= 1;
- cc->bits.green++;
- }
-
- /* Blue */
-
- bmask = cc->masks.blue = cc->visual->blue_mask;
-
- cc->shifts.blue = 0;
- cc->bits.blue = 0;
-
- while (!(bmask & 1))
- {
- bmask >>= 1;
- cc->shifts.blue++;
- }
-
- while (bmask & 1)
- {
- bmask >>= 1;
- cc->bits.blue++;
- }
-
- cc->num_colors = (cc->visual->red_mask | cc->visual->green_mask | cc->visual->blue_mask) + 1;
- cc->white_pixel = WhitePixel (ccp->xdisplay, gdk_screen);
- cc->black_pixel = BlackPixel (ccp->xdisplay, gdk_screen);
-}
-
-static void
-init_direct_color (GdkColorContext *cc)
-{
- gint n, count;
- GdkColor *clrs, *cstart;
- gulong rval, gval, bval;
- gulong *rtable;
- gulong *gtable;
- gulong *btable;
- gdouble dinc;
-
- init_true_color (cc); /* for shift stuff */
-
- rval = cc->visual->red_mask >> cc->shifts.red;
- gval = cc->visual->green_mask >> cc->shifts.green;
- bval = cc->visual->blue_mask >> cc->shifts.blue;
-
- rtable = g_new (gulong, rval + 1);
- gtable = g_new (gulong, gval + 1);
- btable = g_new (gulong, bval + 1);
-
- cc->max_entry = MAX (rval, gval);
- cc->max_entry = MAX (cc->max_entry, bval);
-
- cstart = g_new (GdkColor, cc->max_entry + 1);
- cc->clut = g_new (gulong, cc->max_entry + 1);
-
-retrydirect:
-
- for (n = 0; n < rval; n++)
- rtable[n] = rval ? (65535.0 / rval * n) : 0;
-
- for (n = 0; n < gval; n++)
- gtable[n] = gval ? (65535.0 / gval * n) : 0;
-
- for (n = 0; n < bval; n++)
- btable[n] = bval ? (65535.0 / bval * n) : 0;
-
- cc->max_entry = MAX (rval, gval);
- cc->max_entry = MAX (cc->max_entry, bval);
-
- count = 0;
- clrs = cstart;
- cc->num_colors = (rval + 1) * (gval + 1) * (bval + 1);
-
- for (n = 0; n < cc->max_entry; n++)
- {
- dinc = (double) n / cc->max_entry;
-
- clrs->red = rtable[(int) (dinc * rval)];
- clrs->green = gtable[(int) (dinc * gval)];
- clrs->blue = btable[(int) (dinc * bval)];
-
- if (gdk_color_alloc (cc->colormap, clrs))
- {
- cc->clut[count++] = clrs->pixel;
- clrs++;
- }
- else
- {
- gdk_colors_free (cc->colormap, cc->clut, count, 0);
-
- rval >>= 1;
- gval >>= 1;
- bval >>= 1;
-
- cc->masks.red = (cc->masks.red >> 1) & cc->visual->red_mask;
- cc->masks.green = (cc->masks.green >> 1) & cc->visual->green_mask;
- cc->masks.blue = (cc->masks.blue >> 1) & cc->visual->blue_mask;
-
- cc->shifts.red++;
- cc->shifts.green++;
- cc->shifts.blue++;
-
- cc->bits.red--;
- cc->bits.green--;
- cc->bits.blue--;
-
- cc->num_colors = (rval + 1) * (gval + 1) * (bval + 1);
-
- if (cc->num_colors >1)
- goto retrydirect;
- else
- {
- g_free (cc->clut);
- cc->clut = NULL;
- init_bw (cc);
- break;
- }
- }
- }
-
- /* Update allocated color count; original num_colors is max_entry, which
- * is not necessarily the same as the really allocated number of colors.
- */
-
- cc->num_colors = count;
-
- g_free (rtable);
- g_free (gtable);
- g_free (btable);
- g_free (cstart);
-}
-
-static void
-init_palette (GdkColorContext *cc)
-{
- /* restore correct mode for this cc */
-
- switch (cc->visual->type)
- {
- case GDK_VISUAL_STATIC_GRAY:
- case GDK_VISUAL_GRAYSCALE:
- if (GDK_VISUAL_XVISUAL (cc->visual)->map_entries == 2)
- cc->mode = GDK_CC_MODE_BW;
- else
- cc->mode = GDK_CC_MODE_MY_GRAY;
- break;
-
- case GDK_VISUAL_TRUE_COLOR:
- case GDK_VISUAL_DIRECT_COLOR:
- cc->mode = GDK_CC_MODE_TRUE;
- break;
-
- case GDK_VISUAL_STATIC_COLOR:
- case GDK_VISUAL_PSEUDO_COLOR:
- cc->mode = GDK_CC_MODE_STD_CMAP;
- break;
-
- default:
- cc->mode = GDK_CC_MODE_UNDEFINED;
- break;
- }
-
- /* previous palette */
-
- if (cc->num_palette)
- g_free (cc->palette);
-
- if (cc->fast_dither)
- g_free (cc->fast_dither);
-
- /* clear hash table if present */
-
- if (cc->color_hash)
- {
- /* XXX: quick-and-dirty way to remove everything */
-
- g_hash_table_destroy (cc->color_hash);
- cc->color_hash = g_hash_table_new (hash_color, compare_colors);
- }
-
- cc->palette = NULL;
- cc->num_palette = 0;
- cc->fast_dither = NULL;
-}
-
-GdkColorContext *
-gdk_color_context_new (GdkVisual *visual,
- GdkColormap *colormap)
-{
- GdkColorContextPrivate *ccp;
- gint use_private_colormap = FALSE; /* XXX: maybe restore full functionality later? */
- GdkColorContext *cc;
- gint retry_count;
- GdkColormap *default_colormap;
-
- g_assert (visual != NULL);
- g_assert (colormap != NULL);
-
- ccp = g_new (GdkColorContextPrivate, 1);
- cc = (GdkColorContext *) ccp;
- ccp->xdisplay = gdk_display;
- cc->visual = visual;
- cc->colormap = colormap;
- cc->clut = NULL;
- cc->cmap = NULL;
- cc->mode = GDK_CC_MODE_UNDEFINED;
- cc->need_to_free_colormap = FALSE;
-
- cc->color_hash = NULL;
- cc->palette = NULL;
- cc->num_palette = 0;
- cc->fast_dither = NULL;
-
- default_colormap = gdk_colormap_get_system ();
-
- retry_count = 0;
-
- while (retry_count < 2)
- {
- /* Only create a private colormap if the visual found isn't equal
- * to the default visual and we don't have a private colormap,
- * -or- if we are instructed to create a private colormap (which
- * never is the case for XmHTML).
- */
-
- if (use_private_colormap
- || ((cc->visual != gdk_visual_get_system ()) /* default visual? */
- && (GDK_COLORMAP_XCOLORMAP (colormap) == GDK_COLORMAP_XCOLORMAP (default_colormap))))
- {
- g_warning ("gdk_color_context_new: non-default visual detected, "
- "using private colormap");
-
- cc->colormap = gdk_colormap_new (cc->visual, FALSE);
-
- cc->need_to_free_colormap = (GDK_COLORMAP_XCOLORMAP (colormap)
- != GDK_COLORMAP_XCOLORMAP (default_colormap));
- }
-
- switch (visual->type)
- {
- case GDK_VISUAL_STATIC_GRAY:
- case GDK_VISUAL_GRAYSCALE:
- GDK_NOTE (COLOR_CONTEXT,
- g_print ("gdk_color_context_new: visual class is %s\n",
- (visual->type == GDK_VISUAL_STATIC_GRAY) ?
- "GDK_VISUAL_STATIC_GRAY" :
- "GDK_VISUAL_GRAYSCALE"));
-
- if (GDK_VISUAL_XVISUAL (cc->visual)->map_entries == 2)
- init_bw (cc);
- else
- init_gray (cc);
-
- break;
-
- case GDK_VISUAL_TRUE_COLOR: /* shifts */
- GDK_NOTE (COLOR_CONTEXT,
- g_print ("gdk_color_context_new: visual class is GDK_VISUAL_TRUE_COLOR\n"));
-
- init_true_color (cc);
- break;
-
- case GDK_VISUAL_DIRECT_COLOR: /* shifts and fake CLUT */
- GDK_NOTE (COLOR_CONTEXT,
- g_print ("gdk_color_context_new: visual class is GDK_VISUAL_DIRECT_COLOR\n"));
-
- init_direct_color (cc);
- break;
-
- case GDK_VISUAL_STATIC_COLOR:
- case GDK_VISUAL_PSEUDO_COLOR:
- GDK_NOTE (COLOR_CONTEXT,
- g_print ("gdk_color_context_new: visual class is %s\n",
- (visual->type == GDK_VISUAL_STATIC_COLOR) ?
- "GDK_VISUAL_STATIC_COLOR" :
- "GDK_VISUAL_PSEUDO_COLOR"));
-
- init_color (cc);
- break;
-
- default:
- g_assert_not_reached ();
- }
-
- if ((cc->mode == GDK_CC_MODE_BW) && (cc->visual->depth > 1))
- {
- use_private_colormap = TRUE;
- retry_count++;
- }
- else
- break;
- }
-
- /* no. of colors allocated yet */
-
- cc->num_allocated = 0;
-
- GDK_NOTE (COLOR_CONTEXT,
- g_print ("gdk_color_context_new: screen depth is %i, no. of colors is %i\n",
- cc->visual->depth, cc->num_colors));
-
- /* check if we need to initialize a hash table */
-
- if ((cc->mode == GDK_CC_MODE_STD_CMAP) || (cc->mode == GDK_CC_MODE_UNDEFINED))
- cc->color_hash = g_hash_table_new (hash_color, compare_colors);
-
- return (GdkColorContext *) cc;
-}
-
-GdkColorContext *
-gdk_color_context_new_mono (GdkVisual *visual,
- GdkColormap *colormap)
-{
- GdkColorContextPrivate *ccp;
- GdkColorContext *cc;
-
- g_assert (visual != NULL);
- g_assert (colormap != NULL);
-
- cc = g_new (GdkColorContext, 1);
- ccp = (GdkColorContextPrivate *) cc;
- ccp->xdisplay = gdk_display;
- cc->visual = visual;
- cc->colormap = colormap;
- cc->clut = NULL;
- cc->cmap = NULL;
- cc->mode = GDK_CC_MODE_UNDEFINED;
- cc->need_to_free_colormap = FALSE;
-
- init_bw (cc);
-
- return (GdkColorContext *) cc;
-}
-
-/* This doesn't currently free black/white, hmm... */
-
-void
-gdk_color_context_free (GdkColorContext *cc)
-{
- g_assert (cc != NULL);
-
- if ((cc->visual->type == GDK_VISUAL_STATIC_COLOR)
- || (cc->visual->type == GDK_VISUAL_PSEUDO_COLOR))
- {
- gdk_colors_free (cc->colormap, cc->clut, cc->num_allocated, 0);
- g_free (cc->clut);
- }
- else if (cc->clut != NULL)
- {
- gdk_colors_free (cc->colormap, cc->clut, cc->num_colors, 0);
- g_free (cc->clut);
- }
-
- if (cc->cmap != NULL)
- g_free (cc->cmap);
-
- if (cc->need_to_free_colormap)
- gdk_colormap_unref (cc->colormap);
-
- /* free any palette that has been associated with this GdkColorContext */
-
- init_palette (cc);
-
- if (cc->color_hash)
- {
- g_hash_table_foreach (cc->color_hash,
- free_hash_entry,
- NULL);
- g_hash_table_destroy (cc->color_hash);
- }
-
- g_free (cc);
-}
-
-gulong
-gdk_color_context_get_pixel (GdkColorContext *cc,
- gushort red,
- gushort green,
- gushort blue,
- gint *failed)
-{
- GdkColorContextPrivate *ccp = (GdkColorContextPrivate *) cc;
- g_assert (cc != NULL);
- g_assert (failed != NULL);
-
- *failed = FALSE;
-
- switch (cc->mode)
- {
- case GDK_CC_MODE_BW:
- {
- gdouble value;
-
- value = (red / 65535.0 * 0.30
- + green / 65535.0 * 0.59
- + blue / 65535.0 * 0.11);
-
- if (value > 0.5)
- return cc->white_pixel;
-
- return cc->black_pixel;
- }
-
- case GDK_CC_MODE_MY_GRAY:
- {
- gulong ired, igreen, iblue;
-
- red = red * 0.30 + green * 0.59 + blue * 0.11;
- green = 0;
- blue = 0;
-
- if ((ired = red * (ccp->std_cmap.red_max + 1) / 0xffff) > ccp->std_cmap.red_max)
- ired = ccp->std_cmap.red_max;
-
- ired *= ccp->std_cmap.red_mult;
-
- if ((igreen = green * (ccp->std_cmap.green_max + 1) / 0xffff) > ccp->std_cmap.green_max)
- igreen = ccp->std_cmap.green_max;
-
- igreen *= ccp->std_cmap.green_mult;
-
- if ((iblue = blue * (ccp->std_cmap.blue_max + 1) / 0xffff) > ccp->std_cmap.blue_max)
- iblue = ccp->std_cmap.blue_max;
-
- iblue *= ccp->std_cmap.blue_mult;
-
- if (cc->clut != NULL)
- return cc->clut[ccp->std_cmap.base_pixel + ired + igreen + iblue];
-
- return ccp->std_cmap.base_pixel + ired + igreen + iblue;
- }
-
- case GDK_CC_MODE_TRUE:
- {
- gulong ired, igreen, iblue;
-
- if (cc->clut == NULL)
- {
- red >>= 16 - cc->bits.red;
- green >>= 16 - cc->bits.green;
- blue >>= 16 - cc->bits.blue;
-
- ired = (red << cc->shifts.red) & cc->masks.red;
- igreen = (green << cc->shifts.green) & cc->masks.green;
- iblue = (blue << cc->shifts.blue) & cc->masks.blue;
-
- return ired | igreen | iblue;
- }
-
- ired = cc->clut[red * cc->max_entry / 65535] & cc->masks.red;
- igreen = cc->clut[green * cc->max_entry / 65535] & cc->masks.green;
- iblue = cc->clut[blue * cc->max_entry / 65535] & cc->masks.blue;
-
- return ired | igreen | iblue;
- }
-
- case GDK_CC_MODE_PALETTE:
- return gdk_color_context_get_pixel_from_palette (cc, &red, &green, &blue, failed);
-
- case GDK_CC_MODE_STD_CMAP:
- default:
- {
- GdkColor color;
- GdkColor *result;
-
- color.red = red;
- color.green = green;
- color.blue = blue;
-
- result = g_hash_table_lookup (cc->color_hash, &color);
-
- if (!result)
- {
- color.red = red;
- color.green = green;
- color.blue = blue;
- color.pixel = 0;
-
- if (!gdk_color_alloc (cc->colormap, &color))
- *failed = TRUE;
- else
- {
- GdkColor *cnew;
-
- /* XXX: the following comment comes directly from
- * XCC.c. I don't know if it is relevant for
- * gdk_color_alloc() as it is for XAllocColor()
- * - Federico
- */
- /*
- * I can't figure this out entirely, but it *is* possible
- * that XAllocColor succeeds, even if the number of
- * allocations we've made exceeds the number of available
- * colors in the current colormap. And therefore it
- * might be necessary for us to resize the CLUT.
- */
-
- if (cc->num_allocated == cc->max_colors)
- {
- cc->max_colors *= 2;
-
- GDK_NOTE (COLOR_CONTEXT,
- g_print ("gdk_color_context_get_pixel: "
- "resizing CLUT to %i entries\n",
- cc->max_colors));
-
- cc->clut = g_realloc (cc->clut,
- cc->max_colors * sizeof (gulong));
- }
-
- /* Key and value are the same color structure */
-
- cnew = g_new (GdkColor, 1);
- *cnew = color;
- g_hash_table_insert (cc->color_hash, cnew, cnew);
-
- cc->clut[cc->num_allocated] = color.pixel;
- cc->num_allocated++;
- return color.pixel;
- }
- }
-
- return result->pixel;
- }
- }
-}
-
-void
-gdk_color_context_get_pixels (GdkColorContext *cc,
- gushort *reds,
- gushort *greens,
- gushort *blues,
- gint ncolors,
- gulong *colors,
- gint *nallocated)
-{
- gint i, k, idx;
- gint cmapsize, ncols = 0, nopen = 0, counter = 0;
- gint bad_alloc = FALSE;
- gint failed[MAX_IMAGE_COLORS], allocated[MAX_IMAGE_COLORS];
- GdkColor defs[MAX_IMAGE_COLORS], cmap[MAX_IMAGE_COLORS];
- gint exact_col = 0, subst_col = 0, close_col = 0, black_col = 0;
-
- g_assert (cc != NULL);
- g_assert (reds != NULL);
- g_assert (greens != NULL);
- g_assert (blues != NULL);
- g_assert (colors != NULL);
- g_assert (nallocated != NULL);
-
- memset (defs, 0, MAX_IMAGE_COLORS * sizeof (GdkColor));
- memset (failed, 0, MAX_IMAGE_COLORS * sizeof (gint));
- memset (allocated, 0, MAX_IMAGE_COLORS * sizeof (gint));
-
- /* Will only have a value if used by the progressive image loader */
-
- ncols = *nallocated;
-
- *nallocated = 0;
-
- /* First allocate all pixels */
-
- for (i = 0; i < ncolors; i++)
- {
- /* colors[i] is only zero if the pixel at that location hasn't
- * been allocated yet. This is a sanity check required for proper
- * color allocation by the progressive image loader
- */
-
- if (colors[i] == 0)
- {
- defs[i].red = reds[i];
- defs[i].green = greens[i];
- defs[i].blue = blues[i];
-
- colors[i] = gdk_color_context_get_pixel (cc, reds[i], greens[i], blues[i],
- &bad_alloc);
-
- /* successfully allocated, store it */
-
- if (!bad_alloc)
- {
- defs[i].pixel = colors[i];
- allocated[ncols++] = colors[i];
- }
- else
- failed[nopen++] = i;
- }
- }
-
- *nallocated = ncols;
-
- /* all colors available, all done */
-
- if ((ncols == ncolors) || (nopen == 0))
- {
- GDK_NOTE (COLOR_CONTEXT,
- g_print ("gdk_color_context_get_pixels: got all %i colors; "
- "(%i colors allocated so far)\n", ncolors, cc->num_allocated));
-
- return;
- }
-
- /* The fun part. We now try to allocate the colors we couldn't allocate
- * directly. The first step will map a color onto its nearest color
- * that has been allocated (either by us or someone else). If any colors
- * remain unallocated, we map these onto the colors that we have allocated
- * ourselves.
- */
-
- /* read up to MAX_IMAGE_COLORS colors of the current colormap */
-
- cmapsize = MIN (cc->num_colors, MAX_IMAGE_COLORS);
-
- /* see if the colormap has any colors to read */
-
- if (cmapsize < 0)
- {
- g_warning ("gdk_color_context_get_pixels: oops! no colors available, "
- "your images will look *really* ugly.");
-
- return;
- }
-
-#ifdef DEBUG
- exact_col = ncols;
-#endif
-
- /* initialize pixels */
-
- for (i = 0; i < cmapsize; i++)
- {
- cmap[i].pixel = i;
- cmap[i].red = cmap[i].green = cmap[i].blue = 0;
- }
-
- /* read the colormap */
-
- my_x_query_colors (cc->colormap, cmap, cmapsize);
-
- /* get a close match for any unallocated colors */
-
- counter = nopen;
- nopen = 0;
- idx = 0;
-
- do
- {
- gint d, j, mdist, close, ri, gi, bi;
- gint rd, gd, bd;
-
- i = failed[idx];
-
- mdist = 0x1000000;
- close = -1;
-
- /* Store these vals. Small performance increase as this skips three
- * indexing operations in the loop code.
- */
-
- ri = reds[i];
- gi = greens[i];
- bi = blues[i];
-
- /* Walk all colors in the colormap and see which one is the
- * closest. Uses plain least squares.
- */
-
- for (j = 0; (j < cmapsize) && (mdist != 0); j++)
- {
- /* Don't replace these by shifts; the sign may get clobbered */
-
- rd = (ri - cmap[j].red) / 256;
- gd = (gi - cmap[j].green) / 256;
- bd = (bi - cmap[j].blue) / 256;
-
- d = rd * rd + gd * gd + bd * bd;
-
- if (d < mdist)
- {
- close = j;
- mdist = d;
- }
- }
-
- if (close != -1)
- {
- rd = cmap[close].red;
- gd = cmap[close].green;
- bd = cmap[close].blue;
-
- /* allocate */
-
- colors[i] = gdk_color_context_get_pixel (cc, rd, gd, bd, &bad_alloc);
-
- /* store */
-
- if (!bad_alloc)
- {
- defs[i] = cmap[close];
- defs[i].pixel = colors[i];
- allocated[ncols++] = colors[i];
-#ifdef DEBUG
- close_col++;
-#endif
- } else
- failed[nopen++] = i;
- } else
- failed[nopen++] = i;
- /* deal with in next stage if allocation failed */
- }
- while (++idx < counter);
-
- *nallocated = ncols;
-
- /* This is the maximum no. of allocated colors. See also the nopen == 0
- * note above.
- */
-
- if ((ncols == ncolors) || (nopen == 0))
- {
- GDK_NOTE (COLOR_CONTEXT,
- g_print ("gdk_color_context_get_pixels: got %i colors, %i exact and "
- "%i close (%i colors allocated so far)\n",
- ncolors, exact_col, close_col, cc->num_allocated));
-
- return;
- }
-
- /* Now map any remaining unallocated pixels into the colors we did get */
-
- idx = 0;
-
- do
- {
- gint d, mdist, close, ri, gi, bi;
- gint j, rd, gd, bd;
-
- i = failed[idx];
-
- mdist = 0x1000000;
- close = -1;
-
- /* store */
-
- ri = reds[i];
- gi = greens[i];
- bi = blues[i];
-
- /* search allocated colors */
-
- for (j = 0; (j < ncols) && (mdist != 0); j++)
- {
- k = allocated[j];
-
- /* Don't replace these by shifts; the sign may get clobbered */
-
- rd = (ri - defs[k].red) / 256;
- gd = (gi - defs[k].green) / 256;
- bd = (bi - defs[k].blue) / 256;
-
- d = rd * rd + gd * gd + bd * bd;
-
- if (d < mdist)
- {
- close = k;
- mdist = d;
- }
- }
-
- if (close < 0)
- {
- /* too bad, map to black */
-
- defs[i].pixel = cc->black_pixel;
- defs[i].red = defs[i].green = defs[i].blue = 0;
-#ifdef DEBUG
- black_col++;
-#endif
- }
- else
- {
- defs[i] = defs[close];
-#ifdef DEBUG
- subst_col++;
-#endif
- }
-
- colors[i] = defs[i].pixel;
- }
- while (++idx < nopen);
-
- GDK_NOTE (COLOR_CONTEXT,
- g_print ("gdk_color_context_get_pixels: got %i colors, %i exact, %i close, "
- "%i substituted, %i to black (%i colors allocated so far)\n",
- ncolors, exact_col, close_col, subst_col, black_col, cc->num_allocated));
-}
-
-void
-gdk_color_context_get_pixels_incremental (GdkColorContext *cc,
- gushort *reds,
- gushort *greens,
- gushort *blues,
- gint ncolors,
- gint *used,
- gulong *colors,
- gint *nallocated)
-{
- gint i, k, idx;
- gint cmapsize, ncols = 0, nopen = 0, counter = 0;
- gint bad_alloc = FALSE;
- gint failed[MAX_IMAGE_COLORS], allocated[MAX_IMAGE_COLORS];
- GdkColor defs[MAX_IMAGE_COLORS], cmap[MAX_IMAGE_COLORS];
- gint exact_col = 0, subst_col = 0, close_col = 0, black_col = 0;
-
- g_assert (cc != NULL);
- g_assert (reds != NULL);
- g_assert (greens != NULL);
- g_assert (blues != NULL);
- g_assert (used != NULL);
- g_assert (colors != NULL);
- g_assert (nallocated != NULL);
-
- memset (defs, 0, MAX_IMAGE_COLORS * sizeof (GdkColor));
- memset (failed, 0, MAX_IMAGE_COLORS * sizeof (gint));
- memset (allocated, 0, MAX_IMAGE_COLORS * sizeof (gint));
-
- /* Will only have a value if used by the progressive image loader */
-
- ncols = *nallocated;
-
- *nallocated = 0;
-
- /* First allocate all pixels */
-
- for (i = 0; i < ncolors; i++)
- {
- /* used[i] is only -1 if the pixel at that location hasn't
- * been allocated yet. This is a sanity check required for proper
- * color allocation by the progressive image loader.
- * When colors[i] == 0 it indicates the slot is available for
- * allocation.
- */
-
- if (used[i] != FALSE)
- {
- if (colors[i] == 0)
- {
- defs[i].red = reds[i];
- defs[i].green = greens[i];
- defs[i].blue = blues[i];
-
- colors[i] = gdk_color_context_get_pixel (cc, reds[i], greens[i], blues[i], &bad_alloc);
-
- /* successfully allocated, store it */
-
- if (!bad_alloc)
- {
- defs[i].pixel = colors[i];
- allocated[ncols++] = colors[i];
- }
- else
- failed[nopen++] = i;
- }
-#ifdef DEBUG
- else
- GDK_NOTE (COLOR_CONTEXT,
- g_print ("gdk_color_context_get_pixels_incremental: "
- "pixel at slot %i already allocated, skipping\n", i));
-#endif
- }
- }
-
- *nallocated = ncols;
-
- if ((ncols == ncolors) || (nopen == 0))
- {
- GDK_NOTE (COLOR_CONTEXT,
- g_print ("gdk_color_context_get_pixels_incremental: got all %i colors "
- "(%i colors allocated so far)\n",
- ncolors, cc->num_allocated));
-
- return;
- }
-
- cmapsize = MIN (cc->num_colors, MAX_IMAGE_COLORS);
-
- if (cmapsize < 0)
- {
- g_warning ("gdk_color_context_get_pixels_incremental: oops! "
- "No colors available images will look *really* ugly.");
- return;
- }
-
-#ifdef DEBUG
- exact_col = ncols;
-#endif
-
- /* initialize pixels */
-
- for (i = 0; i < cmapsize; i++)
- {
- cmap[i].pixel = i;
- cmap[i].red = cmap[i].green = cmap[i].blue = 0;
- }
-
- /* read */
-
- my_x_query_colors (cc->colormap, cmap, cmapsize);
-
- /* now match any unallocated colors */
-
- counter = nopen;
- nopen = 0;
- idx = 0;
-
- do
- {
- gint d, j, mdist, close, ri, gi, bi;
- gint rd, gd, bd;
-
- i = failed[idx];
-
- mdist = 0x1000000;
- close = -1;
-
- /* store */
-
- ri = reds[i];
- gi = greens[i];
- bi = blues[i];
-
- for (j = 0; (j < cmapsize) && (mdist != 0); j++)
- {
- /* Don't replace these by shifts; the sign may get clobbered */
-
- rd = (ri - cmap[j].red) / 256;
- gd = (gi - cmap[j].green) / 256;
- bd = (bi - cmap[j].blue) / 256;
-
- d = rd * rd + gd * gd + bd * bd;
-
- if (d < mdist)
- {
- close = j;
- mdist = d;
- }
- }
-
- if (close != -1)
- {
- rd = cmap[close].red;
- gd = cmap[close].green;
- bd = cmap[close].blue;
-
- /* allocate */
-
- colors[i] = gdk_color_context_get_pixel (cc, rd, gd, bd, &bad_alloc);
-
- /* store */
-
- if (!bad_alloc)
- {
- defs[i] = cmap[close];
- defs[i].pixel = colors[i];
- allocated[ncols++] = colors[i];
-#ifdef DEBUG
- close_col++;
-#endif
- }
- else
- failed[nopen++] = i;
- }
- else
- failed[nopen++] = i;
- /* deal with in next stage if allocation failed */
- }
- while (++idx < counter);
-
- *nallocated = ncols;
-
- if ((ncols == ncolors) || (nopen == 0))
- {
- GDK_NOTE (COLOR_CONTEXT,
- g_print ("gdk_color_context_get_pixels_incremental: "
- "got %i colors, %i exact and %i close "
- "(%i colors allocated so far)\n",
- ncolors, exact_col, close_col, cc->num_allocated));
-
- return;
- }
-
- /* map remaining unallocated pixels into colors we did get */
-
- idx = 0;
-
- do
- {
- gint d, mdist, close, ri, gi, bi;
- gint j, rd, gd, bd;
-
- i = failed[idx];
-
- mdist = 0x1000000;
- close = -1;
-
- ri = reds[i];
- gi = greens[i];
- bi = blues[i];
-
- /* search allocated colors */
-
- for (j = 0; (j < ncols) && (mdist != 0); j++)
- {
- k = allocated[j];
-
- /* downscale */
- /* Don't replace these by shifts; the sign may get clobbered */
-
- rd = (ri - defs[k].red) / 256;
- gd = (gi - defs[k].green) / 256;
- bd = (bi - defs[k].blue) / 256;
-
- d = rd * rd + gd * gd + bd * bd;
-
- if (d < mdist)
- {
- close = k;
- mdist = d;
- }
- }
-
- if (close < 0)
- {
- /* too bad, map to black */
-
- defs[i].pixel = cc->black_pixel;
- defs[i].red = defs[i].green = defs[i].blue = 0;
-#ifdef DEBUG
- black_col++;
-#endif
- }
- else
- {
- defs[i] = defs[close];
-#ifdef DEBUG
- subst_col++;
-#endif
- }
-
- colors[i] = defs[i].pixel;
- }
- while (++idx < nopen);
-
- GDK_NOTE (COLOR_CONTEXT,
- g_print ("gdk_color_context_get_pixels_incremental: "
- "got %i colors, %i exact, %i close, %i substituted, %i to black "
- "(%i colors allocated so far)\n",
- ncolors, exact_col, close_col, subst_col, black_col, cc->num_allocated));
-}
-
-gint
-gdk_color_context_query_color (GdkColorContext *cc,
- GdkColor *color)
-{
- return gdk_color_context_query_colors (cc, color, 1);
-}
-
-gint
-gdk_color_context_query_colors (GdkColorContext *cc,
- GdkColor *colors,
- gint num_colors)
-{
- gint i;
- GdkColor *tc;
-
- g_assert (cc != NULL);
- g_assert (colors != NULL);
-
- switch (cc->mode)
- {
- case GDK_CC_MODE_BW:
- for (i = 0, tc = colors; i < num_colors; i++, tc++)
- {
- if (tc->pixel == cc->white_pixel)
- tc->red = tc->green = tc->blue = 65535;
- else
- tc->red = tc->green = tc->blue = 0;
- }
- break;
-
- case GDK_CC_MODE_TRUE:
- if (cc->clut == NULL)
- for (i = 0, tc = colors; i < num_colors; i++, tc++)
- {
- tc->red = ((tc->pixel & cc->masks.red) >> cc->shifts.red) << (16 - cc->bits.red);
- tc->green = ((tc->pixel & cc->masks.green) >> cc->shifts.green) << (16 - cc->bits.green);
- tc->blue = ((tc->pixel & cc->masks.blue) >> cc->shifts.blue) << (16 - cc->bits.blue);
- }
- else
- {
- my_x_query_colors (cc->colormap, colors, num_colors);
- return 1;
- }
- break;
-
- case GDK_CC_MODE_STD_CMAP:
- default:
- if (cc->cmap == NULL)
- {
- my_x_query_colors (cc->colormap, colors, num_colors);
- return 1;
- }
- else
- {
- gint first, last, half;
- gulong half_pixel;
-
- for (i = 0, tc = colors; i < num_colors; i++)
- {
- first = 0;
- last = cc->num_colors - 1;
-
- while (first <= last)
- {
- half = (first + last) / 2;
- half_pixel = cc->cmap[half].pixel;
-
- if (tc->pixel == half_pixel)
- {
- tc->red = cc->cmap[half].red;
- tc->green = cc->cmap[half].green;
- tc->blue = cc->cmap[half].blue;
- first = last + 1; /* false break */
- }
- else
- {
- if (tc->pixel > half_pixel)
- first = half + 1;
- else
- last = half - 1;
- }
- }
- }
- return 1;
- }
- break;
- }
- return 1;
-}
-
-gint
-gdk_color_context_add_palette (GdkColorContext *cc,
- GdkColor *palette,
- gint num_palette)
-{
- gint i, j, erg;
- gushort r, g, b;
- gulong pixel[1];
-
- g_assert (cc != NULL);
-
- /* initialize this palette (will also erase previous palette as well) */
-
- init_palette (cc);
-
- /* restore previous mode if we aren't adding a new palette */
-
- if (num_palette == 0)
- {
- /* GDK_CC_MODE_STD_CMAP uses a hash table, so we'd better initialize one */
-
- /* XXX: here, the hash table is already initialized */
-
- return 0;
- }
-
- /* Initialize a hash table for this palette (we need one for allocating
- * the pixels in the palette using the current settings)
- */
-
- if (cc->color_hash == NULL)
- cc->color_hash = g_hash_table_new (hash_color, compare_colors);
-
- /* copy incoming palette */
-
- cc->palette = g_new0(GdkColor, num_palette);
-
- j = 0;
-
- for (i = 0; i < num_palette; i++)
- {
- erg = 0;
- pixel[0] = 0;
-
- /* try to allocate this color */
-
- r = palette[i].red;
- g = palette[i].green;
- b = palette[i].blue;
-
- gdk_color_context_get_pixels (cc, &r, &g, &b, 1, pixel, &erg);
-
- /* only store if we succeed */
-
- if (erg)
- {
- /* store in palette */
-
- cc->palette[j].red = r;
- cc->palette[j].green = g;
- cc->palette[j].blue = b;
- cc->palette[j].pixel = pixel[0];
-
- /* move to next slot */
-
- j++;
- }
- }
-
- /* resize to fit */
-
- if (j != num_palette)
- cc->palette = g_realloc (cc->palette, j * sizeof (GdkColor));
-
- /* clear the hash table, we don't use it when dithering */
-
- if (cc->color_hash)
- {
- g_hash_table_destroy (cc->color_hash);
- cc->color_hash = NULL;
- }
-
- /* store real palette size */
-
- cc->num_palette = j;
-
- /* switch to palette mode */
-
- cc->mode = GDK_CC_MODE_PALETTE;
-
- /* sort palette */
-
- qsort (cc->palette, cc->num_palette, sizeof (GdkColor), pixel_sort);
-
- cc->fast_dither = NULL;
-
- return j;
-}
-
-void
-gdk_color_context_init_dither (GdkColorContext *cc)
-{
- gint rr, gg, bb, err, erg, erb;
- gint success = FALSE;
-
- g_assert (cc != NULL);
-
- /* now we can initialize the fast dither matrix */
-
- if (cc->fast_dither == NULL)
- cc->fast_dither = g_new (GdkColorContextDither, 1);
-
- /* Fill it. We ignore unsuccessful allocations, they are just mapped
- * to black instead */
-
- for (rr = 0; rr < 32; rr++)
- for (gg = 0; gg < 32; gg++)
- for (bb = 0; bb < 32; bb++)
- {
- err = (rr << 3) | (rr >> 2);
- erg = (gg << 3) | (gg >> 2);
- erb = (bb << 3) | (bb >> 2);
-
- cc->fast_dither->fast_rgb[rr][gg][bb] =
- gdk_color_context_get_index_from_palette (cc, &err, &erg, &erb, &success);
- cc->fast_dither->fast_err[rr][gg][bb] = err;
- cc->fast_dither->fast_erg[rr][gg][bb] = erg;
- cc->fast_dither->fast_erb[rr][gg][bb] = erb;
- }
-}
-
-void
-gdk_color_context_free_dither (GdkColorContext *cc)
-{
- g_assert (cc != NULL);
-
- if (cc->fast_dither)
- g_free (cc->fast_dither);
-
- cc->fast_dither = NULL;
-}
-
-gulong
-gdk_color_context_get_pixel_from_palette (GdkColorContext *cc,
- gushort *red,
- gushort *green,
- gushort *blue,
- gint *failed)
-{
- gulong pixel = 0;
- gint dif, dr, dg, db, j = -1;
- gint mindif = 0x7fffffff;
- gint err = 0, erg = 0, erb = 0;
- gint i;
-
- g_assert (cc != NULL);
- g_assert (red != NULL);
- g_assert (green != NULL);
- g_assert (blue != NULL);
- g_assert (failed != NULL);
-
- *failed = FALSE;
-
- for (i = 0; i < cc->num_palette; i++)
- {
- dr = *red - cc->palette[i].red;
- dg = *green - cc->palette[i].green;
- db = *blue - cc->palette[i].blue;
-
- dif = dr * dr + dg * dg + db * db;
-
- if (dif < mindif)
- {
- mindif = dif;
- j = i;
- pixel = cc->palette[i].pixel;
- err = dr;
- erg = dg;
- erb = db;
-
- if (mindif == 0)
- break;
- }
- }
-
- /* we failed to map onto a color */
-
- if (j == -1)
- *failed = TRUE;
- else
- {
- *red = ABS (err);
- *green = ABS (erg);
- *blue = ABS (erb);
- }
-
- return pixel;
-}
-
-guchar
-gdk_color_context_get_index_from_palette (GdkColorContext *cc,
- gint *red,
- gint *green,
- gint *blue,
- gint *failed)
-{
- gint dif, dr, dg, db, j = -1;
- gint mindif = 0x7fffffff;
- gint err = 0, erg = 0, erb = 0;
- gint i;
-
- g_assert (cc != NULL);
- g_assert (red != NULL);
- g_assert (green != NULL);
- g_assert (blue != NULL);
- g_assert (failed != NULL);
-
- *failed = FALSE;
-
- for (i = 0; i < cc->num_palette; i++)
- {
- dr = *red - cc->palette[i].red;
- dg = *green - cc->palette[i].green;
- db = *blue - cc->palette[i].blue;
-
- dif = dr * dr + dg * dg + db * db;
-
- if (dif < mindif)
- {
- mindif = dif;
- j = i;
- err = dr;
- erg = dg;
- erb = db;
-
- if (mindif == 0)
- break;
- }
- }
-
- /* we failed to map onto a color */
-
- if (j == -1)
- {
- *failed = TRUE;
- j = 0;
- }
- else
- {
- /* return error fractions */
-
- *red = err;
- *green = erg;
- *blue = erb;
- }
-
- return j;
-}
diff --git a/gdk/gdkcolor.c b/gdk/gdkcolor.c
deleted file mode 100644
index 7bc4369577..0000000000
--- a/gdk/gdkcolor.c
+++ /dev/null
@@ -1,718 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <X11/Xlib.h>
-#include "gdk.h"
-#include "gdkprivate.h"
-
-
-static gint gdk_colormap_match_color (GdkColormap *cmap,
- GdkColor *color,
- const gchar *available);
-static void gdk_colormap_add (GdkColormap *cmap);
-static void gdk_colormap_remove (GdkColormap *cmap);
-static guint gdk_colormap_hash (Colormap *cmap);
-static gint gdk_colormap_cmp (Colormap *a,
- Colormap *b);
-static void gdk_colormap_real_destroy (GdkColormap *colormap);
-
-static GHashTable *colormap_hash = NULL;
-
-
-GdkColormap*
-gdk_colormap_new (GdkVisual *visual,
- gint private_cmap)
-{
- GdkColormap *colormap;
- GdkColormapPrivate *private;
- Visual *xvisual;
- XColor default_colors[256];
- int size;
- int i;
-
- g_return_val_if_fail (visual != NULL, NULL);
-
- private = g_new (GdkColormapPrivate, 1);
- colormap = (GdkColormap*) private;
-
- private->xdisplay = gdk_display;
- private->visual = visual;
- private->next_color = 0;
- private->ref_count = 1;
- xvisual = ((GdkVisualPrivate*) visual)->xvisual;
-
- switch (visual->type)
- {
- case GDK_VISUAL_GRAYSCALE:
- case GDK_VISUAL_PSEUDO_COLOR:
- private->private_val = private_cmap;
- private->xcolormap = XCreateColormap (private->xdisplay, gdk_root_window,
- xvisual, (private_cmap) ? (AllocAll) : (AllocNone));
-
- if (private_cmap)
- {
- for (i = 0; i < 256; i++)
- default_colors[i].pixel = i;
-
- XQueryColors (private->xdisplay,
- DefaultColormap (private->xdisplay, gdk_screen),
- default_colors, visual->colormap_size);
-
- for (i = 0; i < visual->colormap_size; i++)
- {
- colormap->colors[i].pixel = default_colors[i].pixel;
- colormap->colors[i].red = default_colors[i].red;
- colormap->colors[i].green = default_colors[i].green;
- colormap->colors[i].blue = default_colors[i].blue;
- }
-
- gdk_colormap_change (colormap, visual->colormap_size);
- }
- break;
-
- case GDK_VISUAL_DIRECT_COLOR:
- private->private_val = TRUE;
- private->xcolormap = XCreateColormap (private->xdisplay, gdk_root_window,
- xvisual, AllocAll);
-
- size = 1 << visual->red_prec;
- for (i = 0; i < size; i++)
- colormap->colors[i].red = i * 65535 / (size - 1);
-
- size = 1 << visual->green_prec;
- for (i = 0; i < size; i++)
- colormap->colors[i].green = i * 65535 / (size - 1);
-
- size = 1 << visual->blue_prec;
- for (i = 0; i < size; i++)
- colormap->colors[i].blue = i * 65535 / (size - 1);
-
- gdk_colormap_change (colormap, visual->colormap_size);
- break;
-
- case GDK_VISUAL_STATIC_GRAY:
- case GDK_VISUAL_STATIC_COLOR:
- case GDK_VISUAL_TRUE_COLOR:
- private->private_val = FALSE;
- private->xcolormap = XCreateColormap (private->xdisplay, gdk_root_window,
- xvisual, AllocNone);
- break;
- }
-
- gdk_colormap_add (colormap);
-
- return colormap;
-}
-
-static void
-gdk_colormap_real_destroy (GdkColormap *colormap)
-{
- GdkColormapPrivate *private = (GdkColormapPrivate*) colormap;
-
- g_return_if_fail (colormap != NULL);
-
- if (private->ref_count > 0)
- return;
-
- gdk_colormap_remove (colormap);
- XFreeColormap (private->xdisplay, private->xcolormap);
- g_free (colormap);
-}
-
-GdkColormap*
-gdk_colormap_ref (GdkColormap *cmap)
-{
- GdkColormapPrivate *private = (GdkColormapPrivate *)cmap;
- g_return_val_if_fail (cmap != NULL, NULL);
-
- private->ref_count += 1;
- return cmap;
-}
-
-void
-gdk_colormap_unref (GdkColormap *cmap)
-{
- GdkColormapPrivate *private = (GdkColormapPrivate *)cmap;
- g_return_if_fail (cmap != NULL);
-
- private->ref_count -= 1;
- if (private->ref_count == 0)
- gdk_colormap_real_destroy (cmap);
-}
-
-GdkColormap*
-gdk_colormap_get_system (void)
-{
- static GdkColormap *colormap = NULL;
- GdkColormapPrivate *private;
- XColor xpalette[256];
- gint i;
-
- if (!colormap)
- {
- private = g_new (GdkColormapPrivate, 1);
- colormap = (GdkColormap*) private;
-
- private->xdisplay = gdk_display;
- private->xcolormap = DefaultColormap (gdk_display, gdk_screen);
- private->visual = gdk_visual_get_system ();
- private->private_val = FALSE;
- private->next_color = 0;
- private->ref_count = 1;
-
- if ((private->visual->type == GDK_VISUAL_GRAYSCALE) ||
- (private->visual->type == GDK_VISUAL_PSEUDO_COLOR))
- {
- for (i = 0; i < 256; i++)
- {
- xpalette[i].pixel = i;
- xpalette[i].red = 0;
- xpalette[i].green = 0;
- xpalette[i].blue = 0;
- }
-
- XQueryColors (gdk_display, private->xcolormap, xpalette,
- MIN (private->visual->colormap_size, 256));
-
- for (i = 0; i < 256; i++)
- {
- colormap->colors[i].pixel = xpalette[i].pixel;
- colormap->colors[i].red = xpalette[i].red;
- colormap->colors[i].green = xpalette[i].green;
- colormap->colors[i].blue = xpalette[i].blue;
- }
- }
-
- gdk_colormap_add (colormap);
- }
-
- return colormap;
-}
-
-gint
-gdk_colormap_get_system_size (void)
-{
- return DisplayCells (gdk_display, gdk_screen);
-}
-
-void
-gdk_colormap_change (GdkColormap *colormap,
- gint ncolors)
-{
- GdkColormapPrivate *private;
- GdkVisual *visual;
- XColor palette[256];
- gint shift;
- int max_colors;
- int size;
- int i;
-
- g_return_if_fail (colormap != NULL);
-
- private = (GdkColormapPrivate*) colormap;
- switch (private->visual->type)
- {
- case GDK_VISUAL_GRAYSCALE:
- case GDK_VISUAL_PSEUDO_COLOR:
- for (i = 0; i < ncolors; i++)
- {
- palette[i].pixel = colormap->colors[i].pixel;
- palette[i].red = colormap->colors[i].red;
- palette[i].green = colormap->colors[i].green;
- palette[i].blue = colormap->colors[i].blue;
- palette[i].flags = DoRed | DoGreen | DoBlue;
- }
-
- XStoreColors (private->xdisplay, private->xcolormap, palette, ncolors);
- private->next_color = MAX (private->next_color, ncolors);
- break;
-
- case GDK_VISUAL_DIRECT_COLOR:
- visual = private->visual;
-
- shift = visual->red_shift;
- max_colors = 1 << visual->red_prec;
- size = (ncolors < max_colors) ? (ncolors) : (max_colors);
-
- for (i = 0; i < size; i++)
- {
- palette[i].pixel = i << shift;
- palette[i].red = colormap->colors[i].red;
- palette[i].flags = DoRed;
- }
-
- XStoreColors (private->xdisplay, private->xcolormap, palette, size);
-
- shift = visual->green_shift;
- max_colors = 1 << visual->green_prec;
- size = (ncolors < max_colors) ? (ncolors) : (max_colors);
-
- for (i = 0; i < size; i++)
- {
- palette[i].pixel = i << shift;
- palette[i].green = colormap->colors[i].green;
- palette[i].flags = DoGreen;
- }
-
- XStoreColors (private->xdisplay, private->xcolormap, palette, size);
-
- shift = visual->blue_shift;
- max_colors = 1 << visual->blue_prec;
- size = (ncolors < max_colors) ? (ncolors) : (max_colors);
-
- for (i = 0; i < size; i++)
- {
- palette[i].pixel = i << shift;
- palette[i].blue = colormap->colors[i].blue;
- palette[i].flags = DoBlue;
- }
-
- XStoreColors (private->xdisplay, private->xcolormap, palette, size);
- break;
-
- default:
- break;
- }
-}
-
-void
-gdk_colors_store (GdkColormap *colormap,
- GdkColor *colors,
- gint ncolors)
-{
- gint i;
-
- for (i = 0; i < ncolors; i++)
- {
- colormap->colors[i].pixel = colors[i].pixel;
- colormap->colors[i].red = colors[i].red;
- colormap->colors[i].green = colors[i].green;
- colormap->colors[i].blue = colors[i].blue;
- }
-
- gdk_colormap_change (colormap, ncolors);
-}
-
-gint
-gdk_colors_alloc (GdkColormap *colormap,
- gint contiguous,
- gulong *planes,
- gint nplanes,
- gulong *pixels,
- gint npixels)
-{
- GdkColormapPrivate *private;
- gint return_val;
-
- g_return_val_if_fail (colormap != NULL, 0);
-
- private = (GdkColormapPrivate*) colormap;
-
- return_val = XAllocColorCells (private->xdisplay, private->xcolormap,
- contiguous, planes, nplanes, pixels, npixels);
-
- return return_val;
-}
-
-void
-gdk_colors_free (GdkColormap *colormap,
- gulong *pixels,
- gint npixels,
- gulong planes)
-{
- GdkColormapPrivate *private;
-
- g_return_if_fail (colormap != NULL);
-
- private = (GdkColormapPrivate*) colormap;
-
- XFreeColors (private->xdisplay, private->xcolormap,
- pixels, npixels, planes);
-}
-
-gint
-gdk_color_white (GdkColormap *colormap,
- GdkColor *color)
-{
- gint return_val;
-
- g_return_val_if_fail (colormap != NULL, FALSE);
-
- if (color)
- {
- color->pixel = WhitePixel (gdk_display, gdk_screen);
- color->red = 65535;
- color->green = 65535;
- color->blue = 65535;
-
- return_val = gdk_color_alloc (colormap, color);
- }
- else
- return_val = FALSE;
-
- return return_val;
-}
-
-gint
-gdk_color_black (GdkColormap *colormap,
- GdkColor *color)
-{
- gint return_val;
-
- g_return_val_if_fail (colormap != NULL, FALSE);
-
- if (color)
- {
- color->pixel = BlackPixel (gdk_display, gdk_screen);
- color->red = 0;
- color->green = 0;
- color->blue = 0;
-
- return_val = gdk_color_alloc (colormap, color);
- }
- else
- return_val = FALSE;
-
- return return_val;
-}
-
-gint
-gdk_color_parse (const gchar *spec,
- GdkColor *color)
-{
- Colormap xcolormap;
- XColor xcolor;
- gint return_val;
-
- g_return_val_if_fail (spec != NULL, FALSE);
- g_return_val_if_fail (color != NULL, FALSE);
-
- xcolormap = DefaultColormap (gdk_display, gdk_screen);
-
- if (XParseColor (gdk_display, xcolormap, spec, &xcolor))
- {
- return_val = TRUE;
- color->red = xcolor.red;
- color->green = xcolor.green;
- color->blue = xcolor.blue;
- }
- else
- return_val = FALSE;
-
- return return_val;
-}
-
-gint
-gdk_color_alloc (GdkColormap *colormap,
- GdkColor *color)
-{
- GdkColormapPrivate *private;
- GdkVisual *visual;
- XColor xcolor;
- gchar available[256];
- gint available_init;
- gint return_val;
- gint i, index;
-
- g_return_val_if_fail (colormap != NULL, FALSE);
- g_return_val_if_fail (color != NULL, FALSE);
-
- xcolor.red = color->red;
- xcolor.green = color->green;
- xcolor.blue = color->blue;
- xcolor.pixel = color->pixel;
- xcolor.flags = DoRed | DoGreen | DoBlue;
-
- return_val = FALSE;
- private = (GdkColormapPrivate*) colormap;
-
- switch (private->visual->type)
- {
- case GDK_VISUAL_GRAYSCALE:
- case GDK_VISUAL_PSEUDO_COLOR:
- if (private->private_val)
- {
- if (private->next_color > 255)
- {
- for (i = 0; i < 256; i++)
- available[i] = TRUE;
-
- index = gdk_colormap_match_color (colormap, color, available);
- if (index != -1)
- {
- available[index] = FALSE;
- *color = colormap->colors[index];
- return_val = TRUE;
- }
- else
- {
- return_val = FALSE;
- }
- }
- else
- {
- xcolor.pixel = 255 - private->next_color;
- color->pixel = xcolor.pixel;
- private->next_color += 1;
-
- XStoreColor (private->xdisplay, private->xcolormap, &xcolor);
- return_val = TRUE;
- }
- }
- else
- {
- available_init = 1;
-
- while (1)
- {
- if (XAllocColor (private->xdisplay, private->xcolormap, &xcolor))
- {
- color->pixel = xcolor.pixel;
- color->red = xcolor.red;
- color->green = xcolor.green;
- color->blue = xcolor.blue;
-
- colormap->colors[color->pixel] = *color;
-
- return_val = TRUE;
- break;
- }
- else
- {
- if (available_init)
- {
- available_init = 0;
- for (i = 0; i < 256; i++)
- available[i] = TRUE;
- }
-
- index = gdk_colormap_match_color (colormap, color, available);
- if (index != -1)
- {
- available[index] = FALSE;
- xcolor.red = colormap->colors[index].red;
- xcolor.green = colormap->colors[index].green;
- xcolor.blue = colormap->colors[index].blue;
- }
- else
- {
- return_val = FALSE;
- break;
- }
- }
- }
- }
- break;
-
- case GDK_VISUAL_DIRECT_COLOR:
- visual = private->visual;
- xcolor.pixel = (((xcolor.red >> (16 - visual->red_prec)) << visual->red_shift) +
- ((xcolor.green >> (16 - visual->green_prec)) << visual->green_shift) +
- ((xcolor.blue >> (16 - visual->blue_prec)) << visual->blue_shift));
- color->pixel = xcolor.pixel;
- return_val = TRUE;
- break;
-
- case GDK_VISUAL_STATIC_GRAY:
- case GDK_VISUAL_STATIC_COLOR:
- case GDK_VISUAL_TRUE_COLOR:
- if (XAllocColor (private->xdisplay, private->xcolormap, &xcolor))
- {
- color->pixel = xcolor.pixel;
- return_val = TRUE;
- }
- else
- return_val = FALSE;
- break;
- }
-
- return return_val;
-}
-
-gint
-gdk_color_change (GdkColormap *colormap,
- GdkColor *color)
-{
- GdkColormapPrivate *private;
- XColor xcolor;
-
- g_return_val_if_fail (colormap != NULL, FALSE);
- g_return_val_if_fail (color != NULL, FALSE);
-
- xcolor.pixel = color->pixel;
- xcolor.red = color->red;
- xcolor.green = color->green;
- xcolor.blue = color->blue;
- xcolor.flags = DoRed | DoGreen | DoBlue;
-
- private = (GdkColormapPrivate*) colormap;
- XStoreColor (private->xdisplay, private->xcolormap, &xcolor);
-
- return TRUE;
-}
-
-gint
-gdk_color_equal (GdkColor *colora,
- GdkColor *colorb)
-{
- g_return_val_if_fail (colora != NULL, FALSE);
- g_return_val_if_fail (colorb != NULL, FALSE);
-
- return ((colora->red == colorb->red) &&
- (colora->green == colorb->green) &&
- (colora->blue == colorb->blue));
-}
-
-GdkColormap*
-gdkx_colormap_get (Colormap xcolormap)
-{
- GdkColormap *colormap;
- GdkColormapPrivate *private;
- XColor xpalette[256];
- gint i;
-
- colormap = gdk_colormap_lookup (xcolormap);
- if (colormap)
- return colormap;
-
- if (xcolormap == DefaultColormap (gdk_display, gdk_screen))
- return gdk_colormap_get_system ();
-
- private = g_new (GdkColormapPrivate, 1);
- colormap = (GdkColormap*) private;
-
- private->xdisplay = gdk_display;
- private->xcolormap = xcolormap;
- private->visual = NULL;
- private->private_val = TRUE;
- private->next_color = 0;
-
- for (i = 0; i < 256; i++)
- {
- xpalette[i].pixel = i;
- xpalette[i].red = 0;
- xpalette[i].green = 0;
- xpalette[i].blue = 0;
- }
-
- XQueryColors (gdk_display, private->xcolormap, xpalette, 256);
-
- for (i = 0; i < 256; i++)
- {
- colormap->colors[i].pixel = xpalette[i].pixel;
- colormap->colors[i].red = xpalette[i].red;
- colormap->colors[i].green = xpalette[i].green;
- colormap->colors[i].blue = xpalette[i].blue;
- }
-
- gdk_colormap_add (colormap);
-
- return colormap;
-}
-
-
-static gint
-gdk_colormap_match_color (GdkColormap *cmap,
- GdkColor *color,
- const gchar *available)
-{
- GdkColor *colors;
- guint sum, max;
- gint rdiff, gdiff, bdiff;
- gint i, index;
-
- g_return_val_if_fail (cmap != NULL, 0);
- g_return_val_if_fail (color != NULL, 0);
-
- colors = cmap->colors;
- max = 3 * (65536);
- index = -1;
-
- for (i = 0; i < 256; i++)
- {
- if ((!available) || (available && available[i]))
- {
- rdiff = (color->red - colors[i].red);
- gdiff = (color->green - colors[i].green);
- bdiff = (color->blue - colors[i].blue);
-
- sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
-
- if (sum < max)
- {
- index = i;
- max = sum;
- }
- }
- }
-
- return index;
-}
-
-
-GdkColormap*
-gdk_colormap_lookup (Colormap xcolormap)
-{
- GdkColormap *cmap;
-
- if (!colormap_hash)
- return NULL;
-
- cmap = g_hash_table_lookup (colormap_hash, &xcolormap);
- return cmap;
-}
-
-static void
-gdk_colormap_add (GdkColormap *cmap)
-{
- GdkColormapPrivate *private;
-
- if (!colormap_hash)
- colormap_hash = g_hash_table_new ((GHashFunc) gdk_colormap_hash,
- (GCompareFunc) gdk_colormap_cmp);
-
- private = (GdkColormapPrivate*) cmap;
-
- g_hash_table_insert (colormap_hash, &private->xcolormap, cmap);
-}
-
-static void
-gdk_colormap_remove (GdkColormap *cmap)
-{
- GdkColormapPrivate *private;
-
- if (!colormap_hash)
- colormap_hash = g_hash_table_new ((GHashFunc) gdk_colormap_hash,
- (GCompareFunc) gdk_colormap_cmp);
-
- private = (GdkColormapPrivate*) cmap;
-
- g_hash_table_remove (colormap_hash, &private->xcolormap);
-}
-
-static guint
-gdk_colormap_hash (Colormap *cmap)
-{
- return *cmap;
-}
-
-static gint
-gdk_colormap_cmp (Colormap *a,
- Colormap *b)
-{
- return (*a == *b);
-}
diff --git a/gdk/gdkcursor.c b/gdk/gdkcursor.c
deleted file mode 100644
index 83b95aa6c7..0000000000
--- a/gdk/gdkcursor.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <X11/Xlib.h>
-#include <X11/cursorfont.h>
-#include "gdk.h"
-#include "gdkprivate.h"
-
-
-GdkCursor*
-gdk_cursor_new (GdkCursorType cursor_type)
-{
- GdkCursorPrivate *private;
- GdkCursor *cursor;
- Cursor xcursor;
-
- xcursor = XCreateFontCursor (gdk_display, cursor_type);
- private = g_new (GdkCursorPrivate, 1);
- private->xdisplay = gdk_display;
- private->xcursor = xcursor;
- cursor = (GdkCursor*) private;
- cursor->type = cursor_type;
-
- return cursor;
-}
-
-GdkCursor*
-gdk_cursor_new_from_pixmap (GdkPixmap *source, GdkPixmap *mask, GdkColor *fg, GdkColor *bg, gint x, gint y)
-{
- GdkCursorPrivate *private;
- GdkCursor *cursor;
- Pixmap source_pixmap, mask_pixmap;
- Cursor xcursor;
- XColor xfg, xbg;
-
- source_pixmap = ((GdkPixmapPrivate *) source)->xwindow;
- mask_pixmap = ((GdkPixmapPrivate *) mask)->xwindow;
-
- xfg.pixel = fg->pixel;
- xfg.red = fg->red;
- xfg.blue = fg->blue;
- xfg.green = fg->green;
- xbg.pixel = bg->pixel;
- xbg.red = bg->red;
- xbg.blue = bg->blue;
- xbg.green = bg->green;
-
- xcursor = XCreatePixmapCursor (gdk_display, source_pixmap, mask_pixmap, &xfg, &xbg, x, y);
- private = g_new (GdkCursorPrivate, 1);
- private->xdisplay = gdk_display;
- private->xcursor = xcursor;
- cursor = (GdkCursor *) private;
- cursor->type = GDK_CURSOR_IS_PIXMAP;
-
- return cursor;
-}
-
-void
-gdk_cursor_destroy (GdkCursor *cursor)
-{
- GdkCursorPrivate *private;
-
- g_return_if_fail (cursor != NULL);
-
- private = (GdkCursorPrivate *) cursor;
- XFreeCursor (private->xdisplay, private->xcursor);
-
- g_free (private);
-}
diff --git a/gdk/gdkcursors.h b/gdk/gdkcursors.h
deleted file mode 100644
index 5e0f1f9dfe..0000000000
--- a/gdk/gdkcursors.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-GDK_NUM_GLYPHS = 154,
-GDK_X_CURSOR = 0,
-GDK_ARROW = 2,
-GDK_BASED_ARROW_DOWN = 4,
-GDK_BASED_ARROW_UP = 6,
-GDK_BOAT = 8,
-GDK_BOGOSITY = 10,
-GDK_BOTTOM_LEFT_CORNER = 12,
-GDK_BOTTOM_RIGHT_CORNER = 14,
-GDK_BOTTOM_SIDE = 16,
-GDK_BOTTOM_TEE = 18,
-GDK_BOX_SPIRAL = 20,
-GDK_CENTER_PTR = 22,
-GDK_CIRCLE = 24,
-GDK_CLOCK = 26,
-GDK_COFFEE_MUG = 28,
-GDK_CROSS = 30,
-GDK_CROSS_REVERSE = 32,
-GDK_CROSSHAIR = 34,
-GDK_DIAMOND_CROSS = 36,
-GDK_DOT = 38,
-GDK_DOTBOX = 40,
-GDK_DOUBLE_ARROW = 42,
-GDK_DRAFT_LARGE = 44,
-GDK_DRAFT_SMALL = 46,
-GDK_DRAPED_BOX = 48,
-GDK_EXCHANGE = 50,
-GDK_FLEUR = 52,
-GDK_GOBBLER = 54,
-GDK_GUMBY = 56,
-GDK_HAND1 = 58,
-GDK_HAND2 = 60,
-GDK_HEART = 62,
-GDK_ICON = 64,
-GDK_IRON_CROSS = 66,
-GDK_LEFT_PTR = 68,
-GDK_LEFT_SIDE = 70,
-GDK_LEFT_TEE = 72,
-GDK_LEFTBUTTON = 74,
-GDK_LL_ANGLE = 76,
-GDK_LR_ANGLE = 78,
-GDK_MAN = 80,
-GDK_MIDDLEBUTTON = 82,
-GDK_MOUSE = 84,
-GDK_PENCIL = 86,
-GDK_PIRATE = 88,
-GDK_PLUS = 90,
-GDK_QUESTION_ARROW = 92,
-GDK_RIGHT_PTR = 94,
-GDK_RIGHT_SIDE = 96,
-GDK_RIGHT_TEE = 98,
-GDK_RIGHTBUTTON = 100,
-GDK_RTL_LOGO = 102,
-GDK_SAILBOAT = 104,
-GDK_SB_DOWN_ARROW = 106,
-GDK_SB_H_DOUBLE_ARROW = 108,
-GDK_SB_LEFT_ARROW = 110,
-GDK_SB_RIGHT_ARROW = 112,
-GDK_SB_UP_ARROW = 114,
-GDK_SB_V_DOUBLE_ARROW = 116,
-GDK_SHUTTLE = 118,
-GDK_SIZING = 120,
-GDK_SPIDER = 122,
-GDK_SPRAYCAN = 124,
-GDK_STAR = 126,
-GDK_TARGET = 128,
-GDK_TCROSS = 130,
-GDK_TOP_LEFT_ARROW = 132,
-GDK_TOP_LEFT_CORNER = 134,
-GDK_TOP_RIGHT_CORNER = 136,
-GDK_TOP_SIDE = 138,
-GDK_TOP_TEE = 140,
-GDK_TREK = 142,
-GDK_UL_ANGLE = 144,
-GDK_UMBRELLA = 146,
-GDK_UR_ANGLE = 148,
-GDK_WATCH = 150,
-GDK_XTERM = 152,
diff --git a/gdk/gdkdnd.c b/gdk/gdkdnd.c
deleted file mode 100644
index 28900bbf5d..0000000000
--- a/gdk/gdkdnd.c
+++ /dev/null
@@ -1,139 +0,0 @@
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <string.h>
-#include "gdkx.h"
-#include "gdk.h"
-
-/* Nothing much here now, but we have to make a start some time ;-) */
-
-void
-gdk_dnd_set_drag_cursors(GdkCursor *default_cursor, GdkCursor *goahead_cursor)
-{
- gdk_dnd.c->gdk_cursor_dragdefault =
- ((GdkCursorPrivate *)default_cursor)->xcursor;
- gdk_dnd.c->gdk_cursor_dragok = ((GdkCursorPrivate *)goahead_cursor)->xcursor;
-
- if(gdk_dnd.dnd_grabbed)
- {
- if(gdk_dnd.c->drag_pm_default)
- /* We were displaying pixmaps for the drag */
- {
- gdk_window_hide(gdk_dnd.c->drag_pm_default);
- gdk_window_unref(gdk_dnd.c->drag_pm_default);
- if(gdk_dnd.c->drag_pm_ok)
- {
- gdk_window_hide(gdk_dnd.c->drag_pm_ok);
- gdk_window_unref(gdk_dnd.c->drag_pm_ok);
- }
- gdk_dnd.c->drag_pm_default = gdk_dnd.c->drag_pm_ok = NULL;
- }
- gdk_dnd_display_drag_cursor(-1, -1,
- gdk_dnd.dnd_drag_target?TRUE:FALSE,
- TRUE);
- }
-}
-
-void
-gdk_dnd_set_drag_shape(GdkWindow *default_pixmapwin,
- GdkPoint *default_hotspot,
- GdkWindow *goahead_pixmapwin,
- GdkPoint *goahead_hotspot)
-{
- g_return_if_fail(default_pixmapwin != NULL);
-
- if(gdk_dnd.c->drag_pm_default)
- gdk_window_unref(gdk_dnd.c->drag_pm_default);
- if(gdk_dnd.c->drag_pm_ok)
- gdk_window_unref(gdk_dnd.c->drag_pm_ok);
-
- gdk_dnd.c->drag_pm_ok = NULL;
-
- gdk_window_ref(default_pixmapwin);
- gdk_dnd.c->drag_pm_default = default_pixmapwin;
- gdk_dnd.c->default_hotspot = *default_hotspot;
- if(goahead_pixmapwin)
- {
- gdk_window_ref(goahead_pixmapwin);
- gdk_dnd.c->drag_pm_ok = goahead_pixmapwin;
- gdk_dnd.c->ok_hotspot = *goahead_hotspot;
- }
-
- if(gdk_dnd.dnd_grabbed)
- {
- gdk_dnd_display_drag_cursor(-1, -1,
- gdk_dnd.dnd_drag_target?TRUE:FALSE,
- TRUE);
- XChangeActivePointerGrab (gdk_display,
- ButtonMotionMask |
- ButtonPressMask |
- ButtonReleaseMask |
- EnterWindowMask | LeaveWindowMask,
- None,
- CurrentTime);
- }
-}
-
-void
-gdk_dnd_display_drag_cursor(gint x, gint y, gboolean drag_ok,
- gboolean change_made)
-{
- if(!gdk_dnd.dnd_grabbed)
- return;
-
- if(gdk_dnd.c->drag_pm_default)
- {
- /* We're doing pixmaps here... */
- GdkWindow *mypix, *opix;
- GdkPoint *myhotspot;
- gint itmp;
- guint masktmp;
- Window wtmp;
-
- if(x == -2 && y == -2) /* Hide the cursors */
- {
- gdk_window_hide(gdk_dnd.c->drag_pm_ok);
- gdk_window_hide(gdk_dnd.c->drag_pm_default);
- return;
- }
-
- if(x == -1 && y == -1) /* We're supposed to find it out for ourselves */
- XQueryPointer(gdk_display, gdk_root_window,
- &wtmp, &wtmp, &x, &y, &itmp, &itmp, &masktmp);
-
- if(drag_ok)
- {
- mypix = gdk_dnd.c->drag_pm_ok;
- opix = gdk_dnd.c->drag_pm_default;
- myhotspot = &gdk_dnd.c->ok_hotspot;
- }
- else
- {
- mypix = gdk_dnd.c->drag_pm_default;
- opix = gdk_dnd.c->drag_pm_ok;
- myhotspot = &gdk_dnd.c->default_hotspot;
- }
- if(change_made)
- {
- gdk_window_hide(opix);
- gdk_window_show(mypix); /* There ought to be a way to know if
- a window is already mapped etc. */
- }
- gdk_window_move(mypix, x - myhotspot->x, y - myhotspot->y);
- }
- else if(change_made)
- {
- Cursor c;
- /* Move cursors around */
- if(drag_ok)
- c = gdk_dnd.c->gdk_cursor_dragok;
- else
- c = gdk_dnd.c->gdk_cursor_dragdefault;
- XChangeActivePointerGrab (gdk_display,
- ButtonMotionMask |
- ButtonPressMask |
- ButtonReleaseMask |
- EnterWindowMask | LeaveWindowMask,
- c,
- CurrentTime);
- }
-}
diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c
deleted file mode 100644
index 3d39d3faac..0000000000
--- a/gdk/gdkdraw.c
+++ /dev/null
@@ -1,443 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <X11/Xlib.h>
-#include <X11/Xos.h>
-#include "gdk.h"
-#include "gdkprivate.h"
-
-
-void
-gdk_draw_point (GdkDrawable *drawable,
- GdkGC *gc,
- gint x,
- gint y)
-{
- GdkWindowPrivate *drawable_private;
- GdkGCPrivate *gc_private;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (gc != NULL);
-
- drawable_private = (GdkWindowPrivate*) drawable;
- if (drawable_private->destroyed)
- return;
- gc_private = (GdkGCPrivate*) gc;
-
- XDrawPoint (drawable_private->xdisplay, drawable_private->xwindow,
- gc_private->xgc, x, y);
-}
-
-void
-gdk_draw_line (GdkDrawable *drawable,
- GdkGC *gc,
- gint x1,
- gint y1,
- gint x2,
- gint y2)
-{
- GdkWindowPrivate *drawable_private;
- GdkGCPrivate *gc_private;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (gc != NULL);
-
- drawable_private = (GdkWindowPrivate*) drawable;
- if (drawable_private->destroyed)
- return;
- gc_private = (GdkGCPrivate*) gc;
-
- XDrawLine (drawable_private->xdisplay, drawable_private->xwindow,
- gc_private->xgc, x1, y1, x2, y2);
-}
-
-void
-gdk_draw_rectangle (GdkDrawable *drawable,
- GdkGC *gc,
- gint filled,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- GdkWindowPrivate *drawable_private;
- GdkGCPrivate *gc_private;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (gc != NULL);
-
- drawable_private = (GdkWindowPrivate*) drawable;
- if (drawable_private->destroyed)
- return;
- gc_private = (GdkGCPrivate*) gc;
-
- if (width == -1)
- width = drawable_private->width;
- if (height == -1)
- height = drawable_private->height;
-
- if (filled)
- XFillRectangle (drawable_private->xdisplay, drawable_private->xwindow,
- gc_private->xgc, x, y, width, height);
- else
- XDrawRectangle (drawable_private->xdisplay, drawable_private->xwindow,
- gc_private->xgc, x, y, width, height);
-}
-
-void
-gdk_draw_arc (GdkDrawable *drawable,
- GdkGC *gc,
- gint filled,
- gint x,
- gint y,
- gint width,
- gint height,
- gint angle1,
- gint angle2)
-{
- GdkWindowPrivate *drawable_private;
- GdkGCPrivate *gc_private;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (gc != NULL);
-
- drawable_private = (GdkWindowPrivate*) drawable;
- if (drawable_private->destroyed)
- return;
- gc_private = (GdkGCPrivate*) gc;
-
- if (width == -1)
- width = drawable_private->width;
- if (height == -1)
- height = drawable_private->height;
-
- if (filled)
- XFillArc (drawable_private->xdisplay, drawable_private->xwindow,
- gc_private->xgc, x, y, width, height, angle1, angle2);
- else
- XDrawArc (drawable_private->xdisplay, drawable_private->xwindow,
- gc_private->xgc, x, y, width, height, angle1, angle2);
-}
-
-void
-gdk_draw_polygon (GdkDrawable *drawable,
- GdkGC *gc,
- gint filled,
- GdkPoint *points,
- gint npoints)
-{
- GdkWindowPrivate *drawable_private;
- GdkGCPrivate *gc_private;
- GdkPoint *local_points = points;
- gint local_npoints = npoints;
- gint local_alloc = 0;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (gc != NULL);
-
- drawable_private = (GdkWindowPrivate*) drawable;
- if (drawable_private->destroyed)
- return;
- gc_private = (GdkGCPrivate*) gc;
-
- if (filled)
- {
- XFillPolygon (drawable_private->xdisplay, drawable_private->xwindow,
- gc_private->xgc, (XPoint*) points, npoints, Complex, CoordModeOrigin);
- }
- else
- {
- if ((points[0].x != points[npoints-1].x) ||
- (points[0].y != points[npoints-1].y))
- {
- local_alloc = 1;
- ++local_npoints;
- local_points = (GdkPoint*) g_malloc (local_npoints * sizeof(GdkPoint));
- memcpy (local_points, points, npoints * sizeof(GdkPoint));
- local_points[npoints].x = points[0].x;
- local_points[npoints].y = points[0].y;
- }
-
- XDrawLines (drawable_private->xdisplay, drawable_private->xwindow,
- gc_private->xgc,
- (XPoint*) local_points, local_npoints,
- CoordModeOrigin);
-
- if (local_alloc)
- g_free (local_points);
- }
-}
-
-/* gdk_draw_string
- *
- * Modified by Li-Da Lho to draw 16 bits and Multibyte strings
- *
- * Interface changed: add "GdkFont *font" to specify font or fontset explicitely
- */
-void
-gdk_draw_string (GdkDrawable *drawable,
- GdkFont *font,
- GdkGC *gc,
- gint x,
- gint y,
- const gchar *string)
-{
- GdkWindowPrivate *drawable_private;
- GdkFontPrivate *font_private;
- GdkGCPrivate *gc_private;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (font != NULL);
- g_return_if_fail (gc != NULL);
- g_return_if_fail (string != NULL);
-
- drawable_private = (GdkWindowPrivate*) drawable;
- if (drawable_private->destroyed)
- return;
- gc_private = (GdkGCPrivate*) gc;
- font_private = (GdkFontPrivate*) font;
-
- if (font->type == GDK_FONT_FONT)
- {
- XFontStruct *xfont = (XFontStruct *) font_private->xfont;
- XSetFont(drawable_private->xdisplay, gc_private->xgc, xfont->fid);
- if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))
- {
- XDrawString (drawable_private->xdisplay, drawable_private->xwindow,
- gc_private->xgc, x, y, string, strlen (string));
- }
- else
- {
- XDrawString16 (drawable_private->xdisplay, drawable_private->xwindow,
- gc_private->xgc, x, y, (XChar2b *) string,
- strlen (string) / 2);
- }
- }
- else if (font->type == GDK_FONT_FONTSET)
- {
- XFontSet fontset = (XFontSet) font_private->xfont;
- XmbDrawString (drawable_private->xdisplay, drawable_private->xwindow,
- fontset, gc_private->xgc, x, y, string, strlen (string));
- }
- else
- g_error("undefined font type\n");
-}
-
-/* gdk_draw_text
- *
- * Modified by Li-Da Lho to draw 16 bits and Multibyte strings
- *
- * Interface changed: add "GdkFont *font" to specify font or fontset explicitely
- */
-void
-gdk_draw_text (GdkDrawable *drawable,
- GdkFont *font,
- GdkGC *gc,
- gint x,
- gint y,
- const gchar *text,
- gint text_length)
-{
- GdkWindowPrivate *drawable_private;
- GdkFontPrivate *font_private;
- GdkGCPrivate *gc_private;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (font != NULL);
- g_return_if_fail (gc != NULL);
- g_return_if_fail (text != NULL);
-
- drawable_private = (GdkWindowPrivate*) drawable;
- if (drawable_private->destroyed)
- return;
- gc_private = (GdkGCPrivate*) gc;
- font_private = (GdkFontPrivate*) font;
-
- if (font->type == GDK_FONT_FONT)
- {
- XFontStruct *xfont = (XFontStruct *) font_private->xfont;
- XSetFont(drawable_private->xdisplay, gc_private->xgc, xfont->fid);
- if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))
- {
- XDrawString (drawable_private->xdisplay, drawable_private->xwindow,
- gc_private->xgc, x, y, text, text_length);
- }
- else
- {
- XDrawString16 (drawable_private->xdisplay, drawable_private->xwindow,
- gc_private->xgc, x, y, (XChar2b *) text, text_length / 2);
- }
- }
- else if (font->type == GDK_FONT_FONTSET)
- {
- XFontSet fontset = (XFontSet) font_private->xfont;
- XmbDrawString (drawable_private->xdisplay, drawable_private->xwindow,
- fontset, gc_private->xgc, x, y, text, text_length);
- }
- else
- g_error("undefined font type\n");
-}
-
-void
-gdk_draw_pixmap (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPixmap *src,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
-{
- GdkWindowPrivate *drawable_private;
- GdkWindowPrivate *src_private;
- GdkGCPrivate *gc_private;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (src != NULL);
- g_return_if_fail (gc != NULL);
-
- drawable_private = (GdkWindowPrivate*) drawable;
- src_private = (GdkWindowPrivate*) src;
- if (drawable_private->destroyed || src_private->destroyed)
- return;
- gc_private = (GdkGCPrivate*) gc;
-
- if (width == -1)
- width = src_private->width;
- if (height == -1)
- height = src_private->height;
-
- XCopyArea (drawable_private->xdisplay,
- src_private->xwindow,
- drawable_private->xwindow,
- gc_private->xgc,
- xsrc, ysrc,
- width, height,
- xdest, ydest);
-}
-
-void
-gdk_draw_image (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
-{
- GdkImagePrivate *image_private;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (image != NULL);
- g_return_if_fail (gc != NULL);
-
- image_private = (GdkImagePrivate*) image;
-
- g_return_if_fail (image_private->image_put != NULL);
-
- if (width == -1)
- width = image->width;
- if (height == -1)
- height = image->height;
-
- (* image_private->image_put) (drawable, gc, image, xsrc, ysrc,
- xdest, ydest, width, height);
-}
-
-void
-gdk_draw_points (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPoint *points,
- gint npoints)
-{
- GdkWindowPrivate *drawable_private;
- GdkGCPrivate *gc_private;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail ((points != NULL) && (npoints > 0));
- g_return_if_fail (gc != NULL);
-
- drawable_private = (GdkWindowPrivate*) drawable;
- if (drawable_private->destroyed)
- return;
- gc_private = (GdkGCPrivate*) gc;
-
- XDrawPoints (drawable_private->xdisplay,
- drawable_private->xwindow,
- gc_private->xgc,
- (XPoint *) points,
- npoints,
- CoordModeOrigin);
-}
-
-void
-gdk_draw_segments (GdkDrawable *drawable,
- GdkGC *gc,
- GdkSegment *segs,
- gint nsegs)
-{
- GdkWindowPrivate *drawable_private;
- GdkGCPrivate *gc_private;
-
- if (nsegs <= 0)
- return;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (segs != NULL);
- g_return_if_fail (gc != NULL);
-
- drawable_private = (GdkWindowPrivate*) drawable;
- if (drawable_private->destroyed)
- return;
- gc_private = (GdkGCPrivate*) gc;
-
- XDrawSegments (drawable_private->xdisplay,
- drawable_private->xwindow,
- gc_private->xgc,
- (XSegment *) segs,
- nsegs);
-}
-
-void
-gdk_draw_lines (GdkDrawable *drawable,
- GdkGC *gc,
- GdkPoint *points,
- gint npoints)
-{
- GdkWindowPrivate *drawable_private;
- GdkGCPrivate *gc_private;
-
- if (npoints <= 0)
- return;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (points != NULL);
- g_return_if_fail (gc != NULL);
-
- drawable_private = (GdkWindowPrivate*) drawable;
- gc_private = (GdkGCPrivate*) gc;
-
- XDrawLines (drawable_private->xdisplay,
- drawable_private->xwindow,
- gc_private->xgc,
- (XPoint *) points,
- npoints,
- CoordModeOrigin);
-}
diff --git a/gdk/gdkfont.c b/gdk/gdkfont.c
deleted file mode 100644
index 41299dc5eb..0000000000
--- a/gdk/gdkfont.c
+++ /dev/null
@@ -1,374 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <X11/Xlib.h>
-#include <X11/Xos.h>
-#include "gdk.h"
-#include "gdkprivate.h"
-
-GdkFont*
-gdk_font_load (const gchar *font_name)
-{
- GdkFont *font;
- GdkFontPrivate *private;
-
- private = g_new (GdkFontPrivate, 1);
- font = (GdkFont*) private;
-
- private->xdisplay = gdk_display;
- private->xfont = XLoadQueryFont (private->xdisplay, font_name);
- private->ref_count = 1;
-
- if (!private->xfont)
- {
- g_free (font);
- return NULL;
- }
- else
- {
- font->type = GDK_FONT_FONT;
- font->ascent = ((XFontStruct *) private->xfont)->ascent;
- font->descent = ((XFontStruct *) private->xfont)->descent;
- }
-
- gdk_xid_table_insert (&((XFontStruct *) private->xfont)->fid, font);
-
- return font;
-}
-
-GdkFont*
-gdk_fontset_load (gchar *fontset_name)
-{
- GdkFont *font;
- GdkFontPrivate *private;
- XFontSet fontset;
- gint missing_charset_count;
- gchar **missing_charset_list;
- gchar *def_string;
-
- private = g_new (GdkFontPrivate, 1);
- font = (GdkFont*) private;
-
- private->xdisplay = gdk_display;
- fontset = XCreateFontSet (gdk_display, fontset_name,
- &missing_charset_list, &missing_charset_count,
- &def_string);
-
- if (missing_charset_count)
- {
- g_print ("Missing charsets in FontSet creation");
- XFreeStringList (missing_charset_list);
- }
-
- private->ref_count = 1;
-
- if (!fontset)
- {
- g_free (font);
- return NULL;
- }
- else
- {
- XFontSetExtents *extent = XExtentsOfFontSet(fontset);
-
- private->xfont = fontset;
- font->type = GDK_FONT_FONTSET;
- /* how to define ascent and descent for fontset ??? */
- font->ascent = extent->max_logical_extent.height;
- font->descent = font->ascent / 4 ;
- }
- return font;
-}
-
-GdkFont*
-gdk_font_ref (GdkFont *font)
-{
- GdkFontPrivate *private;
-
- g_return_val_if_fail (font != NULL, NULL);
-
- private = (GdkFontPrivate*) font;
- private->ref_count += 1;
- return font;
-}
-
-void
-gdk_font_unref (GdkFont *font)
-{
- GdkFontPrivate *private;
-
- g_return_if_fail (font != NULL);
-
- private = (GdkFontPrivate*) font;
-
- private->ref_count -= 1;
- if (private->ref_count == 0)
- {
- switch (font->type)
- {
- case GDK_FONT_FONT:
- gdk_xid_table_remove (((XFontStruct *) private->xfont)->fid);
- XFreeFont (private->xdisplay, (XFontStruct *) private->xfont);
- break;
- case GDK_FONT_FONTSET:
- XFreeFontSet (private->xdisplay, (XFontSet) private->xfont);
- break;
- default:
- g_error ("unknown font type.");
- break;
- }
- g_free (font);
- }
-}
-
-gint
-gdk_font_id (GdkFont *font)
-{
- GdkFontPrivate *font_private;
-
- g_return_val_if_fail (font != NULL, 0);
-
- font_private = (GdkFontPrivate*) font;
-
- if (font->type == GDK_FONT_FONT)
- {
- return ((XFontStruct *) font_private->xfont)->fid;
- }
- else
- {
- return 0;
- }
-}
-
-gint
-gdk_font_equal (GdkFont *fonta,
- GdkFont *fontb)
-{
- GdkFontPrivate *privatea;
- GdkFontPrivate *privateb;
-
- g_return_val_if_fail (fonta != NULL, FALSE);
- g_return_val_if_fail (fontb != NULL, FALSE);
-
- privatea = (GdkFontPrivate*) fonta;
- privateb = (GdkFontPrivate*) fontb;
-
- if (fonta->type == GDK_FONT_FONT && fontb->type == GDK_FONT_FONT)
- {
- return (((XFontStruct *) privatea->xfont)->fid ==
- ((XFontStruct *) privateb->xfont)->fid);
- }
- else if (fonta->type == GDK_FONT_FONTSET && fontb->type == GDK_FONT_FONTSET)
- {
- /* how to compare two fontsets ?? by basename or XFontSet ?? */
- return (((XFontSet) privatea->xfont) == ((XFontSet) privateb->xfont));
- }
- else
- /* fontset != font */
- return 0;
-}
-
-gint
-gdk_string_width (GdkFont *font,
- const gchar *string)
-{
- GdkFontPrivate *font_private;
- gint width;
- XFontStruct *xfont;
- XFontSet fontset;
-
- g_return_val_if_fail (font != NULL, -1);
- g_return_val_if_fail (string != NULL, -1);
-
- font_private = (GdkFontPrivate*) font;
-
- switch (font->type)
- {
- case GDK_FONT_FONT:
- xfont = (XFontStruct *) font_private->xfont;
- if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))
- {
- width = XTextWidth (xfont, string, strlen (string));
- }
- else
- {
- width = XTextWidth16 (xfont, (XChar2b *) string, strlen (string) / 2);
- }
- break;
- case GDK_FONT_FONTSET:
- fontset = (XFontSet) font_private->xfont;
- width = XmbTextEscapement (fontset, string, strlen(string));
- break;
- default:
- width = 0;
- }
-
- return width;
-}
-
-gint
-gdk_text_width (GdkFont *font,
- const gchar *text,
- gint text_length)
-{
- GdkFontPrivate *private;
- gint width;
- XFontStruct *xfont;
- XFontSet fontset;
-
- g_return_val_if_fail (font != NULL, -1);
- g_return_val_if_fail (text != NULL, -1);
-
- private = (GdkFontPrivate*) font;
-
- switch (font->type)
- {
- case GDK_FONT_FONT:
- xfont = (XFontStruct *) private->xfont;
- if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))
- {
- width = XTextWidth (xfont, text, text_length);
- }
- else
- {
- width = XTextWidth16 (xfont, (XChar2b *) text, text_length / 2);
- }
- break;
- case GDK_FONT_FONTSET:
- fontset = (XFontSet) private->xfont;
- width = XmbTextEscapement (fontset, text, text_length);
- break;
- default:
- width = 0;
- }
- return width;
-}
-
-/* Problem: What if a character is a 16 bits character ?? */
-gint
-gdk_char_width (GdkFont *font,
- gchar character)
-{
- GdkFontPrivate *private;
- XCharStruct *chars;
- gint width;
- guint ch = character & 0xff; /* get rid of sign-extension */
- XFontStruct *xfont;
- XFontSet fontset;
-
- g_return_val_if_fail (font != NULL, -1);
-
- private = (GdkFontPrivate*) font;
-
- switch (font->type)
- {
- case GDK_FONT_FONT:
- /* only 8 bits characters are considered here */
- xfont = (XFontStruct *) private->xfont;
- if ((xfont->min_byte1 == 0) &&
- (xfont->max_byte1 == 0) &&
- (ch >= xfont->min_char_or_byte2) &&
- (ch <= xfont->max_char_or_byte2))
- {
- chars = xfont->per_char;
- if (chars)
- width = chars[ch - xfont->min_char_or_byte2].width;
- else
- width = xfont->min_bounds.width;
- }
- else
- {
- width = XTextWidth (xfont, &character, 1);
- }
- break;
- case GDK_FONT_FONTSET:
- fontset = (XFontSet) private->xfont;
- width = XmbTextEscapement (fontset, &character, 1) ;
- break;
- default:
- width = 0;
- }
- return width;
-}
-
-gint
-gdk_string_measure (GdkFont *font,
- const gchar *string)
-{
- g_return_val_if_fail (font != NULL, -1);
- g_return_val_if_fail (string != NULL, -1);
-
- return gdk_text_measure (font, string, strlen (string));
-}
-
-gint
-gdk_text_measure (GdkFont *font,
- const gchar *text,
- gint text_length)
-{
- GdkFontPrivate *private;
- XCharStruct overall;
- XFontStruct *xfont;
- XFontSet fontset;
- XRectangle ink, log;
- int direction;
- int font_ascent;
- int font_descent;
- gint width;
-
- g_return_val_if_fail (font != NULL, -1);
- g_return_val_if_fail (text != NULL, -1);
-
- private = (GdkFontPrivate*) font;
-
- switch (font->type)
- {
- case GDK_FONT_FONT:
- xfont = (XFontStruct *) private->xfont;
- if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))
- {
- XTextExtents (xfont, text, text_length,
- &direction, &font_ascent, &font_descent,
- &overall);
- }
- else
- {
- XTextExtents16 (xfont, (XChar2b *) text, text_length / 2,
- &direction, &font_ascent, &font_descent,
- &overall);
- }
- width = overall.rbearing;
- break;
- case GDK_FONT_FONTSET:
- fontset = (XFontSet) private->xfont;
- XmbTextExtents (fontset, text, text_length, &ink, &log);
- width = log.width;
- break;
- default:
- width = 0;
- }
- return width;
-}
-
-gint
-gdk_char_measure (GdkFont *font,
- gchar character)
-{
- g_return_val_if_fail (font != NULL, -1);
-
- return gdk_text_measure (font, &character, 1);
-}
diff --git a/gdk/gdkglobals.c b/gdk/gdkglobals.c
deleted file mode 100644
index e6644bb600..0000000000
--- a/gdk/gdkglobals.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <stdio.h>
-#include <X11/Xlib.h>
-#include "gdktypes.h"
-#include "gdkprivate.h"
-
-guint gdk_debug_flags = 0;
-gint gdk_use_xshm = TRUE;
-gchar *gdk_display_name = NULL;
-Display *gdk_display = NULL;
-gint gdk_screen;
-Window gdk_root_window;
-Window gdk_leader_window;
-GdkWindowPrivate gdk_root_parent;
-Atom gdk_wm_delete_window;
-Atom gdk_wm_take_focus;
-Atom gdk_wm_protocols;
-Atom gdk_wm_window_protocols[2];
-Atom gdk_selection_property;
-GdkDndCursorInfo gdk_dnd_cursorinfo = {None, None, NULL, NULL,
- {0,0}, {0,0}};
-GdkDndGlobals gdk_dnd = {None,None,None,
- None,None,None,
- None,
- &gdk_dnd_cursorinfo,
- NULL,
- 0,
- FALSE, FALSE, FALSE,
- None,
- {0,0},
- {0,0}, {0,0},
- {0,0,0,0}, NULL, None, 0};
-gchar *gdk_progname = NULL;
-gchar *gdk_progclass = NULL;
-gint gdk_error_code;
-gint gdk_error_warnings = TRUE;
-gint gdk_null_window_warnings = TRUE;
-GList *gdk_default_filters = NULL;
diff --git a/gdk/gdki18n.h b/gdk/gdki18n.h
deleted file mode 100644
index 11e4fc92d9..0000000000
--- a/gdk/gdki18n.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef __GDK_I18N_H__
-#define __GDK_I18N_H__
-
-/* GDK uses "glib". (And so does GTK).
- */
-#include <glib.h>
-
-/* international string support */
-
-#include <stdlib.h>
-
-#ifdef X_LOCALE
-
-#include <X11/Xfuncproto.h>
-#include <X11/Xosdefs.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-_XFUNCPROTOBEGIN
-extern int _Xmblen (
-#if NeedFunctionPrototypes
- const char *s, size_t n
-#endif
-
-);
-_XFUNCPROTOEND
-
-_XFUNCPROTOBEGIN
-extern int _Xmbtowc (
-#if NeedFunctionPrototypes
- wchar_t *wstr, const char *str, size_t len
-#endif
-);
-_XFUNCPROTOEND
-
-_XFUNCPROTOBEGIN
-extern int _Xwctomb (
-#if NeedFunctionPrototypes
- char *str, wchar_t wc
-#endif
-);
-_XFUNCPROTOEND
-
-_XFUNCPROTOBEGIN
-extern size_t _Xmbstowcs (
-#if NeedFunctionPrototypes
- wchar_t *wstr, const char *str, size_t len
-#endif
-);
-_XFUNCPROTOEND
-
-_XFUNCPROTOBEGIN
-extern size_t _Xwcstombs (
-#if NeedFunctionPrototypes
- char *str, const wchar_t *wstr, size_t len
-#endif
-);
-_XFUNCPROTOEND
-
-_XFUNCPROTOBEGIN
-extern size_t _Xwcslen (
-#if NeedFunctionPrototypes
- const wchar_t *wstr
-#endif
-);
-_XFUNCPROTOEND
-
-_XFUNCPROTOBEGIN
-extern wchar_t* _Xwcscpy (
-#if NeedFunctionPrototypes
- wchar_t *wstr1, const wchar_t *wstr2
-#endif
-);
-_XFUNCPROTOEND
-
-_XFUNCPROTOBEGIN
-extern wchar_t* _Xwcsncpy (
-#if NeedFunctionPrototypes
- wchar_t *wstr1, const wchar_t *wstr2, size_t len
-#endif
-);
-_XFUNCPROTOEND
-
-_XFUNCPROTOBEGIN
-extern int _Xwcscmp (
-#if NeedFunctionPrototypes
- const wchar_t *wstr1, const wchar_t *wstr2
-#endif
-);
-_XFUNCPROTOEND
-
-_XFUNCPROTOBEGIN
-extern int _Xwcsncmp (
-#if NeedFunctionPrototypes
- const wchar_t *wstr1, const wchar_t *wstr2, size_t len
-#endif
-);
-_XFUNCPROTOEND
-
-/*
- * mblen, mbtowc, and mbstowcs of the locale "ja_JP.eucJP" are buggy.
- */
-
-#ifdef MB_CUR_MAX
-# undef MB_CUR_MAX
-#endif
-#define MB_CUR_MAX 4
-extern int _g_mbtowc (wchar_t *wstr, const char *str, size_t len);
-
-/* #define mblen _Xmblen */
-/* #define mbtowc _Xmbtowc */
-#define mblen(a,b) _g_mbtowc ((wchar_t *)(NULL), (a), (b))
-#define mbtowc(a,b,c) _g_mbtowc ((a),(b),(c))
-
-#define wctomb(a,b) _Xwctomb ((a),(b))
-#define mbstowcs(a,b,c) _Xmbstowcs ((a),(b),(c))
-#define wcstombs(a,b,c) _Xwcstombs ((a),(b),(c))
-#define wcslen(a) _Xwcslen ((a))
-#define wcscpy(a,b) _Xwcscpy ((a),(b))
-#define wcsncpy(a,b,c) _Xwcsncpy ((a),(b),(c))
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* X_LOCALE */
-
-#if !defined(HAVE_BROKEN_WCTYPE) && (defined(HAVE_WCTYPE_H) || defined(HAVE_WCHAR_H)) && !defined(X_LOCALE)
-# ifdef HAVE_WCTYPE_H
-# include <wctype.h>
-# else
-# ifdef HAVE_WCHAR_H
-# include <wchar.h>
-# endif
-# endif
-#else
-# define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
-#endif
-
-#endif /* __GDK_I18N_H__ */
diff --git a/gdk/gdkimage.c b/gdk/gdkimage.c
deleted file mode 100644
index 1a7273bc5a..0000000000
--- a/gdk/gdkimage.c
+++ /dev/null
@@ -1,495 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "../config.h"
-
-#include <sys/types.h>
-
-#if defined (HAVE_IPC_H) && defined (HAVE_SHM_H) && defined (HAVE_XSHM_H)
-#define USE_SHM
-#endif
-
-#ifdef USE_SHM
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#endif /* USE_SHM */
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-#ifdef USE_SHM
-#include <X11/extensions/XShm.h>
-#endif /* USE_SHM */
-
-#include "gdk.h"
-#include "gdkprivate.h"
-
-
-static void gdk_image_put_normal (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
-static void gdk_image_put_shared (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
-
-
-static GList *image_list = NULL;
-
-
-void
-gdk_image_exit ()
-{
- GdkImage *image;
-
- while (image_list)
- {
- image = image_list->data;
- gdk_image_destroy (image);
- }
-}
-
-GdkImage *
-gdk_image_new_bitmap(GdkVisual *visual, gpointer data, gint w, gint h)
-/*
- * Desc: create a new bitmap image
- */
-{
- Visual *xvisual;
- GdkImage *image;
- GdkImagePrivate *private;
- private = g_new(GdkImagePrivate, 1);
- image = (GdkImage *) private;
- private->xdisplay = gdk_display;
- private->image_put = gdk_image_put_normal;
- image->type = GDK_IMAGE_NORMAL;
- image->visual = visual;
- image->width = w;
- image->height = h;
- image->depth = 1;
- xvisual = ((GdkVisualPrivate*) visual)->xvisual;
- private->ximage = XCreateImage(private->xdisplay, xvisual, 1, XYBitmap,
- 0, 0, w ,h, 8, 0);
- private->ximage->data = data;
- private->ximage->bitmap_bit_order = MSBFirst;
- private->ximage->byte_order = MSBFirst;
- image->byte_order = MSBFirst;
- image->mem = private->ximage->data;
- image->bpl = private->ximage->bytes_per_line;
- image->bpp = 1;
- return(image);
-} /* gdk_image_new_bitmap() */
-
-static int
-gdk_image_check_xshm(Display *display)
-/*
- * Desc: query the server for support for the MIT_SHM extension
- * Return: 0 = not available
- * 1 = shared XImage support available
- * 2 = shared Pixmap support available also
- */
-{
-#ifdef USE_SHM
- int major, minor, ignore;
- Bool pixmaps;
-
- if (XQueryExtension(display, "MIT-SHM", &ignore, &ignore, &ignore))
- {
- if (XShmQueryVersion(display, &major, &minor, &pixmaps )==True)
- {
- return (pixmaps==True) ? 2 : 1;
- }
- }
-#endif /* USE_SHM */
- return 0;
-}
-
-void
-gdk_image_init ()
-{
- if (gdk_use_xshm)
- {
- if (!gdk_image_check_xshm (gdk_display))
- {
- gdk_use_xshm = False;
- }
- }
-}
-
-GdkImage*
-gdk_image_new (GdkImageType type,
- GdkVisual *visual,
- gint width,
- gint height)
-{
- GdkImage *image;
- GdkImagePrivate *private;
-#ifdef USE_SHM
- XShmSegmentInfo *x_shm_info;
-#endif /* USE_SHM */
- Visual *xvisual;
-
- switch (type)
- {
- case GDK_IMAGE_FASTEST:
- image = gdk_image_new (GDK_IMAGE_SHARED, visual, width, height);
-
- if (!image)
- image = gdk_image_new (GDK_IMAGE_NORMAL, visual, width, height);
- break;
-
- default:
- private = g_new (GdkImagePrivate, 1);
- image = (GdkImage*) private;
-
- private->xdisplay = gdk_display;
- private->image_put = NULL;
-
- image->type = type;
- image->visual = visual;
- image->width = width;
- image->height = height;
- image->depth = visual->depth;
-
- xvisual = ((GdkVisualPrivate*) visual)->xvisual;
-
- switch (type)
- {
- case GDK_IMAGE_SHARED:
-#ifdef USE_SHM
- if (gdk_use_xshm)
- {
- private->image_put = gdk_image_put_shared;
-
- private->x_shm_info = g_new (XShmSegmentInfo, 1);
- x_shm_info = private->x_shm_info;
-
- private->ximage = XShmCreateImage (private->xdisplay, xvisual, visual->depth,
- ZPixmap, NULL, x_shm_info, width, height);
- if (private->ximage == NULL)
- {
- g_warning ("XShmCreateImage failed");
-
- g_free (image);
- gdk_use_xshm = False;
- return NULL;
- }
-
- x_shm_info->shmid = shmget (IPC_PRIVATE,
- private->ximage->bytes_per_line * private->ximage->height,
- IPC_CREAT | 0777);
-
- if (x_shm_info->shmid == -1)
- {
- g_warning ("shmget failed!");
-
- XDestroyImage (private->ximage);
- g_free (private->x_shm_info);
- g_free (image);
-
- gdk_use_xshm = False;
- return NULL;
- }
-
- x_shm_info->readOnly = False;
- x_shm_info->shmaddr = shmat (x_shm_info->shmid, 0, 0);
- private->ximage->data = x_shm_info->shmaddr;
-
- if (x_shm_info->shmaddr == (char*) -1)
- {
- g_warning ("shmat failed!");
-
- XDestroyImage (private->ximage);
- shmctl (x_shm_info->shmid, IPC_RMID, 0);
-
- g_free (private->x_shm_info);
- g_free (image);
-
- return NULL;
- }
-
-#ifdef IPC_RMID_DEFERRED_RELEASE
- if (x_shm_info->shmaddr != (char*) -1)
- shmctl (x_shm_info->shmid, IPC_RMID, 0);
-#endif
-
- gdk_error_code = 0;
- gdk_error_warnings = 0;
-
- XShmAttach (private->xdisplay, x_shm_info);
- XSync (private->xdisplay, False);
-
- gdk_error_warnings = 1;
- if (gdk_error_code == -1)
- {
- /* this is the common failure case so omit warning */
- XDestroyImage (private->ximage);
- shmdt (x_shm_info->shmaddr);
- shmctl (x_shm_info->shmid, IPC_RMID, 0);
-
- g_free (private->x_shm_info);
- g_free (image);
-
- gdk_use_xshm = False;
- return NULL;
- }
-
- if (image)
- image_list = g_list_prepend (image_list, image);
- }
- else
- {
- g_free (image);
- return NULL;
- }
- break;
-#else /* USE_SHM */
- g_free (image);
- return NULL;
-#endif /* USE_SHM */
- case GDK_IMAGE_NORMAL:
- private->image_put = gdk_image_put_normal;
-
- private->ximage = XCreateImage (private->xdisplay, xvisual, visual->depth,
- ZPixmap, 0, 0, width, height, 32, 0);
-
- private->ximage->data = g_new (char, private->ximage->bytes_per_line *
- private->ximage->height);
- break;
-
- case GDK_IMAGE_FASTEST:
- g_assert_not_reached ();
- }
-
- if (image)
- {
- image->byte_order = private->ximage->byte_order;
- image->mem = private->ximage->data;
- image->bpl = private->ximage->bytes_per_line;
-
- switch (private->ximage->bits_per_pixel)
- {
- case 8:
- image->bpp = 1;
- break;
- case 16:
- image->bpp = 2;
- break;
- case 24:
- image->bpp = 3;
- break;
- case 32:
- image->bpp = 4;
- break;
- }
- }
- }
-
- return image;
-}
-
-GdkImage*
-gdk_image_get (GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- GdkImage *image;
- GdkImagePrivate *private;
- GdkWindowPrivate *win_private;
-
- g_return_val_if_fail (window != NULL, NULL);
-
- win_private = (GdkWindowPrivate *) window;
- if (win_private->destroyed)
- return NULL;
-
- private = g_new (GdkImagePrivate, 1);
- image = (GdkImage*) private;
-
- private->xdisplay = gdk_display;
- private->image_put = gdk_image_put_normal;
- private->ximage = XGetImage (private->xdisplay,
- win_private->xwindow,
- x, y, width, height,
- AllPlanes, ZPixmap);
-
- image->type = GDK_IMAGE_NORMAL;
- image->visual = gdk_window_get_visual (window);
- image->width = width;
- image->height = height;
- image->depth = private->ximage->depth;
-
- image->mem = private->ximage->data;
- image->bpl = private->ximage->bytes_per_line;
- image->bpp = 1;
-
- return image;
-}
-
-guint32
-gdk_image_get_pixel (GdkImage *image,
- gint x,
- gint y)
-{
- guint32 pixel;
- GdkImagePrivate *private;
-
- g_return_val_if_fail (image != NULL, 0);
-
- private = (GdkImagePrivate *) image;
-
- pixel = XGetPixel (private->ximage, x, y);
-
- return pixel;
-}
-
-void
-gdk_image_put_pixel (GdkImage *image,
- gint x,
- gint y,
- guint32 pixel)
-{
- GdkImagePrivate *private;
-
- g_return_if_fail (image != NULL);
-
- private = (GdkImagePrivate *) image;
-
- pixel = XPutPixel (private->ximage, x, y, pixel);
-}
-
-void
-gdk_image_destroy (GdkImage *image)
-{
- GdkImagePrivate *private;
-#ifdef USE_SHM
- XShmSegmentInfo *x_shm_info;
-#endif /* USE_SHM */
-
- g_return_if_fail (image != NULL);
-
- private = (GdkImagePrivate*) image;
- switch (image->type)
- {
- case GDK_IMAGE_NORMAL:
- XDestroyImage (private->ximage);
- break;
-
- case GDK_IMAGE_SHARED:
-#ifdef USE_SHM
- XShmDetach (private->xdisplay, private->x_shm_info);
- XDestroyImage (private->ximage);
-
- x_shm_info = private->x_shm_info;
- shmdt (x_shm_info->shmaddr);
- shmctl (x_shm_info->shmid, IPC_RMID, 0);
-
- g_free (private->x_shm_info);
-
- image_list = g_list_remove (image_list, image);
-#else /* USE_SHM */
- g_error ("trying to destroy shared memory image when gdk was compiled without shared memory support");
-#endif /* USE_SHM */
- break;
-
- case GDK_IMAGE_FASTEST:
- g_assert_not_reached ();
- }
-
- g_free (image);
-}
-
-static void
-gdk_image_put_normal (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
-{
- GdkWindowPrivate *drawable_private;
- GdkImagePrivate *image_private;
- GdkGCPrivate *gc_private;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (image != NULL);
- g_return_if_fail (gc != NULL);
-
- drawable_private = (GdkWindowPrivate*) drawable;
- if (drawable_private->destroyed)
- return;
- image_private = (GdkImagePrivate*) image;
- gc_private = (GdkGCPrivate*) gc;
-
- g_return_if_fail (image->type == GDK_IMAGE_NORMAL);
-
- XPutImage (drawable_private->xdisplay, drawable_private->xwindow,
- gc_private->xgc, image_private->ximage,
- xsrc, ysrc, xdest, ydest, width, height);
-}
-
-static void
-gdk_image_put_shared (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
-{
-#ifdef USE_SHM
- GdkWindowPrivate *drawable_private;
- GdkImagePrivate *image_private;
- GdkGCPrivate *gc_private;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (image != NULL);
- g_return_if_fail (gc != NULL);
-
- drawable_private = (GdkWindowPrivate*) drawable;
- if (drawable_private->destroyed)
- return;
- image_private = (GdkImagePrivate*) image;
- gc_private = (GdkGCPrivate*) gc;
-
- g_return_if_fail (image->type == GDK_IMAGE_SHARED);
-
- XShmPutImage (drawable_private->xdisplay, drawable_private->xwindow,
- gc_private->xgc, image_private->ximage,
- xsrc, ysrc, xdest, ydest, width, height, False);
-#else /* USE_SHM */
- g_error ("trying to draw shared memory image when gdk was compiled without shared memory support");
-#endif /* USE_SHM */
-}
diff --git a/gdk/gdkinput.c b/gdk/gdkinput.c
deleted file mode 100644
index 8a66b8365f..0000000000
--- a/gdk/gdkinput.c
+++ /dev/null
@@ -1,344 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <stdlib.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include "../config.h"
-#include "gdk.h"
-#include "gdkx.h"
-#include "gdkprivate.h"
-#include "gdkinput.h"
-
-
-/* Forward declarations */
-
-static gint gdk_input_enable_window (GdkWindow *window,
- GdkDevicePrivate *gdkdev);
-static gint gdk_input_disable_window (GdkWindow *window,
- GdkDevicePrivate *gdkdev);
-static GdkInputWindow *gdk_input_window_find (GdkWindow *window);
-static GdkDevicePrivate *gdk_input_find_device (guint32 id);
-
-
-/* Incorporate the specific routines depending on compilation options */
-
-static GdkAxisUse gdk_input_core_axes[] = { GDK_AXIS_X, GDK_AXIS_Y };
-
-static GdkDeviceInfo gdk_input_core_info =
-{
- GDK_CORE_POINTER,
- "Core Pointer",
- GDK_SOURCE_MOUSE,
- GDK_MODE_SCREEN,
- TRUE,
- 2,
- gdk_input_core_axes
-};
-
-/* Global variables */
-
-GdkInputVTable gdk_input_vtable;
-/* information about network port and host for gxid daemon */
-gchar *gdk_input_gxid_host;
-gint gdk_input_gxid_port;
-gint gdk_input_ignore_core;
-
-/* Local variables */
-
-static GList *gdk_input_devices;
-static GList *gdk_input_windows;
-
-#include "gdkinputnone.h"
-#include "gdkinputcommon.h"
-#include "gdkinputxfree.h"
-#include "gdkinputgxi.h"
-
-GList *
-gdk_input_list_devices ()
-{
- return gdk_input_devices;
-}
-
-void
-gdk_input_set_source (guint32 deviceid, GdkInputSource source)
-{
- GdkDevicePrivate *gdkdev = gdk_input_find_device(deviceid);
- g_return_if_fail (gdkdev != NULL);
-
- gdkdev->info.source = source;
-}
-
-gint
-gdk_input_set_mode (guint32 deviceid, GdkInputMode mode)
-{
- if (deviceid == GDK_CORE_POINTER)
- return FALSE;
-
- if (gdk_input_vtable.set_mode)
- return gdk_input_vtable.set_mode(deviceid,mode);
- else
- return FALSE;
-}
-
-void
-gdk_input_set_axes (guint32 deviceid, GdkAxisUse *axes)
-{
- if (deviceid != GDK_CORE_POINTER && gdk_input_vtable.set_axes)
- gdk_input_vtable.set_axes (deviceid, axes);
-}
-
-void gdk_input_set_key (guint32 deviceid,
- guint index,
- guint keyval,
- GdkModifierType modifiers)
-{
- if (deviceid != GDK_CORE_POINTER && gdk_input_vtable.set_key)
- gdk_input_vtable.set_key (deviceid, index, keyval, modifiers);
-}
-
-GdkTimeCoord *
-gdk_input_motion_events (GdkWindow *window,
- guint32 deviceid,
- guint32 start,
- guint32 stop,
- gint *nevents_return)
-{
- GdkWindowPrivate *window_private;
- XTimeCoord *xcoords;
- GdkTimeCoord *coords;
- int i;
-
- g_return_val_if_fail (window != NULL, NULL);
- window_private = (GdkWindowPrivate *) window;
- if (window_private->destroyed)
- return NULL;
-
- if (deviceid == GDK_CORE_POINTER)
- {
- xcoords = XGetMotionEvents (gdk_display,
- window_private->xwindow,
- start, stop, nevents_return);
- if (xcoords)
- {
- coords = g_new (GdkTimeCoord, *nevents_return);
- for (i=0; i<*nevents_return; i++)
- {
- coords[i].time = xcoords[i].time;
- coords[i].x = xcoords[i].x;
- coords[i].y = xcoords[i].y;
- coords[i].pressure = 0.5;
- coords[i].xtilt = 0.0;
- coords[i].ytilt = 0.0;
- }
-
- XFree(xcoords);
-
- return coords;
- }
- else
- return NULL;
- }
- else
- {
- if (gdk_input_vtable.motion_events)
- {
- return gdk_input_vtable.motion_events(window,
- deviceid, start, stop,
- nevents_return);
- }
- else
- {
- *nevents_return = 0;
- return NULL;
- }
- }
-}
-
-static gint
-gdk_input_enable_window (GdkWindow *window, GdkDevicePrivate *gdkdev)
-{
- if (gdk_input_vtable.enable_window)
- return gdk_input_vtable.enable_window (window, gdkdev);
- else
- return TRUE;
-}
-
-static gint
-gdk_input_disable_window (GdkWindow *window, GdkDevicePrivate *gdkdev)
-{
- if (gdk_input_vtable.disable_window)
- return gdk_input_vtable.disable_window(window,gdkdev);
- else
- return TRUE;
-}
-
-
-static GdkInputWindow *
-gdk_input_window_find(GdkWindow *window)
-{
- GList *tmp_list;
-
- for (tmp_list=gdk_input_windows; tmp_list; tmp_list=tmp_list->next)
- if (((GdkInputWindow *)(tmp_list->data))->window == window)
- return (GdkInputWindow *)(tmp_list->data);
-
- return NULL; /* Not found */
-}
-
-/* FIXME: this routine currently needs to be called between creation
- and the corresponding configure event (because it doesn't get the
- root_relative_geometry). This should work with
- gtk_window_set_extension_events, but will likely fail in other
- cases */
-
-void
-gdk_input_set_extension_events (GdkWindow *window, gint mask,
- GdkExtensionMode mode)
-{
- GdkWindowPrivate *window_private;
- GList *tmp_list;
- GdkInputWindow *iw;
-
- g_return_if_fail (window != NULL);
- window_private = (GdkWindowPrivate*) window;
- if (window_private->destroyed)
- return;
-
- if (mode == GDK_EXTENSION_EVENTS_NONE)
- mask = 0;
-
- if (mask != 0)
- {
- iw = g_new(GdkInputWindow,1);
-
- iw->window = window;
- iw->mode = mode;
-
- iw->obscuring = NULL;
- iw->num_obscuring = 0;
- iw->grabbed = FALSE;
-
- gdk_input_windows = g_list_append(gdk_input_windows,iw);
- window_private->extension_events = mask;
-
- /* Add enter window events to the event mask */
- /* FIXME, this is not needed for XINPUT_NONE */
- gdk_window_set_events (window,
- gdk_window_get_events (window) |
- GDK_ENTER_NOTIFY_MASK);
- }
- else
- {
- iw = gdk_input_window_find (window);
- if (iw)
- {
- gdk_input_windows = g_list_remove(gdk_input_windows,iw);
- g_free(iw);
- }
-
- window_private->extension_events = 0;
- }
-
- for (tmp_list = gdk_input_devices; tmp_list; tmp_list = tmp_list->next)
- {
- GdkDevicePrivate *gdkdev = (GdkDevicePrivate *)(tmp_list->data);
-
- if (gdkdev->info.deviceid != GDK_CORE_POINTER)
- {
- if (mask != 0 && gdkdev->info.mode != GDK_MODE_DISABLED
- && (gdkdev->info.has_cursor || mode == GDK_EXTENSION_EVENTS_ALL))
- gdk_input_enable_window(window,gdkdev);
- else
- gdk_input_disable_window(window,gdkdev);
- }
- }
-}
-
-void
-gdk_input_window_destroy (GdkWindow *window)
-{
- GdkInputWindow *input_window;
-
- input_window = gdk_input_window_find (window);
- g_return_if_fail (input_window != NULL);
-
- gdk_input_windows = g_list_remove (gdk_input_windows,input_window);
- g_free(input_window);
-}
-
-void
-gdk_input_exit (void)
-{
- GList *tmp_list;
- GdkDevicePrivate *gdkdev;
-
- for (tmp_list = gdk_input_devices; tmp_list; tmp_list = tmp_list->next)
- {
- gdkdev = (GdkDevicePrivate *)(tmp_list->data);
- if (gdkdev->info.deviceid != GDK_CORE_POINTER)
- {
- gdk_input_set_mode(gdkdev->info.deviceid,GDK_MODE_DISABLED);
-
- g_free(gdkdev->info.name);
-#ifndef XINPUT_NONE
- g_free(gdkdev->axes);
-#endif
- g_free(gdkdev->info.axes);
- g_free(gdkdev->info.keys);
- g_free(gdkdev);
- }
- }
-
- g_list_free(gdk_input_devices);
-
- for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
- {
- g_free(tmp_list->data);
- }
- g_list_free(gdk_input_windows);
-}
-
-static GdkDevicePrivate *
-gdk_input_find_device(guint32 id)
-{
- GList *tmp_list = gdk_input_devices;
- GdkDevicePrivate *gdkdev;
- while (tmp_list)
- {
- gdkdev = (GdkDevicePrivate *)(tmp_list->data);
- if (gdkdev->info.deviceid == id)
- return gdkdev;
- tmp_list = tmp_list->next;
- }
- return NULL;
-}
-
-void
-gdk_input_window_get_pointer (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask)
-{
- if (gdk_input_vtable.get_pointer)
- gdk_input_vtable.get_pointer (window, deviceid, x, y, pressure,
- xtilt, ytilt, mask);
-}
diff --git a/gdk/gdkinput.h b/gdk/gdkinput.h
deleted file mode 100644
index a039679b33..0000000000
--- a/gdk/gdkinput.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef __GDK_INPUT_H__
-#define __GDK_INPUT_H__
-
-#ifndef XINPUT_NONE
-#include <X11/extensions/XInput.h>
-#endif
-
-typedef struct _GdkAxisInfo GdkAxisInfo;
-typedef struct _GdkInputVTable GdkInputVTable;
-typedef struct _GdkDevicePrivate GdkDevicePrivate;
-typedef struct _GdkInputWindow GdkInputWindow;
-
-struct _GdkInputVTable {
- gint (*set_mode) (guint32 deviceid, GdkInputMode mode);
- void (*set_axes) (guint32 deviceid, GdkAxisUse *axes);
- void (*set_key) (guint32 deviceid,
- guint index,
- guint keyval,
- GdkModifierType modifiers);
-
- GdkTimeCoord* (*motion_events) (GdkWindow *window,
- guint32 deviceid,
- guint32 start,
- guint32 stop,
- gint *nevents_return);
- void (*get_pointer) (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask);
- gint (*grab_pointer) (GdkWindow * window,
- gint owner_events,
- GdkEventMask event_mask,
- GdkWindow * confine_to,
- guint32 time);
- void (*ungrab_pointer) (guint32 time);
-
- void (*configure_event) (XConfigureEvent *xevent, GdkWindow *window);
- void (*enter_event) (XCrossingEvent *xevent, GdkWindow *window);
- gint (*other_event) (GdkEvent *event, XEvent *xevent, GdkWindow *window);
- /* Handle an unidentified event. Returns TRUE if handled, FALSE
- otherwise */
- gint (*window_none_event) (GdkEvent *event, XEvent *xevent);
- gint (*enable_window) (GdkWindow *window, GdkDevicePrivate *gdkdev);
- gint (*disable_window) (GdkWindow *window, GdkDevicePrivate *gdkdev);
-};
-
-/* information about a device axis */
-struct _GdkAxisInfo
-{
- /* reported x resolution */
- gint xresolution;
-
- /* reported x minimum/maximum values */
- gint xmin_value, xmax_value;
-
- /* calibrated resolution (for aspect ration) - only relative values
- between axes used */
- gint resolution;
-
- /* calibrated minimum/maximum values */
- gint min_value, max_value;
-};
-
-#define GDK_INPUT_NUM_EVENTC 6
-
-struct _GdkDevicePrivate {
- GdkDeviceInfo info;
-
-#ifndef XINPUT_NONE
- /* information about the axes */
- GdkAxisInfo *axes;
-
- /* reverse lookup on axis use type */
- gint axis_for_use[GDK_AXIS_LAST];
-
- /* Information about XInput device */
- XDevice *xdevice;
-
- /* minimum key code for device */
- gint min_keycode;
-
- int buttonpress_type, buttonrelease_type, keypress_type,
- keyrelease_type, motionnotify_type, proximityin_type,
- proximityout_type, changenotify_type;
-
- /* true if we need to select a different set of events, but
- can't because this is the core pointer */
- gint needs_update;
-
- /* Mask of buttons (used for button grabs) */
- gint button_state;
-
- /* true if we've claimed the device as active. (used only for XINPUT_GXI) */
- gint claimed;
-#endif /* !XINPUT_NONE */
-};
-
-struct _GdkInputWindow
-{
- /* gdk window */
- GdkWindow *window;
-
- /* Extension mode (GDK_EXTENSION_EVENTS_ALL/CURSOR) */
- GdkExtensionMode mode;
-
- /* position relative to root window */
- gint16 root_x;
- gint16 root_y;
-
- /* rectangles relative to window of windows obscuring this one */
- GdkRectangle *obscuring;
- gint num_obscuring;
-
- /* Is there a pointer grab for this window ? */
- gint grabbed;
-};
-
-/* Global data */
-
-extern GdkInputVTable gdk_input_vtable;
-/* information about network port and host for gxid daemon */
-extern gchar *gdk_input_gxid_host;
-extern gint gdk_input_gxid_port;
-extern gint gdk_input_ignore_core;
-
-/* Function declarations */
-
-void gdk_input_window_destroy (GdkWindow *window);
-
-#endif /* __GDK_INPUT_H__ */
diff --git a/gdk/gdkinputcommon.h b/gdk/gdkinputcommon.h
deleted file mode 100644
index 2dc5a6d859..0000000000
--- a/gdk/gdkinputcommon.h
+++ /dev/null
@@ -1,882 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#if defined(XINPUT_GXI) || defined(XINPUT_XFREE)
-
-/* Forward declarations */
-static void gdk_input_get_root_relative_geometry (Display *dpy, Window w,
- int *x_ret, int *y_ret,
- int *width_ret,
- int *height_ret);
-static GdkDevicePrivate *gdk_input_device_new(XDeviceInfo *device,
- gint include_core);
-static void gdk_input_common_find_events(GdkWindow *window,
- GdkDevicePrivate *gdkdev,
- gint mask,
- XEventClass *classes,
- int *num_classes);
-static void gdk_input_common_select_events(GdkWindow *window,
- GdkDevicePrivate *gdkdev);
-static void gdk_input_translate_coordinates(GdkDevicePrivate *gdkdev,
- GdkInputWindow *input_window,
- gint *axis_data,
- gdouble *x, gdouble *y,
- gdouble *pressure,
- gdouble *xtilt, gdouble *ytilt);
-static guint gdk_input_translate_state(guint state, guint device_state);
-static gint gdk_input_common_init(gint include_core);
-static gint gdk_input_common_other_event (GdkEvent *event,
- XEvent *xevent,
- GdkInputWindow *input_window,
- GdkDevicePrivate *gdkdev);
-static void gdk_input_common_set_axes (guint32 deviceid, GdkAxisUse *axes);
-static GdkTimeCoord * gdk_input_common_motion_events (GdkWindow *window,
- guint32 deviceid,
- guint32 start,
- guint32 stop,
- gint *nevents_return);
-static void gdk_input_common_get_pointer (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask);
-
-#define GDK_MAX_DEVICE_CLASSES 13
-
-/* Global variables */
-
-static gint gdk_input_root_width;
-static gint gdk_input_root_height;
-
-static void
-gdk_input_get_root_relative_geometry(Display *dpy, Window w, int *x_ret, int *y_ret,
- int *width_ret, int *height_ret)
-{
- Window root,parent;
- Window *children;
- guint nchildren;
- gint x,y;
- guint width, height;
- gint xc,yc;
- guint widthc,heightc,border_widthc,depthc;
-
- XQueryTree(dpy,w,&root,&parent,&children,&nchildren);
- if (children) XFree(children);
- XGetGeometry(dpy,w,&root,&x,&y,&width,&height,&border_widthc,
- &depthc);
- x += border_widthc;
- y += border_widthc;
-
- while (root != parent)
- {
- w = parent;
- XQueryTree(dpy,w,&root,&parent,&children,&nchildren);
- if (children) XFree(children);
- XGetGeometry(dpy,w,&root,&xc,&yc,&widthc,&heightc,
- &border_widthc,&depthc);
- x += xc + border_widthc;
- y += yc + border_widthc;
- }
-
- if (x_ret)
- *x_ret = x;
- if (y_ret)
- *y_ret = y;
- if (width_ret)
- *width_ret = width;
- if (height_ret)
- *height_ret = height;
-}
-
-static GdkDevicePrivate *
-gdk_input_device_new(XDeviceInfo *device, gint include_core)
-{
- GdkDevicePrivate *gdkdev;
- gchar *tmp_name, *p;
- XAnyClassPtr class;
- gint i,j;
-
- gdkdev = g_new(GdkDevicePrivate,1);
-
- gdkdev->info.deviceid = device->id;
- if (device->name[0]) {
- gdkdev->info.name = g_new(char, strlen(device->name)+1);
- strcpy(gdkdev->info.name,device->name);
- } else {
- /* XFree86 3.2 gives an empty name to the default core devices,
- (fixed in 3.2A) */
- gdkdev->info.name = g_strdup("pointer");
- strcpy(gdkdev->info.name,"pointer");
- gdkdev->info.source = GDK_SOURCE_MOUSE;
- }
-
- gdkdev->info.mode = GDK_MODE_DISABLED;
-
- /* Try to figure out what kind of device this is by its name -
- could invite a very, very, long list... Lowercase name
- for comparison purposes */
-
- tmp_name = g_strdup(gdkdev->info.name);
- for (p = tmp_name; *p; p++)
- {
- if (*p >= 'A' && *p <= 'Z')
- *p += 'a' - 'A';
- }
-
- if (!strcmp (tmp_name, "pointer"))
- gdkdev->info.source = GDK_SOURCE_MOUSE;
- else if (!strcmp (tmp_name, "wacom") ||
- !strcmp (tmp_name, "pen"))
- gdkdev->info.source = GDK_SOURCE_PEN;
- else if (!strcmp (tmp_name, "eraser"))
- gdkdev->info.source = GDK_SOURCE_ERASER;
- else if (!strcmp (tmp_name, "cursor"))
- gdkdev->info.source = GDK_SOURCE_CURSOR;
- else
- gdkdev->info.source = GDK_SOURCE_PEN;
-
- g_free(tmp_name);
-
- gdkdev->xdevice = NULL;
-
- /* step through the classes */
-
- gdkdev->info.num_axes = 0;
- gdkdev->info.num_keys = 0;
- gdkdev->info.keys = NULL;
- gdkdev->axes = 0;
- gdkdev->info.has_cursor = 0;
- gdkdev->needs_update = FALSE;
- gdkdev->claimed = FALSE;
- gdkdev->button_state = 0;
-
- class = device->inputclassinfo;
- for (i=0;i<device->num_classes;i++)
- {
- switch (class->class) {
- case ButtonClass:
- {
- break;
- }
- case KeyClass:
- {
- XKeyInfo *xki = (XKeyInfo *)class;
- /* Hack to catch XFree86 3.3.1 bug. Other devices better
- * not have exactly 25 keys...
- */
- if ((xki->min_keycode == 8) && (xki->max_keycode == 32))
- {
- gdkdev->info.num_keys = 32;
- gdkdev->min_keycode = 0;
- }
- else
- {
- gdkdev->info.num_keys = xki->max_keycode - xki->min_keycode + 1;
- gdkdev->min_keycode = xki->min_keycode;
- }
- gdkdev->info.keys = g_new (GdkDeviceKey, gdkdev->info.num_keys);
-
- for (j=0; j<gdkdev->info.num_keys; j++)
- {
- gdkdev->info.keys[j].keyval = 0;
- gdkdev->info.keys[j].modifiers = 0;
- }
-
- break;
- }
- case ValuatorClass:
- {
- XValuatorInfo *xvi = (XValuatorInfo *)class;
- gdkdev->info.num_axes = xvi->num_axes;
- gdkdev->axes = g_new(GdkAxisInfo, xvi->num_axes);
- gdkdev->info.axes = g_new(GdkAxisUse, xvi->num_axes);
- for (j=0;j<xvi->num_axes;j++)
- {
- gdkdev->axes[j].resolution =
- gdkdev->axes[j].xresolution = xvi->axes[j].resolution;
- gdkdev->axes[j].min_value =
- gdkdev->axes[j].xmin_value = xvi->axes[j].min_value;
- gdkdev->axes[j].max_value =
- gdkdev->axes[j].xmax_value = xvi->axes[j].max_value;
- gdkdev->info.axes[j] = GDK_AXIS_IGNORE;
- }
- j=0;
- if (j<xvi->num_axes)
- gdkdev->info.axes[j++] = GDK_AXIS_X;
- if (j<xvi->num_axes)
- gdkdev->info.axes[j++] = GDK_AXIS_Y;
- if (j<xvi->num_axes)
- gdkdev->info.axes[j++] = GDK_AXIS_PRESSURE;
- if (j<xvi->num_axes)
- gdkdev->info.axes[j++] = GDK_AXIS_XTILT;
- if (j<xvi->num_axes)
- gdkdev->info.axes[j++] = GDK_AXIS_YTILT;
-
- /* set up reverse lookup on axis use */
- for (j=GDK_AXIS_IGNORE;j<GDK_AXIS_LAST;j++)
- gdkdev->axis_for_use[j] = -1;
-
- for (j=0;j<xvi->num_axes;j++)
- if (gdkdev->info.axes[j] != GDK_AXIS_IGNORE)
- gdkdev->axis_for_use[gdkdev->info.axes[j]] = j;
-
- break;
- }
- }
- class = (XAnyClassPtr)(((char *)class) + class->length);
- }
- /* return NULL if no axes */
- if (!gdkdev->info.num_axes || !gdkdev->axes ||
- (!include_core && device->use == IsXPointer))
- {
- g_free(gdkdev->info.name);
- if (gdkdev->axes)
- g_free(gdkdev->axes);
- if (gdkdev->info.keys)
- g_free(gdkdev->info.keys);
- g_free(gdkdev);
- return NULL;
- }
-
- if (device->use != IsXPointer)
- {
- int error_warn = gdk_error_warnings;
-
- gdk_error_warnings = 0;
- gdk_error_code = 0;
- gdkdev->xdevice = XOpenDevice(gdk_display, gdkdev->info.deviceid);
- gdk_error_warnings = error_warn;
-
- /* return NULL if device is not ready */
- if (gdk_error_code)
- {
- g_free (gdkdev->info.name);
- if (gdkdev->axes)
- g_free (gdkdev->axes);
- if (gdkdev->info.keys)
- g_free (gdkdev->info.keys);
- if (gdkdev->info.axes)
- g_free (gdkdev->info.axes);
- g_free (gdkdev);
-
- return NULL;
- }
- }
-
- gdkdev->buttonpress_type = 0;
- gdkdev->buttonrelease_type = 0;
- gdkdev->keypress_type = 0;
- gdkdev->keyrelease_type = 0;
- gdkdev->motionnotify_type = 0;
- gdkdev->proximityin_type = 0;
- gdkdev->proximityout_type = 0;
- gdkdev->changenotify_type = 0;
-
- return gdkdev;
-}
-
-static void
-gdk_input_common_find_events(GdkWindow *window,
- GdkDevicePrivate *gdkdev,
- gint mask,
- XEventClass *classes,
- int *num_classes)
-{
- gint i;
- XEventClass class;
-
- i = 0;
- /* We have to track press and release events in pairs to keep
- track of button state correctly and implement grabbing for
- the gxi support */
- if (mask & GDK_BUTTON_PRESS_MASK || mask & GDK_BUTTON_RELEASE_MASK)
- {
- DeviceButtonPress (gdkdev->xdevice, gdkdev->buttonpress_type,
- class);
- if (class != 0)
- classes[i++] = class;
- DeviceButtonPressGrab (gdkdev->xdevice, 0, class);
- if (class != 0)
- classes[i++] = class;
- DeviceButtonRelease (gdkdev->xdevice, gdkdev->buttonrelease_type,
- class);
- if (class != 0)
- classes[i++] = class;
- }
- if (mask & GDK_POINTER_MOTION_MASK)
- {
- DeviceMotionNotify (gdkdev->xdevice, gdkdev->motionnotify_type, class);
- if (class != 0)
- classes[i++] = class;
- }
- else
- if (mask & (GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK |
- GDK_BUTTON3_MOTION_MASK | GDK_BUTTON_MOTION_MASK |
- GDK_POINTER_MOTION_HINT_MASK))
- {
- /* Make sure gdkdev->motionnotify_type is set */
- DeviceMotionNotify (gdkdev->xdevice, gdkdev->motionnotify_type, class);
- }
- if (mask & GDK_BUTTON1_MOTION_MASK)
- {
- DeviceButton1Motion (gdkdev->xdevice, 0, class);
- if (class != 0)
- classes[i++] = class;
- }
- if (mask & GDK_BUTTON2_MOTION_MASK)
- {
- DeviceButton2Motion (gdkdev->xdevice, 0, class);
- if (class != 0)
- classes[i++] = class;
- }
- if (mask & GDK_BUTTON3_MOTION_MASK)
- {
- DeviceButton3Motion (gdkdev->xdevice, 0, class);
- if (class != 0)
- classes[i++] = class;
- }
- if (mask & GDK_BUTTON_MOTION_MASK)
- {
- DeviceButtonMotion (gdkdev->xdevice, 0, class);
- if (class != 0)
- classes[i++] = class;
- }
- if (mask & GDK_POINTER_MOTION_HINT_MASK)
- {
- /* We'll get into trouble if the macros change, but at least we'll
- know about it, and we avoid warnings now */
- DevicePointerMotionHint (gdkdev->xdevice, 0, class);
- if (class != 0)
- classes[i++] = class;
- }
- if (mask & GDK_KEY_PRESS_MASK)
- {
- DeviceKeyPress (gdkdev->xdevice, gdkdev->keypress_type, class);
- if (class != 0)
- classes[i++] = class;
- }
- if (mask & GDK_KEY_RELEASE_MASK)
- {
- DeviceKeyRelease (gdkdev->xdevice, gdkdev->keyrelease_type, class);
- if (class != 0)
- classes[i++] = class;
- }
- if (mask & GDK_PROXIMITY_IN_MASK)
- {
- ProximityIn (gdkdev->xdevice, gdkdev->proximityin_type, class);
- if (class != 0)
- classes[i++] = class;
- }
- if (mask & GDK_PROXIMITY_OUT_MASK)
- {
- ProximityOut (gdkdev->xdevice, gdkdev->proximityout_type, class);
- if (class != 0)
- classes[i++] = class;
- }
-
- *num_classes = i;
-}
-
-static void
-gdk_input_common_select_events(GdkWindow *window,
- GdkDevicePrivate *gdkdev)
-{
- XEventClass classes[GDK_MAX_DEVICE_CLASSES];
- gint num_classes;
-
- if (gdkdev->info.mode == GDK_MODE_DISABLED)
- gdk_input_common_find_events(window, gdkdev, 0, classes, &num_classes);
- else
- gdk_input_common_find_events(window, gdkdev,
- ((GdkWindowPrivate *)window)->extension_events,
- classes, &num_classes);
-
- XSelectExtensionEvent (gdk_display,
- GDK_WINDOW_XWINDOW(window),
- classes, num_classes);
-}
-
-gint
-gdk_input_common_init(gint include_core)
-{
- char **extensions;
- XDeviceInfo *devices;
- int num_devices;
- int num_extensions, loop;
- Display *display = gdk_display;
-
- /* Init global vars */
- gdk_window_get_geometry(NULL, /* use root window */
- NULL,NULL,
- &gdk_input_root_width,&gdk_input_root_height,
- NULL);
-
- /* Init XInput extension */
-
- extensions = XListExtensions(display, &num_extensions);
- for (loop = 0; loop < num_extensions &&
- (strcmp(extensions[loop], "XInputExtension") != 0); loop++);
- XFreeExtensionList(extensions);
- if (loop == num_extensions) /* XInput extension not found */
- return FALSE;
-
- gdk_input_devices = 0;
- devices = XListInputDevices(display, &num_devices);
-
- for(loop=0; loop<num_devices; loop++)
- {
- GdkDevicePrivate *gdkdev = gdk_input_device_new(&devices[loop],
- include_core);
- if (gdkdev)
- gdk_input_devices = g_list_append(gdk_input_devices, gdkdev);
- }
- XFreeDeviceList(devices);
-
- gdk_input_devices = g_list_append (gdk_input_devices, &gdk_input_core_info);
-
- return TRUE;
-}
-
-static void
-gdk_input_translate_coordinates (GdkDevicePrivate *gdkdev,
- GdkInputWindow *input_window,
- gint *axis_data,
- gdouble *x, gdouble *y, gdouble *pressure,
- gdouble *xtilt, gdouble *ytilt)
-{
- GdkWindowPrivate *win_priv;
-
- int x_axis, y_axis, pressure_axis, xtilt_axis, ytilt_axis;
-
- double device_width, device_height;
- double x_offset, y_offset, x_scale, y_scale;
-
- win_priv = (GdkWindowPrivate *) input_window->window;
-
- x_axis = gdkdev->axis_for_use[GDK_AXIS_X];
- y_axis = gdkdev->axis_for_use[GDK_AXIS_Y];
- pressure_axis = gdkdev->axis_for_use[GDK_AXIS_PRESSURE];
- xtilt_axis = gdkdev->axis_for_use[GDK_AXIS_XTILT];
- ytilt_axis = gdkdev->axis_for_use[GDK_AXIS_YTILT];
-
- device_width = gdkdev->axes[x_axis].max_value -
- gdkdev->axes[x_axis].min_value;
- device_height = gdkdev->axes[y_axis].max_value -
- gdkdev->axes[y_axis].min_value;
-
- if (gdkdev->info.mode == GDK_MODE_SCREEN)
- {
- x_scale = gdk_input_root_width / device_width;
- y_scale = gdk_input_root_height / device_height;
-
- x_offset = - input_window->root_x;
- y_offset = - input_window->root_y;
- }
- else /* GDK_MODE_WINDOW */
- {
- double device_aspect = (device_height*gdkdev->axes[y_axis].resolution) /
- (device_width*gdkdev->axes[x_axis].resolution);
-
- if (device_aspect * win_priv->width >= win_priv->height)
- {
- /* device taller than window */
- x_scale = win_priv->width / device_width;
- y_scale = (x_scale * gdkdev->axes[x_axis].resolution)
- / gdkdev->axes[y_axis].resolution;
-
- x_offset = 0;
- y_offset = -(device_height * y_scale -
- win_priv->height)/2;
- }
- else
- {
- /* window taller than device */
- y_scale = win_priv->height / device_height;
- x_scale = (y_scale * gdkdev->axes[y_axis].resolution)
- / gdkdev->axes[x_axis].resolution;
-
- y_offset = 0;
- x_offset = - (device_width * x_scale - win_priv->width)/2;
- }
- }
-
- if (x) *x = x_offset + x_scale*axis_data[x_axis];
- if (y) *y = y_offset + y_scale*axis_data[y_axis];
-
- if (pressure)
- {
- if (pressure_axis != -1)
- *pressure = ((double)axis_data[pressure_axis]
- - gdkdev->axes[pressure_axis].min_value)
- / (gdkdev->axes[pressure_axis].max_value
- - gdkdev->axes[pressure_axis].min_value);
- else
- *pressure = 0.5;
- }
-
- if (xtilt)
- {
- if (xtilt_axis != -1)
- {
- *xtilt = 2. * (double)(axis_data[xtilt_axis] -
- (gdkdev->axes[xtilt_axis].min_value +
- gdkdev->axes[xtilt_axis].max_value)/2) /
- (gdkdev->axes[xtilt_axis].max_value -
- gdkdev->axes[xtilt_axis].min_value);
- }
- else *xtilt = 0;
- }
-
- if (ytilt)
- {
- if (ytilt_axis != -1)
- {
- *ytilt = 2. * (double)(axis_data[ytilt_axis] -
- (gdkdev->axes[ytilt_axis].min_value +
- gdkdev->axes[ytilt_axis].max_value)/2) /
- (gdkdev->axes[ytilt_axis].max_value -
- gdkdev->axes[ytilt_axis].min_value);
- }
- else
- *ytilt = 0;
- }
-}
-
-/* combine the state of the core device and the device state
- into one - for now we do this in a simple-minded manner -
- we just take the keyboard portion of the core device and
- the button portion (all of?) the device state.
- Any button remapping should go on here. */
-static guint
-gdk_input_translate_state(guint state, guint device_state)
-{
- return device_state | (state & 0xFF);
-}
-
-static gint
-gdk_input_common_other_event (GdkEvent *event,
- XEvent *xevent,
- GdkInputWindow *input_window,
- GdkDevicePrivate *gdkdev)
-{
- if ((xevent->type == gdkdev->buttonpress_type) ||
- (xevent->type == gdkdev->buttonrelease_type))
- {
- XDeviceButtonEvent *xdbe = (XDeviceButtonEvent *)(xevent);
-
- if (xdbe->type == gdkdev->buttonpress_type)
- {
- event->button.type = GDK_BUTTON_PRESS;
- gdkdev->button_state |= 1 << xdbe->button;
- }
- else
- {
- event->button.type = GDK_BUTTON_RELEASE;
- gdkdev->button_state &= ~(1 << xdbe->button);
- }
- event->button.window = input_window->window;
- event->button.time = xdbe->time;
- event->button.source = gdkdev->info.source;
- event->button.deviceid = xdbe->deviceid;
-
- gdk_input_translate_coordinates (gdkdev,input_window, xdbe->axis_data,
- &event->button.x,&event->button.y,
- &event->button.pressure,
- &event->button.xtilt,
- &event->button.ytilt);
- event->button.state = gdk_input_translate_state(xdbe->state,xdbe->device_state);
- event->button.button = xdbe->button;
-
- GDK_NOTE (EVENTS,
- g_print ("button %s:\t\twindow: %ld device: %ld x,y: %f %f button: %d\n",
- (event->button.type == GDK_BUTTON_PRESS) ? "press" : "release",
- xdbe->window,
- xdbe->deviceid,
- event->button.x, event->button.y,
- xdbe->button));
-
- return TRUE;
- }
-
- if ((xevent->type == gdkdev->keypress_type) ||
- (xevent->type == gdkdev->keyrelease_type))
- {
- XDeviceKeyEvent *xdke = (XDeviceKeyEvent *)(xevent);
-
- GDK_NOTE (EVENTS,
- g_print ("device key %s:\twindow: %ld device: %ld keycode: %d\n",
- (event->key.type == GDK_KEY_PRESS) ? "press" : "release",
- xdke->window,
- xdke->deviceid,
- xdke->keycode));
-
- if (xdke->keycode < gdkdev->min_keycode ||
- xdke->keycode >= gdkdev->min_keycode + gdkdev->info.num_keys)
- {
- g_warning ("Invalid device key code received");
- return FALSE;
- }
-
- event->key.keyval = gdkdev->info.keys[xdke->keycode - gdkdev->min_keycode].keyval;
-
- if (event->key.keyval == 0)
- {
- GDK_NOTE (EVENTS,
- g_print ("\t\ttranslation - NONE\n"));
-
- return FALSE;
- }
-
- event->key.type = (xdke->type == gdkdev->keypress_type) ?
- GDK_KEY_PRESS : GDK_KEY_RELEASE;
-
- event->key.window = input_window->window;
- event->key.time = xdke->time;
-
- event->key.state = gdk_input_translate_state(xdke->state, xdke->device_state)
- | gdkdev->info.keys[xdke->keycode - gdkdev->min_keycode].modifiers;
-
- /* Add a string translation for the key event */
- if ((event->key.keyval >= 0x20) && (event->key.keyval <= 0xFF))
- {
- event->key.length = 1;
- event->key.string = g_new (gchar, 2);
- event->key.string[0] = (gchar)event->key.keyval;
- event->key.string[1] = 0;
- }
- else
- {
- event->key.length = 0;
- event->key.string = g_new0 (gchar, 1);
- }
-
- GDK_NOTE (EVENTS,
- g_print ("\t\ttranslation - keyval: %d modifiers: %#x\n",
- event->key.keyval,
- event->key.state));
-
- return TRUE;
- }
-
- if (xevent->type == gdkdev->motionnotify_type)
- {
- XDeviceMotionEvent *xdme = (XDeviceMotionEvent *)(xevent);
-
- gdk_input_translate_coordinates(gdkdev,input_window,xdme->axis_data,
- &event->motion.x,&event->motion.y,
- &event->motion.pressure,
- &event->motion.xtilt,
- &event->motion.ytilt);
-
- event->motion.type = GDK_MOTION_NOTIFY;
- event->motion.window = input_window->window;
- event->motion.time = xdme->time;
- event->motion.deviceid = xdme->deviceid;
- event->motion.state = gdk_input_translate_state(xdme->state,
- xdme->device_state);
- event->motion.is_hint = xdme->is_hint;
- event->motion.source = gdkdev->info.source;
- event->motion.deviceid = xdme->deviceid;
-
- GDK_NOTE (EVENTS,
- g_print ("motion notify:\t\twindow: %ld device: %ld x,y: %f %f state %#4x hint: %s\n",
- xdme->window,
- xdme->deviceid,
- event->motion.x, event->motion.y,
- event->motion.state,
- (xdme->is_hint) ? "true" : "false"));
-
-
- return TRUE;
- }
-
- if (xevent->type == gdkdev->proximityin_type ||
- xevent->type == gdkdev->proximityout_type)
- {
- XProximityNotifyEvent *xpne = (XProximityNotifyEvent *)(xevent);
-
- event->proximity.type = (xevent->type == gdkdev->proximityin_type)?
- GDK_PROXIMITY_IN:GDK_PROXIMITY_OUT;
- event->proximity.window = input_window->window;
- event->proximity.time = xpne->time;
- event->proximity.source = gdkdev->info.source;
- event->proximity.deviceid = xpne->deviceid;
-
- return TRUE;
- }
-
- return -1; /* wasn't one of our event types */
-}
-
-static void
-gdk_input_common_set_axes (guint32 deviceid, GdkAxisUse *axes)
-{
- int i;
- GdkDevicePrivate *gdkdev = gdk_input_find_device(deviceid);
- g_return_if_fail (gdkdev != NULL);
-
- for (i=GDK_AXIS_IGNORE;i<GDK_AXIS_LAST;i++)
- {
- gdkdev->axis_for_use[i] = -1;
- }
-
- for (i=0;i<gdkdev->info.num_axes;i++)
- {
- gdkdev->info.axes[i] = axes[i];
- gdkdev->axis_for_use[axes[i]] = i;
- }
-}
-
-void gdk_input_common_set_key (guint32 deviceid,
- guint index,
- guint keyval,
- GdkModifierType modifiers)
-{
- GdkDevicePrivate *gdkdev = gdk_input_find_device(deviceid);
-
- gdkdev = gdk_input_find_device (deviceid);
- g_return_if_fail (gdkdev != NULL);
- g_return_if_fail (index < gdkdev->info.num_keys);
-
- gdkdev->info.keys[index].keyval = keyval;
- gdkdev->info.keys[index].modifiers = modifiers;
-}
-
-static GdkTimeCoord *
-gdk_input_common_motion_events (GdkWindow *window,
- guint32 deviceid,
- guint32 start,
- guint32 stop,
- gint *nevents_return)
-{
- GdkTimeCoord *coords;
- XDeviceTimeCoord *device_coords;
- GdkInputWindow *input_window;
- GdkDevicePrivate *gdkdev;
-
- int mode_return;
- int axis_count_return;
- int i;
-
- gdkdev = gdk_input_find_device (deviceid);
- input_window = gdk_input_window_find (window);
-
- g_return_val_if_fail (gdkdev != NULL, NULL);
- g_return_val_if_fail (gdkdev->xdevice != NULL, NULL);
- g_return_val_if_fail (input_window != NULL, NULL);
-
- device_coords = XGetDeviceMotionEvents (gdk_display,
- gdkdev->xdevice,
- start, stop,
- nevents_return, &mode_return,
- &axis_count_return);
-
- if (device_coords)
- {
- coords = g_new (GdkTimeCoord, *nevents_return);
-
- for (i=0; i<*nevents_return; i++)
- {
- gdk_input_translate_coordinates (gdkdev, input_window,
- device_coords[i].data,
- &coords[i].x, &coords[i].y,
- &coords[i].pressure,
- &coords[i].xtilt, &coords[i].ytilt);
- }
- XFreeDeviceMotionEvents (device_coords);
-
- return coords;
- }
- else
- return NULL;
-}
-
-static void
-gdk_input_common_get_pointer (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask)
-{
- GdkDevicePrivate *gdkdev;
- GdkInputWindow *input_window;
- XDeviceState *state;
- XInputClass *input_class;
- gint x_int, y_int;
- gint i;
-
- /* we probably need to get the mask in any case */
-
- if (deviceid == GDK_CORE_POINTER)
- {
- gdk_window_get_pointer (window, &x_int, &y_int, mask);
- if (x) *x = x_int;
- if (y) *y = y_int;
- if (pressure) *pressure = 0.5;
- if (xtilt) *xtilt = 0;
- if (ytilt) *ytilt = 0;
- }
- else
- {
- if (mask)
- gdk_window_get_pointer (window, NULL, NULL, mask);
-
- gdkdev = gdk_input_find_device (deviceid);
- input_window = gdk_input_window_find (window);
-
- g_return_if_fail (gdkdev != NULL);
- g_return_if_fail (gdkdev->xdevice != NULL);
- g_return_if_fail (input_window != NULL);
-
- state = XQueryDeviceState (gdk_display, gdkdev->xdevice);
- input_class = state->data;
- for (i=0; i<state->num_classes; i++)
- {
- switch (input_class->class)
- {
- case ValuatorClass:
- gdk_input_translate_coordinates (gdkdev, input_window,
- ((XValuatorState *)input_class)->valuators,
- x, y, pressure,
- xtilt, ytilt);
-
-
- break;
- case ButtonClass:
- if (mask)
- {
- *mask &= 0xFF;
- if (((XButtonState *)input_class)->num_buttons > 0)
- *mask |= ((XButtonState *)input_class)->buttons[0] << 7;
- /* GDK_BUTTON1_MASK = 1 << 8, and button n is stored
- * in bit 1<<(n%8) in byte n/8. n = 1,2,... */
- }
- break;
- }
- input_class = (XInputClass *)(((char *)input_class)+input_class->length);
- }
- }
-}
-
-#endif
diff --git a/gdk/gdkinputgxi.h b/gdk/gdkinputgxi.h
deleted file mode 100644
index 3d67eb513e..0000000000
--- a/gdk/gdkinputgxi.h
+++ /dev/null
@@ -1,629 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifdef XINPUT_GXI
-
-/* #define DEBUG_SWITCHING */
-
-#include <gxid_lib.h>
-
-/* Forward declarations */
-static void gdk_input_gxi_select_notify (GdkDevicePrivate *gdkdev);
-static gint gdk_input_gxi_set_mode (guint32 deviceid, GdkInputMode mode);
-static gint gdk_input_is_extension_device (guint32 deviceid);
-static void gdk_input_gxi_configure_event (XConfigureEvent *xevent,
- GdkWindow *window);
-static void gdk_input_gxi_enter_event (XCrossingEvent *xevent,
- GdkWindow *window);
-static gint gdk_input_gxi_other_event (GdkEvent *event,
- XEvent *xevent,
- GdkWindow *window);
-static void gdk_input_gxi_update_device (GdkDevicePrivate *gdkdev);
-
-static gint gdk_input_gxi_window_none_event (GdkEvent *event, XEvent *xevent);
-static gint gdk_input_gxi_enable_window (GdkWindow *window,
- GdkDevicePrivate *gdkdev);
-static gint gdk_input_gxi_disable_window (GdkWindow *window,
- GdkDevicePrivate *gdkdev);
-static Window gdk_input_find_root_child(Display *dpy, Window w);
-static void gdk_input_compute_obscuring(GdkInputWindow *input_window);
-static gint gdk_input_is_obscured(GdkInputWindow *input_window, gdouble x,
- gdouble y);
-static GdkTimeCoord *gdk_input_gxi_motion_events (GdkWindow *window,
- guint32 deviceid,
- guint32 start,
- guint32 stop,
- gint *nevents_return);
-static void gdk_input_gxi_get_pointer (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask);
-static gint gdk_input_gxi_grab_pointer (GdkWindow * window,
- gint owner_events,
- GdkEventMask event_mask,
- GdkWindow * confine_to,
- guint32 time);
-static void gdk_input_gxi_ungrab_pointer (guint32 time);
-
-/* Local variables */
-
-static GdkDevicePrivate *gdk_input_current_device;
-static GdkDevicePrivate *gdk_input_core_pointer;
-
-void
-gdk_input_init(void)
-{
- GList *tmp_list;
-
- gdk_input_vtable.set_mode = gdk_input_gxi_set_mode;
- gdk_input_vtable.set_axes = gdk_input_common_set_axes;
- gdk_input_vtable.set_key = gdk_input_common_set_key;
- gdk_input_vtable.motion_events = gdk_input_gxi_motion_events;
- gdk_input_vtable.get_pointer = gdk_input_gxi_get_pointer;
- gdk_input_vtable.grab_pointer = gdk_input_gxi_grab_pointer;
- gdk_input_vtable.ungrab_pointer = gdk_input_gxi_ungrab_pointer;
- gdk_input_vtable.configure_event = gdk_input_gxi_configure_event;
- gdk_input_vtable.enter_event = gdk_input_gxi_enter_event;
- gdk_input_vtable.other_event = gdk_input_gxi_other_event;
- gdk_input_vtable.window_none_event = gdk_input_gxi_window_none_event;
- gdk_input_vtable.enable_window = gdk_input_gxi_enable_window;
- gdk_input_vtable.disable_window = gdk_input_gxi_disable_window;
-
- gdk_input_ignore_core = FALSE;
- gdk_input_core_pointer = NULL;
-
- if (!gdk_input_gxid_host)
- {
- gdk_input_gxid_host = getenv("GXID_HOST");
- }
- if (!gdk_input_gxid_port)
- {
- char *t = getenv("GXID_PORT");
- if (t)
- gdk_input_gxid_port = atoi(t);
- }
-
- gdk_input_common_init(TRUE);
-
- /* find initial core pointer */
-
- for (tmp_list = gdk_input_devices; tmp_list; tmp_list = tmp_list->next)
- {
- GdkDevicePrivate *gdkdev = (GdkDevicePrivate *)tmp_list->data;
- if (gdk_input_is_extension_device(gdkdev->info.deviceid))
- {
- gdk_input_gxi_select_notify (gdkdev);
- }
- else
- {
- if (gdkdev->info.deviceid != GDK_CORE_POINTER)
- gdk_input_core_pointer = gdkdev;
- }
- }
-}
-
-static void
-gdk_input_gxi_select_notify (GdkDevicePrivate *gdkdev)
-{
- XEventClass class;
-
- ChangeDeviceNotify (gdkdev->xdevice, gdkdev->changenotify_type, class);
-
- XSelectExtensionEvent (gdk_display, gdk_root_window, &class, 1);
-}
-
-/* Set the core pointer. Device should already be enabled. */
-static gint
-gdk_input_gxi_set_core_pointer(GdkDevicePrivate *gdkdev)
-{
- int x_axis,y_axis;
-
- g_return_val_if_fail(gdkdev->xdevice,FALSE);
-
- x_axis = gdkdev->axis_for_use[GDK_AXIS_X];
- y_axis = gdkdev->axis_for_use[GDK_AXIS_Y];
-
- g_return_val_if_fail(x_axis != -1 && y_axis != -1,FALSE);
-
- /* core_pointer might not be up to date so we check with the server
- before change the pointer */
-
- if ( !gdk_input_is_extension_device(gdkdev->info.deviceid) )
- {
-#if 0
- if (gdkdev != gdk_input_core_pointer)
- g_warning("core pointer inconsistency");
-#endif
- return TRUE;
- }
-
- if ( XChangePointerDevice(gdk_display,gdkdev->xdevice, x_axis, y_axis)
- != Success )
- {
- return FALSE;
- }
- else
- {
- gdk_input_gxi_update_device (gdk_input_core_pointer);
- gdk_input_core_pointer = gdkdev;
- return TRUE;
- }
-}
-
-
-/* FIXME, merge with gdk_input_xfree_set_mode */
-
-static gint
-gdk_input_gxi_set_mode (guint32 deviceid, GdkInputMode mode)
-{
- GList *tmp_list;
- GdkDevicePrivate *gdkdev;
- GdkInputMode old_mode;
- GdkInputWindow *input_window;
-
- gdkdev = gdk_input_find_device(deviceid);
- g_return_val_if_fail (gdkdev != NULL,FALSE);
- old_mode = gdkdev->info.mode;
-
- if (gdkdev->info.mode == mode)
- return TRUE;
-
- gdkdev->info.mode = mode;
-
- if (old_mode != GDK_MODE_DISABLED)
- {
- for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
- {
- input_window = (GdkInputWindow *)tmp_list->data;
- if (input_window->mode != GDK_EXTENSION_EVENTS_CURSOR)
- gdk_input_disable_window (input_window->window, gdkdev);
- }
- }
-
- if (mode != GDK_MODE_DISABLED)
- {
- for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
- {
- input_window = (GdkInputWindow *)tmp_list->data;
- if (input_window->mode != GDK_EXTENSION_EVENTS_CURSOR)
- if (!gdk_input_enable_window(input_window->window, gdkdev))
- {
- gdk_input_set_mode(deviceid, old_mode);
- return FALSE;
- }
- }
- }
-
- return TRUE;
-
-}
-
-gint
-gdk_input_is_extension_device (guint32 deviceid)
-{
- XDeviceInfo *devices;
- int num_devices, loop;
-
- if (deviceid == GDK_CORE_POINTER)
- return FALSE;
-
- devices = XListInputDevices(gdk_display, &num_devices);
- for(loop=0; loop<num_devices; loop++)
- {
- if ((devices[loop].id == deviceid) && (devices[loop].use == IsXExtensionDevice))
- {
- XFreeDeviceList(devices);
- return TRUE;
- }
- }
-
- XFreeDeviceList(devices);
- return FALSE;
-}
-
-static void
-gdk_input_gxi_configure_event (XConfigureEvent *xevent, GdkWindow *window)
-{
- GdkInputWindow *input_window;
- gint root_x, root_y;
-
- input_window = gdk_input_window_find(window);
- g_return_if_fail (input_window != NULL);
-
- gdk_input_get_root_relative_geometry(gdk_display,GDK_WINDOW_XWINDOW(window),
- &root_x, &root_y, NULL, NULL);
- input_window->root_x = root_x;
- input_window->root_y = root_y;
- gdk_input_compute_obscuring(input_window);
-}
-
-static void
-gdk_input_gxi_enter_event (XCrossingEvent *xevent, GdkWindow *window)
-{
- GdkInputWindow *input_window;
-
- input_window = gdk_input_window_find(window);
- g_return_if_fail (input_window != NULL);
-
- gdk_input_compute_obscuring(input_window);
-}
-
-static gint
-gdk_input_gxi_other_event (GdkEvent *event,
- XEvent *xevent,
- GdkWindow *window)
-{
- GdkInputWindow *input_window;
-
- GdkDevicePrivate *gdkdev;
- gint return_val;
-
- input_window = gdk_input_window_find(window);
- g_return_val_if_fail (window != NULL, -1);
-
- /* This is a sort of a hack, as there isn't any XDeviceAnyEvent -
- but it's potentially faster than scanning through the types of
- every device. If we were deceived, then it won't match any of
- the types for the device anyways */
- gdkdev = gdk_input_find_device(((XDeviceButtonEvent *)xevent)->deviceid);
-
- if (!gdkdev) {
- return -1; /* we don't handle it - not an XInput event */
- }
-
- if (gdkdev->info.mode == GDK_MODE_DISABLED ||
- input_window->mode == GDK_EXTENSION_EVENTS_CURSOR)
- return FALSE;
-
- if (gdkdev != gdk_input_current_device &&
- xevent->type != gdkdev->changenotify_type)
- {
- gdk_input_current_device = gdkdev;
- }
-
- return_val = gdk_input_common_other_event (event, xevent,
- input_window, gdkdev);
-
- if (return_val > 0 && event->type == GDK_MOTION_NOTIFY &&
- (!gdkdev->button_state) && (!input_window->grabbed) &&
- ((event->motion.x < 0) || (event->motion.y < 0) ||
- (event->motion.x > ((GdkWindowPrivate *)window)->width) ||
- (event->motion.y > ((GdkWindowPrivate *)window)->height) ||
- gdk_input_is_obscured(input_window,event->motion.x,event->motion.y)))
- {
-#ifdef DEBUG_SWITCHING
- g_print("gdkinput: Setting core pointer to %d on motion at (%f,%f)\n",
- gdkdev->info.deviceid,event->motion.x,event->motion.y);
- g_print(" window geometry is: %dx%d\n",
- ((GdkWindowPrivate *)window)->width,
- ((GdkWindowPrivate *)window)->height);
-#endif
- gdk_input_gxi_set_core_pointer(gdkdev);
- return FALSE;
- }
- else
- return return_val;
-
-}
-
-static void
-gdk_input_gxi_update_device (GdkDevicePrivate *gdkdev)
-{
- GList *t;
-
- if (gdk_input_is_extension_device (gdkdev->info.deviceid))
- {
- if (!gdkdev->xdevice)
- {
- gdkdev->xdevice = XOpenDevice(gdk_display, gdkdev->info.deviceid);
- gdk_input_gxi_select_notify (gdkdev);
- gdkdev->needs_update = 1;
- }
- if (gdkdev->needs_update && gdkdev->xdevice)
- {
- for (t = gdk_input_windows; t; t = t->next)
- gdk_input_common_select_events (((GdkInputWindow *)t->data)->window,
- gdkdev);
- gdkdev->needs_update = 0;
- }
- }
-}
-
-static gint
-gdk_input_gxi_window_none_event (GdkEvent *event, XEvent *xevent)
-{
- GdkDevicePrivate *gdkdev =
- gdk_input_find_device(((XDeviceButtonEvent *)xevent)->deviceid);
-
- if (!gdkdev) {
- return -1; /* we don't handle it - not an XInput event */
- }
-
- if (xevent->type == gdkdev->changenotify_type)
- {
- if (gdk_input_core_pointer != gdkdev)
- {
-#ifdef DEBUG_SWITCHING
- g_print("ChangeNotify from %d to %d:\n",
- gdk_input_core_pointer->info.deviceid,
- gdkdev->info.deviceid);
-#endif
- gdk_input_gxi_update_device (gdk_input_core_pointer);
- gdk_input_core_pointer = gdkdev;
- }
- }
-
- return FALSE;
-}
-
-static gint
-gdk_input_gxi_enable_window (GdkWindow *window, GdkDevicePrivate *gdkdev)
-{
- GdkInputWindow *input_window;
-
- input_window = gdk_input_window_find (window);
- g_return_val_if_fail (input_window != NULL, FALSE);
-
- if (!gdkdev->claimed)
- {
- if (gxid_claim_device(gdk_input_gxid_host, gdk_input_gxid_port,
- gdkdev->info.deviceid,
- GDK_WINDOW_XWINDOW(window), FALSE) !=
- GXID_RETURN_OK)
- {
- g_warning("Could not get device (is gxid running?)\n");
- return FALSE;
- }
- gdkdev->claimed = TRUE;
- }
-
- if (gdkdev->xdevice && gdkdev != gdk_input_core_pointer)
- gdk_input_common_select_events(window, gdkdev);
- else
- gdkdev->needs_update = TRUE;
-
- return TRUE;
-}
-
-static gint
-gdk_input_gxi_disable_window(GdkWindow *window, GdkDevicePrivate *gdkdev)
-{
- GdkInputWindow *input_window;
-
- input_window = gdk_input_window_find (window);
- g_return_val_if_fail (input_window != NULL, FALSE);
-
- if (gdkdev->claimed)
- {
- gxid_release_device(gdk_input_gxid_host, gdk_input_gxid_port,
- gdkdev->info.deviceid,
- GDK_WINDOW_XWINDOW(window));
-
- gdkdev->claimed = FALSE;
- }
-
- if (gdkdev->xdevice && gdkdev != gdk_input_core_pointer)
- gdk_input_common_select_events(window, gdkdev);
- else
- gdkdev->needs_update = TRUE;
-
- return TRUE;
-}
-
-static gint
-gdk_input_is_obscured(GdkInputWindow *input_window, gdouble x, gdouble y)
-{
- int i;
- for (i=0;i<input_window->num_obscuring;i++)
- {
- GdkRectangle *rect = &input_window->obscuring[i];
- if ((x >= rect->x) &&
- (y >= rect->y) &&
- (x < rect->x + rect->width) &&
- (y < rect->y + rect->height))
- return TRUE;
- }
- return FALSE;
-}
-
-/* If this routine needs fixing, the corresponding routine
- in gxid.c will need it too. */
-
-static Window
-gdk_input_find_root_child(Display *dpy, Window w)
-{
- Window root,parent;
- Window *children;
- int nchildren;
-
- parent = w;
- do
- {
- w = parent;
- XQueryTree(dpy,w,&root,&parent,&children,&nchildren);
- if (children) XFree(children);
- }
- while (parent != root);
-
- return w;
-}
-
-void
-gdk_input_compute_obscuring(GdkInputWindow *input_window)
-{
- int i;
- int x,y,width,height;
- int xc,yc,widthc,heightc,border_widthc,depthc;
-
- Window root,parent;
- Window *children;
- int nchildren;
-
- Window w = GDK_WINDOW_XWINDOW(input_window->window);
- Window root_child = gdk_input_find_root_child(gdk_display,w);
- gdk_input_get_root_relative_geometry(gdk_display,w,&x,&y,&width,&height);
-
- input_window->root_x = x;
- input_window->root_y = y;
-
- XQueryTree(gdk_display,GDK_ROOT_WINDOW(),
- &root,&parent,&children,&nchildren);
-
-
- if (input_window->obscuring)
- g_free(input_window->obscuring);
- input_window->obscuring = 0;
- input_window->num_obscuring = 0;
-
- for (i=0;i<nchildren;i++)
- if (children[i] == root_child)
- break;
-
- if (i>=nchildren-1)
- {
- if (nchildren)
- XFree(children);
- return;
- }
-
- input_window->obscuring = g_new(GdkRectangle,(nchildren-i-1));
-
- for (i=i+1;i<nchildren;i++)
- {
- int xmin, xmax, ymin, ymax;
- XGetGeometry(gdk_display,children[i],&root,&xc,&yc,&widthc,&heightc,
- &border_widthc, &depthc);
- xmin = xc>x ? xc : x;
- xmax = (xc+widthc)<(x+width) ? xc+widthc : x+width;
- ymin = yc>y ? yc : y;
- ymax = (yc+heightc)<(y+height) ? yc+heightc : y+height;
- if ((xmin < xmax) && (ymin < ymax))
- {
- XWindowAttributes attributes;
- XGetWindowAttributes(gdk_display,children[i],&attributes);
- if (attributes.map_state == IsViewable)
- {
- GdkRectangle *rect = &input_window->obscuring[input_window->num_obscuring];
-
- /* we store the whole window, not just the obscuring part */
- rect->x = xc - x;
- rect->y = yc - y;
- rect->width = widthc;
- rect->height = heightc;
- input_window->num_obscuring++;
- }
- }
- }
-
- if (nchildren)
- XFree(children);
-}
-
-static void
-gdk_input_gxi_get_pointer (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask)
-{
- GdkDevicePrivate *gdkdev;
-
- gdkdev = gdk_input_find_device (deviceid);
- g_return_if_fail (gdkdev != NULL);
-
- if (gdkdev == gdk_input_core_pointer)
- gdk_input_common_get_pointer (window, GDK_CORE_POINTER, x, y,
- pressure, xtilt, ytilt, mask);
- else
- gdk_input_common_get_pointer (window, deviceid, x, y,
- pressure, xtilt, ytilt, mask);
-}
-
-static GdkTimeCoord *
-gdk_input_gxi_motion_events (GdkWindow *window,
- guint32 deviceid,
- guint32 start,
- guint32 stop,
- gint *nevents_return)
-{
- GdkDevicePrivate *gdkdev;
-
- gdkdev = gdk_input_find_device (deviceid);
- g_return_val_if_fail (gdkdev != NULL, NULL);
-
-
- if (gdkdev == gdk_input_core_pointer)
- return gdk_input_motion_events (window, GDK_CORE_POINTER, start, stop,
- nevents_return);
- else
- return gdk_input_common_motion_events (window, deviceid, start, stop,
- nevents_return);
-
-}
-
-static gint
-gdk_input_gxi_grab_pointer (GdkWindow * window,
- gint owner_events,
- GdkEventMask event_mask,
- GdkWindow * confine_to,
- guint32 time)
-{
- GdkInputWindow *input_window, *new_window;
- GList *tmp_list;
-
- tmp_list = gdk_input_windows;
- while (tmp_list)
- {
- input_window = (GdkInputWindow *)tmp_list->data;
- if (input_window->grabbed)
- return AlreadyGrabbed;
-
- if (input_window->window == window)
- new_window = input_window;
-
- tmp_list = tmp_list->next;
- }
-
- new_window->grabbed = TRUE;
- return Success;
-}
-
-static void
-gdk_input_gxi_ungrab_pointer (guint32 time)
-{
- GdkInputWindow *input_window;
- GList *tmp_list;
-
- tmp_list = gdk_input_windows;
- while (tmp_list)
- {
- input_window = (GdkInputWindow *)tmp_list->data;
- if (input_window->grabbed)
- input_window->grabbed = FALSE;
- tmp_list = tmp_list->next;
- }
-}
-
-#endif /* XINPUT_GXI */
diff --git a/gdk/gdkinputnone.h b/gdk/gdkinputnone.h
deleted file mode 100644
index 6dd999b837..0000000000
--- a/gdk/gdkinputnone.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifdef XINPUT_NONE
-
-static void gdk_input_none_get_pointer (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask);
-
-void
-gdk_input_init ()
-{
- gdk_input_vtable.set_mode = NULL;
- gdk_input_vtable.set_axes = NULL;
- gdk_input_vtable.set_key = NULL;
- gdk_input_vtable.motion_events = NULL;
- gdk_input_vtable.get_pointer = gdk_input_none_get_pointer;
- gdk_input_vtable.grab_pointer = NULL;
- gdk_input_vtable.ungrab_pointer = NULL;
- gdk_input_vtable.configure_event = NULL;
- gdk_input_vtable.enter_event = NULL;
- gdk_input_vtable.other_event = NULL;
- gdk_input_vtable.window_none_event = NULL;
- gdk_input_vtable.enable_window = NULL;
- gdk_input_vtable.disable_window = NULL;
-
- gdk_input_devices = g_list_append (NULL, &gdk_input_core_info);
-
- gdk_input_ignore_core = FALSE;
-}
-
-static void
-gdk_input_none_get_pointer (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask)
-{
- gint x_int, y_int;
-
- gdk_window_get_pointer (window, &x_int, &y_int, mask);
-
- if (x) *x = x_int;
- if (y) *y = y_int;
- if (pressure) *pressure = 0.5;
- if (xtilt) *xtilt = 0;
- if (ytilt) *ytilt = 0;
-}
-
-#endif /* XINPUT_NONE */
diff --git a/gdk/gdkinputxfree.h b/gdk/gdkinputxfree.h
deleted file mode 100644
index 704c11aefa..0000000000
--- a/gdk/gdkinputxfree.h
+++ /dev/null
@@ -1,342 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifdef XINPUT_XFREE
-
-/* forward declarations */
-
-static gint gdk_input_xfree_set_mode (guint32 deviceid, GdkInputMode mode);
-static void gdk_input_check_proximity();
-static void gdk_input_xfree_configure_event (XConfigureEvent *xevent,
- GdkWindow *window);
-static void gdk_input_xfree_enter_event (XCrossingEvent *xevent,
- GdkWindow *window);
-static gint gdk_input_xfree_other_event (GdkEvent *event,
- XEvent *xevent,
- GdkWindow *window);
-static gint gdk_input_xfree_enable_window(GdkWindow *window,
- GdkDevicePrivate *gdkdev);
-static gint gdk_input_xfree_disable_window(GdkWindow *window,
- GdkDevicePrivate *gdkdev);
-static gint gdk_input_xfree_grab_pointer (GdkWindow * window,
- gint owner_events,
- GdkEventMask event_mask,
- GdkWindow * confine_to,
- guint32 time);
-static void gdk_input_xfree_ungrab_pointer (guint32 time);
-
-void
-gdk_input_init(void)
-{
- gdk_input_vtable.set_mode = gdk_input_xfree_set_mode;
- gdk_input_vtable.set_axes = gdk_input_common_set_axes;
- gdk_input_vtable.set_key = gdk_input_common_set_key;
- gdk_input_vtable.motion_events = gdk_input_common_motion_events;
- gdk_input_vtable.get_pointer = gdk_input_common_get_pointer;
- gdk_input_vtable.grab_pointer = gdk_input_xfree_grab_pointer;
- gdk_input_vtable.ungrab_pointer = gdk_input_xfree_ungrab_pointer;
- gdk_input_vtable.configure_event = gdk_input_xfree_configure_event;
- gdk_input_vtable.enter_event = gdk_input_xfree_enter_event;
- gdk_input_vtable.other_event = gdk_input_xfree_other_event;
- gdk_input_vtable.window_none_event = NULL;
- gdk_input_vtable.enable_window = gdk_input_xfree_enable_window;
- gdk_input_vtable.disable_window = gdk_input_xfree_disable_window;
-
- gdk_input_ignore_core = FALSE;
- gdk_input_common_init(FALSE);
-}
-
-static gint
-gdk_input_xfree_set_mode (guint32 deviceid, GdkInputMode mode)
-{
- GList *tmp_list;
- GdkDevicePrivate *gdkdev;
- GdkInputMode old_mode;
- GdkInputWindow *input_window;
-
- gdkdev = gdk_input_find_device(deviceid);
- g_return_val_if_fail (gdkdev != NULL,FALSE);
- old_mode = gdkdev->info.mode;
-
- if (gdkdev->info.mode == mode)
- return TRUE;
-
- gdkdev->info.mode = mode;
-
- if (mode == GDK_MODE_WINDOW)
- {
- gdkdev->info.has_cursor = FALSE;
- for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
- {
- input_window = (GdkInputWindow *)tmp_list->data;
- if (input_window->mode != GDK_EXTENSION_EVENTS_CURSOR)
- gdk_input_enable_window (input_window->window, gdkdev);
- else
- if (old_mode != GDK_MODE_DISABLED)
- gdk_input_disable_window (input_window->window, gdkdev);
- }
- }
- else if (mode == GDK_MODE_SCREEN)
- {
- gdkdev->info.has_cursor = TRUE;
- for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
- gdk_input_enable_window (((GdkInputWindow *)tmp_list->data)->window,
- gdkdev);
- }
- else /* mode == GDK_MODE_DISABLED */
- {
- for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
- {
- input_window = (GdkInputWindow *)tmp_list->data;
- if (old_mode != GDK_MODE_WINDOW ||
- input_window->mode != GDK_EXTENSION_EVENTS_CURSOR)
- gdk_input_disable_window (input_window->window, gdkdev);
- }
- }
-
- return TRUE;
-
-}
-
-static void
-gdk_input_check_proximity()
-{
- gint new_proximity = 0;
- GList *tmp_list = gdk_input_devices;
-
- while (tmp_list && !new_proximity)
- {
- GdkDevicePrivate *gdkdev = (GdkDevicePrivate *)(tmp_list->data);
-
- if (gdkdev->info.mode != GDK_MODE_DISABLED
- && gdkdev->info.deviceid != GDK_CORE_POINTER
- && gdkdev->xdevice)
- {
- XDeviceState *state = XQueryDeviceState(GDK_DISPLAY(),
- gdkdev->xdevice);
- XInputClass *xic;
- int i;
-
- xic = state->data;
- for (i=0; i<state->num_classes; i++)
- {
- if (xic->class == ValuatorClass)
- {
- XValuatorState *xvs = (XValuatorState *)xic;
- if ((xvs->mode & ProximityState) == InProximity)
- {
- new_proximity = TRUE;
- }
- break;
- }
- xic = (XInputClass *)((char *)xic + xic->length);
- }
- }
- tmp_list = tmp_list->next;
- }
-
- gdk_input_ignore_core = new_proximity;
-}
-
-static void
-gdk_input_xfree_configure_event (XConfigureEvent *xevent, GdkWindow *window)
-{
- GdkInputWindow *input_window;
- gint root_x, root_y;
-
- input_window = gdk_input_window_find(window);
- g_return_if_fail (window != NULL);
-
- gdk_input_get_root_relative_geometry(GDK_DISPLAY(),GDK_WINDOW_XWINDOW(window),
- &root_x,
- &root_y, NULL, NULL);
-
- input_window->root_x = root_x;
- input_window->root_y = root_y;
-}
-
-static void
-gdk_input_xfree_enter_event (XCrossingEvent *xevent,
- GdkWindow *window)
-{
- GdkInputWindow *input_window;
- gint root_x, root_y;
-
- input_window = gdk_input_window_find(window);
- g_return_if_fail (window != NULL);
-
- gdk_input_check_proximity();
-
- gdk_input_get_root_relative_geometry(GDK_DISPLAY(),GDK_WINDOW_XWINDOW(window),
- &root_x,
- &root_y, NULL, NULL);
-
- input_window->root_x = root_x;
- input_window->root_y = root_y;
-}
-
-static gint
-gdk_input_xfree_other_event (GdkEvent *event,
- XEvent *xevent,
- GdkWindow *window)
-{
- GdkInputWindow *input_window;
-
- GdkDevicePrivate *gdkdev;
- gint return_val;
-
- input_window = gdk_input_window_find(window);
- g_return_val_if_fail (window != NULL, -1);
-
- /* This is a sort of a hack, as there isn't any XDeviceAnyEvent -
- but it's potentially faster than scanning through the types of
- every device. If we were deceived, then it won't match any of
- the types for the device anyways */
- gdkdev = gdk_input_find_device(((XDeviceButtonEvent *)xevent)->deviceid);
-
- if (!gdkdev) {
- return -1; /* we don't handle it - not an XInput event */
- }
-
- /* FIXME: It would be nice if we could just get rid of the events
- entirely, instead of having to ignore them */
- if (gdkdev->info.mode == GDK_MODE_DISABLED ||
- (gdkdev->info.mode == GDK_MODE_WINDOW
- && input_window->mode == GDK_EXTENSION_EVENTS_CURSOR))
- return FALSE;
-
- if (!gdk_input_ignore_core)
- gdk_input_check_proximity();
-
- return_val = gdk_input_common_other_event (event, xevent,
- input_window, gdkdev);
-
- if (return_val > 0 && event->type == GDK_PROXIMITY_OUT &&
- gdk_input_ignore_core)
- gdk_input_check_proximity();
-
- return return_val;
-}
-
-static gint
-gdk_input_xfree_enable_window(GdkWindow *window, GdkDevicePrivate *gdkdev)
-{
- /* FIXME: watchout, gdkdev might be core pointer, never opened */
- gdk_input_common_select_events (window, gdkdev);
- return TRUE;
-}
-
-static gint
-gdk_input_xfree_disable_window(GdkWindow *window, GdkDevicePrivate *gdkdev)
-{
- gdk_input_common_select_events (window, gdkdev);
- return TRUE;
-}
-
-static gint
-gdk_input_xfree_grab_pointer (GdkWindow * window,
- gint owner_events,
- GdkEventMask event_mask,
- GdkWindow * confine_to,
- guint32 time)
-{
- GdkInputWindow *input_window, *new_window;
- GdkDevicePrivate *gdkdev;
- GList *tmp_list;
- XEventClass event_classes[GDK_MAX_DEVICE_CLASSES];
- gint num_classes;
- gint result;
-
- tmp_list = gdk_input_windows;
- new_window = NULL;
- while (tmp_list)
- {
- input_window = (GdkInputWindow *)tmp_list->data;
- if (input_window->grabbed)
- return AlreadyGrabbed;
-
- if (input_window->window == window)
- new_window = input_window;
-
- tmp_list = tmp_list->next;
- }
-
- g_return_val_if_fail (new_window != NULL, Success); /* shouldn't happen */
-
- new_window->grabbed = TRUE;
-
- tmp_list = gdk_input_devices;
- while (tmp_list)
- {
- gdkdev = (GdkDevicePrivate *)tmp_list->data;
- if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
- gdkdev->xdevice)
- {
- gdk_input_common_find_events (window, gdkdev,
- event_mask,
- event_classes, &num_classes);
-
- result = XGrabDevice( GDK_DISPLAY(), gdkdev->xdevice,
- GDK_WINDOW_XWINDOW (window),
- owner_events, num_classes, event_classes,
- GrabModeAsync, GrabModeAsync, time);
-
- /* FIXME: if failure occurs on something other than the first
- device, things will be badly inconsistent */
- if (result != Success)
- return result;
- }
- tmp_list = tmp_list->next;
- }
-
- return Success;
-}
-
-static void
-gdk_input_xfree_ungrab_pointer (guint32 time)
-{
- GdkInputWindow *input_window;
- GdkDevicePrivate *gdkdev;
- GList *tmp_list;
-
- tmp_list = gdk_input_windows;
- while (tmp_list)
- {
- input_window = (GdkInputWindow *)tmp_list->data;
- if (input_window->grabbed)
- break;
- tmp_list = tmp_list->next;
- }
-
- if (tmp_list) /* we found a grabbed window */
- {
- input_window->grabbed = FALSE;
-
- tmp_list = gdk_input_devices;
- while (tmp_list)
- {
- gdkdev = (GdkDevicePrivate *)tmp_list->data;
- if (gdkdev->info.deviceid != GDK_CORE_POINTER && gdkdev->xdevice)
- XUngrabDevice( gdk_display, gdkdev->xdevice, time);
-
- tmp_list = tmp_list->next;
- }
- }
-}
-
-#endif /* XINPUT_XFREE */
diff --git a/gdk/gdkkeysyms.h b/gdk/gdkkeysyms.h
deleted file mode 100644
index 45d22a4cbc..0000000000
--- a/gdk/gdkkeysyms.h
+++ /dev/null
@@ -1,1316 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#define GDK_VoidSymbol 0xFFFFFF
-#define GDK_BackSpace 0xFF08
-#define GDK_Tab 0xFF09
-#define GDK_Linefeed 0xFF0A
-#define GDK_Clear 0xFF0B
-#define GDK_Return 0xFF0D
-#define GDK_Pause 0xFF13
-#define GDK_Scroll_Lock 0xFF14
-#define GDK_Sys_Req 0xFF15
-#define GDK_Escape 0xFF1B
-#define GDK_Delete 0xFFFF
-#define GDK_Multi_key 0xFF20
-#define GDK_Kanji 0xFF21
-#define GDK_Muhenkan 0xFF22
-#define GDK_Henkan_Mode 0xFF23
-#define GDK_Henkan 0xFF23
-#define GDK_Romaji 0xFF24
-#define GDK_Hiragana 0xFF25
-#define GDK_Katakana 0xFF26
-#define GDK_Hiragana_Katakana 0xFF27
-#define GDK_Zenkaku 0xFF28
-#define GDK_Hankaku 0xFF29
-#define GDK_Zenkaku_Hankaku 0xFF2A
-#define GDK_Touroku 0xFF2B
-#define GDK_Massyo 0xFF2C
-#define GDK_Kana_Lock 0xFF2D
-#define GDK_Kana_Shift 0xFF2E
-#define GDK_Eisu_Shift 0xFF2F
-#define GDK_Eisu_toggle 0xFF30
-#define GDK_Home 0xFF50
-#define GDK_Left 0xFF51
-#define GDK_Up 0xFF52
-#define GDK_Right 0xFF53
-#define GDK_Down 0xFF54
-#define GDK_Prior 0xFF55
-#define GDK_Page_Up 0xFF55
-#define GDK_Next 0xFF56
-#define GDK_Page_Down 0xFF56
-#define GDK_End 0xFF57
-#define GDK_Begin 0xFF58
-#define GDK_Select 0xFF60
-#define GDK_Print 0xFF61
-#define GDK_Execute 0xFF62
-#define GDK_Insert 0xFF63
-#define GDK_Undo 0xFF65
-#define GDK_Redo 0xFF66
-#define GDK_Menu 0xFF67
-#define GDK_Find 0xFF68
-#define GDK_Cancel 0xFF69
-#define GDK_Help 0xFF6A
-#define GDK_Break 0xFF6B
-#define GDK_Mode_switch 0xFF7E
-#define GDK_script_switch 0xFF7E
-#define GDK_Num_Lock 0xFF7F
-#define GDK_KP_Space 0xFF80
-#define GDK_KP_Tab 0xFF89
-#define GDK_KP_Enter 0xFF8D
-#define GDK_KP_F1 0xFF91
-#define GDK_KP_F2 0xFF92
-#define GDK_KP_F3 0xFF93
-#define GDK_KP_F4 0xFF94
-#define GDK_KP_Home 0xFF95
-#define GDK_KP_Left 0xFF96
-#define GDK_KP_Up 0xFF97
-#define GDK_KP_Right 0xFF98
-#define GDK_KP_Down 0xFF99
-#define GDK_KP_Prior 0xFF9A
-#define GDK_KP_Page_Up 0xFF9A
-#define GDK_KP_Next 0xFF9B
-#define GDK_KP_Page_Down 0xFF9B
-#define GDK_KP_End 0xFF9C
-#define GDK_KP_Begin 0xFF9D
-#define GDK_KP_Insert 0xFF9E
-#define GDK_KP_Delete 0xFF9F
-#define GDK_KP_Equal 0xFFBD
-#define GDK_KP_Multiply 0xFFAA
-#define GDK_KP_Add 0xFFAB
-#define GDK_KP_Separator 0xFFAC
-#define GDK_KP_Subtract 0xFFAD
-#define GDK_KP_Decimal 0xFFAE
-#define GDK_KP_Divide 0xFFAF
-#define GDK_KP_0 0xFFB0
-#define GDK_KP_1 0xFFB1
-#define GDK_KP_2 0xFFB2
-#define GDK_KP_3 0xFFB3
-#define GDK_KP_4 0xFFB4
-#define GDK_KP_5 0xFFB5
-#define GDK_KP_6 0xFFB6
-#define GDK_KP_7 0xFFB7
-#define GDK_KP_8 0xFFB8
-#define GDK_KP_9 0xFFB9
-#define GDK_F1 0xFFBE
-#define GDK_F2 0xFFBF
-#define GDK_F3 0xFFC0
-#define GDK_F4 0xFFC1
-#define GDK_F5 0xFFC2
-#define GDK_F6 0xFFC3
-#define GDK_F7 0xFFC4
-#define GDK_F8 0xFFC5
-#define GDK_F9 0xFFC6
-#define GDK_F10 0xFFC7
-#define GDK_F11 0xFFC8
-#define GDK_L1 0xFFC8
-#define GDK_F12 0xFFC9
-#define GDK_L2 0xFFC9
-#define GDK_F13 0xFFCA
-#define GDK_L3 0xFFCA
-#define GDK_F14 0xFFCB
-#define GDK_L4 0xFFCB
-#define GDK_F15 0xFFCC
-#define GDK_L5 0xFFCC
-#define GDK_F16 0xFFCD
-#define GDK_L6 0xFFCD
-#define GDK_F17 0xFFCE
-#define GDK_L7 0xFFCE
-#define GDK_F18 0xFFCF
-#define GDK_L8 0xFFCF
-#define GDK_F19 0xFFD0
-#define GDK_L9 0xFFD0
-#define GDK_F20 0xFFD1
-#define GDK_L10 0xFFD1
-#define GDK_F21 0xFFD2
-#define GDK_R1 0xFFD2
-#define GDK_F22 0xFFD3
-#define GDK_R2 0xFFD3
-#define GDK_F23 0xFFD4
-#define GDK_R3 0xFFD4
-#define GDK_F24 0xFFD5
-#define GDK_R4 0xFFD5
-#define GDK_F25 0xFFD6
-#define GDK_R5 0xFFD6
-#define GDK_F26 0xFFD7
-#define GDK_R6 0xFFD7
-#define GDK_F27 0xFFD8
-#define GDK_R7 0xFFD8
-#define GDK_F28 0xFFD9
-#define GDK_R8 0xFFD9
-#define GDK_F29 0xFFDA
-#define GDK_R9 0xFFDA
-#define GDK_F30 0xFFDB
-#define GDK_R10 0xFFDB
-#define GDK_F31 0xFFDC
-#define GDK_R11 0xFFDC
-#define GDK_F32 0xFFDD
-#define GDK_R12 0xFFDD
-#define GDK_F33 0xFFDE
-#define GDK_R13 0xFFDE
-#define GDK_F34 0xFFDF
-#define GDK_R14 0xFFDF
-#define GDK_F35 0xFFE0
-#define GDK_R15 0xFFE0
-#define GDK_Shift_L 0xFFE1
-#define GDK_Shift_R 0xFFE2
-#define GDK_Control_L 0xFFE3
-#define GDK_Control_R 0xFFE4
-#define GDK_Caps_Lock 0xFFE5
-#define GDK_Shift_Lock 0xFFE6
-#define GDK_Meta_L 0xFFE7
-#define GDK_Meta_R 0xFFE8
-#define GDK_Alt_L 0xFFE9
-#define GDK_Alt_R 0xFFEA
-#define GDK_Super_L 0xFFEB
-#define GDK_Super_R 0xFFEC
-#define GDK_Hyper_L 0xFFED
-#define GDK_Hyper_R 0xFFEE
-#define GDK_ISO_Lock 0xFE01
-#define GDK_ISO_Level2_Latch 0xFE02
-#define GDK_ISO_Level3_Shift 0xFE03
-#define GDK_ISO_Level3_Latch 0xFE04
-#define GDK_ISO_Level3_Lock 0xFE05
-#define GDK_ISO_Group_Shift 0xFF7E
-#define GDK_ISO_Group_Latch 0xFE06
-#define GDK_ISO_Group_Lock 0xFE07
-#define GDK_ISO_Next_Group 0xFE08
-#define GDK_ISO_Next_Group_Lock 0xFE09
-#define GDK_ISO_Prev_Group 0xFE0A
-#define GDK_ISO_Prev_Group_Lock 0xFE0B
-#define GDK_ISO_First_Group 0xFE0C
-#define GDK_ISO_First_Group_Lock 0xFE0D
-#define GDK_ISO_Last_Group 0xFE0E
-#define GDK_ISO_Last_Group_Lock 0xFE0F
-#define GDK_ISO_Left_Tab 0xFE20
-#define GDK_ISO_Move_Line_Up 0xFE21
-#define GDK_ISO_Move_Line_Down 0xFE22
-#define GDK_ISO_Partial_Line_Up 0xFE23
-#define GDK_ISO_Partial_Line_Down 0xFE24
-#define GDK_ISO_Partial_Space_Left 0xFE25
-#define GDK_ISO_Partial_Space_Right 0xFE26
-#define GDK_ISO_Set_Margin_Left 0xFE27
-#define GDK_ISO_Set_Margin_Right 0xFE28
-#define GDK_ISO_Release_Margin_Left 0xFE29
-#define GDK_ISO_Release_Margin_Right 0xFE2A
-#define GDK_ISO_Release_Both_Margins 0xFE2B
-#define GDK_ISO_Fast_Cursor_Left 0xFE2C
-#define GDK_ISO_Fast_Cursor_Right 0xFE2D
-#define GDK_ISO_Fast_Cursor_Up 0xFE2E
-#define GDK_ISO_Fast_Cursor_Down 0xFE2F
-#define GDK_ISO_Continuous_Underline 0xFE30
-#define GDK_ISO_Discontinuous_Underline 0xFE31
-#define GDK_ISO_Emphasize 0xFE32
-#define GDK_ISO_Center_Object 0xFE33
-#define GDK_ISO_Enter 0xFE34
-#define GDK_dead_grave 0xFE50
-#define GDK_dead_acute 0xFE51
-#define GDK_dead_circumflex 0xFE52
-#define GDK_dead_tilde 0xFE53
-#define GDK_dead_macron 0xFE54
-#define GDK_dead_breve 0xFE55
-#define GDK_dead_abovedot 0xFE56
-#define GDK_dead_diaeresis 0xFE57
-#define GDK_dead_abovering 0xFE58
-#define GDK_dead_doubleacute 0xFE59
-#define GDK_dead_caron 0xFE5A
-#define GDK_dead_cedilla 0xFE5B
-#define GDK_dead_ogonek 0xFE5C
-#define GDK_dead_iota 0xFE5D
-#define GDK_dead_voiced_sound 0xFE5E
-#define GDK_dead_semivoiced_sound 0xFE5F
-#define GDK_First_Virtual_Screen 0xFED0
-#define GDK_Prev_Virtual_Screen 0xFED1
-#define GDK_Next_Virtual_Screen 0xFED2
-#define GDK_Last_Virtual_Screen 0xFED4
-#define GDK_Terminate_Server 0xFED5
-#define GDK_Pointer_Left 0xFEE0
-#define GDK_Pointer_Right 0xFEE1
-#define GDK_Pointer_Up 0xFEE2
-#define GDK_Pointer_Down 0xFEE3
-#define GDK_Pointer_UpLeft 0xFEE4
-#define GDK_Pointer_UpRight 0xFEE5
-#define GDK_Pointer_DownLeft 0xFEE6
-#define GDK_Pointer_DownRight 0xFEE7
-#define GDK_Pointer_Button_Dflt 0xFEE8
-#define GDK_Pointer_Button1 0xFEE9
-#define GDK_Pointer_Button2 0xFEEA
-#define GDK_Pointer_Button3 0xFEEB
-#define GDK_Pointer_Button4 0xFEEC
-#define GDK_Pointer_Button5 0xFEED
-#define GDK_Pointer_DblClick_Dflt 0xFEEE
-#define GDK_Pointer_DblClick1 0xFEEF
-#define GDK_Pointer_DblClick2 0xFEF0
-#define GDK_Pointer_DblClick3 0xFEF1
-#define GDK_Pointer_DblClick4 0xFEF2
-#define GDK_Pointer_DblClick5 0xFEF3
-#define GDK_Pointer_Drag_Dflt 0xFEF4
-#define GDK_Pointer_Drag1 0xFEF5
-#define GDK_Pointer_Drag2 0xFEF6
-#define GDK_Pointer_Drag3 0xFEF7
-#define GDK_Pointer_Drag4 0xFEF8
-#define GDK_Pointer_EnableKeys 0xFEF9
-#define GDK_Pointer_Accelerate 0xFEFA
-#define GDK_Pointer_DfltBtnNext 0xFEFB
-#define GDK_Pointer_DfltBtnPrev 0xFEFC
-#define GDK_3270_Duplicate 0xFD01
-#define GDK_3270_FieldMark 0xFD02
-#define GDK_3270_Right2 0xFD03
-#define GDK_3270_Left2 0xFD04
-#define GDK_3270_BackTab 0xFD05
-#define GDK_3270_EraseEOF 0xFD06
-#define GDK_3270_EraseInput 0xFD07
-#define GDK_3270_Reset 0xFD08
-#define GDK_3270_Quit 0xFD09
-#define GDK_3270_PA1 0xFD0A
-#define GDK_3270_PA2 0xFD0B
-#define GDK_3270_PA3 0xFD0C
-#define GDK_3270_Test 0xFD0D
-#define GDK_3270_Attn 0xFD0E
-#define GDK_3270_CursorBlink 0xFD0F
-#define GDK_3270_AltCursor 0xFD10
-#define GDK_3270_KeyClick 0xFD11
-#define GDK_3270_Jump 0xFD12
-#define GDK_3270_Ident 0xFD13
-#define GDK_3270_Rule 0xFD14
-#define GDK_3270_Copy 0xFD15
-#define GDK_3270_Play 0xFD16
-#define GDK_3270_Setup 0xFD17
-#define GDK_3270_Record 0xFD18
-#define GDK_3270_ChangeScreen 0xFD19
-#define GDK_3270_DeleteWord 0xFD1A
-#define GDK_3270_ExSelect 0xFD1B
-#define GDK_3270_CursorSelect 0xFD1C
-#define GDK_3270_PrintScreen 0xFD1D
-#define GDK_3270_Enter 0xFD1E
-#define GDK_space 0x020
-#define GDK_exclam 0x021
-#define GDK_quotedbl 0x022
-#define GDK_numbersign 0x023
-#define GDK_dollar 0x024
-#define GDK_percent 0x025
-#define GDK_ampersand 0x026
-#define GDK_apostrophe 0x027
-#define GDK_quoteright 0x027
-#define GDK_parenleft 0x028
-#define GDK_parenright 0x029
-#define GDK_asterisk 0x02a
-#define GDK_plus 0x02b
-#define GDK_comma 0x02c
-#define GDK_minus 0x02d
-#define GDK_period 0x02e
-#define GDK_slash 0x02f
-#define GDK_0 0x030
-#define GDK_1 0x031
-#define GDK_2 0x032
-#define GDK_3 0x033
-#define GDK_4 0x034
-#define GDK_5 0x035
-#define GDK_6 0x036
-#define GDK_7 0x037
-#define GDK_8 0x038
-#define GDK_9 0x039
-#define GDK_colon 0x03a
-#define GDK_semicolon 0x03b
-#define GDK_less 0x03c
-#define GDK_equal 0x03d
-#define GDK_greater 0x03e
-#define GDK_question 0x03f
-#define GDK_at 0x040
-#define GDK_A 0x041
-#define GDK_B 0x042
-#define GDK_C 0x043
-#define GDK_D 0x044
-#define GDK_E 0x045
-#define GDK_F 0x046
-#define GDK_G 0x047
-#define GDK_H 0x048
-#define GDK_I 0x049
-#define GDK_J 0x04a
-#define GDK_K 0x04b
-#define GDK_L 0x04c
-#define GDK_M 0x04d
-#define GDK_N 0x04e
-#define GDK_O 0x04f
-#define GDK_P 0x050
-#define GDK_Q 0x051
-#define GDK_R 0x052
-#define GDK_S 0x053
-#define GDK_T 0x054
-#define GDK_U 0x055
-#define GDK_V 0x056
-#define GDK_W 0x057
-#define GDK_X 0x058
-#define GDK_Y 0x059
-#define GDK_Z 0x05a
-#define GDK_bracketleft 0x05b
-#define GDK_backslash 0x05c
-#define GDK_bracketright 0x05d
-#define GDK_asciicircum 0x05e
-#define GDK_underscore 0x05f
-#define GDK_grave 0x060
-#define GDK_quoteleft 0x060
-#define GDK_a 0x061
-#define GDK_b 0x062
-#define GDK_c 0x063
-#define GDK_d 0x064
-#define GDK_e 0x065
-#define GDK_f 0x066
-#define GDK_g 0x067
-#define GDK_h 0x068
-#define GDK_i 0x069
-#define GDK_j 0x06a
-#define GDK_k 0x06b
-#define GDK_l 0x06c
-#define GDK_m 0x06d
-#define GDK_n 0x06e
-#define GDK_o 0x06f
-#define GDK_p 0x070
-#define GDK_q 0x071
-#define GDK_r 0x072
-#define GDK_s 0x073
-#define GDK_t 0x074
-#define GDK_u 0x075
-#define GDK_v 0x076
-#define GDK_w 0x077
-#define GDK_x 0x078
-#define GDK_y 0x079
-#define GDK_z 0x07a
-#define GDK_braceleft 0x07b
-#define GDK_bar 0x07c
-#define GDK_braceright 0x07d
-#define GDK_asciitilde 0x07e
-#define GDK_nobreakspace 0x0a0
-#define GDK_exclamdown 0x0a1
-#define GDK_cent 0x0a2
-#define GDK_sterling 0x0a3
-#define GDK_currency 0x0a4
-#define GDK_yen 0x0a5
-#define GDK_brokenbar 0x0a6
-#define GDK_section 0x0a7
-#define GDK_diaeresis 0x0a8
-#define GDK_copyright 0x0a9
-#define GDK_ordfeminine 0x0aa
-#define GDK_guillemotleft 0x0ab
-#define GDK_notsign 0x0ac
-#define GDK_hyphen 0x0ad
-#define GDK_registered 0x0ae
-#define GDK_macron 0x0af
-#define GDK_degree 0x0b0
-#define GDK_plusminus 0x0b1
-#define GDK_twosuperior 0x0b2
-#define GDK_threesuperior 0x0b3
-#define GDK_acute 0x0b4
-#define GDK_mu 0x0b5
-#define GDK_paragraph 0x0b6
-#define GDK_periodcentered 0x0b7
-#define GDK_cedilla 0x0b8
-#define GDK_onesuperior 0x0b9
-#define GDK_masculine 0x0ba
-#define GDK_guillemotright 0x0bb
-#define GDK_onequarter 0x0bc
-#define GDK_onehalf 0x0bd
-#define GDK_threequarters 0x0be
-#define GDK_questiondown 0x0bf
-#define GDK_Agrave 0x0c0
-#define GDK_Aacute 0x0c1
-#define GDK_Acircumflex 0x0c2
-#define GDK_Atilde 0x0c3
-#define GDK_Adiaeresis 0x0c4
-#define GDK_Aring 0x0c5
-#define GDK_AE 0x0c6
-#define GDK_Ccedilla 0x0c7
-#define GDK_Egrave 0x0c8
-#define GDK_Eacute 0x0c9
-#define GDK_Ecircumflex 0x0ca
-#define GDK_Ediaeresis 0x0cb
-#define GDK_Igrave 0x0cc
-#define GDK_Iacute 0x0cd
-#define GDK_Icircumflex 0x0ce
-#define GDK_Idiaeresis 0x0cf
-#define GDK_ETH 0x0d0
-#define GDK_Eth 0x0d0
-#define GDK_Ntilde 0x0d1
-#define GDK_Ograve 0x0d2
-#define GDK_Oacute 0x0d3
-#define GDK_Ocircumflex 0x0d4
-#define GDK_Otilde 0x0d5
-#define GDK_Odiaeresis 0x0d6
-#define GDK_multiply 0x0d7
-#define GDK_Ooblique 0x0d8
-#define GDK_Ugrave 0x0d9
-#define GDK_Uacute 0x0da
-#define GDK_Ucircumflex 0x0db
-#define GDK_Udiaeresis 0x0dc
-#define GDK_Yacute 0x0dd
-#define GDK_THORN 0x0de
-#define GDK_Thorn 0x0de
-#define GDK_ssharp 0x0df
-#define GDK_agrave 0x0e0
-#define GDK_aacute 0x0e1
-#define GDK_acircumflex 0x0e2
-#define GDK_atilde 0x0e3
-#define GDK_adiaeresis 0x0e4
-#define GDK_aring 0x0e5
-#define GDK_ae 0x0e6
-#define GDK_ccedilla 0x0e7
-#define GDK_egrave 0x0e8
-#define GDK_eacute 0x0e9
-#define GDK_ecircumflex 0x0ea
-#define GDK_ediaeresis 0x0eb
-#define GDK_igrave 0x0ec
-#define GDK_iacute 0x0ed
-#define GDK_icircumflex 0x0ee
-#define GDK_idiaeresis 0x0ef
-#define GDK_eth 0x0f0
-#define GDK_ntilde 0x0f1
-#define GDK_ograve 0x0f2
-#define GDK_oacute 0x0f3
-#define GDK_ocircumflex 0x0f4
-#define GDK_otilde 0x0f5
-#define GDK_odiaeresis 0x0f6
-#define GDK_division 0x0f7
-#define GDK_oslash 0x0f8
-#define GDK_ugrave 0x0f9
-#define GDK_uacute 0x0fa
-#define GDK_ucircumflex 0x0fb
-#define GDK_udiaeresis 0x0fc
-#define GDK_yacute 0x0fd
-#define GDK_thorn 0x0fe
-#define GDK_ydiaeresis 0x0ff
-#define GDK_Aogonek 0x1a1
-#define GDK_breve 0x1a2
-#define GDK_Lstroke 0x1a3
-#define GDK_Lcaron 0x1a5
-#define GDK_Sacute 0x1a6
-#define GDK_Scaron 0x1a9
-#define GDK_Scedilla 0x1aa
-#define GDK_Tcaron 0x1ab
-#define GDK_Zacute 0x1ac
-#define GDK_Zcaron 0x1ae
-#define GDK_Zabovedot 0x1af
-#define GDK_aogonek 0x1b1
-#define GDK_ogonek 0x1b2
-#define GDK_lstroke 0x1b3
-#define GDK_lcaron 0x1b5
-#define GDK_sacute 0x1b6
-#define GDK_caron 0x1b7
-#define GDK_scaron 0x1b9
-#define GDK_scedilla 0x1ba
-#define GDK_tcaron 0x1bb
-#define GDK_zacute 0x1bc
-#define GDK_doubleacute 0x1bd
-#define GDK_zcaron 0x1be
-#define GDK_zabovedot 0x1bf
-#define GDK_Racute 0x1c0
-#define GDK_Abreve 0x1c3
-#define GDK_Lacute 0x1c5
-#define GDK_Cacute 0x1c6
-#define GDK_Ccaron 0x1c8
-#define GDK_Eogonek 0x1ca
-#define GDK_Ecaron 0x1cc
-#define GDK_Dcaron 0x1cf
-#define GDK_Dstroke 0x1d0
-#define GDK_Nacute 0x1d1
-#define GDK_Ncaron 0x1d2
-#define GDK_Odoubleacute 0x1d5
-#define GDK_Rcaron 0x1d8
-#define GDK_Uring 0x1d9
-#define GDK_Udoubleacute 0x1db
-#define GDK_Tcedilla 0x1de
-#define GDK_racute 0x1e0
-#define GDK_abreve 0x1e3
-#define GDK_lacute 0x1e5
-#define GDK_cacute 0x1e6
-#define GDK_ccaron 0x1e8
-#define GDK_eogonek 0x1ea
-#define GDK_ecaron 0x1ec
-#define GDK_dcaron 0x1ef
-#define GDK_dstroke 0x1f0
-#define GDK_nacute 0x1f1
-#define GDK_ncaron 0x1f2
-#define GDK_odoubleacute 0x1f5
-#define GDK_udoubleacute 0x1fb
-#define GDK_rcaron 0x1f8
-#define GDK_uring 0x1f9
-#define GDK_tcedilla 0x1fe
-#define GDK_abovedot 0x1ff
-#define GDK_Hstroke 0x2a1
-#define GDK_Hcircumflex 0x2a6
-#define GDK_Iabovedot 0x2a9
-#define GDK_Gbreve 0x2ab
-#define GDK_Jcircumflex 0x2ac
-#define GDK_hstroke 0x2b1
-#define GDK_hcircumflex 0x2b6
-#define GDK_idotless 0x2b9
-#define GDK_gbreve 0x2bb
-#define GDK_jcircumflex 0x2bc
-#define GDK_Cabovedot 0x2c5
-#define GDK_Ccircumflex 0x2c6
-#define GDK_Gabovedot 0x2d5
-#define GDK_Gcircumflex 0x2d8
-#define GDK_Ubreve 0x2dd
-#define GDK_Scircumflex 0x2de
-#define GDK_cabovedot 0x2e5
-#define GDK_ccircumflex 0x2e6
-#define GDK_gabovedot 0x2f5
-#define GDK_gcircumflex 0x2f8
-#define GDK_ubreve 0x2fd
-#define GDK_scircumflex 0x2fe
-#define GDK_kra 0x3a2
-#define GDK_kappa 0x3a2
-#define GDK_Rcedilla 0x3a3
-#define GDK_Itilde 0x3a5
-#define GDK_Lcedilla 0x3a6
-#define GDK_Emacron 0x3aa
-#define GDK_Gcedilla 0x3ab
-#define GDK_Tslash 0x3ac
-#define GDK_rcedilla 0x3b3
-#define GDK_itilde 0x3b5
-#define GDK_lcedilla 0x3b6
-#define GDK_emacron 0x3ba
-#define GDK_gcedilla 0x3bb
-#define GDK_tslash 0x3bc
-#define GDK_ENG 0x3bd
-#define GDK_eng 0x3bf
-#define GDK_Amacron 0x3c0
-#define GDK_Iogonek 0x3c7
-#define GDK_Eabovedot 0x3cc
-#define GDK_Imacron 0x3cf
-#define GDK_Ncedilla 0x3d1
-#define GDK_Omacron 0x3d2
-#define GDK_Kcedilla 0x3d3
-#define GDK_Uogonek 0x3d9
-#define GDK_Utilde 0x3dd
-#define GDK_Umacron 0x3de
-#define GDK_amacron 0x3e0
-#define GDK_iogonek 0x3e7
-#define GDK_eabovedot 0x3ec
-#define GDK_imacron 0x3ef
-#define GDK_ncedilla 0x3f1
-#define GDK_omacron 0x3f2
-#define GDK_kcedilla 0x3f3
-#define GDK_uogonek 0x3f9
-#define GDK_utilde 0x3fd
-#define GDK_umacron 0x3fe
-#define GDK_overline 0x47e
-#define GDK_kana_fullstop 0x4a1
-#define GDK_kana_openingbracket 0x4a2
-#define GDK_kana_closingbracket 0x4a3
-#define GDK_kana_comma 0x4a4
-#define GDK_kana_conjunctive 0x4a5
-#define GDK_kana_middledot 0x4a5
-#define GDK_kana_WO 0x4a6
-#define GDK_kana_a 0x4a7
-#define GDK_kana_i 0x4a8
-#define GDK_kana_u 0x4a9
-#define GDK_kana_e 0x4aa
-#define GDK_kana_o 0x4ab
-#define GDK_kana_ya 0x4ac
-#define GDK_kana_yu 0x4ad
-#define GDK_kana_yo 0x4ae
-#define GDK_kana_tsu 0x4af
-#define GDK_kana_tu 0x4af
-#define GDK_prolongedsound 0x4b0
-#define GDK_kana_A 0x4b1
-#define GDK_kana_I 0x4b2
-#define GDK_kana_U 0x4b3
-#define GDK_kana_E 0x4b4
-#define GDK_kana_O 0x4b5
-#define GDK_kana_KA 0x4b6
-#define GDK_kana_KI 0x4b7
-#define GDK_kana_KU 0x4b8
-#define GDK_kana_KE 0x4b9
-#define GDK_kana_KO 0x4ba
-#define GDK_kana_SA 0x4bb
-#define GDK_kana_SHI 0x4bc
-#define GDK_kana_SU 0x4bd
-#define GDK_kana_SE 0x4be
-#define GDK_kana_SO 0x4bf
-#define GDK_kana_TA 0x4c0
-#define GDK_kana_CHI 0x4c1
-#define GDK_kana_TI 0x4c1
-#define GDK_kana_TSU 0x4c2
-#define GDK_kana_TU 0x4c2
-#define GDK_kana_TE 0x4c3
-#define GDK_kana_TO 0x4c4
-#define GDK_kana_NA 0x4c5
-#define GDK_kana_NI 0x4c6
-#define GDK_kana_NU 0x4c7
-#define GDK_kana_NE 0x4c8
-#define GDK_kana_NO 0x4c9
-#define GDK_kana_HA 0x4ca
-#define GDK_kana_HI 0x4cb
-#define GDK_kana_FU 0x4cc
-#define GDK_kana_HU 0x4cc
-#define GDK_kana_HE 0x4cd
-#define GDK_kana_HO 0x4ce
-#define GDK_kana_MA 0x4cf
-#define GDK_kana_MI 0x4d0
-#define GDK_kana_MU 0x4d1
-#define GDK_kana_ME 0x4d2
-#define GDK_kana_MO 0x4d3
-#define GDK_kana_YA 0x4d4
-#define GDK_kana_YU 0x4d5
-#define GDK_kana_YO 0x4d6
-#define GDK_kana_RA 0x4d7
-#define GDK_kana_RI 0x4d8
-#define GDK_kana_RU 0x4d9
-#define GDK_kana_RE 0x4da
-#define GDK_kana_RO 0x4db
-#define GDK_kana_WA 0x4dc
-#define GDK_kana_N 0x4dd
-#define GDK_voicedsound 0x4de
-#define GDK_semivoicedsound 0x4df
-#define GDK_kana_switch 0xFF7E
-#define GDK_Arabic_comma 0x5ac
-#define GDK_Arabic_semicolon 0x5bb
-#define GDK_Arabic_question_mark 0x5bf
-#define GDK_Arabic_hamza 0x5c1
-#define GDK_Arabic_maddaonalef 0x5c2
-#define GDK_Arabic_hamzaonalef 0x5c3
-#define GDK_Arabic_hamzaonwaw 0x5c4
-#define GDK_Arabic_hamzaunderalef 0x5c5
-#define GDK_Arabic_hamzaonyeh 0x5c6
-#define GDK_Arabic_alef 0x5c7
-#define GDK_Arabic_beh 0x5c8
-#define GDK_Arabic_tehmarbuta 0x5c9
-#define GDK_Arabic_teh 0x5ca
-#define GDK_Arabic_theh 0x5cb
-#define GDK_Arabic_jeem 0x5cc
-#define GDK_Arabic_hah 0x5cd
-#define GDK_Arabic_khah 0x5ce
-#define GDK_Arabic_dal 0x5cf
-#define GDK_Arabic_thal 0x5d0
-#define GDK_Arabic_ra 0x5d1
-#define GDK_Arabic_zain 0x5d2
-#define GDK_Arabic_seen 0x5d3
-#define GDK_Arabic_sheen 0x5d4
-#define GDK_Arabic_sad 0x5d5
-#define GDK_Arabic_dad 0x5d6
-#define GDK_Arabic_tah 0x5d7
-#define GDK_Arabic_zah 0x5d8
-#define GDK_Arabic_ain 0x5d9
-#define GDK_Arabic_ghain 0x5da
-#define GDK_Arabic_tatweel 0x5e0
-#define GDK_Arabic_feh 0x5e1
-#define GDK_Arabic_qaf 0x5e2
-#define GDK_Arabic_kaf 0x5e3
-#define GDK_Arabic_lam 0x5e4
-#define GDK_Arabic_meem 0x5e5
-#define GDK_Arabic_noon 0x5e6
-#define GDK_Arabic_ha 0x5e7
-#define GDK_Arabic_heh 0x5e7
-#define GDK_Arabic_waw 0x5e8
-#define GDK_Arabic_alefmaksura 0x5e9
-#define GDK_Arabic_yeh 0x5ea
-#define GDK_Arabic_fathatan 0x5eb
-#define GDK_Arabic_dammatan 0x5ec
-#define GDK_Arabic_kasratan 0x5ed
-#define GDK_Arabic_fatha 0x5ee
-#define GDK_Arabic_damma 0x5ef
-#define GDK_Arabic_kasra 0x5f0
-#define GDK_Arabic_shadda 0x5f1
-#define GDK_Arabic_sukun 0x5f2
-#define GDK_Arabic_switch 0xFF7E
-#define GDK_Serbian_dje 0x6a1
-#define GDK_Macedonia_gje 0x6a2
-#define GDK_Cyrillic_io 0x6a3
-#define GDK_Ukrainian_ie 0x6a4
-#define GDK_Ukranian_je 0x6a4
-#define GDK_Macedonia_dse 0x6a5
-#define GDK_Ukrainian_i 0x6a6
-#define GDK_Ukranian_i 0x6a6
-#define GDK_Ukrainian_yi 0x6a7
-#define GDK_Ukranian_yi 0x6a7
-#define GDK_Cyrillic_je 0x6a8
-#define GDK_Serbian_je 0x6a8
-#define GDK_Cyrillic_lje 0x6a9
-#define GDK_Serbian_lje 0x6a9
-#define GDK_Cyrillic_nje 0x6aa
-#define GDK_Serbian_nje 0x6aa
-#define GDK_Serbian_tshe 0x6ab
-#define GDK_Macedonia_kje 0x6ac
-#define GDK_Byelorussian_shortu 0x6ae
-#define GDK_Cyrillic_dzhe 0x6af
-#define GDK_Serbian_dze 0x6af
-#define GDK_numerosign 0x6b0
-#define GDK_Serbian_DJE 0x6b1
-#define GDK_Macedonia_GJE 0x6b2
-#define GDK_Cyrillic_IO 0x6b3
-#define GDK_Ukrainian_IE 0x6b4
-#define GDK_Ukranian_JE 0x6b4
-#define GDK_Macedonia_DSE 0x6b5
-#define GDK_Ukrainian_I 0x6b6
-#define GDK_Ukranian_I 0x6b6
-#define GDK_Ukrainian_YI 0x6b7
-#define GDK_Ukranian_YI 0x6b7
-#define GDK_Cyrillic_JE 0x6b8
-#define GDK_Serbian_JE 0x6b8
-#define GDK_Cyrillic_LJE 0x6b9
-#define GDK_Serbian_LJE 0x6b9
-#define GDK_Cyrillic_NJE 0x6ba
-#define GDK_Serbian_NJE 0x6ba
-#define GDK_Serbian_TSHE 0x6bb
-#define GDK_Macedonia_KJE 0x6bc
-#define GDK_Byelorussian_SHORTU 0x6be
-#define GDK_Cyrillic_DZHE 0x6bf
-#define GDK_Serbian_DZE 0x6bf
-#define GDK_Cyrillic_yu 0x6c0
-#define GDK_Cyrillic_a 0x6c1
-#define GDK_Cyrillic_be 0x6c2
-#define GDK_Cyrillic_tse 0x6c3
-#define GDK_Cyrillic_de 0x6c4
-#define GDK_Cyrillic_ie 0x6c5
-#define GDK_Cyrillic_ef 0x6c6
-#define GDK_Cyrillic_ghe 0x6c7
-#define GDK_Cyrillic_ha 0x6c8
-#define GDK_Cyrillic_i 0x6c9
-#define GDK_Cyrillic_shorti 0x6ca
-#define GDK_Cyrillic_ka 0x6cb
-#define GDK_Cyrillic_el 0x6cc
-#define GDK_Cyrillic_em 0x6cd
-#define GDK_Cyrillic_en 0x6ce
-#define GDK_Cyrillic_o 0x6cf
-#define GDK_Cyrillic_pe 0x6d0
-#define GDK_Cyrillic_ya 0x6d1
-#define GDK_Cyrillic_er 0x6d2
-#define GDK_Cyrillic_es 0x6d3
-#define GDK_Cyrillic_te 0x6d4
-#define GDK_Cyrillic_u 0x6d5
-#define GDK_Cyrillic_zhe 0x6d6
-#define GDK_Cyrillic_ve 0x6d7
-#define GDK_Cyrillic_softsign 0x6d8
-#define GDK_Cyrillic_yeru 0x6d9
-#define GDK_Cyrillic_ze 0x6da
-#define GDK_Cyrillic_sha 0x6db
-#define GDK_Cyrillic_e 0x6dc
-#define GDK_Cyrillic_shcha 0x6dd
-#define GDK_Cyrillic_che 0x6de
-#define GDK_Cyrillic_hardsign 0x6df
-#define GDK_Cyrillic_YU 0x6e0
-#define GDK_Cyrillic_A 0x6e1
-#define GDK_Cyrillic_BE 0x6e2
-#define GDK_Cyrillic_TSE 0x6e3
-#define GDK_Cyrillic_DE 0x6e4
-#define GDK_Cyrillic_IE 0x6e5
-#define GDK_Cyrillic_EF 0x6e6
-#define GDK_Cyrillic_GHE 0x6e7
-#define GDK_Cyrillic_HA 0x6e8
-#define GDK_Cyrillic_I 0x6e9
-#define GDK_Cyrillic_SHORTI 0x6ea
-#define GDK_Cyrillic_KA 0x6eb
-#define GDK_Cyrillic_EL 0x6ec
-#define GDK_Cyrillic_EM 0x6ed
-#define GDK_Cyrillic_EN 0x6ee
-#define GDK_Cyrillic_O 0x6ef
-#define GDK_Cyrillic_PE 0x6f0
-#define GDK_Cyrillic_YA 0x6f1
-#define GDK_Cyrillic_ER 0x6f2
-#define GDK_Cyrillic_ES 0x6f3
-#define GDK_Cyrillic_TE 0x6f4
-#define GDK_Cyrillic_U 0x6f5
-#define GDK_Cyrillic_ZHE 0x6f6
-#define GDK_Cyrillic_VE 0x6f7
-#define GDK_Cyrillic_SOFTSIGN 0x6f8
-#define GDK_Cyrillic_YERU 0x6f9
-#define GDK_Cyrillic_ZE 0x6fa
-#define GDK_Cyrillic_SHA 0x6fb
-#define GDK_Cyrillic_E 0x6fc
-#define GDK_Cyrillic_SHCHA 0x6fd
-#define GDK_Cyrillic_CHE 0x6fe
-#define GDK_Cyrillic_HARDSIGN 0x6ff
-#define GDK_Greek_ALPHAaccent 0x7a1
-#define GDK_Greek_EPSILONaccent 0x7a2
-#define GDK_Greek_ETAaccent 0x7a3
-#define GDK_Greek_IOTAaccent 0x7a4
-#define GDK_Greek_IOTAdiaeresis 0x7a5
-#define GDK_Greek_OMICRONaccent 0x7a7
-#define GDK_Greek_UPSILONaccent 0x7a8
-#define GDK_Greek_UPSILONdieresis 0x7a9
-#define GDK_Greek_OMEGAaccent 0x7ab
-#define GDK_Greek_accentdieresis 0x7ae
-#define GDK_Greek_horizbar 0x7af
-#define GDK_Greek_alphaaccent 0x7b1
-#define GDK_Greek_epsilonaccent 0x7b2
-#define GDK_Greek_etaaccent 0x7b3
-#define GDK_Greek_iotaaccent 0x7b4
-#define GDK_Greek_iotadieresis 0x7b5
-#define GDK_Greek_iotaaccentdieresis 0x7b6
-#define GDK_Greek_omicronaccent 0x7b7
-#define GDK_Greek_upsilonaccent 0x7b8
-#define GDK_Greek_upsilondieresis 0x7b9
-#define GDK_Greek_upsilonaccentdieresis 0x7ba
-#define GDK_Greek_omegaaccent 0x7bb
-#define GDK_Greek_ALPHA 0x7c1
-#define GDK_Greek_BETA 0x7c2
-#define GDK_Greek_GAMMA 0x7c3
-#define GDK_Greek_DELTA 0x7c4
-#define GDK_Greek_EPSILON 0x7c5
-#define GDK_Greek_ZETA 0x7c6
-#define GDK_Greek_ETA 0x7c7
-#define GDK_Greek_THETA 0x7c8
-#define GDK_Greek_IOTA 0x7c9
-#define GDK_Greek_KAPPA 0x7ca
-#define GDK_Greek_LAMDA 0x7cb
-#define GDK_Greek_LAMBDA 0x7cb
-#define GDK_Greek_MU 0x7cc
-#define GDK_Greek_NU 0x7cd
-#define GDK_Greek_XI 0x7ce
-#define GDK_Greek_OMICRON 0x7cf
-#define GDK_Greek_PI 0x7d0
-#define GDK_Greek_RHO 0x7d1
-#define GDK_Greek_SIGMA 0x7d2
-#define GDK_Greek_TAU 0x7d4
-#define GDK_Greek_UPSILON 0x7d5
-#define GDK_Greek_PHI 0x7d6
-#define GDK_Greek_CHI 0x7d7
-#define GDK_Greek_PSI 0x7d8
-#define GDK_Greek_OMEGA 0x7d9
-#define GDK_Greek_alpha 0x7e1
-#define GDK_Greek_beta 0x7e2
-#define GDK_Greek_gamma 0x7e3
-#define GDK_Greek_delta 0x7e4
-#define GDK_Greek_epsilon 0x7e5
-#define GDK_Greek_zeta 0x7e6
-#define GDK_Greek_eta 0x7e7
-#define GDK_Greek_theta 0x7e8
-#define GDK_Greek_iota 0x7e9
-#define GDK_Greek_kappa 0x7ea
-#define GDK_Greek_lamda 0x7eb
-#define GDK_Greek_lambda 0x7eb
-#define GDK_Greek_mu 0x7ec
-#define GDK_Greek_nu 0x7ed
-#define GDK_Greek_xi 0x7ee
-#define GDK_Greek_omicron 0x7ef
-#define GDK_Greek_pi 0x7f0
-#define GDK_Greek_rho 0x7f1
-#define GDK_Greek_sigma 0x7f2
-#define GDK_Greek_finalsmallsigma 0x7f3
-#define GDK_Greek_tau 0x7f4
-#define GDK_Greek_upsilon 0x7f5
-#define GDK_Greek_phi 0x7f6
-#define GDK_Greek_chi 0x7f7
-#define GDK_Greek_psi 0x7f8
-#define GDK_Greek_omega 0x7f9
-#define GDK_Greek_switch 0xFF7E
-#define GDK_leftradical 0x8a1
-#define GDK_topleftradical 0x8a2
-#define GDK_horizconnector 0x8a3
-#define GDK_topintegral 0x8a4
-#define GDK_botintegral 0x8a5
-#define GDK_vertconnector 0x8a6
-#define GDK_topleftsqbracket 0x8a7
-#define GDK_botleftsqbracket 0x8a8
-#define GDK_toprightsqbracket 0x8a9
-#define GDK_botrightsqbracket 0x8aa
-#define GDK_topleftparens 0x8ab
-#define GDK_botleftparens 0x8ac
-#define GDK_toprightparens 0x8ad
-#define GDK_botrightparens 0x8ae
-#define GDK_leftmiddlecurlybrace 0x8af
-#define GDK_rightmiddlecurlybrace 0x8b0
-#define GDK_topleftsummation 0x8b1
-#define GDK_botleftsummation 0x8b2
-#define GDK_topvertsummationconnector 0x8b3
-#define GDK_botvertsummationconnector 0x8b4
-#define GDK_toprightsummation 0x8b5
-#define GDK_botrightsummation 0x8b6
-#define GDK_rightmiddlesummation 0x8b7
-#define GDK_lessthanequal 0x8bc
-#define GDK_notequal 0x8bd
-#define GDK_greaterthanequal 0x8be
-#define GDK_integral 0x8bf
-#define GDK_therefore 0x8c0
-#define GDK_variation 0x8c1
-#define GDK_infinity 0x8c2
-#define GDK_nabla 0x8c5
-#define GDK_approximate 0x8c8
-#define GDK_similarequal 0x8c9
-#define GDK_ifonlyif 0x8cd
-#define GDK_implies 0x8ce
-#define GDK_identical 0x8cf
-#define GDK_radical 0x8d6
-#define GDK_includedin 0x8da
-#define GDK_includes 0x8db
-#define GDK_intersection 0x8dc
-#define GDK_union 0x8dd
-#define GDK_logicaland 0x8de
-#define GDK_logicalor 0x8df
-#define GDK_partialderivative 0x8ef
-#define GDK_function 0x8f6
-#define GDK_leftarrow 0x8fb
-#define GDK_uparrow 0x8fc
-#define GDK_rightarrow 0x8fd
-#define GDK_downarrow 0x8fe
-#define GDK_blank 0x9df
-#define GDK_soliddiamond 0x9e0
-#define GDK_checkerboard 0x9e1
-#define GDK_ht 0x9e2
-#define GDK_ff 0x9e3
-#define GDK_cr 0x9e4
-#define GDK_lf 0x9e5
-#define GDK_nl 0x9e8
-#define GDK_vt 0x9e9
-#define GDK_lowrightcorner 0x9ea
-#define GDK_uprightcorner 0x9eb
-#define GDK_upleftcorner 0x9ec
-#define GDK_lowleftcorner 0x9ed
-#define GDK_crossinglines 0x9ee
-#define GDK_horizlinescan1 0x9ef
-#define GDK_horizlinescan3 0x9f0
-#define GDK_horizlinescan5 0x9f1
-#define GDK_horizlinescan7 0x9f2
-#define GDK_horizlinescan9 0x9f3
-#define GDK_leftt 0x9f4
-#define GDK_rightt 0x9f5
-#define GDK_bott 0x9f6
-#define GDK_topt 0x9f7
-#define GDK_vertbar 0x9f8
-#define GDK_emspace 0xaa1
-#define GDK_enspace 0xaa2
-#define GDK_em3space 0xaa3
-#define GDK_em4space 0xaa4
-#define GDK_digitspace 0xaa5
-#define GDK_punctspace 0xaa6
-#define GDK_thinspace 0xaa7
-#define GDK_hairspace 0xaa8
-#define GDK_emdash 0xaa9
-#define GDK_endash 0xaaa
-#define GDK_signifblank 0xaac
-#define GDK_ellipsis 0xaae
-#define GDK_doubbaselinedot 0xaaf
-#define GDK_onethird 0xab0
-#define GDK_twothirds 0xab1
-#define GDK_onefifth 0xab2
-#define GDK_twofifths 0xab3
-#define GDK_threefifths 0xab4
-#define GDK_fourfifths 0xab5
-#define GDK_onesixth 0xab6
-#define GDK_fivesixths 0xab7
-#define GDK_careof 0xab8
-#define GDK_figdash 0xabb
-#define GDK_leftanglebracket 0xabc
-#define GDK_decimalpoint 0xabd
-#define GDK_rightanglebracket 0xabe
-#define GDK_marker 0xabf
-#define GDK_oneeighth 0xac3
-#define GDK_threeeighths 0xac4
-#define GDK_fiveeighths 0xac5
-#define GDK_seveneighths 0xac6
-#define GDK_trademark 0xac9
-#define GDK_signaturemark 0xaca
-#define GDK_trademarkincircle 0xacb
-#define GDK_leftopentriangle 0xacc
-#define GDK_rightopentriangle 0xacd
-#define GDK_emopencircle 0xace
-#define GDK_emopenrectangle 0xacf
-#define GDK_leftsinglequotemark 0xad0
-#define GDK_rightsinglequotemark 0xad1
-#define GDK_leftdoublequotemark 0xad2
-#define GDK_rightdoublequotemark 0xad3
-#define GDK_prescription 0xad4
-#define GDK_minutes 0xad6
-#define GDK_seconds 0xad7
-#define GDK_latincross 0xad9
-#define GDK_hexagram 0xada
-#define GDK_filledrectbullet 0xadb
-#define GDK_filledlefttribullet 0xadc
-#define GDK_filledrighttribullet 0xadd
-#define GDK_emfilledcircle 0xade
-#define GDK_emfilledrect 0xadf
-#define GDK_enopencircbullet 0xae0
-#define GDK_enopensquarebullet 0xae1
-#define GDK_openrectbullet 0xae2
-#define GDK_opentribulletup 0xae3
-#define GDK_opentribulletdown 0xae4
-#define GDK_openstar 0xae5
-#define GDK_enfilledcircbullet 0xae6
-#define GDK_enfilledsqbullet 0xae7
-#define GDK_filledtribulletup 0xae8
-#define GDK_filledtribulletdown 0xae9
-#define GDK_leftpointer 0xaea
-#define GDK_rightpointer 0xaeb
-#define GDK_club 0xaec
-#define GDK_diamond 0xaed
-#define GDK_heart 0xaee
-#define GDK_maltesecross 0xaf0
-#define GDK_dagger 0xaf1
-#define GDK_doubledagger 0xaf2
-#define GDK_checkmark 0xaf3
-#define GDK_ballotcross 0xaf4
-#define GDK_musicalsharp 0xaf5
-#define GDK_musicalflat 0xaf6
-#define GDK_malesymbol 0xaf7
-#define GDK_femalesymbol 0xaf8
-#define GDK_telephone 0xaf9
-#define GDK_telephonerecorder 0xafa
-#define GDK_phonographcopyright 0xafb
-#define GDK_caret 0xafc
-#define GDK_singlelowquotemark 0xafd
-#define GDK_doublelowquotemark 0xafe
-#define GDK_cursor 0xaff
-#define GDK_leftcaret 0xba3
-#define GDK_rightcaret 0xba6
-#define GDK_downcaret 0xba8
-#define GDK_upcaret 0xba9
-#define GDK_overbar 0xbc0
-#define GDK_downtack 0xbc2
-#define GDK_upshoe 0xbc3
-#define GDK_downstile 0xbc4
-#define GDK_underbar 0xbc6
-#define GDK_jot 0xbca
-#define GDK_quad 0xbcc
-#define GDK_uptack 0xbce
-#define GDK_circle 0xbcf
-#define GDK_upstile 0xbd3
-#define GDK_downshoe 0xbd6
-#define GDK_rightshoe 0xbd8
-#define GDK_leftshoe 0xbda
-#define GDK_lefttack 0xbdc
-#define GDK_righttack 0xbfc
-#define GDK_hebrew_doublelowline 0xcdf
-#define GDK_hebrew_aleph 0xce0
-#define GDK_hebrew_bet 0xce1
-#define GDK_hebrew_beth 0xce1
-#define GDK_hebrew_gimel 0xce2
-#define GDK_hebrew_gimmel 0xce2
-#define GDK_hebrew_dalet 0xce3
-#define GDK_hebrew_daleth 0xce3
-#define GDK_hebrew_he 0xce4
-#define GDK_hebrew_waw 0xce5
-#define GDK_hebrew_zain 0xce6
-#define GDK_hebrew_zayin 0xce6
-#define GDK_hebrew_chet 0xce7
-#define GDK_hebrew_het 0xce7
-#define GDK_hebrew_tet 0xce8
-#define GDK_hebrew_teth 0xce8
-#define GDK_hebrew_yod 0xce9
-#define GDK_hebrew_finalkaph 0xcea
-#define GDK_hebrew_kaph 0xceb
-#define GDK_hebrew_lamed 0xcec
-#define GDK_hebrew_finalmem 0xced
-#define GDK_hebrew_mem 0xcee
-#define GDK_hebrew_finalnun 0xcef
-#define GDK_hebrew_nun 0xcf0
-#define GDK_hebrew_samech 0xcf1
-#define GDK_hebrew_samekh 0xcf1
-#define GDK_hebrew_ayin 0xcf2
-#define GDK_hebrew_finalpe 0xcf3
-#define GDK_hebrew_pe 0xcf4
-#define GDK_hebrew_finalzade 0xcf5
-#define GDK_hebrew_finalzadi 0xcf5
-#define GDK_hebrew_zade 0xcf6
-#define GDK_hebrew_zadi 0xcf6
-#define GDK_hebrew_qoph 0xcf7
-#define GDK_hebrew_kuf 0xcf7
-#define GDK_hebrew_resh 0xcf8
-#define GDK_hebrew_shin 0xcf9
-#define GDK_hebrew_taw 0xcfa
-#define GDK_hebrew_taf 0xcfa
-#define GDK_Hebrew_switch 0xFF7E
-#define GDK_Thai_kokai 0xda1
-#define GDK_Thai_khokhai 0xda2
-#define GDK_Thai_khokhuat 0xda3
-#define GDK_Thai_khokhwai 0xda4
-#define GDK_Thai_khokhon 0xda5
-#define GDK_Thai_khorakhang 0xda6
-#define GDK_Thai_ngongu 0xda7
-#define GDK_Thai_chochan 0xda8
-#define GDK_Thai_choching 0xda9
-#define GDK_Thai_chochang 0xdaa
-#define GDK_Thai_soso 0xdab
-#define GDK_Thai_chochoe 0xdac
-#define GDK_Thai_yoying 0xdad
-#define GDK_Thai_dochada 0xdae
-#define GDK_Thai_topatak 0xdaf
-#define GDK_Thai_thothan 0xdb0
-#define GDK_Thai_thonangmontho 0xdb1
-#define GDK_Thai_thophuthao 0xdb2
-#define GDK_Thai_nonen 0xdb3
-#define GDK_Thai_dodek 0xdb4
-#define GDK_Thai_totao 0xdb5
-#define GDK_Thai_thothung 0xdb6
-#define GDK_Thai_thothahan 0xdb7
-#define GDK_Thai_thothong 0xdb8
-#define GDK_Thai_nonu 0xdb9
-#define GDK_Thai_bobaimai 0xdba
-#define GDK_Thai_popla 0xdbb
-#define GDK_Thai_phophung 0xdbc
-#define GDK_Thai_fofa 0xdbd
-#define GDK_Thai_phophan 0xdbe
-#define GDK_Thai_fofan 0xdbf
-#define GDK_Thai_phosamphao 0xdc0
-#define GDK_Thai_moma 0xdc1
-#define GDK_Thai_yoyak 0xdc2
-#define GDK_Thai_rorua 0xdc3
-#define GDK_Thai_ru 0xdc4
-#define GDK_Thai_loling 0xdc5
-#define GDK_Thai_lu 0xdc6
-#define GDK_Thai_wowaen 0xdc7
-#define GDK_Thai_sosala 0xdc8
-#define GDK_Thai_sorusi 0xdc9
-#define GDK_Thai_sosua 0xdca
-#define GDK_Thai_hohip 0xdcb
-#define GDK_Thai_lochula 0xdcc
-#define GDK_Thai_oang 0xdcd
-#define GDK_Thai_honokhuk 0xdce
-#define GDK_Thai_paiyannoi 0xdcf
-#define GDK_Thai_saraa 0xdd0
-#define GDK_Thai_maihanakat 0xdd1
-#define GDK_Thai_saraaa 0xdd2
-#define GDK_Thai_saraam 0xdd3
-#define GDK_Thai_sarai 0xdd4
-#define GDK_Thai_saraii 0xdd5
-#define GDK_Thai_saraue 0xdd6
-#define GDK_Thai_sarauee 0xdd7
-#define GDK_Thai_sarau 0xdd8
-#define GDK_Thai_sarauu 0xdd9
-#define GDK_Thai_phinthu 0xdda
-#define GDK_Thai_maihanakat_maitho 0xdde
-#define GDK_Thai_baht 0xddf
-#define GDK_Thai_sarae 0xde0
-#define GDK_Thai_saraae 0xde1
-#define GDK_Thai_sarao 0xde2
-#define GDK_Thai_saraaimaimuan 0xde3
-#define GDK_Thai_saraaimaimalai 0xde4
-#define GDK_Thai_lakkhangyao 0xde5
-#define GDK_Thai_maiyamok 0xde6
-#define GDK_Thai_maitaikhu 0xde7
-#define GDK_Thai_maiek 0xde8
-#define GDK_Thai_maitho 0xde9
-#define GDK_Thai_maitri 0xdea
-#define GDK_Thai_maichattawa 0xdeb
-#define GDK_Thai_thanthakhat 0xdec
-#define GDK_Thai_nikhahit 0xded
-#define GDK_Thai_leksun 0xdf0
-#define GDK_Thai_leknung 0xdf1
-#define GDK_Thai_leksong 0xdf2
-#define GDK_Thai_leksam 0xdf3
-#define GDK_Thai_leksi 0xdf4
-#define GDK_Thai_lekha 0xdf5
-#define GDK_Thai_lekhok 0xdf6
-#define GDK_Thai_lekchet 0xdf7
-#define GDK_Thai_lekpaet 0xdf8
-#define GDK_Thai_lekkao 0xdf9
-#define GDK_Hangul 0xff31
-#define GDK_Hangul_Start 0xff32
-#define GDK_Hangul_End 0xff33
-#define GDK_Hangul_Hanja 0xff34
-#define GDK_Hangul_Jamo 0xff35
-#define GDK_Hangul_Romaja 0xff36
-#define GDK_Hangul_Codeinput 0xff37
-#define GDK_Hangul_Jeonja 0xff38
-#define GDK_Hangul_Banja 0xff39
-#define GDK_Hangul_PreHanja 0xff3a
-#define GDK_Hangul_PostHanja 0xff3b
-#define GDK_Hangul_SingleCandidate 0xff3c
-#define GDK_Hangul_MultipleCandidate 0xff3d
-#define GDK_Hangul_PreviousCandidate 0xff3e
-#define GDK_Hangul_Special 0xff3f
-#define GDK_Hangul_switch 0xFF7E
-#define GDK_Hangul_Kiyeog 0xea1
-#define GDK_Hangul_SsangKiyeog 0xea2
-#define GDK_Hangul_KiyeogSios 0xea3
-#define GDK_Hangul_Nieun 0xea4
-#define GDK_Hangul_NieunJieuj 0xea5
-#define GDK_Hangul_NieunHieuh 0xea6
-#define GDK_Hangul_Dikeud 0xea7
-#define GDK_Hangul_SsangDikeud 0xea8
-#define GDK_Hangul_Rieul 0xea9
-#define GDK_Hangul_RieulKiyeog 0xeaa
-#define GDK_Hangul_RieulMieum 0xeab
-#define GDK_Hangul_RieulPieub 0xeac
-#define GDK_Hangul_RieulSios 0xead
-#define GDK_Hangul_RieulTieut 0xeae
-#define GDK_Hangul_RieulPhieuf 0xeaf
-#define GDK_Hangul_RieulHieuh 0xeb0
-#define GDK_Hangul_Mieum 0xeb1
-#define GDK_Hangul_Pieub 0xeb2
-#define GDK_Hangul_SsangPieub 0xeb3
-#define GDK_Hangul_PieubSios 0xeb4
-#define GDK_Hangul_Sios 0xeb5
-#define GDK_Hangul_SsangSios 0xeb6
-#define GDK_Hangul_Ieung 0xeb7
-#define GDK_Hangul_Jieuj 0xeb8
-#define GDK_Hangul_SsangJieuj 0xeb9
-#define GDK_Hangul_Cieuc 0xeba
-#define GDK_Hangul_Khieuq 0xebb
-#define GDK_Hangul_Tieut 0xebc
-#define GDK_Hangul_Phieuf 0xebd
-#define GDK_Hangul_Hieuh 0xebe
-#define GDK_Hangul_A 0xebf
-#define GDK_Hangul_AE 0xec0
-#define GDK_Hangul_YA 0xec1
-#define GDK_Hangul_YAE 0xec2
-#define GDK_Hangul_EO 0xec3
-#define GDK_Hangul_E 0xec4
-#define GDK_Hangul_YEO 0xec5
-#define GDK_Hangul_YE 0xec6
-#define GDK_Hangul_O 0xec7
-#define GDK_Hangul_WA 0xec8
-#define GDK_Hangul_WAE 0xec9
-#define GDK_Hangul_OE 0xeca
-#define GDK_Hangul_YO 0xecb
-#define GDK_Hangul_U 0xecc
-#define GDK_Hangul_WEO 0xecd
-#define GDK_Hangul_WE 0xece
-#define GDK_Hangul_WI 0xecf
-#define GDK_Hangul_YU 0xed0
-#define GDK_Hangul_EU 0xed1
-#define GDK_Hangul_YI 0xed2
-#define GDK_Hangul_I 0xed3
-#define GDK_Hangul_J_Kiyeog 0xed4
-#define GDK_Hangul_J_SsangKiyeog 0xed5
-#define GDK_Hangul_J_KiyeogSios 0xed6
-#define GDK_Hangul_J_Nieun 0xed7
-#define GDK_Hangul_J_NieunJieuj 0xed8
-#define GDK_Hangul_J_NieunHieuh 0xed9
-#define GDK_Hangul_J_Dikeud 0xeda
-#define GDK_Hangul_J_Rieul 0xedb
-#define GDK_Hangul_J_RieulKiyeog 0xedc
-#define GDK_Hangul_J_RieulMieum 0xedd
-#define GDK_Hangul_J_RieulPieub 0xede
-#define GDK_Hangul_J_RieulSios 0xedf
-#define GDK_Hangul_J_RieulTieut 0xee0
-#define GDK_Hangul_J_RieulPhieuf 0xee1
-#define GDK_Hangul_J_RieulHieuh 0xee2
-#define GDK_Hangul_J_Mieum 0xee3
-#define GDK_Hangul_J_Pieub 0xee4
-#define GDK_Hangul_J_PieubSios 0xee5
-#define GDK_Hangul_J_Sios 0xee6
-#define GDK_Hangul_J_SsangSios 0xee7
-#define GDK_Hangul_J_Ieung 0xee8
-#define GDK_Hangul_J_Jieuj 0xee9
-#define GDK_Hangul_J_Cieuc 0xeea
-#define GDK_Hangul_J_Khieuq 0xeeb
-#define GDK_Hangul_J_Tieut 0xeec
-#define GDK_Hangul_J_Phieuf 0xeed
-#define GDK_Hangul_J_Hieuh 0xeee
-#define GDK_Hangul_RieulYeorinHieuh 0xeef
-#define GDK_Hangul_SunkyeongeumMieum 0xef0
-#define GDK_Hangul_SunkyeongeumPieub 0xef1
-#define GDK_Hangul_PanSios 0xef2
-#define GDK_Hangul_KkogjiDalrinIeung 0xef3
-#define GDK_Hangul_SunkyeongeumPhieuf 0xef4
-#define GDK_Hangul_YeorinHieuh 0xef5
-#define GDK_Hangul_AraeA 0xef6
-#define GDK_Hangul_AraeAE 0xef7
-#define GDK_Hangul_J_PanSios 0xef8
-#define GDK_Hangul_J_KkogjiDalrinIeung 0xef9
-#define GDK_Hangul_J_YeorinHieuh 0xefa
-#define GDK_Korean_Won 0xeff
diff --git a/gdk/gdkpixmap.c b/gdk/gdkpixmap.c
deleted file mode 100644
index 6fbdada880..0000000000
--- a/gdk/gdkpixmap.c
+++ /dev/null
@@ -1,734 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "../config.h"
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-/* Needed for SEEK_END in SunOS */
-#include <unistd.h>
-#include <X11/Xlib.h>
-
-#include "gdk.h"
-#include "gdkprivate.h"
-
-typedef struct
-{
- gchar *color_string;
- GdkColor color;
- gint transparent;
-} _GdkPixmapColor;
-
-GdkPixmap*
-gdk_pixmap_new (GdkWindow *window,
- gint width,
- gint height,
- gint depth)
-{
- GdkPixmap *pixmap;
- GdkWindowPrivate *private;
- GdkWindowPrivate *window_private;
-
- g_return_val_if_fail ((window != NULL) || (depth != -1), NULL);
-
- if (!window)
- window = (GdkWindow*) &gdk_root_parent;
-
- window_private = (GdkWindowPrivate*) window;
- if (window_private->destroyed)
- return NULL;
-
- if (depth == -1)
- gdk_window_get_geometry (window, NULL, NULL, NULL, NULL, &depth);
-
- private = g_new (GdkWindowPrivate, 1);
- pixmap = (GdkPixmap*) private;
-
- private->xdisplay = window_private->xdisplay;
- private->window_type = GDK_WINDOW_PIXMAP;
- private->xwindow = XCreatePixmap (private->xdisplay, window_private->xwindow,
- width, height, depth);
- private->parent = NULL;
- private->x = 0;
- private->y = 0;
- private->width = width;
- private->height = height;
- private->resize_count = 0;
- private->ref_count = 1;
- private->destroyed = 0;
-
- gdk_xid_table_insert (&private->xwindow, pixmap);
-
- return pixmap;
-}
-
-GdkPixmap *
-gdk_bitmap_create_from_data (GdkWindow *window,
- gchar *data,
- gint width,
- gint height)
-{
- GdkPixmap *pixmap;
- GdkWindowPrivate *private;
- GdkWindowPrivate *window_private;
-
- g_return_val_if_fail (data != NULL, NULL);
-
- if (!window)
- window = (GdkWindow*) &gdk_root_parent;
-
- window_private = (GdkWindowPrivate*) window;
- if (window_private->destroyed)
- return NULL;
-
- private = g_new (GdkWindowPrivate, 1);
- pixmap = (GdkPixmap*) private;
-
- private->parent = NULL;
- private->xdisplay = window_private->xdisplay;
- private->window_type = GDK_WINDOW_PIXMAP;
- private->x = 0;
- private->y = 0;
- private->width = width;
- private->height = height;
- private->resize_count = 0;
- private->ref_count = 1;
- private->destroyed = FALSE;
-
- private->xwindow = XCreateBitmapFromData (private->xdisplay,
- window_private->xwindow,
- data, width, height);
-
- gdk_xid_table_insert (&private->xwindow, pixmap);
-
- return pixmap;
-}
-
-GdkPixmap*
-gdk_pixmap_create_from_data (GdkWindow *window,
- gchar *data,
- gint width,
- gint height,
- gint depth,
- GdkColor *fg,
- GdkColor *bg)
-{
- GdkPixmap *pixmap;
- GdkWindowPrivate *private;
- GdkWindowPrivate *window_private;
-
- g_return_val_if_fail (data != NULL, NULL);
- g_return_val_if_fail (fg != NULL, NULL);
- g_return_val_if_fail (bg != NULL, NULL);
- g_return_val_if_fail ((window != NULL) || (depth != -1), NULL);
-
- if (!window)
- window = (GdkWindow*) &gdk_root_parent;
-
- window_private = (GdkWindowPrivate*) window;
- if (window_private->destroyed)
- return NULL;
-
- if (depth == -1)
- gdk_window_get_geometry (window, NULL, NULL, NULL, NULL, &depth);
-
- private = g_new (GdkWindowPrivate, 1);
- pixmap = (GdkPixmap*) private;
-
- private->parent = NULL;
- private->xdisplay = window_private->xdisplay;
- private->window_type = GDK_WINDOW_PIXMAP;
- private->x = 0;
- private->y = 0;
- private->width = width;
- private->height = height;
- private->resize_count = 0;
- private->ref_count = 1;
- private->destroyed = FALSE;
-
- private->xwindow = XCreatePixmapFromBitmapData (private->xdisplay,
- window_private->xwindow,
- data, width, height,
- fg->pixel, bg->pixel, depth);
-
- gdk_xid_table_insert (&private->xwindow, pixmap);
-
- return pixmap;
-}
-
-gint
-gdk_pixmap_seek_string (FILE *infile,
- const gchar *str,
- gint skip_comments)
-{
- char instr[1024];
-
- while (!feof (infile))
- {
- fscanf (infile, "%s", instr);
- if (skip_comments == TRUE && strcmp (instr, "/*") == 0)
- {
- fscanf (infile, "%s", instr);
- while (!feof (infile) && strcmp (instr, "*/") != 0)
- fscanf (infile, "%s", instr);
- fscanf(infile, "%s", instr);
- }
- if (strcmp (instr, str)==0)
- return TRUE;
- }
-
- return FALSE;
-}
-
-gint
-gdk_pixmap_seek_char (FILE *infile,
- gchar c)
-{
- gchar b, oldb;
-
- while (!feof (infile))
- {
- fscanf(infile, "%c", &b);
- if (c != b && b == '/')
- {
- fscanf (infile, "%c", &b);
- if (b == '*')
- {
- oldb = b;
- while (!feof (infile) && !(oldb == '*' && b == '/'))
- {
- oldb = b;
- fscanf (infile, "%c", &b);
- }
- fscanf (infile, "%c", &b);
- }
- }
- if (c == b)
- return TRUE;
- }
-
- return FALSE;
-}
-
-gint
-gdk_pixmap_read_string (FILE *infile,
- gchar **buffer,
- guint *buffer_size)
-{
- gchar c;
- guint cnt = 0;
-
- if ((*buffer) == NULL)
- {
- (*buffer_size) = 10 * sizeof (gchar);
- (*buffer) = (gchar *) malloc (*buffer_size);
- }
-
- do
- fscanf (infile, "%c", &c);
- while (!feof (infile) && c != '"');
-
- if (c != '"')
- return FALSE;
-
- while (!feof (infile))
- {
- fscanf (infile, "%c", &c);
-
- if (cnt == (*buffer_size))
- {
- (*buffer_size) *= 2;
- (*buffer) = (gchar *) realloc ((*buffer), *buffer_size);
- }
-
- if (c != '"')
- (*buffer)[cnt++] = c;
- else
- {
- (*buffer)[cnt++] = 0;
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-gchar*
-gdk_pixmap_skip_whitespaces (gchar *buffer)
-{
- gint32 index = 0;
-
- while (buffer[index] != 0 && (buffer[index] == 0x20 || buffer[index] == 0x09))
- index++;
-
- return &buffer[index];
-}
-
-gchar*
-gdk_pixmap_skip_string (gchar *buffer)
-{
- gint32 index = 0;
-
- while (buffer[index] != 0 && buffer[index] != 0x20 && buffer[index] != 0x09)
- index++;
-
- return &buffer[index];
-}
-
-gchar*
-gdk_pixmap_extract_color (gchar *buffer)
-{
- gint counter, finished = FALSE, numnames;
- gchar *ptr = NULL, ch, temp[128];
- gchar color[128], *retcol;
-
- counter = 0;
- while (ptr == NULL)
- {
- if (buffer[counter] == 'c')
- {
- ch = buffer[counter + 1];
- if (ch == 0x20 || ch == 0x09)
- ptr = &buffer[counter + 1];
- }
- else if (buffer[counter] == 0)
- return NULL;
-
- counter++;
- }
-
- if (ptr == NULL)
- return NULL;
-
- ptr = gdk_pixmap_skip_whitespaces (ptr);
-
- if (ptr[0] == 0)
- return NULL;
- else if (ptr[0] == '#')
- {
- retcol = g_strdup (ptr);
- return retcol;
- }
-
- color[0] = 0;
- numnames = 0;
-
- while (finished == FALSE)
- {
- sscanf (ptr, "%s", temp);
-
- if ((gint)ptr[0] == 0 || strcmp ("s", temp) == 0 || strcmp ("m", temp) == 0 ||
- strcmp ("g", temp) == 0 || strcmp ("g4", temp) == 0)
- finished = TRUE;
- else
- {
- if (numnames > 0)
- strcat (color, " ");
- strcat (color, temp);
- ptr = gdk_pixmap_skip_string (ptr);
- ptr = gdk_pixmap_skip_whitespaces (ptr);
- numnames++;
- }
- }
-
- retcol = g_strdup (color);
- return retcol;
-}
-
-
-GdkPixmap*
-gdk_pixmap_colormap_create_from_xpm (GdkWindow *window,
- GdkColormap *colormap,
- GdkBitmap **mask,
- GdkColor *transparent_color,
- const gchar *filename)
-{
- FILE *infile = NULL;
- GdkPixmap *pixmap = NULL;
- GdkImage *image = NULL;
- GdkVisual *visual;
- GdkGC *gc;
- GdkColor tmp_color;
- gint width, height, num_cols, cpp, cnt, n, ns, xcnt, ycnt;
- gchar *buffer = NULL, pixel_str[32];
- guint buffer_size = 0;
- _GdkPixmapColor *colors = NULL, *color = NULL;
- gulong index;
-
- if ((window == NULL) && (colormap == NULL))
- g_warning ("Creating pixmap from xpm with NULL window and colormap");
-
- if (window == NULL)
- window = (GdkWindow *)&gdk_root_parent;
-
- if (colormap == NULL)
- {
- colormap = gdk_window_get_colormap (window);
- visual = gdk_window_get_visual (window);
- }
- else
- visual = ((GdkColormapPrivate *)colormap)->visual;
-
- infile = fopen (filename, "rb");
- if (infile != NULL)
- {
- if (gdk_pixmap_seek_string (infile, "XPM", FALSE) == TRUE)
- {
- if (gdk_pixmap_seek_char (infile,'{') == TRUE)
- {
- gdk_pixmap_seek_char (infile, '"');
- fseek (infile, -1, SEEK_CUR);
- gdk_pixmap_read_string (infile, &buffer, &buffer_size);
-
- sscanf (buffer,"%d %d %d %d", &width, &height, &num_cols, &cpp);
-
- colors = g_new(_GdkPixmapColor, num_cols);
-
- if (transparent_color == NULL)
- {
- gdk_color_white (colormap, &tmp_color);
- transparent_color = &tmp_color;
- }
-
- for (cnt = 0; cnt < num_cols; cnt++)
- {
- gchar *color_name;
-
- gdk_pixmap_seek_char (infile, '"');
- fseek (infile, -1, SEEK_CUR);
- gdk_pixmap_read_string (infile, &buffer, &buffer_size);
-
- colors[cnt].color_string = g_new(gchar, cpp + 1);
- for (n = 0; n < cpp; n++)
- colors[cnt].color_string[n] = buffer[n];
- colors[cnt].color_string[n] = 0;
- colors[cnt].transparent = FALSE;
-
- color_name = gdk_pixmap_extract_color (&buffer[cpp]);
-
- if (color_name != NULL)
- {
- if (gdk_color_parse (color_name, &colors[cnt].color) == FALSE)
- {
- colors[cnt].color = *transparent_color;
- colors[cnt].transparent = TRUE;
- }
- }
- else
- {
- colors[cnt].color = *transparent_color;
- colors[cnt].transparent = TRUE;
- }
-
- g_free (color_name);
-
- gdk_color_alloc (colormap, &colors[cnt].color);
- }
-
- index = 0;
- image = gdk_image_new (GDK_IMAGE_FASTEST, visual, width, height);
-
- gc = NULL;
- if (mask)
- {
- /* The pixmap mask is just a bits pattern.
- * Color 0 is used for background and 1 for foreground.
- * We don't care about the colormap, we just need 0 and 1.
- */
- GdkColor mask_pattern;
-
- *mask = gdk_pixmap_new (window, width, height, 1);
- gc = gdk_gc_new (*mask);
-
- mask_pattern.pixel = 0;
- gdk_gc_set_foreground (gc, &mask_pattern);
- gdk_draw_rectangle (*mask, gc, TRUE, 0, 0, -1, -1);
-
- mask_pattern.pixel = 1;
- gdk_gc_set_foreground (gc, &mask_pattern);
- }
-
- for (ycnt = 0; ycnt < height; ycnt++)
- {
- gdk_pixmap_read_string (infile, &buffer, &buffer_size);
-
- for (n = 0, cnt = 0, xcnt = 0; n < (width * cpp); n += cpp, xcnt++)
- {
- strncpy (pixel_str, &buffer[n], cpp);
- pixel_str[cpp] = 0;
- color = NULL;
- ns = 0;
-
- while (color == NULL)
- {
- if (strcmp (pixel_str, colors[ns].color_string) == 0)
- color = &colors[ns];
- else
- ns++;
- }
-
- gdk_image_put_pixel (image, xcnt, ycnt, color->color.pixel);
-
- if (mask && color->transparent)
- {
- if (cnt < xcnt)
- gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
- cnt = xcnt + 1;
- }
- }
-
- if (mask && (cnt < xcnt))
- gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
- }
-
- if (mask)
- gdk_gc_destroy (gc);
-
- pixmap = gdk_pixmap_new (window, width, height, visual->depth);
-
- gc = gdk_gc_new (pixmap);
- gdk_gc_set_foreground (gc, transparent_color);
- gdk_draw_image (pixmap, gc, image, 0, 0, 0, 0, image->width, image->height);
- gdk_gc_destroy (gc);
- gdk_image_destroy (image);
- }
- }
-
- fclose (infile);
- free (buffer);
-
- if (colors != NULL)
- {
- for (cnt = 0; cnt < num_cols; cnt++)
- g_free (colors[cnt].color_string);
- g_free (colors);
- }
- }
-
- return pixmap;
-}
-
-GdkPixmap*
-gdk_pixmap_create_from_xpm (GdkWindow *window,
- GdkBitmap **mask,
- GdkColor *transparent_color,
- const gchar *filename)
-{
- return gdk_pixmap_colormap_create_from_xpm (window, NULL, mask,
- transparent_color, filename);
-}
-
-
-GdkPixmap*
-gdk_pixmap_colormap_create_from_xpm_d (GdkWindow *window,
- GdkColormap *colormap,
- GdkBitmap **mask,
- GdkColor *transparent_color,
- gchar **data)
-{
- GdkPixmap *pixmap = NULL;
- GdkImage *image = NULL;
- GdkVisual *visual;
- GdkGC *gc;
- GdkColor tmp_color;
- gint width, height, num_cols, cpp, cnt, n, ns, xcnt, ycnt, i;
- gchar *buffer, pixel_str[32];
- _GdkPixmapColor *colors = NULL, *color = NULL;
- gulong index;
-
- if ((window == NULL) && (colormap == NULL))
- g_warning ("Creating pixmap from xpm with NULL window and colormap");
-
- if (window == NULL)
- window = (GdkWindow *)&gdk_root_parent;
-
- if (colormap == NULL)
- {
- colormap = gdk_window_get_colormap (window);
- visual = gdk_window_get_visual (window);
- }
- else
- visual = ((GdkColormapPrivate *)colormap)->visual;
-
- i = 0;
- buffer = data[i++];
- sscanf (buffer,"%d %d %d %d", &width, &height, &num_cols, &cpp);
-
- colors = g_new(_GdkPixmapColor, num_cols);
-
- if (transparent_color == NULL)
- {
- gdk_color_white (colormap, &tmp_color);
- transparent_color = &tmp_color;
- }
-
- for (cnt = 0; cnt < num_cols; cnt++)
- {
- gchar *color_name;
-
- buffer = data[i++];
-
- colors[cnt].color_string = g_new(gchar, cpp + 1);
- for (n = 0; n < cpp; n++)
- colors[cnt].color_string[n] = buffer[n];
- colors[cnt].color_string[n] = 0;
- colors[cnt].transparent = FALSE;
-
- color_name = gdk_pixmap_extract_color (&buffer[cpp]);
-
- if (color_name != NULL)
- {
- if (gdk_color_parse (color_name, &colors[cnt].color) == FALSE)
- {
- colors[cnt].color = *transparent_color;
- colors[cnt].transparent = TRUE;
- }
- }
- else
- {
- colors[cnt].color = *transparent_color;
- colors[cnt].transparent = TRUE;
- }
-
- g_free (color_name);
-
- gdk_color_alloc (colormap, &colors[cnt].color);
- }
-
- index = 0;
- image = gdk_image_new (GDK_IMAGE_FASTEST, visual, width, height);
-
- gc = NULL;
- if (mask)
- {
- /* The pixmap mask is just a bits pattern.
- * Color 0 is used for background and 1 for foreground.
- * We don't care about the colormap, we just need 0 and 1.
- */
- GdkColor mask_pattern;
-
- *mask = gdk_pixmap_new (window, width, height, 1);
- gc = gdk_gc_new (*mask);
-
- mask_pattern.pixel = 0;
- gdk_gc_set_foreground (gc, &mask_pattern);
- gdk_draw_rectangle (*mask, gc, TRUE, 0, 0, -1, -1);
-
- mask_pattern.pixel = 1;
- gdk_gc_set_foreground (gc, &mask_pattern);
- }
-
- for (ycnt = 0; ycnt < height; ycnt++)
- {
- buffer = data[i++];
-
- for (n = 0, cnt = 0, xcnt = 0; n < (width * cpp); n += cpp, xcnt++)
- {
- strncpy (pixel_str, &buffer[n], cpp);
- pixel_str[cpp] = 0;
- color = NULL;
- ns = 0;
-
- while (color == NULL)
- {
- if (strcmp (pixel_str, colors[ns].color_string) == 0)
- color = &colors[ns];
- else
- ns++;
- }
-
- gdk_image_put_pixel (image, xcnt, ycnt, color->color.pixel);
-
- if (mask && color->transparent)
- {
- if (cnt < xcnt)
- gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
- cnt = xcnt + 1;
- }
- }
-
- if (mask && (cnt < xcnt))
- gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
- }
-
- if (mask)
- gdk_gc_destroy (gc);
-
- pixmap = gdk_pixmap_new (window, width, height, visual->depth);
-
- gc = gdk_gc_new (pixmap);
- gdk_gc_set_foreground (gc, transparent_color);
- gdk_draw_image (pixmap, gc, image, 0, 0, 0, 0, image->width, image->height);
- gdk_gc_destroy (gc);
- gdk_image_destroy (image);
-
- if (colors != NULL)
- {
- for (cnt = 0; cnt < num_cols; cnt++)
- g_free (colors[cnt].color_string);
- g_free (colors);
- }
-
- return pixmap;
-}
-
-GdkPixmap*
-gdk_pixmap_create_from_xpm_d (GdkWindow *window,
- GdkBitmap **mask,
- GdkColor *transparent_color,
- gchar **data)
-{
- return gdk_pixmap_colormap_create_from_xpm_d (window, NULL, mask,
- transparent_color, data);
-}
-
-GdkPixmap*
-gdk_pixmap_ref (GdkPixmap *pixmap)
-{
- GdkWindowPrivate *private = (GdkWindowPrivate *)pixmap;
- g_return_val_if_fail (pixmap != NULL, NULL);
-
- private->ref_count += 1;
- return pixmap;
-}
-
-void
-gdk_pixmap_unref (GdkPixmap *pixmap)
-{
- GdkWindowPrivate *private = (GdkWindowPrivate *)pixmap;
- g_return_if_fail(pixmap != NULL);
-
- private->ref_count -= 1;
- if (private->ref_count == 0)
- {
- XFreePixmap (private->xdisplay, private->xwindow);
- gdk_xid_table_remove (private->xwindow);
- g_free (private);
- }
-}
-
-GdkBitmap *
-gdk_bitmap_ref (GdkBitmap *bitmap)
-{
- return (GdkBitmap *)gdk_pixmap_ref ((GdkPixmap *)bitmap);
-}
-
-void
-gdk_bitmap_unref (GdkBitmap *bitmap)
-{
- gdk_pixmap_unref ((GdkPixmap *)bitmap);
-}
diff --git a/gdk/gdkprivate.h b/gdk/gdkprivate.h
deleted file mode 100644
index 481811ef0c..0000000000
--- a/gdk/gdkprivate.h
+++ /dev/null
@@ -1,290 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GDK_PRIVATE_H__
-#define __GDK_PRIVATE_H__
-
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <gdk/gdktypes.h>
-
-#define DND_PROTOCOL_VERSION 0
-
-#define gdk_window_lookup(xid) ((GdkWindow*) gdk_xid_table_lookup (xid))
-#define gdk_pixmap_lookup(xid) ((GdkPixmap*) gdk_xid_table_lookup (xid))
-#define gdk_font_lookup(xid) ((GdkFont*) gdk_xid_table_lookup (xid))
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-typedef struct _GdkWindowPrivate GdkWindowPrivate;
-typedef struct _GdkWindowPrivate GdkPixmapPrivate;
-typedef struct _GdkImagePrivate GdkImagePrivate;
-typedef struct _GdkGCPrivate GdkGCPrivate;
-typedef struct _GdkColormapPrivate GdkColormapPrivate;
-typedef struct _GdkVisualPrivate GdkVisualPrivate;
-typedef struct _GdkFontPrivate GdkFontPrivate;
-typedef struct _GdkCursorPrivate GdkCursorPrivate;
-typedef struct _GdkEventFilter GdkEventFilter;
-typedef struct _GdkColorContextPrivate GdkColorContextPrivate;
-typedef struct _GdkRegionPrivate GdkRegionPrivate;
-
-
-struct _GdkWindowPrivate
-{
- GdkWindow window;
- GdkWindow *parent;
- Window xwindow;
- Display *xdisplay;
- gint16 x;
- gint16 y;
- guint16 width;
- guint16 height;
- guint8 resize_count;
- guint8 window_type;
- guint ref_count;
- guint destroyed : 2;
- guint dnd_drag_enabled : 1,
- dnd_drag_datashow : 1,
- dnd_drag_destructive_op : 1,
- dnd_drag_accepted : 1,
- dnd_drop_enabled : 1,
- dnd_drop_destructive_op : 1;
- GdkAtom dnd_drag_data_type, *dnd_drag_data_typesavail;
- guint dnd_drag_data_numtypesavail;
- /* We have to turn on MotionMask/EnterWindowMask/LeaveWindowMask
- during drags, then set it back to what it was after */
- glong dnd_drag_savedeventmask, dnd_drag_eventmask;
- GdkAtom *dnd_drop_data_typesavail;
- guint dnd_drop_data_numtypesavail;
- /* need to allow custom drag/drop cursors */
-
- gint extension_events;
-
- GList *filters;
-};
-
-struct _GdkImagePrivate
-{
- GdkImage image;
- XImage *ximage;
- Display *xdisplay;
- gpointer x_shm_info;
-
- void (*image_put) (GdkDrawable *window,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
-};
-
-struct _GdkGCPrivate
-{
- GdkGC gc;
- GC xgc;
- Display *xdisplay;
- guint ref_count;
-};
-
-struct _GdkColormapPrivate
-{
- GdkColormap colormap;
- Colormap xcolormap;
- Display *xdisplay;
- GdkVisual *visual;
- gint private_val;
- gint next_color;
- guint ref_count;
-};
-
-struct _GdkVisualPrivate
-{
- GdkVisual visual;
- Visual *xvisual;
-};
-
-struct _GdkFontPrivate
-{
- GdkFont font;
- /* XFontStruct *xfont; */
- /* generic pointer point to XFontStruct or XFontSet */
- gpointer xfont;
- Display *xdisplay;
- guint ref_count;
-};
-
-struct _GdkCursorPrivate
-{
- GdkCursor cursor;
- Cursor xcursor;
- Display *xdisplay;
-};
-
-struct _GdkDndCursorInfo {
- Cursor gdk_cursor_dragdefault, gdk_cursor_dragok;
- GdkWindow *drag_pm_default, *drag_pm_ok;
- GdkPoint default_hotspot, ok_hotspot;
-};
-typedef struct _GdkDndCursorInfo GdkDndCursorInfo;
-
-struct _GdkDndGlobals {
- GdkAtom gdk_XdeEnter, gdk_XdeLeave, gdk_XdeRequest;
- GdkAtom gdk_XdeDataAvailable, gdk_XdeDataShow, gdk_XdeCancel;
- GdkAtom gdk_XdeTypelist;
-
- GdkDndCursorInfo *c;
- GdkWindow **drag_startwindows;
- guint drag_numwindows;
- gboolean drag_really, drag_perhaps, dnd_grabbed;
- Window dnd_drag_target;
- GdkPoint drag_dropcoords;
-
- GdkPoint dnd_drag_start, dnd_drag_oldpos;
- GdkRectangle dnd_drag_dropzone;
- GdkWindowPrivate *real_sw;
- Window dnd_drag_curwin;
- Time last_drop_time; /* An incredible hack, sosumi miguel */
-};
-typedef struct _GdkDndGlobals GdkDndGlobals;
-
-struct _GdkEventFilter {
- GdkFilterFunc function;
- gpointer data;
-};
-
-#ifdef USE_XIM
-
-struct _GdkICPrivate
-{
- XIC xic;
- GdkIMStyle style;
-};
-
-typedef struct _GdkICPrivate GdkICPrivate;
-
-#endif /* USE_XIM */
-
-struct _GdkColorContextPrivate
-{
- GdkColorContext color_context;
- Display *xdisplay;
- XStandardColormap std_cmap;
-};
-
-struct _GdkRegionPrivate
-{
- GdkRegion region;
- Region xregion;
-};
-
-typedef enum {
- GDK_DEBUG_MISC = 1<<0,
- GDK_DEBUG_EVENTS = 1 << 1,
- GDK_DEBUG_DND = 1<<2,
- GDK_DEBUG_COLOR_CONTEXT = 1<<3,
- GDK_DEBUG_XIM = 1<<4
-} GdkDebugFlag;
-
-void gdk_window_init (void);
-void gdk_visual_init (void);
-
-void gdk_image_init (void);
-void gdk_image_exit (void);
-
-GdkColormap* gdk_colormap_lookup (Colormap xcolormap);
-GdkVisual* gdk_visual_lookup (Visual *xvisual);
-
-void gdk_window_add_colormap_windows (GdkWindow *window);
-void gdk_window_destroy_notify (GdkWindow *window);
-
-void gdk_xid_table_insert (XID *xid,
- gpointer data);
-void gdk_xid_table_remove (XID xid);
-gpointer gdk_xid_table_lookup (XID xid);
-
-gint gdk_send_xevent (Window window, gboolean propagate, glong event_mask,
- XEvent *event_send);
-
-/* If you pass x = y = -1, it queries the pointer
- to find out where it currently is.
- If you pass x = y = -2, it does anything necessary
- to know that the drag is ending.
-*/
-void gdk_dnd_display_drag_cursor(gint x,
- gint y,
- gboolean drag_ok,
- gboolean change_made);
-
-/* Please see gdkwindow.c for comments on how to use */
-Window gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y);
-Window gdk_window_xid_at_coords(gint x, gint y, GList *excludes);
-
-extern gint gdk_debug_level;
-extern gint gdk_show_events;
-extern gint gdk_use_xshm;
-extern gint gdk_stack_trace;
-extern gchar *gdk_display_name;
-extern Display *gdk_display;
-extern gint gdk_screen;
-extern Window gdk_root_window;
-extern Window gdk_leader_window;
-extern GdkWindowPrivate gdk_root_parent;
-extern Atom gdk_wm_delete_window;
-extern Atom gdk_wm_take_focus;
-extern Atom gdk_wm_protocols;
-extern Atom gdk_wm_window_protocols[];
-extern Atom gdk_selection_property;
-extern GdkDndGlobals gdk_dnd;
-extern GdkWindow *selection_owner[];
-extern gchar *gdk_progname;
-extern gchar *gdk_progclass;
-extern gint gdk_error_code;
-extern gint gdk_error_warnings;
-extern gint gdk_null_window_warnings;
-extern GList *gdk_default_filters;
-
-/* Debugging support */
-
-#ifdef G_ENABLE_DEBUG
-
-#define GDK_NOTE(type,action) G_STMT_START { \
- if (gdk_debug_flags & GDK_DEBUG_##type) \
- { action; }; } G_STMT_END
-
-#else /* !G_ENABLE_DEBUG */
-
-#define GDK_NOTE(type,action)
-
-#endif /* G_ENABLE_DEBUG */
-
-extern guint gdk_debug_flags;
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GDK_PRIVATE_H__ */
diff --git a/gdk/gdkproperty.c b/gdk/gdkproperty.c
deleted file mode 100644
index 40140a026a..0000000000
--- a/gdk/gdkproperty.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <string.h>
-#include "gdk.h"
-#include "gdkprivate.h"
-
-
-GdkAtom
-gdk_atom_intern (const gchar *atom_name,
- gint only_if_exists)
-{
- return XInternAtom (gdk_display, atom_name, only_if_exists);
-}
-
-gchar *
-gdk_atom_name (GdkAtom atom)
-{
- gchar *t;
- gchar *name;
-
- /* If this atom doesn't exist, we'll die with an X error unless
- we take precautions */
-
- gdk_error_warnings = 0;
- gdk_error_code = 0;
- t = XGetAtomName (gdk_display, atom);
- gdk_error_warnings = 1;
-
- if (gdk_error_code == -1)
- {
- return NULL;
- }
- else
- {
- name = g_strdup (t);
- XFree (t);
-
- return name;
- }
-}
-
-gint
-gdk_property_get (GdkWindow *window,
- GdkAtom property,
- GdkAtom type,
- gulong offset,
- gulong length,
- gint pdelete,
- GdkAtom *actual_property_type,
- gint *actual_format_type,
- gint *actual_length,
- guchar **data)
-{
- Display *xdisplay;
- Window xwindow;
- Atom ret_prop_type;
- gint ret_format;
- gulong ret_nitems;
- gulong ret_bytes_after;
- gulong ret_length;
- guchar *ret_data;
-
- if (window)
- {
- GdkWindowPrivate *private;
-
- private = (GdkWindowPrivate*) window;
- if (private->destroyed)
- return FALSE;
-
- xdisplay = private->xdisplay;
- xwindow = private->xwindow;
- }
- else
- {
- xdisplay = gdk_display;
- xwindow = gdk_root_window;
- }
-
- XGetWindowProperty (xdisplay, xwindow, property,
- offset, (length + 3) / 4, pdelete,
- type, &ret_prop_type, &ret_format,
- &ret_nitems, &ret_bytes_after,
- &ret_data);
-
- if ((ret_prop_type == None) && (ret_format == 0)) {
- return FALSE;
- }
-
- if (actual_property_type)
- *actual_property_type = ret_prop_type;
- if (actual_format_type)
- *actual_format_type = ret_format;
-
- if (ret_prop_type != type)
- {
- gchar *rn, *pn;
- XFree (ret_data);
- rn = gdk_atom_name(ret_prop_type);
- pn = gdk_atom_name(type);
- g_warning("Couldn't match property type %s to %s\n", rn, pn);
- g_free(rn); g_free(pn);
- return FALSE;
- }
-
- /* FIXME: ignoring bytes_after could have very bad effects */
-
- if (data)
- {
- switch (ret_format)
- {
- case 8:
- ret_length = ret_nitems;
- break;
- case 16:
- ret_length = 2 * ret_nitems;
- break;
- case 32:
- ret_length = 4 * ret_nitems;
- break;
- default:
- g_warning ("unknown property return format: %d", ret_format);
- XFree (ret_data);
- return FALSE;
- }
-
- *data = g_new (guchar, ret_length);
- memcpy (*data, ret_data, ret_length);
- if (actual_length)
- *actual_length = ret_length;
- }
-
- XFree (ret_data);
-
- return TRUE;
-}
-
-void
-gdk_property_change (GdkWindow *window,
- GdkAtom property,
- GdkAtom type,
- gint format,
- GdkPropMode mode,
- guchar *data,
- gint nelements)
-{
- Display *xdisplay;
- Window xwindow;
-
- if (window)
- {
- GdkWindowPrivate *private;
-
- private = (GdkWindowPrivate*) window;
- if (private->destroyed)
- return;
-
- xdisplay = private->xdisplay;
- xwindow = private->xwindow;
- }
- else
- {
- xdisplay = gdk_display;
- xwindow = gdk_root_window;
- }
-
- XChangeProperty (xdisplay, xwindow, property, type,
- format, mode, data, nelements);
-}
-
-void
-gdk_property_delete (GdkWindow *window,
- GdkAtom property)
-{
- Display *xdisplay;
- Window xwindow;
-
- if (window)
- {
- GdkWindowPrivate *private;
-
- private = (GdkWindowPrivate*) window;
- if (private->destroyed)
- return;
-
- xdisplay = private->xdisplay;
- xwindow = private->xwindow;
- }
- else
- {
- xdisplay = gdk_display;
- xwindow = gdk_root_window;
- }
-
- XDeleteProperty (xdisplay, xwindow, property);
-}
diff --git a/gdk/gdkrectangle.c b/gdk/gdkrectangle.c
deleted file mode 100644
index dbb35b664e..0000000000
--- a/gdk/gdkrectangle.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gdk.h"
-
-
-gint
-gdk_rectangle_intersect (GdkRectangle *src1,
- GdkRectangle *src2,
- GdkRectangle *dest)
-{
- GdkRectangle *temp;
- gint src1_x2, src1_y2;
- gint src2_x2, src2_y2;
- gint return_val;
-
- g_return_val_if_fail (src1 != NULL, FALSE);
- g_return_val_if_fail (src2 != NULL, FALSE);
- g_return_val_if_fail (dest != NULL, FALSE);
-
- return_val = FALSE;
-
- if (src2->x < src1->x)
- {
- temp = src1;
- src1 = src2;
- src2 = temp;
- }
- dest->x = src2->x;
-
- src1_x2 = src1->x + src1->width;
- src2_x2 = src2->x + src2->width;
-
- if (src2->x < src1_x2)
- {
- if (src1_x2 < src2_x2)
- dest->width = src1_x2 - dest->x;
- else
- dest->width = src2_x2 - dest->x;
-
- if (src2->y < src1->y)
- {
- temp = src1;
- src1 = src2;
- src2 = temp;
- }
- dest->y = src2->y;
-
- src1_y2 = src1->y + src1->height;
- src2_y2 = src2->y + src2->height;
-
- if (src2->y < src1_y2)
- {
- return_val = TRUE;
-
- if (src1_y2 < src2_y2)
- dest->height = src1_y2 - dest->y;
- else
- dest->height = src2_y2 - dest->y;
-
- if (dest->height == 0)
- return_val = FALSE;
- if (dest->width == 0)
- return_val = FALSE;
- }
- }
-
- return return_val;
-}
diff --git a/gdk/gdkregion.c b/gdk/gdkregion.c
deleted file mode 100644
index 8863d62e69..0000000000
--- a/gdk/gdkregion.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include "gdk.h"
-#include "gdkprivate.h"
-
-
-
-
-GdkRegion*
-gdk_region_new (void)
-{
- GdkRegionPrivate *private;
- GdkRegion *region;
- Region xregion;
-
- xregion = XCreateRegion();
- private = g_new (GdkRegionPrivate, 1);
- private->xregion = xregion;
- region = (GdkRegion*) private;
- region->user_data = NULL;
-
- return region;
-}
-
-void
-gdk_region_destroy (GdkRegion *region)
-{
- GdkRegionPrivate *private;
-
- g_return_if_fail (region != NULL);
-
- private = (GdkRegionPrivate *) region;
- XDestroyRegion (private->xregion);
-
- g_free (private);
-}
-
-gboolean
-gdk_region_empty (GdkRegion *region)
-{
- GdkRegionPrivate *private;
-
- g_return_val_if_fail (region != NULL, 0);
-
- private = (GdkRegionPrivate *) region;
-
- return XEmptyRegion (private->xregion);
-}
-
-gboolean
-gdk_region_equal (GdkRegion *region1,
- GdkRegion *region2)
-{
- GdkRegionPrivate *private1;
- GdkRegionPrivate *private2;
-
- g_return_val_if_fail (region1 != NULL, 0);
- g_return_val_if_fail (region2 != NULL, 0);
-
- private1 = (GdkRegionPrivate *) region1;
- private2 = (GdkRegionPrivate *) region2;
-
- return XEqualRegion (private1->xregion, private2->xregion);
-}
-
-gboolean
-gdk_region_point_in (GdkRegion *region,
- gint x,
- gint y)
-{
- GdkRegionPrivate *private;
-
- g_return_val_if_fail (region != NULL, 0);
-
- private = (GdkRegionPrivate *) region;
-
- return XPointInRegion (private->xregion, x, y);
-}
-
-GdkOverlapType
-gdk_region_rect_in (GdkRegion *region,
- GdkRectangle *rect)
-{
- GdkRegionPrivate *private;
- int res;
-
- g_return_val_if_fail (region != NULL, 0);
-
- private = (GdkRegionPrivate *) region;
-
- res = XRectInRegion (private->xregion, rect->x, rect->y, rect->width, rect->height);
-
- switch (res)
- {
- case RectangleIn: return GDK_OVERLAP_RECTANGLE_IN;
- case RectangleOut: return GDK_OVERLAP_RECTANGLE_OUT;
- case RectanglePart: return GDK_OVERLAP_RECTANGLE_PART;
- }
-
- return GDK_OVERLAP_RECTANGLE_OUT; /*what else ? */
-}
-
-void
-gdk_region_offset (GdkRegion *region,
- gint dx,
- gint dy)
-{
- GdkRegionPrivate *private;
-
- g_return_if_fail (region != NULL);
-
- private = (GdkRegionPrivate *) region;
-
- XOffsetRegion (private->xregion, dx, dy);
-}
-
-void
-gdk_region_shrink (GdkRegion *region,
- gint dx,
- gint dy)
-{
- GdkRegionPrivate *private;
-
- g_return_if_fail (region != NULL);
-
- private = (GdkRegionPrivate *) region;
-
- XShrinkRegion (private->xregion, dx, dy);
-}
-
-GdkRegion*
-gdk_region_union_with_rect (GdkRegion *region,
- GdkRectangle *rect)
-{
- GdkRegionPrivate *private;
- GdkRegion *res;
- GdkRegionPrivate *res_private;
- XRectangle xrect;
-
- g_return_val_if_fail (region != NULL, NULL);
-
- private = (GdkRegionPrivate *) region;
-
- xrect.x = rect->x;
- xrect.y = rect->y;
- xrect.width = rect->width;
- xrect.height = rect->height;
-
- res = gdk_region_new ();
- res_private = (GdkRegionPrivate *) res;
-
- XUnionRectWithRegion (&xrect, private->xregion, res_private->xregion);
-
- return res;
-}
-
-GdkRegion*
-gdk_regions_intersect (GdkRegion *source1,
- GdkRegion *source2)
-{
- GdkRegionPrivate *private1;
- GdkRegionPrivate *private2;
- GdkRegion *res;
- GdkRegionPrivate *res_private;
-
- g_return_val_if_fail (source1 != NULL, NULL);
- g_return_val_if_fail (source2 != NULL, NULL);
-
- private1 = (GdkRegionPrivate *) source1;
- private2 = (GdkRegionPrivate *) source2;
-
- res = gdk_region_new ();
- res_private = (GdkRegionPrivate *) res;
-
- XIntersectRegion (private1->xregion, private2->xregion, res_private->xregion);
-
- return res;
-}
-
-GdkRegion*
-gdk_regions_union (GdkRegion *source1,
- GdkRegion *source2)
-{
- GdkRegionPrivate *private1;
- GdkRegionPrivate *private2;
- GdkRegion *res;
- GdkRegionPrivate *res_private;
-
- g_return_val_if_fail (source1 != NULL, NULL);
- g_return_val_if_fail (source2 != NULL, NULL);
-
- private1 = (GdkRegionPrivate *) source1;
- private2 = (GdkRegionPrivate *) source2;
-
- res = gdk_region_new ();
- res_private = (GdkRegionPrivate *) res;
-
- XUnionRegion (private1->xregion, private2->xregion, res_private->xregion);
-
- return res;
-}
-
-GdkRegion*
-gdk_regions_subtract (GdkRegion *source1,
- GdkRegion *source2)
-{
- GdkRegionPrivate *private1;
- GdkRegionPrivate *private2;
- GdkRegion *res;
- GdkRegionPrivate *res_private;
-
- g_return_val_if_fail (source1 != NULL, NULL);
- g_return_val_if_fail (source2 != NULL, NULL);
-
- private1 = (GdkRegionPrivate *) source1;
- private2 = (GdkRegionPrivate *) source2;
-
- res = gdk_region_new ();
- res_private = (GdkRegionPrivate *) res;
-
- XSubtractRegion (private1->xregion, private2->xregion, res_private->xregion);
-
- return res;
-}
-
-GdkRegion*
-gdk_regions_xor (GdkRegion *source1,
- GdkRegion *source2)
-{
- GdkRegionPrivate *private1;
- GdkRegionPrivate *private2;
- GdkRegion *res;
- GdkRegionPrivate *res_private;
-
- g_return_val_if_fail (source1 != NULL, NULL);
- g_return_val_if_fail (source2 != NULL, NULL);
-
- private1 = (GdkRegionPrivate *) source1;
- private2 = (GdkRegionPrivate *) source2;
-
- res = gdk_region_new ();
- res_private = (GdkRegionPrivate *) res;
-
- XXorRegion (private1->xregion, private2->xregion, res_private->xregion);
-
- return res;
-}
-
-
-
diff --git a/gdk/gdkselection.c b/gdk/gdkselection.c
deleted file mode 100644
index b8f1c9ff60..0000000000
--- a/gdk/gdkselection.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <string.h>
-#include "gdk.h"
-#include "gdkprivate.h"
-#include "gdkx.h"
-
-
-gint
-gdk_selection_owner_set (GdkWindow *owner,
- GdkAtom selection,
- guint32 time,
- gint send_event)
-{
- Display *xdisplay;
- Window xwindow;
-
- if (owner)
- {
- GdkWindowPrivate *private;
-
- private = (GdkWindowPrivate*) owner;
- if (private->destroyed)
- return FALSE;
-
- xdisplay = private->xdisplay;
- xwindow = private->xwindow;
- }
- else
- {
- xdisplay = gdk_display;
- xwindow = None;
- }
-
- XSetSelectionOwner (xdisplay, selection, xwindow, time);
-
- return (XGetSelectionOwner (xdisplay, selection) == xwindow);
-}
-
-GdkWindow*
-gdk_selection_owner_get (GdkAtom selection)
-{
- Window xwindow;
-
- xwindow = XGetSelectionOwner (gdk_display, selection);
- if (xwindow == None)
- return NULL;
-
- return gdk_window_lookup (xwindow);
-}
-
-void
-gdk_selection_convert (GdkWindow *requestor,
- GdkAtom selection,
- GdkAtom target,
- guint32 time)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (requestor != NULL);
-
- private = (GdkWindowPrivate*) requestor;
- if (private->destroyed)
- return;
-
- XConvertSelection (private->xdisplay, selection, target,
- gdk_selection_property, private->xwindow, time);
-}
-
-gint
-gdk_selection_property_get (GdkWindow *requestor,
- guchar **data,
- GdkAtom *ret_type,
- gint *ret_format)
-{
- GdkWindowPrivate *private;
- gulong nitems;
- gulong nbytes;
- gulong length;
- GdkAtom prop_type;
- gint prop_format;
- guchar *t;
-
- g_return_val_if_fail (requestor != NULL, 0);
-
- /* If retrieved chunks are typically small, (and the ICCM says the
- should be) it would be a win to try first with a buffer of
- moderate length, to avoid two round trips to the server */
-
- private = (GdkWindowPrivate*) requestor;
- if (private->destroyed)
- return 0;
-
- XGetWindowProperty (private->xdisplay, private->xwindow,
- gdk_selection_property, 0, 0, False,
- AnyPropertyType, &prop_type, &prop_format,
- &nitems, &nbytes, &t);
-
- if (ret_type)
- *ret_type = prop_type;
- if (ret_format)
- *ret_format = prop_format;
-
- if (prop_type == None)
- {
- *data = NULL;
- return 0;
- }
-
- XFree (t);
-
- /* Add on an extra byte to handle null termination. X guarantees
- that t will be 1 longer than nbytes and null terminated */
- length = nbytes + 1;
-
- /* We can't delete the selection here, because it might be the INCR
- protocol, in which case the client has to make sure they'll be
- notified of PropertyChange events _before_ the property is deleted.
- Otherwise there's no guarantee we'll win the race ... */
- XGetWindowProperty (private->xdisplay, private->xwindow,
- gdk_selection_property, 0, (nbytes + 3) / 4, False,
- AnyPropertyType, &prop_type, &prop_format,
- &nitems, &nbytes, &t);
-
- if (prop_type != None)
- {
- *data = g_new (guchar, length);
- memcpy (*data, t, length);
- XFree (t);
- return length-1;
- }
- else
- {
- *data = NULL;
- return 0;
- }
-}
-
-
-void
-gdk_selection_send_notify (guint32 requestor,
- GdkAtom selection,
- GdkAtom target,
- GdkAtom property,
- guint32 time)
-{
- XSelectionEvent xevent;
-
- xevent.type = SelectionNotify;
- xevent.serial = 0;
- xevent.send_event = True;
- xevent.display = gdk_display;
- xevent.requestor = requestor;
- xevent.selection = selection;
- xevent.target = target;
- xevent.property = property;
- xevent.time = time;
-
- XSendEvent (gdk_display, requestor, False, NoEventMask, (XEvent*) &xevent);
-}
-
-gint
-gdk_text_property_to_text_list (GdkAtom encoding, gint format,
- guchar *text, gint length,
- gchar ***list)
-{
- XTextProperty property;
- gint count = 0;
- gint res;
-
- if (!list)
- return 0;
-
- property.value = text;
- property.encoding = encoding;
- property.format = format;
- property.nitems = length;
- res = XmbTextPropertyToTextList (GDK_DISPLAY(), &property, list, &count);
-
- if (res == XNoMemory || res == XLocaleNotSupported ||
- res == XConverterNotFound)
- return 0;
- else
- return count;
-}
-
-void
-gdk_free_text_list (gchar **list)
-{
- XFreeStringList (list);
-}
-
-gint
-gdk_string_to_compound_text (gchar *str,
- GdkAtom *encoding, gint *format,
- guchar **ctext, gint *length)
-{
- gint res;
- XTextProperty property;
-
- res = XmbTextListToTextProperty (GDK_DISPLAY(),
- &str, 1, XCompoundTextStyle,
- &property);
- if (res != Success)
- {
- property.encoding = None;
- property.format = None;
- property.value = NULL;
- property.nitems = 0;
- }
-
- if (encoding)
- *encoding = property.encoding;
- if (format)
- *format = property.format;
- if (ctext)
- *ctext = property.value;
- if (length)
- *length = property.nitems;
-
- return res;
-}
-
-void gdk_free_compound_text (guchar *ctext)
-{
- if (ctext)
- XFree (ctext);
-}
diff --git a/gdk/gdktypes.h b/gdk/gdktypes.h
deleted file mode 100644
index 931fdf78b0..0000000000
--- a/gdk/gdktypes.h
+++ /dev/null
@@ -1,1196 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GDK_TYPES_H__
-#define __GDK_TYPES_H__
-
-
-/* GDK uses "glib". (And so does GTK).
- */
-#include <glib.h>
-
-
-#define GDK_NONE 0L
-#define GDK_CURRENT_TIME 0L
-#define GDK_PARENT_RELATIVE 1L
-
-/* special deviceid for core pointer events */
-#define GDK_CORE_POINTER 0xfedc
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/* Type definitions for the basic structures.
- */
-
-typedef gulong GdkAtom;
-typedef struct _GdkColor GdkColor;
-typedef struct _GdkColormap GdkColormap;
-typedef struct _GdkVisual GdkVisual;
-typedef struct _GdkWindowAttr GdkWindowAttr;
-typedef struct _GdkWindow GdkWindow;
-typedef struct _GdkWindow GdkPixmap;
-typedef struct _GdkWindow GdkBitmap;
-typedef struct _GdkWindow GdkDrawable;
-typedef struct _GdkImage GdkImage;
-typedef struct _GdkGCValues GdkGCValues;
-typedef struct _GdkGC GdkGC;
-typedef struct _GdkPoint GdkPoint;
-typedef struct _GdkRectangle GdkRectangle;
-typedef struct _GdkSegment GdkSegment;
-typedef struct _GdkFont GdkFont;
-typedef struct _GdkCursor GdkCursor;
-typedef struct _GdkColorContextDither GdkColorContextDither;
-typedef struct _GdkColorContext GdkColorContext;
-
-typedef struct _GdkEventAny GdkEventAny;
-typedef struct _GdkEventExpose GdkEventExpose;
-typedef struct _GdkEventNoExpose GdkEventNoExpose;
-typedef struct _GdkEventVisibility GdkEventVisibility;
-typedef struct _GdkEventMotion GdkEventMotion;
-typedef struct _GdkEventButton GdkEventButton;
-typedef struct _GdkEventKey GdkEventKey;
-typedef struct _GdkEventFocus GdkEventFocus;
-typedef struct _GdkEventCrossing GdkEventCrossing;
-typedef struct _GdkEventConfigure GdkEventConfigure;
-typedef struct _GdkEventProperty GdkEventProperty;
-typedef struct _GdkEventSelection GdkEventSelection;
-typedef struct _GdkEventProximity GdkEventProximity;
-typedef struct _GdkEventOther GdkEventOther;
-typedef struct _GdkEventDragBegin GdkEventDragBegin;
-typedef struct _GdkEventDragRequest GdkEventDragRequest;
-typedef struct _GdkEventDropEnter GdkEventDropEnter;
-typedef struct _GdkEventDropDataAvailable GdkEventDropDataAvailable;
-typedef struct _GdkEventDropLeave GdkEventDropLeave;
-typedef struct _GdkEventClient GdkEventClient;
-typedef union _GdkEvent GdkEvent;
-typedef struct _GdkDeviceKey GdkDeviceKey;
-typedef struct _GdkDeviceInfo GdkDeviceInfo;
-typedef struct _GdkTimeCoord GdkTimeCoord;
-typedef struct _GdkRegion GdkRegion;
-typedef gint (*GdkEventFunc) (GdkEvent *event,
- gpointer data);
-
-typedef void* GdkIC;
-typedef void* GdkIM;
-
-
-/* Types of windows.
- * Root: There is only 1 root window and it is initialized
- * at startup. Creating a window of type GDK_WINDOW_ROOT
- * is an error.
- * Toplevel: Windows which interact with the window manager.
- * Child: Windows which are children of some other type of window.
- * (Any other type of window). Most windows are child windows.
- * Dialog: A special kind of toplevel window which interacts with
- * the window manager slightly differently than a regular
- * toplevel window. Dialog windows should be used for any
- * transient window.
- * Pixmap: Pixmaps are really just another kind of window which
- * doesn't actually appear on the screen. It can't have
- * children, either and is really just a convenience so
- * that the drawing functions can work on both windows
- * and pixmaps transparently. (ie. You shouldn't pass a
- * pixmap to any procedure which accepts a window with the
- * exception of the drawing functions).
- */
-typedef enum
-{
- GDK_WINDOW_ROOT,
- GDK_WINDOW_TOPLEVEL,
- GDK_WINDOW_CHILD,
- GDK_WINDOW_DIALOG,
- GDK_WINDOW_TEMP,
- GDK_WINDOW_PIXMAP
-} GdkWindowType;
-
-/* Classes of windows.
- * InputOutput: Almost every window should be of this type. Such windows
- * receive events and are also displayed on screen.
- * InputOnly: Used only in special circumstances when events need to be
- * stolen from another window or windows. Input only windows
- * have no visible output, so they are handy for placing over
- * top of a group of windows in order to grab the events (or
- * filter the events) from those windows.
- */
-typedef enum
-{
- GDK_INPUT_OUTPUT,
- GDK_INPUT_ONLY
-} GdkWindowClass;
-
-/* Types of images.
- * Normal: Normal X image type. These are slow as they involve passing
- * the entire image through the X connection each time a draw
- * request is required.
- * Shared: Shared memory X image type. These are fast as the X server
- * and the program actually use the same piece of memory. They
- * should be used with care though as there is the possibility
- * for both the X server and the program to be reading/writing
- * the image simultaneously and producing undesired results.
- */
-typedef enum
-{
- GDK_IMAGE_NORMAL,
- GDK_IMAGE_SHARED,
- GDK_IMAGE_FASTEST
-} GdkImageType;
-
-/* Types of visuals.
- * StaticGray:
- * Grayscale:
- * StaticColor:
- * PseudoColor:
- * TrueColor:
- * DirectColor:
- */
-typedef enum
-{
- GDK_VISUAL_STATIC_GRAY,
- GDK_VISUAL_GRAYSCALE,
- GDK_VISUAL_STATIC_COLOR,
- GDK_VISUAL_PSEUDO_COLOR,
- GDK_VISUAL_TRUE_COLOR,
- GDK_VISUAL_DIRECT_COLOR
-} GdkVisualType;
-
-/* Types of font.
- * GDK_FONT_FONT: the font is an XFontStruct.
- * GDK_FONT_FONTSET: the font is an XFontSet used for I18N.
- */
-typedef enum
-{
- GDK_FONT_FONT,
- GDK_FONT_FONTSET
-} GdkFontType;
-
-/* Window attribute mask values.
- * GDK_WA_TITLE: The "title" field is valid.
- * GDK_WA_X: The "x" field is valid.
- * GDK_WA_Y: The "y" field is valid.
- * GDK_WA_CURSOR: The "cursor" field is valid.
- * GDK_WA_COLORMAP: The "colormap" field is valid.
- * GDK_WA_VISUAL: The "visual" field is valid.
- */
-typedef enum
-{
- GDK_WA_TITLE = 1 << 1,
- GDK_WA_X = 1 << 2,
- GDK_WA_Y = 1 << 3,
- GDK_WA_CURSOR = 1 << 4,
- GDK_WA_COLORMAP = 1 << 5,
- GDK_WA_VISUAL = 1 << 6,
- GDK_WA_WMCLASS = 1 << 7,
- GDK_WA_NOREDIR = 1 << 8
-} GdkWindowAttributesType;
-
-/* Size restriction enumeration.
- */
-typedef enum
-{
- GDK_HINT_POS = 1 << 0,
- GDK_HINT_MIN_SIZE = 1 << 1,
- GDK_HINT_MAX_SIZE = 1 << 2
-} GdkWindowHints;
-
-/* GC function types.
- * Copy: Overwrites destination pixels with the source pixels.
- * Invert: Inverts the destination pixels.
- * Xor: Xor's the destination pixels with the source pixels.
- */
-typedef enum
-{
- GDK_COPY,
- GDK_INVERT,
- GDK_XOR
-} GdkFunction;
-
-/* GC fill types.
- * Solid:
- * Tiled:
- * Stippled:
- * OpaqueStippled:
- */
-typedef enum
-{
- GDK_SOLID,
- GDK_TILED,
- GDK_STIPPLED,
- GDK_OPAQUE_STIPPLED
-} GdkFill;
-
-/* GC line styles
- * Solid:
- * OnOffDash:
- * DoubleDash:
- */
-typedef enum
-{
- GDK_LINE_SOLID,
- GDK_LINE_ON_OFF_DASH,
- GDK_LINE_DOUBLE_DASH
-} GdkLineStyle;
-
-/* GC cap styles
- * CapNotLast:
- * CapButt:
- * CapRound:
- * CapProjecting:
- */
-typedef enum
-{
- GDK_CAP_NOT_LAST,
- GDK_CAP_BUTT,
- GDK_CAP_ROUND,
- GDK_CAP_PROJECTING
-} GdkCapStyle;
-
-/* GC join styles
- * JoinMiter:
- * JoinRound:
- * JoinBevel:
- */
-typedef enum
-{
- GDK_JOIN_MITER,
- GDK_JOIN_ROUND,
- GDK_JOIN_BEVEL
-} GdkJoinStyle;
-
-/* Cursor types.
- */
-typedef enum
-{
-#include <gdk/gdkcursors.h>
- GDK_LAST_CURSOR,
- GDK_CURSOR_IS_PIXMAP = -1
-} GdkCursorType;
-
-typedef enum {
- GDK_FILTER_CONTINUE, /* Event not handled, continue processesing */
- GDK_FILTER_TRANSLATE, /* Translated event stored */
- GDK_FILTER_REMOVE /* Terminate processing, removing event */
-} GdkFilterReturn;
-
-typedef enum {
- GDK_VISIBILITY_UNOBSCURED,
- GDK_VISIBILITY_PARTIAL,
- GDK_VISIBILITY_FULLY_OBSCURED
-} GdkVisibilityState;
-
-/* Event types.
- * Nothing: No event occurred.
- * Delete: A window delete event was sent by the window manager.
- * The specified window should be deleted.
- * Destroy: A window has been destroyed.
- * Expose: Part of a window has been uncovered.
- * NoExpose: Same as expose, but no expose event was generated.
- * VisibilityNotify: A window has become fully/partially/not obscured.
- * MotionNotify: The mouse has moved.
- * ButtonPress: A mouse button was pressed.
- * ButtonRelease: A mouse button was release.
- * KeyPress: A key was pressed.
- * KeyRelease: A key was released.
- * EnterNotify: A window was entered.
- * LeaveNotify: A window was exited.
- * FocusChange: The focus window has changed. (The focus window gets
- * keyboard events).
- * Resize: A window has been resized.
- * Map: A window has been mapped. (It is now visible on the screen).
- * Unmap: A window has been unmapped. (It is no longer visible on
- * the screen).
- */
-typedef enum
-{
- GDK_NOTHING = -1,
- GDK_DELETE = 0,
- GDK_DESTROY = 1,
- GDK_EXPOSE = 2,
- GDK_MOTION_NOTIFY = 3,
- GDK_BUTTON_PRESS = 4,
- GDK_2BUTTON_PRESS = 5,
- GDK_3BUTTON_PRESS = 6,
- GDK_BUTTON_RELEASE = 7,
- GDK_KEY_PRESS = 8,
- GDK_KEY_RELEASE = 9,
- GDK_ENTER_NOTIFY = 10,
- GDK_LEAVE_NOTIFY = 11,
- GDK_FOCUS_CHANGE = 12,
- GDK_CONFIGURE = 13,
- GDK_MAP = 14,
- GDK_UNMAP = 15,
- GDK_PROPERTY_NOTIFY = 16,
- GDK_SELECTION_CLEAR = 17,
- GDK_SELECTION_REQUEST = 18,
- GDK_SELECTION_NOTIFY = 19,
- GDK_PROXIMITY_IN = 20,
- GDK_PROXIMITY_OUT = 21,
- GDK_DRAG_BEGIN = 22,
- GDK_DRAG_REQUEST = 23,
- GDK_DROP_ENTER = 24,
- GDK_DROP_LEAVE = 25,
- GDK_DROP_DATA_AVAIL = 26,
- GDK_CLIENT_EVENT = 27,
- GDK_VISIBILITY_NOTIFY = 28,
- GDK_NO_EXPOSE = 29,
- GDK_OTHER_EVENT = 9999 /* Deprecated, use filters instead */
-} GdkEventType;
-
-/* Event masks. (Used to select what types of events a window
- * will receive).
- */
-typedef enum
-{
- GDK_EXPOSURE_MASK = 1 << 1,
- GDK_POINTER_MOTION_MASK = 1 << 2,
- GDK_POINTER_MOTION_HINT_MASK = 1 << 3,
- GDK_BUTTON_MOTION_MASK = 1 << 4,
- GDK_BUTTON1_MOTION_MASK = 1 << 5,
- GDK_BUTTON2_MOTION_MASK = 1 << 6,
- GDK_BUTTON3_MOTION_MASK = 1 << 7,
- GDK_BUTTON_PRESS_MASK = 1 << 8,
- GDK_BUTTON_RELEASE_MASK = 1 << 9,
- GDK_KEY_PRESS_MASK = 1 << 10,
- GDK_KEY_RELEASE_MASK = 1 << 11,
- GDK_ENTER_NOTIFY_MASK = 1 << 12,
- GDK_LEAVE_NOTIFY_MASK = 1 << 13,
- GDK_FOCUS_CHANGE_MASK = 1 << 14,
- GDK_STRUCTURE_MASK = 1 << 15,
- GDK_PROPERTY_CHANGE_MASK = 1 << 16,
- GDK_VISIBILITY_NOTIFY_MASK = 1 << 17,
- GDK_PROXIMITY_IN_MASK = 1 << 18,
- GDK_PROXIMITY_OUT_MASK = 1 << 19,
- GDK_ALL_EVENTS_MASK = 0x07FFFF
-} GdkEventMask;
-
-/* Types of enter/leave notifications.
- * Ancestor:
- * Virtual:
- * Inferior:
- * Nonlinear:
- * NonlinearVirtual:
- * Unknown: An unknown type of enter/leave event occurred.
- */
-typedef enum
-{
- GDK_NOTIFY_ANCESTOR = 0,
- GDK_NOTIFY_VIRTUAL = 1,
- GDK_NOTIFY_INFERIOR = 2,
- GDK_NOTIFY_NONLINEAR = 3,
- GDK_NOTIFY_NONLINEAR_VIRTUAL = 4,
- GDK_NOTIFY_UNKNOWN = 5
-} GdkNotifyType;
-
-/* Types of modifiers.
- */
-typedef enum
-{
- GDK_SHIFT_MASK = 1 << 0,
- GDK_LOCK_MASK = 1 << 1,
- GDK_CONTROL_MASK = 1 << 2,
- GDK_MOD1_MASK = 1 << 3,
- GDK_MOD2_MASK = 1 << 4,
- GDK_MOD3_MASK = 1 << 5,
- GDK_MOD4_MASK = 1 << 6,
- GDK_MOD5_MASK = 1 << 7,
- GDK_BUTTON1_MASK = 1 << 8,
- GDK_BUTTON2_MASK = 1 << 9,
- GDK_BUTTON3_MASK = 1 << 10,
- GDK_BUTTON4_MASK = 1 << 11,
- GDK_BUTTON5_MASK = 1 << 12
-} GdkModifierType;
-
-typedef enum
-{
- GDK_CLIP_BY_CHILDREN = 0,
- GDK_INCLUDE_INFERIORS = 1
-} GdkSubwindowMode;
-
-typedef enum
-{
- GDK_INPUT_READ = 1 << 0,
- GDK_INPUT_WRITE = 1 << 1,
- GDK_INPUT_EXCEPTION = 1 << 2
-} GdkInputCondition;
-
-typedef enum
-{
- GDK_OK = 0,
- GDK_ERROR = -1,
- GDK_ERROR_PARAM = -2,
- GDK_ERROR_FILE = -3,
- GDK_ERROR_MEM = -4
-} GdkStatus;
-
-typedef enum
-{
- GDK_LSB_FIRST,
- GDK_MSB_FIRST
-} GdkByteOrder;
-
-typedef enum
-{
- GDK_GC_FOREGROUND = 1 << 0,
- GDK_GC_BACKGROUND = 1 << 1,
- GDK_GC_FONT = 1 << 2,
- GDK_GC_FUNCTION = 1 << 3,
- GDK_GC_FILL = 1 << 4,
- GDK_GC_TILE = 1 << 5,
- GDK_GC_STIPPLE = 1 << 6,
- GDK_GC_CLIP_MASK = 1 << 7,
- GDK_GC_SUBWINDOW = 1 << 8,
- GDK_GC_TS_X_ORIGIN = 1 << 9,
- GDK_GC_TS_Y_ORIGIN = 1 << 10,
- GDK_GC_CLIP_X_ORIGIN = 1 << 11,
- GDK_GC_CLIP_Y_ORIGIN = 1 << 12,
- GDK_GC_EXPOSURES = 1 << 13,
- GDK_GC_LINE_WIDTH = 1 << 14,
- GDK_GC_LINE_STYLE = 1 << 15,
- GDK_GC_CAP_STYLE = 1 << 16,
- GDK_GC_JOIN_STYLE = 1 << 17
-} GdkGCValuesMask;
-
-typedef enum
-{
- GDK_SELECTION_PRIMARY = 1,
- GDK_SELECTION_SECONDARY = 2
-} GdkSelection;
-
-typedef enum
-{
- GDK_PROPERTY_NEW_VALUE,
- GDK_PROPERTY_DELETE
-} GdkPropertyState;
-
-typedef enum
-{
- GDK_PROP_MODE_REPLACE,
- GDK_PROP_MODE_PREPEND,
- GDK_PROP_MODE_APPEND
-} GdkPropMode;
-
-/* These definitions are for version 1 of the OffiX D&D protocol,
- taken from <OffiX/DragAndDropTypes.h> */
-typedef enum
-{
- GDK_DNDTYPE_NOTDND = -1,
- GDK_DNDTYPE_UNKNOWN = 0,
- GDK_DNDTYPE_RAWDATA = 1,
- GDK_DNDTYPE_FILE = 2,
- GDK_DNDTYPE_FILES = 3,
- GDK_DNDTYPE_TEXT = 4,
- GDK_DNDTYPE_DIR = 5,
- GDK_DNDTYPE_LINK = 6,
- GDK_DNDTYPE_EXE = 7,
- GDK_DNDTYPE_URL = 8,
- GDK_DNDTYPE_MIME = 9,
- GDK_DNDTYPE_END = 10
-} GdkDndType;
-
-/* Enums for XInput support */
-
-typedef enum
-{
- GDK_SOURCE_MOUSE,
- GDK_SOURCE_PEN,
- GDK_SOURCE_ERASER,
- GDK_SOURCE_CURSOR
-} GdkInputSource;
-
-typedef enum
-{
- GDK_MODE_DISABLED,
- GDK_MODE_SCREEN,
- GDK_MODE_WINDOW
-} GdkInputMode;
-
-typedef enum
-{
- GDK_AXIS_IGNORE,
- GDK_AXIS_X,
- GDK_AXIS_Y,
- GDK_AXIS_PRESSURE,
- GDK_AXIS_XTILT,
- GDK_AXIS_YTILT,
- GDK_AXIS_LAST
-} GdkAxisUse;
-
-/* The next two types define enums for predefined atoms relating
- to selections. In general, one will need to use gdk_intern_atom */
-
-typedef enum
-{
- GDK_TARGET_BITMAP = 5,
- GDK_TARGET_COLORMAP = 7,
- GDK_TARGET_DRAWABLE = 17,
- GDK_TARGET_PIXMAP = 20,
- GDK_TARGET_STRING = 31
-} GdkTarget;
-
-typedef enum
-{
- GDK_SELECTION_TYPE_ATOM = 4,
- GDK_SELECTION_TYPE_BITMAP = 5,
- GDK_SELECTION_TYPE_COLORMAP = 7,
- GDK_SELECTION_TYPE_DRAWABLE = 17,
- GDK_SELECTION_TYPE_INTEGER = 19,
- GDK_SELECTION_TYPE_PIXMAP = 20,
- GDK_SELECTION_TYPE_WINDOW = 33,
- GDK_SELECTION_TYPE_STRING = 31
-} GdkSelectionType;
-
-typedef enum
-{
- GDK_EXTENSION_EVENTS_NONE,
- GDK_EXTENSION_EVENTS_ALL,
- GDK_EXTENSION_EVENTS_CURSOR
-} GdkExtensionMode;
-
-typedef enum
-{
- GdkIMPreeditArea = 0x0001L,
- GdkIMPreeditCallbacks = 0x0002L,
- GdkIMPreeditPosition = 0x0004L,
- GdkIMPreeditNothing = 0x0008L,
- GdkIMPreeditNone = 0x0010L,
- GdkIMStatusArea = 0x0100L,
- GdkIMStatusCallbacks = 0x0200L,
- GdkIMStatusNothing = 0x0400L,
- GdkIMStatusNone = 0x0800L
-} GdkIMStyle;
-
-/* The next two enumeration values current match the
- * Motif constants. If this is changed, the implementation
- * of gdk_window_set_decorations/gdk_window_set_functions
- * will need to change as well.
- */
-typedef enum
-{
- GDK_DECOR_ALL = 1 << 0,
- GDK_DECOR_BORDER = 1 << 1,
- GDK_DECOR_RESIZEH = 1 << 2,
- GDK_DECOR_TITLE = 1 << 3,
- GDK_DECOR_MENU = 1 << 4,
- GDK_DECOR_MINIMIZE = 1 << 5,
- GDK_DECOR_MAXIMIZE = 1 << 6
-} GdkWMDecoration;
-
-typedef enum
-{
- GDK_FUNC_ALL = 1 << 0,
- GDK_FUNC_RESIZE = 1 << 1,
- GDK_FUNC_MOVE = 1 << 2,
- GDK_FUNC_MINIMIZE = 1 << 3,
- GDK_FUNC_MAXIMIZE = 1 << 4,
- GDK_FUNC_CLOSE = 1 << 5
-} GdkWMFunction;
-
-#define GdkIMPreeditMask \
- ( GdkIMPreeditArea | GdkIMPreeditCallbacks | \
- GdkIMPreeditPosition | GdkIMPreeditNothing | \
- GdkIMPreeditNone )
-
-#define GdkIMStatusMask \
- ( GdkIMStatusArea | GdkIMStatusCallbacks | \
- GdkIMStatusNothing | GdkIMStatusNone )
-
-typedef void (*GdkInputFunction) (gpointer data,
- gint source,
- GdkInputCondition condition);
-
-typedef void (*GdkDestroyNotify) (gpointer data);
-
-/* Color Context modes.
- *
- * GDK_CC_MODE_UNDEFINED - unknown
- * GDK_CC_MODE_BW - default B/W
- * GDK_CC_MODE_STD_CMAP - has a standard colormap
- * GDK_CC_MODE_TRUE - is a TrueColor/DirectColor visual
- * GDK_CC_MODE_MY_GRAY - my grayramp
- * GDK_CC_MODE_PALETTE - has a pre-allocated palette
- */
-
-typedef enum
-{
- GDK_CC_MODE_UNDEFINED,
- GDK_CC_MODE_BW,
- GDK_CC_MODE_STD_CMAP,
- GDK_CC_MODE_TRUE,
- GDK_CC_MODE_MY_GRAY,
- GDK_CC_MODE_PALETTE
-} GdkColorContextMode;
-
-/* Types of overlapping between a rectangle and a region
- * GDK_OVERLAP_RECTANGLE_IN: rectangle is in region
- * GDK_OVERLAP_RECTANGLE_OUT: rectangle in not in region
- * GDK_OVERLAP_RECTANGLE_PART: rectangle in partially in region
- */
-
-typedef enum
-{
- GDK_OVERLAP_RECTANGLE_IN,
- GDK_OVERLAP_RECTANGLE_OUT,
- GDK_OVERLAP_RECTANGLE_PART
-} GdkOverlapType;
-
-/* The color type.
- * A color consists of red, green and blue values in the
- * range 0-65535 and a pixel value. The pixel value is highly
- * dependent on the depth and colormap which this color will
- * be used to draw into. Therefore, sharing colors between
- * colormaps is a bad idea.
- */
-struct _GdkColor
-{
- gulong pixel;
- gushort red;
- gushort green;
- gushort blue;
-};
-
-/* The colormap type.
- * Colormaps consist of 256 colors.
- */
-struct _GdkColormap
-{
- GdkColor colors[256];
-};
-
-/* The visual type.
- * "type" is the type of visual this is (PseudoColor, TrueColor, etc).
- * "depth" is the bit depth of this visual.
- * "colormap_size" is the size of a colormap for this visual.
- * "bits_per_rgb" is the number of significant bits per red, green and blue.
- * The red, green and blue masks, shifts and precisions refer
- * to value needed to calculate pixel values in TrueColor and DirectColor
- * visuals. The "mask" is the significant bits within the pixel. The
- * "shift" is the number of bits left we must shift a primary for it
- * to be in position (according to the "mask"). "prec" refers to how
- * much precision the pixel value contains for a particular primary.
- */
-struct _GdkVisual
-{
- GdkVisualType type;
- gint depth;
- GdkByteOrder byte_order;
- gint colormap_size;
- gint bits_per_rgb;
-
- guint32 red_mask;
- gint red_shift;
- gint red_prec;
-
- guint32 green_mask;
- gint green_shift;
- gint green_prec;
-
- guint32 blue_mask;
- gint blue_shift;
- gint blue_prec;
-};
-
-struct _GdkWindowAttr
-{
- gchar *title;
- gint event_mask;
- gint16 x, y;
- gint16 width;
- gint16 height;
- GdkWindowClass wclass;
- GdkVisual *visual;
- GdkColormap *colormap;
- GdkWindowType window_type;
- GdkCursor *cursor;
- gchar *wmclass_name;
- gchar *wmclass_class;
- gboolean override_redirect;
-};
-
-struct _GdkWindow
-{
- gpointer user_data;
-};
-
-struct _GdkImage
-{
- GdkImageType type;
- GdkVisual *visual; /* visual used to create the image */
- GdkByteOrder byte_order;
- guint16 width;
- guint16 height;
- guint16 depth;
- guint16 bpp; /* bytes per pixel */
- guint16 bpl; /* bytes per line */
- gpointer mem;
-};
-
-struct _GdkGCValues
-{
- GdkColor foreground;
- GdkColor background;
- GdkFont *font;
- GdkFunction function;
- GdkFill fill;
- GdkPixmap *tile;
- GdkPixmap *stipple;
- GdkPixmap *clip_mask;
- GdkSubwindowMode subwindow_mode;
- gint ts_x_origin;
- gint ts_y_origin;
- gint clip_x_origin;
- gint clip_y_origin;
- gint graphics_exposures;
- gint line_width;
- GdkLineStyle line_style;
- GdkCapStyle cap_style;
- GdkJoinStyle join_style;
-};
-
-struct _GdkGC
-{
- gint dummy_var;
-};
-
-struct _GdkPoint
-{
- gint16 x;
- gint16 y;
-};
-
-struct _GdkRectangle
-{
- gint16 x;
- gint16 y;
- guint16 width;
- guint16 height;
-};
-
-struct _GdkSegment
-{
- gint16 x1;
- gint16 y1;
- gint16 x2;
- gint16 y2;
-};
-
-struct _GdkFont
-{
- GdkFontType type;
- gint ascent;
- gint descent;
-};
-
-struct _GdkCursor
-{
- GdkCursorType type;
-};
-
-struct _GdkColorContextDither
-{
- gint fast_rgb[32][32][32]; /* quick look-up table for faster rendering */
- gint fast_err[32][32][32]; /* internal RGB error information */
- gint fast_erg[32][32][32];
- gint fast_erb[32][32][32];
-};
-
-struct _GdkColorContext
-{
- GdkVisual *visual;
- GdkColormap *colormap;
-
- gint num_colors; /* available no. of colors in colormap */
- gint max_colors; /* maximum no. of colors */
- gint num_allocated; /* no. of allocated colors */
-
- GdkColorContextMode mode;
- gint need_to_free_colormap;
- GdkAtom std_cmap_atom;
-
- gulong *clut; /* color look-up table */
- GdkColor *cmap; /* colormap */
-
- GHashTable *color_hash; /* hash table of allocated colors */
- GdkColor *palette; /* preallocated palette */
- gint num_palette; /* size of palette */
-
- GdkColorContextDither *fast_dither; /* fast dither matrix */
-
- struct
- {
- gint red;
- gint green;
- gint blue;
- } shifts;
-
- struct
- {
- gulong red;
- gulong green;
- gulong blue;
- } masks;
-
- struct
- {
- gint red;
- gint green;
- gint blue;
- } bits;
-
- gulong max_entry;
-
- gulong black_pixel;
- gulong white_pixel;
-};
-
-/* Types for XInput support */
-
-struct _GdkDeviceKey
-{
- guint keyval;
- GdkModifierType modifiers;
-};
-
-struct _GdkDeviceInfo
-{
- guint32 deviceid;
- gchar *name;
- GdkInputSource source;
- GdkInputMode mode;
- gint has_cursor; /* TRUE if the X pointer follows device motion */
- gint num_axes;
- GdkAxisUse *axes; /* Specifies use for each axis */
- gint num_keys;
- GdkDeviceKey *keys;
-};
-
-struct _GdkTimeCoord
-{
- guint32 time;
- gdouble x;
- gdouble y;
- gdouble pressure;
- gdouble xtilt;
- gdouble ytilt;
-};
-
-/* Event filtering */
-
-typedef void GdkXEvent; /* Can be cast to XEvent */
-
-typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
- GdkEvent *event,
- gpointer data);
-
-struct _GdkEventAny
-{
- GdkEventType type;
- GdkWindow *window;
- gint8 send_event;
-};
-
-struct _GdkEventExpose
-{
- GdkEventType type;
- GdkWindow *window;
- gint8 send_event;
- GdkRectangle area;
- gint count; /* If non-zero, how many more events follow. */
-};
-
-struct _GdkEventNoExpose
-{
- GdkEventType type;
- GdkWindow *window;
- gint8 send_event;
- /* XXX: does anyone need the X major_code or minor_code fields? */
-};
-
-struct _GdkEventVisibility
-{
- GdkEventType type;
- GdkWindow *window;
- gint8 send_event;
- GdkVisibilityState state;
-};
-
-struct _GdkEventMotion
-{
- GdkEventType type;
- GdkWindow *window;
- gint8 send_event;
- guint32 time;
- gdouble x;
- gdouble y;
- gdouble pressure;
- gdouble xtilt;
- gdouble ytilt;
- guint state;
- gint16 is_hint;
- GdkInputSource source;
- guint32 deviceid;
- gdouble x_root, y_root;
-};
-
-struct _GdkEventButton
-{
- GdkEventType type;
- GdkWindow *window;
- gint8 send_event;
- guint32 time;
- gdouble x;
- gdouble y;
- gdouble pressure;
- gdouble xtilt;
- gdouble ytilt;
- guint state;
- guint button;
- GdkInputSource source;
- guint32 deviceid;
- gdouble x_root, y_root;
-};
-
-struct _GdkEventKey
-{
- GdkEventType type;
- GdkWindow *window;
- gint8 send_event;
- guint32 time;
- guint state;
- guint keyval;
- gint length;
- gchar *string;
-};
-
-struct _GdkEventCrossing
-{
- GdkEventType type;
- GdkWindow *window;
- gint8 send_event;
- GdkWindow *subwindow;
- GdkNotifyType detail;
-};
-
-struct _GdkEventFocus
-{
- GdkEventType type;
- GdkWindow *window;
- gint8 send_event;
- gint16 in;
-};
-
-struct _GdkEventConfigure
-{
- GdkEventType type;
- GdkWindow *window;
- gint8 send_event;
- gint16 x, y;
- gint16 width;
- gint16 height;
-};
-
-struct _GdkEventProperty
-{
- GdkEventType type;
- GdkWindow *window;
- gint8 send_event;
- GdkAtom atom;
- guint32 time;
- guint state;
-};
-
-struct _GdkEventSelection
-{
- GdkEventType type;
- GdkWindow *window;
- gint8 send_event;
- GdkAtom selection;
- GdkAtom target;
- GdkAtom property;
- guint32 requestor;
- guint32 time;
-};
-
-/* This event type will be used pretty rarely. It only is important
- for XInput aware programs that are drawing their own cursor */
-
-struct _GdkEventProximity
-{
- GdkEventType type;
- GdkWindow *window;
- gint8 send_event;
- guint32 time;
- GdkInputSource source;
- guint32 deviceid;
-};
-
-struct _GdkEventDragRequest
-{
- GdkEventType type;
- GdkWindow *window;
- gint8 send_event;
- guint32 requestor;
- union {
- struct {
- guint protocol_version:4;
- guint sendreply:1;
- guint willaccept:1;
- guint delete_data:1; /* Do *not* delete if link is sent, only
- if data is sent */
- guint senddata:1;
- guint reserved:22;
- } flags;
- glong allflags;
- } u;
- guint8 isdrop; /* This gdk event can be generated by a couple of
- X events - this lets the app know whether the
- drop really occurred or we just set the data */
-
- GdkPoint drop_coords;
- gchar *data_type;
- guint32 timestamp;
-};
-
-struct _GdkEventDragBegin
-{
- GdkEventType type;
- GdkWindow *window;
- gint8 send_event;
- union {
- struct {
- guint protocol_version:4;
- guint reserved:28;
- } flags;
- glong allflags;
- } u;
-};
-
-struct _GdkEventDropEnter
-{
- GdkEventType type;
- GdkWindow *window;
- gint8 send_event;
- guint32 requestor;
- union {
- struct {
- guint protocol_version:4;
- guint sendreply:1;
- guint extended_typelist:1;
- guint reserved:26;
- } flags;
- glong allflags;
- } u;
-};
-
-struct _GdkEventDropLeave
-{
- GdkEventType type;
- GdkWindow *window;
- gint8 send_event;
- guint32 requestor;
- union {
- struct {
- guint protocol_version:4;
- guint reserved:28;
- } flags;
- glong allflags;
- } u;
-};
-
-struct _GdkEventDropDataAvailable
-{
- GdkEventType type;
- GdkWindow *window;
- gint8 send_event;
- guint32 requestor;
- union {
- struct {
- guint protocol_version:4;
- guint isdrop:1;
- guint reserved:25;
- } flags;
- glong allflags;
- } u;
- gchar *data_type; /* MIME type */
- gulong data_numbytes;
- gpointer data;
- guint32 timestamp;
- GdkPoint coords;
-};
-
-struct _GdkEventClient
-{
- GdkEventType type;
- GdkWindow *window;
- gint8 send_event;
- GdkAtom message_type;
- gushort data_format;
- union {
- char b[20];
- short s[10];
- long l[5];
- } data;
-};
-
-struct _GdkEventOther
-{
- GdkEventType type;
- GdkWindow *window;
- gint8 send_event;
- GdkXEvent *xevent;
-};
-
-union _GdkEvent
-{
- GdkEventType type;
- GdkEventAny any;
- GdkEventExpose expose;
- GdkEventNoExpose no_expose;
- GdkEventVisibility visibility;
- GdkEventMotion motion;
- GdkEventButton button;
- GdkEventKey key;
- GdkEventCrossing crossing;
- GdkEventFocus focus_change;
- GdkEventConfigure configure;
- GdkEventProperty property;
- GdkEventSelection selection;
- GdkEventProximity proximity;
- GdkEventDragBegin dragbegin;
- GdkEventDragRequest dragrequest;
- GdkEventDropEnter dropenter;
- GdkEventDropLeave dropleave;
- GdkEventDropDataAvailable dropdataavailable;
- GdkEventClient client;
- GdkEventOther other;
-};
-
-struct _GdkRegion
-{
- gpointer user_data;
-};
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GDK_TYPES_H__ */
diff --git a/gdk/gdkvisual.c b/gdk/gdkvisual.c
deleted file mode 100644
index c6365de9cd..0000000000
--- a/gdk/gdkvisual.c
+++ /dev/null
@@ -1,433 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include "gdk.h"
-#include "gdkprivate.h"
-
-
-static void gdk_visual_add (GdkVisual *visual);
-static void gdk_visual_decompose_mask (gulong mask,
- gint *shift,
- gint *prec);
-static guint gdk_visual_hash (Visual *key);
-static gint gdk_visual_compare (Visual *a,
- Visual *b);
-
-
-static GdkVisualPrivate *system_visual;
-static GdkVisualPrivate *visuals;
-static gint nvisuals;
-
-static gint available_depths[4];
-static gint navailable_depths;
-
-static GdkVisualType available_types[6];
-static gint navailable_types;
-
-static char* visual_names[] =
-{
- "static gray",
- "grayscale",
- "static color",
- "pseudo color",
- "true color",
- "direct color",
-};
-
-static GHashTable *visual_hash = NULL;
-
-void
-gdk_visual_init ()
-{
- static gint possible_depths[6] = { 32, 24, 16, 15, 8, 1 };
- static GdkVisualType possible_types[6] =
- {
- GDK_VISUAL_DIRECT_COLOR,
- GDK_VISUAL_TRUE_COLOR,
- GDK_VISUAL_PSEUDO_COLOR,
- GDK_VISUAL_STATIC_COLOR,
- GDK_VISUAL_GRAYSCALE,
- GDK_VISUAL_STATIC_GRAY
- };
-
- static gint npossible_depths = 6;
- static gint npossible_types = 6;
-
- XVisualInfo *visual_list;
- XVisualInfo visual_template;
- GdkVisualPrivate temp_visual;
- Visual *default_xvisual;
- int nxvisuals;
- int i, j;
-
- visual_template.screen = gdk_screen;
- visual_list = XGetVisualInfo (gdk_display, VisualScreenMask, &visual_template, &nxvisuals);
- visuals = g_new (GdkVisualPrivate, nxvisuals);
-
- default_xvisual = DefaultVisual (gdk_display, gdk_screen);
-
- nvisuals = 0;
- for (i = 0; i < nxvisuals; i++)
- {
- if (visual_list[i].depth >= 1)
- {
-#ifdef __cplusplus
- switch (visual_list[i].c_class)
-#else /* __cplusplus */
- switch (visual_list[i].class)
-#endif /* __cplusplus */
- {
- case StaticGray:
- visuals[nvisuals].visual.type = GDK_VISUAL_STATIC_GRAY;
- break;
- case GrayScale:
- visuals[nvisuals].visual.type = GDK_VISUAL_GRAYSCALE;
- break;
- case StaticColor:
- visuals[nvisuals].visual.type = GDK_VISUAL_STATIC_COLOR;
- break;
- case PseudoColor:
- visuals[nvisuals].visual.type = GDK_VISUAL_PSEUDO_COLOR;
- break;
- case TrueColor:
- visuals[nvisuals].visual.type = GDK_VISUAL_TRUE_COLOR;
- break;
- case DirectColor:
- visuals[nvisuals].visual.type = GDK_VISUAL_DIRECT_COLOR;
- break;
- }
-
- visuals[nvisuals].visual.depth = visual_list[i].depth;
- visuals[nvisuals].visual.byte_order =
- (ImageByteOrder(gdk_display) == LSBFirst) ?
- GDK_LSB_FIRST : GDK_MSB_FIRST;
- visuals[nvisuals].visual.red_mask = visual_list[i].red_mask;
- visuals[nvisuals].visual.green_mask = visual_list[i].green_mask;
- visuals[nvisuals].visual.blue_mask = visual_list[i].blue_mask;
- visuals[nvisuals].visual.colormap_size = visual_list[i].colormap_size;
- visuals[nvisuals].visual.bits_per_rgb = visual_list[i].bits_per_rgb;
- visuals[nvisuals].xvisual = visual_list[i].visual;
-
- if ((visuals[nvisuals].visual.type == GDK_VISUAL_TRUE_COLOR) ||
- (visuals[nvisuals].visual.type == GDK_VISUAL_DIRECT_COLOR))
- {
- gdk_visual_decompose_mask (visuals[nvisuals].visual.red_mask,
- &visuals[nvisuals].visual.red_shift,
- &visuals[nvisuals].visual.red_prec);
-
- gdk_visual_decompose_mask (visuals[nvisuals].visual.green_mask,
- &visuals[nvisuals].visual.green_shift,
- &visuals[nvisuals].visual.green_prec);
-
- gdk_visual_decompose_mask (visuals[nvisuals].visual.blue_mask,
- &visuals[nvisuals].visual.blue_shift,
- &visuals[nvisuals].visual.blue_prec);
- }
- else
- {
- visuals[nvisuals].visual.red_mask = 0;
- visuals[nvisuals].visual.red_shift = 0;
- visuals[nvisuals].visual.red_prec = 0;
-
- visuals[nvisuals].visual.green_mask = 0;
- visuals[nvisuals].visual.green_shift = 0;
- visuals[nvisuals].visual.green_prec = 0;
-
- visuals[nvisuals].visual.blue_mask = 0;
- visuals[nvisuals].visual.blue_shift = 0;
- visuals[nvisuals].visual.blue_prec = 0;
- }
-
- nvisuals += 1;
- }
- }
-
- XFree (visual_list);
-
- for (i = 0; i < nvisuals; i++)
- {
- for (j = i+1; j < nvisuals; j++)
- {
- if (visuals[j].visual.depth >= visuals[i].visual.depth)
- {
- if ((visuals[j].visual.depth == 8) && (visuals[i].visual.depth == 8))
- {
- if (visuals[j].visual.type == GDK_VISUAL_PSEUDO_COLOR)
- {
- temp_visual = visuals[j];
- visuals[j] = visuals[i];
- visuals[i] = temp_visual;
- }
- else if ((visuals[i].visual.type != GDK_VISUAL_PSEUDO_COLOR) &&
- visuals[j].visual.type > visuals[i].visual.type)
- {
- temp_visual = visuals[j];
- visuals[j] = visuals[i];
- visuals[i] = temp_visual;
- }
- }
- else if ((visuals[j].visual.depth > visuals[i].visual.depth) ||
- ((visuals[j].visual.depth == visuals[i].visual.depth) &&
- (visuals[j].visual.type > visuals[i].visual.type)))
- {
- temp_visual = visuals[j];
- visuals[j] = visuals[i];
- visuals[i] = temp_visual;
- }
- }
- }
- }
-
- for (i = 0; i < nvisuals; i++)
- if (default_xvisual->visualid == visuals[i].xvisual->visualid)
- {
- system_visual = &visuals[i];
- break;
- }
-
-#ifdef G_ENABLE_DEBUG
- if (gdk_debug_flags & GDK_DEBUG_MISC)
- for (i = 0; i < nvisuals; i++)
- g_print ("visual: %s: %d\n",
- visual_names[visuals[i].visual.type],
- visuals[i].visual.depth);
-#endif /* G_ENABLE_DEBUG */
-
- navailable_depths = 0;
- for (i = 0; i < npossible_depths; i++)
- {
- for (j = 0; j < nvisuals; j++)
- {
- if (visuals[j].visual.depth == possible_depths[i])
- {
- available_depths[navailable_depths++] = visuals[j].visual.depth;
- break;
- }
- }
- }
-
- if (navailable_depths == 0)
- g_error ("unable to find a usable depth");
-
- navailable_types = 0;
- for (i = 0; i < npossible_types; i++)
- {
- for (j = 0; j < nvisuals; j++)
- {
- if (visuals[j].visual.type == possible_types[i])
- {
- available_types[navailable_types++] = visuals[j].visual.type;
- break;
- }
- }
- }
-
- for (i = 0; i < nvisuals; i++)
- gdk_visual_add ((GdkVisual*) &visuals[i]);
-
- if (npossible_types == 0)
- g_error ("unable to find a usable visual type");
-}
-
-GdkVisual*
-gdk_visual_ref (GdkVisual *visual)
-{
- return visual;
-}
-
-void
-gdk_visual_unref (GdkVisual *visual)
-{
- return;
-}
-
-gint
-gdk_visual_get_best_depth ()
-{
- return available_depths[0];
-}
-
-GdkVisualType
-gdk_visual_get_best_type ()
-{
- return available_types[0];
-}
-
-GdkVisual*
-gdk_visual_get_system ()
-{
- return ((GdkVisual*) system_visual);
-}
-
-GdkVisual*
-gdk_visual_get_best ()
-{
- return ((GdkVisual*) &(visuals[0]));
-}
-
-GdkVisual*
-gdk_visual_get_best_with_depth (gint depth)
-{
- GdkVisual *return_val;
- int i;
-
- return_val = NULL;
- for (i = 0; i < nvisuals; i++)
- if (depth == visuals[i].visual.depth)
- {
- return_val = (GdkVisual*) &(visuals[i]);
- break;
- }
-
- return return_val;
-}
-
-GdkVisual*
-gdk_visual_get_best_with_type (GdkVisualType visual_type)
-{
- GdkVisual *return_val;
- int i;
-
- return_val = NULL;
- for (i = 0; i < nvisuals; i++)
- if (visual_type == visuals[i].visual.type)
- {
- return_val = (GdkVisual*) &(visuals[i]);
- break;
- }
-
- return return_val;
-}
-
-GdkVisual*
-gdk_visual_get_best_with_both (gint depth,
- GdkVisualType visual_type)
-{
- GdkVisual *return_val;
- int i;
-
- return_val = NULL;
- for (i = 0; i < nvisuals; i++)
- if ((depth == visuals[i].visual.depth) &&
- (visual_type == visuals[i].visual.type))
- {
- return_val = (GdkVisual*) &(visuals[i]);
- break;
- }
-
- return return_val;
-}
-
-void
-gdk_query_depths (gint **depths,
- gint *count)
-{
- *count = navailable_depths;
- *depths = available_depths;
-}
-
-void
-gdk_query_visual_types (GdkVisualType **visual_types,
- gint *count)
-{
- *count = navailable_types;
- *visual_types = available_types;
-}
-
-void
-gdk_query_visuals (GdkVisual **visual_return,
- gint *count)
-{
- *count = nvisuals;
- *visual_return = (GdkVisual*) visuals;
-}
-
-
-GdkVisual*
-gdk_visual_lookup (Visual *xvisual)
-{
- GdkVisual *visual;
-
- if (!visual_hash)
- return NULL;
-
- visual = g_hash_table_lookup (visual_hash, xvisual);
- return visual;
-}
-
-GdkVisual*
-gdkx_visual_get (VisualID xvisualid)
-{
- int i;
-
- for (i = 0; i < nvisuals; i++)
- if (xvisualid == visuals[i].xvisual->visualid)
- return (GdkVisual*) &visuals[i];
-
- return NULL;
-}
-
-
-static void
-gdk_visual_add (GdkVisual *visual)
-{
- GdkVisualPrivate *private;
-
- if (!visual_hash)
- visual_hash = g_hash_table_new ((GHashFunc) gdk_visual_hash,
- (GCompareFunc) gdk_visual_compare);
-
- private = (GdkVisualPrivate*) visual;
-
- g_hash_table_insert (visual_hash, private->xvisual, visual);
-}
-
-static void
-gdk_visual_decompose_mask (gulong mask,
- gint *shift,
- gint *prec)
-{
- *shift = 0;
- *prec = 0;
-
- while (!(mask & 0x1))
- {
- (*shift)++;
- mask >>= 1;
- }
-
- while (mask & 0x1)
- {
- (*prec)++;
- mask >>= 1;
- }
-}
-
-static guint
-gdk_visual_hash (Visual *key)
-{
- return key->visualid;
-}
-
-static gint
-gdk_visual_compare (Visual *a,
- Visual *b)
-{
- return (a->visualid == b->visualid);
-}
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
deleted file mode 100644
index 579b9703b1..0000000000
--- a/gdk/gdkwindow.c
+++ /dev/null
@@ -1,1814 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Xatom.h>
-#include <X11/extensions/shape.h>
-#include <netinet/in.h>
-#include "gdk.h"
-#include "../config.h"
-#include "gdkinput.h"
-#include "gdkprivate.h"
-#include "MwmUtil.h"
-#include <stdlib.h>
-#include <stdio.h>
-
-int nevent_masks = 17;
-int event_mask_table[19] =
-{
- ExposureMask,
- PointerMotionMask,
- PointerMotionHintMask,
- ButtonMotionMask,
- Button1MotionMask,
- Button2MotionMask,
- Button3MotionMask,
- ButtonPressMask | OwnerGrabButtonMask,
- ButtonReleaseMask | OwnerGrabButtonMask,
- KeyPressMask,
- KeyReleaseMask,
- EnterWindowMask,
- LeaveWindowMask,
- FocusChangeMask,
- StructureNotifyMask,
- PropertyChangeMask,
- VisibilityChangeMask,
- 0, /* PROXIMITY_IN */
- 0 /* PROXIMTY_OUT */
-};
-
-
-/* internal function created for and used by gdk_window_xid_at_coords */
-Window
-gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y)
-{
- GdkWindow *window;
- GdkWindowPrivate *private;
- Display *disp;
- Window *list=NULL;
- Window child=0,parent_win=0,root_win=0;
- unsigned int num,i,ww,wh,wb,wd;
- int wx,wy;
-
- window=(GdkWindow*)&gdk_root_parent;
- private=(GdkWindowPrivate*)window;
- disp=private->xdisplay;
- if (!XGetGeometry(disp,base,&root_win,&wx,&wy,&ww,&wh,&wb,&wd))
- return 0;
- wx+=bx;wy+=by;
- if (!((x>=wx)&&(y>=wy)&&(x<(wx+ww))&&(y<(wy+wh))))
- return 0;
- if (!XQueryTree(disp,base,&root_win,&parent_win,&list,&num))
- return base;
- if (list)
- {
- for (i=num-1;i>=0;i--)
- {
- if ((child=gdk_window_xid_at(list[i],wx,wy,x,y))!=0)
- {
- XFree(list);
- return child;
- }
- }
- }
- return 0;
-}
-
-/*
- * The following fucntion by The Rasterman <raster@redhat.com>
- * This function returns the X Window ID in which the x y location is in
- * (x and y being relative to the root window), excluding any windows listed
- * in the GList excludes (this is a list of X Window ID's - gpointer being
- * the Window ID).
- *
- * This is primarily designed for internal gdk use - for DND for example
- * when using a shaped icon window as the drag object - you exclude the
- * X Window ID of the "icon" (perhaps more if excludes may be needed) and
- * You can get back an X Window ID as to what X Window ID is infact under
- * those X,Y co-ordinates.
- */
-Window
-gdk_window_xid_at_coords(gint x, gint y, GList *excludes)
-{
- GdkWindow *window;
- GdkWindowPrivate *private;
- Display *disp;
- Window *list=NULL;
- Window root,child=0,parent_win=0,root_win=0;
- unsigned int num,i;
-
- window=(GdkWindow*)&gdk_root_parent;
- private=(GdkWindowPrivate*)window;
- disp=private->xdisplay;
- root=private->xwindow;
- if (!XQueryTree(disp,root,&root_win,&parent_win,&list,&num))
- return root;
- if (list)
- {
- for (i=num-1;i>=0;i--)
- {
- if ((child=gdk_window_xid_at(list[i],0,0,x,y))!=0)
- {
- if (excludes)
- {
- if (!g_list_find(excludes,(gpointer)child))
- {
- XFree(list);
- return child;
- }
- }
- else
- {
- XFree(list);
- return child;
- }
- }
- }
- }
- return root;
-}
-
-void
-gdk_window_init ()
-{
- XWindowAttributes xattributes;
- unsigned int width;
- unsigned int height;
- unsigned int border_width;
- unsigned int depth;
- int x, y;
-
- XGetGeometry (gdk_display, gdk_root_window, &gdk_root_window,
- &x, &y, &width, &height, &border_width, &depth);
- XGetWindowAttributes (gdk_display, gdk_root_window, &xattributes);
-
- gdk_root_parent.xdisplay = gdk_display;
- gdk_root_parent.xwindow = gdk_root_window;
- gdk_root_parent.window_type = GDK_WINDOW_ROOT;
- gdk_root_parent.window.user_data = NULL;
- gdk_root_parent.width = width;
- gdk_root_parent.height = height;
-}
-
-GdkWindow*
-gdk_window_new (GdkWindow *parent,
- GdkWindowAttr *attributes,
- gint attributes_mask)
-{
- GdkWindow *window;
- GdkWindowPrivate *private;
- GdkWindowPrivate *parent_private;
- GdkVisual *visual;
- GdkColormap *colormap;
- Display *parent_display;
- Window xparent;
- Visual *xvisual;
- XSetWindowAttributes xattributes;
- long xattributes_mask;
- XSizeHints size_hints;
- XWMHints wm_hints;
- XClassHint *class_hint;
- int x, y, depth;
- unsigned int class;
- char *title;
- int i;
-
- g_return_val_if_fail (attributes != NULL, NULL);
-
- if (!parent)
- parent = (GdkWindow*) &gdk_root_parent;
-
- parent_private = (GdkWindowPrivate*) parent;
- if (parent_private->destroyed)
- return NULL;
-
- xparent = parent_private->xwindow;
- parent_display = parent_private->xdisplay;
-
- private = g_new (GdkWindowPrivate, 1);
- window = (GdkWindow*) private;
-
- private->parent = parent;
- private->xdisplay = parent_display;
- private->destroyed = FALSE;
- private->resize_count = 0;
- private->ref_count = 1;
- xattributes_mask = 0;
-
- if (attributes_mask & GDK_WA_X)
- x = attributes->x;
- else
- x = 0;
-
- if (attributes_mask & GDK_WA_Y)
- y = attributes->y;
- else
- y = 0;
-
- private->x = x;
- private->y = y;
- private->width = (attributes->width > 1) ? (attributes->width) : (1);
- private->height = (attributes->height > 1) ? (attributes->height) : (1);
- private->window_type = attributes->window_type;
- private->extension_events = FALSE;
- private->dnd_drag_data_type = None;
- private->dnd_drag_data_typesavail =
- private->dnd_drop_data_typesavail = NULL;
- private->dnd_drop_enabled = private->dnd_drag_enabled =
- private->dnd_drag_accepted = private->dnd_drag_datashow =
- private->dnd_drop_data_numtypesavail =
- private->dnd_drag_data_numtypesavail = 0;
- private->dnd_drag_eventmask = private->dnd_drag_savedeventmask = 0;
-
- private->filters = NULL;
-
- window->user_data = NULL;
-
- if (attributes_mask & GDK_WA_VISUAL)
- visual = attributes->visual;
- else
- visual = gdk_visual_get_system ();
- xvisual = ((GdkVisualPrivate*) visual)->xvisual;
-
- xattributes.event_mask = StructureNotifyMask;
- for (i = 0; i < nevent_masks; i++)
- {
- if (attributes->event_mask & (1 << (i + 1)))
- xattributes.event_mask |= event_mask_table[i];
- }
-
- if (xattributes.event_mask)
- xattributes_mask |= CWEventMask;
-
- if(attributes_mask & GDK_WA_NOREDIR) {
- xattributes.override_redirect =
- (attributes->override_redirect == FALSE)?False:True;
- xattributes_mask |= CWOverrideRedirect;
- } else
- xattributes.override_redirect = False;
-
- if (attributes->wclass == GDK_INPUT_OUTPUT)
- {
- class = InputOutput;
- depth = visual->depth;
-
- if (attributes_mask & GDK_WA_COLORMAP)
- colormap = attributes->colormap;
- else
- colormap = gdk_colormap_get_system ();
-
- xattributes.background_pixel = BlackPixel (gdk_display, gdk_screen);
- xattributes.border_pixel = BlackPixel (gdk_display, gdk_screen);
- xattributes_mask |= CWBorderPixel | CWBackPixel;
-
- switch (private->window_type)
- {
- case GDK_WINDOW_TOPLEVEL:
- xattributes.colormap = ((GdkColormapPrivate*) colormap)->xcolormap;
- xattributes_mask |= CWColormap;
-
- xparent = gdk_root_window;
- break;
-
- case GDK_WINDOW_CHILD:
- xattributes.colormap = ((GdkColormapPrivate*) colormap)->xcolormap;
- xattributes_mask |= CWColormap;
- break;
-
- case GDK_WINDOW_DIALOG:
- xattributes.colormap = ((GdkColormapPrivate*) colormap)->xcolormap;
- xattributes_mask |= CWColormap;
-
- xparent = gdk_root_window;
- break;
-
- case GDK_WINDOW_TEMP:
- xattributes.colormap = ((GdkColormapPrivate*) colormap)->xcolormap;
- xattributes_mask |= CWColormap;
-
- xparent = gdk_root_window;
-
- xattributes.save_under = True;
- xattributes.override_redirect = True;
- xattributes.cursor = None;
- xattributes_mask |= CWSaveUnder | CWOverrideRedirect;
- break;
- case GDK_WINDOW_ROOT:
- g_error ("cannot make windows of type GDK_WINDOW_ROOT");
- break;
- case GDK_WINDOW_PIXMAP:
- g_error ("cannot make windows of type GDK_WINDOW_PIXMAP (use gdk_pixmap_new)");
- break;
- }
- }
- else
- {
- depth = 0;
- class = InputOnly;
- colormap = NULL;
- }
-
- private->xwindow = XCreateWindow (private->xdisplay, xparent,
- x, y, private->width, private->height,
- 0, depth, class, xvisual,
- xattributes_mask, &xattributes);
- gdk_window_ref (window);
- gdk_xid_table_insert (&private->xwindow, window);
-
- switch (private->window_type)
- {
- case GDK_WINDOW_DIALOG:
- XSetTransientForHint (private->xdisplay, private->xwindow, xparent);
- case GDK_WINDOW_TOPLEVEL:
- case GDK_WINDOW_TEMP:
- XSetWMProtocols (private->xdisplay, private->xwindow, gdk_wm_window_protocols, 2);
- break;
- case GDK_WINDOW_CHILD:
- if ((attributes->wclass == GDK_INPUT_OUTPUT) &&
- (colormap != gdk_colormap_get_system ()) &&
- (colormap != gdk_window_get_colormap (gdk_window_get_toplevel (window))))
- {
- g_print ("adding colormap window\n");
- gdk_window_add_colormap_windows (window);
- }
- break;
- default:
- break;
- }
-
- size_hints.flags = PSize | PBaseSize;
- size_hints.width = private->width;
- size_hints.height = private->height;
- size_hints.base_width = private->width;
- size_hints.base_height = private->height;
-
- wm_hints.flags = InputHint | StateHint | WindowGroupHint;
- wm_hints.window_group = gdk_leader_window;
- wm_hints.input = True;
- wm_hints.initial_state = NormalState;
-
- XSetWMNormalHints (private->xdisplay, private->xwindow, &size_hints);
- XSetWMHints (private->xdisplay, private->xwindow, &wm_hints);
-
- if (attributes_mask & GDK_WA_TITLE)
- title = attributes->title;
- else
- title = gdk_progname;
-
- XmbSetWMProperties (private->xdisplay, private->xwindow,
- title, title,
- NULL, 0,
- NULL, NULL, NULL);
-
- if (attributes_mask & GDK_WA_WMCLASS)
- {
- class_hint = XAllocClassHint ();
- class_hint->res_name = attributes->wmclass_name;
- class_hint->res_class = attributes->wmclass_class;
- XSetClassHint (private->xdisplay, private->xwindow, class_hint);
- XFree (class_hint);
- }
-
- gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
- (attributes->cursor) :
- NULL));
-
- return window;
-}
-
-GdkWindow *
-gdk_window_foreign_new (guint32 anid)
-{
- GdkWindow *window;
- GdkWindowPrivate *private;
- XWindowAttributes attrs;
-
- private = g_new (GdkWindowPrivate, 1);
- window = (GdkWindow*) private;
-
- XGetWindowAttributes (gdk_display, anid, &attrs);
-
- private->parent = NULL;
- private->xwindow = anid;
- private->xdisplay = gdk_display;
- private->x = attrs.x;
- private->y = attrs.y;
- private->width = attrs.width;
- private->height = attrs.height;
- private->resize_count = 0;
- private->ref_count = 1;
- if (anid == attrs.root)
- private->window_type = GDK_WINDOW_ROOT;
- else
- private->window_type = GDK_WINDOW_TOPLEVEL;
- /* the above is probably wrong, but it may not be worth the extra
- X call to get it right */
-
- private->destroyed = FALSE;
- private->extension_events = 0;
- private->filters = NULL;
-
- window->user_data = NULL;
-
- gdk_window_ref (window);
- gdk_xid_table_insert (&private->xwindow, window);
-
- return window;
-}
-
-/* Call this function when you want a window and all its children to
- disappear. When xdestroy is true, a request to destroy the XWindow
- is sent out. When it is false, it is assumed that the XWindow has
- been or will be destroyed by destroying some ancestor of this
- window. */
-
-static void
-gdk_window_internal_destroy (GdkWindow *window, int xdestroy)
-{
- GdkWindowPrivate *private;
- GdkWindowPrivate *temp_private;
- GdkWindow *temp_window;
- GList *children;
- GList *tmp;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
-
- switch (private->window_type)
- {
- case GDK_WINDOW_TOPLEVEL:
- case GDK_WINDOW_CHILD:
- case GDK_WINDOW_DIALOG:
- case GDK_WINDOW_TEMP:
- if (!private->destroyed)
- {
- children = gdk_window_get_children (window);
- tmp = children;
-
- while (tmp)
- {
- temp_window = tmp->data;
- tmp = tmp->next;
-
- temp_private = (GdkWindowPrivate*) temp_window;
- if (temp_private)
- gdk_window_internal_destroy (temp_window, FALSE);
- }
-
- g_list_free (children);
-
- if (private->extension_events != 0)
- gdk_input_window_destroy (window);
-
- if(private->dnd_drag_data_numtypesavail > 0)
- {
- g_free (private->dnd_drag_data_typesavail);
- private->dnd_drag_data_typesavail = NULL;
- }
- if(private->dnd_drop_data_numtypesavail > 0)
- {
- g_free (private->dnd_drop_data_typesavail);
- private->dnd_drop_data_typesavail = NULL;
- }
-
- if (xdestroy)
- XDestroyWindow (private->xdisplay, private->xwindow);
- private->destroyed = TRUE;
- }
- break;
-
- case GDK_WINDOW_ROOT:
- g_error ("attempted to destroy root window");
- break;
-
- case GDK_WINDOW_PIXMAP:
- g_error ("called gdk_window_destroy on a pixmap (use gdk_pixmap_unref)");
- break;
- }
-}
-
-/* Like internal_destroy, but also destroys the reference created by
- gdk_window_new. */
-
-void
-gdk_window_destroy (GdkWindow *window)
-{
- gdk_window_internal_destroy (window, TRUE);
- gdk_window_unref (window);
-}
-
-/* This function is called when the XWindow is really gone. */
-
-void
-gdk_window_destroy_notify (GdkWindow *window)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
-
- gdk_xid_table_remove (private->xwindow);
- gdk_window_unref (window);
-}
-
-GdkWindow*
-gdk_window_ref (GdkWindow *window)
-{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
- g_return_val_if_fail (window != NULL, NULL);
-
- private->ref_count += 1;
- return window;
-}
-
-void
-gdk_window_unref (GdkWindow *window)
-{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
- g_return_if_fail (window != NULL);
-
- private->ref_count -= 1;
- if (private->ref_count == 0)
- {
- if (!private->destroyed)
- g_warning ("losing last reference to undestroyed window\n");
- g_free (window);
- }
-}
-
-void
-gdk_window_show (GdkWindow *window)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
- if (!private->destroyed)
- {
- XRaiseWindow (private->xdisplay, private->xwindow);
- XMapWindow (private->xdisplay, private->xwindow);
- }
-}
-
-void
-gdk_window_hide (GdkWindow *window)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
- if (!private->destroyed)
- XUnmapWindow (private->xdisplay, private->xwindow);
-}
-
-void
-gdk_window_withdraw (GdkWindow *window)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
- if (!private->destroyed)
- XWithdrawWindow (private->xdisplay, private->xwindow, 0);
-}
-
-void
-gdk_window_move (GdkWindow *window,
- gint x,
- gint y)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
- if (!private->destroyed)
- {
- XMoveWindow (private->xdisplay, private->xwindow, x, y);
-
- if (private->window_type == GDK_WINDOW_CHILD)
- {
- private->x = x;
- private->y = y;
- }
- }
-}
-
-void
-gdk_window_resize (GdkWindow *window,
- gint width,
- gint height)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- if (width < 1)
- width = 1;
- if (height < 1)
- height = 1;
-
- private = (GdkWindowPrivate*) window;
-
- if (!private->destroyed &&
- ((private->resize_count > 0) ||
- (private->width != (guint16) width) ||
- (private->height != (guint16) height)))
- {
- XResizeWindow (private->xdisplay, private->xwindow, width, height);
- private->resize_count += 1;
-
- if (private->window_type == GDK_WINDOW_CHILD)
- {
- private->width = width;
- private->height = height;
- }
- }
-}
-
-void
-gdk_window_move_resize (GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- if (width < 1)
- width = 1;
- if (height < 1)
- height = 1;
-
- private = (GdkWindowPrivate*) window;
- if (!private->destroyed)
- {
- XMoveResizeWindow (private->xdisplay, private->xwindow, x, y, width, height);
-
- if (private->window_type == GDK_WINDOW_CHILD)
- {
- private->x = x;
- private->y = y;
- private->width = width;
- private->height = height;
- }
- }
-}
-
-void
-gdk_window_reparent (GdkWindow *window,
- GdkWindow *new_parent,
- gint x,
- gint y)
-{
- GdkWindowPrivate *window_private;
- GdkWindowPrivate *parent_private;
-
- g_return_if_fail (window != NULL);
-
- if (!new_parent)
- new_parent = (GdkWindow*) &gdk_root_parent;
-
- window_private = (GdkWindowPrivate*) window;
- parent_private = (GdkWindowPrivate*) new_parent;
-
- if (!window_private->destroyed && !parent_private->destroyed)
- XReparentWindow (window_private->xdisplay,
- window_private->xwindow,
- parent_private->xwindow,
- x, y);
-}
-
-void
-gdk_window_clear (GdkWindow *window)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
-
- if (!private->destroyed)
- XClearWindow (private->xdisplay, private->xwindow);
-}
-
-void
-gdk_window_clear_area (GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
-
- if (!private->destroyed)
- XClearArea (private->xdisplay, private->xwindow,
- x, y, width, height, False);
-}
-
-void
-gdk_window_clear_area_e (GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
-
- if (!private->destroyed)
- XClearArea (private->xdisplay, private->xwindow,
- x, y, width, height, True);
-}
-
-void
-gdk_window_copy_area (GdkWindow *window,
- GdkGC *gc,
- gint x,
- gint y,
- GdkWindow *source_window,
- gint source_x,
- gint source_y,
- gint width,
- gint height)
-{
- GdkWindowPrivate *src_private;
- GdkWindowPrivate *dest_private;
- GdkGCPrivate *gc_private;
-
- g_return_if_fail (window != NULL);
- g_return_if_fail (gc != NULL);
-
- if (source_window == NULL)
- source_window = window;
-
- src_private = (GdkWindowPrivate*) source_window;
- dest_private = (GdkWindowPrivate*) window;
- gc_private = (GdkGCPrivate*) gc;
-
- if (!src_private->destroyed && !dest_private->destroyed)
- {
- XCopyArea (dest_private->xdisplay, src_private->xwindow, dest_private->xwindow,
- gc_private->xgc,
- source_x, source_y,
- width, height,
- x, y);
- }
-}
-
-void
-gdk_window_raise (GdkWindow *window)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
-
- if (!private->destroyed)
- XRaiseWindow (private->xdisplay, private->xwindow);
-}
-
-void
-gdk_window_lower (GdkWindow *window)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
-
- if (!private->destroyed)
- XLowerWindow (private->xdisplay, private->xwindow);
-}
-
-void
-gdk_window_set_user_data (GdkWindow *window,
- gpointer user_data)
-{
- g_return_if_fail (window != NULL);
-
- window->user_data = user_data;
-}
-
-void
-gdk_window_set_hints (GdkWindow *window,
- gint x,
- gint y,
- gint min_width,
- gint min_height,
- gint max_width,
- gint max_height,
- gint flags)
-{
- GdkWindowPrivate *private;
- XSizeHints size_hints;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
- if (private->destroyed)
- return;
-
- size_hints.flags = 0;
-
- if (flags & GDK_HINT_POS)
- {
- size_hints.flags |= PPosition;
- size_hints.x = x;
- size_hints.y = y;
- }
-
- if (flags & GDK_HINT_MIN_SIZE)
- {
- size_hints.flags |= PMinSize;
- size_hints.min_width = min_width;
- size_hints.min_height = min_height;
- }
-
- if (flags & GDK_HINT_MAX_SIZE)
- {
- size_hints.flags |= PMaxSize;
- size_hints.max_width = max_width;
- size_hints.max_height = max_height;
- }
-
- if (flags)
- XSetWMNormalHints (private->xdisplay, private->xwindow, &size_hints);
-}
-
-void
-gdk_window_set_title (GdkWindow *window,
- const gchar *title)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
- if (!private->destroyed)
- XmbSetWMProperties (private->xdisplay, private->xwindow,
- title, title, NULL, 0, NULL, NULL, NULL);
-}
-
-void
-gdk_window_set_background (GdkWindow *window,
- GdkColor *color)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
- if (!private->destroyed)
- XSetWindowBackground (private->xdisplay, private->xwindow, color->pixel);
-}
-
-void
-gdk_window_set_back_pixmap (GdkWindow *window,
- GdkPixmap *pixmap,
- gint parent_relative)
-{
- GdkWindowPrivate *window_private;
- GdkPixmapPrivate *pixmap_private;
- Pixmap xpixmap;
-
- g_return_if_fail (window != NULL);
-
- window_private = (GdkWindowPrivate*) window;
- pixmap_private = (GdkPixmapPrivate*) pixmap;
-
- if (pixmap)
- xpixmap = pixmap_private->xwindow;
- else
- xpixmap = None;
-
- if (parent_relative)
- xpixmap = ParentRelative;
-
- if (!window_private->destroyed)
- XSetWindowBackgroundPixmap (window_private->xdisplay, window_private->xwindow, xpixmap);
-}
-
-void
-gdk_window_set_cursor (GdkWindow *window,
- GdkCursor *cursor)
-{
- GdkWindowPrivate *window_private;
- GdkCursorPrivate *cursor_private;
- Cursor xcursor;
-
- g_return_if_fail (window != NULL);
-
- window_private = (GdkWindowPrivate*) window;
- cursor_private = (GdkCursorPrivate*) cursor;
-
- if (!cursor)
- xcursor = None;
- else
- xcursor = cursor_private->xcursor;
-
- if (!window_private->destroyed)
- XDefineCursor (window_private->xdisplay, window_private->xwindow, xcursor);
-}
-
-void
-gdk_window_set_colormap (GdkWindow *window,
- GdkColormap *colormap)
-{
- GdkWindowPrivate *window_private;
- GdkColormapPrivate *colormap_private;
-
- g_return_if_fail (window != NULL);
- g_return_if_fail (colormap != NULL);
-
- window_private = (GdkWindowPrivate*) window;
- colormap_private = (GdkColormapPrivate*) colormap;
-
- if (!window_private->destroyed)
- {
- XSetWindowColormap (window_private->xdisplay,
- window_private->xwindow,
- colormap_private->xcolormap);
-
- if (window_private->window_type != GDK_WINDOW_TOPLEVEL)
- gdk_window_add_colormap_windows (window);
- }
-}
-
-void
-gdk_window_get_user_data (GdkWindow *window,
- gpointer *data)
-{
- g_return_if_fail (window != NULL);
-
- *data = window->user_data;
-}
-
-void
-gdk_window_get_geometry (GdkWindow *window,
- gint *x,
- gint *y,
- gint *width,
- gint *height,
- gint *depth)
-{
- GdkWindowPrivate *window_private;
- Window root;
- gint tx;
- gint ty;
- guint twidth;
- guint theight;
- guint tborder_width;
- guint tdepth;
-
- if (!window)
- window = (GdkWindow*) &gdk_root_parent;
-
- window_private = (GdkWindowPrivate*) window;
-
- if (!window_private->destroyed)
- {
- XGetGeometry (window_private->xdisplay, window_private->xwindow,
- &root, &tx, &ty, &twidth, &theight, &tborder_width, &tdepth);
-
- if (x)
- *x = tx;
- if (y)
- *y = ty;
- if (width)
- *width = twidth;
- if (height)
- *height = theight;
- if (depth)
- *depth = tdepth;
- }
-}
-
-void
-gdk_window_get_position (GdkWindow *window,
- gint *x,
- gint *y)
-{
- GdkWindowPrivate *window_private;
-
- g_return_if_fail (window != NULL);
-
- window_private = (GdkWindowPrivate*) window;
-
- if (x)
- *x = window_private->x;
- if (y)
- *y = window_private->y;
-}
-
-void
-gdk_window_get_size (GdkWindow *window,
- gint *width,
- gint *height)
-{
- GdkWindowPrivate *window_private;
-
- g_return_if_fail (window != NULL);
-
- window_private = (GdkWindowPrivate*) window;
-
- if (width)
- *width = window_private->width;
- if (height)
- *height = window_private->height;
-}
-
-GdkVisual*
-gdk_window_get_visual (GdkWindow *window)
-{
- GdkWindowPrivate *window_private;
- XWindowAttributes window_attributes;
-
- g_return_val_if_fail (window != NULL, NULL);
-
- window_private = (GdkWindowPrivate*) window;
- while (window_private && (window_private->window_type == GDK_WINDOW_PIXMAP))
- window_private = (GdkWindowPrivate*) window_private->parent;
-
- if (window_private && !window_private->destroyed)
- {
- XGetWindowAttributes (window_private->xdisplay,
- window_private->xwindow,
- &window_attributes);
-
- return gdk_visual_lookup (window_attributes.visual);
- }
-
- return NULL;
-}
-
-GdkColormap*
-gdk_window_get_colormap (GdkWindow *window)
-{
- GdkWindowPrivate *window_private;
- XWindowAttributes window_attributes;
-
- g_return_val_if_fail (window != NULL, NULL);
-
- window_private = (GdkWindowPrivate*) window;
-
- if (!window_private->destroyed)
- {
- XGetWindowAttributes (window_private->xdisplay,
- window_private->xwindow,
- &window_attributes);
-
- return gdk_colormap_lookup (window_attributes.colormap);
- }
-
- return NULL;
-}
-
-GdkWindowType
-gdk_window_get_type (GdkWindow *window)
-{
- GdkWindowPrivate *window_private;
-
- g_return_val_if_fail (window != NULL, (GdkWindowType) -1);
-
- window_private = (GdkWindowPrivate*) window;
- return window_private->window_type;
-}
-
-gint
-gdk_window_get_origin (GdkWindow *window,
- gint *x,
- gint *y)
-{
- GdkWindowPrivate *private;
- gint return_val;
- Window child;
- gint tx, ty;
-
- g_return_val_if_fail (window != NULL, 0);
-
- private = (GdkWindowPrivate*) window;
-
- if (!private->destroyed)
- {
- return_val = XTranslateCoordinates (private->xdisplay,
- private->xwindow,
- gdk_root_window,
- 0, 0, &tx, &ty,
- &child);
-
- if (x)
- *x = tx;
- if (y)
- *y = ty;
- }
- else
- return_val = 0;
-
- return return_val;
-}
-
-GdkWindow*
-gdk_window_get_pointer (GdkWindow *window,
- gint *x,
- gint *y,
- GdkModifierType *mask)
-{
- GdkWindowPrivate *private;
- GdkWindow *return_val;
- Window root;
- Window child;
- int rootx, rooty;
- int winx, winy;
- unsigned int xmask;
-
- if (!window)
- window = (GdkWindow*) &gdk_root_parent;
-
- private = (GdkWindowPrivate*) window;
-
- return_val = NULL;
- if (!private->destroyed &&
- XQueryPointer (private->xdisplay, private->xwindow, &root, &child,
- &rootx, &rooty, &winx, &winy, &xmask))
- {
- if (x) *x = winx;
- if (y) *y = winy;
- if (mask) *mask = xmask;
-
- if (child)
- return_val = gdk_window_lookup (child);
- }
-
- return return_val;
-}
-
-GdkWindow*
-gdk_window_get_parent (GdkWindow *window)
-{
- g_return_val_if_fail (window != NULL, NULL);
-
- return ((GdkWindowPrivate*) window)->parent;
-}
-
-GdkWindow*
-gdk_window_get_toplevel (GdkWindow *window)
-{
- GdkWindowPrivate *private;
-
- g_return_val_if_fail (window != NULL, NULL);
-
- private = (GdkWindowPrivate*) window;
-
- while (private->window_type == GDK_WINDOW_CHILD)
- {
- window = ((GdkWindowPrivate*) window)->parent;
- private = (GdkWindowPrivate*) window;
- }
-
- return window;
-}
-
-GList*
-gdk_window_get_children (GdkWindow *window)
-{
- GdkWindowPrivate *private;
- GdkWindow *child;
- GList *children;
- Window root;
- Window parent;
- Window *xchildren;
- unsigned int nchildren;
- unsigned int i;
-
- g_return_val_if_fail (window != NULL, NULL);
-
- private = (GdkWindowPrivate*) window;
- if (private->destroyed)
- return NULL;
-
- XQueryTree (private->xdisplay, private->xwindow,
- &root, &parent, &xchildren, &nchildren);
-
- children = NULL;
-
- if (nchildren > 0)
- {
- for (i = 0; i < nchildren; i++)
- {
- child = gdk_window_lookup (xchildren[i]);
- if (child)
- children = g_list_prepend (children, child);
- }
-
- XFree (xchildren);
- }
-
- return children;
-}
-
-GdkEventMask
-gdk_window_get_events (GdkWindow *window)
-{
- GdkWindowPrivate *private;
- XWindowAttributes attrs;
- GdkEventMask event_mask;
- int i;
-
- g_return_val_if_fail (window != NULL, 0);
-
- private = (GdkWindowPrivate*) window;
- if (private->destroyed)
- return 0;
-
- XGetWindowAttributes (gdk_display, private->xwindow,
- &attrs);
-
- event_mask = 0;
- for (i = 0; i < nevent_masks; i++)
- {
- if (attrs.your_event_mask & event_mask_table[i])
- event_mask |= 1 << (i + 1);
- }
-
- return event_mask;
-}
-
-void
-gdk_window_set_events (GdkWindow *window,
- GdkEventMask event_mask)
-{
- GdkWindowPrivate *private;
- long xevent_mask;
- int i;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
- if (private->destroyed)
- return;
-
- xevent_mask = StructureNotifyMask;
- for (i = 0; i < nevent_masks; i++)
- {
- if (event_mask & (1 << (i + 1)))
- xevent_mask |= event_mask_table[i];
- }
-
- XSelectInput (gdk_display, private->xwindow,
- xevent_mask);
-}
-
-void
-gdk_window_add_colormap_windows (GdkWindow *window)
-{
- GdkWindow *toplevel;
- GdkWindowPrivate *toplevel_private;
- GdkWindowPrivate *window_private;
- Window *old_windows;
- Window *new_windows;
- int i, count;
-
- g_return_if_fail (window != NULL);
-
- toplevel = gdk_window_get_toplevel (window);
- toplevel_private = (GdkWindowPrivate*) toplevel;
- window_private = (GdkWindowPrivate*) window;
- if (window_private->destroyed)
- return;
-
- if (!XGetWMColormapWindows (toplevel_private->xdisplay,
- toplevel_private->xwindow,
- &old_windows, &count))
- {
- old_windows = NULL;
- count = 0;
- }
-
- for (i = 0; i < count; i++)
- if (old_windows[i] == window_private->xwindow)
- return;
-
- new_windows = g_new (Window, count + 1);
-
- for (i = 0; i < count; i++)
- new_windows[i] = old_windows[i];
- new_windows[count] = window_private->xwindow;
-
- XSetWMColormapWindows (toplevel_private->xdisplay,
- toplevel_private->xwindow,
- new_windows, count + 1);
-
- g_free (new_windows);
- if (old_windows)
- XFree (old_windows);
-}
-
-/*
- * This needs the X11 shape extension.
- * If not available, simply remove the call to
- * XShapeCombineMask. Shaped windows will look
- * ugly, but programs still work. Stefan Wille
- */
-void
-gdk_window_shape_combine_mask (GdkWindow *window,
- GdkBitmap *mask,
- gint x, gint y)
-{
- GdkWindowPrivate *window_private;
- Pixmap pixmap;
-
- g_return_if_fail (window != NULL);
-
- window_private = (GdkWindowPrivate*) window;
- if (window_private->destroyed)
- return;
-
- if (mask)
- {
- GdkWindowPrivate *pixmap_private;
-
- pixmap_private = (GdkWindowPrivate*) mask;
- pixmap = (Pixmap) pixmap_private->xwindow;
- }
- else
- {
- x = 0;
- y = 0;
- pixmap = None;
- }
-
- XShapeCombineMask (window_private->xdisplay,
- window_private->xwindow,
- ShapeBounding,
- x, y,
- pixmap,
- ShapeSet);
-}
-
-void
-gdk_dnd_drag_addwindow (GdkWindow *window)
-{
- GdkWindowPrivate *window_private;
-
- g_return_if_fail (window != NULL);
-
- window_private = (GdkWindowPrivate *) window;
- if (window_private->destroyed)
- return;
-
- if (window_private->dnd_drag_enabled == 1 && gdk_dnd.drag_really == 0)
- {
- gdk_dnd.drag_numwindows++;
- gdk_dnd.drag_startwindows = g_realloc (gdk_dnd.drag_startwindows,
- gdk_dnd.drag_numwindows
- * sizeof(GdkWindow *));
- gdk_dnd.drag_startwindows[gdk_dnd.drag_numwindows - 1] = window;
- window_private->dnd_drag_accepted = 0;
- }
- else
- g_warning ("dnd_really is 1 or drag is not enabled! can't addwindow\n");
-}
-
-void
-gdk_window_dnd_drag_set (GdkWindow *window,
- guint8 drag_enable,
- gchar **typelist,
- guint numtypes)
-{
- GdkWindowPrivate *window_private;
- int i, wasset = 0;
-
- g_return_if_fail (window != NULL);
- window_private = (GdkWindowPrivate *) window;
- if (window_private->destroyed)
- return;
-
- window_private->dnd_drag_enabled = drag_enable ? 1 : 0;
-
- if (drag_enable)
- {
- g_return_if_fail(typelist != NULL);
-
- if (window_private->dnd_drag_data_numtypesavail > 3)
- wasset = 1;
- window_private->dnd_drag_data_numtypesavail = numtypes;
-
- window_private->dnd_drag_data_typesavail =
- g_realloc (window_private->dnd_drag_data_typesavail,
- (numtypes + 1) * sizeof (GdkAtom));
-
- for (i = 0; i < numtypes; i++)
- {
- /* Allow blanket use of ALL to get anything... */
- if (strcmp (typelist[i], "ALL"))
- window_private->dnd_drag_data_typesavail[i] =
- gdk_atom_intern (typelist[i], FALSE);
- else
- window_private->dnd_drag_data_typesavail[i] = None;
- }
-
- /*
- * set our extended type list if we need to
- */
- if (numtypes > 3)
- gdk_property_change(window, gdk_dnd.gdk_XdeTypelist,
- XA_PRIMARY, 32, GDK_PROP_MODE_REPLACE,
- (guchar *)(window_private->dnd_drag_data_typesavail
- + (sizeof(GdkAtom) * 3)),
- (numtypes - 3) * sizeof(GdkAtom));
- else if (wasset)
- gdk_property_delete (window, gdk_dnd.gdk_XdeTypelist);
- }
- else
- {
- g_free (window_private->dnd_drag_data_typesavail);
- window_private->dnd_drag_data_typesavail = NULL;
- window_private->dnd_drag_data_numtypesavail = 0;
- }
-}
-
-void
-gdk_window_dnd_drop_set (GdkWindow *window,
- guint8 drop_enable,
- gchar **typelist,
- guint numtypes,
- guint8 destructive_op)
-{
- GdkWindowPrivate *window_private;
- int i;
-
- g_return_if_fail (window != NULL);
- window_private = (GdkWindowPrivate *) window;
- if (window_private->destroyed)
- return;
-
- window_private->dnd_drop_enabled = drop_enable ? 1 : 0;
- if (drop_enable)
- {
- g_return_if_fail(typelist != NULL);
-
- window_private->dnd_drop_data_numtypesavail = numtypes;
-
- window_private->dnd_drop_data_typesavail =
- g_realloc (window_private->dnd_drop_data_typesavail,
- (numtypes + 1) * sizeof (GdkAtom));
-
- for (i = 0; i < numtypes; i++)
- window_private->dnd_drop_data_typesavail[i] =
- gdk_atom_intern (typelist[i], FALSE);
-
- window_private->dnd_drop_destructive_op = destructive_op;
- }
-}
-
-/*
- * This is used to reply to a GDK_DRAG_REQUEST event
- * (which may be generated by XdeRequest or a confirmed drop...
- */
-void
-gdk_window_dnd_data_set (GdkWindow *window,
- GdkEvent *event,
- gpointer data,
- gulong data_numbytes)
-{
- GdkWindowPrivate *window_private;
- XEvent sev;
- GdkEventDropDataAvailable tmp_ev;
- gchar *tmp;
-
- g_return_if_fail (window != NULL);
- g_return_if_fail (event != NULL);
- g_return_if_fail (data != NULL);
- g_return_if_fail (data_numbytes > 0);
- g_return_if_fail (event->type == GDK_DRAG_REQUEST);
-
- window_private = (GdkWindowPrivate *) window;
- g_return_if_fail (window_private->dnd_drag_accepted != 0);
- if (window_private->destroyed)
- return;
-
- /* We set the property on our window... */
- gdk_property_change (window, window_private->dnd_drag_data_type,
- XA_PRIMARY, 8, GDK_PROP_MODE_REPLACE, data,
- data_numbytes);
- tmp = gdk_atom_name(window_private->dnd_drag_data_type);
-#ifdef DEBUG_DND
- g_print("DnD type %s on window %ld\n", tmp, window_private->xwindow);
-#endif
- g_free(tmp);
-
- /*
- * Then we send the event to tell the receiving window that the
- * drop has happened
- */
- tmp_ev.u.allflags = 0;
- tmp_ev.u.flags.protocol_version = DND_PROTOCOL_VERSION;
- tmp_ev.u.flags.isdrop = event->dragrequest.isdrop;
-
- sev.xclient.type = ClientMessage;
- sev.xclient.format = 32;
- sev.xclient.window = event->dragrequest.requestor;
- sev.xclient.message_type = gdk_dnd.gdk_XdeDataAvailable;
- sev.xclient.data.l[0] = window_private->xwindow;
- sev.xclient.data.l[1] = tmp_ev.u.allflags;
- sev.xclient.data.l[2] = window_private->dnd_drag_data_type;
-
- if (event->dragrequest.isdrop)
- sev.xclient.data.l[3] = event->dragrequest.drop_coords.x +
- (event->dragrequest.drop_coords.y << 16);
- else
- sev.xclient.data.l[3] = 0;
-
- sev.xclient.data.l[4] = event->dragrequest.timestamp;
-
- if (!gdk_send_xevent (event->dragrequest.requestor, False,
- NoEventMask, &sev))
- GDK_NOTE (DND, g_print("Sending XdeDataAvailable to %#x failed\n",
- event->dragrequest.requestor));
-
-}
-
-void
-gdk_window_add_filter (GdkWindow *window,
- GdkFilterFunc function,
- gpointer data)
-{
- GdkWindowPrivate *private;
- GList *tmp_list;
- GdkEventFilter *filter;
-
- private = (GdkWindowPrivate*) window;
- if (private && private->destroyed)
- return;
-
- if(private)
- tmp_list = private->filters;
- else
- tmp_list = gdk_default_filters;
-
- while (tmp_list)
- {
- filter = (GdkEventFilter *)tmp_list->data;
- if ((filter->function == function) && (filter->data == data))
- return;
- tmp_list = tmp_list->next;
- }
-
- filter = g_new (GdkEventFilter, 1);
- filter->function = function;
- filter->data = data;
-
- if(private)
- private->filters = g_list_append (private->filters, filter);
- else
- gdk_default_filters = g_list_append (gdk_default_filters, filter);
-}
-
-void
-gdk_window_remove_filter (GdkWindow *window,
- GdkFilterFunc function,
- gpointer data)
-{
- GdkWindowPrivate *private;
- GList *tmp_list;
- GdkEventFilter *filter;
-
- private = (GdkWindowPrivate*) window;
-
- if(private)
- tmp_list = private->filters;
- else
- tmp_list = gdk_default_filters;
-
- while (tmp_list)
- {
- filter = (GdkEventFilter *)tmp_list->data;
- tmp_list = tmp_list->next;
-
- if ((filter->function == function) && (filter->data == data))
- {
- if(private)
- private->filters = g_list_remove_link (private->filters, tmp_list);
- else
- gdk_default_filters = g_list_remove_link (gdk_default_filters, tmp_list);
- g_list_free_1 (tmp_list);
- g_free (filter);
-
- return;
- }
- }
-}
-
-void
-gdk_window_set_override_redirect(GdkWindow *window,
- gboolean override_redirect)
-{
- GdkWindowPrivate *private;
- XSetWindowAttributes attr;
-
- g_return_if_fail (window != NULL);
- private = (GdkWindowPrivate*) window;
- if (private->destroyed)
- return;
-
- attr.override_redirect = (override_redirect == FALSE)?False:True;
- XChangeWindowAttributes(gdk_display,
- ((GdkWindowPrivate *)window)->xwindow,
- CWOverrideRedirect,
- &attr);
-}
-
-void
-gdk_window_set_icon (GdkWindow *window,
- GdkWindow *icon_window,
- GdkPixmap *pixmap,
- GdkBitmap *mask)
-{
- XWMHints wm_hints;
- GdkWindowPrivate *window_private;
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
- window_private = (GdkWindowPrivate*) window;
- if (window_private->destroyed)
- return;
-
- wm_hints.flags = 0;
-
- if (icon_window != NULL)
- {
- private = (GdkWindowPrivate *)icon_window;
- wm_hints.flags |= IconWindowHint;
- wm_hints.icon_window = private->xwindow;
- }
-
- if (pixmap != NULL)
- {
- private = (GdkWindowPrivate *)pixmap;
- wm_hints.flags |= IconPixmapHint;
- wm_hints.icon_pixmap = private->xwindow;
- }
-
- if (mask != NULL)
- {
- private = (GdkWindowPrivate *)mask;
- wm_hints.flags |= IconMaskHint;
- wm_hints.icon_mask = private->xwindow;
- }
-
- XSetWMHints (window_private->xdisplay, window_private->xwindow, &wm_hints);
-}
-
-void
-gdk_window_set_icon_name (GdkWindow *window,
- gchar * name)
-{
- GdkWindowPrivate *window_private;
- XTextProperty property;
- gint res;
-
- g_return_if_fail (window != NULL);
- window_private = (GdkWindowPrivate*) window;
- if (window_private->destroyed)
- return;
- res = XmbTextListToTextProperty (window_private->xdisplay,
- &name, 1, XStdICCTextStyle,
- &property);
- if (res < 0)
- {
- g_warning("Error converting icon name to text property: %d\n", res);
- return;
- }
-
- XSetWMIconName (window_private->xdisplay, window_private->xwindow,
- &property);
-
- XFree(property.value);
-}
-
-void
-gdk_window_set_group (GdkWindow *window,
- GdkWindow *leader)
-{
- XWMHints wm_hints;
- GdkWindowPrivate *window_private;
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
- g_return_if_fail (leader != NULL);
- window_private = (GdkWindowPrivate*) window;
- if (window_private->destroyed)
- return;
-
- private = (GdkWindowPrivate *)leader;
- wm_hints.flags |= WindowGroupHint;
- wm_hints.window_group = private->xwindow;
-
- XSetWMHints (window_private->xdisplay, window_private->xwindow, &wm_hints);
-}
-
-static void
-gdk_window_set_mwm_hints (GdkWindow *window,
- MotifWmHints *new_hints)
-{
- static Atom hints_atom = None;
- MotifWmHints *hints;
- Atom type;
- gint format;
- gulong nitems;
- gulong bytes_after;
-
- GdkWindowPrivate *window_private;
-
- g_return_if_fail (window != NULL);
- window_private = (GdkWindowPrivate*) window;
- if (window_private->destroyed)
- return;
-
- if (!hints_atom)
- hints_atom = XInternAtom (window_private->xdisplay,
- _XA_MOTIF_WM_HINTS, FALSE);
-
- XGetWindowProperty (window_private->xdisplay, window_private->xwindow,
- hints_atom, 0, sizeof(MotifWmHints)/4,
- False, AnyPropertyType, &type, &format, &nitems,
- &bytes_after, (guchar **)&hints);
-
- if (type == None)
- hints = new_hints;
- else
- {
- if (new_hints->flags & MWM_HINTS_FUNCTIONS)
- {
- hints->flags |= MWM_HINTS_FUNCTIONS;
- hints->functions = new_hints->functions;
- }
- if (new_hints->flags & MWM_HINTS_DECORATIONS)
- {
- hints->flags |= MWM_HINTS_DECORATIONS;
- hints->decorations = new_hints->decorations;
- }
- }
-
- XChangeProperty (window_private->xdisplay, window_private->xwindow,
- hints_atom, hints_atom, 32, PropModeReplace,
- (guchar *)hints, sizeof(MotifWmHints)/4);
-
- if (hints != new_hints)
- XFree (hints);
-}
-
-void
-gdk_window_set_decorations (GdkWindow *window,
- GdkWMDecoration decorations)
-{
- MotifWmHints hints;
-
- hints.flags = MWM_HINTS_DECORATIONS;
- hints.decorations = decorations;
-
- gdk_window_set_mwm_hints (window, &hints);
-}
-
-void
-gdk_window_set_functions (GdkWindow *window,
- GdkWMFunction functions)
-{
- MotifWmHints hints;
-
- hints.flags = MWM_HINTS_FUNCTIONS;
- hints.functions = functions;
-
- gdk_window_set_mwm_hints (window, &hints);
-}
diff --git a/gdk/gdkx.h b/gdk/gdkx.h
deleted file mode 100644
index cc43cbca17..0000000000
--- a/gdk/gdkx.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GDK_X_H__
-#define __GDK_X_H__
-
-#include <gdk/gdkprivate.h>
-
-
-#define GDK_ROOT_WINDOW() gdk_root_window
-#define GDK_ROOT_PARENT() ((GdkWindow *)&gdk_root_parent)
-#define GDK_DISPLAY() gdk_display
-#define GDK_WINDOW_XDISPLAY(win) (((GdkWindowPrivate*) win)->xdisplay)
-#define GDK_WINDOW_XWINDOW(win) (((GdkWindowPrivate*) win)->xwindow)
-#define GDK_IMAGE_XDISPLAY(image) (((GdkImagePrivate*) image)->xdisplay)
-#define GDK_IMAGE_XIMAGE(image) (((GdkImagePrivate*) image)->ximage)
-#define GDK_GC_XDISPLAY(gc) (((GdkGCPrivate*) gc)->xdisplay)
-#define GDK_GC_XGC(gc) (((GdkGCPrivate*) gc)->xgc)
-#define GDK_COLORMAP_XDISPLAY(cmap) (((GdkColormapPrivate*) cmap)->xdisplay)
-#define GDK_COLORMAP_XCOLORMAP(cmap) (((GdkColormapPrivate*) cmap)->xcolormap)
-#define GDK_VISUAL_XVISUAL(vis) (((GdkVisualPrivate*) vis)->xvisual)
-#define GDK_FONT_XDISPLAY(font) (((GdkFontPrivate*) font)->xdisplay)
-#define GDK_FONT_XFONT(font) (((GdkFontPrivate*) font)->xfont)
-
-
-GdkVisual* gdkx_visual_get (VisualID xvisualid);
-GdkColormap* gdkx_colormap_get (Colormap xcolormap);
-/* Utility function in gdk.c - not sure where it belongs, but it's
- needed in more than one place, so make it public */
-Window gdk_get_client_window (Display *dpy,
- Window win);
-
-
-#endif /* __GDK_X_H__ */
diff --git a/gdk/gdkxid.c b/gdk/gdkxid.c
deleted file mode 100644
index 94c304f4ed..0000000000
--- a/gdk/gdkxid.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gdkprivate.h"
-#include <stdio.h>
-
-static guint gdk_xid_hash (XID *xid);
-static gint gdk_xid_compare (XID *a,
- XID *b);
-
-
-GHashTable *xid_ht = NULL;
-
-
-void
-gdk_xid_table_insert (XID *xid,
- gpointer data)
-{
- g_return_if_fail (xid != NULL);
-
- if (!xid_ht)
- xid_ht = g_hash_table_new ((GHashFunc) gdk_xid_hash,
- (GCompareFunc) gdk_xid_compare);
-
- g_hash_table_insert (xid_ht, xid, data);
-}
-
-void
-gdk_xid_table_remove (XID xid)
-{
- if (!xid_ht)
- xid_ht = g_hash_table_new ((GHashFunc) gdk_xid_hash,
- (GCompareFunc) gdk_xid_compare);
-
- g_hash_table_remove (xid_ht, &xid);
-}
-
-gpointer
-gdk_xid_table_lookup (XID xid)
-{
- gpointer data;
-
- data = g_hash_table_lookup (xid_ht, &xid);
-
- return data;
-}
-
-
-static guint
-gdk_xid_hash (XID *xid)
-{
- return *xid;
-}
-
-static gint
-gdk_xid_compare (XID *a,
- XID *b)
-{
- return (*a == *b);
-}
diff --git a/gdk/gxid.c b/gdk/gxid.c
deleted file mode 100644
index 219c08bfe0..0000000000
--- a/gdk/gxid.c
+++ /dev/null
@@ -1,844 +0,0 @@
-/*
- * gxid version 0.3
- *
- * Copyright 1997 Owen Taylor <owt1@cornell.edu>
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/XInput.h>
-
-#include "gxid_proto.h"
-
-/* #define DEBUG_CLIENTS */
-/* #define DEBUG_EVENTS */
-
-char *program_name;
-Display *dpy;
-Window root_window; /* default root window of dpy */
-int port = 0; /* port to listen on */
-int socket_fd = 0; /* file descriptor of socket */
-typedef struct GxidWindow_ GxidWindow;
-
-typedef struct GxidDevice_ GxidDevice;
-struct GxidDevice_ {
- XID id;
- int exclusive;
- int ispointer;
-
- XDevice *xdevice;
- int motionnotify_type;
- int changenotify_type;
-};
-
-struct GxidWindow_ {
- Window xwindow;
- /* Immediate child of root that is ancestor of window */
- Window root_child;
- int num_devices;
- GxidDevice **devices;
-};
-
-GxidDevice **devices = NULL;
-int num_devices = 0;
-GxidWindow **windows = NULL;
-int num_windows = 0;
-
-void
-handler(int signal)
-{
- fprintf(stderr,"%s: dying on signal %d\n",program_name,signal);
- if (socket_fd)
- close(socket_fd);
- exit(1);
-}
-
-void
-init_socket()
-{
- struct sockaddr_in sin;
-
- socket_fd = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
- if (socket_fd < 0)
- {
- fprintf (stderr, "%s: error getting socket\n",
- program_name);
- exit(1);
- }
-
- sin.sin_family = AF_INET;
- sin.sin_port = htons(port);
- sin.sin_addr.s_addr = INADDR_ANY;
-
- if (bind(socket_fd,(struct sockaddr *)(&sin),
- sizeof(struct sockaddr_in)) < 0)
- {
- fprintf (stderr,"%s: cannot bind to port %d\n",
- program_name,port);
- exit(1);
- }
-
- if (listen(socket_fd,5) < 0)
- {
- fprintf (stderr,"%s: error listening on socket\n",
- program_name);
- exit(1);
- };
-}
-
-#define NUM_EVENTC 2
-static void
-enable_device(GxidDevice *dev)
-{
- XEventClass xevc[NUM_EVENTC];
- int num_eventc = NUM_EVENTC;
- int i,j;
-
- if (!dev->xdevice)
- {
- if (dev->ispointer) return;
-
- dev->xdevice = XOpenDevice(dpy, dev->id);
- if (!dev->xdevice) return;
-
- DeviceMotionNotify (dev->xdevice, dev->motionnotify_type,
- xevc[0]);
- ChangeDeviceNotify (dev->xdevice, dev->changenotify_type,
- xevc[1]);
-
- /* compress out zero event classes */
- for (i=0,j=0;i<NUM_EVENTC;i++)
- {
- if (xevc[i]) {
- xevc[j] = xevc[i];
- j++;
- }
- }
- num_eventc = j;
-
- XSelectExtensionEvent (dpy, root_window, xevc, num_eventc);
- }
-}
-
-/* switch the core pointer from whatever it is now to something else,
- return true on success, false otherwise */
-static int
-switch_core_pointer()
-{
- GxidDevice *old_pointer = 0;
- GxidDevice *new_pointer = 0;
- int result;
- int i;
-
- for (i=0;i<num_devices;i++)
- {
- if (devices[i]->ispointer)
- old_pointer = devices[i];
- else
- if (!new_pointer && !devices[i]->exclusive)
- new_pointer = devices[i];
- }
-
- if (!old_pointer || !new_pointer)
- return 0;
-
-#ifdef DEBUG_EVENTS
- fprintf(stderr,"gxid: Switching core from %ld to %ld\n",
- old_pointer->id,new_pointer->id);
-#endif
- result = XChangePointerDevice(dpy,new_pointer->xdevice, 0, 1);
- if (result != Success)
- {
- fprintf(stderr,"gxid: Error %d switching core from %ld to %ld\n",
- result, old_pointer->id, new_pointer->id);
- }
- else
- {
- new_pointer->ispointer = 1;
- old_pointer->ispointer = 0;
- if (!old_pointer->xdevice)
- enable_device(old_pointer);
- }
-
- return 1;
-}
-
-void
-disable_device(GxidDevice *dev)
-{
- if (dev->xdevice)
- {
- if (dev->ispointer)
- return;
- XCloseDevice(dpy,dev->xdevice);
- dev->xdevice = 0;
- }
-}
-
-GxidDevice *
-init_device(XDeviceInfo *xdevice)
-{
- GxidDevice *dev = (GxidDevice *)malloc(sizeof(GxidDevice));
- XAnyClassPtr class;
- int num_axes, i;
-
- dev->id = xdevice->id;
- dev->exclusive = 0;
- dev->xdevice = NULL;
-
- dev->ispointer = (xdevice->use == IsXPointer);
-
- /* step through the classes */
-
- num_axes = 0;
- class = xdevice->inputclassinfo;
- for (i=0;i<xdevice->num_classes;i++)
- {
- if (class->class == ValuatorClass)
- {
- XValuatorInfo *xvi = (XValuatorInfo *)class;
- num_axes = xvi->num_axes;
- }
- class = (XAnyClassPtr)(((char *)class) + class->length);
- }
-
- /* return NULL if insufficient axes */
- if (num_axes < 2)
- {
- free((void *)dev);
- return NULL;
- }
-
- if (!dev->ispointer)
- enable_device(dev);
- return dev;
-}
-
-void
-init_xinput()
-{
- char **extensions;
- XDeviceInfo *xdevices;
- int num_xdevices;
- int num_extensions;
- int i;
-
- extensions = XListExtensions(dpy, &num_extensions);
- for (i = 0; i < num_extensions &&
- (strcmp(extensions[i], "XInputExtension") != 0); i++);
- XFreeExtensionList(extensions);
- if (i == num_extensions) /* XInput extension not found */
- {
- fprintf(stderr,"XInput extension not found\n");
- exit(1);
- }
-
- xdevices = XListInputDevices(dpy, &num_xdevices);
- devices = (GxidDevice **)malloc(num_xdevices * sizeof(GxidDevice *));
-
- num_devices = 0;
- for(i=0; i<num_xdevices; i++)
- {
- GxidDevice *dev = init_device(&xdevices[i]);
- if (dev)
- devices[num_devices++] = dev;
- }
- XFreeDeviceList(xdevices);
-}
-
-/* If this routine needs fixing, the corresponding routine
- in gdkinputgxi.h will need it too. */
-
-Window
-gxi_find_root_child(Display *dpy, Window w)
-{
- Window root,parent;
- Window *children;
- int nchildren;
-
- parent = w;
- do
- {
- w = parent;
- XQueryTree(dpy,w,&root,&parent,&children,&nchildren);
- if (children) XFree(children);
- }
- while (parent != root);
-
- return w;
-}
-
-int
-handle_claim_device(GxidClaimDevice *msg)
-{
- int i,j;
- XID devid = ntohl(msg->device);
- XID winid = ntohl(msg->window);
- int exclusive = ntohl(msg->exclusive);
- GxidDevice *device = NULL;
- GxidWindow *window = NULL;
-
-#ifdef DEBUG_CLIENTS
- fprintf(stderr,"device %ld claimed (window 0x%lx)\n",devid,winid);
-#endif
-
- for (i=0;i<num_devices;i++)
- {
- if (devices[i]->id == devid)
- {
- device = devices[i];
- break;
- }
- }
- if (!device)
- {
- fprintf(stderr,"%s: Unknown device id %ld\n",program_name,devid);
- return GXID_RETURN_ERROR;
- }
-
- if (device->exclusive)
- {
- /* already in use */
- fprintf(stderr,
- "%s: Device %ld already claimed in exclusive mode\n",
- program_name,devid);
- return GXID_RETURN_ERROR;
- }
-
- if (exclusive)
- {
- for (i=0;i<num_windows;i++)
- {
- for (j=0;j<windows[i]->num_devices;j++)
- if (windows[i]->devices[j]->id == devid)
- {
- /* already in use */
- fprintf(stderr,
- "%s: Can't establish exclusive use of device %ld\n",
- program_name,devid);
- return GXID_RETURN_ERROR;
- }
- }
- if (device->ispointer)
- if (!switch_core_pointer())
- {
- fprintf(stderr,
- "%s: Can't free up core pointer %ld\n",
- program_name,devid);
- return GXID_RETURN_ERROR;
- }
-
- device->exclusive = 1;
- disable_device(device);
- XSelectInput(dpy,winid,StructureNotifyMask);
- }
- else /* !exclusive */
- {
- /* FIXME: this is a bit improper. We probably should do this only
- when a window is first claimed. But we might be fooled if
- an old client died without releasing it's windows. So until
- we look for client-window closings, do it here
-
- (We do look for closings now...)
- */
-
- XSelectInput(dpy,winid,EnterWindowMask|StructureNotifyMask);
- }
-
- for (i=0;i<num_windows;i++)
- {
- if (windows[i]->xwindow == winid)
- {
- window = windows[i];
- break;
- }
- }
-
- /* Create window structure if no devices have been previously
- claimed on it */
- if (!window)
- {
- num_windows++;
- windows = (GxidWindow **)realloc(windows,
- sizeof(GxidWindow*)*num_windows);
- window = (GxidWindow *)malloc(sizeof(GxidWindow));
- windows[num_windows-1] = window;
-
- window->xwindow = winid;
- window->root_child = gxi_find_root_child(dpy,winid);
- window->num_devices = 0;
- window->devices = 0;
- }
-
-
- for (i=0;i<window->num_devices;i++)
- {
- if (window->devices[i] == device)
- return GXID_RETURN_OK;
- }
-
- window->num_devices++;
- window->devices = (GxidDevice **)realloc(window->devices,
- sizeof(GxidDevice*)*num_devices);
- /* we need add the device to the window */
- window->devices[i] = device;
-
- return GXID_RETURN_OK;
-}
-
-int
-handle_release_device(GxidReleaseDevice *msg)
-{
- int i,j;
- XID devid = ntohl(msg->device);
- XID winid = ntohl(msg->window);
-
- GxidDevice *device = NULL;
-
-#ifdef DEBUG_CLIENTS
- fprintf(stderr,"device %ld released (window 0x%lx)\n",devid,winid);
-#endif
-
- for (i=0;i<num_devices;i++)
- {
- if (devices[i]->id == devid)
- {
- device = devices[i];
- break;
- }
- }
- if (!device)
- {
- fprintf(stderr,"%s: Unknown device id %ld\n",program_name,devid);
- return GXID_RETURN_ERROR;
- }
-
- for (i=0;i<num_windows;i++)
- {
- GxidWindow *w = windows[i];
-
- if (w->xwindow == winid)
- for (j=0;j<w->num_devices;j++)
- if (w->devices[j]->id == devid)
- {
- if (j<w->num_devices-1)
- w->devices[j] = w->devices[w->num_devices-1];
- w->num_devices--;
-
- if (w->num_devices == 0)
- {
- if (i<num_windows-1)
- windows[i] = windows[num_windows-1];
- num_windows--;
-
- free((void *)w);
- /* FIXME: should we deselect input? But what
- what if window is already destroyed */
- }
-
- if (device->exclusive)
- {
- device->exclusive = 0;
- enable_device(device);
- }
- return GXID_RETURN_OK;
- }
- }
-
- /* device/window combination not found */
- fprintf(stderr,
- "%s: Device %ld not claimed for window 0x%lx\n",
- program_name,devid,winid);
- return GXID_RETURN_ERROR;
-}
-
-void
-handle_connection()
-{
- GxidMessage msg;
- GxidU32 type;
- int length;
- GxidI32 retval;
-
- int conn_fd;
- struct sockaddr_in sin;
- int sin_length;
- int count;
-
- sin_length = sizeof(struct sockaddr_in);
- conn_fd = accept(socket_fd,(struct sockaddr *)&sin,&sin_length);
- if (conn_fd < 0)
- {
- fprintf(stderr,"%s: Error accepting connection\n",
- program_name);
- exit(1);
- }
-
- /* read type and length of message */
-
- count = read(conn_fd,(char *)&msg,2*sizeof(GxidU32));
- if (count != 2*sizeof(GxidU32))
- {
- fprintf(stderr,"%s: Error reading message header\n",
- program_name);
- close(conn_fd);
- return;
- }
- type = ntohl(msg.any.type);
- length = ntohl(msg.any.length);
-
- /* read rest of message */
-
- if (length > sizeof(GxidMessage))
- {
- fprintf(stderr,"%s: Bad message length\n",
- program_name);
- close(conn_fd);
- return;
- }
-
- count = read(conn_fd,2*sizeof(GxidU32) + (char *)&msg,
- length - 2*sizeof(GxidU32));
- if (count != length - 2*sizeof(GxidU32))
- {
- fprintf(stderr,"%s: Error reading message body\n",
- program_name);
- close(conn_fd);
- return;
- }
-
- switch (type)
- {
- case GXID_CLAIM_DEVICE:
- retval = handle_claim_device((GxidClaimDevice *)&msg);
- break;
- case GXID_RELEASE_DEVICE:
- retval = handle_release_device((GxidReleaseDevice *)&msg);
- break;
- default:
- fprintf(stderr,"%s: Unknown message type: %ld (ignoring)\n",
- program_name,type);
- close(conn_fd);
- return;
- }
-
- count = write(conn_fd,&retval,sizeof(GxidI32));
- if (count != sizeof(GxidI32))
- {
- fprintf(stderr,"%s: Error writing return code\n",
- program_name);
- }
-
- close(conn_fd);
-}
-
-void
-handle_motion_notify(XDeviceMotionEvent *event)
-{
- int i,j;
- GxidDevice *old_device = NULL;
- GxidDevice *new_device = NULL;
- Window w, root, child;
- int root_x, root_y, x, y, mask;
-
- for (j=0;j<num_devices;j++)
- {
- if (devices[j]->ispointer)
- old_device = devices[j];
- if (devices[j]->id == event->deviceid)
- new_device = devices[j];
- }
-
- if (new_device && !new_device->exclusive && !new_device->ispointer)
- {
- /* make sure we aren't stealing the pointer back from a slow
- client */
- child = root_window;
- do
- {
- w = child;
- /* FIXME: this fails disasterously if child vanishes between
- calls. (Which is prone to happening since we get events
- on root just as the client exits) */
-
- XQueryPointer(dpy,w,&root,&child,&root_x,&root_y,
- &x,&y,&mask);
- }
- while (child != None);
-
- for (i=0;i<num_windows;i++)
- if (windows[i]->xwindow == w)
- for (j=0;j<windows[i]->num_devices;j++)
- if (windows[i]->devices[j] == new_device)
- return;
-
- /* FIXME: do something smarter with axes */
- XChangePointerDevice(dpy,new_device->xdevice, 0, 1);
- new_device->ispointer = 1;
-
- old_device->ispointer = 0;
- if (!old_device->xdevice)
- enable_device(old_device);
- }
-}
-
-void
-handle_change_notify(XChangeDeviceNotifyEvent *event)
-{
- int j;
- GxidDevice *old_device = NULL;
- GxidDevice *new_device = NULL;
-
-
- for (j=0;j<num_devices;j++)
- {
- if (devices[j]->ispointer)
- old_device = devices[j];
- if (devices[j]->id == event->deviceid)
- new_device = devices[j];
- }
-
-#ifdef DEBUG_EVENTS
- fprintf(stderr,"gxid: ChangeNotify event; old = %ld; new = %ld\n",
- old_device->id, new_device->id);
-#endif
-
- if (old_device != new_device)
- {
- new_device->ispointer = 1;
-
- old_device->ispointer = 0;
- if (!old_device->xdevice)
- enable_device(old_device);
- }
-}
-
-void
-handle_enter_notify(XEnterWindowEvent *event, GxidWindow *window)
-{
- int i;
- GxidDevice *old_pointer = NULL;
- for (i=0;i<num_devices;i++)
- {
- if (devices[i]->ispointer)
- {
- old_pointer = devices[i];
- break;
- }
- }
-
-#ifdef DEBUG_EVENTS
- fprintf(stderr,"gxid: Enter event; oldpointer = %ld\n",
- old_pointer->id);
-#endif
-
- if (old_pointer)
- for (i=0;i<window->num_devices;i++)
- {
- if (window->devices[i] == old_pointer)
- {
- switch_core_pointer();
- break;
- }
- }
-}
-
-void
-handle_destroy_notify(XDestroyWindowEvent *event)
-{
- int i,j;
-
- for (i=0;i<num_windows;i++)
- if (windows[i]->xwindow == event->window)
- {
- GxidWindow *w = windows[i];
-
- for (j=0;j<w->num_devices;j++)
- {
-#ifdef DEBUG_CLIENTS
- fprintf(stderr,"device %ld released on destruction of window 0x%lx.\n",
- w->devices[j]->id,w->xwindow);
-#endif
-
- if (w->devices[j]->exclusive)
- {
- w->devices[j]->exclusive = 0;
- enable_device(devices[j]);
- }
- }
-
- if (i<num_windows-1)
- windows[i] = windows[num_windows-1];
- num_windows--;
-
- if (w->devices)
- free((void *)w->devices);
- free((void *)w);
- /* FIXME: should we deselect input? But what
- what if window is already destroyed */
-
- return;
- }
-}
-
-void
-handle_xevent()
-{
- int i;
- XEvent event;
-
- XNextEvent (dpy, &event);
-
-#ifdef DEBUG_EVENTS
- fprintf(stderr,"Event - type = %d; window = 0x%lx\n",
- event.type,event.xany.window);
-#endif
-
- if (event.type == ConfigureNotify)
- {
-#ifdef DEBUG_EVENTS
- XConfigureEvent *xce = (XConfigureEvent *)&event;
- fprintf(stderr," configureNotify: window = 0x%lx\n",xce->window);
-#endif
- }
- else if (event.type == EnterNotify)
- {
- /* pointer entered a claimed window */
- for (i=0;i<num_windows;i++)
- {
- if (event.xany.window == windows[i]->xwindow)
- handle_enter_notify((XEnterWindowEvent *)&event,windows[i]);
- }
- }
- else if (event.type == DestroyNotify)
- {
- /* A claimed window was destroyed */
- for (i=0;i<num_windows;i++)
- {
- if (event.xany.window == windows[i]->xwindow)
- handle_destroy_notify((XDestroyWindowEvent *)&event);
- }
- }
- else
- for (i=0;i<num_devices;i++)
- {
- if (event.type == devices[i]->motionnotify_type)
- {
- handle_motion_notify((XDeviceMotionEvent *)&event);
- break;
- }
- else if (event.type == devices[i]->changenotify_type)
- {
- handle_change_notify((XChangeDeviceNotifyEvent *)&event);
- break;
- }
- }
-}
-
-void
-usage()
-{
- fprintf(stderr,"Usage: %s [-d display] [-p --gxid-port port]\n",
- program_name);
- exit(1);
-}
-
-int
-main(int argc, char **argv)
-{
- int i;
- char *display_name = NULL;
- fd_set readfds;
-
- program_name = argv[0];
-
- for (i=1;i<argc;i++)
- {
- if (!strcmp(argv[i],"-d"))
- {
- if (++i >= argc) usage();
- display_name = argv[i];
- }
- else if (!strcmp(argv[i],"--gxid-port") ||
- !strcmp(argv[i],"-p"))
- {
- if (++i >= argc) usage();
- port = atoi(argv[i]);
- break;
- }
- else
- usage();
- }
-
- if (!port)
- {
- char *t = getenv("GXID_PORT");
- if (t)
- port = atoi(t);
- else
- port = 6951;
- }
- /* set up a signal handler so we can clean up if killed */
-
- signal(SIGTERM,handler);
- signal(SIGINT,handler);
-
- /* initialize the X connection */
-
- dpy = XOpenDisplay (display_name);
- if (!dpy)
- {
- fprintf (stderr, "%s: unable to open display '%s'\n",
- program_name, XDisplayName (display_name));
- exit (1);
- }
-
- root_window = DefaultRootWindow(dpy);
-
- /* We'll want to do this in the future if we are to support
- gxid monitoring visibility information for clients */
-#if 0
- XSelectInput(dpy,root_window,SubstructureNotifyMask);
-#endif
- init_xinput();
-
- /* set up our server connection */
-
- init_socket();
-
- /* main loop */
-
- if (XPending(dpy)) /* this seems necessary to get things
- in sync */
- handle_xevent();
- while (1)
- {
-
- FD_ZERO(&readfds);
- FD_SET(ConnectionNumber(dpy),&readfds);
- FD_SET(socket_fd,&readfds);
-
- if (select(8*sizeof(readfds),&readfds,
- (fd_set *)0,(fd_set *)0, (struct timeval *)0) < 0)
- {
- fprintf(stderr,"Error in select\n");
- exit(1);
- }
-
- if (FD_ISSET(socket_fd,&readfds))
- handle_connection(socket_fd);
-
- while (XPending(dpy))
- handle_xevent();
- }
-
- XCloseDisplay (dpy);
- exit (0);
-}
diff --git a/gdk/gxid_lib.c b/gdk/gxid_lib.c
deleted file mode 100644
index 64c1e53b1f..0000000000
--- a/gdk/gxid_lib.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * gxid version 0.3
- *
- * Copyright 1997 Owen Taylor <owt1@cornell.edu>
-*/
-
-#include "../config.h"
-#include "gxid_lib.h"
-
-#ifdef XINPUT_GXI
-
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-
-/* handles mechanics of communicating with a client */
-static int
-gxid_send_message(char *host, int port, GxidMessage *msg)
-{
- int socket_fd;
- struct sockaddr_in sin;
- int count;
- GxidI32 retval;
- struct hostent *he;
-
- if (!port) port = 6951;
-
- if (!host || strcmp(host,"localhost") )
- {
- /* looking it up as localhost can be _SLOW_ on ppp systems */
- /* FIXME: Could localhost be anything other than loopback? */
- host = "127.0.0.1";
- }
-
- he = gethostbyname(host);
- if (!he)
- {
- fprintf(stderr,"gxid_lib: error looking up %s\n",host);
- return GXID_RETURN_ERROR;
- }
-
- sin.sin_family = he->h_addrtype;
- sin.sin_port = htons(port);
- memcpy(&sin.sin_addr,he->h_addr_list[0],he->h_length);
-
- socket_fd = socket(AF_INET,SOCK_STREAM,0);
- if (socket_fd < 0)
- {
- fprintf(stderr,"gxid_lib: can't get socket");
- return GXID_RETURN_ERROR;
- }
-
- if (connect(socket_fd, (struct sockaddr *)&sin,
- sizeof sin) < 0)
- {
- fprintf(stderr,"gxid_lib: can't connect to %s:%d\n",host,port);
- close(socket_fd);
- return GXID_RETURN_ERROR;
- }
-
- count = write(socket_fd,(char *)msg,ntohl(msg->any.length));
- if (count != ntohl(msg->any.length))
- {
- fprintf(stderr,"gxid_lib: error writing");
- close(socket_fd);
- return GXID_RETURN_ERROR;
- }
-
- /* now read the return code */
- count = read(socket_fd,(char *)&retval,sizeof(GxidI32));
- if (count != sizeof(GxidI32))
- {
- fprintf(stderr,"gxid_lib: error reading return code");
- close(socket_fd);
- return GXID_RETURN_ERROR;
- }
-
- close (socket_fd);
- return ntohl(retval);
-}
-
-/* claim a device. If exclusive, device is claimed exclusively */
-int
-gxid_claim_device(char *host, int port, GxidU32 device, GxidU32 window,
- int exclusive)
-{
- GxidClaimDevice msg;
- msg.type = htonl(GXID_CLAIM_DEVICE);
- msg.length = htonl(sizeof(GxidClaimDevice));
- msg.device = htonl(device);
- msg.window = htonl(window);
- msg.exclusive = htonl(exclusive);
-
- return gxid_send_message(host,port,(GxidMessage *)&msg);
-}
-
-/* release a device/window pair */
-int
-gxid_release_device(char *host, int port, GxidU32 device, GxidU32 window)
-{
- GxidReleaseDevice msg;
- msg.type = htonl(GXID_RELEASE_DEVICE);
- msg.length = htonl(sizeof(GxidReleaseDevice));
- msg.device = htonl(device);
- msg.window = htonl(window);
-
- return gxid_send_message(host,port,(GxidMessage *)&msg);
-}
-
-#else /* !XINPUT_GXI */
-
-/* Some compilers don't like empty source files */
-int
-gxid_claim_device(char *host, int port, GxidU32 device, GxidU32 window,
- int exclusive)
-{
- return 0;
-}
-
-#endif /* XINPUT_GXI */
-
diff --git a/gdk/gxid_lib.h b/gdk/gxid_lib.h
deleted file mode 100644
index 6a7103bbe0..0000000000
--- a/gdk/gxid_lib.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "gxid_proto.h"
-
-int gxid_claim_device(char *host, int port,
- GxidU32 device, GxidU32 window, int exclusive);
-int gxid_release_device(char *host, int port, GxidU32 device,
- GxidU32 window);
diff --git a/gdk/gxid_proto.h b/gdk/gxid_proto.h
deleted file mode 100644
index 24959b806c..0000000000
--- a/gdk/gxid_proto.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#define GXID_CLAIM_DEVICE 1
-#define GXID_RELEASE_DEVICE 2
-
-#define GXID_RETURN_OK 0
-#define GXID_RETURN_ERROR -1
-
-typedef struct GxidClaimDevice_ GxidClaimDevice;
-typedef struct GxidReleaseDevice_ GxidReleaseDevice;
-typedef struct GxidMessageAny_ GxidMessageAny;
-typedef union GxidMessage_ GxidMessage;
-
-typedef unsigned long GxidU32;
-typedef long GxidI32;
-
-struct GxidClaimDevice_ {
- GxidU32 type;
- GxidU32 length;
- GxidU32 device;
- GxidU32 window;
- GxidU32 exclusive;
-};
-
-struct GxidReleaseDevice_ {
- GxidU32 type;
- GxidU32 length;
- GxidU32 device;
- GxidU32 window;
-};
-
-struct GxidMessageAny_ {
- GxidU32 type;
- GxidU32 length;
-};
-
-union GxidMessage_ {
- GxidMessageAny any;
- GxidClaimDevice claim;
- GxidReleaseDevice release;
-};
diff --git a/gdk/makecursors.awk b/gdk/makecursors.awk
deleted file mode 100755
index aee14c8a64..0000000000
--- a/gdk/makecursors.awk
+++ /dev/null
@@ -1,4 +0,0 @@
-$1 == "#define" && NF >= 3 {
- sub(/^XC/,"GDK",$2)
- printf("%s = %s,\n",toupper($2),$3)
-}
diff --git a/gdk/makekeysyms.awk b/gdk/makekeysyms.awk
deleted file mode 100755
index dbf2a1b94a..0000000000
--- a/gdk/makekeysyms.awk
+++ /dev/null
@@ -1,5 +0,0 @@
-$1 == "#define" && NF >= 3 {
- sub(/^XK/,"GDK",$2)
- sub(/0X/,"0x",$3)
- print $1,$2,$3
-}
diff --git a/gdk/x11/MwmUtil.h b/gdk/x11/MwmUtil.h
deleted file mode 100644
index 3628e9c0ce..0000000000
--- a/gdk/x11/MwmUtil.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/**
- *
- * $Id$
- *
- * Copyright (C) 1995 Free Software Foundation, Inc.
- *
- * This file is part of the GNU LessTif Library.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- **/
-
-#ifndef MWMUTIL_H_INCLUDED
-#define MWMUTIL_H_INCLUDED
-
-#include <X11/Xmd.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct {
- CARD32 flags;
- CARD32 functions;
- CARD32 decorations;
- INT32 input_mode;
- CARD32 status;
-} MotifWmHints, MwmHints;
-
-#define MWM_HINTS_FUNCTIONS (1L << 0)
-#define MWM_HINTS_DECORATIONS (1L << 1)
-#define MWM_HINTS_INPUT_MODE (1L << 2)
-#define MWM_HINTS_STATUS (1L << 3)
-
-#define MWM_FUNC_ALL (1L << 0)
-#define MWM_FUNC_RESIZE (1L << 1)
-#define MWM_FUNC_MOVE (1L << 2)
-#define MWM_FUNC_MINIMIZE (1L << 3)
-#define MWM_FUNC_MAXIMIZE (1L << 4)
-#define MWM_FUNC_CLOSE (1L << 5)
-
-#define MWM_DECOR_ALL (1L << 0)
-#define MWM_DECOR_BORDER (1L << 1)
-#define MWM_DECOR_RESIZEH (1L << 2)
-#define MWM_DECOR_TITLE (1L << 3)
-#define MWM_DECOR_MENU (1L << 4)
-#define MWM_DECOR_MINIMIZE (1L << 5)
-#define MWM_DECOR_MAXIMIZE (1L << 6)
-
-#define MWM_INPUT_MODELESS 0
-#define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1
-#define MWM_INPUT_SYSTEM_MODAL 2
-#define MWM_INPUT_FULL_APPLICATION_MODAL 3
-#define MWM_INPUT_APPLICATION_MODAL MWM_INPUT_PRIMARY_APPLICATION_MODAL
-
-#define MWM_TEAROFF_WINDOW (1L<<0)
-
-/*
- * atoms
- */
-#define _XA_MOTIF_BINDINGS "_MOTIF_BINDINGS"
-#define _XA_MOTIF_WM_HINTS "_MOTIF_WM_HINTS"
-#define _XA_MOTIF_WM_MESSAGES "_MOTIF_WM_MESSAGES"
-#define _XA_MOTIF_WM_OFFSET "_MOTIF_WM_OFFSET"
-#define _XA_MOTIF_WM_MENU "_MOTIF_WM_MENU"
-#define _XA_MOTIF_WM_INFO "_MOTIF_WM_INFO"
-#define _XA_MWM_HINTS _XA_MOTIF_WM_HINTS
-#define _XA_MWM_MESSAGES _XA_MOTIF_WM_MESSAGES
-#define _XA_MWM_MENU _XA_MOTIF_WM_MENU
-#define _XA_MWM_INFO _XA_MOTIF_WM_INFO
-
-
-/*
- * _MWM_INFO property
- */
-typedef struct {
- long flags;
- Window wm_window;
-} MotifWmInfo;
-
-typedef MotifWmInfo MwmInfo;
-
-#define MWM_INFO_STARTUP_STANDARD (1L<<0)
-#define MWM_INFO_STARTUP_CUSTOM (1L<<1)
-
-/*
- * _MWM_HINTS property
- */
-typedef struct {
- CARD32 flags;
- CARD32 functions;
- CARD32 decorations;
- INT32 inputMode;
- CARD32 status;
-} PropMotifWmHints;
-
-typedef PropMotifWmHints PropMwmHints;
-
-#define PROP_MOTIF_WM_HINTS_ELEMENTS 5
-#define PROP_MWM_HINTS_ELEMENTS PROP_MOTIF_WM_HINTS_ELEMENTS
-
-/*
- * _MWM_INFO property, slight return
- */
-typedef struct {
- CARD32 flags;
- CARD32 wmWindow;
-} PropMotifWmInfo;
-
-typedef PropMotifWmInfo PropMwmInfo;
-
-#define PROP_MOTIF_WM_INFO_ELEMENTS 2
-#define PROP_MWM_INFO_ELEMENTS PROP_MOTIF_WM_INFO_ELEMENTS
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* MWMUTIL_H_INCLUDED */
diff --git a/gdk/x11/gdkcc-x11.c b/gdk/x11/gdkcc-x11.c
deleted file mode 100644
index 28ecad7feb..0000000000
--- a/gdk/x11/gdkcc-x11.c
+++ /dev/null
@@ -1,1721 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/* Color Context module
- * Copyright 1994,1995 John L. Cwikla
- * Copyright (C) 1997 by Ripley Software Development
- * Copyright (C) 1997 by Federico Mena (port to Gtk/Gdk)
- */
-
-/* Copyright 1994,1995 John L. Cwikla
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appears in all copies and that
- * both that copyright notice and this permission notice appear in
- * supporting documentation, and that the name of John L. Cwikla or
- * Wolfram Research, Inc not be used in advertising or publicity
- * pertaining to distribution of the software without specific, written
- * prior permission. John L. Cwikla and Wolfram Research, Inc make no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- * John L. Cwikla and Wolfram Research, Inc disclaim all warranties with
- * regard to this software, including all implied warranties of
- * merchantability and fitness, in no event shall John L. Cwikla or
- * Wolfram Research, Inc be liable for any special, indirect or
- * consequential damages or any damages whatsoever resulting from loss of
- * use, data or profits, whether in an action of contract, negligence or
- * other tortious action, arising out of or in connection with the use or
- * performance of this software.
- *
- * Author:
- * John L. Cwikla
- * X Programmer
- * Wolfram Research Inc.
- *
- * cwikla@wri.com
- */
-
-
-#include <X11/Xlib.h>
-#include <stdlib.h>
-#include <string.h>
-#include "gdk.h"
-#include "gdkprivate.h"
-#include "gdkx.h"
-
-
-#define MAX_IMAGE_COLORS 256
-
-
-static guint
-hash_color (gpointer key)
-{
- GdkColor *color = key;
-
- return (color->red * 33023 + color->green * 30013 + color->blue * 27011);
-}
-
-static gint
-compare_colors (gpointer a,
- gpointer b)
-{
- GdkColor *aa = a;
- GdkColor *bb = b;
-
- return ((aa->red == bb->red) && (aa->green == bb->green) && (aa->blue == bb->blue));
-}
-
-static void
-free_hash_entry (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- g_free (key); /* key and value are the same GdkColor */
-}
-
-static int
-pixel_sort (const void *a, const void *b)
-{
- return ((GdkColor *) a)->pixel - ((GdkColor *) b)->pixel;
-}
-
-/* XXX: This function does an XQueryColors() the hard way, because there is
- * no corresponding function in Gdk.
- */
-
-static void
-my_x_query_colors (GdkColormap *colormap,
- GdkColor *colors,
- gint ncolors)
-{
- XColor *xcolors;
- gint i;
-
- xcolors = g_new (XColor, ncolors);
- for (i = 0; i < ncolors; i++)
- xcolors[i].pixel = colors[i].pixel;
-
- XQueryColors (gdk_display, GDK_COLORMAP_XCOLORMAP (colormap), xcolors, ncolors);
-
- for (i = 0; i < ncolors; i++)
- {
- colors[i].red = xcolors[i].red;
- colors[i].green = xcolors[i].green;
- colors[i].blue = xcolors[i].blue;
- }
-
- g_free (xcolors);
-}
-
-static void
-query_colors (GdkColorContext *cc)
-{
- gint i;
- GdkColorContextPrivate *ccp = (GdkColorContextPrivate *) cc;
- cc->cmap = g_new (GdkColor, cc->num_colors);
-
- for (i = 0; i < cc->num_colors; i++)
- cc->cmap[i].pixel = cc->clut ? cc->clut[i] : ccp->std_cmap.base_pixel + i;
-
- my_x_query_colors (cc->colormap, cc->cmap, cc->num_colors);
-
- qsort (cc->cmap, cc->num_colors, sizeof (GdkColor), pixel_sort);
-}
-
-static void
-init_bw (GdkColorContext *cc)
-{
- GdkColor color;
-
- g_warning ("init_bw: failed to allocate colors, falling back to black and white");
-
- cc->mode = GDK_CC_MODE_BW;
-
- color.red = color.green = color.blue = 0;
-
- if (!gdk_color_alloc (cc->colormap, &color))
- cc->black_pixel = 0;
- else
- cc->black_pixel = color.pixel;
-
- color.red = color.green = color.blue = 0xffff;
-
- if (!gdk_color_alloc (cc->colormap, &color))
- cc->white_pixel = cc->black_pixel ? 0 : 1;
- else
- cc->white_pixel = color.pixel;
-
- cc->num_colors = 2;
-}
-
-static void
-init_gray (GdkColorContext *cc)
-{
- GdkColorContextPrivate *ccp = (GdkColorContextPrivate *) cc;
- GdkColor *clrs, *cstart;
- gint i;
- gdouble dinc;
-
- cc->num_colors = GDK_VISUAL_XVISUAL (cc->visual)->map_entries;
-
- cc->clut = g_new (gulong, cc->num_colors);
- cstart = g_new (GdkColor, cc->num_colors);
-
-retrygray:
-
- dinc = 65535.0 / (cc->num_colors - 1);
-
- clrs = cstart;
-
- for (i = 0; i < cc->num_colors; i++)
- {
- clrs->red = clrs->green = clrs->blue = dinc * i;
-
- if (!gdk_color_alloc (cc->colormap, clrs))
- {
- gdk_colors_free (cc->colormap, cc->clut, i, 0);
-
- cc->num_colors /= 2;
-
- if (cc->num_colors > 1)
- goto retrygray;
- else
- {
- g_free (cc->clut);
- cc->clut = NULL;
- init_bw (cc);
- g_free (cstart);
- return;
- }
- }
-
- cc->clut[i] = clrs++->pixel;
- }
-
- g_free (cstart);
-
- /* XXX: is this the right thing to do? */
- ccp->std_cmap.colormap = GDK_COLORMAP_XCOLORMAP (cc->colormap);
- ccp->std_cmap.base_pixel = 0;
- ccp->std_cmap.red_max = cc->num_colors - 1;
- ccp->std_cmap.green_max = 0;
- ccp->std_cmap.blue_max = 0;
- ccp->std_cmap.red_mult = 1;
- ccp->std_cmap.green_mult = 0;
- ccp->std_cmap.blue_mult = 0;
-
- cc->white_pixel = WhitePixel (ccp->xdisplay, gdk_screen);
- cc->black_pixel = BlackPixel (ccp->xdisplay, gdk_screen);
-
- query_colors (cc);
-
- cc->mode = GDK_CC_MODE_MY_GRAY;
-}
-
-static void
-init_color (GdkColorContext *cc)
-{
- GdkColorContextPrivate *ccp = (GdkColorContextPrivate *) cc;
- gint cubeval;
-
- cubeval = 1;
- while ((cubeval * cubeval * cubeval) < GDK_VISUAL_XVISUAL (cc->visual)->map_entries)
- cubeval++;
- cubeval--;
-
- cc->num_colors = cubeval * cubeval * cubeval;
-
- ccp->std_cmap.red_max = cubeval - 1;
- ccp->std_cmap.green_max = cubeval - 1;
- ccp->std_cmap.blue_max = cubeval - 1;
- ccp->std_cmap.red_mult = cubeval * cubeval;
- ccp->std_cmap.green_mult = cubeval;
- ccp->std_cmap.blue_mult = 1;
- ccp->std_cmap.base_pixel = 0;
-
- cc->white_pixel = WhitePixel (ccp->xdisplay, gdk_screen);
- cc->black_pixel = BlackPixel (ccp->xdisplay, gdk_screen);
- cc->num_colors = DisplayCells (ccp->xdisplay, gdk_screen);
-
- /* a CLUT for storing allocated pixel indices */
-
- cc->max_colors = cc->num_colors;
- cc->clut = g_new (gulong, cc->max_colors);
-
- for (cubeval = 0; cubeval < cc->max_colors; cubeval++)
- cc->clut[cubeval] = cubeval;
-
- query_colors (cc);
-
- cc->mode = GDK_CC_MODE_STD_CMAP;
-}
-
-
-static void
-init_true_color (GdkColorContext *cc)
-{
- GdkColorContextPrivate *ccp = (GdkColorContextPrivate *) cc;
- gulong rmask, gmask, bmask;
-
- cc->mode = GDK_CC_MODE_TRUE;
-
- /* Red */
-
- rmask = cc->masks.red = cc->visual->red_mask;
-
- cc->shifts.red = 0;
- cc->bits.red = 0;
-
- while (!(rmask & 1))
- {
- rmask >>= 1;
- cc->shifts.red++;
- }
-
- while (rmask & 1)
- {
- rmask >>= 1;
- cc->bits.red++;
- }
-
- /* Green */
-
- gmask = cc->masks.green = cc->visual->green_mask;
-
- cc->shifts.green = 0;
- cc->bits.green = 0;
-
- while (!(gmask & 1))
- {
- gmask >>= 1;
- cc->shifts.green++;
- }
-
- while (gmask & 1)
- {
- gmask >>= 1;
- cc->bits.green++;
- }
-
- /* Blue */
-
- bmask = cc->masks.blue = cc->visual->blue_mask;
-
- cc->shifts.blue = 0;
- cc->bits.blue = 0;
-
- while (!(bmask & 1))
- {
- bmask >>= 1;
- cc->shifts.blue++;
- }
-
- while (bmask & 1)
- {
- bmask >>= 1;
- cc->bits.blue++;
- }
-
- cc->num_colors = (cc->visual->red_mask | cc->visual->green_mask | cc->visual->blue_mask) + 1;
- cc->white_pixel = WhitePixel (ccp->xdisplay, gdk_screen);
- cc->black_pixel = BlackPixel (ccp->xdisplay, gdk_screen);
-}
-
-static void
-init_direct_color (GdkColorContext *cc)
-{
- gint n, count;
- GdkColor *clrs, *cstart;
- gulong rval, gval, bval;
- gulong *rtable;
- gulong *gtable;
- gulong *btable;
- gdouble dinc;
-
- init_true_color (cc); /* for shift stuff */
-
- rval = cc->visual->red_mask >> cc->shifts.red;
- gval = cc->visual->green_mask >> cc->shifts.green;
- bval = cc->visual->blue_mask >> cc->shifts.blue;
-
- rtable = g_new (gulong, rval + 1);
- gtable = g_new (gulong, gval + 1);
- btable = g_new (gulong, bval + 1);
-
- cc->max_entry = MAX (rval, gval);
- cc->max_entry = MAX (cc->max_entry, bval);
-
- cstart = g_new (GdkColor, cc->max_entry + 1);
- cc->clut = g_new (gulong, cc->max_entry + 1);
-
-retrydirect:
-
- for (n = 0; n < rval; n++)
- rtable[n] = rval ? (65535.0 / rval * n) : 0;
-
- for (n = 0; n < gval; n++)
- gtable[n] = gval ? (65535.0 / gval * n) : 0;
-
- for (n = 0; n < bval; n++)
- btable[n] = bval ? (65535.0 / bval * n) : 0;
-
- cc->max_entry = MAX (rval, gval);
- cc->max_entry = MAX (cc->max_entry, bval);
-
- count = 0;
- clrs = cstart;
- cc->num_colors = (rval + 1) * (gval + 1) * (bval + 1);
-
- for (n = 0; n < cc->max_entry; n++)
- {
- dinc = (double) n / cc->max_entry;
-
- clrs->red = rtable[(int) (dinc * rval)];
- clrs->green = gtable[(int) (dinc * gval)];
- clrs->blue = btable[(int) (dinc * bval)];
-
- if (gdk_color_alloc (cc->colormap, clrs))
- {
- cc->clut[count++] = clrs->pixel;
- clrs++;
- }
- else
- {
- gdk_colors_free (cc->colormap, cc->clut, count, 0);
-
- rval >>= 1;
- gval >>= 1;
- bval >>= 1;
-
- cc->masks.red = (cc->masks.red >> 1) & cc->visual->red_mask;
- cc->masks.green = (cc->masks.green >> 1) & cc->visual->green_mask;
- cc->masks.blue = (cc->masks.blue >> 1) & cc->visual->blue_mask;
-
- cc->shifts.red++;
- cc->shifts.green++;
- cc->shifts.blue++;
-
- cc->bits.red--;
- cc->bits.green--;
- cc->bits.blue--;
-
- cc->num_colors = (rval + 1) * (gval + 1) * (bval + 1);
-
- if (cc->num_colors >1)
- goto retrydirect;
- else
- {
- g_free (cc->clut);
- cc->clut = NULL;
- init_bw (cc);
- break;
- }
- }
- }
-
- /* Update allocated color count; original num_colors is max_entry, which
- * is not necessarily the same as the really allocated number of colors.
- */
-
- cc->num_colors = count;
-
- g_free (rtable);
- g_free (gtable);
- g_free (btable);
- g_free (cstart);
-}
-
-static void
-init_palette (GdkColorContext *cc)
-{
- /* restore correct mode for this cc */
-
- switch (cc->visual->type)
- {
- case GDK_VISUAL_STATIC_GRAY:
- case GDK_VISUAL_GRAYSCALE:
- if (GDK_VISUAL_XVISUAL (cc->visual)->map_entries == 2)
- cc->mode = GDK_CC_MODE_BW;
- else
- cc->mode = GDK_CC_MODE_MY_GRAY;
- break;
-
- case GDK_VISUAL_TRUE_COLOR:
- case GDK_VISUAL_DIRECT_COLOR:
- cc->mode = GDK_CC_MODE_TRUE;
- break;
-
- case GDK_VISUAL_STATIC_COLOR:
- case GDK_VISUAL_PSEUDO_COLOR:
- cc->mode = GDK_CC_MODE_STD_CMAP;
- break;
-
- default:
- cc->mode = GDK_CC_MODE_UNDEFINED;
- break;
- }
-
- /* previous palette */
-
- if (cc->num_palette)
- g_free (cc->palette);
-
- if (cc->fast_dither)
- g_free (cc->fast_dither);
-
- /* clear hash table if present */
-
- if (cc->color_hash)
- {
- /* XXX: quick-and-dirty way to remove everything */
-
- g_hash_table_destroy (cc->color_hash);
- cc->color_hash = g_hash_table_new (hash_color, compare_colors);
- }
-
- cc->palette = NULL;
- cc->num_palette = 0;
- cc->fast_dither = NULL;
-}
-
-GdkColorContext *
-gdk_color_context_new (GdkVisual *visual,
- GdkColormap *colormap)
-{
- GdkColorContextPrivate *ccp;
- gint use_private_colormap = FALSE; /* XXX: maybe restore full functionality later? */
- GdkColorContext *cc;
- gint retry_count;
- GdkColormap *default_colormap;
-
- g_assert (visual != NULL);
- g_assert (colormap != NULL);
-
- ccp = g_new (GdkColorContextPrivate, 1);
- cc = (GdkColorContext *) ccp;
- ccp->xdisplay = gdk_display;
- cc->visual = visual;
- cc->colormap = colormap;
- cc->clut = NULL;
- cc->cmap = NULL;
- cc->mode = GDK_CC_MODE_UNDEFINED;
- cc->need_to_free_colormap = FALSE;
-
- cc->color_hash = NULL;
- cc->palette = NULL;
- cc->num_palette = 0;
- cc->fast_dither = NULL;
-
- default_colormap = gdk_colormap_get_system ();
-
- retry_count = 0;
-
- while (retry_count < 2)
- {
- /* Only create a private colormap if the visual found isn't equal
- * to the default visual and we don't have a private colormap,
- * -or- if we are instructed to create a private colormap (which
- * never is the case for XmHTML).
- */
-
- if (use_private_colormap
- || ((cc->visual != gdk_visual_get_system ()) /* default visual? */
- && (GDK_COLORMAP_XCOLORMAP (colormap) == GDK_COLORMAP_XCOLORMAP (default_colormap))))
- {
- g_warning ("gdk_color_context_new: non-default visual detected, "
- "using private colormap");
-
- cc->colormap = gdk_colormap_new (cc->visual, FALSE);
-
- cc->need_to_free_colormap = (GDK_COLORMAP_XCOLORMAP (colormap)
- != GDK_COLORMAP_XCOLORMAP (default_colormap));
- }
-
- switch (visual->type)
- {
- case GDK_VISUAL_STATIC_GRAY:
- case GDK_VISUAL_GRAYSCALE:
- GDK_NOTE (COLOR_CONTEXT,
- g_print ("gdk_color_context_new: visual class is %s\n",
- (visual->type == GDK_VISUAL_STATIC_GRAY) ?
- "GDK_VISUAL_STATIC_GRAY" :
- "GDK_VISUAL_GRAYSCALE"));
-
- if (GDK_VISUAL_XVISUAL (cc->visual)->map_entries == 2)
- init_bw (cc);
- else
- init_gray (cc);
-
- break;
-
- case GDK_VISUAL_TRUE_COLOR: /* shifts */
- GDK_NOTE (COLOR_CONTEXT,
- g_print ("gdk_color_context_new: visual class is GDK_VISUAL_TRUE_COLOR\n"));
-
- init_true_color (cc);
- break;
-
- case GDK_VISUAL_DIRECT_COLOR: /* shifts and fake CLUT */
- GDK_NOTE (COLOR_CONTEXT,
- g_print ("gdk_color_context_new: visual class is GDK_VISUAL_DIRECT_COLOR\n"));
-
- init_direct_color (cc);
- break;
-
- case GDK_VISUAL_STATIC_COLOR:
- case GDK_VISUAL_PSEUDO_COLOR:
- GDK_NOTE (COLOR_CONTEXT,
- g_print ("gdk_color_context_new: visual class is %s\n",
- (visual->type == GDK_VISUAL_STATIC_COLOR) ?
- "GDK_VISUAL_STATIC_COLOR" :
- "GDK_VISUAL_PSEUDO_COLOR"));
-
- init_color (cc);
- break;
-
- default:
- g_assert_not_reached ();
- }
-
- if ((cc->mode == GDK_CC_MODE_BW) && (cc->visual->depth > 1))
- {
- use_private_colormap = TRUE;
- retry_count++;
- }
- else
- break;
- }
-
- /* no. of colors allocated yet */
-
- cc->num_allocated = 0;
-
- GDK_NOTE (COLOR_CONTEXT,
- g_print ("gdk_color_context_new: screen depth is %i, no. of colors is %i\n",
- cc->visual->depth, cc->num_colors));
-
- /* check if we need to initialize a hash table */
-
- if ((cc->mode == GDK_CC_MODE_STD_CMAP) || (cc->mode == GDK_CC_MODE_UNDEFINED))
- cc->color_hash = g_hash_table_new (hash_color, compare_colors);
-
- return (GdkColorContext *) cc;
-}
-
-GdkColorContext *
-gdk_color_context_new_mono (GdkVisual *visual,
- GdkColormap *colormap)
-{
- GdkColorContextPrivate *ccp;
- GdkColorContext *cc;
-
- g_assert (visual != NULL);
- g_assert (colormap != NULL);
-
- cc = g_new (GdkColorContext, 1);
- ccp = (GdkColorContextPrivate *) cc;
- ccp->xdisplay = gdk_display;
- cc->visual = visual;
- cc->colormap = colormap;
- cc->clut = NULL;
- cc->cmap = NULL;
- cc->mode = GDK_CC_MODE_UNDEFINED;
- cc->need_to_free_colormap = FALSE;
-
- init_bw (cc);
-
- return (GdkColorContext *) cc;
-}
-
-/* This doesn't currently free black/white, hmm... */
-
-void
-gdk_color_context_free (GdkColorContext *cc)
-{
- g_assert (cc != NULL);
-
- if ((cc->visual->type == GDK_VISUAL_STATIC_COLOR)
- || (cc->visual->type == GDK_VISUAL_PSEUDO_COLOR))
- {
- gdk_colors_free (cc->colormap, cc->clut, cc->num_allocated, 0);
- g_free (cc->clut);
- }
- else if (cc->clut != NULL)
- {
- gdk_colors_free (cc->colormap, cc->clut, cc->num_colors, 0);
- g_free (cc->clut);
- }
-
- if (cc->cmap != NULL)
- g_free (cc->cmap);
-
- if (cc->need_to_free_colormap)
- gdk_colormap_unref (cc->colormap);
-
- /* free any palette that has been associated with this GdkColorContext */
-
- init_palette (cc);
-
- if (cc->color_hash)
- {
- g_hash_table_foreach (cc->color_hash,
- free_hash_entry,
- NULL);
- g_hash_table_destroy (cc->color_hash);
- }
-
- g_free (cc);
-}
-
-gulong
-gdk_color_context_get_pixel (GdkColorContext *cc,
- gushort red,
- gushort green,
- gushort blue,
- gint *failed)
-{
- GdkColorContextPrivate *ccp = (GdkColorContextPrivate *) cc;
- g_assert (cc != NULL);
- g_assert (failed != NULL);
-
- *failed = FALSE;
-
- switch (cc->mode)
- {
- case GDK_CC_MODE_BW:
- {
- gdouble value;
-
- value = (red / 65535.0 * 0.30
- + green / 65535.0 * 0.59
- + blue / 65535.0 * 0.11);
-
- if (value > 0.5)
- return cc->white_pixel;
-
- return cc->black_pixel;
- }
-
- case GDK_CC_MODE_MY_GRAY:
- {
- gulong ired, igreen, iblue;
-
- red = red * 0.30 + green * 0.59 + blue * 0.11;
- green = 0;
- blue = 0;
-
- if ((ired = red * (ccp->std_cmap.red_max + 1) / 0xffff) > ccp->std_cmap.red_max)
- ired = ccp->std_cmap.red_max;
-
- ired *= ccp->std_cmap.red_mult;
-
- if ((igreen = green * (ccp->std_cmap.green_max + 1) / 0xffff) > ccp->std_cmap.green_max)
- igreen = ccp->std_cmap.green_max;
-
- igreen *= ccp->std_cmap.green_mult;
-
- if ((iblue = blue * (ccp->std_cmap.blue_max + 1) / 0xffff) > ccp->std_cmap.blue_max)
- iblue = ccp->std_cmap.blue_max;
-
- iblue *= ccp->std_cmap.blue_mult;
-
- if (cc->clut != NULL)
- return cc->clut[ccp->std_cmap.base_pixel + ired + igreen + iblue];
-
- return ccp->std_cmap.base_pixel + ired + igreen + iblue;
- }
-
- case GDK_CC_MODE_TRUE:
- {
- gulong ired, igreen, iblue;
-
- if (cc->clut == NULL)
- {
- red >>= 16 - cc->bits.red;
- green >>= 16 - cc->bits.green;
- blue >>= 16 - cc->bits.blue;
-
- ired = (red << cc->shifts.red) & cc->masks.red;
- igreen = (green << cc->shifts.green) & cc->masks.green;
- iblue = (blue << cc->shifts.blue) & cc->masks.blue;
-
- return ired | igreen | iblue;
- }
-
- ired = cc->clut[red * cc->max_entry / 65535] & cc->masks.red;
- igreen = cc->clut[green * cc->max_entry / 65535] & cc->masks.green;
- iblue = cc->clut[blue * cc->max_entry / 65535] & cc->masks.blue;
-
- return ired | igreen | iblue;
- }
-
- case GDK_CC_MODE_PALETTE:
- return gdk_color_context_get_pixel_from_palette (cc, &red, &green, &blue, failed);
-
- case GDK_CC_MODE_STD_CMAP:
- default:
- {
- GdkColor color;
- GdkColor *result;
-
- color.red = red;
- color.green = green;
- color.blue = blue;
-
- result = g_hash_table_lookup (cc->color_hash, &color);
-
- if (!result)
- {
- color.red = red;
- color.green = green;
- color.blue = blue;
- color.pixel = 0;
-
- if (!gdk_color_alloc (cc->colormap, &color))
- *failed = TRUE;
- else
- {
- GdkColor *cnew;
-
- /* XXX: the following comment comes directly from
- * XCC.c. I don't know if it is relevant for
- * gdk_color_alloc() as it is for XAllocColor()
- * - Federico
- */
- /*
- * I can't figure this out entirely, but it *is* possible
- * that XAllocColor succeeds, even if the number of
- * allocations we've made exceeds the number of available
- * colors in the current colormap. And therefore it
- * might be necessary for us to resize the CLUT.
- */
-
- if (cc->num_allocated == cc->max_colors)
- {
- cc->max_colors *= 2;
-
- GDK_NOTE (COLOR_CONTEXT,
- g_print ("gdk_color_context_get_pixel: "
- "resizing CLUT to %i entries\n",
- cc->max_colors));
-
- cc->clut = g_realloc (cc->clut,
- cc->max_colors * sizeof (gulong));
- }
-
- /* Key and value are the same color structure */
-
- cnew = g_new (GdkColor, 1);
- *cnew = color;
- g_hash_table_insert (cc->color_hash, cnew, cnew);
-
- cc->clut[cc->num_allocated] = color.pixel;
- cc->num_allocated++;
- return color.pixel;
- }
- }
-
- return result->pixel;
- }
- }
-}
-
-void
-gdk_color_context_get_pixels (GdkColorContext *cc,
- gushort *reds,
- gushort *greens,
- gushort *blues,
- gint ncolors,
- gulong *colors,
- gint *nallocated)
-{
- gint i, k, idx;
- gint cmapsize, ncols = 0, nopen = 0, counter = 0;
- gint bad_alloc = FALSE;
- gint failed[MAX_IMAGE_COLORS], allocated[MAX_IMAGE_COLORS];
- GdkColor defs[MAX_IMAGE_COLORS], cmap[MAX_IMAGE_COLORS];
- gint exact_col = 0, subst_col = 0, close_col = 0, black_col = 0;
-
- g_assert (cc != NULL);
- g_assert (reds != NULL);
- g_assert (greens != NULL);
- g_assert (blues != NULL);
- g_assert (colors != NULL);
- g_assert (nallocated != NULL);
-
- memset (defs, 0, MAX_IMAGE_COLORS * sizeof (GdkColor));
- memset (failed, 0, MAX_IMAGE_COLORS * sizeof (gint));
- memset (allocated, 0, MAX_IMAGE_COLORS * sizeof (gint));
-
- /* Will only have a value if used by the progressive image loader */
-
- ncols = *nallocated;
-
- *nallocated = 0;
-
- /* First allocate all pixels */
-
- for (i = 0; i < ncolors; i++)
- {
- /* colors[i] is only zero if the pixel at that location hasn't
- * been allocated yet. This is a sanity check required for proper
- * color allocation by the progressive image loader
- */
-
- if (colors[i] == 0)
- {
- defs[i].red = reds[i];
- defs[i].green = greens[i];
- defs[i].blue = blues[i];
-
- colors[i] = gdk_color_context_get_pixel (cc, reds[i], greens[i], blues[i],
- &bad_alloc);
-
- /* successfully allocated, store it */
-
- if (!bad_alloc)
- {
- defs[i].pixel = colors[i];
- allocated[ncols++] = colors[i];
- }
- else
- failed[nopen++] = i;
- }
- }
-
- *nallocated = ncols;
-
- /* all colors available, all done */
-
- if ((ncols == ncolors) || (nopen == 0))
- {
- GDK_NOTE (COLOR_CONTEXT,
- g_print ("gdk_color_context_get_pixels: got all %i colors; "
- "(%i colors allocated so far)\n", ncolors, cc->num_allocated));
-
- return;
- }
-
- /* The fun part. We now try to allocate the colors we couldn't allocate
- * directly. The first step will map a color onto its nearest color
- * that has been allocated (either by us or someone else). If any colors
- * remain unallocated, we map these onto the colors that we have allocated
- * ourselves.
- */
-
- /* read up to MAX_IMAGE_COLORS colors of the current colormap */
-
- cmapsize = MIN (cc->num_colors, MAX_IMAGE_COLORS);
-
- /* see if the colormap has any colors to read */
-
- if (cmapsize < 0)
- {
- g_warning ("gdk_color_context_get_pixels: oops! no colors available, "
- "your images will look *really* ugly.");
-
- return;
- }
-
-#ifdef DEBUG
- exact_col = ncols;
-#endif
-
- /* initialize pixels */
-
- for (i = 0; i < cmapsize; i++)
- {
- cmap[i].pixel = i;
- cmap[i].red = cmap[i].green = cmap[i].blue = 0;
- }
-
- /* read the colormap */
-
- my_x_query_colors (cc->colormap, cmap, cmapsize);
-
- /* get a close match for any unallocated colors */
-
- counter = nopen;
- nopen = 0;
- idx = 0;
-
- do
- {
- gint d, j, mdist, close, ri, gi, bi;
- gint rd, gd, bd;
-
- i = failed[idx];
-
- mdist = 0x1000000;
- close = -1;
-
- /* Store these vals. Small performance increase as this skips three
- * indexing operations in the loop code.
- */
-
- ri = reds[i];
- gi = greens[i];
- bi = blues[i];
-
- /* Walk all colors in the colormap and see which one is the
- * closest. Uses plain least squares.
- */
-
- for (j = 0; (j < cmapsize) && (mdist != 0); j++)
- {
- /* Don't replace these by shifts; the sign may get clobbered */
-
- rd = (ri - cmap[j].red) / 256;
- gd = (gi - cmap[j].green) / 256;
- bd = (bi - cmap[j].blue) / 256;
-
- d = rd * rd + gd * gd + bd * bd;
-
- if (d < mdist)
- {
- close = j;
- mdist = d;
- }
- }
-
- if (close != -1)
- {
- rd = cmap[close].red;
- gd = cmap[close].green;
- bd = cmap[close].blue;
-
- /* allocate */
-
- colors[i] = gdk_color_context_get_pixel (cc, rd, gd, bd, &bad_alloc);
-
- /* store */
-
- if (!bad_alloc)
- {
- defs[i] = cmap[close];
- defs[i].pixel = colors[i];
- allocated[ncols++] = colors[i];
-#ifdef DEBUG
- close_col++;
-#endif
- } else
- failed[nopen++] = i;
- } else
- failed[nopen++] = i;
- /* deal with in next stage if allocation failed */
- }
- while (++idx < counter);
-
- *nallocated = ncols;
-
- /* This is the maximum no. of allocated colors. See also the nopen == 0
- * note above.
- */
-
- if ((ncols == ncolors) || (nopen == 0))
- {
- GDK_NOTE (COLOR_CONTEXT,
- g_print ("gdk_color_context_get_pixels: got %i colors, %i exact and "
- "%i close (%i colors allocated so far)\n",
- ncolors, exact_col, close_col, cc->num_allocated));
-
- return;
- }
-
- /* Now map any remaining unallocated pixels into the colors we did get */
-
- idx = 0;
-
- do
- {
- gint d, mdist, close, ri, gi, bi;
- gint j, rd, gd, bd;
-
- i = failed[idx];
-
- mdist = 0x1000000;
- close = -1;
-
- /* store */
-
- ri = reds[i];
- gi = greens[i];
- bi = blues[i];
-
- /* search allocated colors */
-
- for (j = 0; (j < ncols) && (mdist != 0); j++)
- {
- k = allocated[j];
-
- /* Don't replace these by shifts; the sign may get clobbered */
-
- rd = (ri - defs[k].red) / 256;
- gd = (gi - defs[k].green) / 256;
- bd = (bi - defs[k].blue) / 256;
-
- d = rd * rd + gd * gd + bd * bd;
-
- if (d < mdist)
- {
- close = k;
- mdist = d;
- }
- }
-
- if (close < 0)
- {
- /* too bad, map to black */
-
- defs[i].pixel = cc->black_pixel;
- defs[i].red = defs[i].green = defs[i].blue = 0;
-#ifdef DEBUG
- black_col++;
-#endif
- }
- else
- {
- defs[i] = defs[close];
-#ifdef DEBUG
- subst_col++;
-#endif
- }
-
- colors[i] = defs[i].pixel;
- }
- while (++idx < nopen);
-
- GDK_NOTE (COLOR_CONTEXT,
- g_print ("gdk_color_context_get_pixels: got %i colors, %i exact, %i close, "
- "%i substituted, %i to black (%i colors allocated so far)\n",
- ncolors, exact_col, close_col, subst_col, black_col, cc->num_allocated));
-}
-
-void
-gdk_color_context_get_pixels_incremental (GdkColorContext *cc,
- gushort *reds,
- gushort *greens,
- gushort *blues,
- gint ncolors,
- gint *used,
- gulong *colors,
- gint *nallocated)
-{
- gint i, k, idx;
- gint cmapsize, ncols = 0, nopen = 0, counter = 0;
- gint bad_alloc = FALSE;
- gint failed[MAX_IMAGE_COLORS], allocated[MAX_IMAGE_COLORS];
- GdkColor defs[MAX_IMAGE_COLORS], cmap[MAX_IMAGE_COLORS];
- gint exact_col = 0, subst_col = 0, close_col = 0, black_col = 0;
-
- g_assert (cc != NULL);
- g_assert (reds != NULL);
- g_assert (greens != NULL);
- g_assert (blues != NULL);
- g_assert (used != NULL);
- g_assert (colors != NULL);
- g_assert (nallocated != NULL);
-
- memset (defs, 0, MAX_IMAGE_COLORS * sizeof (GdkColor));
- memset (failed, 0, MAX_IMAGE_COLORS * sizeof (gint));
- memset (allocated, 0, MAX_IMAGE_COLORS * sizeof (gint));
-
- /* Will only have a value if used by the progressive image loader */
-
- ncols = *nallocated;
-
- *nallocated = 0;
-
- /* First allocate all pixels */
-
- for (i = 0; i < ncolors; i++)
- {
- /* used[i] is only -1 if the pixel at that location hasn't
- * been allocated yet. This is a sanity check required for proper
- * color allocation by the progressive image loader.
- * When colors[i] == 0 it indicates the slot is available for
- * allocation.
- */
-
- if (used[i] != FALSE)
- {
- if (colors[i] == 0)
- {
- defs[i].red = reds[i];
- defs[i].green = greens[i];
- defs[i].blue = blues[i];
-
- colors[i] = gdk_color_context_get_pixel (cc, reds[i], greens[i], blues[i], &bad_alloc);
-
- /* successfully allocated, store it */
-
- if (!bad_alloc)
- {
- defs[i].pixel = colors[i];
- allocated[ncols++] = colors[i];
- }
- else
- failed[nopen++] = i;
- }
-#ifdef DEBUG
- else
- GDK_NOTE (COLOR_CONTEXT,
- g_print ("gdk_color_context_get_pixels_incremental: "
- "pixel at slot %i already allocated, skipping\n", i));
-#endif
- }
- }
-
- *nallocated = ncols;
-
- if ((ncols == ncolors) || (nopen == 0))
- {
- GDK_NOTE (COLOR_CONTEXT,
- g_print ("gdk_color_context_get_pixels_incremental: got all %i colors "
- "(%i colors allocated so far)\n",
- ncolors, cc->num_allocated));
-
- return;
- }
-
- cmapsize = MIN (cc->num_colors, MAX_IMAGE_COLORS);
-
- if (cmapsize < 0)
- {
- g_warning ("gdk_color_context_get_pixels_incremental: oops! "
- "No colors available images will look *really* ugly.");
- return;
- }
-
-#ifdef DEBUG
- exact_col = ncols;
-#endif
-
- /* initialize pixels */
-
- for (i = 0; i < cmapsize; i++)
- {
- cmap[i].pixel = i;
- cmap[i].red = cmap[i].green = cmap[i].blue = 0;
- }
-
- /* read */
-
- my_x_query_colors (cc->colormap, cmap, cmapsize);
-
- /* now match any unallocated colors */
-
- counter = nopen;
- nopen = 0;
- idx = 0;
-
- do
- {
- gint d, j, mdist, close, ri, gi, bi;
- gint rd, gd, bd;
-
- i = failed[idx];
-
- mdist = 0x1000000;
- close = -1;
-
- /* store */
-
- ri = reds[i];
- gi = greens[i];
- bi = blues[i];
-
- for (j = 0; (j < cmapsize) && (mdist != 0); j++)
- {
- /* Don't replace these by shifts; the sign may get clobbered */
-
- rd = (ri - cmap[j].red) / 256;
- gd = (gi - cmap[j].green) / 256;
- bd = (bi - cmap[j].blue) / 256;
-
- d = rd * rd + gd * gd + bd * bd;
-
- if (d < mdist)
- {
- close = j;
- mdist = d;
- }
- }
-
- if (close != -1)
- {
- rd = cmap[close].red;
- gd = cmap[close].green;
- bd = cmap[close].blue;
-
- /* allocate */
-
- colors[i] = gdk_color_context_get_pixel (cc, rd, gd, bd, &bad_alloc);
-
- /* store */
-
- if (!bad_alloc)
- {
- defs[i] = cmap[close];
- defs[i].pixel = colors[i];
- allocated[ncols++] = colors[i];
-#ifdef DEBUG
- close_col++;
-#endif
- }
- else
- failed[nopen++] = i;
- }
- else
- failed[nopen++] = i;
- /* deal with in next stage if allocation failed */
- }
- while (++idx < counter);
-
- *nallocated = ncols;
-
- if ((ncols == ncolors) || (nopen == 0))
- {
- GDK_NOTE (COLOR_CONTEXT,
- g_print ("gdk_color_context_get_pixels_incremental: "
- "got %i colors, %i exact and %i close "
- "(%i colors allocated so far)\n",
- ncolors, exact_col, close_col, cc->num_allocated));
-
- return;
- }
-
- /* map remaining unallocated pixels into colors we did get */
-
- idx = 0;
-
- do
- {
- gint d, mdist, close, ri, gi, bi;
- gint j, rd, gd, bd;
-
- i = failed[idx];
-
- mdist = 0x1000000;
- close = -1;
-
- ri = reds[i];
- gi = greens[i];
- bi = blues[i];
-
- /* search allocated colors */
-
- for (j = 0; (j < ncols) && (mdist != 0); j++)
- {
- k = allocated[j];
-
- /* downscale */
- /* Don't replace these by shifts; the sign may get clobbered */
-
- rd = (ri - defs[k].red) / 256;
- gd = (gi - defs[k].green) / 256;
- bd = (bi - defs[k].blue) / 256;
-
- d = rd * rd + gd * gd + bd * bd;
-
- if (d < mdist)
- {
- close = k;
- mdist = d;
- }
- }
-
- if (close < 0)
- {
- /* too bad, map to black */
-
- defs[i].pixel = cc->black_pixel;
- defs[i].red = defs[i].green = defs[i].blue = 0;
-#ifdef DEBUG
- black_col++;
-#endif
- }
- else
- {
- defs[i] = defs[close];
-#ifdef DEBUG
- subst_col++;
-#endif
- }
-
- colors[i] = defs[i].pixel;
- }
- while (++idx < nopen);
-
- GDK_NOTE (COLOR_CONTEXT,
- g_print ("gdk_color_context_get_pixels_incremental: "
- "got %i colors, %i exact, %i close, %i substituted, %i to black "
- "(%i colors allocated so far)\n",
- ncolors, exact_col, close_col, subst_col, black_col, cc->num_allocated));
-}
-
-gint
-gdk_color_context_query_color (GdkColorContext *cc,
- GdkColor *color)
-{
- return gdk_color_context_query_colors (cc, color, 1);
-}
-
-gint
-gdk_color_context_query_colors (GdkColorContext *cc,
- GdkColor *colors,
- gint num_colors)
-{
- gint i;
- GdkColor *tc;
-
- g_assert (cc != NULL);
- g_assert (colors != NULL);
-
- switch (cc->mode)
- {
- case GDK_CC_MODE_BW:
- for (i = 0, tc = colors; i < num_colors; i++, tc++)
- {
- if (tc->pixel == cc->white_pixel)
- tc->red = tc->green = tc->blue = 65535;
- else
- tc->red = tc->green = tc->blue = 0;
- }
- break;
-
- case GDK_CC_MODE_TRUE:
- if (cc->clut == NULL)
- for (i = 0, tc = colors; i < num_colors; i++, tc++)
- {
- tc->red = ((tc->pixel & cc->masks.red) >> cc->shifts.red) << (16 - cc->bits.red);
- tc->green = ((tc->pixel & cc->masks.green) >> cc->shifts.green) << (16 - cc->bits.green);
- tc->blue = ((tc->pixel & cc->masks.blue) >> cc->shifts.blue) << (16 - cc->bits.blue);
- }
- else
- {
- my_x_query_colors (cc->colormap, colors, num_colors);
- return 1;
- }
- break;
-
- case GDK_CC_MODE_STD_CMAP:
- default:
- if (cc->cmap == NULL)
- {
- my_x_query_colors (cc->colormap, colors, num_colors);
- return 1;
- }
- else
- {
- gint first, last, half;
- gulong half_pixel;
-
- for (i = 0, tc = colors; i < num_colors; i++)
- {
- first = 0;
- last = cc->num_colors - 1;
-
- while (first <= last)
- {
- half = (first + last) / 2;
- half_pixel = cc->cmap[half].pixel;
-
- if (tc->pixel == half_pixel)
- {
- tc->red = cc->cmap[half].red;
- tc->green = cc->cmap[half].green;
- tc->blue = cc->cmap[half].blue;
- first = last + 1; /* false break */
- }
- else
- {
- if (tc->pixel > half_pixel)
- first = half + 1;
- else
- last = half - 1;
- }
- }
- }
- return 1;
- }
- break;
- }
- return 1;
-}
-
-gint
-gdk_color_context_add_palette (GdkColorContext *cc,
- GdkColor *palette,
- gint num_palette)
-{
- gint i, j, erg;
- gushort r, g, b;
- gulong pixel[1];
-
- g_assert (cc != NULL);
-
- /* initialize this palette (will also erase previous palette as well) */
-
- init_palette (cc);
-
- /* restore previous mode if we aren't adding a new palette */
-
- if (num_palette == 0)
- {
- /* GDK_CC_MODE_STD_CMAP uses a hash table, so we'd better initialize one */
-
- /* XXX: here, the hash table is already initialized */
-
- return 0;
- }
-
- /* Initialize a hash table for this palette (we need one for allocating
- * the pixels in the palette using the current settings)
- */
-
- if (cc->color_hash == NULL)
- cc->color_hash = g_hash_table_new (hash_color, compare_colors);
-
- /* copy incoming palette */
-
- cc->palette = g_new0(GdkColor, num_palette);
-
- j = 0;
-
- for (i = 0; i < num_palette; i++)
- {
- erg = 0;
- pixel[0] = 0;
-
- /* try to allocate this color */
-
- r = palette[i].red;
- g = palette[i].green;
- b = palette[i].blue;
-
- gdk_color_context_get_pixels (cc, &r, &g, &b, 1, pixel, &erg);
-
- /* only store if we succeed */
-
- if (erg)
- {
- /* store in palette */
-
- cc->palette[j].red = r;
- cc->palette[j].green = g;
- cc->palette[j].blue = b;
- cc->palette[j].pixel = pixel[0];
-
- /* move to next slot */
-
- j++;
- }
- }
-
- /* resize to fit */
-
- if (j != num_palette)
- cc->palette = g_realloc (cc->palette, j * sizeof (GdkColor));
-
- /* clear the hash table, we don't use it when dithering */
-
- if (cc->color_hash)
- {
- g_hash_table_destroy (cc->color_hash);
- cc->color_hash = NULL;
- }
-
- /* store real palette size */
-
- cc->num_palette = j;
-
- /* switch to palette mode */
-
- cc->mode = GDK_CC_MODE_PALETTE;
-
- /* sort palette */
-
- qsort (cc->palette, cc->num_palette, sizeof (GdkColor), pixel_sort);
-
- cc->fast_dither = NULL;
-
- return j;
-}
-
-void
-gdk_color_context_init_dither (GdkColorContext *cc)
-{
- gint rr, gg, bb, err, erg, erb;
- gint success = FALSE;
-
- g_assert (cc != NULL);
-
- /* now we can initialize the fast dither matrix */
-
- if (cc->fast_dither == NULL)
- cc->fast_dither = g_new (GdkColorContextDither, 1);
-
- /* Fill it. We ignore unsuccessful allocations, they are just mapped
- * to black instead */
-
- for (rr = 0; rr < 32; rr++)
- for (gg = 0; gg < 32; gg++)
- for (bb = 0; bb < 32; bb++)
- {
- err = (rr << 3) | (rr >> 2);
- erg = (gg << 3) | (gg >> 2);
- erb = (bb << 3) | (bb >> 2);
-
- cc->fast_dither->fast_rgb[rr][gg][bb] =
- gdk_color_context_get_index_from_palette (cc, &err, &erg, &erb, &success);
- cc->fast_dither->fast_err[rr][gg][bb] = err;
- cc->fast_dither->fast_erg[rr][gg][bb] = erg;
- cc->fast_dither->fast_erb[rr][gg][bb] = erb;
- }
-}
-
-void
-gdk_color_context_free_dither (GdkColorContext *cc)
-{
- g_assert (cc != NULL);
-
- if (cc->fast_dither)
- g_free (cc->fast_dither);
-
- cc->fast_dither = NULL;
-}
-
-gulong
-gdk_color_context_get_pixel_from_palette (GdkColorContext *cc,
- gushort *red,
- gushort *green,
- gushort *blue,
- gint *failed)
-{
- gulong pixel = 0;
- gint dif, dr, dg, db, j = -1;
- gint mindif = 0x7fffffff;
- gint err = 0, erg = 0, erb = 0;
- gint i;
-
- g_assert (cc != NULL);
- g_assert (red != NULL);
- g_assert (green != NULL);
- g_assert (blue != NULL);
- g_assert (failed != NULL);
-
- *failed = FALSE;
-
- for (i = 0; i < cc->num_palette; i++)
- {
- dr = *red - cc->palette[i].red;
- dg = *green - cc->palette[i].green;
- db = *blue - cc->palette[i].blue;
-
- dif = dr * dr + dg * dg + db * db;
-
- if (dif < mindif)
- {
- mindif = dif;
- j = i;
- pixel = cc->palette[i].pixel;
- err = dr;
- erg = dg;
- erb = db;
-
- if (mindif == 0)
- break;
- }
- }
-
- /* we failed to map onto a color */
-
- if (j == -1)
- *failed = TRUE;
- else
- {
- *red = ABS (err);
- *green = ABS (erg);
- *blue = ABS (erb);
- }
-
- return pixel;
-}
-
-guchar
-gdk_color_context_get_index_from_palette (GdkColorContext *cc,
- gint *red,
- gint *green,
- gint *blue,
- gint *failed)
-{
- gint dif, dr, dg, db, j = -1;
- gint mindif = 0x7fffffff;
- gint err = 0, erg = 0, erb = 0;
- gint i;
-
- g_assert (cc != NULL);
- g_assert (red != NULL);
- g_assert (green != NULL);
- g_assert (blue != NULL);
- g_assert (failed != NULL);
-
- *failed = FALSE;
-
- for (i = 0; i < cc->num_palette; i++)
- {
- dr = *red - cc->palette[i].red;
- dg = *green - cc->palette[i].green;
- db = *blue - cc->palette[i].blue;
-
- dif = dr * dr + dg * dg + db * db;
-
- if (dif < mindif)
- {
- mindif = dif;
- j = i;
- err = dr;
- erg = dg;
- erb = db;
-
- if (mindif == 0)
- break;
- }
- }
-
- /* we failed to map onto a color */
-
- if (j == -1)
- {
- *failed = TRUE;
- j = 0;
- }
- else
- {
- /* return error fractions */
-
- *red = err;
- *green = erg;
- *blue = erb;
- }
-
- return j;
-}
diff --git a/gdk/x11/gdkcolor-x11.c b/gdk/x11/gdkcolor-x11.c
deleted file mode 100644
index 7bc4369577..0000000000
--- a/gdk/x11/gdkcolor-x11.c
+++ /dev/null
@@ -1,718 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <X11/Xlib.h>
-#include "gdk.h"
-#include "gdkprivate.h"
-
-
-static gint gdk_colormap_match_color (GdkColormap *cmap,
- GdkColor *color,
- const gchar *available);
-static void gdk_colormap_add (GdkColormap *cmap);
-static void gdk_colormap_remove (GdkColormap *cmap);
-static guint gdk_colormap_hash (Colormap *cmap);
-static gint gdk_colormap_cmp (Colormap *a,
- Colormap *b);
-static void gdk_colormap_real_destroy (GdkColormap *colormap);
-
-static GHashTable *colormap_hash = NULL;
-
-
-GdkColormap*
-gdk_colormap_new (GdkVisual *visual,
- gint private_cmap)
-{
- GdkColormap *colormap;
- GdkColormapPrivate *private;
- Visual *xvisual;
- XColor default_colors[256];
- int size;
- int i;
-
- g_return_val_if_fail (visual != NULL, NULL);
-
- private = g_new (GdkColormapPrivate, 1);
- colormap = (GdkColormap*) private;
-
- private->xdisplay = gdk_display;
- private->visual = visual;
- private->next_color = 0;
- private->ref_count = 1;
- xvisual = ((GdkVisualPrivate*) visual)->xvisual;
-
- switch (visual->type)
- {
- case GDK_VISUAL_GRAYSCALE:
- case GDK_VISUAL_PSEUDO_COLOR:
- private->private_val = private_cmap;
- private->xcolormap = XCreateColormap (private->xdisplay, gdk_root_window,
- xvisual, (private_cmap) ? (AllocAll) : (AllocNone));
-
- if (private_cmap)
- {
- for (i = 0; i < 256; i++)
- default_colors[i].pixel = i;
-
- XQueryColors (private->xdisplay,
- DefaultColormap (private->xdisplay, gdk_screen),
- default_colors, visual->colormap_size);
-
- for (i = 0; i < visual->colormap_size; i++)
- {
- colormap->colors[i].pixel = default_colors[i].pixel;
- colormap->colors[i].red = default_colors[i].red;
- colormap->colors[i].green = default_colors[i].green;
- colormap->colors[i].blue = default_colors[i].blue;
- }
-
- gdk_colormap_change (colormap, visual->colormap_size);
- }
- break;
-
- case GDK_VISUAL_DIRECT_COLOR:
- private->private_val = TRUE;
- private->xcolormap = XCreateColormap (private->xdisplay, gdk_root_window,
- xvisual, AllocAll);
-
- size = 1 << visual->red_prec;
- for (i = 0; i < size; i++)
- colormap->colors[i].red = i * 65535 / (size - 1);
-
- size = 1 << visual->green_prec;
- for (i = 0; i < size; i++)
- colormap->colors[i].green = i * 65535 / (size - 1);
-
- size = 1 << visual->blue_prec;
- for (i = 0; i < size; i++)
- colormap->colors[i].blue = i * 65535 / (size - 1);
-
- gdk_colormap_change (colormap, visual->colormap_size);
- break;
-
- case GDK_VISUAL_STATIC_GRAY:
- case GDK_VISUAL_STATIC_COLOR:
- case GDK_VISUAL_TRUE_COLOR:
- private->private_val = FALSE;
- private->xcolormap = XCreateColormap (private->xdisplay, gdk_root_window,
- xvisual, AllocNone);
- break;
- }
-
- gdk_colormap_add (colormap);
-
- return colormap;
-}
-
-static void
-gdk_colormap_real_destroy (GdkColormap *colormap)
-{
- GdkColormapPrivate *private = (GdkColormapPrivate*) colormap;
-
- g_return_if_fail (colormap != NULL);
-
- if (private->ref_count > 0)
- return;
-
- gdk_colormap_remove (colormap);
- XFreeColormap (private->xdisplay, private->xcolormap);
- g_free (colormap);
-}
-
-GdkColormap*
-gdk_colormap_ref (GdkColormap *cmap)
-{
- GdkColormapPrivate *private = (GdkColormapPrivate *)cmap;
- g_return_val_if_fail (cmap != NULL, NULL);
-
- private->ref_count += 1;
- return cmap;
-}
-
-void
-gdk_colormap_unref (GdkColormap *cmap)
-{
- GdkColormapPrivate *private = (GdkColormapPrivate *)cmap;
- g_return_if_fail (cmap != NULL);
-
- private->ref_count -= 1;
- if (private->ref_count == 0)
- gdk_colormap_real_destroy (cmap);
-}
-
-GdkColormap*
-gdk_colormap_get_system (void)
-{
- static GdkColormap *colormap = NULL;
- GdkColormapPrivate *private;
- XColor xpalette[256];
- gint i;
-
- if (!colormap)
- {
- private = g_new (GdkColormapPrivate, 1);
- colormap = (GdkColormap*) private;
-
- private->xdisplay = gdk_display;
- private->xcolormap = DefaultColormap (gdk_display, gdk_screen);
- private->visual = gdk_visual_get_system ();
- private->private_val = FALSE;
- private->next_color = 0;
- private->ref_count = 1;
-
- if ((private->visual->type == GDK_VISUAL_GRAYSCALE) ||
- (private->visual->type == GDK_VISUAL_PSEUDO_COLOR))
- {
- for (i = 0; i < 256; i++)
- {
- xpalette[i].pixel = i;
- xpalette[i].red = 0;
- xpalette[i].green = 0;
- xpalette[i].blue = 0;
- }
-
- XQueryColors (gdk_display, private->xcolormap, xpalette,
- MIN (private->visual->colormap_size, 256));
-
- for (i = 0; i < 256; i++)
- {
- colormap->colors[i].pixel = xpalette[i].pixel;
- colormap->colors[i].red = xpalette[i].red;
- colormap->colors[i].green = xpalette[i].green;
- colormap->colors[i].blue = xpalette[i].blue;
- }
- }
-
- gdk_colormap_add (colormap);
- }
-
- return colormap;
-}
-
-gint
-gdk_colormap_get_system_size (void)
-{
- return DisplayCells (gdk_display, gdk_screen);
-}
-
-void
-gdk_colormap_change (GdkColormap *colormap,
- gint ncolors)
-{
- GdkColormapPrivate *private;
- GdkVisual *visual;
- XColor palette[256];
- gint shift;
- int max_colors;
- int size;
- int i;
-
- g_return_if_fail (colormap != NULL);
-
- private = (GdkColormapPrivate*) colormap;
- switch (private->visual->type)
- {
- case GDK_VISUAL_GRAYSCALE:
- case GDK_VISUAL_PSEUDO_COLOR:
- for (i = 0; i < ncolors; i++)
- {
- palette[i].pixel = colormap->colors[i].pixel;
- palette[i].red = colormap->colors[i].red;
- palette[i].green = colormap->colors[i].green;
- palette[i].blue = colormap->colors[i].blue;
- palette[i].flags = DoRed | DoGreen | DoBlue;
- }
-
- XStoreColors (private->xdisplay, private->xcolormap, palette, ncolors);
- private->next_color = MAX (private->next_color, ncolors);
- break;
-
- case GDK_VISUAL_DIRECT_COLOR:
- visual = private->visual;
-
- shift = visual->red_shift;
- max_colors = 1 << visual->red_prec;
- size = (ncolors < max_colors) ? (ncolors) : (max_colors);
-
- for (i = 0; i < size; i++)
- {
- palette[i].pixel = i << shift;
- palette[i].red = colormap->colors[i].red;
- palette[i].flags = DoRed;
- }
-
- XStoreColors (private->xdisplay, private->xcolormap, palette, size);
-
- shift = visual->green_shift;
- max_colors = 1 << visual->green_prec;
- size = (ncolors < max_colors) ? (ncolors) : (max_colors);
-
- for (i = 0; i < size; i++)
- {
- palette[i].pixel = i << shift;
- palette[i].green = colormap->colors[i].green;
- palette[i].flags = DoGreen;
- }
-
- XStoreColors (private->xdisplay, private->xcolormap, palette, size);
-
- shift = visual->blue_shift;
- max_colors = 1 << visual->blue_prec;
- size = (ncolors < max_colors) ? (ncolors) : (max_colors);
-
- for (i = 0; i < size; i++)
- {
- palette[i].pixel = i << shift;
- palette[i].blue = colormap->colors[i].blue;
- palette[i].flags = DoBlue;
- }
-
- XStoreColors (private->xdisplay, private->xcolormap, palette, size);
- break;
-
- default:
- break;
- }
-}
-
-void
-gdk_colors_store (GdkColormap *colormap,
- GdkColor *colors,
- gint ncolors)
-{
- gint i;
-
- for (i = 0; i < ncolors; i++)
- {
- colormap->colors[i].pixel = colors[i].pixel;
- colormap->colors[i].red = colors[i].red;
- colormap->colors[i].green = colors[i].green;
- colormap->colors[i].blue = colors[i].blue;
- }
-
- gdk_colormap_change (colormap, ncolors);
-}
-
-gint
-gdk_colors_alloc (GdkColormap *colormap,
- gint contiguous,
- gulong *planes,
- gint nplanes,
- gulong *pixels,
- gint npixels)
-{
- GdkColormapPrivate *private;
- gint return_val;
-
- g_return_val_if_fail (colormap != NULL, 0);
-
- private = (GdkColormapPrivate*) colormap;
-
- return_val = XAllocColorCells (private->xdisplay, private->xcolormap,
- contiguous, planes, nplanes, pixels, npixels);
-
- return return_val;
-}
-
-void
-gdk_colors_free (GdkColormap *colormap,
- gulong *pixels,
- gint npixels,
- gulong planes)
-{
- GdkColormapPrivate *private;
-
- g_return_if_fail (colormap != NULL);
-
- private = (GdkColormapPrivate*) colormap;
-
- XFreeColors (private->xdisplay, private->xcolormap,
- pixels, npixels, planes);
-}
-
-gint
-gdk_color_white (GdkColormap *colormap,
- GdkColor *color)
-{
- gint return_val;
-
- g_return_val_if_fail (colormap != NULL, FALSE);
-
- if (color)
- {
- color->pixel = WhitePixel (gdk_display, gdk_screen);
- color->red = 65535;
- color->green = 65535;
- color->blue = 65535;
-
- return_val = gdk_color_alloc (colormap, color);
- }
- else
- return_val = FALSE;
-
- return return_val;
-}
-
-gint
-gdk_color_black (GdkColormap *colormap,
- GdkColor *color)
-{
- gint return_val;
-
- g_return_val_if_fail (colormap != NULL, FALSE);
-
- if (color)
- {
- color->pixel = BlackPixel (gdk_display, gdk_screen);
- color->red = 0;
- color->green = 0;
- color->blue = 0;
-
- return_val = gdk_color_alloc (colormap, color);
- }
- else
- return_val = FALSE;
-
- return return_val;
-}
-
-gint
-gdk_color_parse (const gchar *spec,
- GdkColor *color)
-{
- Colormap xcolormap;
- XColor xcolor;
- gint return_val;
-
- g_return_val_if_fail (spec != NULL, FALSE);
- g_return_val_if_fail (color != NULL, FALSE);
-
- xcolormap = DefaultColormap (gdk_display, gdk_screen);
-
- if (XParseColor (gdk_display, xcolormap, spec, &xcolor))
- {
- return_val = TRUE;
- color->red = xcolor.red;
- color->green = xcolor.green;
- color->blue = xcolor.blue;
- }
- else
- return_val = FALSE;
-
- return return_val;
-}
-
-gint
-gdk_color_alloc (GdkColormap *colormap,
- GdkColor *color)
-{
- GdkColormapPrivate *private;
- GdkVisual *visual;
- XColor xcolor;
- gchar available[256];
- gint available_init;
- gint return_val;
- gint i, index;
-
- g_return_val_if_fail (colormap != NULL, FALSE);
- g_return_val_if_fail (color != NULL, FALSE);
-
- xcolor.red = color->red;
- xcolor.green = color->green;
- xcolor.blue = color->blue;
- xcolor.pixel = color->pixel;
- xcolor.flags = DoRed | DoGreen | DoBlue;
-
- return_val = FALSE;
- private = (GdkColormapPrivate*) colormap;
-
- switch (private->visual->type)
- {
- case GDK_VISUAL_GRAYSCALE:
- case GDK_VISUAL_PSEUDO_COLOR:
- if (private->private_val)
- {
- if (private->next_color > 255)
- {
- for (i = 0; i < 256; i++)
- available[i] = TRUE;
-
- index = gdk_colormap_match_color (colormap, color, available);
- if (index != -1)
- {
- available[index] = FALSE;
- *color = colormap->colors[index];
- return_val = TRUE;
- }
- else
- {
- return_val = FALSE;
- }
- }
- else
- {
- xcolor.pixel = 255 - private->next_color;
- color->pixel = xcolor.pixel;
- private->next_color += 1;
-
- XStoreColor (private->xdisplay, private->xcolormap, &xcolor);
- return_val = TRUE;
- }
- }
- else
- {
- available_init = 1;
-
- while (1)
- {
- if (XAllocColor (private->xdisplay, private->xcolormap, &xcolor))
- {
- color->pixel = xcolor.pixel;
- color->red = xcolor.red;
- color->green = xcolor.green;
- color->blue = xcolor.blue;
-
- colormap->colors[color->pixel] = *color;
-
- return_val = TRUE;
- break;
- }
- else
- {
- if (available_init)
- {
- available_init = 0;
- for (i = 0; i < 256; i++)
- available[i] = TRUE;
- }
-
- index = gdk_colormap_match_color (colormap, color, available);
- if (index != -1)
- {
- available[index] = FALSE;
- xcolor.red = colormap->colors[index].red;
- xcolor.green = colormap->colors[index].green;
- xcolor.blue = colormap->colors[index].blue;
- }
- else
- {
- return_val = FALSE;
- break;
- }
- }
- }
- }
- break;
-
- case GDK_VISUAL_DIRECT_COLOR:
- visual = private->visual;
- xcolor.pixel = (((xcolor.red >> (16 - visual->red_prec)) << visual->red_shift) +
- ((xcolor.green >> (16 - visual->green_prec)) << visual->green_shift) +
- ((xcolor.blue >> (16 - visual->blue_prec)) << visual->blue_shift));
- color->pixel = xcolor.pixel;
- return_val = TRUE;
- break;
-
- case GDK_VISUAL_STATIC_GRAY:
- case GDK_VISUAL_STATIC_COLOR:
- case GDK_VISUAL_TRUE_COLOR:
- if (XAllocColor (private->xdisplay, private->xcolormap, &xcolor))
- {
- color->pixel = xcolor.pixel;
- return_val = TRUE;
- }
- else
- return_val = FALSE;
- break;
- }
-
- return return_val;
-}
-
-gint
-gdk_color_change (GdkColormap *colormap,
- GdkColor *color)
-{
- GdkColormapPrivate *private;
- XColor xcolor;
-
- g_return_val_if_fail (colormap != NULL, FALSE);
- g_return_val_if_fail (color != NULL, FALSE);
-
- xcolor.pixel = color->pixel;
- xcolor.red = color->red;
- xcolor.green = color->green;
- xcolor.blue = color->blue;
- xcolor.flags = DoRed | DoGreen | DoBlue;
-
- private = (GdkColormapPrivate*) colormap;
- XStoreColor (private->xdisplay, private->xcolormap, &xcolor);
-
- return TRUE;
-}
-
-gint
-gdk_color_equal (GdkColor *colora,
- GdkColor *colorb)
-{
- g_return_val_if_fail (colora != NULL, FALSE);
- g_return_val_if_fail (colorb != NULL, FALSE);
-
- return ((colora->red == colorb->red) &&
- (colora->green == colorb->green) &&
- (colora->blue == colorb->blue));
-}
-
-GdkColormap*
-gdkx_colormap_get (Colormap xcolormap)
-{
- GdkColormap *colormap;
- GdkColormapPrivate *private;
- XColor xpalette[256];
- gint i;
-
- colormap = gdk_colormap_lookup (xcolormap);
- if (colormap)
- return colormap;
-
- if (xcolormap == DefaultColormap (gdk_display, gdk_screen))
- return gdk_colormap_get_system ();
-
- private = g_new (GdkColormapPrivate, 1);
- colormap = (GdkColormap*) private;
-
- private->xdisplay = gdk_display;
- private->xcolormap = xcolormap;
- private->visual = NULL;
- private->private_val = TRUE;
- private->next_color = 0;
-
- for (i = 0; i < 256; i++)
- {
- xpalette[i].pixel = i;
- xpalette[i].red = 0;
- xpalette[i].green = 0;
- xpalette[i].blue = 0;
- }
-
- XQueryColors (gdk_display, private->xcolormap, xpalette, 256);
-
- for (i = 0; i < 256; i++)
- {
- colormap->colors[i].pixel = xpalette[i].pixel;
- colormap->colors[i].red = xpalette[i].red;
- colormap->colors[i].green = xpalette[i].green;
- colormap->colors[i].blue = xpalette[i].blue;
- }
-
- gdk_colormap_add (colormap);
-
- return colormap;
-}
-
-
-static gint
-gdk_colormap_match_color (GdkColormap *cmap,
- GdkColor *color,
- const gchar *available)
-{
- GdkColor *colors;
- guint sum, max;
- gint rdiff, gdiff, bdiff;
- gint i, index;
-
- g_return_val_if_fail (cmap != NULL, 0);
- g_return_val_if_fail (color != NULL, 0);
-
- colors = cmap->colors;
- max = 3 * (65536);
- index = -1;
-
- for (i = 0; i < 256; i++)
- {
- if ((!available) || (available && available[i]))
- {
- rdiff = (color->red - colors[i].red);
- gdiff = (color->green - colors[i].green);
- bdiff = (color->blue - colors[i].blue);
-
- sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
-
- if (sum < max)
- {
- index = i;
- max = sum;
- }
- }
- }
-
- return index;
-}
-
-
-GdkColormap*
-gdk_colormap_lookup (Colormap xcolormap)
-{
- GdkColormap *cmap;
-
- if (!colormap_hash)
- return NULL;
-
- cmap = g_hash_table_lookup (colormap_hash, &xcolormap);
- return cmap;
-}
-
-static void
-gdk_colormap_add (GdkColormap *cmap)
-{
- GdkColormapPrivate *private;
-
- if (!colormap_hash)
- colormap_hash = g_hash_table_new ((GHashFunc) gdk_colormap_hash,
- (GCompareFunc) gdk_colormap_cmp);
-
- private = (GdkColormapPrivate*) cmap;
-
- g_hash_table_insert (colormap_hash, &private->xcolormap, cmap);
-}
-
-static void
-gdk_colormap_remove (GdkColormap *cmap)
-{
- GdkColormapPrivate *private;
-
- if (!colormap_hash)
- colormap_hash = g_hash_table_new ((GHashFunc) gdk_colormap_hash,
- (GCompareFunc) gdk_colormap_cmp);
-
- private = (GdkColormapPrivate*) cmap;
-
- g_hash_table_remove (colormap_hash, &private->xcolormap);
-}
-
-static guint
-gdk_colormap_hash (Colormap *cmap)
-{
- return *cmap;
-}
-
-static gint
-gdk_colormap_cmp (Colormap *a,
- Colormap *b)
-{
- return (*a == *b);
-}
diff --git a/gdk/x11/gdkcursor-x11.c b/gdk/x11/gdkcursor-x11.c
deleted file mode 100644
index 83b95aa6c7..0000000000
--- a/gdk/x11/gdkcursor-x11.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <X11/Xlib.h>
-#include <X11/cursorfont.h>
-#include "gdk.h"
-#include "gdkprivate.h"
-
-
-GdkCursor*
-gdk_cursor_new (GdkCursorType cursor_type)
-{
- GdkCursorPrivate *private;
- GdkCursor *cursor;
- Cursor xcursor;
-
- xcursor = XCreateFontCursor (gdk_display, cursor_type);
- private = g_new (GdkCursorPrivate, 1);
- private->xdisplay = gdk_display;
- private->xcursor = xcursor;
- cursor = (GdkCursor*) private;
- cursor->type = cursor_type;
-
- return cursor;
-}
-
-GdkCursor*
-gdk_cursor_new_from_pixmap (GdkPixmap *source, GdkPixmap *mask, GdkColor *fg, GdkColor *bg, gint x, gint y)
-{
- GdkCursorPrivate *private;
- GdkCursor *cursor;
- Pixmap source_pixmap, mask_pixmap;
- Cursor xcursor;
- XColor xfg, xbg;
-
- source_pixmap = ((GdkPixmapPrivate *) source)->xwindow;
- mask_pixmap = ((GdkPixmapPrivate *) mask)->xwindow;
-
- xfg.pixel = fg->pixel;
- xfg.red = fg->red;
- xfg.blue = fg->blue;
- xfg.green = fg->green;
- xbg.pixel = bg->pixel;
- xbg.red = bg->red;
- xbg.blue = bg->blue;
- xbg.green = bg->green;
-
- xcursor = XCreatePixmapCursor (gdk_display, source_pixmap, mask_pixmap, &xfg, &xbg, x, y);
- private = g_new (GdkCursorPrivate, 1);
- private->xdisplay = gdk_display;
- private->xcursor = xcursor;
- cursor = (GdkCursor *) private;
- cursor->type = GDK_CURSOR_IS_PIXMAP;
-
- return cursor;
-}
-
-void
-gdk_cursor_destroy (GdkCursor *cursor)
-{
- GdkCursorPrivate *private;
-
- g_return_if_fail (cursor != NULL);
-
- private = (GdkCursorPrivate *) cursor;
- XFreeCursor (private->xdisplay, private->xcursor);
-
- g_free (private);
-}
diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c
deleted file mode 100644
index 28900bbf5d..0000000000
--- a/gdk/x11/gdkdnd-x11.c
+++ /dev/null
@@ -1,139 +0,0 @@
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <string.h>
-#include "gdkx.h"
-#include "gdk.h"
-
-/* Nothing much here now, but we have to make a start some time ;-) */
-
-void
-gdk_dnd_set_drag_cursors(GdkCursor *default_cursor, GdkCursor *goahead_cursor)
-{
- gdk_dnd.c->gdk_cursor_dragdefault =
- ((GdkCursorPrivate *)default_cursor)->xcursor;
- gdk_dnd.c->gdk_cursor_dragok = ((GdkCursorPrivate *)goahead_cursor)->xcursor;
-
- if(gdk_dnd.dnd_grabbed)
- {
- if(gdk_dnd.c->drag_pm_default)
- /* We were displaying pixmaps for the drag */
- {
- gdk_window_hide(gdk_dnd.c->drag_pm_default);
- gdk_window_unref(gdk_dnd.c->drag_pm_default);
- if(gdk_dnd.c->drag_pm_ok)
- {
- gdk_window_hide(gdk_dnd.c->drag_pm_ok);
- gdk_window_unref(gdk_dnd.c->drag_pm_ok);
- }
- gdk_dnd.c->drag_pm_default = gdk_dnd.c->drag_pm_ok = NULL;
- }
- gdk_dnd_display_drag_cursor(-1, -1,
- gdk_dnd.dnd_drag_target?TRUE:FALSE,
- TRUE);
- }
-}
-
-void
-gdk_dnd_set_drag_shape(GdkWindow *default_pixmapwin,
- GdkPoint *default_hotspot,
- GdkWindow *goahead_pixmapwin,
- GdkPoint *goahead_hotspot)
-{
- g_return_if_fail(default_pixmapwin != NULL);
-
- if(gdk_dnd.c->drag_pm_default)
- gdk_window_unref(gdk_dnd.c->drag_pm_default);
- if(gdk_dnd.c->drag_pm_ok)
- gdk_window_unref(gdk_dnd.c->drag_pm_ok);
-
- gdk_dnd.c->drag_pm_ok = NULL;
-
- gdk_window_ref(default_pixmapwin);
- gdk_dnd.c->drag_pm_default = default_pixmapwin;
- gdk_dnd.c->default_hotspot = *default_hotspot;
- if(goahead_pixmapwin)
- {
- gdk_window_ref(goahead_pixmapwin);
- gdk_dnd.c->drag_pm_ok = goahead_pixmapwin;
- gdk_dnd.c->ok_hotspot = *goahead_hotspot;
- }
-
- if(gdk_dnd.dnd_grabbed)
- {
- gdk_dnd_display_drag_cursor(-1, -1,
- gdk_dnd.dnd_drag_target?TRUE:FALSE,
- TRUE);
- XChangeActivePointerGrab (gdk_display,
- ButtonMotionMask |
- ButtonPressMask |
- ButtonReleaseMask |
- EnterWindowMask | LeaveWindowMask,
- None,
- CurrentTime);
- }
-}
-
-void
-gdk_dnd_display_drag_cursor(gint x, gint y, gboolean drag_ok,
- gboolean change_made)
-{
- if(!gdk_dnd.dnd_grabbed)
- return;
-
- if(gdk_dnd.c->drag_pm_default)
- {
- /* We're doing pixmaps here... */
- GdkWindow *mypix, *opix;
- GdkPoint *myhotspot;
- gint itmp;
- guint masktmp;
- Window wtmp;
-
- if(x == -2 && y == -2) /* Hide the cursors */
- {
- gdk_window_hide(gdk_dnd.c->drag_pm_ok);
- gdk_window_hide(gdk_dnd.c->drag_pm_default);
- return;
- }
-
- if(x == -1 && y == -1) /* We're supposed to find it out for ourselves */
- XQueryPointer(gdk_display, gdk_root_window,
- &wtmp, &wtmp, &x, &y, &itmp, &itmp, &masktmp);
-
- if(drag_ok)
- {
- mypix = gdk_dnd.c->drag_pm_ok;
- opix = gdk_dnd.c->drag_pm_default;
- myhotspot = &gdk_dnd.c->ok_hotspot;
- }
- else
- {
- mypix = gdk_dnd.c->drag_pm_default;
- opix = gdk_dnd.c->drag_pm_ok;
- myhotspot = &gdk_dnd.c->default_hotspot;
- }
- if(change_made)
- {
- gdk_window_hide(opix);
- gdk_window_show(mypix); /* There ought to be a way to know if
- a window is already mapped etc. */
- }
- gdk_window_move(mypix, x - myhotspot->x, y - myhotspot->y);
- }
- else if(change_made)
- {
- Cursor c;
- /* Move cursors around */
- if(drag_ok)
- c = gdk_dnd.c->gdk_cursor_dragok;
- else
- c = gdk_dnd.c->gdk_cursor_dragdefault;
- XChangeActivePointerGrab (gdk_display,
- ButtonMotionMask |
- ButtonPressMask |
- ButtonReleaseMask |
- EnterWindowMask | LeaveWindowMask,
- c,
- CurrentTime);
- }
-}
diff --git a/gdk/x11/gdkfont-x11.c b/gdk/x11/gdkfont-x11.c
deleted file mode 100644
index 41299dc5eb..0000000000
--- a/gdk/x11/gdkfont-x11.c
+++ /dev/null
@@ -1,374 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <X11/Xlib.h>
-#include <X11/Xos.h>
-#include "gdk.h"
-#include "gdkprivate.h"
-
-GdkFont*
-gdk_font_load (const gchar *font_name)
-{
- GdkFont *font;
- GdkFontPrivate *private;
-
- private = g_new (GdkFontPrivate, 1);
- font = (GdkFont*) private;
-
- private->xdisplay = gdk_display;
- private->xfont = XLoadQueryFont (private->xdisplay, font_name);
- private->ref_count = 1;
-
- if (!private->xfont)
- {
- g_free (font);
- return NULL;
- }
- else
- {
- font->type = GDK_FONT_FONT;
- font->ascent = ((XFontStruct *) private->xfont)->ascent;
- font->descent = ((XFontStruct *) private->xfont)->descent;
- }
-
- gdk_xid_table_insert (&((XFontStruct *) private->xfont)->fid, font);
-
- return font;
-}
-
-GdkFont*
-gdk_fontset_load (gchar *fontset_name)
-{
- GdkFont *font;
- GdkFontPrivate *private;
- XFontSet fontset;
- gint missing_charset_count;
- gchar **missing_charset_list;
- gchar *def_string;
-
- private = g_new (GdkFontPrivate, 1);
- font = (GdkFont*) private;
-
- private->xdisplay = gdk_display;
- fontset = XCreateFontSet (gdk_display, fontset_name,
- &missing_charset_list, &missing_charset_count,
- &def_string);
-
- if (missing_charset_count)
- {
- g_print ("Missing charsets in FontSet creation");
- XFreeStringList (missing_charset_list);
- }
-
- private->ref_count = 1;
-
- if (!fontset)
- {
- g_free (font);
- return NULL;
- }
- else
- {
- XFontSetExtents *extent = XExtentsOfFontSet(fontset);
-
- private->xfont = fontset;
- font->type = GDK_FONT_FONTSET;
- /* how to define ascent and descent for fontset ??? */
- font->ascent = extent->max_logical_extent.height;
- font->descent = font->ascent / 4 ;
- }
- return font;
-}
-
-GdkFont*
-gdk_font_ref (GdkFont *font)
-{
- GdkFontPrivate *private;
-
- g_return_val_if_fail (font != NULL, NULL);
-
- private = (GdkFontPrivate*) font;
- private->ref_count += 1;
- return font;
-}
-
-void
-gdk_font_unref (GdkFont *font)
-{
- GdkFontPrivate *private;
-
- g_return_if_fail (font != NULL);
-
- private = (GdkFontPrivate*) font;
-
- private->ref_count -= 1;
- if (private->ref_count == 0)
- {
- switch (font->type)
- {
- case GDK_FONT_FONT:
- gdk_xid_table_remove (((XFontStruct *) private->xfont)->fid);
- XFreeFont (private->xdisplay, (XFontStruct *) private->xfont);
- break;
- case GDK_FONT_FONTSET:
- XFreeFontSet (private->xdisplay, (XFontSet) private->xfont);
- break;
- default:
- g_error ("unknown font type.");
- break;
- }
- g_free (font);
- }
-}
-
-gint
-gdk_font_id (GdkFont *font)
-{
- GdkFontPrivate *font_private;
-
- g_return_val_if_fail (font != NULL, 0);
-
- font_private = (GdkFontPrivate*) font;
-
- if (font->type == GDK_FONT_FONT)
- {
- return ((XFontStruct *) font_private->xfont)->fid;
- }
- else
- {
- return 0;
- }
-}
-
-gint
-gdk_font_equal (GdkFont *fonta,
- GdkFont *fontb)
-{
- GdkFontPrivate *privatea;
- GdkFontPrivate *privateb;
-
- g_return_val_if_fail (fonta != NULL, FALSE);
- g_return_val_if_fail (fontb != NULL, FALSE);
-
- privatea = (GdkFontPrivate*) fonta;
- privateb = (GdkFontPrivate*) fontb;
-
- if (fonta->type == GDK_FONT_FONT && fontb->type == GDK_FONT_FONT)
- {
- return (((XFontStruct *) privatea->xfont)->fid ==
- ((XFontStruct *) privateb->xfont)->fid);
- }
- else if (fonta->type == GDK_FONT_FONTSET && fontb->type == GDK_FONT_FONTSET)
- {
- /* how to compare two fontsets ?? by basename or XFontSet ?? */
- return (((XFontSet) privatea->xfont) == ((XFontSet) privateb->xfont));
- }
- else
- /* fontset != font */
- return 0;
-}
-
-gint
-gdk_string_width (GdkFont *font,
- const gchar *string)
-{
- GdkFontPrivate *font_private;
- gint width;
- XFontStruct *xfont;
- XFontSet fontset;
-
- g_return_val_if_fail (font != NULL, -1);
- g_return_val_if_fail (string != NULL, -1);
-
- font_private = (GdkFontPrivate*) font;
-
- switch (font->type)
- {
- case GDK_FONT_FONT:
- xfont = (XFontStruct *) font_private->xfont;
- if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))
- {
- width = XTextWidth (xfont, string, strlen (string));
- }
- else
- {
- width = XTextWidth16 (xfont, (XChar2b *) string, strlen (string) / 2);
- }
- break;
- case GDK_FONT_FONTSET:
- fontset = (XFontSet) font_private->xfont;
- width = XmbTextEscapement (fontset, string, strlen(string));
- break;
- default:
- width = 0;
- }
-
- return width;
-}
-
-gint
-gdk_text_width (GdkFont *font,
- const gchar *text,
- gint text_length)
-{
- GdkFontPrivate *private;
- gint width;
- XFontStruct *xfont;
- XFontSet fontset;
-
- g_return_val_if_fail (font != NULL, -1);
- g_return_val_if_fail (text != NULL, -1);
-
- private = (GdkFontPrivate*) font;
-
- switch (font->type)
- {
- case GDK_FONT_FONT:
- xfont = (XFontStruct *) private->xfont;
- if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))
- {
- width = XTextWidth (xfont, text, text_length);
- }
- else
- {
- width = XTextWidth16 (xfont, (XChar2b *) text, text_length / 2);
- }
- break;
- case GDK_FONT_FONTSET:
- fontset = (XFontSet) private->xfont;
- width = XmbTextEscapement (fontset, text, text_length);
- break;
- default:
- width = 0;
- }
- return width;
-}
-
-/* Problem: What if a character is a 16 bits character ?? */
-gint
-gdk_char_width (GdkFont *font,
- gchar character)
-{
- GdkFontPrivate *private;
- XCharStruct *chars;
- gint width;
- guint ch = character & 0xff; /* get rid of sign-extension */
- XFontStruct *xfont;
- XFontSet fontset;
-
- g_return_val_if_fail (font != NULL, -1);
-
- private = (GdkFontPrivate*) font;
-
- switch (font->type)
- {
- case GDK_FONT_FONT:
- /* only 8 bits characters are considered here */
- xfont = (XFontStruct *) private->xfont;
- if ((xfont->min_byte1 == 0) &&
- (xfont->max_byte1 == 0) &&
- (ch >= xfont->min_char_or_byte2) &&
- (ch <= xfont->max_char_or_byte2))
- {
- chars = xfont->per_char;
- if (chars)
- width = chars[ch - xfont->min_char_or_byte2].width;
- else
- width = xfont->min_bounds.width;
- }
- else
- {
- width = XTextWidth (xfont, &character, 1);
- }
- break;
- case GDK_FONT_FONTSET:
- fontset = (XFontSet) private->xfont;
- width = XmbTextEscapement (fontset, &character, 1) ;
- break;
- default:
- width = 0;
- }
- return width;
-}
-
-gint
-gdk_string_measure (GdkFont *font,
- const gchar *string)
-{
- g_return_val_if_fail (font != NULL, -1);
- g_return_val_if_fail (string != NULL, -1);
-
- return gdk_text_measure (font, string, strlen (string));
-}
-
-gint
-gdk_text_measure (GdkFont *font,
- const gchar *text,
- gint text_length)
-{
- GdkFontPrivate *private;
- XCharStruct overall;
- XFontStruct *xfont;
- XFontSet fontset;
- XRectangle ink, log;
- int direction;
- int font_ascent;
- int font_descent;
- gint width;
-
- g_return_val_if_fail (font != NULL, -1);
- g_return_val_if_fail (text != NULL, -1);
-
- private = (GdkFontPrivate*) font;
-
- switch (font->type)
- {
- case GDK_FONT_FONT:
- xfont = (XFontStruct *) private->xfont;
- if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))
- {
- XTextExtents (xfont, text, text_length,
- &direction, &font_ascent, &font_descent,
- &overall);
- }
- else
- {
- XTextExtents16 (xfont, (XChar2b *) text, text_length / 2,
- &direction, &font_ascent, &font_descent,
- &overall);
- }
- width = overall.rbearing;
- break;
- case GDK_FONT_FONTSET:
- fontset = (XFontSet) private->xfont;
- XmbTextExtents (fontset, text, text_length, &ink, &log);
- width = log.width;
- break;
- default:
- width = 0;
- }
- return width;
-}
-
-gint
-gdk_char_measure (GdkFont *font,
- gchar character)
-{
- g_return_val_if_fail (font != NULL, -1);
-
- return gdk_text_measure (font, &character, 1);
-}
diff --git a/gdk/x11/gdkglobals-x11.c b/gdk/x11/gdkglobals-x11.c
deleted file mode 100644
index e6644bb600..0000000000
--- a/gdk/x11/gdkglobals-x11.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <stdio.h>
-#include <X11/Xlib.h>
-#include "gdktypes.h"
-#include "gdkprivate.h"
-
-guint gdk_debug_flags = 0;
-gint gdk_use_xshm = TRUE;
-gchar *gdk_display_name = NULL;
-Display *gdk_display = NULL;
-gint gdk_screen;
-Window gdk_root_window;
-Window gdk_leader_window;
-GdkWindowPrivate gdk_root_parent;
-Atom gdk_wm_delete_window;
-Atom gdk_wm_take_focus;
-Atom gdk_wm_protocols;
-Atom gdk_wm_window_protocols[2];
-Atom gdk_selection_property;
-GdkDndCursorInfo gdk_dnd_cursorinfo = {None, None, NULL, NULL,
- {0,0}, {0,0}};
-GdkDndGlobals gdk_dnd = {None,None,None,
- None,None,None,
- None,
- &gdk_dnd_cursorinfo,
- NULL,
- 0,
- FALSE, FALSE, FALSE,
- None,
- {0,0},
- {0,0}, {0,0},
- {0,0,0,0}, NULL, None, 0};
-gchar *gdk_progname = NULL;
-gchar *gdk_progclass = NULL;
-gint gdk_error_code;
-gint gdk_error_warnings = TRUE;
-gint gdk_null_window_warnings = TRUE;
-GList *gdk_default_filters = NULL;
diff --git a/gdk/x11/gdkimage-x11.c b/gdk/x11/gdkimage-x11.c
deleted file mode 100644
index 1a7273bc5a..0000000000
--- a/gdk/x11/gdkimage-x11.c
+++ /dev/null
@@ -1,495 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "../config.h"
-
-#include <sys/types.h>
-
-#if defined (HAVE_IPC_H) && defined (HAVE_SHM_H) && defined (HAVE_XSHM_H)
-#define USE_SHM
-#endif
-
-#ifdef USE_SHM
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#endif /* USE_SHM */
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-#ifdef USE_SHM
-#include <X11/extensions/XShm.h>
-#endif /* USE_SHM */
-
-#include "gdk.h"
-#include "gdkprivate.h"
-
-
-static void gdk_image_put_normal (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
-static void gdk_image_put_shared (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height);
-
-
-static GList *image_list = NULL;
-
-
-void
-gdk_image_exit ()
-{
- GdkImage *image;
-
- while (image_list)
- {
- image = image_list->data;
- gdk_image_destroy (image);
- }
-}
-
-GdkImage *
-gdk_image_new_bitmap(GdkVisual *visual, gpointer data, gint w, gint h)
-/*
- * Desc: create a new bitmap image
- */
-{
- Visual *xvisual;
- GdkImage *image;
- GdkImagePrivate *private;
- private = g_new(GdkImagePrivate, 1);
- image = (GdkImage *) private;
- private->xdisplay = gdk_display;
- private->image_put = gdk_image_put_normal;
- image->type = GDK_IMAGE_NORMAL;
- image->visual = visual;
- image->width = w;
- image->height = h;
- image->depth = 1;
- xvisual = ((GdkVisualPrivate*) visual)->xvisual;
- private->ximage = XCreateImage(private->xdisplay, xvisual, 1, XYBitmap,
- 0, 0, w ,h, 8, 0);
- private->ximage->data = data;
- private->ximage->bitmap_bit_order = MSBFirst;
- private->ximage->byte_order = MSBFirst;
- image->byte_order = MSBFirst;
- image->mem = private->ximage->data;
- image->bpl = private->ximage->bytes_per_line;
- image->bpp = 1;
- return(image);
-} /* gdk_image_new_bitmap() */
-
-static int
-gdk_image_check_xshm(Display *display)
-/*
- * Desc: query the server for support for the MIT_SHM extension
- * Return: 0 = not available
- * 1 = shared XImage support available
- * 2 = shared Pixmap support available also
- */
-{
-#ifdef USE_SHM
- int major, minor, ignore;
- Bool pixmaps;
-
- if (XQueryExtension(display, "MIT-SHM", &ignore, &ignore, &ignore))
- {
- if (XShmQueryVersion(display, &major, &minor, &pixmaps )==True)
- {
- return (pixmaps==True) ? 2 : 1;
- }
- }
-#endif /* USE_SHM */
- return 0;
-}
-
-void
-gdk_image_init ()
-{
- if (gdk_use_xshm)
- {
- if (!gdk_image_check_xshm (gdk_display))
- {
- gdk_use_xshm = False;
- }
- }
-}
-
-GdkImage*
-gdk_image_new (GdkImageType type,
- GdkVisual *visual,
- gint width,
- gint height)
-{
- GdkImage *image;
- GdkImagePrivate *private;
-#ifdef USE_SHM
- XShmSegmentInfo *x_shm_info;
-#endif /* USE_SHM */
- Visual *xvisual;
-
- switch (type)
- {
- case GDK_IMAGE_FASTEST:
- image = gdk_image_new (GDK_IMAGE_SHARED, visual, width, height);
-
- if (!image)
- image = gdk_image_new (GDK_IMAGE_NORMAL, visual, width, height);
- break;
-
- default:
- private = g_new (GdkImagePrivate, 1);
- image = (GdkImage*) private;
-
- private->xdisplay = gdk_display;
- private->image_put = NULL;
-
- image->type = type;
- image->visual = visual;
- image->width = width;
- image->height = height;
- image->depth = visual->depth;
-
- xvisual = ((GdkVisualPrivate*) visual)->xvisual;
-
- switch (type)
- {
- case GDK_IMAGE_SHARED:
-#ifdef USE_SHM
- if (gdk_use_xshm)
- {
- private->image_put = gdk_image_put_shared;
-
- private->x_shm_info = g_new (XShmSegmentInfo, 1);
- x_shm_info = private->x_shm_info;
-
- private->ximage = XShmCreateImage (private->xdisplay, xvisual, visual->depth,
- ZPixmap, NULL, x_shm_info, width, height);
- if (private->ximage == NULL)
- {
- g_warning ("XShmCreateImage failed");
-
- g_free (image);
- gdk_use_xshm = False;
- return NULL;
- }
-
- x_shm_info->shmid = shmget (IPC_PRIVATE,
- private->ximage->bytes_per_line * private->ximage->height,
- IPC_CREAT | 0777);
-
- if (x_shm_info->shmid == -1)
- {
- g_warning ("shmget failed!");
-
- XDestroyImage (private->ximage);
- g_free (private->x_shm_info);
- g_free (image);
-
- gdk_use_xshm = False;
- return NULL;
- }
-
- x_shm_info->readOnly = False;
- x_shm_info->shmaddr = shmat (x_shm_info->shmid, 0, 0);
- private->ximage->data = x_shm_info->shmaddr;
-
- if (x_shm_info->shmaddr == (char*) -1)
- {
- g_warning ("shmat failed!");
-
- XDestroyImage (private->ximage);
- shmctl (x_shm_info->shmid, IPC_RMID, 0);
-
- g_free (private->x_shm_info);
- g_free (image);
-
- return NULL;
- }
-
-#ifdef IPC_RMID_DEFERRED_RELEASE
- if (x_shm_info->shmaddr != (char*) -1)
- shmctl (x_shm_info->shmid, IPC_RMID, 0);
-#endif
-
- gdk_error_code = 0;
- gdk_error_warnings = 0;
-
- XShmAttach (private->xdisplay, x_shm_info);
- XSync (private->xdisplay, False);
-
- gdk_error_warnings = 1;
- if (gdk_error_code == -1)
- {
- /* this is the common failure case so omit warning */
- XDestroyImage (private->ximage);
- shmdt (x_shm_info->shmaddr);
- shmctl (x_shm_info->shmid, IPC_RMID, 0);
-
- g_free (private->x_shm_info);
- g_free (image);
-
- gdk_use_xshm = False;
- return NULL;
- }
-
- if (image)
- image_list = g_list_prepend (image_list, image);
- }
- else
- {
- g_free (image);
- return NULL;
- }
- break;
-#else /* USE_SHM */
- g_free (image);
- return NULL;
-#endif /* USE_SHM */
- case GDK_IMAGE_NORMAL:
- private->image_put = gdk_image_put_normal;
-
- private->ximage = XCreateImage (private->xdisplay, xvisual, visual->depth,
- ZPixmap, 0, 0, width, height, 32, 0);
-
- private->ximage->data = g_new (char, private->ximage->bytes_per_line *
- private->ximage->height);
- break;
-
- case GDK_IMAGE_FASTEST:
- g_assert_not_reached ();
- }
-
- if (image)
- {
- image->byte_order = private->ximage->byte_order;
- image->mem = private->ximage->data;
- image->bpl = private->ximage->bytes_per_line;
-
- switch (private->ximage->bits_per_pixel)
- {
- case 8:
- image->bpp = 1;
- break;
- case 16:
- image->bpp = 2;
- break;
- case 24:
- image->bpp = 3;
- break;
- case 32:
- image->bpp = 4;
- break;
- }
- }
- }
-
- return image;
-}
-
-GdkImage*
-gdk_image_get (GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- GdkImage *image;
- GdkImagePrivate *private;
- GdkWindowPrivate *win_private;
-
- g_return_val_if_fail (window != NULL, NULL);
-
- win_private = (GdkWindowPrivate *) window;
- if (win_private->destroyed)
- return NULL;
-
- private = g_new (GdkImagePrivate, 1);
- image = (GdkImage*) private;
-
- private->xdisplay = gdk_display;
- private->image_put = gdk_image_put_normal;
- private->ximage = XGetImage (private->xdisplay,
- win_private->xwindow,
- x, y, width, height,
- AllPlanes, ZPixmap);
-
- image->type = GDK_IMAGE_NORMAL;
- image->visual = gdk_window_get_visual (window);
- image->width = width;
- image->height = height;
- image->depth = private->ximage->depth;
-
- image->mem = private->ximage->data;
- image->bpl = private->ximage->bytes_per_line;
- image->bpp = 1;
-
- return image;
-}
-
-guint32
-gdk_image_get_pixel (GdkImage *image,
- gint x,
- gint y)
-{
- guint32 pixel;
- GdkImagePrivate *private;
-
- g_return_val_if_fail (image != NULL, 0);
-
- private = (GdkImagePrivate *) image;
-
- pixel = XGetPixel (private->ximage, x, y);
-
- return pixel;
-}
-
-void
-gdk_image_put_pixel (GdkImage *image,
- gint x,
- gint y,
- guint32 pixel)
-{
- GdkImagePrivate *private;
-
- g_return_if_fail (image != NULL);
-
- private = (GdkImagePrivate *) image;
-
- pixel = XPutPixel (private->ximage, x, y, pixel);
-}
-
-void
-gdk_image_destroy (GdkImage *image)
-{
- GdkImagePrivate *private;
-#ifdef USE_SHM
- XShmSegmentInfo *x_shm_info;
-#endif /* USE_SHM */
-
- g_return_if_fail (image != NULL);
-
- private = (GdkImagePrivate*) image;
- switch (image->type)
- {
- case GDK_IMAGE_NORMAL:
- XDestroyImage (private->ximage);
- break;
-
- case GDK_IMAGE_SHARED:
-#ifdef USE_SHM
- XShmDetach (private->xdisplay, private->x_shm_info);
- XDestroyImage (private->ximage);
-
- x_shm_info = private->x_shm_info;
- shmdt (x_shm_info->shmaddr);
- shmctl (x_shm_info->shmid, IPC_RMID, 0);
-
- g_free (private->x_shm_info);
-
- image_list = g_list_remove (image_list, image);
-#else /* USE_SHM */
- g_error ("trying to destroy shared memory image when gdk was compiled without shared memory support");
-#endif /* USE_SHM */
- break;
-
- case GDK_IMAGE_FASTEST:
- g_assert_not_reached ();
- }
-
- g_free (image);
-}
-
-static void
-gdk_image_put_normal (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
-{
- GdkWindowPrivate *drawable_private;
- GdkImagePrivate *image_private;
- GdkGCPrivate *gc_private;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (image != NULL);
- g_return_if_fail (gc != NULL);
-
- drawable_private = (GdkWindowPrivate*) drawable;
- if (drawable_private->destroyed)
- return;
- image_private = (GdkImagePrivate*) image;
- gc_private = (GdkGCPrivate*) gc;
-
- g_return_if_fail (image->type == GDK_IMAGE_NORMAL);
-
- XPutImage (drawable_private->xdisplay, drawable_private->xwindow,
- gc_private->xgc, image_private->ximage,
- xsrc, ysrc, xdest, ydest, width, height);
-}
-
-static void
-gdk_image_put_shared (GdkDrawable *drawable,
- GdkGC *gc,
- GdkImage *image,
- gint xsrc,
- gint ysrc,
- gint xdest,
- gint ydest,
- gint width,
- gint height)
-{
-#ifdef USE_SHM
- GdkWindowPrivate *drawable_private;
- GdkImagePrivate *image_private;
- GdkGCPrivate *gc_private;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (image != NULL);
- g_return_if_fail (gc != NULL);
-
- drawable_private = (GdkWindowPrivate*) drawable;
- if (drawable_private->destroyed)
- return;
- image_private = (GdkImagePrivate*) image;
- gc_private = (GdkGCPrivate*) gc;
-
- g_return_if_fail (image->type == GDK_IMAGE_SHARED);
-
- XShmPutImage (drawable_private->xdisplay, drawable_private->xwindow,
- gc_private->xgc, image_private->ximage,
- xsrc, ysrc, xdest, ydest, width, height, False);
-#else /* USE_SHM */
- g_error ("trying to draw shared memory image when gdk was compiled without shared memory support");
-#endif /* USE_SHM */
-}
diff --git a/gdk/x11/gdkinput-gxi.c b/gdk/x11/gdkinput-gxi.c
deleted file mode 100644
index 3d67eb513e..0000000000
--- a/gdk/x11/gdkinput-gxi.c
+++ /dev/null
@@ -1,629 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifdef XINPUT_GXI
-
-/* #define DEBUG_SWITCHING */
-
-#include <gxid_lib.h>
-
-/* Forward declarations */
-static void gdk_input_gxi_select_notify (GdkDevicePrivate *gdkdev);
-static gint gdk_input_gxi_set_mode (guint32 deviceid, GdkInputMode mode);
-static gint gdk_input_is_extension_device (guint32 deviceid);
-static void gdk_input_gxi_configure_event (XConfigureEvent *xevent,
- GdkWindow *window);
-static void gdk_input_gxi_enter_event (XCrossingEvent *xevent,
- GdkWindow *window);
-static gint gdk_input_gxi_other_event (GdkEvent *event,
- XEvent *xevent,
- GdkWindow *window);
-static void gdk_input_gxi_update_device (GdkDevicePrivate *gdkdev);
-
-static gint gdk_input_gxi_window_none_event (GdkEvent *event, XEvent *xevent);
-static gint gdk_input_gxi_enable_window (GdkWindow *window,
- GdkDevicePrivate *gdkdev);
-static gint gdk_input_gxi_disable_window (GdkWindow *window,
- GdkDevicePrivate *gdkdev);
-static Window gdk_input_find_root_child(Display *dpy, Window w);
-static void gdk_input_compute_obscuring(GdkInputWindow *input_window);
-static gint gdk_input_is_obscured(GdkInputWindow *input_window, gdouble x,
- gdouble y);
-static GdkTimeCoord *gdk_input_gxi_motion_events (GdkWindow *window,
- guint32 deviceid,
- guint32 start,
- guint32 stop,
- gint *nevents_return);
-static void gdk_input_gxi_get_pointer (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask);
-static gint gdk_input_gxi_grab_pointer (GdkWindow * window,
- gint owner_events,
- GdkEventMask event_mask,
- GdkWindow * confine_to,
- guint32 time);
-static void gdk_input_gxi_ungrab_pointer (guint32 time);
-
-/* Local variables */
-
-static GdkDevicePrivate *gdk_input_current_device;
-static GdkDevicePrivate *gdk_input_core_pointer;
-
-void
-gdk_input_init(void)
-{
- GList *tmp_list;
-
- gdk_input_vtable.set_mode = gdk_input_gxi_set_mode;
- gdk_input_vtable.set_axes = gdk_input_common_set_axes;
- gdk_input_vtable.set_key = gdk_input_common_set_key;
- gdk_input_vtable.motion_events = gdk_input_gxi_motion_events;
- gdk_input_vtable.get_pointer = gdk_input_gxi_get_pointer;
- gdk_input_vtable.grab_pointer = gdk_input_gxi_grab_pointer;
- gdk_input_vtable.ungrab_pointer = gdk_input_gxi_ungrab_pointer;
- gdk_input_vtable.configure_event = gdk_input_gxi_configure_event;
- gdk_input_vtable.enter_event = gdk_input_gxi_enter_event;
- gdk_input_vtable.other_event = gdk_input_gxi_other_event;
- gdk_input_vtable.window_none_event = gdk_input_gxi_window_none_event;
- gdk_input_vtable.enable_window = gdk_input_gxi_enable_window;
- gdk_input_vtable.disable_window = gdk_input_gxi_disable_window;
-
- gdk_input_ignore_core = FALSE;
- gdk_input_core_pointer = NULL;
-
- if (!gdk_input_gxid_host)
- {
- gdk_input_gxid_host = getenv("GXID_HOST");
- }
- if (!gdk_input_gxid_port)
- {
- char *t = getenv("GXID_PORT");
- if (t)
- gdk_input_gxid_port = atoi(t);
- }
-
- gdk_input_common_init(TRUE);
-
- /* find initial core pointer */
-
- for (tmp_list = gdk_input_devices; tmp_list; tmp_list = tmp_list->next)
- {
- GdkDevicePrivate *gdkdev = (GdkDevicePrivate *)tmp_list->data;
- if (gdk_input_is_extension_device(gdkdev->info.deviceid))
- {
- gdk_input_gxi_select_notify (gdkdev);
- }
- else
- {
- if (gdkdev->info.deviceid != GDK_CORE_POINTER)
- gdk_input_core_pointer = gdkdev;
- }
- }
-}
-
-static void
-gdk_input_gxi_select_notify (GdkDevicePrivate *gdkdev)
-{
- XEventClass class;
-
- ChangeDeviceNotify (gdkdev->xdevice, gdkdev->changenotify_type, class);
-
- XSelectExtensionEvent (gdk_display, gdk_root_window, &class, 1);
-}
-
-/* Set the core pointer. Device should already be enabled. */
-static gint
-gdk_input_gxi_set_core_pointer(GdkDevicePrivate *gdkdev)
-{
- int x_axis,y_axis;
-
- g_return_val_if_fail(gdkdev->xdevice,FALSE);
-
- x_axis = gdkdev->axis_for_use[GDK_AXIS_X];
- y_axis = gdkdev->axis_for_use[GDK_AXIS_Y];
-
- g_return_val_if_fail(x_axis != -1 && y_axis != -1,FALSE);
-
- /* core_pointer might not be up to date so we check with the server
- before change the pointer */
-
- if ( !gdk_input_is_extension_device(gdkdev->info.deviceid) )
- {
-#if 0
- if (gdkdev != gdk_input_core_pointer)
- g_warning("core pointer inconsistency");
-#endif
- return TRUE;
- }
-
- if ( XChangePointerDevice(gdk_display,gdkdev->xdevice, x_axis, y_axis)
- != Success )
- {
- return FALSE;
- }
- else
- {
- gdk_input_gxi_update_device (gdk_input_core_pointer);
- gdk_input_core_pointer = gdkdev;
- return TRUE;
- }
-}
-
-
-/* FIXME, merge with gdk_input_xfree_set_mode */
-
-static gint
-gdk_input_gxi_set_mode (guint32 deviceid, GdkInputMode mode)
-{
- GList *tmp_list;
- GdkDevicePrivate *gdkdev;
- GdkInputMode old_mode;
- GdkInputWindow *input_window;
-
- gdkdev = gdk_input_find_device(deviceid);
- g_return_val_if_fail (gdkdev != NULL,FALSE);
- old_mode = gdkdev->info.mode;
-
- if (gdkdev->info.mode == mode)
- return TRUE;
-
- gdkdev->info.mode = mode;
-
- if (old_mode != GDK_MODE_DISABLED)
- {
- for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
- {
- input_window = (GdkInputWindow *)tmp_list->data;
- if (input_window->mode != GDK_EXTENSION_EVENTS_CURSOR)
- gdk_input_disable_window (input_window->window, gdkdev);
- }
- }
-
- if (mode != GDK_MODE_DISABLED)
- {
- for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
- {
- input_window = (GdkInputWindow *)tmp_list->data;
- if (input_window->mode != GDK_EXTENSION_EVENTS_CURSOR)
- if (!gdk_input_enable_window(input_window->window, gdkdev))
- {
- gdk_input_set_mode(deviceid, old_mode);
- return FALSE;
- }
- }
- }
-
- return TRUE;
-
-}
-
-gint
-gdk_input_is_extension_device (guint32 deviceid)
-{
- XDeviceInfo *devices;
- int num_devices, loop;
-
- if (deviceid == GDK_CORE_POINTER)
- return FALSE;
-
- devices = XListInputDevices(gdk_display, &num_devices);
- for(loop=0; loop<num_devices; loop++)
- {
- if ((devices[loop].id == deviceid) && (devices[loop].use == IsXExtensionDevice))
- {
- XFreeDeviceList(devices);
- return TRUE;
- }
- }
-
- XFreeDeviceList(devices);
- return FALSE;
-}
-
-static void
-gdk_input_gxi_configure_event (XConfigureEvent *xevent, GdkWindow *window)
-{
- GdkInputWindow *input_window;
- gint root_x, root_y;
-
- input_window = gdk_input_window_find(window);
- g_return_if_fail (input_window != NULL);
-
- gdk_input_get_root_relative_geometry(gdk_display,GDK_WINDOW_XWINDOW(window),
- &root_x, &root_y, NULL, NULL);
- input_window->root_x = root_x;
- input_window->root_y = root_y;
- gdk_input_compute_obscuring(input_window);
-}
-
-static void
-gdk_input_gxi_enter_event (XCrossingEvent *xevent, GdkWindow *window)
-{
- GdkInputWindow *input_window;
-
- input_window = gdk_input_window_find(window);
- g_return_if_fail (input_window != NULL);
-
- gdk_input_compute_obscuring(input_window);
-}
-
-static gint
-gdk_input_gxi_other_event (GdkEvent *event,
- XEvent *xevent,
- GdkWindow *window)
-{
- GdkInputWindow *input_window;
-
- GdkDevicePrivate *gdkdev;
- gint return_val;
-
- input_window = gdk_input_window_find(window);
- g_return_val_if_fail (window != NULL, -1);
-
- /* This is a sort of a hack, as there isn't any XDeviceAnyEvent -
- but it's potentially faster than scanning through the types of
- every device. If we were deceived, then it won't match any of
- the types for the device anyways */
- gdkdev = gdk_input_find_device(((XDeviceButtonEvent *)xevent)->deviceid);
-
- if (!gdkdev) {
- return -1; /* we don't handle it - not an XInput event */
- }
-
- if (gdkdev->info.mode == GDK_MODE_DISABLED ||
- input_window->mode == GDK_EXTENSION_EVENTS_CURSOR)
- return FALSE;
-
- if (gdkdev != gdk_input_current_device &&
- xevent->type != gdkdev->changenotify_type)
- {
- gdk_input_current_device = gdkdev;
- }
-
- return_val = gdk_input_common_other_event (event, xevent,
- input_window, gdkdev);
-
- if (return_val > 0 && event->type == GDK_MOTION_NOTIFY &&
- (!gdkdev->button_state) && (!input_window->grabbed) &&
- ((event->motion.x < 0) || (event->motion.y < 0) ||
- (event->motion.x > ((GdkWindowPrivate *)window)->width) ||
- (event->motion.y > ((GdkWindowPrivate *)window)->height) ||
- gdk_input_is_obscured(input_window,event->motion.x,event->motion.y)))
- {
-#ifdef DEBUG_SWITCHING
- g_print("gdkinput: Setting core pointer to %d on motion at (%f,%f)\n",
- gdkdev->info.deviceid,event->motion.x,event->motion.y);
- g_print(" window geometry is: %dx%d\n",
- ((GdkWindowPrivate *)window)->width,
- ((GdkWindowPrivate *)window)->height);
-#endif
- gdk_input_gxi_set_core_pointer(gdkdev);
- return FALSE;
- }
- else
- return return_val;
-
-}
-
-static void
-gdk_input_gxi_update_device (GdkDevicePrivate *gdkdev)
-{
- GList *t;
-
- if (gdk_input_is_extension_device (gdkdev->info.deviceid))
- {
- if (!gdkdev->xdevice)
- {
- gdkdev->xdevice = XOpenDevice(gdk_display, gdkdev->info.deviceid);
- gdk_input_gxi_select_notify (gdkdev);
- gdkdev->needs_update = 1;
- }
- if (gdkdev->needs_update && gdkdev->xdevice)
- {
- for (t = gdk_input_windows; t; t = t->next)
- gdk_input_common_select_events (((GdkInputWindow *)t->data)->window,
- gdkdev);
- gdkdev->needs_update = 0;
- }
- }
-}
-
-static gint
-gdk_input_gxi_window_none_event (GdkEvent *event, XEvent *xevent)
-{
- GdkDevicePrivate *gdkdev =
- gdk_input_find_device(((XDeviceButtonEvent *)xevent)->deviceid);
-
- if (!gdkdev) {
- return -1; /* we don't handle it - not an XInput event */
- }
-
- if (xevent->type == gdkdev->changenotify_type)
- {
- if (gdk_input_core_pointer != gdkdev)
- {
-#ifdef DEBUG_SWITCHING
- g_print("ChangeNotify from %d to %d:\n",
- gdk_input_core_pointer->info.deviceid,
- gdkdev->info.deviceid);
-#endif
- gdk_input_gxi_update_device (gdk_input_core_pointer);
- gdk_input_core_pointer = gdkdev;
- }
- }
-
- return FALSE;
-}
-
-static gint
-gdk_input_gxi_enable_window (GdkWindow *window, GdkDevicePrivate *gdkdev)
-{
- GdkInputWindow *input_window;
-
- input_window = gdk_input_window_find (window);
- g_return_val_if_fail (input_window != NULL, FALSE);
-
- if (!gdkdev->claimed)
- {
- if (gxid_claim_device(gdk_input_gxid_host, gdk_input_gxid_port,
- gdkdev->info.deviceid,
- GDK_WINDOW_XWINDOW(window), FALSE) !=
- GXID_RETURN_OK)
- {
- g_warning("Could not get device (is gxid running?)\n");
- return FALSE;
- }
- gdkdev->claimed = TRUE;
- }
-
- if (gdkdev->xdevice && gdkdev != gdk_input_core_pointer)
- gdk_input_common_select_events(window, gdkdev);
- else
- gdkdev->needs_update = TRUE;
-
- return TRUE;
-}
-
-static gint
-gdk_input_gxi_disable_window(GdkWindow *window, GdkDevicePrivate *gdkdev)
-{
- GdkInputWindow *input_window;
-
- input_window = gdk_input_window_find (window);
- g_return_val_if_fail (input_window != NULL, FALSE);
-
- if (gdkdev->claimed)
- {
- gxid_release_device(gdk_input_gxid_host, gdk_input_gxid_port,
- gdkdev->info.deviceid,
- GDK_WINDOW_XWINDOW(window));
-
- gdkdev->claimed = FALSE;
- }
-
- if (gdkdev->xdevice && gdkdev != gdk_input_core_pointer)
- gdk_input_common_select_events(window, gdkdev);
- else
- gdkdev->needs_update = TRUE;
-
- return TRUE;
-}
-
-static gint
-gdk_input_is_obscured(GdkInputWindow *input_window, gdouble x, gdouble y)
-{
- int i;
- for (i=0;i<input_window->num_obscuring;i++)
- {
- GdkRectangle *rect = &input_window->obscuring[i];
- if ((x >= rect->x) &&
- (y >= rect->y) &&
- (x < rect->x + rect->width) &&
- (y < rect->y + rect->height))
- return TRUE;
- }
- return FALSE;
-}
-
-/* If this routine needs fixing, the corresponding routine
- in gxid.c will need it too. */
-
-static Window
-gdk_input_find_root_child(Display *dpy, Window w)
-{
- Window root,parent;
- Window *children;
- int nchildren;
-
- parent = w;
- do
- {
- w = parent;
- XQueryTree(dpy,w,&root,&parent,&children,&nchildren);
- if (children) XFree(children);
- }
- while (parent != root);
-
- return w;
-}
-
-void
-gdk_input_compute_obscuring(GdkInputWindow *input_window)
-{
- int i;
- int x,y,width,height;
- int xc,yc,widthc,heightc,border_widthc,depthc;
-
- Window root,parent;
- Window *children;
- int nchildren;
-
- Window w = GDK_WINDOW_XWINDOW(input_window->window);
- Window root_child = gdk_input_find_root_child(gdk_display,w);
- gdk_input_get_root_relative_geometry(gdk_display,w,&x,&y,&width,&height);
-
- input_window->root_x = x;
- input_window->root_y = y;
-
- XQueryTree(gdk_display,GDK_ROOT_WINDOW(),
- &root,&parent,&children,&nchildren);
-
-
- if (input_window->obscuring)
- g_free(input_window->obscuring);
- input_window->obscuring = 0;
- input_window->num_obscuring = 0;
-
- for (i=0;i<nchildren;i++)
- if (children[i] == root_child)
- break;
-
- if (i>=nchildren-1)
- {
- if (nchildren)
- XFree(children);
- return;
- }
-
- input_window->obscuring = g_new(GdkRectangle,(nchildren-i-1));
-
- for (i=i+1;i<nchildren;i++)
- {
- int xmin, xmax, ymin, ymax;
- XGetGeometry(gdk_display,children[i],&root,&xc,&yc,&widthc,&heightc,
- &border_widthc, &depthc);
- xmin = xc>x ? xc : x;
- xmax = (xc+widthc)<(x+width) ? xc+widthc : x+width;
- ymin = yc>y ? yc : y;
- ymax = (yc+heightc)<(y+height) ? yc+heightc : y+height;
- if ((xmin < xmax) && (ymin < ymax))
- {
- XWindowAttributes attributes;
- XGetWindowAttributes(gdk_display,children[i],&attributes);
- if (attributes.map_state == IsViewable)
- {
- GdkRectangle *rect = &input_window->obscuring[input_window->num_obscuring];
-
- /* we store the whole window, not just the obscuring part */
- rect->x = xc - x;
- rect->y = yc - y;
- rect->width = widthc;
- rect->height = heightc;
- input_window->num_obscuring++;
- }
- }
- }
-
- if (nchildren)
- XFree(children);
-}
-
-static void
-gdk_input_gxi_get_pointer (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask)
-{
- GdkDevicePrivate *gdkdev;
-
- gdkdev = gdk_input_find_device (deviceid);
- g_return_if_fail (gdkdev != NULL);
-
- if (gdkdev == gdk_input_core_pointer)
- gdk_input_common_get_pointer (window, GDK_CORE_POINTER, x, y,
- pressure, xtilt, ytilt, mask);
- else
- gdk_input_common_get_pointer (window, deviceid, x, y,
- pressure, xtilt, ytilt, mask);
-}
-
-static GdkTimeCoord *
-gdk_input_gxi_motion_events (GdkWindow *window,
- guint32 deviceid,
- guint32 start,
- guint32 stop,
- gint *nevents_return)
-{
- GdkDevicePrivate *gdkdev;
-
- gdkdev = gdk_input_find_device (deviceid);
- g_return_val_if_fail (gdkdev != NULL, NULL);
-
-
- if (gdkdev == gdk_input_core_pointer)
- return gdk_input_motion_events (window, GDK_CORE_POINTER, start, stop,
- nevents_return);
- else
- return gdk_input_common_motion_events (window, deviceid, start, stop,
- nevents_return);
-
-}
-
-static gint
-gdk_input_gxi_grab_pointer (GdkWindow * window,
- gint owner_events,
- GdkEventMask event_mask,
- GdkWindow * confine_to,
- guint32 time)
-{
- GdkInputWindow *input_window, *new_window;
- GList *tmp_list;
-
- tmp_list = gdk_input_windows;
- while (tmp_list)
- {
- input_window = (GdkInputWindow *)tmp_list->data;
- if (input_window->grabbed)
- return AlreadyGrabbed;
-
- if (input_window->window == window)
- new_window = input_window;
-
- tmp_list = tmp_list->next;
- }
-
- new_window->grabbed = TRUE;
- return Success;
-}
-
-static void
-gdk_input_gxi_ungrab_pointer (guint32 time)
-{
- GdkInputWindow *input_window;
- GList *tmp_list;
-
- tmp_list = gdk_input_windows;
- while (tmp_list)
- {
- input_window = (GdkInputWindow *)tmp_list->data;
- if (input_window->grabbed)
- input_window->grabbed = FALSE;
- tmp_list = tmp_list->next;
- }
-}
-
-#endif /* XINPUT_GXI */
diff --git a/gdk/x11/gdkinput-none.c b/gdk/x11/gdkinput-none.c
deleted file mode 100644
index 6dd999b837..0000000000
--- a/gdk/x11/gdkinput-none.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifdef XINPUT_NONE
-
-static void gdk_input_none_get_pointer (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask);
-
-void
-gdk_input_init ()
-{
- gdk_input_vtable.set_mode = NULL;
- gdk_input_vtable.set_axes = NULL;
- gdk_input_vtable.set_key = NULL;
- gdk_input_vtable.motion_events = NULL;
- gdk_input_vtable.get_pointer = gdk_input_none_get_pointer;
- gdk_input_vtable.grab_pointer = NULL;
- gdk_input_vtable.ungrab_pointer = NULL;
- gdk_input_vtable.configure_event = NULL;
- gdk_input_vtable.enter_event = NULL;
- gdk_input_vtable.other_event = NULL;
- gdk_input_vtable.window_none_event = NULL;
- gdk_input_vtable.enable_window = NULL;
- gdk_input_vtable.disable_window = NULL;
-
- gdk_input_devices = g_list_append (NULL, &gdk_input_core_info);
-
- gdk_input_ignore_core = FALSE;
-}
-
-static void
-gdk_input_none_get_pointer (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask)
-{
- gint x_int, y_int;
-
- gdk_window_get_pointer (window, &x_int, &y_int, mask);
-
- if (x) *x = x_int;
- if (y) *y = y_int;
- if (pressure) *pressure = 0.5;
- if (xtilt) *xtilt = 0;
- if (ytilt) *ytilt = 0;
-}
-
-#endif /* XINPUT_NONE */
diff --git a/gdk/x11/gdkinput-x11.c b/gdk/x11/gdkinput-x11.c
deleted file mode 100644
index 2dc5a6d859..0000000000
--- a/gdk/x11/gdkinput-x11.c
+++ /dev/null
@@ -1,882 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#if defined(XINPUT_GXI) || defined(XINPUT_XFREE)
-
-/* Forward declarations */
-static void gdk_input_get_root_relative_geometry (Display *dpy, Window w,
- int *x_ret, int *y_ret,
- int *width_ret,
- int *height_ret);
-static GdkDevicePrivate *gdk_input_device_new(XDeviceInfo *device,
- gint include_core);
-static void gdk_input_common_find_events(GdkWindow *window,
- GdkDevicePrivate *gdkdev,
- gint mask,
- XEventClass *classes,
- int *num_classes);
-static void gdk_input_common_select_events(GdkWindow *window,
- GdkDevicePrivate *gdkdev);
-static void gdk_input_translate_coordinates(GdkDevicePrivate *gdkdev,
- GdkInputWindow *input_window,
- gint *axis_data,
- gdouble *x, gdouble *y,
- gdouble *pressure,
- gdouble *xtilt, gdouble *ytilt);
-static guint gdk_input_translate_state(guint state, guint device_state);
-static gint gdk_input_common_init(gint include_core);
-static gint gdk_input_common_other_event (GdkEvent *event,
- XEvent *xevent,
- GdkInputWindow *input_window,
- GdkDevicePrivate *gdkdev);
-static void gdk_input_common_set_axes (guint32 deviceid, GdkAxisUse *axes);
-static GdkTimeCoord * gdk_input_common_motion_events (GdkWindow *window,
- guint32 deviceid,
- guint32 start,
- guint32 stop,
- gint *nevents_return);
-static void gdk_input_common_get_pointer (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask);
-
-#define GDK_MAX_DEVICE_CLASSES 13
-
-/* Global variables */
-
-static gint gdk_input_root_width;
-static gint gdk_input_root_height;
-
-static void
-gdk_input_get_root_relative_geometry(Display *dpy, Window w, int *x_ret, int *y_ret,
- int *width_ret, int *height_ret)
-{
- Window root,parent;
- Window *children;
- guint nchildren;
- gint x,y;
- guint width, height;
- gint xc,yc;
- guint widthc,heightc,border_widthc,depthc;
-
- XQueryTree(dpy,w,&root,&parent,&children,&nchildren);
- if (children) XFree(children);
- XGetGeometry(dpy,w,&root,&x,&y,&width,&height,&border_widthc,
- &depthc);
- x += border_widthc;
- y += border_widthc;
-
- while (root != parent)
- {
- w = parent;
- XQueryTree(dpy,w,&root,&parent,&children,&nchildren);
- if (children) XFree(children);
- XGetGeometry(dpy,w,&root,&xc,&yc,&widthc,&heightc,
- &border_widthc,&depthc);
- x += xc + border_widthc;
- y += yc + border_widthc;
- }
-
- if (x_ret)
- *x_ret = x;
- if (y_ret)
- *y_ret = y;
- if (width_ret)
- *width_ret = width;
- if (height_ret)
- *height_ret = height;
-}
-
-static GdkDevicePrivate *
-gdk_input_device_new(XDeviceInfo *device, gint include_core)
-{
- GdkDevicePrivate *gdkdev;
- gchar *tmp_name, *p;
- XAnyClassPtr class;
- gint i,j;
-
- gdkdev = g_new(GdkDevicePrivate,1);
-
- gdkdev->info.deviceid = device->id;
- if (device->name[0]) {
- gdkdev->info.name = g_new(char, strlen(device->name)+1);
- strcpy(gdkdev->info.name,device->name);
- } else {
- /* XFree86 3.2 gives an empty name to the default core devices,
- (fixed in 3.2A) */
- gdkdev->info.name = g_strdup("pointer");
- strcpy(gdkdev->info.name,"pointer");
- gdkdev->info.source = GDK_SOURCE_MOUSE;
- }
-
- gdkdev->info.mode = GDK_MODE_DISABLED;
-
- /* Try to figure out what kind of device this is by its name -
- could invite a very, very, long list... Lowercase name
- for comparison purposes */
-
- tmp_name = g_strdup(gdkdev->info.name);
- for (p = tmp_name; *p; p++)
- {
- if (*p >= 'A' && *p <= 'Z')
- *p += 'a' - 'A';
- }
-
- if (!strcmp (tmp_name, "pointer"))
- gdkdev->info.source = GDK_SOURCE_MOUSE;
- else if (!strcmp (tmp_name, "wacom") ||
- !strcmp (tmp_name, "pen"))
- gdkdev->info.source = GDK_SOURCE_PEN;
- else if (!strcmp (tmp_name, "eraser"))
- gdkdev->info.source = GDK_SOURCE_ERASER;
- else if (!strcmp (tmp_name, "cursor"))
- gdkdev->info.source = GDK_SOURCE_CURSOR;
- else
- gdkdev->info.source = GDK_SOURCE_PEN;
-
- g_free(tmp_name);
-
- gdkdev->xdevice = NULL;
-
- /* step through the classes */
-
- gdkdev->info.num_axes = 0;
- gdkdev->info.num_keys = 0;
- gdkdev->info.keys = NULL;
- gdkdev->axes = 0;
- gdkdev->info.has_cursor = 0;
- gdkdev->needs_update = FALSE;
- gdkdev->claimed = FALSE;
- gdkdev->button_state = 0;
-
- class = device->inputclassinfo;
- for (i=0;i<device->num_classes;i++)
- {
- switch (class->class) {
- case ButtonClass:
- {
- break;
- }
- case KeyClass:
- {
- XKeyInfo *xki = (XKeyInfo *)class;
- /* Hack to catch XFree86 3.3.1 bug. Other devices better
- * not have exactly 25 keys...
- */
- if ((xki->min_keycode == 8) && (xki->max_keycode == 32))
- {
- gdkdev->info.num_keys = 32;
- gdkdev->min_keycode = 0;
- }
- else
- {
- gdkdev->info.num_keys = xki->max_keycode - xki->min_keycode + 1;
- gdkdev->min_keycode = xki->min_keycode;
- }
- gdkdev->info.keys = g_new (GdkDeviceKey, gdkdev->info.num_keys);
-
- for (j=0; j<gdkdev->info.num_keys; j++)
- {
- gdkdev->info.keys[j].keyval = 0;
- gdkdev->info.keys[j].modifiers = 0;
- }
-
- break;
- }
- case ValuatorClass:
- {
- XValuatorInfo *xvi = (XValuatorInfo *)class;
- gdkdev->info.num_axes = xvi->num_axes;
- gdkdev->axes = g_new(GdkAxisInfo, xvi->num_axes);
- gdkdev->info.axes = g_new(GdkAxisUse, xvi->num_axes);
- for (j=0;j<xvi->num_axes;j++)
- {
- gdkdev->axes[j].resolution =
- gdkdev->axes[j].xresolution = xvi->axes[j].resolution;
- gdkdev->axes[j].min_value =
- gdkdev->axes[j].xmin_value = xvi->axes[j].min_value;
- gdkdev->axes[j].max_value =
- gdkdev->axes[j].xmax_value = xvi->axes[j].max_value;
- gdkdev->info.axes[j] = GDK_AXIS_IGNORE;
- }
- j=0;
- if (j<xvi->num_axes)
- gdkdev->info.axes[j++] = GDK_AXIS_X;
- if (j<xvi->num_axes)
- gdkdev->info.axes[j++] = GDK_AXIS_Y;
- if (j<xvi->num_axes)
- gdkdev->info.axes[j++] = GDK_AXIS_PRESSURE;
- if (j<xvi->num_axes)
- gdkdev->info.axes[j++] = GDK_AXIS_XTILT;
- if (j<xvi->num_axes)
- gdkdev->info.axes[j++] = GDK_AXIS_YTILT;
-
- /* set up reverse lookup on axis use */
- for (j=GDK_AXIS_IGNORE;j<GDK_AXIS_LAST;j++)
- gdkdev->axis_for_use[j] = -1;
-
- for (j=0;j<xvi->num_axes;j++)
- if (gdkdev->info.axes[j] != GDK_AXIS_IGNORE)
- gdkdev->axis_for_use[gdkdev->info.axes[j]] = j;
-
- break;
- }
- }
- class = (XAnyClassPtr)(((char *)class) + class->length);
- }
- /* return NULL if no axes */
- if (!gdkdev->info.num_axes || !gdkdev->axes ||
- (!include_core && device->use == IsXPointer))
- {
- g_free(gdkdev->info.name);
- if (gdkdev->axes)
- g_free(gdkdev->axes);
- if (gdkdev->info.keys)
- g_free(gdkdev->info.keys);
- g_free(gdkdev);
- return NULL;
- }
-
- if (device->use != IsXPointer)
- {
- int error_warn = gdk_error_warnings;
-
- gdk_error_warnings = 0;
- gdk_error_code = 0;
- gdkdev->xdevice = XOpenDevice(gdk_display, gdkdev->info.deviceid);
- gdk_error_warnings = error_warn;
-
- /* return NULL if device is not ready */
- if (gdk_error_code)
- {
- g_free (gdkdev->info.name);
- if (gdkdev->axes)
- g_free (gdkdev->axes);
- if (gdkdev->info.keys)
- g_free (gdkdev->info.keys);
- if (gdkdev->info.axes)
- g_free (gdkdev->info.axes);
- g_free (gdkdev);
-
- return NULL;
- }
- }
-
- gdkdev->buttonpress_type = 0;
- gdkdev->buttonrelease_type = 0;
- gdkdev->keypress_type = 0;
- gdkdev->keyrelease_type = 0;
- gdkdev->motionnotify_type = 0;
- gdkdev->proximityin_type = 0;
- gdkdev->proximityout_type = 0;
- gdkdev->changenotify_type = 0;
-
- return gdkdev;
-}
-
-static void
-gdk_input_common_find_events(GdkWindow *window,
- GdkDevicePrivate *gdkdev,
- gint mask,
- XEventClass *classes,
- int *num_classes)
-{
- gint i;
- XEventClass class;
-
- i = 0;
- /* We have to track press and release events in pairs to keep
- track of button state correctly and implement grabbing for
- the gxi support */
- if (mask & GDK_BUTTON_PRESS_MASK || mask & GDK_BUTTON_RELEASE_MASK)
- {
- DeviceButtonPress (gdkdev->xdevice, gdkdev->buttonpress_type,
- class);
- if (class != 0)
- classes[i++] = class;
- DeviceButtonPressGrab (gdkdev->xdevice, 0, class);
- if (class != 0)
- classes[i++] = class;
- DeviceButtonRelease (gdkdev->xdevice, gdkdev->buttonrelease_type,
- class);
- if (class != 0)
- classes[i++] = class;
- }
- if (mask & GDK_POINTER_MOTION_MASK)
- {
- DeviceMotionNotify (gdkdev->xdevice, gdkdev->motionnotify_type, class);
- if (class != 0)
- classes[i++] = class;
- }
- else
- if (mask & (GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK |
- GDK_BUTTON3_MOTION_MASK | GDK_BUTTON_MOTION_MASK |
- GDK_POINTER_MOTION_HINT_MASK))
- {
- /* Make sure gdkdev->motionnotify_type is set */
- DeviceMotionNotify (gdkdev->xdevice, gdkdev->motionnotify_type, class);
- }
- if (mask & GDK_BUTTON1_MOTION_MASK)
- {
- DeviceButton1Motion (gdkdev->xdevice, 0, class);
- if (class != 0)
- classes[i++] = class;
- }
- if (mask & GDK_BUTTON2_MOTION_MASK)
- {
- DeviceButton2Motion (gdkdev->xdevice, 0, class);
- if (class != 0)
- classes[i++] = class;
- }
- if (mask & GDK_BUTTON3_MOTION_MASK)
- {
- DeviceButton3Motion (gdkdev->xdevice, 0, class);
- if (class != 0)
- classes[i++] = class;
- }
- if (mask & GDK_BUTTON_MOTION_MASK)
- {
- DeviceButtonMotion (gdkdev->xdevice, 0, class);
- if (class != 0)
- classes[i++] = class;
- }
- if (mask & GDK_POINTER_MOTION_HINT_MASK)
- {
- /* We'll get into trouble if the macros change, but at least we'll
- know about it, and we avoid warnings now */
- DevicePointerMotionHint (gdkdev->xdevice, 0, class);
- if (class != 0)
- classes[i++] = class;
- }
- if (mask & GDK_KEY_PRESS_MASK)
- {
- DeviceKeyPress (gdkdev->xdevice, gdkdev->keypress_type, class);
- if (class != 0)
- classes[i++] = class;
- }
- if (mask & GDK_KEY_RELEASE_MASK)
- {
- DeviceKeyRelease (gdkdev->xdevice, gdkdev->keyrelease_type, class);
- if (class != 0)
- classes[i++] = class;
- }
- if (mask & GDK_PROXIMITY_IN_MASK)
- {
- ProximityIn (gdkdev->xdevice, gdkdev->proximityin_type, class);
- if (class != 0)
- classes[i++] = class;
- }
- if (mask & GDK_PROXIMITY_OUT_MASK)
- {
- ProximityOut (gdkdev->xdevice, gdkdev->proximityout_type, class);
- if (class != 0)
- classes[i++] = class;
- }
-
- *num_classes = i;
-}
-
-static void
-gdk_input_common_select_events(GdkWindow *window,
- GdkDevicePrivate *gdkdev)
-{
- XEventClass classes[GDK_MAX_DEVICE_CLASSES];
- gint num_classes;
-
- if (gdkdev->info.mode == GDK_MODE_DISABLED)
- gdk_input_common_find_events(window, gdkdev, 0, classes, &num_classes);
- else
- gdk_input_common_find_events(window, gdkdev,
- ((GdkWindowPrivate *)window)->extension_events,
- classes, &num_classes);
-
- XSelectExtensionEvent (gdk_display,
- GDK_WINDOW_XWINDOW(window),
- classes, num_classes);
-}
-
-gint
-gdk_input_common_init(gint include_core)
-{
- char **extensions;
- XDeviceInfo *devices;
- int num_devices;
- int num_extensions, loop;
- Display *display = gdk_display;
-
- /* Init global vars */
- gdk_window_get_geometry(NULL, /* use root window */
- NULL,NULL,
- &gdk_input_root_width,&gdk_input_root_height,
- NULL);
-
- /* Init XInput extension */
-
- extensions = XListExtensions(display, &num_extensions);
- for (loop = 0; loop < num_extensions &&
- (strcmp(extensions[loop], "XInputExtension") != 0); loop++);
- XFreeExtensionList(extensions);
- if (loop == num_extensions) /* XInput extension not found */
- return FALSE;
-
- gdk_input_devices = 0;
- devices = XListInputDevices(display, &num_devices);
-
- for(loop=0; loop<num_devices; loop++)
- {
- GdkDevicePrivate *gdkdev = gdk_input_device_new(&devices[loop],
- include_core);
- if (gdkdev)
- gdk_input_devices = g_list_append(gdk_input_devices, gdkdev);
- }
- XFreeDeviceList(devices);
-
- gdk_input_devices = g_list_append (gdk_input_devices, &gdk_input_core_info);
-
- return TRUE;
-}
-
-static void
-gdk_input_translate_coordinates (GdkDevicePrivate *gdkdev,
- GdkInputWindow *input_window,
- gint *axis_data,
- gdouble *x, gdouble *y, gdouble *pressure,
- gdouble *xtilt, gdouble *ytilt)
-{
- GdkWindowPrivate *win_priv;
-
- int x_axis, y_axis, pressure_axis, xtilt_axis, ytilt_axis;
-
- double device_width, device_height;
- double x_offset, y_offset, x_scale, y_scale;
-
- win_priv = (GdkWindowPrivate *) input_window->window;
-
- x_axis = gdkdev->axis_for_use[GDK_AXIS_X];
- y_axis = gdkdev->axis_for_use[GDK_AXIS_Y];
- pressure_axis = gdkdev->axis_for_use[GDK_AXIS_PRESSURE];
- xtilt_axis = gdkdev->axis_for_use[GDK_AXIS_XTILT];
- ytilt_axis = gdkdev->axis_for_use[GDK_AXIS_YTILT];
-
- device_width = gdkdev->axes[x_axis].max_value -
- gdkdev->axes[x_axis].min_value;
- device_height = gdkdev->axes[y_axis].max_value -
- gdkdev->axes[y_axis].min_value;
-
- if (gdkdev->info.mode == GDK_MODE_SCREEN)
- {
- x_scale = gdk_input_root_width / device_width;
- y_scale = gdk_input_root_height / device_height;
-
- x_offset = - input_window->root_x;
- y_offset = - input_window->root_y;
- }
- else /* GDK_MODE_WINDOW */
- {
- double device_aspect = (device_height*gdkdev->axes[y_axis].resolution) /
- (device_width*gdkdev->axes[x_axis].resolution);
-
- if (device_aspect * win_priv->width >= win_priv->height)
- {
- /* device taller than window */
- x_scale = win_priv->width / device_width;
- y_scale = (x_scale * gdkdev->axes[x_axis].resolution)
- / gdkdev->axes[y_axis].resolution;
-
- x_offset = 0;
- y_offset = -(device_height * y_scale -
- win_priv->height)/2;
- }
- else
- {
- /* window taller than device */
- y_scale = win_priv->height / device_height;
- x_scale = (y_scale * gdkdev->axes[y_axis].resolution)
- / gdkdev->axes[x_axis].resolution;
-
- y_offset = 0;
- x_offset = - (device_width * x_scale - win_priv->width)/2;
- }
- }
-
- if (x) *x = x_offset + x_scale*axis_data[x_axis];
- if (y) *y = y_offset + y_scale*axis_data[y_axis];
-
- if (pressure)
- {
- if (pressure_axis != -1)
- *pressure = ((double)axis_data[pressure_axis]
- - gdkdev->axes[pressure_axis].min_value)
- / (gdkdev->axes[pressure_axis].max_value
- - gdkdev->axes[pressure_axis].min_value);
- else
- *pressure = 0.5;
- }
-
- if (xtilt)
- {
- if (xtilt_axis != -1)
- {
- *xtilt = 2. * (double)(axis_data[xtilt_axis] -
- (gdkdev->axes[xtilt_axis].min_value +
- gdkdev->axes[xtilt_axis].max_value)/2) /
- (gdkdev->axes[xtilt_axis].max_value -
- gdkdev->axes[xtilt_axis].min_value);
- }
- else *xtilt = 0;
- }
-
- if (ytilt)
- {
- if (ytilt_axis != -1)
- {
- *ytilt = 2. * (double)(axis_data[ytilt_axis] -
- (gdkdev->axes[ytilt_axis].min_value +
- gdkdev->axes[ytilt_axis].max_value)/2) /
- (gdkdev->axes[ytilt_axis].max_value -
- gdkdev->axes[ytilt_axis].min_value);
- }
- else
- *ytilt = 0;
- }
-}
-
-/* combine the state of the core device and the device state
- into one - for now we do this in a simple-minded manner -
- we just take the keyboard portion of the core device and
- the button portion (all of?) the device state.
- Any button remapping should go on here. */
-static guint
-gdk_input_translate_state(guint state, guint device_state)
-{
- return device_state | (state & 0xFF);
-}
-
-static gint
-gdk_input_common_other_event (GdkEvent *event,
- XEvent *xevent,
- GdkInputWindow *input_window,
- GdkDevicePrivate *gdkdev)
-{
- if ((xevent->type == gdkdev->buttonpress_type) ||
- (xevent->type == gdkdev->buttonrelease_type))
- {
- XDeviceButtonEvent *xdbe = (XDeviceButtonEvent *)(xevent);
-
- if (xdbe->type == gdkdev->buttonpress_type)
- {
- event->button.type = GDK_BUTTON_PRESS;
- gdkdev->button_state |= 1 << xdbe->button;
- }
- else
- {
- event->button.type = GDK_BUTTON_RELEASE;
- gdkdev->button_state &= ~(1 << xdbe->button);
- }
- event->button.window = input_window->window;
- event->button.time = xdbe->time;
- event->button.source = gdkdev->info.source;
- event->button.deviceid = xdbe->deviceid;
-
- gdk_input_translate_coordinates (gdkdev,input_window, xdbe->axis_data,
- &event->button.x,&event->button.y,
- &event->button.pressure,
- &event->button.xtilt,
- &event->button.ytilt);
- event->button.state = gdk_input_translate_state(xdbe->state,xdbe->device_state);
- event->button.button = xdbe->button;
-
- GDK_NOTE (EVENTS,
- g_print ("button %s:\t\twindow: %ld device: %ld x,y: %f %f button: %d\n",
- (event->button.type == GDK_BUTTON_PRESS) ? "press" : "release",
- xdbe->window,
- xdbe->deviceid,
- event->button.x, event->button.y,
- xdbe->button));
-
- return TRUE;
- }
-
- if ((xevent->type == gdkdev->keypress_type) ||
- (xevent->type == gdkdev->keyrelease_type))
- {
- XDeviceKeyEvent *xdke = (XDeviceKeyEvent *)(xevent);
-
- GDK_NOTE (EVENTS,
- g_print ("device key %s:\twindow: %ld device: %ld keycode: %d\n",
- (event->key.type == GDK_KEY_PRESS) ? "press" : "release",
- xdke->window,
- xdke->deviceid,
- xdke->keycode));
-
- if (xdke->keycode < gdkdev->min_keycode ||
- xdke->keycode >= gdkdev->min_keycode + gdkdev->info.num_keys)
- {
- g_warning ("Invalid device key code received");
- return FALSE;
- }
-
- event->key.keyval = gdkdev->info.keys[xdke->keycode - gdkdev->min_keycode].keyval;
-
- if (event->key.keyval == 0)
- {
- GDK_NOTE (EVENTS,
- g_print ("\t\ttranslation - NONE\n"));
-
- return FALSE;
- }
-
- event->key.type = (xdke->type == gdkdev->keypress_type) ?
- GDK_KEY_PRESS : GDK_KEY_RELEASE;
-
- event->key.window = input_window->window;
- event->key.time = xdke->time;
-
- event->key.state = gdk_input_translate_state(xdke->state, xdke->device_state)
- | gdkdev->info.keys[xdke->keycode - gdkdev->min_keycode].modifiers;
-
- /* Add a string translation for the key event */
- if ((event->key.keyval >= 0x20) && (event->key.keyval <= 0xFF))
- {
- event->key.length = 1;
- event->key.string = g_new (gchar, 2);
- event->key.string[0] = (gchar)event->key.keyval;
- event->key.string[1] = 0;
- }
- else
- {
- event->key.length = 0;
- event->key.string = g_new0 (gchar, 1);
- }
-
- GDK_NOTE (EVENTS,
- g_print ("\t\ttranslation - keyval: %d modifiers: %#x\n",
- event->key.keyval,
- event->key.state));
-
- return TRUE;
- }
-
- if (xevent->type == gdkdev->motionnotify_type)
- {
- XDeviceMotionEvent *xdme = (XDeviceMotionEvent *)(xevent);
-
- gdk_input_translate_coordinates(gdkdev,input_window,xdme->axis_data,
- &event->motion.x,&event->motion.y,
- &event->motion.pressure,
- &event->motion.xtilt,
- &event->motion.ytilt);
-
- event->motion.type = GDK_MOTION_NOTIFY;
- event->motion.window = input_window->window;
- event->motion.time = xdme->time;
- event->motion.deviceid = xdme->deviceid;
- event->motion.state = gdk_input_translate_state(xdme->state,
- xdme->device_state);
- event->motion.is_hint = xdme->is_hint;
- event->motion.source = gdkdev->info.source;
- event->motion.deviceid = xdme->deviceid;
-
- GDK_NOTE (EVENTS,
- g_print ("motion notify:\t\twindow: %ld device: %ld x,y: %f %f state %#4x hint: %s\n",
- xdme->window,
- xdme->deviceid,
- event->motion.x, event->motion.y,
- event->motion.state,
- (xdme->is_hint) ? "true" : "false"));
-
-
- return TRUE;
- }
-
- if (xevent->type == gdkdev->proximityin_type ||
- xevent->type == gdkdev->proximityout_type)
- {
- XProximityNotifyEvent *xpne = (XProximityNotifyEvent *)(xevent);
-
- event->proximity.type = (xevent->type == gdkdev->proximityin_type)?
- GDK_PROXIMITY_IN:GDK_PROXIMITY_OUT;
- event->proximity.window = input_window->window;
- event->proximity.time = xpne->time;
- event->proximity.source = gdkdev->info.source;
- event->proximity.deviceid = xpne->deviceid;
-
- return TRUE;
- }
-
- return -1; /* wasn't one of our event types */
-}
-
-static void
-gdk_input_common_set_axes (guint32 deviceid, GdkAxisUse *axes)
-{
- int i;
- GdkDevicePrivate *gdkdev = gdk_input_find_device(deviceid);
- g_return_if_fail (gdkdev != NULL);
-
- for (i=GDK_AXIS_IGNORE;i<GDK_AXIS_LAST;i++)
- {
- gdkdev->axis_for_use[i] = -1;
- }
-
- for (i=0;i<gdkdev->info.num_axes;i++)
- {
- gdkdev->info.axes[i] = axes[i];
- gdkdev->axis_for_use[axes[i]] = i;
- }
-}
-
-void gdk_input_common_set_key (guint32 deviceid,
- guint index,
- guint keyval,
- GdkModifierType modifiers)
-{
- GdkDevicePrivate *gdkdev = gdk_input_find_device(deviceid);
-
- gdkdev = gdk_input_find_device (deviceid);
- g_return_if_fail (gdkdev != NULL);
- g_return_if_fail (index < gdkdev->info.num_keys);
-
- gdkdev->info.keys[index].keyval = keyval;
- gdkdev->info.keys[index].modifiers = modifiers;
-}
-
-static GdkTimeCoord *
-gdk_input_common_motion_events (GdkWindow *window,
- guint32 deviceid,
- guint32 start,
- guint32 stop,
- gint *nevents_return)
-{
- GdkTimeCoord *coords;
- XDeviceTimeCoord *device_coords;
- GdkInputWindow *input_window;
- GdkDevicePrivate *gdkdev;
-
- int mode_return;
- int axis_count_return;
- int i;
-
- gdkdev = gdk_input_find_device (deviceid);
- input_window = gdk_input_window_find (window);
-
- g_return_val_if_fail (gdkdev != NULL, NULL);
- g_return_val_if_fail (gdkdev->xdevice != NULL, NULL);
- g_return_val_if_fail (input_window != NULL, NULL);
-
- device_coords = XGetDeviceMotionEvents (gdk_display,
- gdkdev->xdevice,
- start, stop,
- nevents_return, &mode_return,
- &axis_count_return);
-
- if (device_coords)
- {
- coords = g_new (GdkTimeCoord, *nevents_return);
-
- for (i=0; i<*nevents_return; i++)
- {
- gdk_input_translate_coordinates (gdkdev, input_window,
- device_coords[i].data,
- &coords[i].x, &coords[i].y,
- &coords[i].pressure,
- &coords[i].xtilt, &coords[i].ytilt);
- }
- XFreeDeviceMotionEvents (device_coords);
-
- return coords;
- }
- else
- return NULL;
-}
-
-static void
-gdk_input_common_get_pointer (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask)
-{
- GdkDevicePrivate *gdkdev;
- GdkInputWindow *input_window;
- XDeviceState *state;
- XInputClass *input_class;
- gint x_int, y_int;
- gint i;
-
- /* we probably need to get the mask in any case */
-
- if (deviceid == GDK_CORE_POINTER)
- {
- gdk_window_get_pointer (window, &x_int, &y_int, mask);
- if (x) *x = x_int;
- if (y) *y = y_int;
- if (pressure) *pressure = 0.5;
- if (xtilt) *xtilt = 0;
- if (ytilt) *ytilt = 0;
- }
- else
- {
- if (mask)
- gdk_window_get_pointer (window, NULL, NULL, mask);
-
- gdkdev = gdk_input_find_device (deviceid);
- input_window = gdk_input_window_find (window);
-
- g_return_if_fail (gdkdev != NULL);
- g_return_if_fail (gdkdev->xdevice != NULL);
- g_return_if_fail (input_window != NULL);
-
- state = XQueryDeviceState (gdk_display, gdkdev->xdevice);
- input_class = state->data;
- for (i=0; i<state->num_classes; i++)
- {
- switch (input_class->class)
- {
- case ValuatorClass:
- gdk_input_translate_coordinates (gdkdev, input_window,
- ((XValuatorState *)input_class)->valuators,
- x, y, pressure,
- xtilt, ytilt);
-
-
- break;
- case ButtonClass:
- if (mask)
- {
- *mask &= 0xFF;
- if (((XButtonState *)input_class)->num_buttons > 0)
- *mask |= ((XButtonState *)input_class)->buttons[0] << 7;
- /* GDK_BUTTON1_MASK = 1 << 8, and button n is stored
- * in bit 1<<(n%8) in byte n/8. n = 1,2,... */
- }
- break;
- }
- input_class = (XInputClass *)(((char *)input_class)+input_class->length);
- }
- }
-}
-
-#endif
diff --git a/gdk/x11/gdkinput-xfree.c b/gdk/x11/gdkinput-xfree.c
deleted file mode 100644
index 704c11aefa..0000000000
--- a/gdk/x11/gdkinput-xfree.c
+++ /dev/null
@@ -1,342 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifdef XINPUT_XFREE
-
-/* forward declarations */
-
-static gint gdk_input_xfree_set_mode (guint32 deviceid, GdkInputMode mode);
-static void gdk_input_check_proximity();
-static void gdk_input_xfree_configure_event (XConfigureEvent *xevent,
- GdkWindow *window);
-static void gdk_input_xfree_enter_event (XCrossingEvent *xevent,
- GdkWindow *window);
-static gint gdk_input_xfree_other_event (GdkEvent *event,
- XEvent *xevent,
- GdkWindow *window);
-static gint gdk_input_xfree_enable_window(GdkWindow *window,
- GdkDevicePrivate *gdkdev);
-static gint gdk_input_xfree_disable_window(GdkWindow *window,
- GdkDevicePrivate *gdkdev);
-static gint gdk_input_xfree_grab_pointer (GdkWindow * window,
- gint owner_events,
- GdkEventMask event_mask,
- GdkWindow * confine_to,
- guint32 time);
-static void gdk_input_xfree_ungrab_pointer (guint32 time);
-
-void
-gdk_input_init(void)
-{
- gdk_input_vtable.set_mode = gdk_input_xfree_set_mode;
- gdk_input_vtable.set_axes = gdk_input_common_set_axes;
- gdk_input_vtable.set_key = gdk_input_common_set_key;
- gdk_input_vtable.motion_events = gdk_input_common_motion_events;
- gdk_input_vtable.get_pointer = gdk_input_common_get_pointer;
- gdk_input_vtable.grab_pointer = gdk_input_xfree_grab_pointer;
- gdk_input_vtable.ungrab_pointer = gdk_input_xfree_ungrab_pointer;
- gdk_input_vtable.configure_event = gdk_input_xfree_configure_event;
- gdk_input_vtable.enter_event = gdk_input_xfree_enter_event;
- gdk_input_vtable.other_event = gdk_input_xfree_other_event;
- gdk_input_vtable.window_none_event = NULL;
- gdk_input_vtable.enable_window = gdk_input_xfree_enable_window;
- gdk_input_vtable.disable_window = gdk_input_xfree_disable_window;
-
- gdk_input_ignore_core = FALSE;
- gdk_input_common_init(FALSE);
-}
-
-static gint
-gdk_input_xfree_set_mode (guint32 deviceid, GdkInputMode mode)
-{
- GList *tmp_list;
- GdkDevicePrivate *gdkdev;
- GdkInputMode old_mode;
- GdkInputWindow *input_window;
-
- gdkdev = gdk_input_find_device(deviceid);
- g_return_val_if_fail (gdkdev != NULL,FALSE);
- old_mode = gdkdev->info.mode;
-
- if (gdkdev->info.mode == mode)
- return TRUE;
-
- gdkdev->info.mode = mode;
-
- if (mode == GDK_MODE_WINDOW)
- {
- gdkdev->info.has_cursor = FALSE;
- for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
- {
- input_window = (GdkInputWindow *)tmp_list->data;
- if (input_window->mode != GDK_EXTENSION_EVENTS_CURSOR)
- gdk_input_enable_window (input_window->window, gdkdev);
- else
- if (old_mode != GDK_MODE_DISABLED)
- gdk_input_disable_window (input_window->window, gdkdev);
- }
- }
- else if (mode == GDK_MODE_SCREEN)
- {
- gdkdev->info.has_cursor = TRUE;
- for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
- gdk_input_enable_window (((GdkInputWindow *)tmp_list->data)->window,
- gdkdev);
- }
- else /* mode == GDK_MODE_DISABLED */
- {
- for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
- {
- input_window = (GdkInputWindow *)tmp_list->data;
- if (old_mode != GDK_MODE_WINDOW ||
- input_window->mode != GDK_EXTENSION_EVENTS_CURSOR)
- gdk_input_disable_window (input_window->window, gdkdev);
- }
- }
-
- return TRUE;
-
-}
-
-static void
-gdk_input_check_proximity()
-{
- gint new_proximity = 0;
- GList *tmp_list = gdk_input_devices;
-
- while (tmp_list && !new_proximity)
- {
- GdkDevicePrivate *gdkdev = (GdkDevicePrivate *)(tmp_list->data);
-
- if (gdkdev->info.mode != GDK_MODE_DISABLED
- && gdkdev->info.deviceid != GDK_CORE_POINTER
- && gdkdev->xdevice)
- {
- XDeviceState *state = XQueryDeviceState(GDK_DISPLAY(),
- gdkdev->xdevice);
- XInputClass *xic;
- int i;
-
- xic = state->data;
- for (i=0; i<state->num_classes; i++)
- {
- if (xic->class == ValuatorClass)
- {
- XValuatorState *xvs = (XValuatorState *)xic;
- if ((xvs->mode & ProximityState) == InProximity)
- {
- new_proximity = TRUE;
- }
- break;
- }
- xic = (XInputClass *)((char *)xic + xic->length);
- }
- }
- tmp_list = tmp_list->next;
- }
-
- gdk_input_ignore_core = new_proximity;
-}
-
-static void
-gdk_input_xfree_configure_event (XConfigureEvent *xevent, GdkWindow *window)
-{
- GdkInputWindow *input_window;
- gint root_x, root_y;
-
- input_window = gdk_input_window_find(window);
- g_return_if_fail (window != NULL);
-
- gdk_input_get_root_relative_geometry(GDK_DISPLAY(),GDK_WINDOW_XWINDOW(window),
- &root_x,
- &root_y, NULL, NULL);
-
- input_window->root_x = root_x;
- input_window->root_y = root_y;
-}
-
-static void
-gdk_input_xfree_enter_event (XCrossingEvent *xevent,
- GdkWindow *window)
-{
- GdkInputWindow *input_window;
- gint root_x, root_y;
-
- input_window = gdk_input_window_find(window);
- g_return_if_fail (window != NULL);
-
- gdk_input_check_proximity();
-
- gdk_input_get_root_relative_geometry(GDK_DISPLAY(),GDK_WINDOW_XWINDOW(window),
- &root_x,
- &root_y, NULL, NULL);
-
- input_window->root_x = root_x;
- input_window->root_y = root_y;
-}
-
-static gint
-gdk_input_xfree_other_event (GdkEvent *event,
- XEvent *xevent,
- GdkWindow *window)
-{
- GdkInputWindow *input_window;
-
- GdkDevicePrivate *gdkdev;
- gint return_val;
-
- input_window = gdk_input_window_find(window);
- g_return_val_if_fail (window != NULL, -1);
-
- /* This is a sort of a hack, as there isn't any XDeviceAnyEvent -
- but it's potentially faster than scanning through the types of
- every device. If we were deceived, then it won't match any of
- the types for the device anyways */
- gdkdev = gdk_input_find_device(((XDeviceButtonEvent *)xevent)->deviceid);
-
- if (!gdkdev) {
- return -1; /* we don't handle it - not an XInput event */
- }
-
- /* FIXME: It would be nice if we could just get rid of the events
- entirely, instead of having to ignore them */
- if (gdkdev->info.mode == GDK_MODE_DISABLED ||
- (gdkdev->info.mode == GDK_MODE_WINDOW
- && input_window->mode == GDK_EXTENSION_EVENTS_CURSOR))
- return FALSE;
-
- if (!gdk_input_ignore_core)
- gdk_input_check_proximity();
-
- return_val = gdk_input_common_other_event (event, xevent,
- input_window, gdkdev);
-
- if (return_val > 0 && event->type == GDK_PROXIMITY_OUT &&
- gdk_input_ignore_core)
- gdk_input_check_proximity();
-
- return return_val;
-}
-
-static gint
-gdk_input_xfree_enable_window(GdkWindow *window, GdkDevicePrivate *gdkdev)
-{
- /* FIXME: watchout, gdkdev might be core pointer, never opened */
- gdk_input_common_select_events (window, gdkdev);
- return TRUE;
-}
-
-static gint
-gdk_input_xfree_disable_window(GdkWindow *window, GdkDevicePrivate *gdkdev)
-{
- gdk_input_common_select_events (window, gdkdev);
- return TRUE;
-}
-
-static gint
-gdk_input_xfree_grab_pointer (GdkWindow * window,
- gint owner_events,
- GdkEventMask event_mask,
- GdkWindow * confine_to,
- guint32 time)
-{
- GdkInputWindow *input_window, *new_window;
- GdkDevicePrivate *gdkdev;
- GList *tmp_list;
- XEventClass event_classes[GDK_MAX_DEVICE_CLASSES];
- gint num_classes;
- gint result;
-
- tmp_list = gdk_input_windows;
- new_window = NULL;
- while (tmp_list)
- {
- input_window = (GdkInputWindow *)tmp_list->data;
- if (input_window->grabbed)
- return AlreadyGrabbed;
-
- if (input_window->window == window)
- new_window = input_window;
-
- tmp_list = tmp_list->next;
- }
-
- g_return_val_if_fail (new_window != NULL, Success); /* shouldn't happen */
-
- new_window->grabbed = TRUE;
-
- tmp_list = gdk_input_devices;
- while (tmp_list)
- {
- gdkdev = (GdkDevicePrivate *)tmp_list->data;
- if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
- gdkdev->xdevice)
- {
- gdk_input_common_find_events (window, gdkdev,
- event_mask,
- event_classes, &num_classes);
-
- result = XGrabDevice( GDK_DISPLAY(), gdkdev->xdevice,
- GDK_WINDOW_XWINDOW (window),
- owner_events, num_classes, event_classes,
- GrabModeAsync, GrabModeAsync, time);
-
- /* FIXME: if failure occurs on something other than the first
- device, things will be badly inconsistent */
- if (result != Success)
- return result;
- }
- tmp_list = tmp_list->next;
- }
-
- return Success;
-}
-
-static void
-gdk_input_xfree_ungrab_pointer (guint32 time)
-{
- GdkInputWindow *input_window;
- GdkDevicePrivate *gdkdev;
- GList *tmp_list;
-
- tmp_list = gdk_input_windows;
- while (tmp_list)
- {
- input_window = (GdkInputWindow *)tmp_list->data;
- if (input_window->grabbed)
- break;
- tmp_list = tmp_list->next;
- }
-
- if (tmp_list) /* we found a grabbed window */
- {
- input_window->grabbed = FALSE;
-
- tmp_list = gdk_input_devices;
- while (tmp_list)
- {
- gdkdev = (GdkDevicePrivate *)tmp_list->data;
- if (gdkdev->info.deviceid != GDK_CORE_POINTER && gdkdev->xdevice)
- XUngrabDevice( gdk_display, gdkdev->xdevice, time);
-
- tmp_list = tmp_list->next;
- }
- }
-}
-
-#endif /* XINPUT_XFREE */
diff --git a/gdk/x11/gdkinput.c b/gdk/x11/gdkinput.c
deleted file mode 100644
index 8a66b8365f..0000000000
--- a/gdk/x11/gdkinput.c
+++ /dev/null
@@ -1,344 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <stdlib.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include "../config.h"
-#include "gdk.h"
-#include "gdkx.h"
-#include "gdkprivate.h"
-#include "gdkinput.h"
-
-
-/* Forward declarations */
-
-static gint gdk_input_enable_window (GdkWindow *window,
- GdkDevicePrivate *gdkdev);
-static gint gdk_input_disable_window (GdkWindow *window,
- GdkDevicePrivate *gdkdev);
-static GdkInputWindow *gdk_input_window_find (GdkWindow *window);
-static GdkDevicePrivate *gdk_input_find_device (guint32 id);
-
-
-/* Incorporate the specific routines depending on compilation options */
-
-static GdkAxisUse gdk_input_core_axes[] = { GDK_AXIS_X, GDK_AXIS_Y };
-
-static GdkDeviceInfo gdk_input_core_info =
-{
- GDK_CORE_POINTER,
- "Core Pointer",
- GDK_SOURCE_MOUSE,
- GDK_MODE_SCREEN,
- TRUE,
- 2,
- gdk_input_core_axes
-};
-
-/* Global variables */
-
-GdkInputVTable gdk_input_vtable;
-/* information about network port and host for gxid daemon */
-gchar *gdk_input_gxid_host;
-gint gdk_input_gxid_port;
-gint gdk_input_ignore_core;
-
-/* Local variables */
-
-static GList *gdk_input_devices;
-static GList *gdk_input_windows;
-
-#include "gdkinputnone.h"
-#include "gdkinputcommon.h"
-#include "gdkinputxfree.h"
-#include "gdkinputgxi.h"
-
-GList *
-gdk_input_list_devices ()
-{
- return gdk_input_devices;
-}
-
-void
-gdk_input_set_source (guint32 deviceid, GdkInputSource source)
-{
- GdkDevicePrivate *gdkdev = gdk_input_find_device(deviceid);
- g_return_if_fail (gdkdev != NULL);
-
- gdkdev->info.source = source;
-}
-
-gint
-gdk_input_set_mode (guint32 deviceid, GdkInputMode mode)
-{
- if (deviceid == GDK_CORE_POINTER)
- return FALSE;
-
- if (gdk_input_vtable.set_mode)
- return gdk_input_vtable.set_mode(deviceid,mode);
- else
- return FALSE;
-}
-
-void
-gdk_input_set_axes (guint32 deviceid, GdkAxisUse *axes)
-{
- if (deviceid != GDK_CORE_POINTER && gdk_input_vtable.set_axes)
- gdk_input_vtable.set_axes (deviceid, axes);
-}
-
-void gdk_input_set_key (guint32 deviceid,
- guint index,
- guint keyval,
- GdkModifierType modifiers)
-{
- if (deviceid != GDK_CORE_POINTER && gdk_input_vtable.set_key)
- gdk_input_vtable.set_key (deviceid, index, keyval, modifiers);
-}
-
-GdkTimeCoord *
-gdk_input_motion_events (GdkWindow *window,
- guint32 deviceid,
- guint32 start,
- guint32 stop,
- gint *nevents_return)
-{
- GdkWindowPrivate *window_private;
- XTimeCoord *xcoords;
- GdkTimeCoord *coords;
- int i;
-
- g_return_val_if_fail (window != NULL, NULL);
- window_private = (GdkWindowPrivate *) window;
- if (window_private->destroyed)
- return NULL;
-
- if (deviceid == GDK_CORE_POINTER)
- {
- xcoords = XGetMotionEvents (gdk_display,
- window_private->xwindow,
- start, stop, nevents_return);
- if (xcoords)
- {
- coords = g_new (GdkTimeCoord, *nevents_return);
- for (i=0; i<*nevents_return; i++)
- {
- coords[i].time = xcoords[i].time;
- coords[i].x = xcoords[i].x;
- coords[i].y = xcoords[i].y;
- coords[i].pressure = 0.5;
- coords[i].xtilt = 0.0;
- coords[i].ytilt = 0.0;
- }
-
- XFree(xcoords);
-
- return coords;
- }
- else
- return NULL;
- }
- else
- {
- if (gdk_input_vtable.motion_events)
- {
- return gdk_input_vtable.motion_events(window,
- deviceid, start, stop,
- nevents_return);
- }
- else
- {
- *nevents_return = 0;
- return NULL;
- }
- }
-}
-
-static gint
-gdk_input_enable_window (GdkWindow *window, GdkDevicePrivate *gdkdev)
-{
- if (gdk_input_vtable.enable_window)
- return gdk_input_vtable.enable_window (window, gdkdev);
- else
- return TRUE;
-}
-
-static gint
-gdk_input_disable_window (GdkWindow *window, GdkDevicePrivate *gdkdev)
-{
- if (gdk_input_vtable.disable_window)
- return gdk_input_vtable.disable_window(window,gdkdev);
- else
- return TRUE;
-}
-
-
-static GdkInputWindow *
-gdk_input_window_find(GdkWindow *window)
-{
- GList *tmp_list;
-
- for (tmp_list=gdk_input_windows; tmp_list; tmp_list=tmp_list->next)
- if (((GdkInputWindow *)(tmp_list->data))->window == window)
- return (GdkInputWindow *)(tmp_list->data);
-
- return NULL; /* Not found */
-}
-
-/* FIXME: this routine currently needs to be called between creation
- and the corresponding configure event (because it doesn't get the
- root_relative_geometry). This should work with
- gtk_window_set_extension_events, but will likely fail in other
- cases */
-
-void
-gdk_input_set_extension_events (GdkWindow *window, gint mask,
- GdkExtensionMode mode)
-{
- GdkWindowPrivate *window_private;
- GList *tmp_list;
- GdkInputWindow *iw;
-
- g_return_if_fail (window != NULL);
- window_private = (GdkWindowPrivate*) window;
- if (window_private->destroyed)
- return;
-
- if (mode == GDK_EXTENSION_EVENTS_NONE)
- mask = 0;
-
- if (mask != 0)
- {
- iw = g_new(GdkInputWindow,1);
-
- iw->window = window;
- iw->mode = mode;
-
- iw->obscuring = NULL;
- iw->num_obscuring = 0;
- iw->grabbed = FALSE;
-
- gdk_input_windows = g_list_append(gdk_input_windows,iw);
- window_private->extension_events = mask;
-
- /* Add enter window events to the event mask */
- /* FIXME, this is not needed for XINPUT_NONE */
- gdk_window_set_events (window,
- gdk_window_get_events (window) |
- GDK_ENTER_NOTIFY_MASK);
- }
- else
- {
- iw = gdk_input_window_find (window);
- if (iw)
- {
- gdk_input_windows = g_list_remove(gdk_input_windows,iw);
- g_free(iw);
- }
-
- window_private->extension_events = 0;
- }
-
- for (tmp_list = gdk_input_devices; tmp_list; tmp_list = tmp_list->next)
- {
- GdkDevicePrivate *gdkdev = (GdkDevicePrivate *)(tmp_list->data);
-
- if (gdkdev->info.deviceid != GDK_CORE_POINTER)
- {
- if (mask != 0 && gdkdev->info.mode != GDK_MODE_DISABLED
- && (gdkdev->info.has_cursor || mode == GDK_EXTENSION_EVENTS_ALL))
- gdk_input_enable_window(window,gdkdev);
- else
- gdk_input_disable_window(window,gdkdev);
- }
- }
-}
-
-void
-gdk_input_window_destroy (GdkWindow *window)
-{
- GdkInputWindow *input_window;
-
- input_window = gdk_input_window_find (window);
- g_return_if_fail (input_window != NULL);
-
- gdk_input_windows = g_list_remove (gdk_input_windows,input_window);
- g_free(input_window);
-}
-
-void
-gdk_input_exit (void)
-{
- GList *tmp_list;
- GdkDevicePrivate *gdkdev;
-
- for (tmp_list = gdk_input_devices; tmp_list; tmp_list = tmp_list->next)
- {
- gdkdev = (GdkDevicePrivate *)(tmp_list->data);
- if (gdkdev->info.deviceid != GDK_CORE_POINTER)
- {
- gdk_input_set_mode(gdkdev->info.deviceid,GDK_MODE_DISABLED);
-
- g_free(gdkdev->info.name);
-#ifndef XINPUT_NONE
- g_free(gdkdev->axes);
-#endif
- g_free(gdkdev->info.axes);
- g_free(gdkdev->info.keys);
- g_free(gdkdev);
- }
- }
-
- g_list_free(gdk_input_devices);
-
- for (tmp_list = gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
- {
- g_free(tmp_list->data);
- }
- g_list_free(gdk_input_windows);
-}
-
-static GdkDevicePrivate *
-gdk_input_find_device(guint32 id)
-{
- GList *tmp_list = gdk_input_devices;
- GdkDevicePrivate *gdkdev;
- while (tmp_list)
- {
- gdkdev = (GdkDevicePrivate *)(tmp_list->data);
- if (gdkdev->info.deviceid == id)
- return gdkdev;
- tmp_list = tmp_list->next;
- }
- return NULL;
-}
-
-void
-gdk_input_window_get_pointer (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask)
-{
- if (gdk_input_vtable.get_pointer)
- gdk_input_vtable.get_pointer (window, deviceid, x, y, pressure,
- xtilt, ytilt, mask);
-}
diff --git a/gdk/x11/gdkmain-x11.c b/gdk/x11/gdkmain-x11.c
deleted file mode 100644
index 16d43da2bf..0000000000
--- a/gdk/x11/gdkmain-x11.c
+++ /dev/null
@@ -1,4035 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "../config.h"
-
-/* If you don't want to use gdk's signal handlers define this */
-/* #define I_NEED_TO_ACTUALLY_DEBUG_MY_PROGRAMS 1 */
-
-#include <X11/Xlocale.h>
-#include <ctype.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#ifdef USE_XIM
-#include <stdarg.h>
-#endif
-
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif /* HAVE_SYS_SELECT_H_ */
-
-#define XLIB_ILLEGAL_ACCESS
-#include <X11/Xatom.h>
-#include <X11/Xlib.h>
-#include <X11/Xos.h>
-#include <X11/Xutil.h>
-#include <X11/Xmu/WinUtil.h>
-#ifdef USE_XIM
-#include <X11/Xresource.h>
-#endif
-#include <X11/cursorfont.h>
-#include "gdk.h"
-#include "gdkprivate.h"
-#include "gdkinput.h"
-#ifdef USE_XIM
-#include "gdkx.h"
-#include "gdkkeysyms.h"
-#endif
-#include "gdki18n.h"
-
-#ifndef X_GETTIMEOFDAY
-#define X_GETTIMEOFDAY(tv) gettimeofday (tv, NULL)
-#endif /* X_GETTIMEOFDAY */
-
-
-#define DOUBLE_CLICK_TIME 250
-#define TRIPLE_CLICK_TIME 500
-#define DOUBLE_CLICK_DIST 5
-#define TRIPLE_CLICK_DIST 5
-
-
-#ifndef NO_FD_SET
-# define SELECT_MASK fd_set
-#else
-# ifndef _AIX
- typedef long fd_mask;
-# endif
-# if defined(_IBMR2)
-# define SELECT_MASK void
-# else
-# define SELECT_MASK int
-# endif
-#endif
-
-
-typedef struct _GdkInput GdkInput;
-typedef struct _GdkPredicate GdkPredicate;
-
-struct _GdkInput
-{
- gint tag;
- gint source;
- GdkInputCondition condition;
- GdkInputFunction function;
- gpointer data;
- GdkDestroyNotify destroy;
-};
-
-struct _GdkPredicate
-{
- GdkEventFunc func;
- gpointer data;
-};
-
-/*
- * Private function declarations
- */
-
-static GdkEvent *gdk_event_new (void);
-static gint gdk_event_wait (void);
-static gint gdk_event_apply_filters (XEvent *xevent,
- GdkEvent *event,
- GList *filters);
-static gint gdk_event_translate (GdkEvent *event,
- XEvent *xevent);
-#if 0
-static Bool gdk_event_get_type (Display *display,
- XEvent *xevent,
- XPointer arg);
-#endif
-static void gdk_synthesize_click (GdkEvent *event,
- gint nclicks);
-
-static void gdk_dnd_drag_begin (GdkWindow *initial_window);
-static void gdk_dnd_drag_enter (Window dest);
-static void gdk_dnd_drag_leave (Window dest);
-static void gdk_dnd_drag_end (Window dest,
- GdkPoint coords);
-static GdkAtom gdk_dnd_check_types (GdkWindow *window,
- XEvent *xevent);
-#ifdef DEBUG_DND
-static void gdk_print_atom (GdkAtom anatom);
-#endif
-
-/*
- * old junk from offix, we might use it though so leave it
- */
-Window gdk_get_client_window (Display *dpy,
- Window win);
-#ifdef WE_HAVE_MOTIF_DROPS_DONE
-static GdkWindow * gdk_drop_get_real_window (GdkWindow *w,
- guint16 *x,
- guint16 *y);
-#endif
-static void gdk_exit_func (void);
-static int gdk_x_error (Display *display,
- XErrorEvent *error);
-static int gdk_x_io_error (Display *display);
-static RETSIGTYPE gdk_signal (int signum);
-
-
-#ifdef USE_XIM
-static GdkIM gdk_im_get (void);
-static gint gdk_im_open (XrmDatabase db,
- gchar* res_name,
- gchar* rec_class);
-static void gdk_im_close (void);
-static void gdk_ic_cleanup (void);
-#endif /* USE_XIM */
-
-/* Private variable declarations
- */
-static int initialized = 0; /* 1 if the library is initialized,
- * 0 otherwise.
- */
-static int connection_number = 0; /* The file descriptor number of our
- * connection to the X server. This
- * is used so that we may determine
- * when events are pending by using
- * the "select" system call.
- */
-
-
-static struct timeval start; /* The time at which the library was
- * last initialized.
- */
-static struct timeval timer; /* Timeout interval to use in the call
- * to "select". This is used in
- * conjunction with "timerp" to create
- * a maximum time to wait for an event
- * to arrive.
- */
-static struct timeval *timerp; /* The actual timer passed to "select"
- * This may be NULL, in which case
- * "select" will block until an event
- * arrives.
- */
-static guint32 timer_val; /* The timeout length as specified by
- * the user in milliseconds.
- */
-static GList *inputs; /* A list of the input file descriptors
- * that we care about. Each list node
- * contains a GdkInput struct that describes
- * when we are interested in the specified
- * file descriptor. That is, when it is
- * available for read, write or has an
- * exception pending.
- */
-static guint32 button_click_time[2]; /* The last 2 button click times. Used
- * to determine if the latest button click
- * is part of a double or triple click.
- */
-static GdkWindow *button_window[2]; /* The last 2 windows to receive button presses.
- * Also used to determine if the latest button
- * click is part of a double or triple click.
- */
-static guint button_number[2]; /* The last 2 buttons to be pressed.
- */
-static GdkWindowPrivate *xgrab_window = NULL; /* Window that currently holds the
- * x pointer grab
- */
-
-#ifdef USE_XIM
-static gint xim_using; /* using XIM Protocol if TRUE */
-static GdkIM xim_im; /* global IM */
-static XIMStyles* xim_styles; /* im supports these styles */
-static XIMStyle xim_best_allowed_style;
-static GdkICPrivate *xim_ic; /* currently using IC */
-static GdkWindow* xim_window; /* currently using Widow */
-static GList* xim_ic_list;
-
-#endif
-
-#define OTHER_XEVENT_BUFSIZE 4
-static XEvent other_xevent[OTHER_XEVENT_BUFSIZE]; /* XEvents passed along to user */
-static int other_xevent_i = 0;
-static GList *putback_events = NULL;
-
-static gulong base_id;
-static gint autorepeat;
-
-#ifdef G_ENABLE_DEBUG
-static GDebugKey gdk_debug_keys[] = {
- {"events", GDK_DEBUG_EVENTS},
- {"misc", GDK_DEBUG_MISC},
- {"dnd", GDK_DEBUG_DND},
- {"color-context", GDK_DEBUG_COLOR_CONTEXT},
- {"xim", GDK_DEBUG_XIM}
-};
-
-static const int gdk_ndebug_keys = sizeof(gdk_debug_keys)/sizeof(GDebugKey);
-
-#endif /* G_ENABLE_DEBUG */
-
-/*
- *--------------------------------------------------------------
- * gdk_init
- *
- * Initialize the library for use.
- *
- * Arguments:
- * "argc" is the number of arguments.
- * "argv" is an array of strings.
- *
- * Results:
- * "argc" and "argv" are modified to reflect any arguments
- * which were not handled. (Such arguments should either
- * be handled by the application or dismissed).
- *
- * Side effects:
- * The library is initialized.
- *
- *--------------------------------------------------------------
- */
-
-void
-gdk_init (int *argc,
- char ***argv)
-{
- XKeyboardState keyboard_state;
- gint synchronize;
- gint i, j, k;
- XClassHint *class_hint;
- gint argc_orig = *argc;
- gchar **argv_orig;
-
- argv_orig = g_malloc ((argc_orig + 1) * sizeof (char*));
- for (i = 0; i < argc_orig; i++)
- argv_orig[i] = g_strdup ((*argv)[i]);
- argv_orig[argc_orig] = NULL;
-
- X_GETTIMEOFDAY (&start);
-
-#ifndef I_NEED_TO_ACTUALLY_DEBUG_MY_PROGRAMS
- signal (SIGHUP, gdk_signal);
- signal (SIGINT, gdk_signal);
- signal (SIGQUIT, gdk_signal);
- signal (SIGBUS, gdk_signal);
- signal (SIGSEGV, gdk_signal);
- signal (SIGPIPE, gdk_signal);
- signal (SIGTERM, gdk_signal);
-#endif
-
- gdk_display_name = NULL;
-
- XSetErrorHandler (gdk_x_error);
- XSetIOErrorHandler (gdk_x_io_error);
-
- synchronize = FALSE;
-
-#ifdef G_ENABLE_DEBUG
- {
- gchar *debug_string = getenv("GDK_DEBUG");
- if (debug_string != NULL)
- gdk_debug_flags = g_parse_debug_string (debug_string,
- gdk_debug_keys,
- gdk_ndebug_keys);
- }
-#endif /* G_ENABLE_DEBUG */
-
- if (argc && argv)
- {
- if (*argc > 0)
- gdk_progname = (*argv)[0];
-
- for (i = 1; i < *argc;)
- {
- if ((*argv)[i] == NULL)
- {
- i += 1;
- continue;
- }
-
-#ifdef G_ENABLE_DEBUG
- if (strcmp ("--gdk-debug", (*argv)[i]) == 0)
- {
- (*argv)[i] = NULL;
-
- if ((i + 1) < *argc && (*argv)[i + 1])
- {
- gdk_debug_flags |= g_parse_debug_string ((*argv)[i+1],
- gdk_debug_keys,
- gdk_ndebug_keys);
- (*argv)[i + 1] = NULL;
- i += 1;
- }
- }
- else if (strcmp ("--gdk-no-debug", (*argv)[i]) == 0)
- {
- (*argv)[i] = NULL;
-
- if ((i + 1) < *argc && (*argv)[i + 1])
- {
- gdk_debug_flags &= ~g_parse_debug_string ((*argv)[i+1],
- gdk_debug_keys,
- gdk_ndebug_keys);
- (*argv)[i + 1] = NULL;
- i += 1;
- }
- }
-#endif /* G_ENABLE_DEBUG */
- else if (strcmp ("--display", (*argv)[i]) == 0)
- {
- (*argv)[i] = NULL;
-
- if ((i + 1) < *argc && (*argv)[i + 1])
- {
- gdk_display_name = g_strdup ((*argv)[i + 1]);
- (*argv)[i + 1] = NULL;
- i += 1;
- }
- }
- else if (strcmp ("--sync", (*argv)[i]) == 0)
- {
- (*argv)[i] = NULL;
- synchronize = TRUE;
- }
- else if (strcmp ("--no-xshm", (*argv)[i]) == 0)
- {
- (*argv)[i] = NULL;
- gdk_use_xshm = FALSE;
- }
- else if (strcmp ("--name", (*argv)[i]) == 0)
- {
- if ((i + 1) < *argc && (*argv)[i + 1])
- {
- (*argv)[i++] = NULL;
- gdk_progname = (*argv)[i];
- (*argv)[i] = NULL;
- }
- }
- else if (strcmp ("--class", (*argv)[i]) == 0)
- {
- if ((i + 1) < *argc && (*argv)[i + 1])
- {
- (*argv)[i++] = NULL;
- gdk_progclass = (*argv)[i];
- (*argv)[i] = NULL;
- }
- }
-#ifdef XINPUT_GXI
- else if (strcmp ("--gxid_host", (*argv)[i]) == 0)
- {
- if ((i + 1) < *argc && (*argv)[i + 1])
- {
- (*argv)[i++] = NULL;
- gdk_input_gxid_host = ((*argv)[i]);
- (*argv)[i] = NULL;
- }
- }
- else if (strcmp ("--gxid_port", (*argv)[i]) == 0)
- {
- if ((i + 1) < *argc && (*argv)[i + 1])
- {
- (*argv)[i++] = NULL;
- gdk_input_gxid_port = atoi ((*argv)[i]);
- (*argv)[i] = NULL;
- }
- }
-#endif
-#ifdef USE_XIM
- else if (strcmp ("--xim-preedit", (*argv)[i]) == 0)
- {
- if ((i + 1) < *argc && (*argv)[i + 1])
- {
- (*argv)[i++] = NULL;
- if (strcmp ("none", (*argv)[i]) == 0)
- gdk_im_set_best_style (GdkIMPreeditNone);
- else if (strcmp ("nothing", (*argv)[i]) == 0)
- gdk_im_set_best_style (GdkIMPreeditNothing);
- else if (strcmp ("area", (*argv)[i]) == 0)
- gdk_im_set_best_style (GdkIMPreeditArea);
- else if (strcmp ("position", (*argv)[i]) == 0)
- gdk_im_set_best_style (GdkIMPreeditPosition);
- else if (strcmp ("callbacks", (*argv)[i]) == 0)
- gdk_im_set_best_style (GdkIMPreeditCallbacks);
- }
- }
- else if (strcmp ("--xim-status", (*argv)[i]) == 0)
- {
- if ((i + 1) < *argc && (*argv)[i + 1])
- {
- (*argv)[i++] = NULL;
- if (strcmp ("none", (*argv)[i]) == 0)
- gdk_im_set_best_style (GdkIMStatusNone);
- else if (strcmp ("nothing", (*argv)[i]) == 0)
- gdk_im_set_best_style (GdkIMStatusNothing);
- else if (strcmp ("area", (*argv)[i]) == 0)
- gdk_im_set_best_style (GdkIMStatusArea);
- else if (strcmp ("callbacks", (*argv)[i]) == 0)
- gdk_im_set_best_style (GdkIMStatusCallbacks);
- }
- }
-#endif
-
- i += 1;
- }
-
- for (i = 1; i < *argc; i++)
- {
- for (k = i; k < *argc; k++)
- if ((*argv)[k] != NULL)
- break;
-
- if (k > i)
- {
- k -= i;
- for (j = i + k; j < *argc; j++)
- (*argv)[j-k] = (*argv)[j];
- *argc -= k;
- }
- }
- }
- else
- {
- gdk_progname = "<unknown>";
- }
-
- gdk_display = XOpenDisplay (gdk_display_name);
- if (!gdk_display)
- {
- g_warning ("cannot open display: %s", XDisplayName (gdk_display_name));
- exit(1);
- }
-
- /* This is really crappy. We have to look into the display structure
- * to find the base resource id. This is only needed for recording
- * and playback of events.
- */
- /* base_id = RESOURCE_BASE; */
- base_id = 0;
- GDK_NOTE (EVENTS, g_print ("base id: %lu\n", base_id));
-
- connection_number = ConnectionNumber (gdk_display);
- GDK_NOTE (MISC,
- g_print ("connection number: %d\n", connection_number));
-
- if (synchronize)
- XSynchronize (gdk_display, True);
-
- gdk_screen = DefaultScreen (gdk_display);
- gdk_root_window = RootWindow (gdk_display, gdk_screen);
-
- gdk_leader_window = XCreateSimpleWindow(gdk_display, gdk_root_window,
- 10, 10, 10, 10, 0, 0 , 0);
- class_hint = XAllocClassHint();
- class_hint->res_name = gdk_progname;
- if (gdk_progclass == NULL)
- {
- gdk_progclass = g_strdup (gdk_progname);
- gdk_progclass[0] = toupper (gdk_progclass[0]);
- }
- class_hint->res_class = gdk_progclass;
- XSetClassHint(gdk_display, gdk_leader_window, class_hint);
- XSetCommand(gdk_display, gdk_leader_window, argv_orig, argc_orig);
- XFree (class_hint);
-
- for (i = 0; i < argc_orig; i++)
- g_free(argv_orig[i]);
- g_free(argv_orig);
-
- gdk_wm_delete_window = XInternAtom (gdk_display, "WM_DELETE_WINDOW", True);
- gdk_wm_take_focus = XInternAtom (gdk_display, "WM_TAKE_FOCUS", True);
- gdk_wm_protocols = XInternAtom (gdk_display, "WM_PROTOCOLS", True);
- gdk_wm_window_protocols[0] = gdk_wm_delete_window;
- gdk_wm_window_protocols[1] = gdk_wm_take_focus;
- gdk_selection_property = XInternAtom (gdk_display, "GDK_SELECTION", False);
-
- gdk_dnd.gdk_XdeEnter = gdk_atom_intern("_XDE_ENTER", FALSE);
- gdk_dnd.gdk_XdeLeave = gdk_atom_intern("_XDE_LEAVE", FALSE);
- gdk_dnd.gdk_XdeRequest = gdk_atom_intern("_XDE_REQUEST", FALSE);
- gdk_dnd.gdk_XdeDataAvailable = gdk_atom_intern("_XDE_DATA_AVAILABLE", FALSE);
- gdk_dnd.gdk_XdeTypelist = gdk_atom_intern("_XDE_TYPELIST", FALSE);
- gdk_dnd.c->gdk_cursor_dragdefault = XCreateFontCursor(gdk_display, XC_bogosity);
- gdk_dnd.c->gdk_cursor_dragok = XCreateFontCursor(gdk_display, XC_heart);
-
- XGetKeyboardControl (gdk_display, &keyboard_state);
- autorepeat = keyboard_state.global_auto_repeat;
-
- timer.tv_sec = 0;
- timer.tv_usec = 0;
- timerp = NULL;
-
- button_click_time[0] = 0;
- button_click_time[1] = 0;
- button_window[0] = NULL;
- button_window[1] = NULL;
- button_number[0] = -1;
- button_number[1] = -1;
-
- if (ATEXIT (gdk_exit_func))
- g_warning ("unable to register exit function");
-
- gdk_visual_init ();
- gdk_window_init ();
- gdk_image_init ();
- gdk_input_init ();
-
-#ifdef USE_XIM
- /* initialize XIM Protocol variables */
- xim_using = FALSE;
- xim_im = NULL;
- xim_styles = NULL;
- if (!(xim_best_allowed_style & GdkIMPreeditMask))
- gdk_im_set_best_style (GdkIMPreeditCallbacks);
- if (!(xim_best_allowed_style & GdkIMStatusMask))
- gdk_im_set_best_style (GdkIMStatusCallbacks);
- xim_ic = NULL;
- xim_window = (GdkWindow*)NULL;
-
- gdk_im_open (NULL, NULL, NULL);
-#endif
-
- initialized = 1;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_exit
- *
- * Restores the library to an un-itialized state and exits
- * the program using the "exit" system call.
- *
- * Arguments:
- * "errorcode" is the error value to pass to "exit".
- *
- * Results:
- * Allocated structures are freed and the program exits
- * cleanly.
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-void
-gdk_exit (int errorcode)
-{
- /* de-initialisation is done by the gdk_exit_funct(),
- no need to do this here (Alex J.) */
- exit (errorcode);
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_set_locale
- *
- * Arguments:
- *
- * Results:
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-gchar*
-gdk_set_locale ()
-{
- if (!setlocale (LC_ALL,""))
- g_print ("locale not supported by C library\n");
-
- if (!XSupportsLocale ())
- {
- g_print ("locale not supported by Xlib, locale set to C\n");
- setlocale (LC_ALL, "C");
- }
-
- if (!XSetLocaleModifiers (""))
- {
- g_print ("can not set locale modifiers\n");
- }
-
- return setlocale (LC_ALL,NULL);
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_events_pending
- *
- * Returns the number of events pending on the queue.
- * These events have already been read from the server
- * connection.
- *
- * Arguments:
- *
- * Results:
- * Returns the number of events on XLib's event queue.
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-gint
-gdk_events_pending ()
-{
- gint result;
- GList *tmp_list;
-
- result = XPending (gdk_display);
-
- tmp_list = putback_events;
- while (tmp_list)
- {
- result++;
- tmp_list = tmp_list->next;
- }
-
- return result;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_event_get_graphics_expose
- *
- * Waits for a GraphicsExpose or NoExpose event
- *
- * Arguments:
- *
- * Results:
- * For GraphicsExpose events, returns a pointer to the event
- * converted into a GdkEvent Otherwise, returns NULL.
- *
- * Side effects:
- *
- *-------------------------------------------------------------- */
-
-static Bool
-graphics_expose_predicate (Display *display,
- XEvent *xevent,
- XPointer arg)
-{
- GdkWindowPrivate *private = (GdkWindowPrivate *)arg;
-
- g_return_val_if_fail (private != NULL, False);
-
- if ((xevent->xany.window == private->xwindow) &&
- ((xevent->xany.type == GraphicsExpose) ||
- (xevent->xany.type == NoExpose)))
- return True;
- else
- return False;
-}
-
-GdkEvent *
-gdk_event_get_graphics_expose (GdkWindow *window)
-{
- XEvent xevent;
- GdkEvent *event;
-
- g_return_val_if_fail (window != NULL, NULL);
-
- XIfEvent (gdk_display, &xevent, graphics_expose_predicate, (XPointer)window);
-
- if (xevent.xany.type == GraphicsExpose)
- {
- event = gdk_event_new ();
-
- if (gdk_event_translate (event, &xevent))
- return event;
- else
- gdk_event_free (event);
- }
-
- return NULL;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_event_get
- *
- * Gets the next event.
- *
- * Arguments:
- *
- * Results:
- * If an event was received that we care about, returns
- * a pointer to that event, to be freed with gdk_event_free.
- * Otherwise, returns NULL. This function will also return
- * before an event is received if the timeout interval
- * runs out.
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-GdkEvent *
-gdk_event_get (void)
-{
- GdkEvent *event;
- GList *temp_list;
- XEvent xevent;
-
-#if 0
- if (pred)
- {
- temp_list = putback_events;
- while (temp_list)
- {
- temp_event = temp_list->data;
-
- if ((* pred) (temp_event, data))
- {
- if (event)
- *event = *temp_event;
- putback_events = g_list_remove_link (putback_events, temp_list);
- g_list_free (temp_list);
- return TRUE;
- }
-
- temp_list = temp_list->next;
- }
-
- event_pred.func = pred;
- event_pred.data = data;
-
- if (XCheckIfEvent (gdk_display, &xevent, gdk_event_get_type, (XPointer) & event_pred))
- if (event)
- return gdk_event_translate (event, &xevent);
- }
- else
-#endif
- if (putback_events)
- {
- event = putback_events->data;
-
- temp_list = putback_events;
- putback_events = g_list_remove_link (putback_events, temp_list);
- g_list_free_1 (temp_list);
-
- return event;
- }
-
- /* Wait for an event to occur or the timeout to elapse.
- * If an event occurs "gdk_event_wait" will return TRUE.
- * If the timeout elapses "gdk_event_wait" will return
- * FALSE.
- */
- if (gdk_event_wait ())
- {
- /* If we get here we can rest assurred that an event
- * has occurred. Read it.
- */
-#ifdef USE_XIM
- gint filter_status;
- if (xim_using && xim_window)
- do
- { /* don't dispatch events used by IM */
- XNextEvent (gdk_display, &xevent);
- filter_status = XFilterEvent (&xevent,
- GDK_WINDOW_XWINDOW (xim_window));
- } while (filter_status == True);
- else
- XNextEvent (gdk_display, &xevent);
-#else
- XNextEvent (gdk_display, &xevent);
-#endif
- event = gdk_event_new ();
-
- event->any.type = GDK_NOTHING;
- event->any.window = NULL;
- event->any.send_event = FALSE;
- event->any.send_event = xevent.xany.send_event;
-
- if (gdk_event_translate (event, &xevent))
- return event;
- else
- gdk_event_free (event);
- }
-
- return NULL;
-}
-
-void
-gdk_event_put (GdkEvent *event)
-{
- GdkEvent *new_event;
-
- g_return_if_fail (event != NULL);
-
- new_event = gdk_event_copy (event);
-
- putback_events = g_list_prepend (putback_events, new_event);
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_event_copy
- *
- * Copy a event structure into new storage.
- *
- * Arguments:
- * "event" is the event struct to copy.
- *
- * Results:
- * A new event structure. Free it with gdk_event_free.
- *
- * Side effects:
- * The reference count of the window in the event is increased.
- *
- *--------------------------------------------------------------
- */
-
-static GMemChunk *event_chunk;
-
-static GdkEvent*
-gdk_event_new (void)
-{
- GdkEvent *new_event;
-
- if (event_chunk == NULL)
- event_chunk = g_mem_chunk_new ("events",
- sizeof (GdkEvent),
- 4096,
- G_ALLOC_AND_FREE);
-
- new_event = g_chunk_new (GdkEvent, event_chunk);
-
- return new_event;
-}
-
-GdkEvent*
-gdk_event_copy (GdkEvent *event)
-{
- GdkEvent *new_event;
-
- g_return_val_if_fail (event != NULL, NULL);
-
- new_event = gdk_event_new ();
-
- *new_event = *event;
- gdk_window_ref (new_event->any.window);
-
- switch (event->any.type)
- {
- case GDK_KEY_PRESS:
- case GDK_KEY_RELEASE:
- new_event->key.string = g_strdup (event->key.string);
- break;
-
- case GDK_ENTER_NOTIFY:
- case GDK_LEAVE_NOTIFY:
- if (event->crossing.subwindow != NULL)
- gdk_window_ref (event->crossing.subwindow);
- break;
-
- case GDK_DROP_DATA_AVAIL:
- new_event->dropdataavailable.data_type = g_strdup (event->dropdataavailable.data_type);
- new_event->dropdataavailable.data = g_malloc (event->dropdataavailable.data_numbytes);
- memcpy (new_event->dropdataavailable.data,
- event->dropdataavailable.data,
- event->dropdataavailable.data_numbytes);
- break;
-
- default:
- break;
- }
-
- return new_event;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_event_free
- *
- * Free a event structure obtained from gdk_event_copy. Do not use
- * with other event structures.
- *
- * Arguments:
- * "event" is the event struct to free.
- *
- * Results:
- *
- * Side effects:
- * The reference count of the window in the event is decreased and
- * might be freed, too.
- *
- *-------------------------------------------------------------- */
-
-void
-gdk_event_free (GdkEvent *event)
-{
- g_assert (event_chunk != NULL);
- g_return_if_fail (event != NULL);
-
- if (event->any.window)
- gdk_window_unref (event->any.window);
-
- switch (event->any.type)
- {
- case GDK_KEY_PRESS:
- case GDK_KEY_RELEASE:
- g_free (event->key.string);
- break;
-
- case GDK_ENTER_NOTIFY:
- case GDK_LEAVE_NOTIFY:
- if (event->crossing.subwindow != NULL)
- gdk_window_unref (event->crossing.subwindow);
- break;
-
- case GDK_DROP_DATA_AVAIL:
- g_free (event->dropdataavailable.data_type);
- g_free (event->dropdataavailable.data);
- break;
-
- case GDK_DRAG_REQUEST:
- g_free (event->dragrequest.data_type);
- break;
-
- default:
- break;
- }
-
- g_mem_chunk_free (event_chunk, event);
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_set_show_events
- *
- * Turns on/off the showing of events.
- *
- * Arguments:
- * "show_events" is a boolean describing whether or
- * not to show the events gdk receives.
- *
- * Results:
- *
- * Side effects:
- * When "show_events" is TRUE, calls to "gdk_event_get"
- * will output debugging informatin regarding the event
- * received to stdout.
- *
- *--------------------------------------------------------------
- */
-
-void
-gdk_set_show_events (int show_events)
-{
- if (show_events)
- gdk_debug_flags |= GDK_DEBUG_EVENTS;
- else
- gdk_debug_flags &= ~GDK_DEBUG_EVENTS;
-}
-
-void
-gdk_set_use_xshm (gint use_xshm)
-{
- gdk_use_xshm = use_xshm;
-}
-
-gint
-gdk_get_show_events ()
-{
- return gdk_debug_flags & GDK_DEBUG_EVENTS;
-}
-
-gint
-gdk_get_use_xshm ()
-{
- return gdk_use_xshm;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_time_get
- *
- * Get the number of milliseconds since the library was
- * initialized.
- *
- * Arguments:
- *
- * Results:
- * The time since the library was initialized is returned.
- * This time value is accurate to milliseconds even though
- * a more accurate time down to the microsecond could be
- * returned.
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-guint32
-gdk_time_get ()
-{
- struct timeval end;
- struct timeval elapsed;
- guint32 milliseconds;
-
- X_GETTIMEOFDAY (&end);
-
- if (start.tv_usec > end.tv_usec)
- {
- end.tv_usec += 1000000;
- end.tv_sec--;
- }
- elapsed.tv_sec = end.tv_sec - start.tv_sec;
- elapsed.tv_usec = end.tv_usec - start.tv_usec;
-
- milliseconds = (elapsed.tv_sec * 1000) + (elapsed.tv_usec / 1000);
-
- return milliseconds;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_timer_get
- *
- * Returns the current timer.
- *
- * Arguments:
- *
- * Results:
- * Returns the current timer interval. This interval is
- * in units of milliseconds.
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-guint32
-gdk_timer_get ()
-{
- return timer_val;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_timer_set
- *
- * Sets the timer interval.
- *
- * Arguments:
- * "milliseconds" is the new value for the timer.
- *
- * Results:
- *
- * Side effects:
- * Calls to "gdk_event_get" will last for a maximum
- * of time of "milliseconds". However, a value of 0
- * milliseconds will cause "gdk_event_get" to block
- * indefinately until an event is received.
- *
- *--------------------------------------------------------------
- */
-
-void
-gdk_timer_set (guint32 milliseconds)
-{
- timer_val = milliseconds;
- timer.tv_sec = milliseconds / 1000;
- timer.tv_usec = (milliseconds % 1000) * 1000;
-
-}
-
-void
-gdk_timer_enable ()
-{
- timerp = &timer;
-}
-
-void
-gdk_timer_disable ()
-{
- timerp = NULL;
-}
-
-gint
-gdk_input_add_full (gint source,
- GdkInputCondition condition,
- GdkInputFunction function,
- gpointer data,
- GdkDestroyNotify destroy)
-{
- static gint next_tag = 1;
- GList *list;
- GdkInput *input;
- gint tag;
-
- tag = 0;
- list = inputs;
-
- while (list)
- {
- input = list->data;
- list = list->next;
-
- if ((input->source == source) && (input->condition == condition))
- {
- if (input->destroy)
- (input->destroy) (input->data);
- input->function = function;
- input->data = data;
- input->destroy = destroy;
- tag = input->tag;
- }
- }
-
- if (!tag)
- {
- input = g_new (GdkInput, 1);
- input->tag = next_tag++;
- input->source = source;
- input->condition = condition;
- input->function = function;
- input->data = data;
- input->destroy = destroy;
- tag = input->tag;
-
- inputs = g_list_prepend (inputs, input);
- }
-
- return tag;
-}
-
-gint
-gdk_input_add (gint source,
- GdkInputCondition condition,
- GdkInputFunction function,
- gpointer data)
-{
- return gdk_input_add_interp (source, condition, function, data, NULL);
-}
-
-void
-gdk_input_remove (gint tag)
-{
- GList *list;
- GList *temp_list;
- GdkInput *input;
-
- list = inputs;
- while (list)
- {
- input = list->data;
-
- if (input->tag == tag)
- {
- if (input->destroy)
- (input->destroy) (input->data);
-
- temp_list = list;
-
- if (list->next)
- list->next->prev = list->prev;
- if (list->prev)
- list->prev->next = list->next;
- if (inputs == list)
- inputs = list->next;
-
- temp_list->next = NULL;
- temp_list->prev = NULL;
-
- g_free (temp_list->data);
- g_list_free (temp_list);
- break;
- }
-
- list = list->next;
- }
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_pointer_grab
- *
- * Grabs the pointer to a specific window
- *
- * Arguments:
- * "window" is the window which will receive the grab
- * "owner_events" specifies whether events will be reported as is,
- * or relative to "window"
- * "event_mask" masks only interesting events
- * "confine_to" limits the cursor movement to the specified window
- * "cursor" changes the cursor for the duration of the grab
- * "time" specifies the time
- *
- * Results:
- *
- * Side effects:
- * requires a corresponding call to gdk_pointer_ungrab
- *
- *--------------------------------------------------------------
- */
-
-gint
-gdk_pointer_grab (GdkWindow * window,
- gint owner_events,
- GdkEventMask event_mask,
- GdkWindow * confine_to,
- GdkCursor * cursor,
- guint32 time)
-{
- /* From gdkwindow.c */
- extern int nevent_masks;
- extern int event_mask_table[];
-
- gint return_val;
- GdkWindowPrivate *window_private;
- GdkWindowPrivate *confine_to_private;
- GdkCursorPrivate *cursor_private;
- guint xevent_mask;
- Window xwindow;
- Window xconfine_to;
- Cursor xcursor;
- int i;
-
- g_return_val_if_fail (window != NULL, 0);
-
- window_private = (GdkWindowPrivate*) window;
- confine_to_private = (GdkWindowPrivate*) confine_to;
- cursor_private = (GdkCursorPrivate*) cursor;
-
- xwindow = window_private->xwindow;
-
- if (!confine_to || confine_to_private->destroyed)
- xconfine_to = None;
- else
- xconfine_to = confine_to_private->xwindow;
-
- if (!cursor)
- xcursor = None;
- else
- xcursor = cursor_private->xcursor;
-
-
- xevent_mask = 0;
- for (i = 0; i < nevent_masks; i++)
- {
- if (event_mask & (1 << (i + 1)))
- xevent_mask |= event_mask_table[i];
- }
-
- if (((GdkWindowPrivate *)window)->extension_events &&
- gdk_input_vtable.grab_pointer)
- return_val = gdk_input_vtable.grab_pointer (window,
- owner_events,
- event_mask,
- confine_to,
- time);
- else
- return_val = Success;
-
- if (return_val == Success)
- {
- if (!window_private->destroyed)
- return_val = XGrabPointer (window_private->xdisplay,
- xwindow,
- owner_events,
- xevent_mask,
- GrabModeAsync, GrabModeAsync,
- xconfine_to,
- xcursor,
- time);
- else
- return_val = AlreadyGrabbed;
- }
-
- if (return_val == GrabSuccess)
- xgrab_window = window_private;
-
- return return_val;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_pointer_ungrab
- *
- * Releases any pointer grab
- *
- * Arguments:
- *
- * Results:
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-void
-gdk_pointer_ungrab (guint32 time)
-{
- if (gdk_input_vtable.ungrab_pointer)
- gdk_input_vtable.ungrab_pointer (time);
-
- XUngrabPointer (gdk_display, time);
- xgrab_window = NULL;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_pointer_is_grabbed
- *
- * Tell wether there is an active x pointer grab in effect
- *
- * Arguments:
- *
- * Results:
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-gint
-gdk_pointer_is_grabbed (void)
-{
- return xgrab_window != NULL;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_keyboard_grab
- *
- * Grabs the keyboard to a specific window
- *
- * Arguments:
- * "window" is the window which will receive the grab
- * "owner_events" specifies whether events will be reported as is,
- * or relative to "window"
- * "time" specifies the time
- *
- * Results:
- *
- * Side effects:
- * requires a corresponding call to gdk_keyboard_ungrab
- *
- *--------------------------------------------------------------
- */
-
-gint
-gdk_keyboard_grab (GdkWindow * window,
- gint owner_events,
- guint32 time)
-{
- GdkWindowPrivate *window_private;
- Window xwindow;
-
- g_return_val_if_fail (window != NULL, 0);
-
- window_private = (GdkWindowPrivate*) window;
- xwindow = window_private->xwindow;
-
- if (!window_private->destroyed)
- return XGrabKeyboard (window_private->xdisplay,
- xwindow,
- owner_events,
- GrabModeAsync, GrabModeAsync,
- time);
- else
- return AlreadyGrabbed;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_keyboard_ungrab
- *
- * Releases any keyboard grab
- *
- * Arguments:
- *
- * Results:
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-void
-gdk_keyboard_ungrab (guint32 time)
-{
- XUngrabKeyboard (gdk_display, time);
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_screen_width
- *
- * Return the width of the screen.
- *
- * Arguments:
- *
- * Results:
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-gint
-gdk_screen_width ()
-{
- gint return_val;
-
- return_val = DisplayWidth (gdk_display, gdk_screen);
-
- return return_val;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_screen_height
- *
- * Return the height of the screen.
- *
- * Arguments:
- *
- * Results:
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-gint
-gdk_screen_height ()
-{
- gint return_val;
-
- return_val = DisplayHeight (gdk_display, gdk_screen);
-
- return return_val;
-}
-
-void
-gdk_key_repeat_disable ()
-{
- XAutoRepeatOff (gdk_display);
-}
-
-void
-gdk_key_repeat_restore ()
-{
- if (autorepeat)
- XAutoRepeatOn (gdk_display);
- else
- XAutoRepeatOff (gdk_display);
-}
-
-
-/*
- *--------------------------------------------------------------
- * gdk_flush
- *
- * Flushes the Xlib output buffer and then waits
- * until all requests have been received and processed
- * by the X server. The only real use for this function
- * is in dealing with XShm.
- *
- * Arguments:
- *
- * Results:
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-void gdk_flush ()
-{
- XSync (gdk_display, False);
-}
-
-
-void
-gdk_beep ()
-{
- XBell(gdk_display, 100);
-}
-
-
-/*
- *--------------------------------------------------------------
- * gdk_event_wait
- *
- * Waits until an event occurs or the timer runs out.
- *
- * Arguments:
- *
- * Results:
- * Returns TRUE if an event is ready to be read and FALSE
- * if the timer ran out.
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-static gint
-gdk_event_wait ()
-{
- GList *list;
- GdkInput *input;
- GdkInputCondition condition;
- SELECT_MASK readfds;
- SELECT_MASK writefds;
- SELECT_MASK exceptfds;
- int max_input;
- int nfd;
-
- /* If there are no events pending we will wait for an event.
- * The time we wait is dependant on the "timer". If no timer
- * has been specified then we'll block until an event arrives.
- * If a timer has been specified we'll block until an event
- * arrives or the timer expires. (This is all done using the
- * "select" system call).
- */
-
- if (XPending (gdk_display) == 0)
- {
- FD_ZERO (&readfds);
- FD_ZERO (&writefds);
- FD_ZERO (&exceptfds);
-
- FD_SET (connection_number, &readfds);
- max_input = connection_number;
-
- list = inputs;
- while (list)
- {
- input = list->data;
- list = list->next;
-
- if (input->condition & GDK_INPUT_READ)
- FD_SET (input->source, &readfds);
- if (input->condition & GDK_INPUT_WRITE)
- FD_SET (input->source, &writefds);
- if (input->condition & GDK_INPUT_EXCEPTION)
- FD_SET (input->source, &exceptfds);
-
- max_input = MAX (max_input, input->source);
- }
-
- nfd = select (max_input+1, &readfds, &writefds, &exceptfds, timerp);
-
- timerp = NULL;
- timer_val = 0;
-
- if (nfd > 0)
- {
- if (FD_ISSET (connection_number, &readfds))
- {
- if (XPending (gdk_display) == 0)
- {
- if (nfd == 1)
- {
- XNoOp (gdk_display);
- XFlush (gdk_display);
- }
- return FALSE;
- }
- else
- return TRUE;
- }
-
- list = inputs;
- while (list)
- {
- input = list->data;
- list = list->next;
-
- condition = 0;
- if (FD_ISSET (input->source, &readfds))
- condition |= GDK_INPUT_READ;
- if (FD_ISSET (input->source, &writefds))
- condition |= GDK_INPUT_WRITE;
- if (FD_ISSET (input->source, &exceptfds))
- condition |= GDK_INPUT_EXCEPTION;
-
- if (condition && input->function)
- (* input->function) (input->data, input->source, condition);
- }
- }
- }
- else
- return TRUE;
-
- return FALSE;
-}
-
-static gint
-gdk_event_apply_filters (XEvent *xevent,
- GdkEvent *event,
- GList *filters)
-{
- GdkEventFilter *filter;
- GList *tmp_list;
- GdkFilterReturn result;
-
- tmp_list = filters;
-
- while (tmp_list)
- {
- filter = (GdkEventFilter *)tmp_list->data;
-
- result = (*filter->function)(xevent, event, filter->data);
- if (result != GDK_FILTER_CONTINUE)
- return result;
-
- tmp_list = tmp_list->next;
- }
-
- return GDK_FILTER_CONTINUE;
-}
-
-static gint
-gdk_event_translate (GdkEvent *event,
- XEvent *xevent)
-{
-
- GdkWindow *window;
- GdkWindowPrivate *window_private;
- XComposeStatus compose;
- int charcount;
-#ifdef USE_XIM
- static gchar* buf = NULL;
- static gint buf_len= 0;
-#else
- char buf[16];
-#endif
- gint return_val;
-
- /* Are static variables used for this purpose thread-safe? */
-
- return_val = FALSE;
-
- /* Find the GdkWindow that this event occurred in.
- * All events occur in some GdkWindow (otherwise, why
- * would we be receiving them). It really is an error
- * to receive an event for which we cannot find the
- * corresponding GdkWindow. We handle events with window=None
- * specially - they are generated by XFree86's XInput under
- * some circumstances.
- */
-
- if ((xevent->xany.window == None) &&
- gdk_input_vtable.window_none_event)
- {
- return_val = gdk_input_vtable.window_none_event (event,xevent);
-
- if (return_val >= 0) /* was handled */
- return return_val;
- else
- return_val = FALSE;
- }
-
- window = gdk_window_lookup (xevent->xany.window);
- window_private = (GdkWindowPrivate *) window;
-
- if (window != NULL)
- gdk_window_ref (window);
- else if(gdk_null_window_warnings) /* Special purpose programs that
- get events for other windows may
- want to disable this */
- g_warning ("%#lx -> NULL\n", xevent->xany.window);
-
- /* Check for filters for this window */
-
- {
- GdkFilterReturn result;
- result = gdk_event_apply_filters (xevent, event,
- window_private
- ?window_private->filters
- :gdk_default_filters);
-
- if (result != GDK_FILTER_CONTINUE)
- {
- return (result == GDK_FILTER_TRANSLATE) ? TRUE : FALSE;
- }
- }
-
- /* We do a "manual" conversion of the XEvent to a
- * GdkEvent. The structures are mostly the same so
- * the conversion is fairly straightforward. We also
- * optionally print debugging info regarding events
- * received.
- */
- /* Addendum:
- * During drag & drop you get events where the pointer is
- * in other windows. Need to just do finer-grained checking
- */
- switch (xevent->type)
- {
- case KeyPress:
- /* Lookup the string corresponding to the given keysym.
- */
-#ifdef USE_XIM
- if (buf_len == 0)
- {
- buf_len = 128;
- buf = g_new (gchar, buf_len);
- }
- if (xim_using == TRUE && xim_ic)
- {
- Status status;
-
- /* Clear keyval. Depending on status, may not be set */
- event->key.keyval = GDK_VoidSymbol;
- charcount = XmbLookupString(xim_ic->xic,
- &xevent->xkey, buf, buf_len-1,
- (KeySym*) &event->key.keyval,
- &status);
- if (status == XBufferOverflow)
- { /* retry */
- /* alloc adequate size of buffer */
- GDK_NOTE (XIM,
- g_print("XIM: overflow (required %i)\n", charcount));
-
- while (buf_len <= charcount)
- buf_len *= 2;
- buf = (gchar *) g_realloc (buf, buf_len);
-
- charcount = XmbLookupString (xim_ic->xic,
- &xevent->xkey, buf, buf_len-1,
- (KeySym*) &event->key.keyval,
- &status);
- }
- if (status == XLookupNone)
- {
- return_val = FALSE;
- break;
- }
- }
- else
- charcount = XLookupString (&xevent->xkey, buf, buf_len,
- (KeySym*) &event->key.keyval,
- &compose);
-#else
- charcount = XLookupString (&xevent->xkey, buf, 16,
- (KeySym*) &event->key.keyval,
- &compose);
-#endif
- if (charcount > 0 && buf[charcount-1] == '\0')
- charcount --;
- else
- buf[charcount] = '\0';
-
- /* Print debugging info.
- */
-#ifdef G_ENABLE_DEBUG
- if (gdk_debug_flags & GDK_DEBUG_EVENTS)
- {
- g_print ("key press:\twindow: %ld key: %12s %d\n",
- xevent->xkey.window - base_id,
- event->key.keyval ? XKeysymToString (event->key.keyval) : "(none)",
- event->key.keyval);
- if (charcount > 0)
- g_print ("\t\tlength: %4d string: \"%s\"\n",
- charcount, buf);
- }
-#endif /* G_ENABLE_DEBUG */
-
- event->key.type = GDK_KEY_PRESS;
- event->key.window = window;
- event->key.time = xevent->xkey.time;
- event->key.state = (GdkModifierType) xevent->xkey.state;
- event->key.string = g_strdup (buf);
- event->key.length = charcount;
-
- return_val = window_private && !window_private->destroyed;
-
- if (!return_val)
- g_free (event->key.string);
-
- break;
-
- case KeyRelease:
- /* Lookup the string corresponding to the given keysym.
- */
- charcount = XLookupString (&xevent->xkey, buf, 16,
- (KeySym*) &event->key.keyval,
- &compose);
-
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("key release:\t\twindow: %ld key: %12s %d\n",
- xevent->xkey.window - base_id,
- XKeysymToString (event->key.keyval),
- event->key.keyval));
-
- event->key.type = GDK_KEY_RELEASE;
- event->key.window = window;
- event->key.time = xevent->xkey.time;
- event->key.state = (GdkModifierType) xevent->xkey.state;
- event->key.length = 0;
- event->key.string = NULL;
-
- return_val = window_private && !window_private->destroyed;
- break;
-
- case ButtonPress:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("button press[%d]:\t\twindow: %ld x,y: %d %d button: %d\n",
- window_private?window_private->dnd_drag_enabled:0,
- xevent->xbutton.window - base_id,
- xevent->xbutton.x, xevent->xbutton.y,
- xevent->xbutton.button));
-
- if (window_private &&
- (window_private->extension_events != 0) &&
- gdk_input_ignore_core)
- break;
-
- event->button.type = GDK_BUTTON_PRESS;
- event->button.window = window;
- event->button.time = xevent->xbutton.time;
- event->button.x = xevent->xbutton.x;
- event->button.y = xevent->xbutton.y;
- event->button.x_root = (gfloat)xevent->xbutton.x_root;
- event->button.y_root = (gfloat)xevent->xbutton.y_root;
- event->button.pressure = 0.5;
- event->button.xtilt = 0;
- event->button.ytilt = 0;
- event->button.state = (GdkModifierType) xevent->xbutton.state;
- event->button.button = xevent->xbutton.button;
- event->button.source = GDK_SOURCE_MOUSE;
- event->button.deviceid = GDK_CORE_POINTER;
-
- if ((event->button.time < (button_click_time[1] + TRIPLE_CLICK_TIME)) &&
- (event->button.window == button_window[1]) &&
- (event->button.button == button_number[1]))
- {
- gdk_synthesize_click (event, 3);
-
- button_click_time[1] = 0;
- button_click_time[0] = 0;
- button_window[1] = NULL;
- button_window[0] = 0;
- button_number[1] = -1;
- button_number[0] = -1;
- }
- else if ((event->button.time < (button_click_time[0] + DOUBLE_CLICK_TIME)) &&
- (event->button.window == button_window[0]) &&
- (event->button.button == button_number[0]))
- {
- gdk_synthesize_click (event, 2);
-
- button_click_time[1] = button_click_time[0];
- button_click_time[0] = event->button.time;
- button_window[1] = button_window[0];
- button_window[0] = event->button.window;
- button_number[1] = button_number[0];
- button_number[0] = event->button.button;
- }
- else
- {
- button_click_time[1] = 0;
- button_click_time[0] = event->button.time;
- button_window[1] = NULL;
- button_window[0] = event->button.window;
- button_number[1] = -1;
- button_number[0] = event->button.button;
- }
- if(window_private
- && window_private->dnd_drag_enabled
- && !gdk_dnd.drag_perhaps
- && event->button.button == 1
- && !gdk_dnd.drag_really)
- {
- gdk_dnd.drag_perhaps = 1;
- gdk_dnd.dnd_drag_start.x = xevent->xbutton.x_root;
- gdk_dnd.dnd_drag_start.y = xevent->xbutton.y_root;
- gdk_dnd.real_sw = window_private;
-
- if(gdk_dnd.drag_startwindows)
- {
- g_free(gdk_dnd.drag_startwindows);
- gdk_dnd.drag_startwindows = NULL;
- }
- gdk_dnd.drag_numwindows = gdk_dnd.drag_really = 0;
- gdk_dnd.dnd_grabbed = FALSE;
-
- {
- /* Set motion mask for first DnD'd window, since it
- will be the one that is actually dragged */
- XWindowAttributes dnd_winattr;
- XSetWindowAttributes dnd_setwinattr;
-
- /* We need to get motion events while the button is down, so
- we can know whether to really start dragging or not... */
- XGetWindowAttributes(gdk_display, (Window)window_private->xwindow,
- &dnd_winattr);
-
- window_private->dnd_drag_savedeventmask = dnd_winattr.your_event_mask;
- dnd_setwinattr.event_mask =
- window_private->dnd_drag_eventmask = ButtonMotionMask |
- EnterWindowMask | LeaveWindowMask;
- XChangeWindowAttributes(gdk_display, window_private->xwindow,
- CWEventMask, &dnd_setwinattr);
- }
- }
- return_val = window_private && !window_private->destroyed;
- break;
-
- case ButtonRelease:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("button release[%d]:\twindow: %ld x,y: %d %d button: %d\n",
- window_private?window_private->dnd_drag_enabled:0,
- xevent->xbutton.window - base_id,
- xevent->xbutton.x, xevent->xbutton.y,
- xevent->xbutton.button));
-
- if (window_private &&
- (window_private->extension_events != 0) &&
- gdk_input_ignore_core)
- break;
-
- event->button.type = GDK_BUTTON_RELEASE;
- event->button.window = window;
- event->button.time = xevent->xbutton.time;
- event->button.x = xevent->xbutton.x;
- event->button.y = xevent->xbutton.y;
- event->button.x_root = (gfloat)xevent->xbutton.x_root;
- event->button.y_root = (gfloat)xevent->xbutton.y_root;
- event->button.pressure = 0.5;
- event->button.xtilt = 0;
- event->button.ytilt = 0;
- event->button.state = (GdkModifierType) xevent->xbutton.state;
- event->button.button = xevent->xbutton.button;
- event->button.source = GDK_SOURCE_MOUSE;
- event->button.deviceid = GDK_CORE_POINTER;
-
- gdk_dnd.last_drop_time = xevent->xbutton.time;
- if(gdk_dnd.drag_perhaps)
- {
- {
- XSetWindowAttributes attrs;
- /* Reset event mask to pre-drag value, assuming event_mask
- doesn't change during drag */
- attrs.event_mask = gdk_dnd.real_sw->dnd_drag_savedeventmask;
- XChangeWindowAttributes(gdk_display, gdk_dnd.real_sw->xwindow,
- CWEventMask, &attrs);
- }
-
- if (gdk_dnd.dnd_grabbed)
- {
- gdk_dnd_display_drag_cursor(-2,
- -2,
- FALSE, TRUE);
- XUngrabPointer(gdk_display, CurrentTime);
- gdk_dnd.dnd_grabbed = FALSE;
- }
-
- if(gdk_dnd.drag_really)
- {
- GdkPoint foo;
- foo.x = xevent->xbutton.x_root;
- foo.y = xevent->xbutton.y_root;
-
- if(gdk_dnd.dnd_drag_target != None)
- gdk_dnd_drag_end(gdk_dnd.dnd_drag_target, foo);
- gdk_dnd.drag_really = 0;
-
- gdk_dnd.drag_numwindows = 0;
- if(gdk_dnd.drag_startwindows)
- {
- g_free(gdk_dnd.drag_startwindows);
- gdk_dnd.drag_startwindows = NULL;
- }
-
- gdk_dnd.real_sw = NULL;
- }
-
- gdk_dnd.drag_perhaps = 0;
- gdk_dnd.dnd_drag_start.x = gdk_dnd.dnd_drag_start.y = 0;
- gdk_dnd.dnd_drag_dropzone.x = gdk_dnd.dnd_drag_dropzone.y = 0;
- gdk_dnd.dnd_drag_dropzone.width = gdk_dnd.dnd_drag_dropzone.height = 0;
- gdk_dnd.dnd_drag_curwin = None;
- return_val = window_private?TRUE:FALSE;
- } else
- return_val = window_private && !window_private->destroyed;
- break;
-
- case MotionNotify:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("motion notify:\t\twindow: %ld x,y: %d %d hint: %s d:%d r%d\n",
- xevent->xmotion.window - base_id,
- xevent->xmotion.x, xevent->xmotion.y,
- (xevent->xmotion.is_hint) ? "true" : "false",
- gdk_dnd.drag_perhaps, gdk_dnd.drag_really));
-
- if (window_private &&
- (window_private->extension_events != 0) &&
- gdk_input_ignore_core)
- break;
-
- event->motion.type = GDK_MOTION_NOTIFY;
- event->motion.window = window;
- event->motion.time = xevent->xmotion.time;
- event->motion.x = xevent->xmotion.x;
- event->motion.y = xevent->xmotion.y;
- event->motion.x_root = (gfloat)xevent->xmotion.x_root;
- event->motion.y_root = (gfloat)xevent->xmotion.y_root;
- event->motion.pressure = 0.5;
- event->motion.xtilt = 0;
- event->motion.ytilt = 0;
- event->motion.state = (GdkModifierType) xevent->xmotion.state;
- event->motion.is_hint = xevent->xmotion.is_hint;
- event->motion.source = GDK_SOURCE_MOUSE;
- event->motion.deviceid = GDK_CORE_POINTER;
-
-#define IS_IN_ZONE(cx, cy) (cx >= gdk_dnd.dnd_drag_dropzone.x \
- && cy >= gdk_dnd.dnd_drag_dropzone.y \
- && cx < (gdk_dnd.dnd_drag_dropzone.x + gdk_dnd.dnd_drag_dropzone.width) \
- && cy < (gdk_dnd.dnd_drag_dropzone.y + gdk_dnd.dnd_drag_dropzone.height))
-
- if(gdk_dnd.drag_perhaps && gdk_dnd.drag_really
- /* && event->motion.is_hint */ /* HINTME */)
- {
- /* First, we have to find what window the motion was in... */
- /* XXX there has to be a better way to do this, perhaps with
- XTranslateCoordinates or XQueryTree - I don't know how,
- and this sort of works */
- static Window lastwin = None, curwin = None, twin;
- Window childwin = gdk_root_window;
- int x, y, ox, oy;
-
- /* Interlude - display cursor for the drag ASAP */
- gdk_dnd_display_drag_cursor(xevent->xmotion.x_root,
- xevent->xmotion.y_root,
- gdk_dnd.dnd_drag_target?TRUE:FALSE,
- FALSE);
-
- lastwin = curwin;
- curwin = gdk_root_window;
- ox = x = xevent->xmotion.x_root;
- oy = y = xevent->xmotion.y_root;
- while(childwin != None)
- {
- ox = x; oy = y;
- curwin = childwin;
- XTranslateCoordinates(gdk_display, curwin, curwin,
- x, y, &x, &y, &childwin);
- if(childwin != None)
- {
- XTranslateCoordinates(gdk_display, curwin, childwin,
- x, y, &x, &y, &twin);
- }
- }
- GDK_NOTE (DND,
- g_print("Drag is now in window %#lx, lastwin was %#lx, ddc = %#lx\n",
- curwin, lastwin, gdk_dnd.dnd_drag_curwin));
- if(curwin != gdk_dnd.dnd_drag_curwin && curwin != lastwin)
- {
- /* We have left one window and entered another
- (do leave & enter bits) */
- if(gdk_dnd.dnd_drag_curwin != None)
- gdk_dnd_drag_leave(gdk_dnd.dnd_drag_curwin);
- gdk_dnd.dnd_drag_curwin = curwin;
- gdk_dnd_drag_enter(gdk_dnd.dnd_drag_curwin);
- gdk_dnd.dnd_drag_dropzone.x = gdk_dnd.dnd_drag_dropzone.y = 0;
- gdk_dnd.dnd_drag_dropzone.width = gdk_dnd.dnd_drag_dropzone.height = 0;
- gdk_dnd.dnd_drag_target = None;
- GDK_NOTE (DND,
- g_print("curwin = %#lx, lastwin = %#lx, dnd_drag_curwin = %#lx\n",
- curwin, lastwin, gdk_dnd.dnd_drag_curwin));
-
- gdk_dnd_display_drag_cursor(xevent->xmotion.x_root,
- xevent->xmotion.y_root,
- FALSE, TRUE);
- }
- else if(gdk_dnd.dnd_drag_dropzone.width > 0
- && gdk_dnd.dnd_drag_dropzone.height > 0
- && curwin == gdk_dnd.dnd_drag_curwin)
- {
- /* Handle all that dropzone stuff - thanks John ;-) */
- if (gdk_dnd.dnd_drag_target != None)
- {
- gboolean in_zone = IS_IN_ZONE(xevent->xmotion.x_root,
- xevent->xmotion.y_root);
- gboolean old_in_zone = IS_IN_ZONE(gdk_dnd.dnd_drag_oldpos.x,
- gdk_dnd.dnd_drag_oldpos.y);
-
- if (!in_zone && old_in_zone)
- {
- /* We were in the drop zone and moved out */
- gdk_dnd.dnd_drag_target = None;
- gdk_dnd_drag_leave(curwin);
- gdk_dnd_display_drag_cursor(xevent->xmotion.x_root,
- xevent->xmotion.y_root,
- FALSE, TRUE);
- }
- else if (!in_zone && !old_in_zone)
- {
- /* We were outside drop zone but in the window
- - have to send enter events */
- gdk_dnd_drag_enter(curwin);
- gdk_dnd.dnd_drag_curwin = curwin;
- gdk_dnd.dnd_drag_dropzone.x = gdk_dnd.dnd_drag_dropzone.y = 0;
- gdk_dnd.dnd_drag_target = None;
- }
- }
- } /* else
- dnd_drag_curwin = None; */
- return_val = FALSE;
- }
- else
- return_val = window_private && !window_private->destroyed;
- break;
-
- case EnterNotify:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("enter notify:\t\twindow: %ld detail: %d subwin: %ld\n",
- xevent->xcrossing.window - base_id,
- xevent->xcrossing.detail,
- xevent->xcrossing.subwindow - base_id));
-
- /* Tell XInput stuff about it if appropriate */
- if (window_private &&
- (window_private->extension_events != 0) &&
- gdk_input_vtable.enter_event)
- gdk_input_vtable.enter_event (&xevent->xcrossing, window);
-
- event->crossing.type = GDK_ENTER_NOTIFY;
- event->crossing.window = window;
-
- /* If the subwindow field of the XEvent is non-NULL, then
- * lookup the corresponding GdkWindow.
- */
- if (xevent->xcrossing.subwindow != None)
- event->crossing.subwindow = gdk_window_lookup (xevent->xcrossing.subwindow);
- else
- event->crossing.subwindow = NULL;
-
- /* Translate the crossing detail into Gdk terms.
- */
- switch (xevent->xcrossing.detail)
- {
- case NotifyInferior:
- event->crossing.detail = GDK_NOTIFY_INFERIOR;
- break;
- case NotifyAncestor:
- event->crossing.detail = GDK_NOTIFY_ANCESTOR;
- break;
- case NotifyVirtual:
- event->crossing.detail = GDK_NOTIFY_VIRTUAL;
- break;
- case NotifyNonlinear:
- event->crossing.detail = GDK_NOTIFY_NONLINEAR;
- break;
- case NotifyNonlinearVirtual:
- event->crossing.detail = GDK_NOTIFY_NONLINEAR_VIRTUAL;
- break;
- default:
- event->crossing.detail = GDK_NOTIFY_UNKNOWN;
- break;
- }
-
-#ifdef G_ENABLE_DEBUG
- if ((gdk_debug_flags & GDK_DEBUG_DND) & gdk_dnd.drag_perhaps)
- {
- g_print("We may[%d] have a drag into %#lx = %#lx\n",
- gdk_dnd.drag_really,
- xevent->xcrossing.window, gdk_dnd.real_sw->xwindow);
- }
-#endif /* G_ENABLE_DEBUG */
-
- if (gdk_dnd.drag_perhaps && gdk_dnd.drag_really &&
- (xevent->xcrossing.window == gdk_dnd.real_sw->xwindow))
- {
- gdk_dnd.drag_really = 0;
-
- GDK_NOTE (DND, g_print("Ungrabbed\n"));
-
- gdk_dnd.drag_numwindows = 0;
- g_free(gdk_dnd.drag_startwindows);
- gdk_dnd.drag_startwindows = NULL;
- /* We don't want to ungrab the pointer here, or we'll
- * start getting spurious enter/leave events */
-#if 0
- XChangeActivePointerGrab (gdk_display, 0, None, CurrentTime);
-#endif
- }
-
- return_val = window_private && !window_private->destroyed;
- break;
-
- case LeaveNotify:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("leave notify:\t\twindow: %ld detail: %d subwin: %ld\n",
- xevent->xcrossing.window - base_id,
- xevent->xcrossing.detail, xevent->xcrossing.subwindow - base_id));
-
- event->crossing.type = GDK_LEAVE_NOTIFY;
- event->crossing.window = window;
-
- /* If the subwindow field of the XEvent is non-NULL, then
- * lookup the corresponding GdkWindow.
- */
- if (xevent->xcrossing.subwindow != None)
- event->crossing.subwindow = gdk_window_lookup (xevent->xcrossing.subwindow);
- else
- event->crossing.subwindow = NULL;
-
- /* Translate the crossing detail into Gdk terms.
- */
- switch (xevent->xcrossing.detail)
- {
- case NotifyInferior:
- event->crossing.detail = GDK_NOTIFY_INFERIOR;
- break;
- case NotifyAncestor:
- event->crossing.detail = GDK_NOTIFY_ANCESTOR;
- break;
- case NotifyVirtual:
- event->crossing.detail = GDK_NOTIFY_VIRTUAL;
- break;
- case NotifyNonlinear:
- event->crossing.detail = GDK_NOTIFY_NONLINEAR;
- break;
- case NotifyNonlinearVirtual:
- event->crossing.detail = GDK_NOTIFY_NONLINEAR_VIRTUAL;
- break;
- default:
- event->crossing.detail = GDK_NOTIFY_UNKNOWN;
- break;
- }
-#ifdef G_ENABLE_DEBUG
- if ((gdk_debug_flags & GDK_DEBUG_DND) & gdk_dnd.drag_perhaps)
- {
- g_print("We may[%d] have a drag out of %#lx = %#lx\n",
- gdk_dnd.drag_really,
- xevent->xcrossing.window, gdk_dnd.real_sw->xwindow);
- }
-#endif /* G_ENABLE_DEBUG */
- if (gdk_dnd.drag_perhaps && !gdk_dnd.drag_really &&
- (xevent->xcrossing.window == gdk_dnd.real_sw->xwindow))
- {
- gboolean xgpret;
- gdk_dnd_drag_addwindow((GdkWindow *) gdk_dnd.real_sw);
- gdk_dnd_drag_begin((GdkWindow *) gdk_dnd.real_sw);
- xgpret =
- XGrabPointer(gdk_display, gdk_dnd.real_sw->xwindow, False,
- ButtonMotionMask | PointerMotionMask |
- /* PointerMotionHintMask | */ /* HINTME */
- ButtonPressMask | ButtonReleaseMask,
- GrabModeAsync, GrabModeAsync, gdk_root_window,
- None, CurrentTime);
-#ifdef G_ENABLE_DEBUG
- GDK_NOTE(DND, g_print("xgpret = %d\n", xgpret));
-#endif
- gdk_dnd.dnd_grabbed = TRUE;
- gdk_dnd.drag_really = 1;
- gdk_dnd_display_drag_cursor(xevent->xmotion.x_root,
- xevent->xmotion.y_root,
- FALSE, TRUE);
- }
-
- return_val = window_private && !window_private->destroyed;
- break;
-
- case FocusIn:
- case FocusOut:
- /* We only care about focus events that indicate that _this_
- * window (not a ancestor or child) got or lost the focus
- */
- switch (xevent->xfocus.detail)
- {
- case NotifyAncestor:
- case NotifyInferior:
- case NotifyNonlinear:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("focus %s:\t\twindow: %ld\n",
- (xevent->xany.type == FocusIn) ? "in" : "out",
- xevent->xfocus.window - base_id));
-
- event->focus_change.type = GDK_FOCUS_CHANGE;
- event->focus_change.window = window;
- event->focus_change.in = (xevent->xany.type == FocusIn);
-
- return_val = window_private && !window_private->destroyed;
- break;
- default:
- ;
- }
- break;
-
- case KeymapNotify:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("keymap notify\n"));
-
- /* Not currently handled */
- break;
-
- case Expose:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("expose:\t\twindow: %ld %d x,y: %d %d w,h: %d %d\n",
- xevent->xexpose.window - base_id, xevent->xexpose.count,
- xevent->xexpose.x, xevent->xexpose.y,
- xevent->xexpose.width, xevent->xexpose.height));
-
- event->expose.type = GDK_EXPOSE;
- event->expose.window = window;
- event->expose.area.x = xevent->xexpose.x;
- event->expose.area.y = xevent->xexpose.y;
- event->expose.area.width = xevent->xexpose.width;
- event->expose.area.height = xevent->xexpose.height;
- event->expose.count = xevent->xexpose.count;
-
- return_val = window_private && !window_private->destroyed;
- break;
-
- case GraphicsExpose:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("graphics expose:\tdrawable: %ld\n",
- xevent->xgraphicsexpose.drawable - base_id));
-
- event->expose.type = GDK_EXPOSE;
- event->expose.window = window;
- event->expose.area.x = xevent->xgraphicsexpose.x;
- event->expose.area.y = xevent->xgraphicsexpose.y;
- event->expose.area.width = xevent->xgraphicsexpose.width;
- event->expose.area.height = xevent->xgraphicsexpose.height;
- event->expose.count = xevent->xexpose.count;
-
- return_val = window_private && !window_private->destroyed;
- break;
-
- case NoExpose:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("no expose:\t\tdrawable: %ld\n",
- xevent->xnoexpose.drawable - base_id));
-
- event->no_expose.type = GDK_NO_EXPOSE;
- event->no_expose.window = window;
-
- return_val = window_private && !window_private->destroyed;
- break;
-
- case VisibilityNotify:
- /* Print debugging info.
- */
-#ifdef G_ENABLE_DEBUG
- if (gdk_debug_flags & GDK_DEBUG_EVENTS)
- switch (xevent->xvisibility.state)
- {
- case VisibilityFullyObscured:
- g_print ("visibility notify:\twindow: %ld none\n",
- xevent->xvisibility.window - base_id);
- break;
- case VisibilityPartiallyObscured:
- g_print ("visibility notify:\twindow: %ld partial\n",
- xevent->xvisibility.window - base_id);
- break;
- case VisibilityUnobscured:
- g_print ("visibility notify:\twindow: %ld full\n",
- xevent->xvisibility.window - base_id);
- break;
- }
-#endif /* G_ENABLE_DEBUG */
-
- event->visibility.type = GDK_VISIBILITY_NOTIFY;
- event->visibility.window = window;
-
- switch (xevent->xvisibility.state)
- {
- case VisibilityFullyObscured:
- event->visibility.state = GDK_VISIBILITY_FULLY_OBSCURED;
- break;
-
- case VisibilityPartiallyObscured:
- event->visibility.state = GDK_VISIBILITY_PARTIAL;
- break;
-
- case VisibilityUnobscured:
- event->visibility.state = GDK_VISIBILITY_UNOBSCURED;
- break;
- }
-
- return_val = window_private && !window_private->destroyed;
- break;
-
- case CreateNotify:
- /* Not currently handled */
- break;
-
- case DestroyNotify:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("destroy notify:\twindow: %ld\n",
- xevent->xdestroywindow.window - base_id));
-
- event->any.type = GDK_DESTROY;
- event->any.window = window;
-
- return_val = window_private && !window_private->destroyed;
-
- gdk_window_destroy_notify (window);
- break;
-
- case UnmapNotify:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("unmap notify:\t\twindow: %ld\n",
- xevent->xmap.window - base_id));
-
- event->any.type = GDK_UNMAP;
- event->any.window = window;
-
- if (xgrab_window == window_private)
- xgrab_window = NULL;
-
- return_val = window_private && !window_private->destroyed;
- break;
-
- case MapNotify:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("map notify:\t\twindow: %ld\n",
- xevent->xmap.window - base_id));
-
- event->any.type = GDK_MAP;
- event->any.window = window;
-
- return_val = window_private && !window_private->destroyed;
- break;
-
- case ReparentNotify:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("reparent notify:\twindow: %ld\n",
- xevent->xreparent.window - base_id));
-
- /* Not currently handled */
- break;
-
- case ConfigureNotify:
- /* Print debugging info.
- */
- while ((XPending (gdk_display) > 0) &&
- XCheckTypedWindowEvent(gdk_display, xevent->xany.window,
- ConfigureNotify, xevent))
- /*XSync (gdk_display, 0)*/;
-
- GDK_NOTE (EVENTS,
- g_print ("configure notify:\twindow: %ld x,y: %d %d w,h: %d %d b-w: %d above: %ld ovr: %d\n",
- xevent->xconfigure.window - base_id,
- xevent->xconfigure.x,
- xevent->xconfigure.y,
- xevent->xconfigure.width,
- xevent->xconfigure.height,
- xevent->xconfigure.border_width,
- xevent->xconfigure.above - base_id,
- xevent->xconfigure.override_redirect));
-
- if (window_private)
- {
- if ((window_private->extension_events != 0) &&
- gdk_input_vtable.configure_event)
- gdk_input_vtable.configure_event (&xevent->xconfigure, window);
-
- if (window_private->window_type != GDK_WINDOW_CHILD)
- {
- event->configure.type = GDK_CONFIGURE;
- event->configure.window = window;
- event->configure.width = xevent->xconfigure.width;
- event->configure.height = xevent->xconfigure.height;
-
- if (!xevent->xconfigure.x &&
- !xevent->xconfigure.y)
- {
- gint tx = 0;
- gint ty = 0;
- Window child_window = 0;
-
- if (!XTranslateCoordinates (window_private->xdisplay,
- window_private->xwindow,
- gdk_root_window,
- 0, 0,
- &tx, &ty,
- &child_window))
- g_warning ("GdkWindow %ld doesn't share root windows display?",
- window_private->xwindow - base_id);
- event->configure.x = tx;
- event->configure.y = ty;
- }
- else
- {
- event->configure.x = xevent->xconfigure.x;
- event->configure.y = xevent->xconfigure.y;
- }
- window_private->x = event->configure.x;
- window_private->y = event->configure.y;
- window_private->width = xevent->xconfigure.width;
- window_private->height = xevent->xconfigure.height;
- if (window_private->resize_count > 1)
- window_private->resize_count -= 1;
-
- return_val = !window_private->destroyed;
- }
- }
- break;
-
- case PropertyNotify:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("property notify:\twindow: %ld\n",
- xevent->xproperty.window - base_id));
-
- event->property.type = GDK_PROPERTY_NOTIFY;
- event->property.window = window;
- event->property.atom = xevent->xproperty.atom;
- event->property.time = xevent->xproperty.time;
- event->property.state = xevent->xproperty.state;
-
- return_val = window_private && !window_private->destroyed;
- break;
-
- case SelectionClear:
- GDK_NOTE (EVENTS,
- g_print ("selection clear:\twindow: %ld\n",
- xevent->xproperty.window - base_id));
-
- event->selection.type = GDK_SELECTION_CLEAR;
- event->selection.window = window;
- event->selection.selection = xevent->xselectionclear.selection;
- event->selection.time = xevent->xselectionclear.time;
-
- return_val = window_private && !window_private->destroyed;
- break;
-
- case SelectionRequest:
- GDK_NOTE (EVENTS,
- g_print ("selection request:\twindow: %ld\n",
- xevent->xproperty.window - base_id));
-
- event->selection.type = GDK_SELECTION_REQUEST;
- event->selection.window = window;
- event->selection.selection = xevent->xselectionrequest.selection;
- event->selection.target = xevent->xselectionrequest.target;
- event->selection.property = xevent->xselectionrequest.property;
- event->selection.requestor = xevent->xselectionrequest.requestor;
- event->selection.time = xevent->xselectionrequest.time;
-
- return_val = window_private && !window_private->destroyed;
- break;
-
- case SelectionNotify:
- GDK_NOTE (EVENTS,
- g_print ("selection notify:\twindow: %ld\n",
- xevent->xproperty.window - base_id));
-
-
- event->selection.type = GDK_SELECTION_NOTIFY;
- event->selection.window = window;
- event->selection.selection = xevent->xselection.selection;
- event->selection.target = xevent->xselection.target;
- event->selection.property = xevent->xselection.property;
- event->selection.time = xevent->xselection.time;
-
- return_val = window_private && !window_private->destroyed;
- break;
-
- case ColormapNotify:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("colormap notify:\twindow: %ld\n",
- xevent->xcolormap.window - base_id));
-
- /* Not currently handled */
- break;
-
- case ClientMessage:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("client message:\twindow: %ld\n",
- xevent->xclient.window - base_id));
-
- /* Client messages are the means of the window manager
- * communicating with a program. We'll first check to
- * see if this is really the window manager talking
- * to us.
- */
- if (xevent->xclient.message_type == gdk_wm_protocols)
- {
- if ((Atom) xevent->xclient.data.l[0] == gdk_wm_delete_window)
- {
- /* The delete window request specifies a window
- * to delete. We don't actually destroy the
- * window because "it is only a request". (The
- * window might contain vital data that the
- * program does not want destroyed). Instead
- * the event is passed along to the program,
- * which should then destroy the window.
- */
-
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("delete window:\t\twindow: %ld\n",
- xevent->xclient.window - base_id));
-
- event->any.type = GDK_DELETE;
- event->any.window = window;
-
- return_val = window_private && !window_private->destroyed;
- }
- else if ((Atom) xevent->xclient.data.l[0] == gdk_wm_take_focus)
- {
- }
- }
- else if (xevent->xclient.message_type == gdk_dnd.gdk_XdeEnter)
- {
- Atom reptype = 0;
-
- event->dropenter.u.allflags = xevent->xclient.data.l[1];
-
- GDK_NOTE (DND, g_print ("GDK_DROP_ENTER [%d][%d]\n",
- window_private->dnd_drop_enabled, event->dropenter.u.flags.sendreply));
- return_val = FALSE;
-
- /* Now figure out if we really want this drop...
- * If someone is trying funky clipboard stuff, ignore
- */
- if (window_private
- && window_private->dnd_drop_enabled
- && event->dropenter.u.flags.sendreply
- && (reptype = gdk_dnd_check_types (window, xevent)))
- {
- XEvent replyev;
-
- replyev.xclient.type = ClientMessage;
- replyev.xclient.window = xevent->xclient.data.l[0];
- replyev.xclient.format = 32;
- replyev.xclient.message_type = gdk_dnd.gdk_XdeRequest;
- replyev.xclient.data.l[0] = window_private->xwindow;
-
- event->dragrequest.u.allflags = 0;
- event->dragrequest.u.flags.protocol_version =
- DND_PROTOCOL_VERSION;
- event->dragrequest.u.flags.willaccept = 1;
- event->dragrequest.u.flags.delete_data =
- (window_private->dnd_drop_destructive_op) ? 1 : 0;
-
- replyev.xclient.data.l[1] = event->dragrequest.u.allflags;
- replyev.xclient.data.l[2] = replyev.xclient.data.l[3] = 0;
- replyev.xclient.data.l[4] = reptype;
-
- if (!gdk_send_xevent (replyev.xclient.window, False,
- NoEventMask, &replyev))
- GDK_NOTE (DND, g_print("Sending XdeRequest to %#lx failed\n",
- replyev.xclient.window));
-
- event->any.type = GDK_DROP_ENTER;
- event->any.window = window;
- event->dropenter.requestor = replyev.xclient.window;
- event->dropenter.u.allflags = xevent->xclient.data.l[1];
-
- GDK_NOTE (DND, g_print("We sent a GDK_DROP_ENTER on to Gtk\n"));
- return_val = TRUE;
- }
- }
- else if (xevent->xclient.message_type == gdk_dnd.gdk_XdeLeave)
- {
-#ifdef G_ENABLE_DEBUG
- if (gdk_debug_flags & (GDK_DEBUG_EVENTS | GDK_DEBUG_DND))
- g_print ("GDK_DROP_LEAVE\n");
-#endif
-
- if (window_private && window_private->dnd_drop_enabled)
- {
- event->dropleave.type = GDK_DROP_LEAVE;
- event->dropleave.window = window;
- event->dropleave.requestor = xevent->xclient.data.l[0];
- event->dropleave.u.allflags = xevent->xclient.data.l[1];
- return_val = TRUE;
- }
- else
- return_val = FALSE;
- }
- else if (xevent->xclient.message_type == gdk_dnd.gdk_XdeRequest)
- {
- /*
- * make sure to only handle requests from the window the cursor is
- * over
- */
-#ifdef G_ENABLE_DEBUG
- if (gdk_debug_flags & (GDK_DEBUG_EVENTS | GDK_DEBUG_DND))
- g_print ("GDK_DRAG_REQUEST\n");
-#endif
- event->dragrequest.u.allflags = xevent->xclient.data.l[1];
- return_val = FALSE;
-
- if (window && gdk_dnd.drag_really &&
- xevent->xclient.data.l[0] == gdk_dnd.dnd_drag_curwin &&
- event->dragrequest.u.flags.sendreply == 0)
- {
- /* Got request - do we need to ask user? */
- if (!event->dragrequest.u.flags.willaccept
- && event->dragrequest.u.flags.senddata)
- {
- /* Yes we do :) */
- event->dragrequest.type = GDK_DRAG_REQUEST;
- event->dragrequest.window = window;
- event->dragrequest.requestor = xevent->xclient.data.l[0];
- event->dragrequest.isdrop = 0;
- event->dragrequest.drop_coords.x =
- event->dragrequest.drop_coords.y = 0;
- return_val = TRUE;
- }
- else if (event->dragrequest.u.flags.willaccept)
- {
- window_private->dnd_drag_destructive_op =
- event->dragrequest.u.flags.delete_data;
- window_private->dnd_drag_accepted = 1;
- window_private->dnd_drag_data_type =
- xevent->xclient.data.l[4];
-
- gdk_dnd.dnd_drag_target = gdk_dnd.dnd_drag_curwin;
- gdk_dnd_display_drag_cursor(-1, -1, TRUE, TRUE);
- }
- gdk_dnd.dnd_drag_dropzone.x = xevent->xclient.data.l[2] & 65535;
- gdk_dnd.dnd_drag_dropzone.y =
- (xevent->xclient.data.l[2] >> 16) & 65535;
- gdk_dnd.dnd_drag_dropzone.width = xevent->xclient.data.l[3] & 65535;
- gdk_dnd.dnd_drag_dropzone.height =
- (xevent->xclient.data.l[3] >> 16) & 65535;
- }
- }
- else if(xevent->xclient.message_type == gdk_dnd.gdk_XdeDataAvailable)
- {
- gint tmp_int; Atom tmp_atom;
- gulong tmp_long;
- guchar *tmp_charptr;
-
-#ifdef G_ENABLE_DEBUG
- if (gdk_debug_flags & (GDK_DEBUG_EVENTS | GDK_DEBUG_DND))
- g_print("GDK_DROP_DATA_AVAIL\n");
-#endif
- event->dropdataavailable.u.allflags = xevent->xclient.data.l[1];
- event->dropdataavailable.timestamp = xevent->xclient.data.l[4];
- event->dropdataavailable.coords.x =
- xevent->xclient.data.l[3] & 0xffff;
- event->dropdataavailable.coords.y =
- (xevent->xclient.data.l[3] >> 16) & 0xffff;
- if(window
- /* No preview of data ATM */
- && event->dropdataavailable.u.flags.isdrop)
- {
- event->dropdataavailable.type = GDK_DROP_DATA_AVAIL;
- event->dropdataavailable.window = window;
- event->dropdataavailable.requestor = xevent->xclient.data.l[0];
- event->dropdataavailable.data_type =
- gdk_atom_name(xevent->xclient.data.l[2]);
- if(XGetWindowProperty (gdk_display,
- event->dropdataavailable.requestor,
- xevent->xclient.data.l[2],
- 0, LONG_MAX - 1,
- False, XA_PRIMARY, &tmp_atom,
- &tmp_int,
- &event->dropdataavailable.data_numbytes,
- &tmp_long,
- &tmp_charptr)
- != Success)
- {
- g_warning("XGetWindowProperty on %#x may have failed\n",
- event->dropdataavailable.requestor);
- event->dropdataavailable.data = NULL;
- }
- else
- {
- GDK_NOTE (DND, g_print("XGetWindowProperty got us %ld bytes\n",
- event->dropdataavailable.data_numbytes));
- event->dropdataavailable.data =
- g_malloc (event->dropdataavailable.data_numbytes);
- memcpy (event->dropdataavailable.data,
- tmp_charptr, event->dropdataavailable.data_numbytes);
- XFree(tmp_charptr);
- return_val = TRUE;
- }
- return_val = TRUE;
- }
- }
- else
- {
- /* Send unknown ClientMessage's on to Gtk for it to use */
- event->client.type = GDK_CLIENT_EVENT;
- event->client.window = window;
- event->client.message_type = xevent->xclient.message_type;
- event->client.data_format = xevent->xclient.format;
- memcpy(&event->client.data, &xevent->xclient.data,
- sizeof(event->client.data));
- if(window)
- return_val = TRUE;
- else
- return_val = FALSE;
- }
- if(window_private)
- return_val = return_val && !window_private->destroyed;
- break;
-
- case MappingNotify:
- /* Print debugging info.
- */
- GDK_NOTE (EVENTS,
- g_print ("mapping notify\n"));
-
- /* Let XLib know that there is a new keyboard mapping.
- */
- XRefreshKeyboardMapping (&xevent->xmapping);
- break;
-
- default:
- /* something else - (e.g., a Xinput event) */
-
- if (window_private &&
- (window_private->extension_events != 0) &&
- gdk_input_vtable.other_event)
- return_val = gdk_input_vtable.other_event(event, xevent, window);
- else
- return_val = -1;
-
- if (return_val < 0) /* not an XInput event, convert */
- {
- event->other.type = GDK_OTHER_EVENT;
- event->other.window = window;
- event->other.xevent = (GdkXEvent *)&other_xevent[other_xevent_i];
- memcpy (&other_xevent[other_xevent_i], xevent, sizeof (XEvent));
- other_xevent_i = (other_xevent_i+1) % OTHER_XEVENT_BUFSIZE;
- return_val = TRUE;
- }
- else
- return_val = return_val && !window_private->destroyed;
-
- break;
- }
-
- if (return_val)
- {
- if (event->any.window)
- gdk_window_ref (event->any.window);
- if (((event->any.type == GDK_ENTER_NOTIFY) ||
- (event->any.type == GDK_LEAVE_NOTIFY)) &&
- (event->crossing.subwindow != NULL))
- gdk_window_ref (event->crossing.subwindow);
- }
- else
- {
- /* Mark this event as having no resources to be freed */
- event->any.window = NULL;
- event->any.type = GDK_NOTHING;
- }
-
- if (window)
- gdk_window_unref (window);
-
- return return_val;
-}
-
-#if 0
-static Bool
-gdk_event_get_type (Display *display,
- XEvent *xevent,
- XPointer arg)
-{
- GdkEvent event;
- GdkPredicate *pred;
-
- if (gdk_event_translate (&event, xevent))
- {
- pred = (GdkPredicate*) arg;
- return (* pred->func) (&event, pred->data);
- }
-
- return FALSE;
-}
-#endif
-
-static void
-gdk_synthesize_click (GdkEvent *event,
- gint nclicks)
-{
- GdkEvent temp_event;
-
- g_return_if_fail (event != NULL);
-
- temp_event = *event;
- temp_event.type = (nclicks == 2) ? GDK_2BUTTON_PRESS : GDK_3BUTTON_PRESS;
-
- gdk_event_put (&temp_event);
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_exit_func
- *
- * This is the "atexit" function that makes sure the
- * library gets a chance to cleanup.
- *
- * Arguments:
- *
- * Results:
- *
- * Side effects:
- * The library is un-initialized and the program exits.
- *
- *--------------------------------------------------------------
- */
-
-static void
-gdk_exit_func ()
-{
- static gboolean in_gdk_exit_func = FALSE;
-
- /* This is to avoid an infinite loop if a program segfaults in
- an atexit() handler (and yes, it does happen, especially if a program
- has trounced over memory too badly for even g_print to work) */
- if(in_gdk_exit_func == TRUE) return;
- in_gdk_exit_func = TRUE;
-
- if (initialized)
- {
-#ifdef USE_XIM
- /* cleanup IC */
- gdk_ic_cleanup ();
- /* close IM */
- gdk_im_close ();
-#endif
- gdk_image_exit ();
- gdk_input_exit ();
- gdk_key_repeat_restore ();
-
- XCloseDisplay (gdk_display);
- initialized = 0;
- }
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_x_error
- *
- * The X error handling routine.
- *
- * Arguments:
- * "display" is the X display the error orignated from.
- * "error" is the XErrorEvent that we are handling.
- *
- * Results:
- * Either we were expecting some sort of error to occur,
- * in which case we set the "gdk_error_code" flag, or this
- * error was unexpected, in which case we will print an
- * error message and exit. (Since trying to continue will
- * most likely simply lead to more errors).
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-static int
-gdk_x_error (Display *display,
- XErrorEvent *error)
-{
- char buf[64];
-
- if (gdk_error_warnings)
- {
- XGetErrorText (display, error->error_code, buf, 63);
- g_error ("%s", buf);
- }
-
- gdk_error_code = -1;
- return 0;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_x_io_error
- *
- * The X I/O error handling routine.
- *
- * Arguments:
- * "display" is the X display the error orignated from.
- *
- * Results:
- * An X I/O error basically means we lost our connection
- * to the X server. There is not much we can do to
- * continue, so simply print an error message and exit.
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-static int
-gdk_x_io_error (Display *display)
-{
- g_error ("an x io error occurred");
- return 0;
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_signal
- *
- * The signal handler.
- *
- * Arguments:
- * "sig_num" is the number of the signal we received.
- *
- * Results:
- * The signals we catch are all fatal. So we simply build
- * up a nice little error message and print it and exit.
- * If in the process of doing so another signal is received
- * we notice that we are already exiting and simply kill
- * our process.
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-static RETSIGTYPE
-gdk_signal (int sig_num)
-{
- static int caught_fatal_sig = 0;
- char *sig;
-
- if (caught_fatal_sig)
- kill (getpid (), sig_num);
- caught_fatal_sig = 1;
-
- switch (sig_num)
- {
- case SIGHUP:
- sig = "sighup";
- break;
- case SIGINT:
- sig = "sigint";
- break;
- case SIGQUIT:
- sig = "sigquit";
- break;
- case SIGBUS:
- sig = "sigbus";
- break;
- case SIGSEGV:
- sig = "sigsegv";
- break;
- case SIGPIPE:
- sig = "sigpipe";
- break;
- case SIGTERM:
- sig = "sigterm";
- break;
- default:
- sig = "unknown signal";
- break;
- }
-
- g_print ("\n** ERROR **: %s caught\n", sig);
-#ifdef G_ENABLE_DEBUG
- abort ();
-#else /* !G_ENABLE_DEBUG */
- gdk_exit (1);
-#endif /* !G_ENABLE_DEBUG */
-}
-
-static void
-gdk_dnd_drag_begin (GdkWindow *initial_window)
-{
- GdkEventDragBegin tev;
- tev.type = GDK_DRAG_BEGIN;
- tev.window = initial_window;
- tev.u.allflags = 0;
- tev.u.flags.protocol_version = DND_PROTOCOL_VERSION;
-
- gdk_event_put ((GdkEvent *) &tev);
-}
-
-static void
-gdk_dnd_drag_enter (Window dest)
-{
- XEvent sev;
- GdkEventDropEnter tev;
- int i;
- GdkWindowPrivate *wp;
-
- sev.xclient.type = ClientMessage;
- sev.xclient.format = 32;
- sev.xclient.message_type = gdk_dnd.gdk_XdeEnter;
- sev.xclient.window = dest;
-
- tev.u.allflags = 0;
- tev.u.flags.protocol_version = DND_PROTOCOL_VERSION;
- tev.u.flags.sendreply = 1;
- for (i = 0; i < gdk_dnd.drag_numwindows; i++)
- {
- wp = (GdkWindowPrivate *) gdk_dnd.drag_startwindows[i];
- if (wp->dnd_drag_data_numtypesavail)
- {
- sev.xclient.data.l[0] = wp->xwindow;
- tev.u.flags.extended_typelist = (wp->dnd_drag_data_numtypesavail > 3)?1:0;
- sev.xclient.data.l[1] = tev.u.allflags;
- sev.xclient.data.l[2] = wp->dnd_drag_data_typesavail[0];
- if (wp->dnd_drag_data_numtypesavail > 1)
- {
- sev.xclient.data.l[3] = wp->dnd_drag_data_typesavail[1];
- if (wp->dnd_drag_data_numtypesavail > 2)
- {
- sev.xclient.data.l[4] = wp->dnd_drag_data_typesavail[2];
- }
- else
- sev.xclient.data.l[4] = None;
- }
- else
- sev.xclient.data.l[3] = sev.xclient.data.l[4] = None;
- if (!gdk_send_xevent (dest, False, NoEventMask, &sev))
- GDK_NOTE (DND, g_print("Sending XdeEnter to %#lx failed\n",
- dest));
- }
-
- }
-}
-
-
-#ifdef USE_XIM
-
-/*
- *--------------------------------------------------------------
- * gdk_im_begin
- *
- * Begin using input method with XIM Protocol(X11R6 standard)
- *
- * Arguments:
- * "ic" is the "Input Context" which is created by gtk_ic_new.
- * The input area is specified with "window".
- *
- * Results:
- * The gdk's event handling routine is switched to XIM based routine.
- * XIM based routine uses XFilterEvent to get rid of events used by IM,
- * and uses XmbLookupString instead of XLookupString.
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-void
-gdk_im_begin (GdkIC ic, GdkWindow* window)
-{
- GdkICPrivate *private;
- Window xwin;
-
- g_return_if_fail (ic != NULL);
- g_return_if_fail (window);
-
- private = (GdkICPrivate *) ic;
-
- xim_using = TRUE;
- xim_ic = private;
- xim_window = window;
- if (gdk_im_ready())
- {
- XGetICValues (private->xic, XNFocusWindow, &xwin, NULL);
- if (xwin != GDK_WINDOW_XWINDOW(window))
- XSetICValues (private->xic, XNFocusWindow,
- GDK_WINDOW_XWINDOW(window), NULL);
- if (private != xim_ic)
- XSetICFocus (private->xic);
- }
-}
-
-/*
- *--------------------------------------------------------------
- * gdk_im_end
- *
- * End using input method with XIM Protocol(X11R6 standard)
- *
- * Arguments:
- *
- * Results:
- * The gdk's event handling routine is switched to normal routine.
- * User should call this function before ic and window will be destroyed.
- *
- * Side effects:
- *
- *--------------------------------------------------------------
- */
-
-void
-gdk_im_end (void)
-{
- xim_using = FALSE;
- xim_ic = NULL;
- xim_window = NULL;
-}
-
-static GdkIM
-gdk_im_get (void)
-{
- return xim_im;
-}
-
-static GdkIMStyle
-gdk_im_choose_better_style (GdkIMStyle style1, GdkIMStyle style2)
-{
- GdkIMStyle s1, s2, u;
-
- if (style1 == 0) return style2;
- if (style2 == 0) return style1;
- if ((style1 & (GdkIMPreeditMask | GdkIMStatusMask))
- == (style2 & (GdkIMPreeditMask | GdkIMStatusMask)))
- return style1;
-
- s1 = style1 & GdkIMPreeditMask;
- s2 = style2 & GdkIMPreeditMask;
- u = s1 | s2;
- if (s1 != s2) {
- if (u & GdkIMPreeditCallbacks)
- return (s1 == GdkIMPreeditCallbacks)? style1:style2;
- else if (u & GdkIMPreeditPosition)
- return (s1 == GdkIMPreeditPosition)? style1:style2;
- else if (u & GdkIMPreeditArea)
- return (s1 == GdkIMPreeditArea)? style1:style2;
- else if (u & GdkIMPreeditNothing)
- return (s1 == GdkIMPreeditNothing)? style1:style2;
- } else {
- s1 = style1 & GdkIMStatusMask;
- s2 = style2 & GdkIMStatusMask;
- u = s1 | s2;
- if ( u & GdkIMStatusCallbacks)
- return (s1 == GdkIMStatusCallbacks)? style1:style2;
- else if ( u & GdkIMStatusArea)
- return (s1 == GdkIMStatusArea)? style1:style2;
- else if ( u & GdkIMStatusNothing)
- return (s1 == GdkIMStatusNothing)? style1:style2;
- else if ( u & GdkIMStatusNone)
- return (s1 == GdkIMStatusNone)? style1:style2;
- }
- return 0; /* Get rid of stupid warning */
-}
-
-GdkIMStyle
-gdk_im_decide_style (GdkIMStyle supported_style)
-{
- gint i;
- GdkIMStyle style, tmp;
-
- g_return_val_if_fail (xim_styles != NULL, 0);
-
- style = 0;
- for (i=0; i<xim_styles->count_styles; i++)
- {
- tmp = xim_styles->supported_styles[i];
- if (tmp == (tmp & supported_style & xim_best_allowed_style))
- style = gdk_im_choose_better_style (style, tmp);
- }
- return style;
-}
-
-GdkIMStyle
-gdk_im_set_best_style (GdkIMStyle style)
-{
- if (style & GdkIMPreeditMask)
- {
- xim_best_allowed_style &= ~GdkIMPreeditMask;
-
- xim_best_allowed_style |= GdkIMPreeditNone;
- if (!(style & GdkIMPreeditNone))
- {
- xim_best_allowed_style |= GdkIMPreeditNothing;
- if (!(style & GdkIMPreeditNothing))
- {
- xim_best_allowed_style |= GdkIMPreeditArea;
- if (!(style & GdkIMPreeditArea))
- {
- xim_best_allowed_style |= GdkIMPreeditPosition;
- if (!(style & GdkIMPreeditPosition))
- xim_best_allowed_style |= GdkIMPreeditCallbacks;
- }
- }
- }
- }
- if (style & GdkIMStatusMask)
- {
- xim_best_allowed_style &= ~GdkIMStatusMask;
-
- xim_best_allowed_style |= GdkIMStatusNone;
- if (!(style & GdkIMStatusNone))
- {
- xim_best_allowed_style |= GdkIMStatusNothing;
- if (!(style & GdkIMStatusNothing))
- {
- xim_best_allowed_style |= GdkIMStatusArea;
- if (!(style & GdkIMStatusArea))
- xim_best_allowed_style |= GdkIMStatusCallbacks;
- }
- }
- }
-
- return xim_best_allowed_style;
-}
-
-static gint
-gdk_im_open (XrmDatabase db, gchar* res_name, gchar* res_class)
-{
- xim_im = XOpenIM (GDK_DISPLAY(), db, res_name, res_class);
- if (xim_im == NULL)
- {
- GDK_NOTE (XIM, g_warning ("Unable to open open IM."));
- return FALSE;
- }
- XGetIMValues (xim_im, XNQueryInputStyle, &xim_styles, NULL, NULL);
-
- return TRUE;
-}
-
-static void
-gdk_im_close (void)
-{
- if (xim_im)
- {
- XCloseIM (xim_im);
- xim_im = NULL;
- }
- if (xim_styles)
- {
- XFree (xim_styles);
- xim_styles = NULL;
- }
-}
-
-gint
-gdk_im_ready (void)
-{
- return (xim_im != NULL);
-}
-
-GdkIC
-gdk_ic_new (GdkWindow* client_window,
- GdkWindow* focus_window,
- GdkIMStyle style, ...)
-{
- va_list list;
- GdkICPrivate *private;
- XVaNestedList preedit_attr;
-
- g_return_val_if_fail (client_window != NULL, NULL);
- g_return_val_if_fail (focus_window != NULL, NULL);
- g_return_val_if_fail (gdk_im_ready(), NULL);
-
- private = g_new (GdkICPrivate, 1);
-
- va_start (list, style);
- preedit_attr = (XVaNestedList) & (va_arg (list, void *));
- va_end (list);
-
- private->style = gdk_im_decide_style (style);
- if (private->style != style)
- {
- g_warning ("can not create input context with specified input style.");
- g_free (private);
- return NULL;
- }
-
- private->xic = XCreateIC(gdk_im_get (),
- XNInputStyle, style,
- XNClientWindow, GDK_WINDOW_XWINDOW (client_window),
- XNFocusWindow, GDK_WINDOW_XWINDOW (focus_window),
- preedit_attr? XNPreeditAttributes : NULL, preedit_attr,
- NULL);
- if (!private->xic)
- {
- g_free (private);
- return NULL;
- }
-
- xim_ic_list = g_list_append (xim_ic_list, private);
- return private;
-}
-
-void
-gdk_ic_destroy (GdkIC ic)
-{
- GdkICPrivate *private;
-
- g_return_if_fail (ic != NULL);
-
- private = (GdkICPrivate *) ic;
-
- if (xim_ic == private)
- gdk_im_end ();
-
- XDestroyIC (private->xic);
- xim_ic_list = g_list_remove (xim_ic_list, private);
- g_free (private);
-}
-
-GdkIMStyle
-gdk_ic_get_style (GdkIC ic)
-{
- GdkICPrivate *private;
-
- g_return_val_if_fail (ic != NULL, 0);
-
- private = (GdkICPrivate *) ic;
-
- return private->style;
-}
-
-void
-gdk_ic_set_values (GdkIC ic, ...)
-{
- va_list list;
- XVaNestedList args;
- GdkICPrivate *private;
-
- g_return_if_fail (ic != NULL);
-
- private = (GdkICPrivate *) ic;
-
- va_start (list, ic);
- args = (XVaNestedList) & (va_arg (list, void *));
- va_end (list);
-
- XSetICValues (private->xic, XNVaNestedList, args, NULL);
-}
-
-void
-gdk_ic_get_values (GdkIC ic, ...)
-{
- va_list list;
- XVaNestedList args;
- GdkICPrivate *private;
-
- g_return_if_fail (ic != NULL);
-
- private = (GdkICPrivate *) ic;
-
- va_start (list, ic);
- args = (XVaNestedList) & (va_arg (list, void *));
- va_end (list);
-
- XGetICValues (private->xic, XNVaNestedList, args, NULL);
-}
-
-void
-gdk_ic_set_attr (GdkIC ic, const char *target, ...)
-{
- va_list list;
- XVaNestedList attr;
- GdkICPrivate *private;
-
- g_return_if_fail (ic != NULL);
- g_return_if_fail (target != NULL);
-
- private = (GdkICPrivate *) ic;
-
- va_start (list, target);
- attr = (XVaNestedList) & (va_arg (list, void *));
- va_end (list);
-
- XSetICValues (private->xic, target, attr, NULL);
-}
-
-void
-gdk_ic_get_attr (GdkIC ic, const char *target, ...)
-{
- va_list list;
- XVaNestedList attr;
- GdkICPrivate *private;
-
- g_return_if_fail (ic != NULL);
- g_return_if_fail (target != NULL);
-
- private = (GdkICPrivate *) ic;
-
- va_start (list, target);
- attr = (XVaNestedList) & (va_arg (list, void *));
- va_end (list);
-
- XGetICValues (private->xic, target, attr, NULL);
-}
-
-GdkEventMask
-gdk_ic_get_events (GdkIC ic)
-{
- GdkEventMask mask;
- glong xmask;
- glong bit;
- GdkICPrivate *private;
- gint i;
-
- /* From gdkwindow.c */
- extern int nevent_masks;
- extern int event_mask_table[];
-
- g_return_val_if_fail (ic != NULL, 0);
-
- private = (GdkICPrivate *) ic;
-
- if (XGetICValues (private->xic, XNFilterEvents, &xmask, NULL) != NULL)
- {
- GDK_NOTE (XIM, g_warning ("Call to XGetICValues: %s failed", XNFilterEvents));
- return 0;
- }
-
- mask = 0;
- for (i=0, bit=2; i < nevent_masks; i++, bit <<= 1)
- if (xmask & event_mask_table [i])
- {
- mask |= bit;
- xmask &= ~ event_mask_table [i];
- }
-
- if (xmask)
- g_warning ("ic requires events not supported by the application (%#04lx)", xmask);
-
- return mask;
-}
-
-static void
-gdk_ic_cleanup (void)
-{
- GList* node;
- gint destroyed;
- GdkICPrivate *private;
-
- destroyed = 0;
- for (node = xim_ic_list; node != NULL; node = node->next)
- {
- if (node->data)
- {
- private = (GdkICPrivate *) (node->data);
- XDestroyIC (private->xic);
- g_free (private);
- destroyed++;
- }
- }
-#ifdef G_ENABLE_DEBUG
- if ((gdk_debug_flags & GDK_DEBUG_XIM) && destroyed > 0)
- {
- g_warning ("Cleaned up %i IC(s)\n", destroyed);
- }
-#endif /* G_ENABLE_DEBUG */
- g_list_free(xim_ic_list);
- xim_ic_list = NULL;
-}
-
-#else /* !USE_XIM */
-
-void
-gdk_im_begin (GdkIC ic, GdkWindow* window)
-{
-}
-
-void
-gdk_im_end (void)
-{
-}
-
-GdkIMStyle
-gdk_im_decide_style (GdkIMStyle supported_style)
-{
- return GdkIMPreeditNone | GdkIMStatusNone;
-}
-
-GdkIMStyle
-gdk_im_set_best_style (GdkIMStyle style)
-{
- return GdkIMPreeditNone | GdkIMStatusNone;
-}
-
-gint
-gdk_im_ready (void)
-{
- return FALSE;
-}
-
-GdkIC
-gdk_ic_new (GdkWindow* client_window,
- GdkWindow* focus_window,
- GdkIMStyle style, ...)
-{
- return NULL;
-}
-
-void
-gdk_ic_destroy (GdkIC ic)
-{
-}
-
-GdkIMStyle
-gdk_ic_get_style (GdkIC ic)
-{
- return GdkIMPreeditNone | GdkIMStatusNone;
-}
-
-void
-gdk_ic_set_values (GdkIC ic, ...)
-{
-}
-
-void
-gdk_ic_get_values (GdkIC ic, ...)
-{
-}
-
-void
-gdk_ic_set_attr (GdkIC ic, const char *target, ...)
-{
-}
-
-void
-gdk_ic_get_attr (GdkIC ic, const char *target, ...)
-{
-}
-
-GdkEventMask
-gdk_ic_get_events (GdkIC ic)
-{
- return 0;
-}
-
-#endif /* USE_XIM */
-
-#ifdef X_LOCALE
-
-gint
-_g_mbtowc (wchar_t *wstr, const char *str, size_t len)
-{
- static wchar_t wcs[MB_CUR_MAX + 1];
- static gchar mbs[MB_CUR_MAX + 1];
-
- wcs[0] = (wchar_t) NULL;
- mbs[0] = '\0';
-
- len = _Xmbstowcs (wcs, str, (len<MB_CUR_MAX)? len:MB_CUR_MAX);
- if (len < 1)
- return len;
- else if (wcs[0] == (wchar_t) NULL)
- return -1;
-
- len = _Xwctomb (mbs, wcs[0]);
- if (mbs[0] == '\0')
- return -1;
- if (wstr)
- *wstr = wcs[0];
-
- return len;
-}
-
-#endif /* X_LOCALE */
-
-static void
-gdk_dnd_drag_leave (Window dest)
-{
- XEvent sev;
- GdkEventDropLeave tev;
- int i;
- GdkWindowPrivate *wp;
-
- tev.u.allflags = 0;
-
- tev.u.flags.protocol_version = DND_PROTOCOL_VERSION;
- sev.xclient.type = ClientMessage;
- sev.xclient.window = dest;
- sev.xclient.format = 32;
- sev.xclient.message_type = gdk_dnd.gdk_XdeLeave;
- sev.xclient.data.l[1] = tev.u.allflags;
- for (i = 0; i < gdk_dnd.drag_numwindows; i++)
- {
- wp = (GdkWindowPrivate *) gdk_dnd.drag_startwindows[i];
- sev.xclient.data.l[0] = wp->xwindow;
- if (!gdk_send_xevent (dest, False, NoEventMask, &sev))
- GDK_NOTE (DND, g_print("Sending XdeLeave to %#lx failed\n",
- dest));
- wp->dnd_drag_accepted = 0;
- }
-}
-
-/*
- * when a drop occurs, we go through the list of windows being dragged and
- * tell them that it has occurred, so that they can set things up and reply
- * to 'dest' window
- */
-static void
-gdk_dnd_drag_end (Window dest,
- GdkPoint coords)
-{
- GdkWindowPrivate *wp;
- GdkEventDragRequest tev;
- int i;
-
- tev.type = GDK_DRAG_REQUEST;
- tev.drop_coords = coords;
- tev.requestor = dest;
- tev.u.allflags = 0;
- tev.u.flags.protocol_version = DND_PROTOCOL_VERSION;
- tev.isdrop = 1;
-
- for (i = 0; i < gdk_dnd.drag_numwindows; i++)
- {
- wp = (GdkWindowPrivate *) gdk_dnd.drag_startwindows[i];
- if (wp->dnd_drag_accepted)
- {
- tev.window = (GdkWindow *) wp;
- tev.u.flags.delete_data = wp->dnd_drag_destructive_op;
- tev.timestamp = gdk_dnd.last_drop_time;
- tev.data_type =
- gdk_atom_name(wp->dnd_drag_data_type);
-
- gdk_event_put((GdkEvent *) &tev);
- }
- }
-}
-
-static GdkAtom
-gdk_dnd_check_types (GdkWindow *window,
- XEvent *xevent)
-{
- GdkWindowPrivate *wp = (GdkWindowPrivate *) window;
- int i, j;
- GdkEventDropEnter event;
-
- g_return_val_if_fail(window != NULL, 0);
- g_return_val_if_fail(xevent != NULL, 0);
- g_return_val_if_fail(xevent->type == ClientMessage, 0);
- g_return_val_if_fail(xevent->xclient.message_type == gdk_dnd.gdk_XdeEnter, 0);
-
- if(wp->dnd_drop_data_numtypesavail <= 0 ||
- !wp->dnd_drop_data_typesavail)
- return 0;
-
- for (i = 2; i <= 4; i++)
- {
- for (j = 0; j < wp->dnd_drop_data_numtypesavail; j++)
- {
- if (xevent->xclient.data.l[i] == wp->dnd_drop_data_typesavail[j])
- return xevent->xclient.data.l[i];
- }
- }
-
- /* Now we get the extended type list if it's available */
- event.u.allflags = xevent->xclient.data.l[1];
- if (event.u.flags.extended_typelist)
- {
- Atom *exttypes, realtype;
- gulong nitems, nbar;
- gint realfmt;
-
- if (XGetWindowProperty(gdk_display, xevent->xclient.data.l[0],
- gdk_dnd.gdk_XdeTypelist, 0L, LONG_MAX - 1,
- False, AnyPropertyType, &realtype, &realfmt,
- &nitems, &nbar, (unsigned char **) &exttypes)
- != Success)
- return 0;
-
- if (realfmt != (sizeof(Atom) * 8))
- {
- g_warning("XdeTypelist property had format of %d instead of the expected %d, on window %#lx\n",
- realfmt, sizeof(Atom) * 8, xevent->xclient.data.l[0]);
- return 0;
- }
-
- for (i = 0; i <= nitems; i++)
- {
- for (j = 0; j < wp->dnd_drop_data_numtypesavail; j++)
- {
- if (exttypes[i] == wp->dnd_drop_data_typesavail[j])
- {
- XFree (exttypes);
- return exttypes[i];
- }
- }
- }
- XFree (exttypes);
- }
- return 0;
-}
-
-/*
- * used for debugging only
- */
-#ifdef DEBUG_DND
-static void
-gdk_print_atom (GdkAtom anatom)
-{
- gchar *tmpstr = NULL;
- tmpstr = (anatom!=None)?gdk_atom_name(anatom):"(none)";
- g_print("Atom %lu has name %s\n", anatom, tmpstr);
- if(tmpstr)
- g_free(tmpstr);
-}
-#endif
-
-/*
- * used only by below routine and itself
- */
-static Window
-getchildren (Display *dpy,
- Window win,
- Atom WM_STATE)
-{
- Window root, parent, *children, inf = 0;
- Atom type = None;
- unsigned int nchildren, i;
- int format;
- unsigned long nitems, after;
- unsigned char *data;
-
- if (XQueryTree(dpy, win, &root, &parent, &children, &nchildren) == 0)
- return 0;
-
- for (i = 0; !inf && (i < nchildren); i++)
- {
- XGetWindowProperty (dpy, children[i], WM_STATE, 0, 0, False,
- AnyPropertyType, &type, &format, &nitems,
- &after, &data);
- if (type != 0)
- inf = children[i];
- XFree(data);
- }
-
- for (i = 0; !inf && (i < nchildren); i++)
- inf = getchildren (dpy, children[i], WM_STATE);
-
- if (children != None)
- XFree ((char *) children);
-
- return inf;
-}
-
-/*
- * find a window with WM_STATE, else return win itself, as per ICCCM
- *
- * modification of the XmuClientWindow() routine from X11R6.3
- */
-Window
-gdk_get_client_window (Display *dpy,
- Window win)
-{
- Atom WM_STATE;
- Atom type = None;
- int format;
- unsigned long nitems, after;
- unsigned char *data;
- Window inf;
-
- if (win == 0)
- return DefaultRootWindow(dpy);
-
- if ((WM_STATE = XInternAtom (dpy, "WM_STATE", True)) == 0)
- return win;
-
- XGetWindowProperty (dpy, win, WM_STATE, 0, 0, False, AnyPropertyType,
- &type, &format, &nitems, &after, &data);
- if (type)
- return win;
-
- inf = getchildren (dpy, win, WM_STATE);
-
- if (inf == 0)
- return win;
- else
- return inf;
-}
-
-#ifdef WE_HAVE_MOTIF_DROPS_DONE
-static GdkWindow *
-gdk_drop_get_real_window (GdkWindow *w,
- guint16 *x,
- guint16 *y)
-{
- GdkWindow *retval = w;
- GdkWindowPrivate *awin;
- GList *children;
- gint16 myx = *x, myy = *y;
-
- g_return_val_if_fail(w != NULL && x != NULL && y != NULL, NULL);
-
- myx = *x;
- myy = *y;
-
-descend:
- for (children = gdk_window_get_children(retval);
- children && children->next;
- children = children->next)
- {
- awin = (GdkWindowPrivate *) children->data;
- if ((myx >= awin->x) && (myy >= awin->y)
- && (myx < (awin->x + awin->width))
- && (myy < (awin->y + awin->height)))
- {
- retval = (GdkWindow *) awin;
- myx -= awin->x;
- myy -= awin->y;
- goto descend;
- }
- }
-
- *x = myx;
- *y = myy;
-
- return retval;
-}
-#endif
-
-/* Sends a ClientMessage to all toplevel client windows */
-void
-gdk_event_send_clientmessage_toall(GdkEvent *event)
-{
- XEvent sev;
- Window *ret_children, ret_root, ret_parent, curwin;
- unsigned int ret_nchildren;
- int i;
-
- g_return_if_fail(event != NULL);
-
- /* Set up our event to send, with the exception of its target window */
- sev.xclient.type = ClientMessage;
- sev.xclient.display = gdk_display;
- sev.xclient.format = event->client.data_format;
- sev.xclient.serial = CurrentTime;
- memcpy(&sev.xclient.data, &event->client.data, sizeof(sev.xclient.data));
- sev.xclient.message_type = event->client.message_type;
-
- /* OK, we're all set, now let's find some windows to send this to */
- if(XQueryTree(gdk_display, gdk_root_window, &ret_root, &ret_parent,
- &ret_children, &ret_nchildren) != True)
- return;
-
- /* foreach true child window of the root window, send an event to it */
- for(i = 0; i < ret_nchildren; i++) {
- curwin = gdk_get_client_window(gdk_display, ret_children[i]);
- sev.xclient.window = curwin;
- if (!gdk_send_xevent (curwin, False, NoEventMask, &sev))
- GDK_NOTE (MISC, g_print("Sending client message %ld to %#lx failed\n",
- event->client.message_type, curwin));
- }
-
- XFree(ret_children);
-}
-
-gchar *
-gdk_get_display(void)
-{
- return (gchar *)XDisplayName (gdk_display_name);
-}
-
-gint
-gdk_send_xevent (Window window, gboolean propagate, glong event_mask,
- XEvent *event_send)
-{
- Status result;
-
- gdk_error_code = 0;
-
- gdk_error_warnings = 0;
- result = XSendEvent (gdk_display, window, propagate, event_mask, event_send);
- XSync (gdk_display, False);
- gdk_error_warnings = 1;
-
- return result && (gdk_error_code != -1);
-}
diff --git a/gdk/x11/gdkpixmap-x11.c b/gdk/x11/gdkpixmap-x11.c
deleted file mode 100644
index 6fbdada880..0000000000
--- a/gdk/x11/gdkpixmap-x11.c
+++ /dev/null
@@ -1,734 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "../config.h"
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-/* Needed for SEEK_END in SunOS */
-#include <unistd.h>
-#include <X11/Xlib.h>
-
-#include "gdk.h"
-#include "gdkprivate.h"
-
-typedef struct
-{
- gchar *color_string;
- GdkColor color;
- gint transparent;
-} _GdkPixmapColor;
-
-GdkPixmap*
-gdk_pixmap_new (GdkWindow *window,
- gint width,
- gint height,
- gint depth)
-{
- GdkPixmap *pixmap;
- GdkWindowPrivate *private;
- GdkWindowPrivate *window_private;
-
- g_return_val_if_fail ((window != NULL) || (depth != -1), NULL);
-
- if (!window)
- window = (GdkWindow*) &gdk_root_parent;
-
- window_private = (GdkWindowPrivate*) window;
- if (window_private->destroyed)
- return NULL;
-
- if (depth == -1)
- gdk_window_get_geometry (window, NULL, NULL, NULL, NULL, &depth);
-
- private = g_new (GdkWindowPrivate, 1);
- pixmap = (GdkPixmap*) private;
-
- private->xdisplay = window_private->xdisplay;
- private->window_type = GDK_WINDOW_PIXMAP;
- private->xwindow = XCreatePixmap (private->xdisplay, window_private->xwindow,
- width, height, depth);
- private->parent = NULL;
- private->x = 0;
- private->y = 0;
- private->width = width;
- private->height = height;
- private->resize_count = 0;
- private->ref_count = 1;
- private->destroyed = 0;
-
- gdk_xid_table_insert (&private->xwindow, pixmap);
-
- return pixmap;
-}
-
-GdkPixmap *
-gdk_bitmap_create_from_data (GdkWindow *window,
- gchar *data,
- gint width,
- gint height)
-{
- GdkPixmap *pixmap;
- GdkWindowPrivate *private;
- GdkWindowPrivate *window_private;
-
- g_return_val_if_fail (data != NULL, NULL);
-
- if (!window)
- window = (GdkWindow*) &gdk_root_parent;
-
- window_private = (GdkWindowPrivate*) window;
- if (window_private->destroyed)
- return NULL;
-
- private = g_new (GdkWindowPrivate, 1);
- pixmap = (GdkPixmap*) private;
-
- private->parent = NULL;
- private->xdisplay = window_private->xdisplay;
- private->window_type = GDK_WINDOW_PIXMAP;
- private->x = 0;
- private->y = 0;
- private->width = width;
- private->height = height;
- private->resize_count = 0;
- private->ref_count = 1;
- private->destroyed = FALSE;
-
- private->xwindow = XCreateBitmapFromData (private->xdisplay,
- window_private->xwindow,
- data, width, height);
-
- gdk_xid_table_insert (&private->xwindow, pixmap);
-
- return pixmap;
-}
-
-GdkPixmap*
-gdk_pixmap_create_from_data (GdkWindow *window,
- gchar *data,
- gint width,
- gint height,
- gint depth,
- GdkColor *fg,
- GdkColor *bg)
-{
- GdkPixmap *pixmap;
- GdkWindowPrivate *private;
- GdkWindowPrivate *window_private;
-
- g_return_val_if_fail (data != NULL, NULL);
- g_return_val_if_fail (fg != NULL, NULL);
- g_return_val_if_fail (bg != NULL, NULL);
- g_return_val_if_fail ((window != NULL) || (depth != -1), NULL);
-
- if (!window)
- window = (GdkWindow*) &gdk_root_parent;
-
- window_private = (GdkWindowPrivate*) window;
- if (window_private->destroyed)
- return NULL;
-
- if (depth == -1)
- gdk_window_get_geometry (window, NULL, NULL, NULL, NULL, &depth);
-
- private = g_new (GdkWindowPrivate, 1);
- pixmap = (GdkPixmap*) private;
-
- private->parent = NULL;
- private->xdisplay = window_private->xdisplay;
- private->window_type = GDK_WINDOW_PIXMAP;
- private->x = 0;
- private->y = 0;
- private->width = width;
- private->height = height;
- private->resize_count = 0;
- private->ref_count = 1;
- private->destroyed = FALSE;
-
- private->xwindow = XCreatePixmapFromBitmapData (private->xdisplay,
- window_private->xwindow,
- data, width, height,
- fg->pixel, bg->pixel, depth);
-
- gdk_xid_table_insert (&private->xwindow, pixmap);
-
- return pixmap;
-}
-
-gint
-gdk_pixmap_seek_string (FILE *infile,
- const gchar *str,
- gint skip_comments)
-{
- char instr[1024];
-
- while (!feof (infile))
- {
- fscanf (infile, "%s", instr);
- if (skip_comments == TRUE && strcmp (instr, "/*") == 0)
- {
- fscanf (infile, "%s", instr);
- while (!feof (infile) && strcmp (instr, "*/") != 0)
- fscanf (infile, "%s", instr);
- fscanf(infile, "%s", instr);
- }
- if (strcmp (instr, str)==0)
- return TRUE;
- }
-
- return FALSE;
-}
-
-gint
-gdk_pixmap_seek_char (FILE *infile,
- gchar c)
-{
- gchar b, oldb;
-
- while (!feof (infile))
- {
- fscanf(infile, "%c", &b);
- if (c != b && b == '/')
- {
- fscanf (infile, "%c", &b);
- if (b == '*')
- {
- oldb = b;
- while (!feof (infile) && !(oldb == '*' && b == '/'))
- {
- oldb = b;
- fscanf (infile, "%c", &b);
- }
- fscanf (infile, "%c", &b);
- }
- }
- if (c == b)
- return TRUE;
- }
-
- return FALSE;
-}
-
-gint
-gdk_pixmap_read_string (FILE *infile,
- gchar **buffer,
- guint *buffer_size)
-{
- gchar c;
- guint cnt = 0;
-
- if ((*buffer) == NULL)
- {
- (*buffer_size) = 10 * sizeof (gchar);
- (*buffer) = (gchar *) malloc (*buffer_size);
- }
-
- do
- fscanf (infile, "%c", &c);
- while (!feof (infile) && c != '"');
-
- if (c != '"')
- return FALSE;
-
- while (!feof (infile))
- {
- fscanf (infile, "%c", &c);
-
- if (cnt == (*buffer_size))
- {
- (*buffer_size) *= 2;
- (*buffer) = (gchar *) realloc ((*buffer), *buffer_size);
- }
-
- if (c != '"')
- (*buffer)[cnt++] = c;
- else
- {
- (*buffer)[cnt++] = 0;
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-gchar*
-gdk_pixmap_skip_whitespaces (gchar *buffer)
-{
- gint32 index = 0;
-
- while (buffer[index] != 0 && (buffer[index] == 0x20 || buffer[index] == 0x09))
- index++;
-
- return &buffer[index];
-}
-
-gchar*
-gdk_pixmap_skip_string (gchar *buffer)
-{
- gint32 index = 0;
-
- while (buffer[index] != 0 && buffer[index] != 0x20 && buffer[index] != 0x09)
- index++;
-
- return &buffer[index];
-}
-
-gchar*
-gdk_pixmap_extract_color (gchar *buffer)
-{
- gint counter, finished = FALSE, numnames;
- gchar *ptr = NULL, ch, temp[128];
- gchar color[128], *retcol;
-
- counter = 0;
- while (ptr == NULL)
- {
- if (buffer[counter] == 'c')
- {
- ch = buffer[counter + 1];
- if (ch == 0x20 || ch == 0x09)
- ptr = &buffer[counter + 1];
- }
- else if (buffer[counter] == 0)
- return NULL;
-
- counter++;
- }
-
- if (ptr == NULL)
- return NULL;
-
- ptr = gdk_pixmap_skip_whitespaces (ptr);
-
- if (ptr[0] == 0)
- return NULL;
- else if (ptr[0] == '#')
- {
- retcol = g_strdup (ptr);
- return retcol;
- }
-
- color[0] = 0;
- numnames = 0;
-
- while (finished == FALSE)
- {
- sscanf (ptr, "%s", temp);
-
- if ((gint)ptr[0] == 0 || strcmp ("s", temp) == 0 || strcmp ("m", temp) == 0 ||
- strcmp ("g", temp) == 0 || strcmp ("g4", temp) == 0)
- finished = TRUE;
- else
- {
- if (numnames > 0)
- strcat (color, " ");
- strcat (color, temp);
- ptr = gdk_pixmap_skip_string (ptr);
- ptr = gdk_pixmap_skip_whitespaces (ptr);
- numnames++;
- }
- }
-
- retcol = g_strdup (color);
- return retcol;
-}
-
-
-GdkPixmap*
-gdk_pixmap_colormap_create_from_xpm (GdkWindow *window,
- GdkColormap *colormap,
- GdkBitmap **mask,
- GdkColor *transparent_color,
- const gchar *filename)
-{
- FILE *infile = NULL;
- GdkPixmap *pixmap = NULL;
- GdkImage *image = NULL;
- GdkVisual *visual;
- GdkGC *gc;
- GdkColor tmp_color;
- gint width, height, num_cols, cpp, cnt, n, ns, xcnt, ycnt;
- gchar *buffer = NULL, pixel_str[32];
- guint buffer_size = 0;
- _GdkPixmapColor *colors = NULL, *color = NULL;
- gulong index;
-
- if ((window == NULL) && (colormap == NULL))
- g_warning ("Creating pixmap from xpm with NULL window and colormap");
-
- if (window == NULL)
- window = (GdkWindow *)&gdk_root_parent;
-
- if (colormap == NULL)
- {
- colormap = gdk_window_get_colormap (window);
- visual = gdk_window_get_visual (window);
- }
- else
- visual = ((GdkColormapPrivate *)colormap)->visual;
-
- infile = fopen (filename, "rb");
- if (infile != NULL)
- {
- if (gdk_pixmap_seek_string (infile, "XPM", FALSE) == TRUE)
- {
- if (gdk_pixmap_seek_char (infile,'{') == TRUE)
- {
- gdk_pixmap_seek_char (infile, '"');
- fseek (infile, -1, SEEK_CUR);
- gdk_pixmap_read_string (infile, &buffer, &buffer_size);
-
- sscanf (buffer,"%d %d %d %d", &width, &height, &num_cols, &cpp);
-
- colors = g_new(_GdkPixmapColor, num_cols);
-
- if (transparent_color == NULL)
- {
- gdk_color_white (colormap, &tmp_color);
- transparent_color = &tmp_color;
- }
-
- for (cnt = 0; cnt < num_cols; cnt++)
- {
- gchar *color_name;
-
- gdk_pixmap_seek_char (infile, '"');
- fseek (infile, -1, SEEK_CUR);
- gdk_pixmap_read_string (infile, &buffer, &buffer_size);
-
- colors[cnt].color_string = g_new(gchar, cpp + 1);
- for (n = 0; n < cpp; n++)
- colors[cnt].color_string[n] = buffer[n];
- colors[cnt].color_string[n] = 0;
- colors[cnt].transparent = FALSE;
-
- color_name = gdk_pixmap_extract_color (&buffer[cpp]);
-
- if (color_name != NULL)
- {
- if (gdk_color_parse (color_name, &colors[cnt].color) == FALSE)
- {
- colors[cnt].color = *transparent_color;
- colors[cnt].transparent = TRUE;
- }
- }
- else
- {
- colors[cnt].color = *transparent_color;
- colors[cnt].transparent = TRUE;
- }
-
- g_free (color_name);
-
- gdk_color_alloc (colormap, &colors[cnt].color);
- }
-
- index = 0;
- image = gdk_image_new (GDK_IMAGE_FASTEST, visual, width, height);
-
- gc = NULL;
- if (mask)
- {
- /* The pixmap mask is just a bits pattern.
- * Color 0 is used for background and 1 for foreground.
- * We don't care about the colormap, we just need 0 and 1.
- */
- GdkColor mask_pattern;
-
- *mask = gdk_pixmap_new (window, width, height, 1);
- gc = gdk_gc_new (*mask);
-
- mask_pattern.pixel = 0;
- gdk_gc_set_foreground (gc, &mask_pattern);
- gdk_draw_rectangle (*mask, gc, TRUE, 0, 0, -1, -1);
-
- mask_pattern.pixel = 1;
- gdk_gc_set_foreground (gc, &mask_pattern);
- }
-
- for (ycnt = 0; ycnt < height; ycnt++)
- {
- gdk_pixmap_read_string (infile, &buffer, &buffer_size);
-
- for (n = 0, cnt = 0, xcnt = 0; n < (width * cpp); n += cpp, xcnt++)
- {
- strncpy (pixel_str, &buffer[n], cpp);
- pixel_str[cpp] = 0;
- color = NULL;
- ns = 0;
-
- while (color == NULL)
- {
- if (strcmp (pixel_str, colors[ns].color_string) == 0)
- color = &colors[ns];
- else
- ns++;
- }
-
- gdk_image_put_pixel (image, xcnt, ycnt, color->color.pixel);
-
- if (mask && color->transparent)
- {
- if (cnt < xcnt)
- gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
- cnt = xcnt + 1;
- }
- }
-
- if (mask && (cnt < xcnt))
- gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
- }
-
- if (mask)
- gdk_gc_destroy (gc);
-
- pixmap = gdk_pixmap_new (window, width, height, visual->depth);
-
- gc = gdk_gc_new (pixmap);
- gdk_gc_set_foreground (gc, transparent_color);
- gdk_draw_image (pixmap, gc, image, 0, 0, 0, 0, image->width, image->height);
- gdk_gc_destroy (gc);
- gdk_image_destroy (image);
- }
- }
-
- fclose (infile);
- free (buffer);
-
- if (colors != NULL)
- {
- for (cnt = 0; cnt < num_cols; cnt++)
- g_free (colors[cnt].color_string);
- g_free (colors);
- }
- }
-
- return pixmap;
-}
-
-GdkPixmap*
-gdk_pixmap_create_from_xpm (GdkWindow *window,
- GdkBitmap **mask,
- GdkColor *transparent_color,
- const gchar *filename)
-{
- return gdk_pixmap_colormap_create_from_xpm (window, NULL, mask,
- transparent_color, filename);
-}
-
-
-GdkPixmap*
-gdk_pixmap_colormap_create_from_xpm_d (GdkWindow *window,
- GdkColormap *colormap,
- GdkBitmap **mask,
- GdkColor *transparent_color,
- gchar **data)
-{
- GdkPixmap *pixmap = NULL;
- GdkImage *image = NULL;
- GdkVisual *visual;
- GdkGC *gc;
- GdkColor tmp_color;
- gint width, height, num_cols, cpp, cnt, n, ns, xcnt, ycnt, i;
- gchar *buffer, pixel_str[32];
- _GdkPixmapColor *colors = NULL, *color = NULL;
- gulong index;
-
- if ((window == NULL) && (colormap == NULL))
- g_warning ("Creating pixmap from xpm with NULL window and colormap");
-
- if (window == NULL)
- window = (GdkWindow *)&gdk_root_parent;
-
- if (colormap == NULL)
- {
- colormap = gdk_window_get_colormap (window);
- visual = gdk_window_get_visual (window);
- }
- else
- visual = ((GdkColormapPrivate *)colormap)->visual;
-
- i = 0;
- buffer = data[i++];
- sscanf (buffer,"%d %d %d %d", &width, &height, &num_cols, &cpp);
-
- colors = g_new(_GdkPixmapColor, num_cols);
-
- if (transparent_color == NULL)
- {
- gdk_color_white (colormap, &tmp_color);
- transparent_color = &tmp_color;
- }
-
- for (cnt = 0; cnt < num_cols; cnt++)
- {
- gchar *color_name;
-
- buffer = data[i++];
-
- colors[cnt].color_string = g_new(gchar, cpp + 1);
- for (n = 0; n < cpp; n++)
- colors[cnt].color_string[n] = buffer[n];
- colors[cnt].color_string[n] = 0;
- colors[cnt].transparent = FALSE;
-
- color_name = gdk_pixmap_extract_color (&buffer[cpp]);
-
- if (color_name != NULL)
- {
- if (gdk_color_parse (color_name, &colors[cnt].color) == FALSE)
- {
- colors[cnt].color = *transparent_color;
- colors[cnt].transparent = TRUE;
- }
- }
- else
- {
- colors[cnt].color = *transparent_color;
- colors[cnt].transparent = TRUE;
- }
-
- g_free (color_name);
-
- gdk_color_alloc (colormap, &colors[cnt].color);
- }
-
- index = 0;
- image = gdk_image_new (GDK_IMAGE_FASTEST, visual, width, height);
-
- gc = NULL;
- if (mask)
- {
- /* The pixmap mask is just a bits pattern.
- * Color 0 is used for background and 1 for foreground.
- * We don't care about the colormap, we just need 0 and 1.
- */
- GdkColor mask_pattern;
-
- *mask = gdk_pixmap_new (window, width, height, 1);
- gc = gdk_gc_new (*mask);
-
- mask_pattern.pixel = 0;
- gdk_gc_set_foreground (gc, &mask_pattern);
- gdk_draw_rectangle (*mask, gc, TRUE, 0, 0, -1, -1);
-
- mask_pattern.pixel = 1;
- gdk_gc_set_foreground (gc, &mask_pattern);
- }
-
- for (ycnt = 0; ycnt < height; ycnt++)
- {
- buffer = data[i++];
-
- for (n = 0, cnt = 0, xcnt = 0; n < (width * cpp); n += cpp, xcnt++)
- {
- strncpy (pixel_str, &buffer[n], cpp);
- pixel_str[cpp] = 0;
- color = NULL;
- ns = 0;
-
- while (color == NULL)
- {
- if (strcmp (pixel_str, colors[ns].color_string) == 0)
- color = &colors[ns];
- else
- ns++;
- }
-
- gdk_image_put_pixel (image, xcnt, ycnt, color->color.pixel);
-
- if (mask && color->transparent)
- {
- if (cnt < xcnt)
- gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
- cnt = xcnt + 1;
- }
- }
-
- if (mask && (cnt < xcnt))
- gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
- }
-
- if (mask)
- gdk_gc_destroy (gc);
-
- pixmap = gdk_pixmap_new (window, width, height, visual->depth);
-
- gc = gdk_gc_new (pixmap);
- gdk_gc_set_foreground (gc, transparent_color);
- gdk_draw_image (pixmap, gc, image, 0, 0, 0, 0, image->width, image->height);
- gdk_gc_destroy (gc);
- gdk_image_destroy (image);
-
- if (colors != NULL)
- {
- for (cnt = 0; cnt < num_cols; cnt++)
- g_free (colors[cnt].color_string);
- g_free (colors);
- }
-
- return pixmap;
-}
-
-GdkPixmap*
-gdk_pixmap_create_from_xpm_d (GdkWindow *window,
- GdkBitmap **mask,
- GdkColor *transparent_color,
- gchar **data)
-{
- return gdk_pixmap_colormap_create_from_xpm_d (window, NULL, mask,
- transparent_color, data);
-}
-
-GdkPixmap*
-gdk_pixmap_ref (GdkPixmap *pixmap)
-{
- GdkWindowPrivate *private = (GdkWindowPrivate *)pixmap;
- g_return_val_if_fail (pixmap != NULL, NULL);
-
- private->ref_count += 1;
- return pixmap;
-}
-
-void
-gdk_pixmap_unref (GdkPixmap *pixmap)
-{
- GdkWindowPrivate *private = (GdkWindowPrivate *)pixmap;
- g_return_if_fail(pixmap != NULL);
-
- private->ref_count -= 1;
- if (private->ref_count == 0)
- {
- XFreePixmap (private->xdisplay, private->xwindow);
- gdk_xid_table_remove (private->xwindow);
- g_free (private);
- }
-}
-
-GdkBitmap *
-gdk_bitmap_ref (GdkBitmap *bitmap)
-{
- return (GdkBitmap *)gdk_pixmap_ref ((GdkPixmap *)bitmap);
-}
-
-void
-gdk_bitmap_unref (GdkBitmap *bitmap)
-{
- gdk_pixmap_unref ((GdkPixmap *)bitmap);
-}
diff --git a/gdk/x11/gdkproperty-x11.c b/gdk/x11/gdkproperty-x11.c
deleted file mode 100644
index 40140a026a..0000000000
--- a/gdk/x11/gdkproperty-x11.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <string.h>
-#include "gdk.h"
-#include "gdkprivate.h"
-
-
-GdkAtom
-gdk_atom_intern (const gchar *atom_name,
- gint only_if_exists)
-{
- return XInternAtom (gdk_display, atom_name, only_if_exists);
-}
-
-gchar *
-gdk_atom_name (GdkAtom atom)
-{
- gchar *t;
- gchar *name;
-
- /* If this atom doesn't exist, we'll die with an X error unless
- we take precautions */
-
- gdk_error_warnings = 0;
- gdk_error_code = 0;
- t = XGetAtomName (gdk_display, atom);
- gdk_error_warnings = 1;
-
- if (gdk_error_code == -1)
- {
- return NULL;
- }
- else
- {
- name = g_strdup (t);
- XFree (t);
-
- return name;
- }
-}
-
-gint
-gdk_property_get (GdkWindow *window,
- GdkAtom property,
- GdkAtom type,
- gulong offset,
- gulong length,
- gint pdelete,
- GdkAtom *actual_property_type,
- gint *actual_format_type,
- gint *actual_length,
- guchar **data)
-{
- Display *xdisplay;
- Window xwindow;
- Atom ret_prop_type;
- gint ret_format;
- gulong ret_nitems;
- gulong ret_bytes_after;
- gulong ret_length;
- guchar *ret_data;
-
- if (window)
- {
- GdkWindowPrivate *private;
-
- private = (GdkWindowPrivate*) window;
- if (private->destroyed)
- return FALSE;
-
- xdisplay = private->xdisplay;
- xwindow = private->xwindow;
- }
- else
- {
- xdisplay = gdk_display;
- xwindow = gdk_root_window;
- }
-
- XGetWindowProperty (xdisplay, xwindow, property,
- offset, (length + 3) / 4, pdelete,
- type, &ret_prop_type, &ret_format,
- &ret_nitems, &ret_bytes_after,
- &ret_data);
-
- if ((ret_prop_type == None) && (ret_format == 0)) {
- return FALSE;
- }
-
- if (actual_property_type)
- *actual_property_type = ret_prop_type;
- if (actual_format_type)
- *actual_format_type = ret_format;
-
- if (ret_prop_type != type)
- {
- gchar *rn, *pn;
- XFree (ret_data);
- rn = gdk_atom_name(ret_prop_type);
- pn = gdk_atom_name(type);
- g_warning("Couldn't match property type %s to %s\n", rn, pn);
- g_free(rn); g_free(pn);
- return FALSE;
- }
-
- /* FIXME: ignoring bytes_after could have very bad effects */
-
- if (data)
- {
- switch (ret_format)
- {
- case 8:
- ret_length = ret_nitems;
- break;
- case 16:
- ret_length = 2 * ret_nitems;
- break;
- case 32:
- ret_length = 4 * ret_nitems;
- break;
- default:
- g_warning ("unknown property return format: %d", ret_format);
- XFree (ret_data);
- return FALSE;
- }
-
- *data = g_new (guchar, ret_length);
- memcpy (*data, ret_data, ret_length);
- if (actual_length)
- *actual_length = ret_length;
- }
-
- XFree (ret_data);
-
- return TRUE;
-}
-
-void
-gdk_property_change (GdkWindow *window,
- GdkAtom property,
- GdkAtom type,
- gint format,
- GdkPropMode mode,
- guchar *data,
- gint nelements)
-{
- Display *xdisplay;
- Window xwindow;
-
- if (window)
- {
- GdkWindowPrivate *private;
-
- private = (GdkWindowPrivate*) window;
- if (private->destroyed)
- return;
-
- xdisplay = private->xdisplay;
- xwindow = private->xwindow;
- }
- else
- {
- xdisplay = gdk_display;
- xwindow = gdk_root_window;
- }
-
- XChangeProperty (xdisplay, xwindow, property, type,
- format, mode, data, nelements);
-}
-
-void
-gdk_property_delete (GdkWindow *window,
- GdkAtom property)
-{
- Display *xdisplay;
- Window xwindow;
-
- if (window)
- {
- GdkWindowPrivate *private;
-
- private = (GdkWindowPrivate*) window;
- if (private->destroyed)
- return;
-
- xdisplay = private->xdisplay;
- xwindow = private->xwindow;
- }
- else
- {
- xdisplay = gdk_display;
- xwindow = gdk_root_window;
- }
-
- XDeleteProperty (xdisplay, xwindow, property);
-}
diff --git a/gdk/x11/gdkregion-x11.c b/gdk/x11/gdkregion-x11.c
deleted file mode 100644
index 8863d62e69..0000000000
--- a/gdk/x11/gdkregion-x11.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include "gdk.h"
-#include "gdkprivate.h"
-
-
-
-
-GdkRegion*
-gdk_region_new (void)
-{
- GdkRegionPrivate *private;
- GdkRegion *region;
- Region xregion;
-
- xregion = XCreateRegion();
- private = g_new (GdkRegionPrivate, 1);
- private->xregion = xregion;
- region = (GdkRegion*) private;
- region->user_data = NULL;
-
- return region;
-}
-
-void
-gdk_region_destroy (GdkRegion *region)
-{
- GdkRegionPrivate *private;
-
- g_return_if_fail (region != NULL);
-
- private = (GdkRegionPrivate *) region;
- XDestroyRegion (private->xregion);
-
- g_free (private);
-}
-
-gboolean
-gdk_region_empty (GdkRegion *region)
-{
- GdkRegionPrivate *private;
-
- g_return_val_if_fail (region != NULL, 0);
-
- private = (GdkRegionPrivate *) region;
-
- return XEmptyRegion (private->xregion);
-}
-
-gboolean
-gdk_region_equal (GdkRegion *region1,
- GdkRegion *region2)
-{
- GdkRegionPrivate *private1;
- GdkRegionPrivate *private2;
-
- g_return_val_if_fail (region1 != NULL, 0);
- g_return_val_if_fail (region2 != NULL, 0);
-
- private1 = (GdkRegionPrivate *) region1;
- private2 = (GdkRegionPrivate *) region2;
-
- return XEqualRegion (private1->xregion, private2->xregion);
-}
-
-gboolean
-gdk_region_point_in (GdkRegion *region,
- gint x,
- gint y)
-{
- GdkRegionPrivate *private;
-
- g_return_val_if_fail (region != NULL, 0);
-
- private = (GdkRegionPrivate *) region;
-
- return XPointInRegion (private->xregion, x, y);
-}
-
-GdkOverlapType
-gdk_region_rect_in (GdkRegion *region,
- GdkRectangle *rect)
-{
- GdkRegionPrivate *private;
- int res;
-
- g_return_val_if_fail (region != NULL, 0);
-
- private = (GdkRegionPrivate *) region;
-
- res = XRectInRegion (private->xregion, rect->x, rect->y, rect->width, rect->height);
-
- switch (res)
- {
- case RectangleIn: return GDK_OVERLAP_RECTANGLE_IN;
- case RectangleOut: return GDK_OVERLAP_RECTANGLE_OUT;
- case RectanglePart: return GDK_OVERLAP_RECTANGLE_PART;
- }
-
- return GDK_OVERLAP_RECTANGLE_OUT; /*what else ? */
-}
-
-void
-gdk_region_offset (GdkRegion *region,
- gint dx,
- gint dy)
-{
- GdkRegionPrivate *private;
-
- g_return_if_fail (region != NULL);
-
- private = (GdkRegionPrivate *) region;
-
- XOffsetRegion (private->xregion, dx, dy);
-}
-
-void
-gdk_region_shrink (GdkRegion *region,
- gint dx,
- gint dy)
-{
- GdkRegionPrivate *private;
-
- g_return_if_fail (region != NULL);
-
- private = (GdkRegionPrivate *) region;
-
- XShrinkRegion (private->xregion, dx, dy);
-}
-
-GdkRegion*
-gdk_region_union_with_rect (GdkRegion *region,
- GdkRectangle *rect)
-{
- GdkRegionPrivate *private;
- GdkRegion *res;
- GdkRegionPrivate *res_private;
- XRectangle xrect;
-
- g_return_val_if_fail (region != NULL, NULL);
-
- private = (GdkRegionPrivate *) region;
-
- xrect.x = rect->x;
- xrect.y = rect->y;
- xrect.width = rect->width;
- xrect.height = rect->height;
-
- res = gdk_region_new ();
- res_private = (GdkRegionPrivate *) res;
-
- XUnionRectWithRegion (&xrect, private->xregion, res_private->xregion);
-
- return res;
-}
-
-GdkRegion*
-gdk_regions_intersect (GdkRegion *source1,
- GdkRegion *source2)
-{
- GdkRegionPrivate *private1;
- GdkRegionPrivate *private2;
- GdkRegion *res;
- GdkRegionPrivate *res_private;
-
- g_return_val_if_fail (source1 != NULL, NULL);
- g_return_val_if_fail (source2 != NULL, NULL);
-
- private1 = (GdkRegionPrivate *) source1;
- private2 = (GdkRegionPrivate *) source2;
-
- res = gdk_region_new ();
- res_private = (GdkRegionPrivate *) res;
-
- XIntersectRegion (private1->xregion, private2->xregion, res_private->xregion);
-
- return res;
-}
-
-GdkRegion*
-gdk_regions_union (GdkRegion *source1,
- GdkRegion *source2)
-{
- GdkRegionPrivate *private1;
- GdkRegionPrivate *private2;
- GdkRegion *res;
- GdkRegionPrivate *res_private;
-
- g_return_val_if_fail (source1 != NULL, NULL);
- g_return_val_if_fail (source2 != NULL, NULL);
-
- private1 = (GdkRegionPrivate *) source1;
- private2 = (GdkRegionPrivate *) source2;
-
- res = gdk_region_new ();
- res_private = (GdkRegionPrivate *) res;
-
- XUnionRegion (private1->xregion, private2->xregion, res_private->xregion);
-
- return res;
-}
-
-GdkRegion*
-gdk_regions_subtract (GdkRegion *source1,
- GdkRegion *source2)
-{
- GdkRegionPrivate *private1;
- GdkRegionPrivate *private2;
- GdkRegion *res;
- GdkRegionPrivate *res_private;
-
- g_return_val_if_fail (source1 != NULL, NULL);
- g_return_val_if_fail (source2 != NULL, NULL);
-
- private1 = (GdkRegionPrivate *) source1;
- private2 = (GdkRegionPrivate *) source2;
-
- res = gdk_region_new ();
- res_private = (GdkRegionPrivate *) res;
-
- XSubtractRegion (private1->xregion, private2->xregion, res_private->xregion);
-
- return res;
-}
-
-GdkRegion*
-gdk_regions_xor (GdkRegion *source1,
- GdkRegion *source2)
-{
- GdkRegionPrivate *private1;
- GdkRegionPrivate *private2;
- GdkRegion *res;
- GdkRegionPrivate *res_private;
-
- g_return_val_if_fail (source1 != NULL, NULL);
- g_return_val_if_fail (source2 != NULL, NULL);
-
- private1 = (GdkRegionPrivate *) source1;
- private2 = (GdkRegionPrivate *) source2;
-
- res = gdk_region_new ();
- res_private = (GdkRegionPrivate *) res;
-
- XXorRegion (private1->xregion, private2->xregion, res_private->xregion);
-
- return res;
-}
-
-
-
diff --git a/gdk/x11/gdkselection-x11.c b/gdk/x11/gdkselection-x11.c
deleted file mode 100644
index b8f1c9ff60..0000000000
--- a/gdk/x11/gdkselection-x11.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <string.h>
-#include "gdk.h"
-#include "gdkprivate.h"
-#include "gdkx.h"
-
-
-gint
-gdk_selection_owner_set (GdkWindow *owner,
- GdkAtom selection,
- guint32 time,
- gint send_event)
-{
- Display *xdisplay;
- Window xwindow;
-
- if (owner)
- {
- GdkWindowPrivate *private;
-
- private = (GdkWindowPrivate*) owner;
- if (private->destroyed)
- return FALSE;
-
- xdisplay = private->xdisplay;
- xwindow = private->xwindow;
- }
- else
- {
- xdisplay = gdk_display;
- xwindow = None;
- }
-
- XSetSelectionOwner (xdisplay, selection, xwindow, time);
-
- return (XGetSelectionOwner (xdisplay, selection) == xwindow);
-}
-
-GdkWindow*
-gdk_selection_owner_get (GdkAtom selection)
-{
- Window xwindow;
-
- xwindow = XGetSelectionOwner (gdk_display, selection);
- if (xwindow == None)
- return NULL;
-
- return gdk_window_lookup (xwindow);
-}
-
-void
-gdk_selection_convert (GdkWindow *requestor,
- GdkAtom selection,
- GdkAtom target,
- guint32 time)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (requestor != NULL);
-
- private = (GdkWindowPrivate*) requestor;
- if (private->destroyed)
- return;
-
- XConvertSelection (private->xdisplay, selection, target,
- gdk_selection_property, private->xwindow, time);
-}
-
-gint
-gdk_selection_property_get (GdkWindow *requestor,
- guchar **data,
- GdkAtom *ret_type,
- gint *ret_format)
-{
- GdkWindowPrivate *private;
- gulong nitems;
- gulong nbytes;
- gulong length;
- GdkAtom prop_type;
- gint prop_format;
- guchar *t;
-
- g_return_val_if_fail (requestor != NULL, 0);
-
- /* If retrieved chunks are typically small, (and the ICCM says the
- should be) it would be a win to try first with a buffer of
- moderate length, to avoid two round trips to the server */
-
- private = (GdkWindowPrivate*) requestor;
- if (private->destroyed)
- return 0;
-
- XGetWindowProperty (private->xdisplay, private->xwindow,
- gdk_selection_property, 0, 0, False,
- AnyPropertyType, &prop_type, &prop_format,
- &nitems, &nbytes, &t);
-
- if (ret_type)
- *ret_type = prop_type;
- if (ret_format)
- *ret_format = prop_format;
-
- if (prop_type == None)
- {
- *data = NULL;
- return 0;
- }
-
- XFree (t);
-
- /* Add on an extra byte to handle null termination. X guarantees
- that t will be 1 longer than nbytes and null terminated */
- length = nbytes + 1;
-
- /* We can't delete the selection here, because it might be the INCR
- protocol, in which case the client has to make sure they'll be
- notified of PropertyChange events _before_ the property is deleted.
- Otherwise there's no guarantee we'll win the race ... */
- XGetWindowProperty (private->xdisplay, private->xwindow,
- gdk_selection_property, 0, (nbytes + 3) / 4, False,
- AnyPropertyType, &prop_type, &prop_format,
- &nitems, &nbytes, &t);
-
- if (prop_type != None)
- {
- *data = g_new (guchar, length);
- memcpy (*data, t, length);
- XFree (t);
- return length-1;
- }
- else
- {
- *data = NULL;
- return 0;
- }
-}
-
-
-void
-gdk_selection_send_notify (guint32 requestor,
- GdkAtom selection,
- GdkAtom target,
- GdkAtom property,
- guint32 time)
-{
- XSelectionEvent xevent;
-
- xevent.type = SelectionNotify;
- xevent.serial = 0;
- xevent.send_event = True;
- xevent.display = gdk_display;
- xevent.requestor = requestor;
- xevent.selection = selection;
- xevent.target = target;
- xevent.property = property;
- xevent.time = time;
-
- XSendEvent (gdk_display, requestor, False, NoEventMask, (XEvent*) &xevent);
-}
-
-gint
-gdk_text_property_to_text_list (GdkAtom encoding, gint format,
- guchar *text, gint length,
- gchar ***list)
-{
- XTextProperty property;
- gint count = 0;
- gint res;
-
- if (!list)
- return 0;
-
- property.value = text;
- property.encoding = encoding;
- property.format = format;
- property.nitems = length;
- res = XmbTextPropertyToTextList (GDK_DISPLAY(), &property, list, &count);
-
- if (res == XNoMemory || res == XLocaleNotSupported ||
- res == XConverterNotFound)
- return 0;
- else
- return count;
-}
-
-void
-gdk_free_text_list (gchar **list)
-{
- XFreeStringList (list);
-}
-
-gint
-gdk_string_to_compound_text (gchar *str,
- GdkAtom *encoding, gint *format,
- guchar **ctext, gint *length)
-{
- gint res;
- XTextProperty property;
-
- res = XmbTextListToTextProperty (GDK_DISPLAY(),
- &str, 1, XCompoundTextStyle,
- &property);
- if (res != Success)
- {
- property.encoding = None;
- property.format = None;
- property.value = NULL;
- property.nitems = 0;
- }
-
- if (encoding)
- *encoding = property.encoding;
- if (format)
- *format = property.format;
- if (ctext)
- *ctext = property.value;
- if (length)
- *length = property.nitems;
-
- return res;
-}
-
-void gdk_free_compound_text (guchar *ctext)
-{
- if (ctext)
- XFree (ctext);
-}
diff --git a/gdk/x11/gdkvisual-x11.c b/gdk/x11/gdkvisual-x11.c
deleted file mode 100644
index c6365de9cd..0000000000
--- a/gdk/x11/gdkvisual-x11.c
+++ /dev/null
@@ -1,433 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include "gdk.h"
-#include "gdkprivate.h"
-
-
-static void gdk_visual_add (GdkVisual *visual);
-static void gdk_visual_decompose_mask (gulong mask,
- gint *shift,
- gint *prec);
-static guint gdk_visual_hash (Visual *key);
-static gint gdk_visual_compare (Visual *a,
- Visual *b);
-
-
-static GdkVisualPrivate *system_visual;
-static GdkVisualPrivate *visuals;
-static gint nvisuals;
-
-static gint available_depths[4];
-static gint navailable_depths;
-
-static GdkVisualType available_types[6];
-static gint navailable_types;
-
-static char* visual_names[] =
-{
- "static gray",
- "grayscale",
- "static color",
- "pseudo color",
- "true color",
- "direct color",
-};
-
-static GHashTable *visual_hash = NULL;
-
-void
-gdk_visual_init ()
-{
- static gint possible_depths[6] = { 32, 24, 16, 15, 8, 1 };
- static GdkVisualType possible_types[6] =
- {
- GDK_VISUAL_DIRECT_COLOR,
- GDK_VISUAL_TRUE_COLOR,
- GDK_VISUAL_PSEUDO_COLOR,
- GDK_VISUAL_STATIC_COLOR,
- GDK_VISUAL_GRAYSCALE,
- GDK_VISUAL_STATIC_GRAY
- };
-
- static gint npossible_depths = 6;
- static gint npossible_types = 6;
-
- XVisualInfo *visual_list;
- XVisualInfo visual_template;
- GdkVisualPrivate temp_visual;
- Visual *default_xvisual;
- int nxvisuals;
- int i, j;
-
- visual_template.screen = gdk_screen;
- visual_list = XGetVisualInfo (gdk_display, VisualScreenMask, &visual_template, &nxvisuals);
- visuals = g_new (GdkVisualPrivate, nxvisuals);
-
- default_xvisual = DefaultVisual (gdk_display, gdk_screen);
-
- nvisuals = 0;
- for (i = 0; i < nxvisuals; i++)
- {
- if (visual_list[i].depth >= 1)
- {
-#ifdef __cplusplus
- switch (visual_list[i].c_class)
-#else /* __cplusplus */
- switch (visual_list[i].class)
-#endif /* __cplusplus */
- {
- case StaticGray:
- visuals[nvisuals].visual.type = GDK_VISUAL_STATIC_GRAY;
- break;
- case GrayScale:
- visuals[nvisuals].visual.type = GDK_VISUAL_GRAYSCALE;
- break;
- case StaticColor:
- visuals[nvisuals].visual.type = GDK_VISUAL_STATIC_COLOR;
- break;
- case PseudoColor:
- visuals[nvisuals].visual.type = GDK_VISUAL_PSEUDO_COLOR;
- break;
- case TrueColor:
- visuals[nvisuals].visual.type = GDK_VISUAL_TRUE_COLOR;
- break;
- case DirectColor:
- visuals[nvisuals].visual.type = GDK_VISUAL_DIRECT_COLOR;
- break;
- }
-
- visuals[nvisuals].visual.depth = visual_list[i].depth;
- visuals[nvisuals].visual.byte_order =
- (ImageByteOrder(gdk_display) == LSBFirst) ?
- GDK_LSB_FIRST : GDK_MSB_FIRST;
- visuals[nvisuals].visual.red_mask = visual_list[i].red_mask;
- visuals[nvisuals].visual.green_mask = visual_list[i].green_mask;
- visuals[nvisuals].visual.blue_mask = visual_list[i].blue_mask;
- visuals[nvisuals].visual.colormap_size = visual_list[i].colormap_size;
- visuals[nvisuals].visual.bits_per_rgb = visual_list[i].bits_per_rgb;
- visuals[nvisuals].xvisual = visual_list[i].visual;
-
- if ((visuals[nvisuals].visual.type == GDK_VISUAL_TRUE_COLOR) ||
- (visuals[nvisuals].visual.type == GDK_VISUAL_DIRECT_COLOR))
- {
- gdk_visual_decompose_mask (visuals[nvisuals].visual.red_mask,
- &visuals[nvisuals].visual.red_shift,
- &visuals[nvisuals].visual.red_prec);
-
- gdk_visual_decompose_mask (visuals[nvisuals].visual.green_mask,
- &visuals[nvisuals].visual.green_shift,
- &visuals[nvisuals].visual.green_prec);
-
- gdk_visual_decompose_mask (visuals[nvisuals].visual.blue_mask,
- &visuals[nvisuals].visual.blue_shift,
- &visuals[nvisuals].visual.blue_prec);
- }
- else
- {
- visuals[nvisuals].visual.red_mask = 0;
- visuals[nvisuals].visual.red_shift = 0;
- visuals[nvisuals].visual.red_prec = 0;
-
- visuals[nvisuals].visual.green_mask = 0;
- visuals[nvisuals].visual.green_shift = 0;
- visuals[nvisuals].visual.green_prec = 0;
-
- visuals[nvisuals].visual.blue_mask = 0;
- visuals[nvisuals].visual.blue_shift = 0;
- visuals[nvisuals].visual.blue_prec = 0;
- }
-
- nvisuals += 1;
- }
- }
-
- XFree (visual_list);
-
- for (i = 0; i < nvisuals; i++)
- {
- for (j = i+1; j < nvisuals; j++)
- {
- if (visuals[j].visual.depth >= visuals[i].visual.depth)
- {
- if ((visuals[j].visual.depth == 8) && (visuals[i].visual.depth == 8))
- {
- if (visuals[j].visual.type == GDK_VISUAL_PSEUDO_COLOR)
- {
- temp_visual = visuals[j];
- visuals[j] = visuals[i];
- visuals[i] = temp_visual;
- }
- else if ((visuals[i].visual.type != GDK_VISUAL_PSEUDO_COLOR) &&
- visuals[j].visual.type > visuals[i].visual.type)
- {
- temp_visual = visuals[j];
- visuals[j] = visuals[i];
- visuals[i] = temp_visual;
- }
- }
- else if ((visuals[j].visual.depth > visuals[i].visual.depth) ||
- ((visuals[j].visual.depth == visuals[i].visual.depth) &&
- (visuals[j].visual.type > visuals[i].visual.type)))
- {
- temp_visual = visuals[j];
- visuals[j] = visuals[i];
- visuals[i] = temp_visual;
- }
- }
- }
- }
-
- for (i = 0; i < nvisuals; i++)
- if (default_xvisual->visualid == visuals[i].xvisual->visualid)
- {
- system_visual = &visuals[i];
- break;
- }
-
-#ifdef G_ENABLE_DEBUG
- if (gdk_debug_flags & GDK_DEBUG_MISC)
- for (i = 0; i < nvisuals; i++)
- g_print ("visual: %s: %d\n",
- visual_names[visuals[i].visual.type],
- visuals[i].visual.depth);
-#endif /* G_ENABLE_DEBUG */
-
- navailable_depths = 0;
- for (i = 0; i < npossible_depths; i++)
- {
- for (j = 0; j < nvisuals; j++)
- {
- if (visuals[j].visual.depth == possible_depths[i])
- {
- available_depths[navailable_depths++] = visuals[j].visual.depth;
- break;
- }
- }
- }
-
- if (navailable_depths == 0)
- g_error ("unable to find a usable depth");
-
- navailable_types = 0;
- for (i = 0; i < npossible_types; i++)
- {
- for (j = 0; j < nvisuals; j++)
- {
- if (visuals[j].visual.type == possible_types[i])
- {
- available_types[navailable_types++] = visuals[j].visual.type;
- break;
- }
- }
- }
-
- for (i = 0; i < nvisuals; i++)
- gdk_visual_add ((GdkVisual*) &visuals[i]);
-
- if (npossible_types == 0)
- g_error ("unable to find a usable visual type");
-}
-
-GdkVisual*
-gdk_visual_ref (GdkVisual *visual)
-{
- return visual;
-}
-
-void
-gdk_visual_unref (GdkVisual *visual)
-{
- return;
-}
-
-gint
-gdk_visual_get_best_depth ()
-{
- return available_depths[0];
-}
-
-GdkVisualType
-gdk_visual_get_best_type ()
-{
- return available_types[0];
-}
-
-GdkVisual*
-gdk_visual_get_system ()
-{
- return ((GdkVisual*) system_visual);
-}
-
-GdkVisual*
-gdk_visual_get_best ()
-{
- return ((GdkVisual*) &(visuals[0]));
-}
-
-GdkVisual*
-gdk_visual_get_best_with_depth (gint depth)
-{
- GdkVisual *return_val;
- int i;
-
- return_val = NULL;
- for (i = 0; i < nvisuals; i++)
- if (depth == visuals[i].visual.depth)
- {
- return_val = (GdkVisual*) &(visuals[i]);
- break;
- }
-
- return return_val;
-}
-
-GdkVisual*
-gdk_visual_get_best_with_type (GdkVisualType visual_type)
-{
- GdkVisual *return_val;
- int i;
-
- return_val = NULL;
- for (i = 0; i < nvisuals; i++)
- if (visual_type == visuals[i].visual.type)
- {
- return_val = (GdkVisual*) &(visuals[i]);
- break;
- }
-
- return return_val;
-}
-
-GdkVisual*
-gdk_visual_get_best_with_both (gint depth,
- GdkVisualType visual_type)
-{
- GdkVisual *return_val;
- int i;
-
- return_val = NULL;
- for (i = 0; i < nvisuals; i++)
- if ((depth == visuals[i].visual.depth) &&
- (visual_type == visuals[i].visual.type))
- {
- return_val = (GdkVisual*) &(visuals[i]);
- break;
- }
-
- return return_val;
-}
-
-void
-gdk_query_depths (gint **depths,
- gint *count)
-{
- *count = navailable_depths;
- *depths = available_depths;
-}
-
-void
-gdk_query_visual_types (GdkVisualType **visual_types,
- gint *count)
-{
- *count = navailable_types;
- *visual_types = available_types;
-}
-
-void
-gdk_query_visuals (GdkVisual **visual_return,
- gint *count)
-{
- *count = nvisuals;
- *visual_return = (GdkVisual*) visuals;
-}
-
-
-GdkVisual*
-gdk_visual_lookup (Visual *xvisual)
-{
- GdkVisual *visual;
-
- if (!visual_hash)
- return NULL;
-
- visual = g_hash_table_lookup (visual_hash, xvisual);
- return visual;
-}
-
-GdkVisual*
-gdkx_visual_get (VisualID xvisualid)
-{
- int i;
-
- for (i = 0; i < nvisuals; i++)
- if (xvisualid == visuals[i].xvisual->visualid)
- return (GdkVisual*) &visuals[i];
-
- return NULL;
-}
-
-
-static void
-gdk_visual_add (GdkVisual *visual)
-{
- GdkVisualPrivate *private;
-
- if (!visual_hash)
- visual_hash = g_hash_table_new ((GHashFunc) gdk_visual_hash,
- (GCompareFunc) gdk_visual_compare);
-
- private = (GdkVisualPrivate*) visual;
-
- g_hash_table_insert (visual_hash, private->xvisual, visual);
-}
-
-static void
-gdk_visual_decompose_mask (gulong mask,
- gint *shift,
- gint *prec)
-{
- *shift = 0;
- *prec = 0;
-
- while (!(mask & 0x1))
- {
- (*shift)++;
- mask >>= 1;
- }
-
- while (mask & 0x1)
- {
- (*prec)++;
- mask >>= 1;
- }
-}
-
-static guint
-gdk_visual_hash (Visual *key)
-{
- return key->visualid;
-}
-
-static gint
-gdk_visual_compare (Visual *a,
- Visual *b)
-{
- return (a->visualid == b->visualid);
-}
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
deleted file mode 100644
index 579b9703b1..0000000000
--- a/gdk/x11/gdkwindow-x11.c
+++ /dev/null
@@ -1,1814 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Xatom.h>
-#include <X11/extensions/shape.h>
-#include <netinet/in.h>
-#include "gdk.h"
-#include "../config.h"
-#include "gdkinput.h"
-#include "gdkprivate.h"
-#include "MwmUtil.h"
-#include <stdlib.h>
-#include <stdio.h>
-
-int nevent_masks = 17;
-int event_mask_table[19] =
-{
- ExposureMask,
- PointerMotionMask,
- PointerMotionHintMask,
- ButtonMotionMask,
- Button1MotionMask,
- Button2MotionMask,
- Button3MotionMask,
- ButtonPressMask | OwnerGrabButtonMask,
- ButtonReleaseMask | OwnerGrabButtonMask,
- KeyPressMask,
- KeyReleaseMask,
- EnterWindowMask,
- LeaveWindowMask,
- FocusChangeMask,
- StructureNotifyMask,
- PropertyChangeMask,
- VisibilityChangeMask,
- 0, /* PROXIMITY_IN */
- 0 /* PROXIMTY_OUT */
-};
-
-
-/* internal function created for and used by gdk_window_xid_at_coords */
-Window
-gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y)
-{
- GdkWindow *window;
- GdkWindowPrivate *private;
- Display *disp;
- Window *list=NULL;
- Window child=0,parent_win=0,root_win=0;
- unsigned int num,i,ww,wh,wb,wd;
- int wx,wy;
-
- window=(GdkWindow*)&gdk_root_parent;
- private=(GdkWindowPrivate*)window;
- disp=private->xdisplay;
- if (!XGetGeometry(disp,base,&root_win,&wx,&wy,&ww,&wh,&wb,&wd))
- return 0;
- wx+=bx;wy+=by;
- if (!((x>=wx)&&(y>=wy)&&(x<(wx+ww))&&(y<(wy+wh))))
- return 0;
- if (!XQueryTree(disp,base,&root_win,&parent_win,&list,&num))
- return base;
- if (list)
- {
- for (i=num-1;i>=0;i--)
- {
- if ((child=gdk_window_xid_at(list[i],wx,wy,x,y))!=0)
- {
- XFree(list);
- return child;
- }
- }
- }
- return 0;
-}
-
-/*
- * The following fucntion by The Rasterman <raster@redhat.com>
- * This function returns the X Window ID in which the x y location is in
- * (x and y being relative to the root window), excluding any windows listed
- * in the GList excludes (this is a list of X Window ID's - gpointer being
- * the Window ID).
- *
- * This is primarily designed for internal gdk use - for DND for example
- * when using a shaped icon window as the drag object - you exclude the
- * X Window ID of the "icon" (perhaps more if excludes may be needed) and
- * You can get back an X Window ID as to what X Window ID is infact under
- * those X,Y co-ordinates.
- */
-Window
-gdk_window_xid_at_coords(gint x, gint y, GList *excludes)
-{
- GdkWindow *window;
- GdkWindowPrivate *private;
- Display *disp;
- Window *list=NULL;
- Window root,child=0,parent_win=0,root_win=0;
- unsigned int num,i;
-
- window=(GdkWindow*)&gdk_root_parent;
- private=(GdkWindowPrivate*)window;
- disp=private->xdisplay;
- root=private->xwindow;
- if (!XQueryTree(disp,root,&root_win,&parent_win,&list,&num))
- return root;
- if (list)
- {
- for (i=num-1;i>=0;i--)
- {
- if ((child=gdk_window_xid_at(list[i],0,0,x,y))!=0)
- {
- if (excludes)
- {
- if (!g_list_find(excludes,(gpointer)child))
- {
- XFree(list);
- return child;
- }
- }
- else
- {
- XFree(list);
- return child;
- }
- }
- }
- }
- return root;
-}
-
-void
-gdk_window_init ()
-{
- XWindowAttributes xattributes;
- unsigned int width;
- unsigned int height;
- unsigned int border_width;
- unsigned int depth;
- int x, y;
-
- XGetGeometry (gdk_display, gdk_root_window, &gdk_root_window,
- &x, &y, &width, &height, &border_width, &depth);
- XGetWindowAttributes (gdk_display, gdk_root_window, &xattributes);
-
- gdk_root_parent.xdisplay = gdk_display;
- gdk_root_parent.xwindow = gdk_root_window;
- gdk_root_parent.window_type = GDK_WINDOW_ROOT;
- gdk_root_parent.window.user_data = NULL;
- gdk_root_parent.width = width;
- gdk_root_parent.height = height;
-}
-
-GdkWindow*
-gdk_window_new (GdkWindow *parent,
- GdkWindowAttr *attributes,
- gint attributes_mask)
-{
- GdkWindow *window;
- GdkWindowPrivate *private;
- GdkWindowPrivate *parent_private;
- GdkVisual *visual;
- GdkColormap *colormap;
- Display *parent_display;
- Window xparent;
- Visual *xvisual;
- XSetWindowAttributes xattributes;
- long xattributes_mask;
- XSizeHints size_hints;
- XWMHints wm_hints;
- XClassHint *class_hint;
- int x, y, depth;
- unsigned int class;
- char *title;
- int i;
-
- g_return_val_if_fail (attributes != NULL, NULL);
-
- if (!parent)
- parent = (GdkWindow*) &gdk_root_parent;
-
- parent_private = (GdkWindowPrivate*) parent;
- if (parent_private->destroyed)
- return NULL;
-
- xparent = parent_private->xwindow;
- parent_display = parent_private->xdisplay;
-
- private = g_new (GdkWindowPrivate, 1);
- window = (GdkWindow*) private;
-
- private->parent = parent;
- private->xdisplay = parent_display;
- private->destroyed = FALSE;
- private->resize_count = 0;
- private->ref_count = 1;
- xattributes_mask = 0;
-
- if (attributes_mask & GDK_WA_X)
- x = attributes->x;
- else
- x = 0;
-
- if (attributes_mask & GDK_WA_Y)
- y = attributes->y;
- else
- y = 0;
-
- private->x = x;
- private->y = y;
- private->width = (attributes->width > 1) ? (attributes->width) : (1);
- private->height = (attributes->height > 1) ? (attributes->height) : (1);
- private->window_type = attributes->window_type;
- private->extension_events = FALSE;
- private->dnd_drag_data_type = None;
- private->dnd_drag_data_typesavail =
- private->dnd_drop_data_typesavail = NULL;
- private->dnd_drop_enabled = private->dnd_drag_enabled =
- private->dnd_drag_accepted = private->dnd_drag_datashow =
- private->dnd_drop_data_numtypesavail =
- private->dnd_drag_data_numtypesavail = 0;
- private->dnd_drag_eventmask = private->dnd_drag_savedeventmask = 0;
-
- private->filters = NULL;
-
- window->user_data = NULL;
-
- if (attributes_mask & GDK_WA_VISUAL)
- visual = attributes->visual;
- else
- visual = gdk_visual_get_system ();
- xvisual = ((GdkVisualPrivate*) visual)->xvisual;
-
- xattributes.event_mask = StructureNotifyMask;
- for (i = 0; i < nevent_masks; i++)
- {
- if (attributes->event_mask & (1 << (i + 1)))
- xattributes.event_mask |= event_mask_table[i];
- }
-
- if (xattributes.event_mask)
- xattributes_mask |= CWEventMask;
-
- if(attributes_mask & GDK_WA_NOREDIR) {
- xattributes.override_redirect =
- (attributes->override_redirect == FALSE)?False:True;
- xattributes_mask |= CWOverrideRedirect;
- } else
- xattributes.override_redirect = False;
-
- if (attributes->wclass == GDK_INPUT_OUTPUT)
- {
- class = InputOutput;
- depth = visual->depth;
-
- if (attributes_mask & GDK_WA_COLORMAP)
- colormap = attributes->colormap;
- else
- colormap = gdk_colormap_get_system ();
-
- xattributes.background_pixel = BlackPixel (gdk_display, gdk_screen);
- xattributes.border_pixel = BlackPixel (gdk_display, gdk_screen);
- xattributes_mask |= CWBorderPixel | CWBackPixel;
-
- switch (private->window_type)
- {
- case GDK_WINDOW_TOPLEVEL:
- xattributes.colormap = ((GdkColormapPrivate*) colormap)->xcolormap;
- xattributes_mask |= CWColormap;
-
- xparent = gdk_root_window;
- break;
-
- case GDK_WINDOW_CHILD:
- xattributes.colormap = ((GdkColormapPrivate*) colormap)->xcolormap;
- xattributes_mask |= CWColormap;
- break;
-
- case GDK_WINDOW_DIALOG:
- xattributes.colormap = ((GdkColormapPrivate*) colormap)->xcolormap;
- xattributes_mask |= CWColormap;
-
- xparent = gdk_root_window;
- break;
-
- case GDK_WINDOW_TEMP:
- xattributes.colormap = ((GdkColormapPrivate*) colormap)->xcolormap;
- xattributes_mask |= CWColormap;
-
- xparent = gdk_root_window;
-
- xattributes.save_under = True;
- xattributes.override_redirect = True;
- xattributes.cursor = None;
- xattributes_mask |= CWSaveUnder | CWOverrideRedirect;
- break;
- case GDK_WINDOW_ROOT:
- g_error ("cannot make windows of type GDK_WINDOW_ROOT");
- break;
- case GDK_WINDOW_PIXMAP:
- g_error ("cannot make windows of type GDK_WINDOW_PIXMAP (use gdk_pixmap_new)");
- break;
- }
- }
- else
- {
- depth = 0;
- class = InputOnly;
- colormap = NULL;
- }
-
- private->xwindow = XCreateWindow (private->xdisplay, xparent,
- x, y, private->width, private->height,
- 0, depth, class, xvisual,
- xattributes_mask, &xattributes);
- gdk_window_ref (window);
- gdk_xid_table_insert (&private->xwindow, window);
-
- switch (private->window_type)
- {
- case GDK_WINDOW_DIALOG:
- XSetTransientForHint (private->xdisplay, private->xwindow, xparent);
- case GDK_WINDOW_TOPLEVEL:
- case GDK_WINDOW_TEMP:
- XSetWMProtocols (private->xdisplay, private->xwindow, gdk_wm_window_protocols, 2);
- break;
- case GDK_WINDOW_CHILD:
- if ((attributes->wclass == GDK_INPUT_OUTPUT) &&
- (colormap != gdk_colormap_get_system ()) &&
- (colormap != gdk_window_get_colormap (gdk_window_get_toplevel (window))))
- {
- g_print ("adding colormap window\n");
- gdk_window_add_colormap_windows (window);
- }
- break;
- default:
- break;
- }
-
- size_hints.flags = PSize | PBaseSize;
- size_hints.width = private->width;
- size_hints.height = private->height;
- size_hints.base_width = private->width;
- size_hints.base_height = private->height;
-
- wm_hints.flags = InputHint | StateHint | WindowGroupHint;
- wm_hints.window_group = gdk_leader_window;
- wm_hints.input = True;
- wm_hints.initial_state = NormalState;
-
- XSetWMNormalHints (private->xdisplay, private->xwindow, &size_hints);
- XSetWMHints (private->xdisplay, private->xwindow, &wm_hints);
-
- if (attributes_mask & GDK_WA_TITLE)
- title = attributes->title;
- else
- title = gdk_progname;
-
- XmbSetWMProperties (private->xdisplay, private->xwindow,
- title, title,
- NULL, 0,
- NULL, NULL, NULL);
-
- if (attributes_mask & GDK_WA_WMCLASS)
- {
- class_hint = XAllocClassHint ();
- class_hint->res_name = attributes->wmclass_name;
- class_hint->res_class = attributes->wmclass_class;
- XSetClassHint (private->xdisplay, private->xwindow, class_hint);
- XFree (class_hint);
- }
-
- gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
- (attributes->cursor) :
- NULL));
-
- return window;
-}
-
-GdkWindow *
-gdk_window_foreign_new (guint32 anid)
-{
- GdkWindow *window;
- GdkWindowPrivate *private;
- XWindowAttributes attrs;
-
- private = g_new (GdkWindowPrivate, 1);
- window = (GdkWindow*) private;
-
- XGetWindowAttributes (gdk_display, anid, &attrs);
-
- private->parent = NULL;
- private->xwindow = anid;
- private->xdisplay = gdk_display;
- private->x = attrs.x;
- private->y = attrs.y;
- private->width = attrs.width;
- private->height = attrs.height;
- private->resize_count = 0;
- private->ref_count = 1;
- if (anid == attrs.root)
- private->window_type = GDK_WINDOW_ROOT;
- else
- private->window_type = GDK_WINDOW_TOPLEVEL;
- /* the above is probably wrong, but it may not be worth the extra
- X call to get it right */
-
- private->destroyed = FALSE;
- private->extension_events = 0;
- private->filters = NULL;
-
- window->user_data = NULL;
-
- gdk_window_ref (window);
- gdk_xid_table_insert (&private->xwindow, window);
-
- return window;
-}
-
-/* Call this function when you want a window and all its children to
- disappear. When xdestroy is true, a request to destroy the XWindow
- is sent out. When it is false, it is assumed that the XWindow has
- been or will be destroyed by destroying some ancestor of this
- window. */
-
-static void
-gdk_window_internal_destroy (GdkWindow *window, int xdestroy)
-{
- GdkWindowPrivate *private;
- GdkWindowPrivate *temp_private;
- GdkWindow *temp_window;
- GList *children;
- GList *tmp;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
-
- switch (private->window_type)
- {
- case GDK_WINDOW_TOPLEVEL:
- case GDK_WINDOW_CHILD:
- case GDK_WINDOW_DIALOG:
- case GDK_WINDOW_TEMP:
- if (!private->destroyed)
- {
- children = gdk_window_get_children (window);
- tmp = children;
-
- while (tmp)
- {
- temp_window = tmp->data;
- tmp = tmp->next;
-
- temp_private = (GdkWindowPrivate*) temp_window;
- if (temp_private)
- gdk_window_internal_destroy (temp_window, FALSE);
- }
-
- g_list_free (children);
-
- if (private->extension_events != 0)
- gdk_input_window_destroy (window);
-
- if(private->dnd_drag_data_numtypesavail > 0)
- {
- g_free (private->dnd_drag_data_typesavail);
- private->dnd_drag_data_typesavail = NULL;
- }
- if(private->dnd_drop_data_numtypesavail > 0)
- {
- g_free (private->dnd_drop_data_typesavail);
- private->dnd_drop_data_typesavail = NULL;
- }
-
- if (xdestroy)
- XDestroyWindow (private->xdisplay, private->xwindow);
- private->destroyed = TRUE;
- }
- break;
-
- case GDK_WINDOW_ROOT:
- g_error ("attempted to destroy root window");
- break;
-
- case GDK_WINDOW_PIXMAP:
- g_error ("called gdk_window_destroy on a pixmap (use gdk_pixmap_unref)");
- break;
- }
-}
-
-/* Like internal_destroy, but also destroys the reference created by
- gdk_window_new. */
-
-void
-gdk_window_destroy (GdkWindow *window)
-{
- gdk_window_internal_destroy (window, TRUE);
- gdk_window_unref (window);
-}
-
-/* This function is called when the XWindow is really gone. */
-
-void
-gdk_window_destroy_notify (GdkWindow *window)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
-
- gdk_xid_table_remove (private->xwindow);
- gdk_window_unref (window);
-}
-
-GdkWindow*
-gdk_window_ref (GdkWindow *window)
-{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
- g_return_val_if_fail (window != NULL, NULL);
-
- private->ref_count += 1;
- return window;
-}
-
-void
-gdk_window_unref (GdkWindow *window)
-{
- GdkWindowPrivate *private = (GdkWindowPrivate *)window;
- g_return_if_fail (window != NULL);
-
- private->ref_count -= 1;
- if (private->ref_count == 0)
- {
- if (!private->destroyed)
- g_warning ("losing last reference to undestroyed window\n");
- g_free (window);
- }
-}
-
-void
-gdk_window_show (GdkWindow *window)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
- if (!private->destroyed)
- {
- XRaiseWindow (private->xdisplay, private->xwindow);
- XMapWindow (private->xdisplay, private->xwindow);
- }
-}
-
-void
-gdk_window_hide (GdkWindow *window)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
- if (!private->destroyed)
- XUnmapWindow (private->xdisplay, private->xwindow);
-}
-
-void
-gdk_window_withdraw (GdkWindow *window)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
- if (!private->destroyed)
- XWithdrawWindow (private->xdisplay, private->xwindow, 0);
-}
-
-void
-gdk_window_move (GdkWindow *window,
- gint x,
- gint y)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
- if (!private->destroyed)
- {
- XMoveWindow (private->xdisplay, private->xwindow, x, y);
-
- if (private->window_type == GDK_WINDOW_CHILD)
- {
- private->x = x;
- private->y = y;
- }
- }
-}
-
-void
-gdk_window_resize (GdkWindow *window,
- gint width,
- gint height)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- if (width < 1)
- width = 1;
- if (height < 1)
- height = 1;
-
- private = (GdkWindowPrivate*) window;
-
- if (!private->destroyed &&
- ((private->resize_count > 0) ||
- (private->width != (guint16) width) ||
- (private->height != (guint16) height)))
- {
- XResizeWindow (private->xdisplay, private->xwindow, width, height);
- private->resize_count += 1;
-
- if (private->window_type == GDK_WINDOW_CHILD)
- {
- private->width = width;
- private->height = height;
- }
- }
-}
-
-void
-gdk_window_move_resize (GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- if (width < 1)
- width = 1;
- if (height < 1)
- height = 1;
-
- private = (GdkWindowPrivate*) window;
- if (!private->destroyed)
- {
- XMoveResizeWindow (private->xdisplay, private->xwindow, x, y, width, height);
-
- if (private->window_type == GDK_WINDOW_CHILD)
- {
- private->x = x;
- private->y = y;
- private->width = width;
- private->height = height;
- }
- }
-}
-
-void
-gdk_window_reparent (GdkWindow *window,
- GdkWindow *new_parent,
- gint x,
- gint y)
-{
- GdkWindowPrivate *window_private;
- GdkWindowPrivate *parent_private;
-
- g_return_if_fail (window != NULL);
-
- if (!new_parent)
- new_parent = (GdkWindow*) &gdk_root_parent;
-
- window_private = (GdkWindowPrivate*) window;
- parent_private = (GdkWindowPrivate*) new_parent;
-
- if (!window_private->destroyed && !parent_private->destroyed)
- XReparentWindow (window_private->xdisplay,
- window_private->xwindow,
- parent_private->xwindow,
- x, y);
-}
-
-void
-gdk_window_clear (GdkWindow *window)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
-
- if (!private->destroyed)
- XClearWindow (private->xdisplay, private->xwindow);
-}
-
-void
-gdk_window_clear_area (GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
-
- if (!private->destroyed)
- XClearArea (private->xdisplay, private->xwindow,
- x, y, width, height, False);
-}
-
-void
-gdk_window_clear_area_e (GdkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
-
- if (!private->destroyed)
- XClearArea (private->xdisplay, private->xwindow,
- x, y, width, height, True);
-}
-
-void
-gdk_window_copy_area (GdkWindow *window,
- GdkGC *gc,
- gint x,
- gint y,
- GdkWindow *source_window,
- gint source_x,
- gint source_y,
- gint width,
- gint height)
-{
- GdkWindowPrivate *src_private;
- GdkWindowPrivate *dest_private;
- GdkGCPrivate *gc_private;
-
- g_return_if_fail (window != NULL);
- g_return_if_fail (gc != NULL);
-
- if (source_window == NULL)
- source_window = window;
-
- src_private = (GdkWindowPrivate*) source_window;
- dest_private = (GdkWindowPrivate*) window;
- gc_private = (GdkGCPrivate*) gc;
-
- if (!src_private->destroyed && !dest_private->destroyed)
- {
- XCopyArea (dest_private->xdisplay, src_private->xwindow, dest_private->xwindow,
- gc_private->xgc,
- source_x, source_y,
- width, height,
- x, y);
- }
-}
-
-void
-gdk_window_raise (GdkWindow *window)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
-
- if (!private->destroyed)
- XRaiseWindow (private->xdisplay, private->xwindow);
-}
-
-void
-gdk_window_lower (GdkWindow *window)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
-
- if (!private->destroyed)
- XLowerWindow (private->xdisplay, private->xwindow);
-}
-
-void
-gdk_window_set_user_data (GdkWindow *window,
- gpointer user_data)
-{
- g_return_if_fail (window != NULL);
-
- window->user_data = user_data;
-}
-
-void
-gdk_window_set_hints (GdkWindow *window,
- gint x,
- gint y,
- gint min_width,
- gint min_height,
- gint max_width,
- gint max_height,
- gint flags)
-{
- GdkWindowPrivate *private;
- XSizeHints size_hints;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
- if (private->destroyed)
- return;
-
- size_hints.flags = 0;
-
- if (flags & GDK_HINT_POS)
- {
- size_hints.flags |= PPosition;
- size_hints.x = x;
- size_hints.y = y;
- }
-
- if (flags & GDK_HINT_MIN_SIZE)
- {
- size_hints.flags |= PMinSize;
- size_hints.min_width = min_width;
- size_hints.min_height = min_height;
- }
-
- if (flags & GDK_HINT_MAX_SIZE)
- {
- size_hints.flags |= PMaxSize;
- size_hints.max_width = max_width;
- size_hints.max_height = max_height;
- }
-
- if (flags)
- XSetWMNormalHints (private->xdisplay, private->xwindow, &size_hints);
-}
-
-void
-gdk_window_set_title (GdkWindow *window,
- const gchar *title)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
- if (!private->destroyed)
- XmbSetWMProperties (private->xdisplay, private->xwindow,
- title, title, NULL, 0, NULL, NULL, NULL);
-}
-
-void
-gdk_window_set_background (GdkWindow *window,
- GdkColor *color)
-{
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
- if (!private->destroyed)
- XSetWindowBackground (private->xdisplay, private->xwindow, color->pixel);
-}
-
-void
-gdk_window_set_back_pixmap (GdkWindow *window,
- GdkPixmap *pixmap,
- gint parent_relative)
-{
- GdkWindowPrivate *window_private;
- GdkPixmapPrivate *pixmap_private;
- Pixmap xpixmap;
-
- g_return_if_fail (window != NULL);
-
- window_private = (GdkWindowPrivate*) window;
- pixmap_private = (GdkPixmapPrivate*) pixmap;
-
- if (pixmap)
- xpixmap = pixmap_private->xwindow;
- else
- xpixmap = None;
-
- if (parent_relative)
- xpixmap = ParentRelative;
-
- if (!window_private->destroyed)
- XSetWindowBackgroundPixmap (window_private->xdisplay, window_private->xwindow, xpixmap);
-}
-
-void
-gdk_window_set_cursor (GdkWindow *window,
- GdkCursor *cursor)
-{
- GdkWindowPrivate *window_private;
- GdkCursorPrivate *cursor_private;
- Cursor xcursor;
-
- g_return_if_fail (window != NULL);
-
- window_private = (GdkWindowPrivate*) window;
- cursor_private = (GdkCursorPrivate*) cursor;
-
- if (!cursor)
- xcursor = None;
- else
- xcursor = cursor_private->xcursor;
-
- if (!window_private->destroyed)
- XDefineCursor (window_private->xdisplay, window_private->xwindow, xcursor);
-}
-
-void
-gdk_window_set_colormap (GdkWindow *window,
- GdkColormap *colormap)
-{
- GdkWindowPrivate *window_private;
- GdkColormapPrivate *colormap_private;
-
- g_return_if_fail (window != NULL);
- g_return_if_fail (colormap != NULL);
-
- window_private = (GdkWindowPrivate*) window;
- colormap_private = (GdkColormapPrivate*) colormap;
-
- if (!window_private->destroyed)
- {
- XSetWindowColormap (window_private->xdisplay,
- window_private->xwindow,
- colormap_private->xcolormap);
-
- if (window_private->window_type != GDK_WINDOW_TOPLEVEL)
- gdk_window_add_colormap_windows (window);
- }
-}
-
-void
-gdk_window_get_user_data (GdkWindow *window,
- gpointer *data)
-{
- g_return_if_fail (window != NULL);
-
- *data = window->user_data;
-}
-
-void
-gdk_window_get_geometry (GdkWindow *window,
- gint *x,
- gint *y,
- gint *width,
- gint *height,
- gint *depth)
-{
- GdkWindowPrivate *window_private;
- Window root;
- gint tx;
- gint ty;
- guint twidth;
- guint theight;
- guint tborder_width;
- guint tdepth;
-
- if (!window)
- window = (GdkWindow*) &gdk_root_parent;
-
- window_private = (GdkWindowPrivate*) window;
-
- if (!window_private->destroyed)
- {
- XGetGeometry (window_private->xdisplay, window_private->xwindow,
- &root, &tx, &ty, &twidth, &theight, &tborder_width, &tdepth);
-
- if (x)
- *x = tx;
- if (y)
- *y = ty;
- if (width)
- *width = twidth;
- if (height)
- *height = theight;
- if (depth)
- *depth = tdepth;
- }
-}
-
-void
-gdk_window_get_position (GdkWindow *window,
- gint *x,
- gint *y)
-{
- GdkWindowPrivate *window_private;
-
- g_return_if_fail (window != NULL);
-
- window_private = (GdkWindowPrivate*) window;
-
- if (x)
- *x = window_private->x;
- if (y)
- *y = window_private->y;
-}
-
-void
-gdk_window_get_size (GdkWindow *window,
- gint *width,
- gint *height)
-{
- GdkWindowPrivate *window_private;
-
- g_return_if_fail (window != NULL);
-
- window_private = (GdkWindowPrivate*) window;
-
- if (width)
- *width = window_private->width;
- if (height)
- *height = window_private->height;
-}
-
-GdkVisual*
-gdk_window_get_visual (GdkWindow *window)
-{
- GdkWindowPrivate *window_private;
- XWindowAttributes window_attributes;
-
- g_return_val_if_fail (window != NULL, NULL);
-
- window_private = (GdkWindowPrivate*) window;
- while (window_private && (window_private->window_type == GDK_WINDOW_PIXMAP))
- window_private = (GdkWindowPrivate*) window_private->parent;
-
- if (window_private && !window_private->destroyed)
- {
- XGetWindowAttributes (window_private->xdisplay,
- window_private->xwindow,
- &window_attributes);
-
- return gdk_visual_lookup (window_attributes.visual);
- }
-
- return NULL;
-}
-
-GdkColormap*
-gdk_window_get_colormap (GdkWindow *window)
-{
- GdkWindowPrivate *window_private;
- XWindowAttributes window_attributes;
-
- g_return_val_if_fail (window != NULL, NULL);
-
- window_private = (GdkWindowPrivate*) window;
-
- if (!window_private->destroyed)
- {
- XGetWindowAttributes (window_private->xdisplay,
- window_private->xwindow,
- &window_attributes);
-
- return gdk_colormap_lookup (window_attributes.colormap);
- }
-
- return NULL;
-}
-
-GdkWindowType
-gdk_window_get_type (GdkWindow *window)
-{
- GdkWindowPrivate *window_private;
-
- g_return_val_if_fail (window != NULL, (GdkWindowType) -1);
-
- window_private = (GdkWindowPrivate*) window;
- return window_private->window_type;
-}
-
-gint
-gdk_window_get_origin (GdkWindow *window,
- gint *x,
- gint *y)
-{
- GdkWindowPrivate *private;
- gint return_val;
- Window child;
- gint tx, ty;
-
- g_return_val_if_fail (window != NULL, 0);
-
- private = (GdkWindowPrivate*) window;
-
- if (!private->destroyed)
- {
- return_val = XTranslateCoordinates (private->xdisplay,
- private->xwindow,
- gdk_root_window,
- 0, 0, &tx, &ty,
- &child);
-
- if (x)
- *x = tx;
- if (y)
- *y = ty;
- }
- else
- return_val = 0;
-
- return return_val;
-}
-
-GdkWindow*
-gdk_window_get_pointer (GdkWindow *window,
- gint *x,
- gint *y,
- GdkModifierType *mask)
-{
- GdkWindowPrivate *private;
- GdkWindow *return_val;
- Window root;
- Window child;
- int rootx, rooty;
- int winx, winy;
- unsigned int xmask;
-
- if (!window)
- window = (GdkWindow*) &gdk_root_parent;
-
- private = (GdkWindowPrivate*) window;
-
- return_val = NULL;
- if (!private->destroyed &&
- XQueryPointer (private->xdisplay, private->xwindow, &root, &child,
- &rootx, &rooty, &winx, &winy, &xmask))
- {
- if (x) *x = winx;
- if (y) *y = winy;
- if (mask) *mask = xmask;
-
- if (child)
- return_val = gdk_window_lookup (child);
- }
-
- return return_val;
-}
-
-GdkWindow*
-gdk_window_get_parent (GdkWindow *window)
-{
- g_return_val_if_fail (window != NULL, NULL);
-
- return ((GdkWindowPrivate*) window)->parent;
-}
-
-GdkWindow*
-gdk_window_get_toplevel (GdkWindow *window)
-{
- GdkWindowPrivate *private;
-
- g_return_val_if_fail (window != NULL, NULL);
-
- private = (GdkWindowPrivate*) window;
-
- while (private->window_type == GDK_WINDOW_CHILD)
- {
- window = ((GdkWindowPrivate*) window)->parent;
- private = (GdkWindowPrivate*) window;
- }
-
- return window;
-}
-
-GList*
-gdk_window_get_children (GdkWindow *window)
-{
- GdkWindowPrivate *private;
- GdkWindow *child;
- GList *children;
- Window root;
- Window parent;
- Window *xchildren;
- unsigned int nchildren;
- unsigned int i;
-
- g_return_val_if_fail (window != NULL, NULL);
-
- private = (GdkWindowPrivate*) window;
- if (private->destroyed)
- return NULL;
-
- XQueryTree (private->xdisplay, private->xwindow,
- &root, &parent, &xchildren, &nchildren);
-
- children = NULL;
-
- if (nchildren > 0)
- {
- for (i = 0; i < nchildren; i++)
- {
- child = gdk_window_lookup (xchildren[i]);
- if (child)
- children = g_list_prepend (children, child);
- }
-
- XFree (xchildren);
- }
-
- return children;
-}
-
-GdkEventMask
-gdk_window_get_events (GdkWindow *window)
-{
- GdkWindowPrivate *private;
- XWindowAttributes attrs;
- GdkEventMask event_mask;
- int i;
-
- g_return_val_if_fail (window != NULL, 0);
-
- private = (GdkWindowPrivate*) window;
- if (private->destroyed)
- return 0;
-
- XGetWindowAttributes (gdk_display, private->xwindow,
- &attrs);
-
- event_mask = 0;
- for (i = 0; i < nevent_masks; i++)
- {
- if (attrs.your_event_mask & event_mask_table[i])
- event_mask |= 1 << (i + 1);
- }
-
- return event_mask;
-}
-
-void
-gdk_window_set_events (GdkWindow *window,
- GdkEventMask event_mask)
-{
- GdkWindowPrivate *private;
- long xevent_mask;
- int i;
-
- g_return_if_fail (window != NULL);
-
- private = (GdkWindowPrivate*) window;
- if (private->destroyed)
- return;
-
- xevent_mask = StructureNotifyMask;
- for (i = 0; i < nevent_masks; i++)
- {
- if (event_mask & (1 << (i + 1)))
- xevent_mask |= event_mask_table[i];
- }
-
- XSelectInput (gdk_display, private->xwindow,
- xevent_mask);
-}
-
-void
-gdk_window_add_colormap_windows (GdkWindow *window)
-{
- GdkWindow *toplevel;
- GdkWindowPrivate *toplevel_private;
- GdkWindowPrivate *window_private;
- Window *old_windows;
- Window *new_windows;
- int i, count;
-
- g_return_if_fail (window != NULL);
-
- toplevel = gdk_window_get_toplevel (window);
- toplevel_private = (GdkWindowPrivate*) toplevel;
- window_private = (GdkWindowPrivate*) window;
- if (window_private->destroyed)
- return;
-
- if (!XGetWMColormapWindows (toplevel_private->xdisplay,
- toplevel_private->xwindow,
- &old_windows, &count))
- {
- old_windows = NULL;
- count = 0;
- }
-
- for (i = 0; i < count; i++)
- if (old_windows[i] == window_private->xwindow)
- return;
-
- new_windows = g_new (Window, count + 1);
-
- for (i = 0; i < count; i++)
- new_windows[i] = old_windows[i];
- new_windows[count] = window_private->xwindow;
-
- XSetWMColormapWindows (toplevel_private->xdisplay,
- toplevel_private->xwindow,
- new_windows, count + 1);
-
- g_free (new_windows);
- if (old_windows)
- XFree (old_windows);
-}
-
-/*
- * This needs the X11 shape extension.
- * If not available, simply remove the call to
- * XShapeCombineMask. Shaped windows will look
- * ugly, but programs still work. Stefan Wille
- */
-void
-gdk_window_shape_combine_mask (GdkWindow *window,
- GdkBitmap *mask,
- gint x, gint y)
-{
- GdkWindowPrivate *window_private;
- Pixmap pixmap;
-
- g_return_if_fail (window != NULL);
-
- window_private = (GdkWindowPrivate*) window;
- if (window_private->destroyed)
- return;
-
- if (mask)
- {
- GdkWindowPrivate *pixmap_private;
-
- pixmap_private = (GdkWindowPrivate*) mask;
- pixmap = (Pixmap) pixmap_private->xwindow;
- }
- else
- {
- x = 0;
- y = 0;
- pixmap = None;
- }
-
- XShapeCombineMask (window_private->xdisplay,
- window_private->xwindow,
- ShapeBounding,
- x, y,
- pixmap,
- ShapeSet);
-}
-
-void
-gdk_dnd_drag_addwindow (GdkWindow *window)
-{
- GdkWindowPrivate *window_private;
-
- g_return_if_fail (window != NULL);
-
- window_private = (GdkWindowPrivate *) window;
- if (window_private->destroyed)
- return;
-
- if (window_private->dnd_drag_enabled == 1 && gdk_dnd.drag_really == 0)
- {
- gdk_dnd.drag_numwindows++;
- gdk_dnd.drag_startwindows = g_realloc (gdk_dnd.drag_startwindows,
- gdk_dnd.drag_numwindows
- * sizeof(GdkWindow *));
- gdk_dnd.drag_startwindows[gdk_dnd.drag_numwindows - 1] = window;
- window_private->dnd_drag_accepted = 0;
- }
- else
- g_warning ("dnd_really is 1 or drag is not enabled! can't addwindow\n");
-}
-
-void
-gdk_window_dnd_drag_set (GdkWindow *window,
- guint8 drag_enable,
- gchar **typelist,
- guint numtypes)
-{
- GdkWindowPrivate *window_private;
- int i, wasset = 0;
-
- g_return_if_fail (window != NULL);
- window_private = (GdkWindowPrivate *) window;
- if (window_private->destroyed)
- return;
-
- window_private->dnd_drag_enabled = drag_enable ? 1 : 0;
-
- if (drag_enable)
- {
- g_return_if_fail(typelist != NULL);
-
- if (window_private->dnd_drag_data_numtypesavail > 3)
- wasset = 1;
- window_private->dnd_drag_data_numtypesavail = numtypes;
-
- window_private->dnd_drag_data_typesavail =
- g_realloc (window_private->dnd_drag_data_typesavail,
- (numtypes + 1) * sizeof (GdkAtom));
-
- for (i = 0; i < numtypes; i++)
- {
- /* Allow blanket use of ALL to get anything... */
- if (strcmp (typelist[i], "ALL"))
- window_private->dnd_drag_data_typesavail[i] =
- gdk_atom_intern (typelist[i], FALSE);
- else
- window_private->dnd_drag_data_typesavail[i] = None;
- }
-
- /*
- * set our extended type list if we need to
- */
- if (numtypes > 3)
- gdk_property_change(window, gdk_dnd.gdk_XdeTypelist,
- XA_PRIMARY, 32, GDK_PROP_MODE_REPLACE,
- (guchar *)(window_private->dnd_drag_data_typesavail
- + (sizeof(GdkAtom) * 3)),
- (numtypes - 3) * sizeof(GdkAtom));
- else if (wasset)
- gdk_property_delete (window, gdk_dnd.gdk_XdeTypelist);
- }
- else
- {
- g_free (window_private->dnd_drag_data_typesavail);
- window_private->dnd_drag_data_typesavail = NULL;
- window_private->dnd_drag_data_numtypesavail = 0;
- }
-}
-
-void
-gdk_window_dnd_drop_set (GdkWindow *window,
- guint8 drop_enable,
- gchar **typelist,
- guint numtypes,
- guint8 destructive_op)
-{
- GdkWindowPrivate *window_private;
- int i;
-
- g_return_if_fail (window != NULL);
- window_private = (GdkWindowPrivate *) window;
- if (window_private->destroyed)
- return;
-
- window_private->dnd_drop_enabled = drop_enable ? 1 : 0;
- if (drop_enable)
- {
- g_return_if_fail(typelist != NULL);
-
- window_private->dnd_drop_data_numtypesavail = numtypes;
-
- window_private->dnd_drop_data_typesavail =
- g_realloc (window_private->dnd_drop_data_typesavail,
- (numtypes + 1) * sizeof (GdkAtom));
-
- for (i = 0; i < numtypes; i++)
- window_private->dnd_drop_data_typesavail[i] =
- gdk_atom_intern (typelist[i], FALSE);
-
- window_private->dnd_drop_destructive_op = destructive_op;
- }
-}
-
-/*
- * This is used to reply to a GDK_DRAG_REQUEST event
- * (which may be generated by XdeRequest or a confirmed drop...
- */
-void
-gdk_window_dnd_data_set (GdkWindow *window,
- GdkEvent *event,
- gpointer data,
- gulong data_numbytes)
-{
- GdkWindowPrivate *window_private;
- XEvent sev;
- GdkEventDropDataAvailable tmp_ev;
- gchar *tmp;
-
- g_return_if_fail (window != NULL);
- g_return_if_fail (event != NULL);
- g_return_if_fail (data != NULL);
- g_return_if_fail (data_numbytes > 0);
- g_return_if_fail (event->type == GDK_DRAG_REQUEST);
-
- window_private = (GdkWindowPrivate *) window;
- g_return_if_fail (window_private->dnd_drag_accepted != 0);
- if (window_private->destroyed)
- return;
-
- /* We set the property on our window... */
- gdk_property_change (window, window_private->dnd_drag_data_type,
- XA_PRIMARY, 8, GDK_PROP_MODE_REPLACE, data,
- data_numbytes);
- tmp = gdk_atom_name(window_private->dnd_drag_data_type);
-#ifdef DEBUG_DND
- g_print("DnD type %s on window %ld\n", tmp, window_private->xwindow);
-#endif
- g_free(tmp);
-
- /*
- * Then we send the event to tell the receiving window that the
- * drop has happened
- */
- tmp_ev.u.allflags = 0;
- tmp_ev.u.flags.protocol_version = DND_PROTOCOL_VERSION;
- tmp_ev.u.flags.isdrop = event->dragrequest.isdrop;
-
- sev.xclient.type = ClientMessage;
- sev.xclient.format = 32;
- sev.xclient.window = event->dragrequest.requestor;
- sev.xclient.message_type = gdk_dnd.gdk_XdeDataAvailable;
- sev.xclient.data.l[0] = window_private->xwindow;
- sev.xclient.data.l[1] = tmp_ev.u.allflags;
- sev.xclient.data.l[2] = window_private->dnd_drag_data_type;
-
- if (event->dragrequest.isdrop)
- sev.xclient.data.l[3] = event->dragrequest.drop_coords.x +
- (event->dragrequest.drop_coords.y << 16);
- else
- sev.xclient.data.l[3] = 0;
-
- sev.xclient.data.l[4] = event->dragrequest.timestamp;
-
- if (!gdk_send_xevent (event->dragrequest.requestor, False,
- NoEventMask, &sev))
- GDK_NOTE (DND, g_print("Sending XdeDataAvailable to %#x failed\n",
- event->dragrequest.requestor));
-
-}
-
-void
-gdk_window_add_filter (GdkWindow *window,
- GdkFilterFunc function,
- gpointer data)
-{
- GdkWindowPrivate *private;
- GList *tmp_list;
- GdkEventFilter *filter;
-
- private = (GdkWindowPrivate*) window;
- if (private && private->destroyed)
- return;
-
- if(private)
- tmp_list = private->filters;
- else
- tmp_list = gdk_default_filters;
-
- while (tmp_list)
- {
- filter = (GdkEventFilter *)tmp_list->data;
- if ((filter->function == function) && (filter->data == data))
- return;
- tmp_list = tmp_list->next;
- }
-
- filter = g_new (GdkEventFilter, 1);
- filter->function = function;
- filter->data = data;
-
- if(private)
- private->filters = g_list_append (private->filters, filter);
- else
- gdk_default_filters = g_list_append (gdk_default_filters, filter);
-}
-
-void
-gdk_window_remove_filter (GdkWindow *window,
- GdkFilterFunc function,
- gpointer data)
-{
- GdkWindowPrivate *private;
- GList *tmp_list;
- GdkEventFilter *filter;
-
- private = (GdkWindowPrivate*) window;
-
- if(private)
- tmp_list = private->filters;
- else
- tmp_list = gdk_default_filters;
-
- while (tmp_list)
- {
- filter = (GdkEventFilter *)tmp_list->data;
- tmp_list = tmp_list->next;
-
- if ((filter->function == function) && (filter->data == data))
- {
- if(private)
- private->filters = g_list_remove_link (private->filters, tmp_list);
- else
- gdk_default_filters = g_list_remove_link (gdk_default_filters, tmp_list);
- g_list_free_1 (tmp_list);
- g_free (filter);
-
- return;
- }
- }
-}
-
-void
-gdk_window_set_override_redirect(GdkWindow *window,
- gboolean override_redirect)
-{
- GdkWindowPrivate *private;
- XSetWindowAttributes attr;
-
- g_return_if_fail (window != NULL);
- private = (GdkWindowPrivate*) window;
- if (private->destroyed)
- return;
-
- attr.override_redirect = (override_redirect == FALSE)?False:True;
- XChangeWindowAttributes(gdk_display,
- ((GdkWindowPrivate *)window)->xwindow,
- CWOverrideRedirect,
- &attr);
-}
-
-void
-gdk_window_set_icon (GdkWindow *window,
- GdkWindow *icon_window,
- GdkPixmap *pixmap,
- GdkBitmap *mask)
-{
- XWMHints wm_hints;
- GdkWindowPrivate *window_private;
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
- window_private = (GdkWindowPrivate*) window;
- if (window_private->destroyed)
- return;
-
- wm_hints.flags = 0;
-
- if (icon_window != NULL)
- {
- private = (GdkWindowPrivate *)icon_window;
- wm_hints.flags |= IconWindowHint;
- wm_hints.icon_window = private->xwindow;
- }
-
- if (pixmap != NULL)
- {
- private = (GdkWindowPrivate *)pixmap;
- wm_hints.flags |= IconPixmapHint;
- wm_hints.icon_pixmap = private->xwindow;
- }
-
- if (mask != NULL)
- {
- private = (GdkWindowPrivate *)mask;
- wm_hints.flags |= IconMaskHint;
- wm_hints.icon_mask = private->xwindow;
- }
-
- XSetWMHints (window_private->xdisplay, window_private->xwindow, &wm_hints);
-}
-
-void
-gdk_window_set_icon_name (GdkWindow *window,
- gchar * name)
-{
- GdkWindowPrivate *window_private;
- XTextProperty property;
- gint res;
-
- g_return_if_fail (window != NULL);
- window_private = (GdkWindowPrivate*) window;
- if (window_private->destroyed)
- return;
- res = XmbTextListToTextProperty (window_private->xdisplay,
- &name, 1, XStdICCTextStyle,
- &property);
- if (res < 0)
- {
- g_warning("Error converting icon name to text property: %d\n", res);
- return;
- }
-
- XSetWMIconName (window_private->xdisplay, window_private->xwindow,
- &property);
-
- XFree(property.value);
-}
-
-void
-gdk_window_set_group (GdkWindow *window,
- GdkWindow *leader)
-{
- XWMHints wm_hints;
- GdkWindowPrivate *window_private;
- GdkWindowPrivate *private;
-
- g_return_if_fail (window != NULL);
- g_return_if_fail (leader != NULL);
- window_private = (GdkWindowPrivate*) window;
- if (window_private->destroyed)
- return;
-
- private = (GdkWindowPrivate *)leader;
- wm_hints.flags |= WindowGroupHint;
- wm_hints.window_group = private->xwindow;
-
- XSetWMHints (window_private->xdisplay, window_private->xwindow, &wm_hints);
-}
-
-static void
-gdk_window_set_mwm_hints (GdkWindow *window,
- MotifWmHints *new_hints)
-{
- static Atom hints_atom = None;
- MotifWmHints *hints;
- Atom type;
- gint format;
- gulong nitems;
- gulong bytes_after;
-
- GdkWindowPrivate *window_private;
-
- g_return_if_fail (window != NULL);
- window_private = (GdkWindowPrivate*) window;
- if (window_private->destroyed)
- return;
-
- if (!hints_atom)
- hints_atom = XInternAtom (window_private->xdisplay,
- _XA_MOTIF_WM_HINTS, FALSE);
-
- XGetWindowProperty (window_private->xdisplay, window_private->xwindow,
- hints_atom, 0, sizeof(MotifWmHints)/4,
- False, AnyPropertyType, &type, &format, &nitems,
- &bytes_after, (guchar **)&hints);
-
- if (type == None)
- hints = new_hints;
- else
- {
- if (new_hints->flags & MWM_HINTS_FUNCTIONS)
- {
- hints->flags |= MWM_HINTS_FUNCTIONS;
- hints->functions = new_hints->functions;
- }
- if (new_hints->flags & MWM_HINTS_DECORATIONS)
- {
- hints->flags |= MWM_HINTS_DECORATIONS;
- hints->decorations = new_hints->decorations;
- }
- }
-
- XChangeProperty (window_private->xdisplay, window_private->xwindow,
- hints_atom, hints_atom, 32, PropModeReplace,
- (guchar *)hints, sizeof(MotifWmHints)/4);
-
- if (hints != new_hints)
- XFree (hints);
-}
-
-void
-gdk_window_set_decorations (GdkWindow *window,
- GdkWMDecoration decorations)
-{
- MotifWmHints hints;
-
- hints.flags = MWM_HINTS_DECORATIONS;
- hints.decorations = decorations;
-
- gdk_window_set_mwm_hints (window, &hints);
-}
-
-void
-gdk_window_set_functions (GdkWindow *window,
- GdkWMFunction functions)
-{
- MotifWmHints hints;
-
- hints.flags = MWM_HINTS_FUNCTIONS;
- hints.functions = functions;
-
- gdk_window_set_mwm_hints (window, &hints);
-}
diff --git a/gdk/x11/gdkx.h b/gdk/x11/gdkx.h
deleted file mode 100644
index cc43cbca17..0000000000
--- a/gdk/x11/gdkx.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GDK_X_H__
-#define __GDK_X_H__
-
-#include <gdk/gdkprivate.h>
-
-
-#define GDK_ROOT_WINDOW() gdk_root_window
-#define GDK_ROOT_PARENT() ((GdkWindow *)&gdk_root_parent)
-#define GDK_DISPLAY() gdk_display
-#define GDK_WINDOW_XDISPLAY(win) (((GdkWindowPrivate*) win)->xdisplay)
-#define GDK_WINDOW_XWINDOW(win) (((GdkWindowPrivate*) win)->xwindow)
-#define GDK_IMAGE_XDISPLAY(image) (((GdkImagePrivate*) image)->xdisplay)
-#define GDK_IMAGE_XIMAGE(image) (((GdkImagePrivate*) image)->ximage)
-#define GDK_GC_XDISPLAY(gc) (((GdkGCPrivate*) gc)->xdisplay)
-#define GDK_GC_XGC(gc) (((GdkGCPrivate*) gc)->xgc)
-#define GDK_COLORMAP_XDISPLAY(cmap) (((GdkColormapPrivate*) cmap)->xdisplay)
-#define GDK_COLORMAP_XCOLORMAP(cmap) (((GdkColormapPrivate*) cmap)->xcolormap)
-#define GDK_VISUAL_XVISUAL(vis) (((GdkVisualPrivate*) vis)->xvisual)
-#define GDK_FONT_XDISPLAY(font) (((GdkFontPrivate*) font)->xdisplay)
-#define GDK_FONT_XFONT(font) (((GdkFontPrivate*) font)->xfont)
-
-
-GdkVisual* gdkx_visual_get (VisualID xvisualid);
-GdkColormap* gdkx_colormap_get (Colormap xcolormap);
-/* Utility function in gdk.c - not sure where it belongs, but it's
- needed in more than one place, so make it public */
-Window gdk_get_client_window (Display *dpy,
- Window win);
-
-
-#endif /* __GDK_X_H__ */
diff --git a/gdk/x11/gdkxid.c b/gdk/x11/gdkxid.c
deleted file mode 100644
index 94c304f4ed..0000000000
--- a/gdk/x11/gdkxid.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gdkprivate.h"
-#include <stdio.h>
-
-static guint gdk_xid_hash (XID *xid);
-static gint gdk_xid_compare (XID *a,
- XID *b);
-
-
-GHashTable *xid_ht = NULL;
-
-
-void
-gdk_xid_table_insert (XID *xid,
- gpointer data)
-{
- g_return_if_fail (xid != NULL);
-
- if (!xid_ht)
- xid_ht = g_hash_table_new ((GHashFunc) gdk_xid_hash,
- (GCompareFunc) gdk_xid_compare);
-
- g_hash_table_insert (xid_ht, xid, data);
-}
-
-void
-gdk_xid_table_remove (XID xid)
-{
- if (!xid_ht)
- xid_ht = g_hash_table_new ((GHashFunc) gdk_xid_hash,
- (GCompareFunc) gdk_xid_compare);
-
- g_hash_table_remove (xid_ht, &xid);
-}
-
-gpointer
-gdk_xid_table_lookup (XID xid)
-{
- gpointer data;
-
- data = g_hash_table_lookup (xid_ht, &xid);
-
- return data;
-}
-
-
-static guint
-gdk_xid_hash (XID *xid)
-{
- return *xid;
-}
-
-static gint
-gdk_xid_compare (XID *a,
- XID *b)
-{
- return (*a == *b);
-}
diff --git a/gdk/x11/gxid.c b/gdk/x11/gxid.c
deleted file mode 100644
index 219c08bfe0..0000000000
--- a/gdk/x11/gxid.c
+++ /dev/null
@@ -1,844 +0,0 @@
-/*
- * gxid version 0.3
- *
- * Copyright 1997 Owen Taylor <owt1@cornell.edu>
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/XInput.h>
-
-#include "gxid_proto.h"
-
-/* #define DEBUG_CLIENTS */
-/* #define DEBUG_EVENTS */
-
-char *program_name;
-Display *dpy;
-Window root_window; /* default root window of dpy */
-int port = 0; /* port to listen on */
-int socket_fd = 0; /* file descriptor of socket */
-typedef struct GxidWindow_ GxidWindow;
-
-typedef struct GxidDevice_ GxidDevice;
-struct GxidDevice_ {
- XID id;
- int exclusive;
- int ispointer;
-
- XDevice *xdevice;
- int motionnotify_type;
- int changenotify_type;
-};
-
-struct GxidWindow_ {
- Window xwindow;
- /* Immediate child of root that is ancestor of window */
- Window root_child;
- int num_devices;
- GxidDevice **devices;
-};
-
-GxidDevice **devices = NULL;
-int num_devices = 0;
-GxidWindow **windows = NULL;
-int num_windows = 0;
-
-void
-handler(int signal)
-{
- fprintf(stderr,"%s: dying on signal %d\n",program_name,signal);
- if (socket_fd)
- close(socket_fd);
- exit(1);
-}
-
-void
-init_socket()
-{
- struct sockaddr_in sin;
-
- socket_fd = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
- if (socket_fd < 0)
- {
- fprintf (stderr, "%s: error getting socket\n",
- program_name);
- exit(1);
- }
-
- sin.sin_family = AF_INET;
- sin.sin_port = htons(port);
- sin.sin_addr.s_addr = INADDR_ANY;
-
- if (bind(socket_fd,(struct sockaddr *)(&sin),
- sizeof(struct sockaddr_in)) < 0)
- {
- fprintf (stderr,"%s: cannot bind to port %d\n",
- program_name,port);
- exit(1);
- }
-
- if (listen(socket_fd,5) < 0)
- {
- fprintf (stderr,"%s: error listening on socket\n",
- program_name);
- exit(1);
- };
-}
-
-#define NUM_EVENTC 2
-static void
-enable_device(GxidDevice *dev)
-{
- XEventClass xevc[NUM_EVENTC];
- int num_eventc = NUM_EVENTC;
- int i,j;
-
- if (!dev->xdevice)
- {
- if (dev->ispointer) return;
-
- dev->xdevice = XOpenDevice(dpy, dev->id);
- if (!dev->xdevice) return;
-
- DeviceMotionNotify (dev->xdevice, dev->motionnotify_type,
- xevc[0]);
- ChangeDeviceNotify (dev->xdevice, dev->changenotify_type,
- xevc[1]);
-
- /* compress out zero event classes */
- for (i=0,j=0;i<NUM_EVENTC;i++)
- {
- if (xevc[i]) {
- xevc[j] = xevc[i];
- j++;
- }
- }
- num_eventc = j;
-
- XSelectExtensionEvent (dpy, root_window, xevc, num_eventc);
- }
-}
-
-/* switch the core pointer from whatever it is now to something else,
- return true on success, false otherwise */
-static int
-switch_core_pointer()
-{
- GxidDevice *old_pointer = 0;
- GxidDevice *new_pointer = 0;
- int result;
- int i;
-
- for (i=0;i<num_devices;i++)
- {
- if (devices[i]->ispointer)
- old_pointer = devices[i];
- else
- if (!new_pointer && !devices[i]->exclusive)
- new_pointer = devices[i];
- }
-
- if (!old_pointer || !new_pointer)
- return 0;
-
-#ifdef DEBUG_EVENTS
- fprintf(stderr,"gxid: Switching core from %ld to %ld\n",
- old_pointer->id,new_pointer->id);
-#endif
- result = XChangePointerDevice(dpy,new_pointer->xdevice, 0, 1);
- if (result != Success)
- {
- fprintf(stderr,"gxid: Error %d switching core from %ld to %ld\n",
- result, old_pointer->id, new_pointer->id);
- }
- else
- {
- new_pointer->ispointer = 1;
- old_pointer->ispointer = 0;
- if (!old_pointer->xdevice)
- enable_device(old_pointer);
- }
-
- return 1;
-}
-
-void
-disable_device(GxidDevice *dev)
-{
- if (dev->xdevice)
- {
- if (dev->ispointer)
- return;
- XCloseDevice(dpy,dev->xdevice);
- dev->xdevice = 0;
- }
-}
-
-GxidDevice *
-init_device(XDeviceInfo *xdevice)
-{
- GxidDevice *dev = (GxidDevice *)malloc(sizeof(GxidDevice));
- XAnyClassPtr class;
- int num_axes, i;
-
- dev->id = xdevice->id;
- dev->exclusive = 0;
- dev->xdevice = NULL;
-
- dev->ispointer = (xdevice->use == IsXPointer);
-
- /* step through the classes */
-
- num_axes = 0;
- class = xdevice->inputclassinfo;
- for (i=0;i<xdevice->num_classes;i++)
- {
- if (class->class == ValuatorClass)
- {
- XValuatorInfo *xvi = (XValuatorInfo *)class;
- num_axes = xvi->num_axes;
- }
- class = (XAnyClassPtr)(((char *)class) + class->length);
- }
-
- /* return NULL if insufficient axes */
- if (num_axes < 2)
- {
- free((void *)dev);
- return NULL;
- }
-
- if (!dev->ispointer)
- enable_device(dev);
- return dev;
-}
-
-void
-init_xinput()
-{
- char **extensions;
- XDeviceInfo *xdevices;
- int num_xdevices;
- int num_extensions;
- int i;
-
- extensions = XListExtensions(dpy, &num_extensions);
- for (i = 0; i < num_extensions &&
- (strcmp(extensions[i], "XInputExtension") != 0); i++);
- XFreeExtensionList(extensions);
- if (i == num_extensions) /* XInput extension not found */
- {
- fprintf(stderr,"XInput extension not found\n");
- exit(1);
- }
-
- xdevices = XListInputDevices(dpy, &num_xdevices);
- devices = (GxidDevice **)malloc(num_xdevices * sizeof(GxidDevice *));
-
- num_devices = 0;
- for(i=0; i<num_xdevices; i++)
- {
- GxidDevice *dev = init_device(&xdevices[i]);
- if (dev)
- devices[num_devices++] = dev;
- }
- XFreeDeviceList(xdevices);
-}
-
-/* If this routine needs fixing, the corresponding routine
- in gdkinputgxi.h will need it too. */
-
-Window
-gxi_find_root_child(Display *dpy, Window w)
-{
- Window root,parent;
- Window *children;
- int nchildren;
-
- parent = w;
- do
- {
- w = parent;
- XQueryTree(dpy,w,&root,&parent,&children,&nchildren);
- if (children) XFree(children);
- }
- while (parent != root);
-
- return w;
-}
-
-int
-handle_claim_device(GxidClaimDevice *msg)
-{
- int i,j;
- XID devid = ntohl(msg->device);
- XID winid = ntohl(msg->window);
- int exclusive = ntohl(msg->exclusive);
- GxidDevice *device = NULL;
- GxidWindow *window = NULL;
-
-#ifdef DEBUG_CLIENTS
- fprintf(stderr,"device %ld claimed (window 0x%lx)\n",devid,winid);
-#endif
-
- for (i=0;i<num_devices;i++)
- {
- if (devices[i]->id == devid)
- {
- device = devices[i];
- break;
- }
- }
- if (!device)
- {
- fprintf(stderr,"%s: Unknown device id %ld\n",program_name,devid);
- return GXID_RETURN_ERROR;
- }
-
- if (device->exclusive)
- {
- /* already in use */
- fprintf(stderr,
- "%s: Device %ld already claimed in exclusive mode\n",
- program_name,devid);
- return GXID_RETURN_ERROR;
- }
-
- if (exclusive)
- {
- for (i=0;i<num_windows;i++)
- {
- for (j=0;j<windows[i]->num_devices;j++)
- if (windows[i]->devices[j]->id == devid)
- {
- /* already in use */
- fprintf(stderr,
- "%s: Can't establish exclusive use of device %ld\n",
- program_name,devid);
- return GXID_RETURN_ERROR;
- }
- }
- if (device->ispointer)
- if (!switch_core_pointer())
- {
- fprintf(stderr,
- "%s: Can't free up core pointer %ld\n",
- program_name,devid);
- return GXID_RETURN_ERROR;
- }
-
- device->exclusive = 1;
- disable_device(device);
- XSelectInput(dpy,winid,StructureNotifyMask);
- }
- else /* !exclusive */
- {
- /* FIXME: this is a bit improper. We probably should do this only
- when a window is first claimed. But we might be fooled if
- an old client died without releasing it's windows. So until
- we look for client-window closings, do it here
-
- (We do look for closings now...)
- */
-
- XSelectInput(dpy,winid,EnterWindowMask|StructureNotifyMask);
- }
-
- for (i=0;i<num_windows;i++)
- {
- if (windows[i]->xwindow == winid)
- {
- window = windows[i];
- break;
- }
- }
-
- /* Create window structure if no devices have been previously
- claimed on it */
- if (!window)
- {
- num_windows++;
- windows = (GxidWindow **)realloc(windows,
- sizeof(GxidWindow*)*num_windows);
- window = (GxidWindow *)malloc(sizeof(GxidWindow));
- windows[num_windows-1] = window;
-
- window->xwindow = winid;
- window->root_child = gxi_find_root_child(dpy,winid);
- window->num_devices = 0;
- window->devices = 0;
- }
-
-
- for (i=0;i<window->num_devices;i++)
- {
- if (window->devices[i] == device)
- return GXID_RETURN_OK;
- }
-
- window->num_devices++;
- window->devices = (GxidDevice **)realloc(window->devices,
- sizeof(GxidDevice*)*num_devices);
- /* we need add the device to the window */
- window->devices[i] = device;
-
- return GXID_RETURN_OK;
-}
-
-int
-handle_release_device(GxidReleaseDevice *msg)
-{
- int i,j;
- XID devid = ntohl(msg->device);
- XID winid = ntohl(msg->window);
-
- GxidDevice *device = NULL;
-
-#ifdef DEBUG_CLIENTS
- fprintf(stderr,"device %ld released (window 0x%lx)\n",devid,winid);
-#endif
-
- for (i=0;i<num_devices;i++)
- {
- if (devices[i]->id == devid)
- {
- device = devices[i];
- break;
- }
- }
- if (!device)
- {
- fprintf(stderr,"%s: Unknown device id %ld\n",program_name,devid);
- return GXID_RETURN_ERROR;
- }
-
- for (i=0;i<num_windows;i++)
- {
- GxidWindow *w = windows[i];
-
- if (w->xwindow == winid)
- for (j=0;j<w->num_devices;j++)
- if (w->devices[j]->id == devid)
- {
- if (j<w->num_devices-1)
- w->devices[j] = w->devices[w->num_devices-1];
- w->num_devices--;
-
- if (w->num_devices == 0)
- {
- if (i<num_windows-1)
- windows[i] = windows[num_windows-1];
- num_windows--;
-
- free((void *)w);
- /* FIXME: should we deselect input? But what
- what if window is already destroyed */
- }
-
- if (device->exclusive)
- {
- device->exclusive = 0;
- enable_device(device);
- }
- return GXID_RETURN_OK;
- }
- }
-
- /* device/window combination not found */
- fprintf(stderr,
- "%s: Device %ld not claimed for window 0x%lx\n",
- program_name,devid,winid);
- return GXID_RETURN_ERROR;
-}
-
-void
-handle_connection()
-{
- GxidMessage msg;
- GxidU32 type;
- int length;
- GxidI32 retval;
-
- int conn_fd;
- struct sockaddr_in sin;
- int sin_length;
- int count;
-
- sin_length = sizeof(struct sockaddr_in);
- conn_fd = accept(socket_fd,(struct sockaddr *)&sin,&sin_length);
- if (conn_fd < 0)
- {
- fprintf(stderr,"%s: Error accepting connection\n",
- program_name);
- exit(1);
- }
-
- /* read type and length of message */
-
- count = read(conn_fd,(char *)&msg,2*sizeof(GxidU32));
- if (count != 2*sizeof(GxidU32))
- {
- fprintf(stderr,"%s: Error reading message header\n",
- program_name);
- close(conn_fd);
- return;
- }
- type = ntohl(msg.any.type);
- length = ntohl(msg.any.length);
-
- /* read rest of message */
-
- if (length > sizeof(GxidMessage))
- {
- fprintf(stderr,"%s: Bad message length\n",
- program_name);
- close(conn_fd);
- return;
- }
-
- count = read(conn_fd,2*sizeof(GxidU32) + (char *)&msg,
- length - 2*sizeof(GxidU32));
- if (count != length - 2*sizeof(GxidU32))
- {
- fprintf(stderr,"%s: Error reading message body\n",
- program_name);
- close(conn_fd);
- return;
- }
-
- switch (type)
- {
- case GXID_CLAIM_DEVICE:
- retval = handle_claim_device((GxidClaimDevice *)&msg);
- break;
- case GXID_RELEASE_DEVICE:
- retval = handle_release_device((GxidReleaseDevice *)&msg);
- break;
- default:
- fprintf(stderr,"%s: Unknown message type: %ld (ignoring)\n",
- program_name,type);
- close(conn_fd);
- return;
- }
-
- count = write(conn_fd,&retval,sizeof(GxidI32));
- if (count != sizeof(GxidI32))
- {
- fprintf(stderr,"%s: Error writing return code\n",
- program_name);
- }
-
- close(conn_fd);
-}
-
-void
-handle_motion_notify(XDeviceMotionEvent *event)
-{
- int i,j;
- GxidDevice *old_device = NULL;
- GxidDevice *new_device = NULL;
- Window w, root, child;
- int root_x, root_y, x, y, mask;
-
- for (j=0;j<num_devices;j++)
- {
- if (devices[j]->ispointer)
- old_device = devices[j];
- if (devices[j]->id == event->deviceid)
- new_device = devices[j];
- }
-
- if (new_device && !new_device->exclusive && !new_device->ispointer)
- {
- /* make sure we aren't stealing the pointer back from a slow
- client */
- child = root_window;
- do
- {
- w = child;
- /* FIXME: this fails disasterously if child vanishes between
- calls. (Which is prone to happening since we get events
- on root just as the client exits) */
-
- XQueryPointer(dpy,w,&root,&child,&root_x,&root_y,
- &x,&y,&mask);
- }
- while (child != None);
-
- for (i=0;i<num_windows;i++)
- if (windows[i]->xwindow == w)
- for (j=0;j<windows[i]->num_devices;j++)
- if (windows[i]->devices[j] == new_device)
- return;
-
- /* FIXME: do something smarter with axes */
- XChangePointerDevice(dpy,new_device->xdevice, 0, 1);
- new_device->ispointer = 1;
-
- old_device->ispointer = 0;
- if (!old_device->xdevice)
- enable_device(old_device);
- }
-}
-
-void
-handle_change_notify(XChangeDeviceNotifyEvent *event)
-{
- int j;
- GxidDevice *old_device = NULL;
- GxidDevice *new_device = NULL;
-
-
- for (j=0;j<num_devices;j++)
- {
- if (devices[j]->ispointer)
- old_device = devices[j];
- if (devices[j]->id == event->deviceid)
- new_device = devices[j];
- }
-
-#ifdef DEBUG_EVENTS
- fprintf(stderr,"gxid: ChangeNotify event; old = %ld; new = %ld\n",
- old_device->id, new_device->id);
-#endif
-
- if (old_device != new_device)
- {
- new_device->ispointer = 1;
-
- old_device->ispointer = 0;
- if (!old_device->xdevice)
- enable_device(old_device);
- }
-}
-
-void
-handle_enter_notify(XEnterWindowEvent *event, GxidWindow *window)
-{
- int i;
- GxidDevice *old_pointer = NULL;
- for (i=0;i<num_devices;i++)
- {
- if (devices[i]->ispointer)
- {
- old_pointer = devices[i];
- break;
- }
- }
-
-#ifdef DEBUG_EVENTS
- fprintf(stderr,"gxid: Enter event; oldpointer = %ld\n",
- old_pointer->id);
-#endif
-
- if (old_pointer)
- for (i=0;i<window->num_devices;i++)
- {
- if (window->devices[i] == old_pointer)
- {
- switch_core_pointer();
- break;
- }
- }
-}
-
-void
-handle_destroy_notify(XDestroyWindowEvent *event)
-{
- int i,j;
-
- for (i=0;i<num_windows;i++)
- if (windows[i]->xwindow == event->window)
- {
- GxidWindow *w = windows[i];
-
- for (j=0;j<w->num_devices;j++)
- {
-#ifdef DEBUG_CLIENTS
- fprintf(stderr,"device %ld released on destruction of window 0x%lx.\n",
- w->devices[j]->id,w->xwindow);
-#endif
-
- if (w->devices[j]->exclusive)
- {
- w->devices[j]->exclusive = 0;
- enable_device(devices[j]);
- }
- }
-
- if (i<num_windows-1)
- windows[i] = windows[num_windows-1];
- num_windows--;
-
- if (w->devices)
- free((void *)w->devices);
- free((void *)w);
- /* FIXME: should we deselect input? But what
- what if window is already destroyed */
-
- return;
- }
-}
-
-void
-handle_xevent()
-{
- int i;
- XEvent event;
-
- XNextEvent (dpy, &event);
-
-#ifdef DEBUG_EVENTS
- fprintf(stderr,"Event - type = %d; window = 0x%lx\n",
- event.type,event.xany.window);
-#endif
-
- if (event.type == ConfigureNotify)
- {
-#ifdef DEBUG_EVENTS
- XConfigureEvent *xce = (XConfigureEvent *)&event;
- fprintf(stderr," configureNotify: window = 0x%lx\n",xce->window);
-#endif
- }
- else if (event.type == EnterNotify)
- {
- /* pointer entered a claimed window */
- for (i=0;i<num_windows;i++)
- {
- if (event.xany.window == windows[i]->xwindow)
- handle_enter_notify((XEnterWindowEvent *)&event,windows[i]);
- }
- }
- else if (event.type == DestroyNotify)
- {
- /* A claimed window was destroyed */
- for (i=0;i<num_windows;i++)
- {
- if (event.xany.window == windows[i]->xwindow)
- handle_destroy_notify((XDestroyWindowEvent *)&event);
- }
- }
- else
- for (i=0;i<num_devices;i++)
- {
- if (event.type == devices[i]->motionnotify_type)
- {
- handle_motion_notify((XDeviceMotionEvent *)&event);
- break;
- }
- else if (event.type == devices[i]->changenotify_type)
- {
- handle_change_notify((XChangeDeviceNotifyEvent *)&event);
- break;
- }
- }
-}
-
-void
-usage()
-{
- fprintf(stderr,"Usage: %s [-d display] [-p --gxid-port port]\n",
- program_name);
- exit(1);
-}
-
-int
-main(int argc, char **argv)
-{
- int i;
- char *display_name = NULL;
- fd_set readfds;
-
- program_name = argv[0];
-
- for (i=1;i<argc;i++)
- {
- if (!strcmp(argv[i],"-d"))
- {
- if (++i >= argc) usage();
- display_name = argv[i];
- }
- else if (!strcmp(argv[i],"--gxid-port") ||
- !strcmp(argv[i],"-p"))
- {
- if (++i >= argc) usage();
- port = atoi(argv[i]);
- break;
- }
- else
- usage();
- }
-
- if (!port)
- {
- char *t = getenv("GXID_PORT");
- if (t)
- port = atoi(t);
- else
- port = 6951;
- }
- /* set up a signal handler so we can clean up if killed */
-
- signal(SIGTERM,handler);
- signal(SIGINT,handler);
-
- /* initialize the X connection */
-
- dpy = XOpenDisplay (display_name);
- if (!dpy)
- {
- fprintf (stderr, "%s: unable to open display '%s'\n",
- program_name, XDisplayName (display_name));
- exit (1);
- }
-
- root_window = DefaultRootWindow(dpy);
-
- /* We'll want to do this in the future if we are to support
- gxid monitoring visibility information for clients */
-#if 0
- XSelectInput(dpy,root_window,SubstructureNotifyMask);
-#endif
- init_xinput();
-
- /* set up our server connection */
-
- init_socket();
-
- /* main loop */
-
- if (XPending(dpy)) /* this seems necessary to get things
- in sync */
- handle_xevent();
- while (1)
- {
-
- FD_ZERO(&readfds);
- FD_SET(ConnectionNumber(dpy),&readfds);
- FD_SET(socket_fd,&readfds);
-
- if (select(8*sizeof(readfds),&readfds,
- (fd_set *)0,(fd_set *)0, (struct timeval *)0) < 0)
- {
- fprintf(stderr,"Error in select\n");
- exit(1);
- }
-
- if (FD_ISSET(socket_fd,&readfds))
- handle_connection(socket_fd);
-
- while (XPending(dpy))
- handle_xevent();
- }
-
- XCloseDisplay (dpy);
- exit (0);
-}
diff --git a/gdk/x11/gxid_lib.c b/gdk/x11/gxid_lib.c
deleted file mode 100644
index 64c1e53b1f..0000000000
--- a/gdk/x11/gxid_lib.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * gxid version 0.3
- *
- * Copyright 1997 Owen Taylor <owt1@cornell.edu>
-*/
-
-#include "../config.h"
-#include "gxid_lib.h"
-
-#ifdef XINPUT_GXI
-
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-
-/* handles mechanics of communicating with a client */
-static int
-gxid_send_message(char *host, int port, GxidMessage *msg)
-{
- int socket_fd;
- struct sockaddr_in sin;
- int count;
- GxidI32 retval;
- struct hostent *he;
-
- if (!port) port = 6951;
-
- if (!host || strcmp(host,"localhost") )
- {
- /* looking it up as localhost can be _SLOW_ on ppp systems */
- /* FIXME: Could localhost be anything other than loopback? */
- host = "127.0.0.1";
- }
-
- he = gethostbyname(host);
- if (!he)
- {
- fprintf(stderr,"gxid_lib: error looking up %s\n",host);
- return GXID_RETURN_ERROR;
- }
-
- sin.sin_family = he->h_addrtype;
- sin.sin_port = htons(port);
- memcpy(&sin.sin_addr,he->h_addr_list[0],he->h_length);
-
- socket_fd = socket(AF_INET,SOCK_STREAM,0);
- if (socket_fd < 0)
- {
- fprintf(stderr,"gxid_lib: can't get socket");
- return GXID_RETURN_ERROR;
- }
-
- if (connect(socket_fd, (struct sockaddr *)&sin,
- sizeof sin) < 0)
- {
- fprintf(stderr,"gxid_lib: can't connect to %s:%d\n",host,port);
- close(socket_fd);
- return GXID_RETURN_ERROR;
- }
-
- count = write(socket_fd,(char *)msg,ntohl(msg->any.length));
- if (count != ntohl(msg->any.length))
- {
- fprintf(stderr,"gxid_lib: error writing");
- close(socket_fd);
- return GXID_RETURN_ERROR;
- }
-
- /* now read the return code */
- count = read(socket_fd,(char *)&retval,sizeof(GxidI32));
- if (count != sizeof(GxidI32))
- {
- fprintf(stderr,"gxid_lib: error reading return code");
- close(socket_fd);
- return GXID_RETURN_ERROR;
- }
-
- close (socket_fd);
- return ntohl(retval);
-}
-
-/* claim a device. If exclusive, device is claimed exclusively */
-int
-gxid_claim_device(char *host, int port, GxidU32 device, GxidU32 window,
- int exclusive)
-{
- GxidClaimDevice msg;
- msg.type = htonl(GXID_CLAIM_DEVICE);
- msg.length = htonl(sizeof(GxidClaimDevice));
- msg.device = htonl(device);
- msg.window = htonl(window);
- msg.exclusive = htonl(exclusive);
-
- return gxid_send_message(host,port,(GxidMessage *)&msg);
-}
-
-/* release a device/window pair */
-int
-gxid_release_device(char *host, int port, GxidU32 device, GxidU32 window)
-{
- GxidReleaseDevice msg;
- msg.type = htonl(GXID_RELEASE_DEVICE);
- msg.length = htonl(sizeof(GxidReleaseDevice));
- msg.device = htonl(device);
- msg.window = htonl(window);
-
- return gxid_send_message(host,port,(GxidMessage *)&msg);
-}
-
-#else /* !XINPUT_GXI */
-
-/* Some compilers don't like empty source files */
-int
-gxid_claim_device(char *host, int port, GxidU32 device, GxidU32 window,
- int exclusive)
-{
- return 0;
-}
-
-#endif /* XINPUT_GXI */
-
diff --git a/gdk/x11/gxid_lib.h b/gdk/x11/gxid_lib.h
deleted file mode 100644
index 6a7103bbe0..0000000000
--- a/gdk/x11/gxid_lib.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "gxid_proto.h"
-
-int gxid_claim_device(char *host, int port,
- GxidU32 device, GxidU32 window, int exclusive);
-int gxid_release_device(char *host, int port, GxidU32 device,
- GxidU32 window);
diff --git a/gdk/x11/gxid_proto.h b/gdk/x11/gxid_proto.h
deleted file mode 100644
index 24959b806c..0000000000
--- a/gdk/x11/gxid_proto.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#define GXID_CLAIM_DEVICE 1
-#define GXID_RELEASE_DEVICE 2
-
-#define GXID_RETURN_OK 0
-#define GXID_RETURN_ERROR -1
-
-typedef struct GxidClaimDevice_ GxidClaimDevice;
-typedef struct GxidReleaseDevice_ GxidReleaseDevice;
-typedef struct GxidMessageAny_ GxidMessageAny;
-typedef union GxidMessage_ GxidMessage;
-
-typedef unsigned long GxidU32;
-typedef long GxidI32;
-
-struct GxidClaimDevice_ {
- GxidU32 type;
- GxidU32 length;
- GxidU32 device;
- GxidU32 window;
- GxidU32 exclusive;
-};
-
-struct GxidReleaseDevice_ {
- GxidU32 type;
- GxidU32 length;
- GxidU32 device;
- GxidU32 window;
-};
-
-struct GxidMessageAny_ {
- GxidU32 type;
- GxidU32 length;
-};
-
-union GxidMessage_ {
- GxidMessageAny any;
- GxidClaimDevice claim;
- GxidReleaseDevice release;
-};
diff --git a/glib/.cvsignore b/glib/.cvsignore
deleted file mode 100644
index fb21b2098d..0000000000
--- a/glib/.cvsignore
+++ /dev/null
@@ -1,17 +0,0 @@
-*.lo
-Makefile
-Makefile.in
-configure
-aclocal.m4
-.deps
-_libs
-libglib.la
-config.log
-glibconfig.h
-glib.h
-libtool
-config.status
-stamp-h
-.libs
-testglib
-config.cache
diff --git a/glib/AUTHORS b/glib/AUTHORS
deleted file mode 100644
index 67f4e56178..0000000000
--- a/glib/AUTHORS
+++ /dev/null
@@ -1 +0,0 @@
-Peter Mattis (petm@xcf.berkeley.edu)
diff --git a/glib/COPYING b/glib/COPYING
deleted file mode 100644
index e69de29bb2..0000000000
--- a/glib/COPYING
+++ /dev/null
diff --git a/glib/ChangeLog b/glib/ChangeLog
deleted file mode 100644
index 5519af0c13..0000000000
--- a/glib/ChangeLog
+++ /dev/null
@@ -1,174 +0,0 @@
-Tue Mar 10 02:03:12 1998 Tim Janik <timj@gimp.org>
-
- * gscanner.c (g_scanner_destroy_symbol_table_entry): new function to
- free symbol table entries upon destruction
- (gtk-gronlund-980309-0.patch.gz).
-
-Mon Mar 9 15:02:21 1998 Tim Janik <timj@gimp.org>
-
- * glib.h: changed *_length functions to return guint.
- changed *_nth functions to take guint as argument.
-
- * glist.c: adapted g_list_length and g_list_length.
-
- * gslist.c: adapted g_slist_length and g_slist_length.
-
-Mon Mar 2 17:51:18 1998 Owen Taylor <owt1@cornell.edu>
-
- * glib.h gutils.c : changed g_strcasecmp
- to take gchar* not guchar*
-
- * testglib.c: Remove trailing ; after functions
-
-Sun Mar 1 19:04:40 1998 Owen Taylor <owt1@cornell.edu>
-
- * glib.h gstring.c: Added g_string_insert[_c]()
- and g_string_erase().
-
- From: Stefan Wille <1wille@vsys1.informatik.uni-hamburg.de>
-
-Mon Feb 16 23:05:06 1998 Owen Taylor <owt1@cornell.edu>
-
- * glist.c (g_list_insert_sorted): Changed function
- so elements are always inserted, even if they compare
- equal with another.
-
-Thu Feb 12 22:48:11 1998 Owen Taylor <owt1@cornell.edu>
-
- * gstring.c glib.h: removed deprecated g_string_equal
- and g_string_hash.
-
-Tue Feb 10 13:04:36 1998 Owen Taylor <owt1@cornell.edu>
-
- * configure.in: Add check to see if the C library's
- iswalnum can actually be used. (Not true for
- Linux libc-5.4.38)
-
-Sat Feb 7 11:48:09 1998 Owen Taylor <owt1@cornell.edu>
-
- * gstring.c gutils.c: added some additional consts in
- appropriate places to remove a warning
-
-Sat Feb 7 11:15:54 1998 Owen Taylor <owt1@cornell.edu>
-
- * gutils.c: include <ctype.h> for tolower()
-
-Fri Jan 30 23:57:17 PST 1998 Manish Singh <yosh@gimp.org>
-
- * added and autoconfigured in a new utility function
- g_strcasecmp
-
-Wed Jan 28 23:53:27 PST 1998 Manish Singh <yosh@gimp.org>
-
- * glist.c
- * gslist.c
- * testglib.c: the sort functions compared backwards. Fixed
- * glib.h: list iterator macros now check for NULL pointers
-
-Tue Jan 27 09:46:57 PST 1998 Manish Singh <yosh@gimp.org>
-
- * gstring.c: g_string_prepend and g_string_prepend_c had
- interchanged src and dest parameters for g_memmove. Fixed.
-
-Tue Jan 27 01:38:52 PST 1998 Manish Singh <yosh@gimp.org>
-
- * gslist.c: fixed a really, really lame error. g_slist_insert
- didn't hook the data in! Reworked the routine to reflect the
- functionality of g_list
-
-Wed Jan 21 01:13:25 1998 Tim Janik <timj@psynet.net>
-
- * Applied patch from (Raja R Harinath <harinath@cs.umn.edu>)
- to add function g_snprintf.
- * configure.in (AC_CHECK_FUNCS): Check for vsnprintf.
- * glib.h: Add prototype for g_snprintf.
- * glibconfig.h.in: Add HAVE_VSNPRINTF.
- * gutils.c (g_snprintf): new function.
-
-Sat Jan 17 23:52:40 1998 Owen Taylor <owt1@cornell.edu>
-
- * gstring.{c,h} gscanner.c:
- renamed g_string_equal => g_str_equal
- renamed g_string_hash => g_str_hash
- And const corrected. Old functions left in for now.
-
-Fri Jan 9 20:03:46 1998 Tim Janik <timj@psynet.net>
-
- * gutils.c (g_strerror): changed message for EAGAIN from
- "no more processes" to "try again" since EAGAIN is used with
- functions else than fork().
-
- * gscanner.c (g_scanner_get_token_ll): use strtol() instead of
- strtoul() to avoid conflicts with solaris.
-
- * merged the glib portions from Jan 2 to Jan 7 out of gtk+/ChangeLog
- into this file.
-
-Wed Jan 7 02:14:30 PST 1998 Manish Singh <yosh@gimp.org>
-
- * glib.h:
- * glist.c:
- * gslist.c:
- * testglib.c: Added g_[s]list_insert_sorted function
- and appropriate tests in testglib
-
-Sat Jan 3 20:23:25 1998 Owen Taylor <owt1@cornell.edu>
-
- * glib.h: Changed guint32 -> guint for bitfields.
- (Bitfields must be int or unsigned int?)
-
-Fri Jan 2 23:52 PST 1998 Jay Painter <jpaint@serv.net>
-
- * glib_pre1.h:
- * glib_pre2.h:
- * glib.h: reverted glibconfig.h and glib.h files back to the
- way they were before my ugly hack.
-
- * gscanner.c: removed inlines from clist and gscanner
-
-Tue Dec 23 02:49:51 1997 Tim Janik <timj@psynet.net>
-
- * gscanner.c: new file for GScanner: Flexible lexical scanner for
- general purpose.
- * glib_pre2.h: added GScanner includes. added g_strconcat and g_strtod.
- gutils.c (g_strconcat): new function for string concatenation of NULL
- terminated parameter list.
- (g_strtod): new function to perform best string to double conversion
- with or without consideration of the current locale.
-
-Mon Dec 15 19:33:58 1997 Tim Janik <timj@psynet.net>
-
- * glist.c: minor optimizations:
- (g_list_append): `if' optimized for common code path, commented out
- unneccessary `assert', saved one variable assignment.
- (g_list_prepend): saved two (conditioned) variable assignment.
- (g_list_insert): saved one (conditioned) variable assignment,
- saved one variable assignment.
- (g_list_remove): `if' optimized for common code path, saved two
- variable assignments by using `g_list_free_1' (which is even
- faster) instead of `g_list_free'.
- (g_list_reverse): saved allocation of one variable, saved one
- variable assignment.
-
-Wed Dec 10 23:27:20 1997 Tim Janik <timj@psynet.net>
-
- * glib_pre1.h:
- * glib_pre2.h:
- * glib.h: this file now gets concatenated by makeglib_h from
- glib_pre1.h and glib_pre2.h to merge in glibconfig.h wich got
- created by configure (done by Jay Painter).
-
- * glib_pre2.h: the g_assert*() and g_return_*_fail() macros
- are wrapped by G_STMT_START and G_STMT_END now, to avoid conflicts
- when used within if (...) g_macro(); else ... conditionals.
-
-Tue Dec 17 13:14:07 1996 Peter Mattis <pmattis@charnley.HIP.Berkeley.EDU>
-
- * glib.h: Changed 'g_return_if_fail' and 'g_return_val_if_fail' to
- not call 'g_string' but to simply stringify the
- expression. Calling 'g_string' causes the expression to be
- expanded which is undesired.
-
-Sun Dec 1 01:30:48 1996 Peter Mattis <pmattis@charnley.HIP.Berkeley.EDU>
-
- * Started ChangeLog
diff --git a/glib/INSTALL b/glib/INSTALL
deleted file mode 100644
index e69de29bb2..0000000000
--- a/glib/INSTALL
+++ /dev/null
diff --git a/glib/Makefile.am b/glib/Makefile.am
deleted file mode 100644
index 4119b7efa4..0000000000
--- a/glib/Makefile.am
+++ /dev/null
@@ -1,39 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-lib_LTLIBRARIES = libglib.la
-
-libglib_la_SOURCES = \
- garray.c \
- gcache.c \
- gerror.c \
- ghash.c \
- glist.c \
- gmem.c \
- gprimes.c \
- gslist.c \
- gtimer.c \
- gtree.c \
- gstring.c \
- gscanner.c \
- gutils.c
-
-include_HEADERS = \
- glib.h \
- glibconfig.h
-
-libglib_la_LDFLAGS = -version-info 1:0:0
-
-INCLUDES = -I$(top_srcdir)
-
-noinst_PROGRAMS = testglib
-testglib_LDADD = $(top_builddir)/libglib.la
-
-.PHONY: files release
-
-files:
- @files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
- echo $$p; \
- done
-
-release:
- $(MAKE) dist distdir=$(PACKAGE)`date +"%y%m%d"`
diff --git a/glib/NEWS b/glib/NEWS
deleted file mode 100644
index e69de29bb2..0000000000
--- a/glib/NEWS
+++ /dev/null
diff --git a/glib/README b/glib/README
deleted file mode 100644
index e69de29bb2..0000000000
--- a/glib/README
+++ /dev/null
diff --git a/glib/acconfig.h b/glib/acconfig.h
deleted file mode 100644
index 86edcee2a8..0000000000
--- a/glib/acconfig.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* GLIB - Library of useful routines for C programming
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-/* acconfig.h
- This file is in the public domain.
-
- Descriptive text for the C preprocessor macros that
- the distributed Autoconf macros can define.
- No software package will use all of them; autoheader copies the ones
- your configure.in uses into your configuration header file templates.
-
- The entries are in sort -df order: alphabetical, case insensitive,
- ignoring punctuation (such as underscores). Although this order
- can split up related entries, it makes it easier to check whether
- a given entry is in the file.
-
- Leave the following blank line there!! Autoheader needs it. */
-
-
-/* Other stuff */
-#undef G_COMPILED_WITH_DEBUGGING
-#undef HAVE_BROKEN_WCTYPE
-#undef HAVE_DOPRNT
-#undef HAVE_FLOAT_H
-#undef HAVE_LIMITS_H
-#undef HAVE_LONG_DOUBLE
-#undef HAVE_SYS_SELECT_H
-#undef HAVE_STRERROR
-#undef HAVE_STRSIGNAL
-#undef HAVE_VSNPRINTF
-#undef HAVE_VALUES_H
-#undef HAVE_VPRINTF
-#undef HAVE_WCHAR_H
-#undef HAVE_WCTYPE_H
-
-#undef NO_FD_SET
-#undef NO_SYS_ERRLIST
-#undef NO_SYS_SIGLIST
-
-#undef SIZEOF_CHAR
-#undef SIZEOF_SHORT
-#undef SIZEOF_LONG
-#undef SIZEOF_INT
-#undef SIZEOF_VOID_P
-
-
-/* #undef PACKAGE */
-/* #undef VERSION */
-
-
-/* Leave that blank line there!! Autoheader needs it.
- If you're adding to this file, keep in mind:
- The entries are in sort -df order: alphabetical, case insensitive,
- ignoring punctuation (such as underscores). */
diff --git a/glib/config.guess b/glib/config.guess
deleted file mode 100755
index 413ed41c0f..0000000000
--- a/glib/config.guess
+++ /dev/null
@@ -1,883 +0,0 @@
-#! /bin/sh
-# Attempt to guess a canonical system name.
-# Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
-#
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# Written by Per Bothner <bothner@cygnus.com>.
-# The master version of this file is at the FSF in /home/gd/gnu/lib.
-#
-# This script attempts to guess a canonical system name similar to
-# config.sub. If it succeeds, it prints the system name on stdout, and
-# exits with 0. Otherwise, it exits with 1.
-#
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit system type (host/target name).
-#
-# Only a few systems have been added to this list; please add others
-# (but try to keep the structure clean).
-#
-
-# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 8/24/94.)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
- PATH=$PATH:/.attbin ; export PATH
-fi
-
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-
-trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
-
-# Note: order is significant - the case branches are not exclusive.
-
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
- alpha:OSF1:*:*)
- if test $UNAME_RELEASE = "V4.0"; then
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
- fi
- # A Vn.n version is a released version.
- # A Tn.n version is a released field test version.
- # A Xn.n version is an unreleased experimental baselevel.
- # 1.2 uses "1.2" for uname -r.
- cat <<EOF >dummy.s
- .globl main
- .ent main
-main:
- .frame \$30,0,\$26,0
- .prologue 0
- .long 0x47e03d80 # implver $0
- lda \$2,259
- .long 0x47e20c21 # amask $2,$1
- srl \$1,8,\$2
- sll \$2,2,\$2
- sll \$0,3,\$0
- addl \$1,\$0,\$0
- addl \$2,\$0,\$0
- ret \$31,(\$26),1
- .end main
-EOF
- ${CC-cc} dummy.s -o dummy 2>/dev/null
- if test "$?" = 0 ; then
- ./dummy
- case "$?" in
- 7)
- UNAME_MACHINE="alpha"
- ;;
- 15)
- UNAME_MACHINE="alphaev5"
- ;;
- 14)
- UNAME_MACHINE="alphaev56"
- ;;
- 10)
- UNAME_MACHINE="alphapca56"
- ;;
- 16)
- UNAME_MACHINE="alphaev6"
- ;;
- esac
- fi
- rm -f dummy.s dummy
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]`
- exit 0 ;;
- 21064:Windows_NT:50:3)
- echo alpha-dec-winnt3.5
- exit 0 ;;
- Amiga*:UNIX_System_V:4.0:*)
- echo m68k-cbm-sysv4
- exit 0;;
- amiga:NetBSD:*:*)
- echo m68k-cbm-netbsd${UNAME_RELEASE}
- exit 0 ;;
- amiga:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- arc64:OpenBSD:*:*)
- echo mips64el-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- arc:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- hkmips:OpenBSD:*:*)
- echo mips-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- pmax:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- sgi:OpenBSD:*:*)
- echo mips-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- wgrisc:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
- echo arm-acorn-riscix${UNAME_RELEASE}
- exit 0;;
- arm32:NetBSD:*:*)
- echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- exit 0 ;;
- SR2?01:HI-UX/MPP:*:*)
- echo hppa1.1-hitachi-hiuxmpp
- exit 0;;
- Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
- # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
- if test "`(/bin/universe) 2>/dev/null`" = att ; then
- echo pyramid-pyramid-sysv3
- else
- echo pyramid-pyramid-bsd
- fi
- exit 0 ;;
- NILE:*:*:dcosx)
- echo pyramid-pyramid-svr4
- exit 0 ;;
- sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
- echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- i86pc:SunOS:5.*:*)
- echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- sun4*:SunOS:6*:*)
- # According to config.sub, this is the proper way to canonicalize
- # SunOS6. Hard to guess exactly what SunOS6 will be like, but
- # it's likely to be more like Solaris than SunOS4.
- echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- sun4*:SunOS:*:*)
- case "`/usr/bin/arch -k`" in
- Series*|S4*)
- UNAME_RELEASE=`uname -v`
- ;;
- esac
- # Japanese Language versions have a version number like `4.1.3-JL'.
- echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
- exit 0 ;;
- sun3*:SunOS:*:*)
- echo m68k-sun-sunos${UNAME_RELEASE}
- exit 0 ;;
- sun*:*:4.2BSD:*)
- UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
- test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
- case "`/bin/arch`" in
- sun3)
- echo m68k-sun-sunos${UNAME_RELEASE}
- ;;
- sun4)
- echo sparc-sun-sunos${UNAME_RELEASE}
- ;;
- esac
- exit 0 ;;
- aushp:SunOS:*:*)
- echo sparc-auspex-sunos${UNAME_RELEASE}
- exit 0 ;;
- atari*:NetBSD:*:*)
- echo m68k-atari-netbsd${UNAME_RELEASE}
- exit 0 ;;
- atari*:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- sun3*:NetBSD:*:*)
- echo m68k-sun-netbsd${UNAME_RELEASE}
- exit 0 ;;
- sun3*:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mac68k:NetBSD:*:*)
- echo m68k-apple-netbsd${UNAME_RELEASE}
- exit 0 ;;
- mac68k:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvme68k:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvme88k:OpenBSD:*:*)
- echo m88k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- powerpc:machten:*:*)
- echo powerpc-apple-machten${UNAME_RELEASE}
- exit 0 ;;
- RISC*:Mach:*:*)
- echo mips-dec-mach_bsd4.3
- exit 0 ;;
- RISC*:ULTRIX:*:*)
- echo mips-dec-ultrix${UNAME_RELEASE}
- exit 0 ;;
- VAX*:ULTRIX*:*:*)
- echo vax-dec-ultrix${UNAME_RELEASE}
- exit 0 ;;
- 2020:CLIX:*:*)
- echo clipper-intergraph-clix${UNAME_RELEASE}
- exit 0 ;;
- mips:*:*:UMIPS | mips:*:*:RISCos)
- sed 's/^ //' << EOF >dummy.c
- int main (argc, argv) int argc; char **argv; {
- #if defined (host_mips) && defined (MIPSEB)
- #if defined (SYSTYPE_SYSV)
- printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_SVR4)
- printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
- printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
- #endif
- #endif
- exit (-1);
- }
-EOF
- ${CC-cc} dummy.c -o dummy \
- && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
- && rm dummy.c dummy && exit 0
- rm -f dummy.c dummy
- echo mips-mips-riscos${UNAME_RELEASE}
- exit 0 ;;
- Night_Hawk:Power_UNIX:*:*)
- echo powerpc-harris-powerunix
- exit 0 ;;
- m88k:CX/UX:7*:*)
- echo m88k-harris-cxux7
- exit 0 ;;
- m88k:*:4*:R4*)
- echo m88k-motorola-sysv4
- exit 0 ;;
- m88k:*:3*:R3*)
- echo m88k-motorola-sysv3
- exit 0 ;;
- AViiON:dgux:*:*)
- # DG/UX returns AViiON for all architectures
- UNAME_PROCESSOR=`/usr/bin/uname -p`
- if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
- if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
- -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
- echo m88k-dg-dgux${UNAME_RELEASE}
- else
- echo m88k-dg-dguxbcs${UNAME_RELEASE}
- fi
- else echo i586-dg-dgux${UNAME_RELEASE}
- fi
- exit 0 ;;
- M88*:DolphinOS:*:*) # DolphinOS (SVR3)
- echo m88k-dolphin-sysv3
- exit 0 ;;
- M88*:*:R3*:*)
- # Delta 88k system running SVR3
- echo m88k-motorola-sysv3
- exit 0 ;;
- XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
- echo m88k-tektronix-sysv3
- exit 0 ;;
- Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
- echo m68k-tektronix-bsd
- exit 0 ;;
- *:IRIX*:*:*)
- echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
- exit 0 ;;
- ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
- exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
- i?86:AIX:*:*)
- echo i386-ibm-aix
- exit 0 ;;
- *:AIX:2:3)
- if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
- sed 's/^ //' << EOF >dummy.c
- #include <sys/systemcfg.h>
-
- main()
- {
- if (!__power_pc())
- exit(1);
- puts("powerpc-ibm-aix3.2.5");
- exit(0);
- }
-EOF
- ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
- rm -f dummy.c dummy
- echo rs6000-ibm-aix3.2.5
- elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
- echo rs6000-ibm-aix3.2.4
- else
- echo rs6000-ibm-aix3.2
- fi
- exit 0 ;;
- *:AIX:*:4)
- if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
- IBM_ARCH=rs6000
- else
- IBM_ARCH=powerpc
- fi
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=4.${UNAME_RELEASE}
- fi
- echo ${IBM_ARCH}-ibm-aix${IBM_REV}
- exit 0 ;;
- *:AIX:*:*)
- echo rs6000-ibm-aix
- exit 0 ;;
- ibmrt:4.4BSD:*|romp-ibm:BSD:*)
- echo romp-ibm-bsd4.4
- exit 0 ;;
- ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
- echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
- exit 0 ;; # report: romp-ibm BSD 4.3
- *:BOSX:*:*)
- echo rs6000-bull-bosx
- exit 0 ;;
- DPX/2?00:B.O.S.:*:*)
- echo m68k-bull-sysv3
- exit 0 ;;
- 9000/[34]??:4.3bsd:1.*:*)
- echo m68k-hp-bsd
- exit 0 ;;
- hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
- echo m68k-hp-bsd4.4
- exit 0 ;;
- 9000/[3478]??:HP-UX:*:*)
- case "${UNAME_MACHINE}" in
- 9000/31? ) HP_ARCH=m68000 ;;
- 9000/[34]?? ) HP_ARCH=m68k ;;
- 9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;;
- 9000/8?? ) HP_ARCH=hppa1.0 ;;
- esac
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- echo ${HP_ARCH}-hp-hpux${HPUX_REV}
- exit 0 ;;
- 3050*:HI-UX:*:*)
- sed 's/^ //' << EOF >dummy.c
- #include <unistd.h>
- int
- main ()
- {
- long cpu = sysconf (_SC_CPU_VERSION);
- /* The order matters, because CPU_IS_HP_MC68K erroneously returns
- true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
- results, however. */
- if (CPU_IS_PA_RISC (cpu))
- {
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
- default: puts ("hppa-hitachi-hiuxwe2"); break;
- }
- }
- else if (CPU_IS_HP_MC68K (cpu))
- puts ("m68k-hitachi-hiuxwe2");
- else puts ("unknown-hitachi-hiuxwe2");
- exit (0);
- }
-EOF
- ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
- rm -f dummy.c dummy
- echo unknown-hitachi-hiuxwe2
- exit 0 ;;
- 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
- echo hppa1.1-hp-bsd
- exit 0 ;;
- 9000/8??:4.3bsd:*:*)
- echo hppa1.0-hp-bsd
- exit 0 ;;
- hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
- echo hppa1.1-hp-osf
- exit 0 ;;
- hp8??:OSF1:*:*)
- echo hppa1.0-hp-osf
- exit 0 ;;
- i?86:OSF1:*:*)
- if [ -x /usr/sbin/sysversion ] ; then
- echo ${UNAME_MACHINE}-unknown-osf1mk
- else
- echo ${UNAME_MACHINE}-unknown-osf1
- fi
- exit 0 ;;
- parisc*:Lites*:*:*)
- echo hppa1.1-hp-lites
- exit 0 ;;
- C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
- echo c1-convex-bsd
- exit 0 ;;
- C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit 0 ;;
- C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
- echo c34-convex-bsd
- exit 0 ;;
- C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
- echo c38-convex-bsd
- exit 0 ;;
- C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
- echo c4-convex-bsd
- exit 0 ;;
- CRAY*X-MP:*:*:*)
- echo xmp-cray-unicos
- exit 0 ;;
- CRAY*Y-MP:*:*:*)
- echo ymp-cray-unicos${UNAME_RELEASE}
- exit 0 ;;
- CRAY*[A-Z]90:*:*:*)
- echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
- | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
- -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
- exit 0 ;;
- CRAY*TS:*:*:*)
- echo t90-cray-unicos${UNAME_RELEASE}
- exit 0 ;;
- CRAY-2:*:*:*)
- echo cray2-cray-unicos
- exit 0 ;;
- F300:UNIX_System_V:*:*)
- FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
- echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit 0 ;;
- F301:UNIX_System_V:*:*)
- echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
- exit 0 ;;
- hp3[0-9][05]:NetBSD:*:*)
- echo m68k-hp-netbsd${UNAME_RELEASE}
- exit 0 ;;
- hp300:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- i?86:BSD/386:*:* | *:BSD/OS:*:*)
- echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
- exit 0 ;;
- *:FreeBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
- exit 0 ;;
- *:NetBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- exit 0 ;;
- *:OpenBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- exit 0 ;;
- i*:CYGWIN*:*)
- echo i386-pc-cygwin32
- exit 0 ;;
- i*:MINGW*:*)
- echo i386-pc-mingw32
- exit 0 ;;
- p*:CYGWIN*:*)
- echo powerpcle-unknown-cygwin32
- exit 0 ;;
- prep*:SunOS:5.*:*)
- echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- *:GNU:*:*)
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
- exit 0 ;;
- *:Linux:*:*)
- # The BFD linker knows what the default object file format is, so
- # first see if it will tell us.
- ld_help_string=`ld --help 2>&1`
- ld_supported_emulations=`echo $ld_help_string \
- | sed -ne '/supported emulations:/!d
- s/[ ][ ]*/ /g
- s/.*supported emulations: *//
- s/ .*//
- p'`
- case "$ld_supported_emulations" in
- i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;;
- i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;;
- sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
- m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
- elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;;
- esac
-
- if test "${UNAME_MACHINE}" = "alpha" ; then
- sed 's/^ //' <<EOF >dummy.s
- .globl main
- .ent main
- main:
- .frame \$30,0,\$26,0
- .prologue 0
- .long 0x47e03d80 # implver $0
- lda \$2,259
- .long 0x47e20c21 # amask $2,$1
- srl \$1,8,\$2
- sll \$2,2,\$2
- sll \$0,3,\$0
- addl \$1,\$0,\$0
- addl \$2,\$0,\$0
- ret \$31,(\$26),1
- .end main
-EOF
- LIBC=""
- ${CC-cc} dummy.s -o dummy 2>/dev/null
- if test "$?" = 0 ; then
- ./dummy
- case "$?" in
- 7)
- UNAME_MACHINE="alpha"
- ;;
- 15)
- UNAME_MACHINE="alphaev5"
- ;;
- 14)
- UNAME_MACHINE="alphaev56"
- ;;
- 10)
- UNAME_MACHINE="alphapca56"
- ;;
- 16)
- UNAME_MACHINE="alphaev6"
- ;;
- esac
-
- objdump --private-headers dummy | \
- grep ld.so.1 > /dev/null
- if test "$?" = 0 ; then
- LIBC="libc1"
- fi
- fi
- rm -f dummy.s dummy
- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
- elif test "${UNAME_MACHINE}" = "mips" ; then
- cat >dummy.c <<EOF
-main(argc, argv)
- int argc;
- char *argv[];
-{
-#ifdef __MIPSEB__
- printf ("%s-unknown-linux-gnu\n", argv[1]);
-#endif
-#ifdef __MIPSEL__
- printf ("%sel-unknown-linux-gnu\n", argv[1]);
-#endif
- return 0;
-}
-EOF
- ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
- rm -f dummy.c dummy
- else
- # Either a pre-BFD a.out linker (linux-gnuoldld)
- # or one that does not give us useful --help.
- # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
- # If ld does not provide *any* "supported emulations:"
- # that means it is gnuoldld.
- echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
- test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
-
- case "${UNAME_MACHINE}" in
- i?86)
- VENDOR=pc;
- ;;
- *)
- VENDOR=unknown;
- ;;
- esac
- # Determine whether the default compiler is a.out or elf
- cat >dummy.c <<EOF
-#include <features.h>
-main(argc, argv)
- int argc;
- char *argv[];
-{
-#ifdef __ELF__
-# ifdef __GLIBC__
-# if __GLIBC__ >= 2
- printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
-# else
- printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
-# endif
-# else
- printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
-# endif
-#else
- printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
-#endif
- return 0;
-}
-EOF
- ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
- rm -f dummy.c dummy
- fi ;;
-# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
-# are messed up and put the nodename in both sysname and nodename.
- i?86:DYNIX/ptx:4*:*)
- echo i386-sequent-sysv4
- exit 0 ;;
- i?86:UNIX_SV:4.2MP:2.*)
- # Unixware is an offshoot of SVR4, but it has its own version
- # number series starting with 2...
- # I am not positive that other SVR4 systems won't match this,
- # I just have to hope. -- rms.
- # Use sysv4.2uw... so that sysv4* matches it.
- echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
- exit 0 ;;
- i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
- if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
- echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
- else
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
- fi
- exit 0 ;;
- i?86:*:3.2:*)
- if test -f /usr/options/cb.name; then
- UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
- echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
- elif /bin/uname -X 2>/dev/null >/dev/null ; then
- UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
- (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
- (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
- && UNAME_MACHINE=i586
- echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
- else
- echo ${UNAME_MACHINE}-pc-sysv32
- fi
- exit 0 ;;
- pc:*:*:*)
- # uname -m prints for DJGPP always 'pc', but it prints nothing about
- # the processor, so we play safe by assuming i386.
- echo i386-pc-msdosdjgpp
- exit 0 ;;
- Intel:Mach:3*:*)
- echo i386-pc-mach3
- exit 0 ;;
- paragon:*:*:*)
- echo i860-intel-osf1
- exit 0 ;;
- i860:*:4.*:*) # i860-SVR4
- if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
- echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
- else # Add other i860-SVR4 vendors below as they are discovered.
- echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
- fi
- exit 0 ;;
- mini*:CTIX:SYS*5:*)
- # "miniframe"
- echo m68010-convergent-sysv
- exit 0 ;;
- M68*:*:R3V[567]*:*)
- test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
- 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
- OS_REL=''
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && echo i486-ncr-sysv4.3${OS_REL} && exit 0
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
- 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && echo i486-ncr-sysv4 && exit 0 ;;
- m68*:LynxOS:2.*:*)
- echo m68k-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
- mc68030:UNIX_System_V:4.*:*)
- echo m68k-atari-sysv4
- exit 0 ;;
- i?86:LynxOS:2.*:*)
- echo i386-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
- TSUNAMI:LynxOS:2.*:*)
- echo sparc-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
- rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
- echo rs6000-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
- SM[BE]S:UNIX_SV:*:*)
- echo mips-dde-sysv${UNAME_RELEASE}
- exit 0 ;;
- RM*:SINIX-*:*:*)
- echo mips-sni-sysv4
- exit 0 ;;
- *:SINIX-*:*:*)
- if uname -p 2>/dev/null >/dev/null ; then
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- echo ${UNAME_MACHINE}-sni-sysv4
- else
- echo ns32k-sni-sysv
- fi
- exit 0 ;;
- PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit 0 ;;
- *:UNIX_System_V:4*:FTX*)
- # From Gerald Hewes <hewes@openmarket.com>.
- # How about differentiating between stratus architectures? -djm
- echo hppa1.1-stratus-sysv4
- exit 0 ;;
- *:*:*:FTX*)
- # From seanf@swdc.stratus.com.
- echo i860-stratus-sysv4
- exit 0 ;;
- mc68*:A/UX:*:*)
- echo m68k-apple-aux${UNAME_RELEASE}
- exit 0 ;;
- news*:NEWS-OS:*:6*)
- echo mips-sony-newsos6
- exit 0 ;;
- R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
- if [ -d /usr/nec ]; then
- echo mips-nec-sysv${UNAME_RELEASE}
- else
- echo mips-unknown-sysv${UNAME_RELEASE}
- fi
- exit 0 ;;
-esac
-
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
-cat >dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
- /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
- I don't know.... */
- printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
- printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
- "4"
-#else
- ""
-#endif
- ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
- printf ("arm-acorn-riscix"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
- printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
- int version;
- version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
- printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
- exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
- printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
- printf ("ns32k-encore-mach\n"); exit (0);
-#else
- printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
- printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
- printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
- printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
- struct utsname un;
-
- uname(&un);
-
- if (strncmp(un.version, "V2", 2) == 0) {
- printf ("i386-sequent-ptx2\n"); exit (0);
- }
- if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
- printf ("i386-sequent-ptx1\n"); exit (0);
- }
- printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-#if !defined (ultrix)
- printf ("vax-dec-bsd\n"); exit (0);
-#else
- printf ("vax-dec-ultrix\n"); exit (0);
-#endif
-#endif
-
-#if defined (alliant) && defined (i860)
- printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
- exit (1);
-}
-EOF
-
-${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
-rm -f dummy.c dummy
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
- case `getsysinfo -f cpu_type` in
- c1*)
- echo c1-convex-bsd
- exit 0 ;;
- c2*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit 0 ;;
- c34*)
- echo c34-convex-bsd
- exit 0 ;;
- c38*)
- echo c38-convex-bsd
- exit 0 ;;
- c4*)
- echo c4-convex-bsd
- exit 0 ;;
- esac
-fi
-
-#echo '(Unable to guess system type)' 1>&2
-
-exit 1
diff --git a/glib/config.sub b/glib/config.sub
deleted file mode 100755
index 213a6d47d6..0000000000
--- a/glib/config.sub
+++ /dev/null
@@ -1,954 +0,0 @@
-#! /bin/sh
-# Configuration validation subroutine script, version 1.1.
-# Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine. It does not imply ALL GNU software can.
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# Configuration subroutine to validate and canonicalize a configuration type.
-# Supply the specified configuration type as an argument.
-# If it is invalid, we print an error message on stderr and exit with code 1.
-# Otherwise, we print the canonical config type on stdout and succeed.
-
-# This file is supposed to be the same for all GNU packages
-# and recognize all the CPU types, system types and aliases
-# that are meaningful with *any* GNU software.
-# Each package is responsible for reporting which valid configurations
-# it does not support. The user should be able to distinguish
-# a failure to support a valid configuration from a meaningless
-# configuration.
-
-# The goal of this file is to map all the various variations of a given
-# machine specification into a single specification in the form:
-# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or in some cases, the newer four-part form:
-# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# It is wrong to echo any other type of specification.
-
-if [ x$1 = x ]
-then
- echo Configuration name missing. 1>&2
- echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
- echo "or $0 ALIAS" 1>&2
- echo where ALIAS is a recognized configuration type. 1>&2
- exit 1
-fi
-
-# First pass through any local machine types.
-case $1 in
- *local*)
- echo $1
- exit 0
- ;;
- *)
- ;;
-esac
-
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
-case $maybe_os in
- linux-gnu*)
- os=-$maybe_os
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
- ;;
- *)
- basic_machine=`echo $1 | sed 's/-[^-]*$//'`
- if [ $basic_machine != $1 ]
- then os=`echo $1 | sed 's/.*-/-/'`
- else os=; fi
- ;;
-esac
-
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work. We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
- -sun*os*)
- # Prevent following clause from handling this invalid input.
- ;;
- -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
- -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
- -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
- -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
- -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
- -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple)
- os=
- basic_machine=$1
- ;;
- -hiux*)
- os=-hiuxwe2
- ;;
- -sco5)
- os=sco3.2v5
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco4)
- os=-sco3.2v4
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2.[4-9]*)
- os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2v[4-9]*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco*)
- os=-sco3.2v2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -isc)
- os=-isc2.2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -clix*)
- basic_machine=clipper-intergraph
- ;;
- -isc*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -lynx*)
- os=-lynxos
- ;;
- -ptx*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
- ;;
- -windowsnt*)
- os=`echo $os | sed -e 's/windowsnt/winnt/'`
- ;;
- -psos*)
- os=-psos
- ;;
-esac
-
-# Decode aliases for certain CPU-COMPANY combinations.
-case $basic_machine in
- # Recognize the basic CPU types without company name.
- # Some are omitted here because they have special meanings below.
- tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
- | arme[lb] | pyramid | mn10200 | mn10300 \
- | tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
- | alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \
- | i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \
- | mips64 | mipsel | mips64el | mips64orion | mips64orionel \
- | mipstx39 | mipstx39el \
- | sparc | sparclet | sparclite | sparc64 | v850)
- basic_machine=$basic_machine-unknown
- ;;
- # We use `pc' rather than `unknown'
- # because (1) that's what they normally are, and
- # (2) the word "unknown" tends to confuse beginning users.
- i[3456]86)
- basic_machine=$basic_machine-pc
- ;;
- # Object if more than one company name word.
- *-*-*)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
- # Recognize the basic CPU types with company name.
- vax-* | tahoe-* | i[3456]86-* | i860-* | m32r-* | m68k-* | m68000-* \
- | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
- | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
- | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
- | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* \
- | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \
- | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \
- | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
- | sparc64-* | mips64-* | mipsel-* \
- | mips64el-* | mips64orion-* | mips64orionel-* \
- | mipstx39-* | mipstx39el-* \
- | f301-*)
- ;;
- # Recognize the various machine names and aliases which stand
- # for a CPU type and a company and sometimes even an OS.
- 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
- basic_machine=m68000-att
- ;;
- 3b*)
- basic_machine=we32k-att
- ;;
- alliant | fx80)
- basic_machine=fx80-alliant
- ;;
- altos | altos3068)
- basic_machine=m68k-altos
- ;;
- am29k)
- basic_machine=a29k-none
- os=-bsd
- ;;
- amdahl)
- basic_machine=580-amdahl
- os=-sysv
- ;;
- amiga | amiga-*)
- basic_machine=m68k-cbm
- ;;
- amigaos | amigados)
- basic_machine=m68k-cbm
- os=-amigaos
- ;;
- amigaunix | amix)
- basic_machine=m68k-cbm
- os=-sysv4
- ;;
- apollo68)
- basic_machine=m68k-apollo
- os=-sysv
- ;;
- aux)
- basic_machine=m68k-apple
- os=-aux
- ;;
- balance)
- basic_machine=ns32k-sequent
- os=-dynix
- ;;
- convex-c1)
- basic_machine=c1-convex
- os=-bsd
- ;;
- convex-c2)
- basic_machine=c2-convex
- os=-bsd
- ;;
- convex-c32)
- basic_machine=c32-convex
- os=-bsd
- ;;
- convex-c34)
- basic_machine=c34-convex
- os=-bsd
- ;;
- convex-c38)
- basic_machine=c38-convex
- os=-bsd
- ;;
- cray | ymp)
- basic_machine=ymp-cray
- os=-unicos
- ;;
- cray2)
- basic_machine=cray2-cray
- os=-unicos
- ;;
- [ctj]90-cray)
- basic_machine=c90-cray
- os=-unicos
- ;;
- crds | unos)
- basic_machine=m68k-crds
- ;;
- da30 | da30-*)
- basic_machine=m68k-da30
- ;;
- decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
- basic_machine=mips-dec
- ;;
- delta | 3300 | motorola-3300 | motorola-delta \
- | 3300-motorola | delta-motorola)
- basic_machine=m68k-motorola
- ;;
- delta88)
- basic_machine=m88k-motorola
- os=-sysv3
- ;;
- dpx20 | dpx20-*)
- basic_machine=rs6000-bull
- os=-bosx
- ;;
- dpx2* | dpx2*-bull)
- basic_machine=m68k-bull
- os=-sysv3
- ;;
- ebmon29k)
- basic_machine=a29k-amd
- os=-ebmon
- ;;
- elxsi)
- basic_machine=elxsi-elxsi
- os=-bsd
- ;;
- encore | umax | mmax)
- basic_machine=ns32k-encore
- ;;
- fx2800)
- basic_machine=i860-alliant
- ;;
- genix)
- basic_machine=ns32k-ns
- ;;
- gmicro)
- basic_machine=tron-gmicro
- os=-sysv
- ;;
- h3050r* | hiux*)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- h8300hms)
- basic_machine=h8300-hitachi
- os=-hms
- ;;
- harris)
- basic_machine=m88k-harris
- os=-sysv3
- ;;
- hp300-*)
- basic_machine=m68k-hp
- ;;
- hp300bsd)
- basic_machine=m68k-hp
- os=-bsd
- ;;
- hp300hpux)
- basic_machine=m68k-hp
- os=-hpux
- ;;
- hp9k2[0-9][0-9] | hp9k31[0-9])
- basic_machine=m68000-hp
- ;;
- hp9k3[2-9][0-9])
- basic_machine=m68k-hp
- ;;
- hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][0-9] | hp8[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hppa-next)
- os=-nextstep3
- ;;
- i370-ibm* | ibm*)
- basic_machine=i370-ibm
- os=-mvs
- ;;
-# I'm not sure what "Sysv32" means. Should this be sysv3.2?
- i[3456]86v32)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv32
- ;;
- i[3456]86v4*)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv4
- ;;
- i[3456]86v)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv
- ;;
- i[3456]86sol2)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-solaris2
- ;;
- iris | iris4d)
- basic_machine=mips-sgi
- case $os in
- -irix*)
- ;;
- *)
- os=-irix4
- ;;
- esac
- ;;
- isi68 | isi)
- basic_machine=m68k-isi
- os=-sysv
- ;;
- m88k-omron*)
- basic_machine=m88k-omron
- ;;
- magnum | m3230)
- basic_machine=mips-mips
- os=-sysv
- ;;
- merlin)
- basic_machine=ns32k-utek
- os=-sysv
- ;;
- miniframe)
- basic_machine=m68000-convergent
- ;;
- mipsel*-linux*)
- basic_machine=mipsel-unknown
- os=-linux-gnu
- ;;
- mips*-linux*)
- basic_machine=mips-unknown
- os=-linux-gnu
- ;;
- mips3*-*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
- ;;
- mips3*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
- ;;
- ncr3000)
- basic_machine=i486-ncr
- os=-sysv4
- ;;
- news | news700 | news800 | news900)
- basic_machine=m68k-sony
- os=-newsos
- ;;
- news1000)
- basic_machine=m68030-sony
- os=-newsos
- ;;
- news-3600 | risc-news)
- basic_machine=mips-sony
- os=-newsos
- ;;
- next | m*-next )
- basic_machine=m68k-next
- case $os in
- -nextstep* )
- ;;
- -ns2*)
- os=-nextstep2
- ;;
- *)
- os=-nextstep3
- ;;
- esac
- ;;
- nh3000)
- basic_machine=m68k-harris
- os=-cxux
- ;;
- nh[45]000)
- basic_machine=m88k-harris
- os=-cxux
- ;;
- nindy960)
- basic_machine=i960-intel
- os=-nindy
- ;;
- np1)
- basic_machine=np1-gould
- ;;
- pa-hitachi)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- paragon)
- basic_machine=i860-intel
- os=-osf
- ;;
- pbd)
- basic_machine=sparc-tti
- ;;
- pbb)
- basic_machine=m68k-tti
- ;;
- pc532 | pc532-*)
- basic_machine=ns32k-pc532
- ;;
- pentium | p5)
- basic_machine=i586-intel
- ;;
- pentiumpro | p6)
- basic_machine=i686-intel
- ;;
- pentium-* | p5-*)
- basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumpro-* | p6-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- k5)
- # We don't have specific support for AMD's K5 yet, so just call it a Pentium
- basic_machine=i586-amd
- ;;
- nexen)
- # We don't have specific support for Nexgen yet, so just call it a Pentium
- basic_machine=i586-nexgen
- ;;
- pn)
- basic_machine=pn-gould
- ;;
- power) basic_machine=rs6000-ibm
- ;;
- ppc) basic_machine=powerpc-unknown
- ;;
- ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppcle | powerpclittle | ppc-le | powerpc-little)
- basic_machine=powerpcle-unknown
- ;;
- ppcle-* | powerpclittle-*)
- basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ps2)
- basic_machine=i386-ibm
- ;;
- rm[46]00)
- basic_machine=mips-siemens
- ;;
- rtpc | rtpc-*)
- basic_machine=romp-ibm
- ;;
- sequent)
- basic_machine=i386-sequent
- ;;
- sh)
- basic_machine=sh-hitachi
- os=-hms
- ;;
- sps7)
- basic_machine=m68k-bull
- os=-sysv2
- ;;
- spur)
- basic_machine=spur-unknown
- ;;
- sun2)
- basic_machine=m68000-sun
- ;;
- sun2os3)
- basic_machine=m68000-sun
- os=-sunos3
- ;;
- sun2os4)
- basic_machine=m68000-sun
- os=-sunos4
- ;;
- sun3os3)
- basic_machine=m68k-sun
- os=-sunos3
- ;;
- sun3os4)
- basic_machine=m68k-sun
- os=-sunos4
- ;;
- sun4os3)
- basic_machine=sparc-sun
- os=-sunos3
- ;;
- sun4os4)
- basic_machine=sparc-sun
- os=-sunos4
- ;;
- sun4sol2)
- basic_machine=sparc-sun
- os=-solaris2
- ;;
- sun3 | sun3-*)
- basic_machine=m68k-sun
- ;;
- sun4)
- basic_machine=sparc-sun
- ;;
- sun386 | sun386i | roadrunner)
- basic_machine=i386-sun
- ;;
- symmetry)
- basic_machine=i386-sequent
- os=-dynix
- ;;
- tx39)
- basic_machine=mipstx39-unknown
- ;;
- tx39el)
- basic_machine=mipstx39el-unknown
- ;;
- tower | tower-32)
- basic_machine=m68k-ncr
- ;;
- udi29k)
- basic_machine=a29k-amd
- os=-udi
- ;;
- ultra3)
- basic_machine=a29k-nyu
- os=-sym1
- ;;
- vaxv)
- basic_machine=vax-dec
- os=-sysv
- ;;
- vms)
- basic_machine=vax-dec
- os=-vms
- ;;
- vpp*|vx|vx-*)
- basic_machine=f301-fujitsu
- ;;
- vxworks960)
- basic_machine=i960-wrs
- os=-vxworks
- ;;
- vxworks68)
- basic_machine=m68k-wrs
- os=-vxworks
- ;;
- vxworks29k)
- basic_machine=a29k-wrs
- os=-vxworks
- ;;
- xmp)
- basic_machine=xmp-cray
- os=-unicos
- ;;
- xps | xps100)
- basic_machine=xps100-honeywell
- ;;
- none)
- basic_machine=none-none
- os=-none
- ;;
-
-# Here we handle the default manufacturer of certain CPU types. It is in
-# some cases the only manufacturer, in others, it is the most popular.
- mips)
- if [ x$os = x-linux-gnu ]; then
- basic_machine=mips-unknown
- else
- basic_machine=mips-mips
- fi
- ;;
- romp)
- basic_machine=romp-ibm
- ;;
- rs6000)
- basic_machine=rs6000-ibm
- ;;
- vax)
- basic_machine=vax-dec
- ;;
- pdp11)
- basic_machine=pdp11-dec
- ;;
- we32k)
- basic_machine=we32k-att
- ;;
- sparc)
- basic_machine=sparc-sun
- ;;
- cydra)
- basic_machine=cydra-cydrome
- ;;
- orion)
- basic_machine=orion-highlevel
- ;;
- orion105)
- basic_machine=clipper-highlevel
- ;;
- *)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
-esac
-
-# Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
- *-digital*)
- basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
- ;;
- *-commodore*)
- basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
- ;;
- *)
- ;;
-esac
-
-# Decode manufacturer-specific aliases for certain operating systems.
-
-if [ x"$os" != x"" ]
-then
-case $os in
- # First match some system type aliases
- # that might get confused with valid system types.
- # -solaris* is a basic system type, with this one exception.
- -solaris1 | -solaris1.*)
- os=`echo $os | sed -e 's|solaris1|sunos4|'`
- ;;
- -solaris)
- os=-solaris2
- ;;
- -svr4*)
- os=-sysv4
- ;;
- -unixware*)
- os=-sysv4.2uw
- ;;
- -gnu/linux*)
- os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
- ;;
- # First accept the basic system types.
- # The portable systems comes first.
- # Each alternative MUST END IN A *, to match a version number.
- # -sysv* is not here because it comes later, after sysvr4.
- -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
- | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
- | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
- | -aos* \
- | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
- | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
- | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
- | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
- | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
- | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -uxpv*)
- # Remember, each alternative MUST END IN *, to match a version number.
- ;;
- -linux*)
- os=`echo $os | sed -e 's|linux|linux-gnu|'`
- ;;
- -sunos5*)
- os=`echo $os | sed -e 's|sunos5|solaris2|'`
- ;;
- -sunos6*)
- os=`echo $os | sed -e 's|sunos6|solaris3|'`
- ;;
- -osfrose*)
- os=-osfrose
- ;;
- -osf*)
- os=-osf
- ;;
- -utek*)
- os=-bsd
- ;;
- -dynix*)
- os=-bsd
- ;;
- -acis*)
- os=-aos
- ;;
- -ctix* | -uts*)
- os=-sysv
- ;;
- -ns2 )
- os=-nextstep2
- ;;
- # Preserve the version number of sinix5.
- -sinix5.*)
- os=`echo $os | sed -e 's|sinix|sysv|'`
- ;;
- -sinix*)
- os=-sysv4
- ;;
- -triton*)
- os=-sysv3
- ;;
- -oss*)
- os=-sysv3
- ;;
- -svr4)
- os=-sysv4
- ;;
- -svr3)
- os=-sysv3
- ;;
- -sysvr4)
- os=-sysv4
- ;;
- # This must come after -sysvr4.
- -sysv*)
- ;;
- -xenix)
- os=-xenix
- ;;
- -none)
- ;;
- *)
- # Get rid of the `-' at the beginning of $os.
- os=`echo $os | sed 's/[^-]*-//'`
- echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
- exit 1
- ;;
-esac
-else
-
-# Here we handle the default operating systems that come with various machines.
-# The value should be what the vendor currently ships out the door with their
-# machine or put another way, the most popular os provided with the machine.
-
-# Note that if you're going to try to match "-MANUFACTURER" here (say,
-# "-sun"), then you have to tell the case statement up towards the top
-# that MANUFACTURER isn't an operating system. Otherwise, code above
-# will signal an error saying that MANUFACTURER isn't an operating
-# system, and we'll never get to this point.
-
-case $basic_machine in
- *-acorn)
- os=-riscix1.2
- ;;
- arm*-semi)
- os=-aout
- ;;
- pdp11-*)
- os=-none
- ;;
- *-dec | vax-*)
- os=-ultrix4.2
- ;;
- m68*-apollo)
- os=-domain
- ;;
- i386-sun)
- os=-sunos4.0.2
- ;;
- m68000-sun)
- os=-sunos3
- # This also exists in the configure program, but was not the
- # default.
- # os=-sunos4
- ;;
- *-tti) # must be before sparc entry or we get the wrong os.
- os=-sysv3
- ;;
- sparc-* | *-sun)
- os=-sunos4.1.1
- ;;
- *-ibm)
- os=-aix
- ;;
- *-hp)
- os=-hpux
- ;;
- *-hitachi)
- os=-hiux
- ;;
- i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
- os=-sysv
- ;;
- *-cbm)
- os=-amigaos
- ;;
- *-dg)
- os=-dgux
- ;;
- *-dolphin)
- os=-sysv3
- ;;
- m68k-ccur)
- os=-rtu
- ;;
- m88k-omron*)
- os=-luna
- ;;
- *-next )
- os=-nextstep
- ;;
- *-sequent)
- os=-ptx
- ;;
- *-crds)
- os=-unos
- ;;
- *-ns)
- os=-genix
- ;;
- i370-*)
- os=-mvs
- ;;
- *-next)
- os=-nextstep3
- ;;
- *-gould)
- os=-sysv
- ;;
- *-highlevel)
- os=-bsd
- ;;
- *-encore)
- os=-bsd
- ;;
- *-sgi)
- os=-irix
- ;;
- *-siemens)
- os=-sysv4
- ;;
- *-masscomp)
- os=-rtu
- ;;
- f301-fujitsu)
- os=-uxpv
- ;;
- *)
- os=-none
- ;;
-esac
-fi
-
-# Here we handle the case where we know the os, and the CPU type, but not the
-# manufacturer. We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
- *-unknown)
- case $os in
- -riscix*)
- vendor=acorn
- ;;
- -sunos*)
- vendor=sun
- ;;
- -aix*)
- vendor=ibm
- ;;
- -hpux*)
- vendor=hp
- ;;
- -hiux*)
- vendor=hitachi
- ;;
- -unos*)
- vendor=crds
- ;;
- -dgux*)
- vendor=dg
- ;;
- -luna*)
- vendor=omron
- ;;
- -genix*)
- vendor=ns
- ;;
- -mvs*)
- vendor=ibm
- ;;
- -ptx*)
- vendor=sequent
- ;;
- -vxsim* | -vxworks*)
- vendor=wrs
- ;;
- -aux*)
- vendor=apple
- ;;
- esac
- basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
- ;;
-esac
-
-echo $basic_machine$os
diff --git a/glib/configure.in b/glib/configure.in
deleted file mode 100644
index d4bd55a2e7..0000000000
--- a/glib/configure.in
+++ /dev/null
@@ -1,167 +0,0 @@
-# Process this file with autoconf to produce a configure script.
-AC_INIT(glist.c)
-
-# Save this value here, since automake will set cflags later
-cflags_set=${CFLAGS+set}
-
-dnl Initialize automake stuff
-AM_INIT_AUTOMAKE(glib, 0.99.5)
-
-# Specify a configuration file
-AM_CONFIG_HEADER(glibconfig.h)
-
-dnl Initialize libtool
-AM_PROG_LIBTOOL
-
-dnl Initialize maintainer mode
-AM_MAINTAINER_MODE
-
-AC_CANONICAL_HOST
-
-AC_ARG_ENABLE(debug, [ --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],,enable_debug=minimum)
-
-AC_ARG_ENABLE(ansi, [ --enable-ansi turn on strict ansi [default=no]],
- , enable_ansi=no)
-
-if test "x$enable_debug" = "xyes"; then
- test "$cflags_set" = set || CFLAGS="-g"
- CFLAGS="$CFLAGS -DG_ENABLE_DEBUG"
-else
- if test "x$enable_debug" = "xno"; then
- CFLAGS="$CFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
- fi
-fi
-
-AC_DEFINE_UNQUOTED(G_COMPILED_WITH_DEBUGGING, "${enable_debug}")
-
-# Checks for programs.
-AC_PROG_CC
-AM_PROG_CC_STDC
-AC_PROG_INSTALL
-
-if eval "test x$GCC = xyes"; then
- if eval test -z \"`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`\" ; then
- CFLAGS="$CFLAGS -Wall"
- fi
-
- if eval "test x$enable_ansi = xyes"; then
- if eval test -z \"`echo "$CFLAGS" | grep "\-ansi" 2> /dev/null`\" ; then
- CFLAGS="$CFLAGS -ansi"
- fi
-
- if eval test -z \"`echo "$CFLAGS" | grep "\-pedantic" 2> /dev/null`\" ; then
- CFLAGS="$CFLAGS -pedantic"
- fi
- fi
-fi
-
-# Checks for header files.
-AC_HEADER_STDC
-
-# Checks for library functions.
-AC_FUNC_VPRINTF
-
-AC_CHECK_SIZEOF(char)
-AC_CHECK_SIZEOF(short)
-AC_CHECK_SIZEOF(long)
-AC_CHECK_SIZEOF(int)
-AC_CHECK_SIZEOF(void *)
-
-# long doubles were not used, and a portability problem
-# AC_C_LONG_DOUBLE
-AC_C_CONST
-AC_C_INLINE
-
-AC_CHECK_HEADERS(float.h, AC_DEFINE(HAVE_FLOAT_H))
-AC_CHECK_HEADERS(limits.h, AC_DEFINE(HAVE_LIMITS_H))
-AC_CHECK_HEADERS(values.h, AC_DEFINE(HAVE_VALUES_H))
-
-# Check for strerror, strsignal, memmove, vsnprintf, and strcasecmp functions
-AC_CHECK_FUNCS(strerror strsignal memmove vsnprintf strcasecmp)
-
-# Check for sys_errlist
-AC_MSG_CHECKING(sys_errlist)
-AC_TRY_LINK(, [
-extern char *sys_errlist[];
-extern int sys_nerr;
-sys_errlist[sys_nerr-1][0] = 0;
-], glib_ok=yes, glib_ok=no)
-AC_MSG_RESULT($glib_ok)
-if test $glib_ok = no; then
- AC_DEFINE(NO_SYS_ERRLIST)
-fi
-
-# Check for sys_siglist
-AC_MSG_CHECKING(sys_siglist)
-AC_TRY_LINK(, [
-extern char *sys_siglist[];
-sys_siglist[1][0] = 0;
-], glib_ok=yes, glib_ok=no)
-AC_MSG_RESULT($glib_ok)
-if test $glib_ok = no; then
- AC_DEFINE(NO_SYS_SIGLIST)
-fi
-
-# Check for sys/select.h
-
-AC_MSG_CHECKING([fd_set and sys/select])
-AC_TRY_COMPILE([#include <sys/types.h>],
- [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
-if test $gtk_ok = no; then
- AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
- if test $gtk_ok = yes; then
- AC_DEFINE(HAVE_SYS_SELECT_H)
- fi
-fi
-AC_MSG_RESULT($gtk_ok)
-if test $gtk_ok = no; then
- AC_DEFINE(NO_FD_SET)
-fi
-
-# This stuff is here, only so that we can define these
-# things in glibconfig.h. If ../config.h was installed
-# (under some other name?) then the definitions would
-# belong there. (They are only used in GDK)
-
-# Check for wchar.h
-
-AC_MSG_CHECKING(for wchar.h)
-AC_TRY_CPP([#include <wchar.h>], gtk_ok=yes, gtk_ok=no)
-if test $gtk_ok = yes; then
- AC_DEFINE(HAVE_WCHAR_H)
-fi
-AC_MSG_RESULT($gtk_ok)
-
-# Check for wctype.h (for iswalnum)
-
-AC_MSG_CHECKING(for wctype.h)
-AC_TRY_CPP([#include <wctype.h>], gtk_ok=yes, gtk_ok=no)
-if test $gtk_ok = yes; then
- AC_DEFINE(HAVE_WCTYPE_H)
-fi
-AC_MSG_RESULT($gtk_ok)
-
-# The following is necessary for Linux libc-5.4.38
-
-AC_MSG_CHECKING(if iswalnum() and friends are properly defined)
-AC_TRY_LINK([#include <stdlib.h>],[
-#if (defined(HAVE_WCTYPE_H) || defined(HAVE_WCHAR_H))
-# ifdef HAVE_WCTYPE_H
-# include <wctype.h>
-# else
-# ifdef HAVE_WCHAR_H
-# include <wchar.h>
-# endif
-# endif
-#else
-# define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
-#endif
-iswalnum((wchar_t) 0);
-], gtk_ok=yes, gtk_ok=no)
-
-if test $gtk_ok = no; then
- AC_DEFINE(HAVE_BROKEN_WCTYPE)
-fi
-AC_MSG_RESULT($gtk_ok)
-
-AC_OUTPUT(Makefile)
diff --git a/glib/garray.c b/glib/garray.c
deleted file mode 100644
index 017e1e3b3a..0000000000
--- a/glib/garray.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/* GLIB - Library of useful routines for C programming
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <string.h>
-#include "glib.h"
-
-
-#define MIN_ARRAY_SIZE 16
-
-
-typedef struct _GRealArray GRealArray;
-
-struct _GRealArray
-{
- guint8 *data;
- guint len;
- guint alloc;
- guint zero_terminated;
-};
-
-
-static gint g_nearest_pow (gint num);
-static void g_array_maybe_expand (GRealArray *array,
- gint len);
-
-
-static GMemChunk *array_mem_chunk = NULL;
-
-
-GArray*
-g_array_new (gint zero_terminated)
-{
- GRealArray *array;
-
- if (!array_mem_chunk)
- array_mem_chunk = g_mem_chunk_new ("array mem chunk",
- sizeof (GRealArray),
- 1024, G_ALLOC_AND_FREE);
-
- array = g_chunk_new (GRealArray, array_mem_chunk);
-
- array->data = NULL;
- array->len = 0;
- array->alloc = 0;
- array->zero_terminated = (zero_terminated ? 1 : 0);
-
- return (GArray*) array;
-}
-
-void
-g_array_free (GArray *array,
- gint free_segment)
-{
- if (free_segment)
- g_free (array->data);
-
- g_mem_chunk_free (array_mem_chunk, array);
-}
-
-GArray*
-g_rarray_append (GArray *array,
- gpointer data,
- gint size)
-{
- g_array_maybe_expand ((GRealArray*) array, size);
-
- memcpy (array->data + array->len, data, size);
-
- array->len += size;
-
- return array;
-}
-
-GArray*
-g_rarray_prepend (GArray *array,
- gpointer data,
- gint size)
-{
- g_array_maybe_expand ((GRealArray*) array, size);
-
- g_memmove (array->data + size, array->data, array->len);
- memcpy (array->data, data, size);
-
- array->len += size;
-
- return array;
-}
-
-GArray*
-g_rarray_truncate (GArray *array,
- gint length,
- gint size)
-{
- if (array->data)
- memset (array->data + length * size, 0, size);
- array->len = length;
- return array;
-}
-
-
-static gint
-g_nearest_pow (gint num)
-{
- gint n = 1;
-
- while (n < num)
- n <<= 1;
-
- return n;
-}
-
-static void
-g_array_maybe_expand (GRealArray *array,
- gint len)
-{
- guint old_alloc;
-
- if ((array->len + len) > array->alloc)
- {
- old_alloc = array->alloc;
-
- array->alloc = g_nearest_pow (array->len + array->zero_terminated + len);
- array->alloc = MAX (array->alloc, MIN_ARRAY_SIZE);
- array->data = g_realloc (array->data, array->alloc);
-
- memset (array->data + old_alloc, 0, array->alloc - old_alloc);
- }
-}
diff --git a/glib/gcache.c b/glib/gcache.c
deleted file mode 100644
index b121219952..0000000000
--- a/glib/gcache.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/* GLIB - Library of useful routines for C programming
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "glib.h"
-
-
-typedef struct _GCacheNode GCacheNode;
-typedef struct _GRealCache GRealCache;
-
-struct _GCacheNode
-{
- /* A reference counted node */
- gpointer value;
- gint ref_count;
-};
-
-struct _GRealCache
-{
- /* Called to create a value from a key */
- GCacheNewFunc value_new_func;
-
- /* Called to destroy a value */
- GCacheDestroyFunc value_destroy_func;
-
- /* Called to duplicate a key */
- GCacheDupFunc key_dup_func;
-
- /* Called to destroy a key */
- GCacheDestroyFunc key_destroy_func;
-
- /* Associates keys with nodes */
- GHashTable *key_table;
-
- /* Associates nodes with keys */
- GHashTable *value_table;
-};
-
-
-static GCacheNode* g_cache_node_new (gpointer value);
-static void g_cache_node_destroy (GCacheNode *node);
-
-
-static GMemChunk *node_mem_chunk = NULL;
-
-
-GCache*
-g_cache_new (GCacheNewFunc value_new_func,
- GCacheDestroyFunc value_destroy_func,
- GCacheDupFunc key_dup_func,
- GCacheDestroyFunc key_destroy_func,
- GHashFunc hash_key_func,
- GHashFunc hash_value_func,
- GCompareFunc key_compare_func)
-{
- GRealCache *cache;
-
- g_return_val_if_fail (value_new_func != NULL, NULL);
- g_return_val_if_fail (value_destroy_func != NULL, NULL);
- g_return_val_if_fail (key_dup_func != NULL, NULL);
- g_return_val_if_fail (key_destroy_func != NULL, NULL);
- g_return_val_if_fail (hash_key_func != NULL, NULL);
- g_return_val_if_fail (hash_value_func != NULL, NULL);
- g_return_val_if_fail (key_compare_func != NULL, NULL);
-
- cache = g_new (GRealCache, 1);
- cache->value_new_func = value_new_func;
- cache->value_destroy_func = value_destroy_func;
- cache->key_dup_func = key_dup_func;
- cache->key_destroy_func = key_destroy_func;
- cache->key_table = g_hash_table_new (hash_key_func, key_compare_func);
- cache->value_table = g_hash_table_new (hash_value_func, NULL);
-
- return (GCache*) cache;
-}
-
-void
-g_cache_destroy (GCache *cache)
-{
- GRealCache *rcache;
-
- g_return_if_fail (cache != NULL);
-
- rcache = (GRealCache*) cache;
- g_hash_table_destroy (rcache->key_table);
- g_hash_table_destroy (rcache->value_table);
- g_free (rcache);
-}
-
-gpointer
-g_cache_insert (GCache *cache,
- gpointer key)
-{
- GRealCache *rcache;
- GCacheNode *node;
- gpointer value;
-
- g_return_val_if_fail (cache != NULL, NULL);
-
- rcache = (GRealCache*) cache;
-
- node = g_hash_table_lookup (rcache->key_table, key);
- if (node)
- {
- node->ref_count += 1;
- return node->value;
- }
-
- key = (* rcache->key_dup_func) (key);
- value = (* rcache->value_new_func) (key);
- node = g_cache_node_new (value);
-
- g_hash_table_insert (rcache->key_table, key, node);
- g_hash_table_insert (rcache->value_table, value, key);
-
- return node->value;
-}
-
-void
-g_cache_remove (GCache *cache,
- gpointer value)
-{
- GRealCache *rcache;
- GCacheNode *node;
- gpointer key;
-
- g_return_if_fail (cache != NULL);
-
- rcache = (GRealCache*) cache;
-
- key = g_hash_table_lookup (rcache->value_table, value);
- node = g_hash_table_lookup (rcache->key_table, key);
-
- node->ref_count -= 1;
- if (node->ref_count == 0)
- {
- g_hash_table_remove (rcache->value_table, value);
- g_hash_table_remove (rcache->key_table, key);
-
- (* rcache->key_destroy_func) (key);
- (* rcache->value_destroy_func) (node->value);
- g_cache_node_destroy (node);
- }
-}
-
-void
-g_cache_key_foreach (GCache *cache,
- GHFunc func,
- gpointer user_data)
-{
- GRealCache *rcache;
-
- g_return_if_fail (cache != NULL);
- g_return_if_fail (func != NULL);
-
- rcache = (GRealCache*) cache;
-
- g_hash_table_foreach (rcache->value_table, func, user_data);
-}
-
-void
-g_cache_value_foreach (GCache *cache,
- GHFunc func,
- gpointer user_data)
-{
- GRealCache *rcache;
-
- g_return_if_fail (cache != NULL);
- g_return_if_fail (func != NULL);
-
- rcache = (GRealCache*) cache;
-
- g_hash_table_foreach (rcache->key_table, func, user_data);
-}
-
-
-static GCacheNode*
-g_cache_node_new (gpointer value)
-{
- GCacheNode *node;
-
- if (!node_mem_chunk)
- node_mem_chunk = g_mem_chunk_new ("cache node mem chunk", sizeof (GCacheNode),
- 1024, G_ALLOC_AND_FREE);
-
- node = g_chunk_new (GCacheNode, node_mem_chunk);
-
- node->value = value;
- node->ref_count = 1;
-
- return node;
-}
-
-static void
-g_cache_node_destroy (GCacheNode *node)
-{
- g_mem_chunk_free (node_mem_chunk, node);
-}
diff --git a/glib/gerror.c b/glib/gerror.c
deleted file mode 100644
index 1f992d9e20..0000000000
--- a/glib/gerror.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/* GLIB - Library of useful routines for C programming
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <signal.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/time.h>
-#include <sys/times.h>
-#include <sys/types.h>
-
-#include <time.h>
-#include <unistd.h>
-#include "glib.h"
-
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif /* HAVE_SYS_SELECT_H */
-
-#ifdef STDC_HEADERS
-#include <string.h> /* for bzero on BSD systems */
-#endif
-
-#define INTERACTIVE 0
-#define STACK_TRACE 1
-
-
-#ifndef NO_FD_SET
-# define SELECT_MASK fd_set
-#else
-# ifndef _AIX
- typedef long fd_mask;
-# endif
-# if defined(_IBMR2)
-# define SELECT_MASK void
-# else
-# define SELECT_MASK int
-# endif
-#endif
-
-
-static int do_query (char *prompt);
-static void debug (char *progname, int method);
-static void stack_trace (char **);
-static void stack_trace_sigchld (int);
-
-
-static int stack_trace_done;
-
-void
-g_debug (char *progname)
-{
- char buf[32];
-
- fprintf (stdout, "[n]othing, [e]xit, [s]tack trace, [a]ttach to process: ");
- fflush (stdout);
-
- fgets (buf, 32, stdin);
- if (strcmp (buf, "n\n") == 0)
- return;
- else if (strcmp (buf, "s\n") == 0)
- debug (progname, STACK_TRACE);
- else if (strcmp (buf, "a\n") == 0)
- debug (progname, INTERACTIVE);
- else
- exit (0);
-}
-
-void
-g_attach_process (char *progname, int query)
-{
- if (!query || do_query ("attach to process"))
- debug (progname, INTERACTIVE);
-}
-
-void
-g_stack_trace (char *progname, int query)
-{
- if (!query || do_query ("print stack trace"))
- debug (progname, STACK_TRACE);
-}
-
-static int
-do_query (char *prompt)
-{
- char buf[32];
-
- fprintf (stdout, "%s (y/n) ", prompt);
- fflush (stdout);
-
- fgets (buf, 32, stdin);
- if ((strcmp (buf, "yes\n") == 0) ||
- (strcmp (buf, "y\n") == 0) ||
- (strcmp (buf, "YES\n") == 0) ||
- (strcmp (buf, "Y\n") == 0))
- return TRUE;
-
- return FALSE;
-}
-
-static void
-debug (char *progname,
- int method)
-{
- pid_t pid;
- char buf[16];
- char *args[4] = { "gdb", NULL, NULL, NULL };
- volatile int x;
-
- sprintf (buf, "%d", (int) getpid ());
-
- args[1] = progname;
- args[2] = buf;
-
- switch (method)
- {
- case INTERACTIVE:
- fprintf (stdout, "pid: %s\n", buf);
- break;
- case STACK_TRACE:
- pid = fork ();
- if (pid == 0)
- {
- stack_trace (args);
- _exit (0);
- }
- else if (pid == (pid_t) -1)
- {
- perror ("could not fork");
- return;
- }
- break;
- }
-
- x = 1;
- while (x)
- ;
-}
-
-static void
-stack_trace (char **args)
-{
- pid_t pid;
- int in_fd[2];
- int out_fd[2];
- SELECT_MASK fdset;
- SELECT_MASK readset;
- struct timeval tv;
- int sel, index, state;
- char buffer[256];
- char c;
-
- stack_trace_done = 0;
- signal (SIGCHLD, stack_trace_sigchld);
-
- if ((pipe (in_fd) == -1) || (pipe (out_fd) == -1))
- {
- perror ("could open pipe");
- _exit (0);
- }
-
- pid = fork ();
- if (pid == 0)
- {
- close (0); dup (in_fd[0]); /* set the stdin to the in pipe */
- close (1); dup (out_fd[1]); /* set the stdout to the out pipe */
- close (2); dup (out_fd[1]); /* set the stderr to the out pipe */
-
- execvp (args[0], args); /* exec gdb */
- perror ("exec failed");
- _exit (0);
- }
- else if (pid == (pid_t) -1)
- {
- perror ("could not fork");
- _exit (0);
- }
-
- FD_ZERO (&fdset);
- FD_SET (out_fd[0], &fdset);
-
- write (in_fd[1], "backtrace\n", 10);
- write (in_fd[1], "p x = 0\n", 8);
- write (in_fd[1], "quit\n", 5);
-
- index = 0;
- state = 0;
-
- while (1)
- {
- readset = fdset;
- tv.tv_sec = 1;
- tv.tv_usec = 0;
-
- sel = select (FD_SETSIZE, &readset, NULL, NULL, &tv);
- if (sel == -1)
- break;
-
- if ((sel > 0) && (FD_ISSET (out_fd[0], &readset)))
- {
- if (read (out_fd[0], &c, 1))
- {
- switch (state)
- {
- case 0:
- if (c == '#')
- {
- state = 1;
- index = 0;
- buffer[index++] = c;
- }
- break;
- case 1:
- buffer[index++] = c;
- if ((c == '\n') || (c == '\r'))
- {
- buffer[index] = 0;
- fprintf (stdout, "%s", buffer);
- state = 0;
- index = 0;
- }
- break;
- default:
- break;
- }
- }
- }
- else if (stack_trace_done)
- break;
- }
-
- close (in_fd[0]);
- close (in_fd[1]);
- close (out_fd[0]);
- close (out_fd[1]);
- _exit (0);
-}
-
-static void
-stack_trace_sigchld (int signum)
-{
- stack_trace_done = 1;
-}
diff --git a/glib/ghash.c b/glib/ghash.c
deleted file mode 100644
index ed736d4cb7..0000000000
--- a/glib/ghash.c
+++ /dev/null
@@ -1,418 +0,0 @@
-/* GLIB - Library of useful routines for C programming
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "glib.h"
-
-
-#define HASH_TABLE_MIN_SIZE 11
-#define HASH_TABLE_MAX_SIZE 13845163
-
-
-typedef struct _GHashNode GHashNode;
-typedef struct _GRealHashTable GRealHashTable;
-
-struct _GHashNode
-{
- gpointer key;
- gpointer value;
- GHashNode *next;
-};
-
-struct _GRealHashTable
-{
- gint size;
- gint nnodes;
- gint frozen;
- GHashNode **nodes;
- GHashFunc hash_func;
- GCompareFunc key_compare_func;
-};
-
-
-static void g_hash_table_resize (GHashTable *hash_table);
-static gint g_hash_closest_prime (gint num);
-static GHashNode* g_hash_node_new (gpointer key,
- gpointer value);
-static void g_hash_node_destroy (GHashNode *hash_node);
-static void g_hash_nodes_destroy (GHashNode *hash_node);
-
-
-extern gint g_primes[];
-extern gint g_nprimes;
-
-static GMemChunk *node_mem_chunk = NULL;
-static GHashNode *node_free_list = NULL;
-
-
-GHashTable*
-g_hash_table_new (GHashFunc hash_func,
- GCompareFunc key_compare_func)
-{
- GRealHashTable *hash_table;
-
- g_return_val_if_fail (hash_func != NULL, NULL);
-
- hash_table = g_new (GRealHashTable, 1);
- hash_table->size = 0;
- hash_table->nnodes = 0;
- hash_table->frozen = FALSE;
- hash_table->nodes = NULL;
- hash_table->hash_func = hash_func;
- hash_table->key_compare_func = key_compare_func;
-
- return ((GHashTable*) hash_table);
-}
-
-void
-g_hash_table_destroy (GHashTable *hash_table)
-{
- GRealHashTable *rhash_table;
- gint i;
-
- if (hash_table)
- {
- rhash_table = (GRealHashTable*) hash_table;
-
- for (i = 0; i < rhash_table->size; i++)
- g_hash_nodes_destroy (rhash_table->nodes[i]);
-
- if (rhash_table->nodes)
- g_free (rhash_table->nodes);
- g_free (rhash_table);
- }
-}
-
-void
-g_hash_table_insert (GHashTable *hash_table,
- gpointer key,
- gpointer value)
-{
- GRealHashTable *rhash_table;
- GHashNode *node;
- guint hash_val;
-
- if (hash_table)
- {
- rhash_table = (GRealHashTable*) hash_table;
-
- if (rhash_table->size == 0)
- g_hash_table_resize (hash_table);
-
- hash_val = (* rhash_table->hash_func) (key) % rhash_table->size;
-
- node = rhash_table->nodes[hash_val];
- while (node)
- {
- if ((rhash_table->key_compare_func &&
- (* rhash_table->key_compare_func) (node->key, key)) ||
- (node->key == key))
- {
- node->value = value;
- return;
- }
- node = node->next;
- }
-
- node = g_hash_node_new (key, value);
- node->next = rhash_table->nodes[hash_val];
- rhash_table->nodes[hash_val] = node;
-
- rhash_table->nnodes += 1;
- g_hash_table_resize (hash_table);
- }
-}
-
-void
-g_hash_table_remove (GHashTable *hash_table,
- gpointer key)
-{
- GRealHashTable *rhash_table;
- GHashNode *node;
- GHashNode *prev;
- guint hash_val;
-
- rhash_table = (GRealHashTable*) hash_table;
- if (hash_table && rhash_table->size)
- {
- hash_val = (* rhash_table->hash_func) (key) % rhash_table->size;
-
- prev = NULL;
- node = rhash_table->nodes[hash_val];
-
- while (node)
- {
- if ((rhash_table->key_compare_func &&
- (* rhash_table->key_compare_func) (node->key, key)) ||
- (node->key == key))
- {
- if (prev)
- prev->next = node->next;
- if (node == rhash_table->nodes[hash_val])
- rhash_table->nodes[hash_val] = node->next;
-
- g_hash_node_destroy (node);
-
- rhash_table->nnodes -= 1;
- g_hash_table_resize (hash_table);
- break;
- }
-
- prev = node;
- node = node->next;
- }
- }
-}
-
-gpointer
-g_hash_table_lookup (GHashTable *hash_table,
- const gpointer key)
-{
- GRealHashTable *rhash_table;
- GHashNode *node;
- guint hash_val;
-
- rhash_table = (GRealHashTable*) hash_table;
- if (hash_table && rhash_table->size)
- {
- hash_val = (* rhash_table->hash_func) (key) % rhash_table->size;
-
- node = rhash_table->nodes[hash_val];
-
- /* Hash table lookup needs to be fast.
- * We therefore remove the extra conditional of testing
- * whether to call the key_compare_func or not from
- * the inner loop.
- */
- if (rhash_table->key_compare_func)
- {
- while (node)
- {
- if ((* rhash_table->key_compare_func) (node->key, key))
- return node->value;
- node = node->next;
- }
- }
- else
- {
- while (node)
- {
- if (node->key == key)
- return node->value;
- node = node->next;
- }
- }
- }
-
- return NULL;
-}
-
-void
-g_hash_table_freeze (GHashTable *hash_table)
-{
- GRealHashTable *rhash_table;
-
- if (hash_table)
- {
- rhash_table = (GRealHashTable*) hash_table;
- rhash_table->frozen = TRUE;
- }
-}
-
-void
-g_hash_table_thaw (GHashTable *hash_table)
-{
- GRealHashTable *rhash_table;
-
- if (hash_table)
- {
- rhash_table = (GRealHashTable*) hash_table;
- rhash_table->frozen = FALSE;
-
- g_hash_table_resize (hash_table);
- }
-}
-
-void
-g_hash_table_foreach (GHashTable *hash_table,
- GHFunc func,
- gpointer user_data)
-{
- GRealHashTable *rhash_table;
- GHashNode *node;
- gint i;
-
- if (hash_table)
- {
- rhash_table = (GRealHashTable*) hash_table;
-
- for (i = 0; i < rhash_table->size; i++)
- {
- node = rhash_table->nodes[i];
-
- while (node)
- {
- (* func) (node->key, node->value, user_data);
- node = node->next;
- }
- }
- }
-}
-
-
-static void
-g_hash_table_resize (GHashTable *hash_table)
-{
- GRealHashTable *rhash_table;
- GHashNode **new_nodes;
- GHashNode *node;
- GHashNode *next;
- gfloat nodes_per_list;
- guint hash_val;
- gint new_size;
- gint need_resize;
- gint i;
-
- if (hash_table)
- {
- rhash_table = (GRealHashTable*) hash_table;
-
- if (rhash_table->size == 0)
- {
- rhash_table->size = HASH_TABLE_MIN_SIZE;
- rhash_table->nodes = g_new (GHashNode*, rhash_table->size);
-
- for (i = 0; i < rhash_table->size; i++)
- rhash_table->nodes[i] = NULL;
- }
- else if (!rhash_table->frozen)
- {
- need_resize = FALSE;
- nodes_per_list = (gfloat) rhash_table->nnodes / (gfloat) rhash_table->size;
-
- if (nodes_per_list < 0.3)
- {
- if (rhash_table->size > HASH_TABLE_MIN_SIZE)
- need_resize = TRUE;
- }
- else if (nodes_per_list > 3.0)
- {
- if (rhash_table->size < HASH_TABLE_MAX_SIZE)
- need_resize = TRUE;
- }
-
- if (need_resize)
- {
- new_size = g_hash_closest_prime (rhash_table->nnodes);
- if (new_size < HASH_TABLE_MIN_SIZE)
- new_size = HASH_TABLE_MIN_SIZE;
- else if (new_size > HASH_TABLE_MAX_SIZE)
- new_size = HASH_TABLE_MAX_SIZE;
-
- new_nodes = g_new (GHashNode*, new_size);
-
- for (i = 0; i < new_size; i++)
- new_nodes[i] = NULL;
-
- for (i = 0; i < rhash_table->size; i++)
- {
- node = rhash_table->nodes[i];
-
- while (node)
- {
- next = node->next;
-
- hash_val = (* rhash_table->hash_func) (node->key) % new_size;
- node->next = new_nodes[hash_val];
- new_nodes[hash_val] = node;
-
- node = next;
- }
- }
-
- g_free (rhash_table->nodes);
-
- rhash_table->nodes = new_nodes;
- rhash_table->size = new_size;
- }
- }
- }
-}
-
-static gint
-g_hash_closest_prime (gint num)
-{
- gint i;
-
- for (i = 0; i < g_nprimes; i++)
- if ((g_primes[i] - num) > 0)
- return g_primes[i];
-
- return g_primes[g_nprimes - 1];
-}
-
-static GHashNode*
-g_hash_node_new (gpointer key,
- gpointer value)
-{
- GHashNode *hash_node;
-
- if (node_free_list)
- {
- hash_node = node_free_list;
- node_free_list = node_free_list->next;
- }
- else
- {
- if (!node_mem_chunk)
- node_mem_chunk = g_mem_chunk_new ("hash node mem chunk",
- sizeof (GHashNode),
- 1024, G_ALLOC_ONLY);
-
- hash_node = g_chunk_new (GHashNode, node_mem_chunk);
- }
-
- hash_node->key = key;
- hash_node->value = value;
- hash_node->next = NULL;
-
- return hash_node;
-}
-
-static void
-g_hash_node_destroy (GHashNode *hash_node)
-{
- if (hash_node)
- {
- hash_node->next = node_free_list;
- node_free_list = hash_node;
- }
-}
-
-static void
-g_hash_nodes_destroy (GHashNode *hash_node)
-{
- GHashNode *node;
-
- if (hash_node)
- {
- node = hash_node;
- while (node->next)
- node = node->next;
- node->next = node_free_list;
- node_free_list = hash_node;
- }
-}
diff --git a/glib/glib.h b/glib/glib.h
deleted file mode 100644
index 765d3a2a38..0000000000
--- a/glib/glib.h
+++ /dev/null
@@ -1,946 +0,0 @@
-/* GLIB - Library of useful routines for C programming
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __G_LIB_H__
-#define __G_LIB_H__
-
-#include <glibconfig.h>
-
-#ifdef USE_DMALLOC
-#include "dmalloc.h"
-#endif
-
-
-/* glib provides definitions for the extrema of many
- * of the standard types. These are:
- * G_MINFLOAT
- * G_MAXFLOAT
- * G_MINDOUBLE
- * G_MAXDOUBLE
- * G_MINSHORT
- * G_MAXSHORT
- * G_MININT
- * G_MAXINT
- * G_MINLONG
- * G_MAXLONG
- */
-
-#ifdef HAVE_FLOAT_H
-
-#include <float.h>
-
-#define G_MINFLOAT FLT_MIN
-#define G_MAXFLOAT FLT_MAX
-#define G_MINDOUBLE DBL_MIN
-#define G_MAXDOUBLE DBL_MAX
-
-#elif HAVE_VALUES_H
-
-#include <values.h>
-
-#define G_MINFLOAT MINFLOAT
-#define G_MAXFLOAT MAXFLOAT
-#define G_MINDOUBLE MINDOUBLE
-#define G_MAXDOUBLE MAXDOUBLE
-
-#endif /* HAVE_VALUES_H */
-
-
-#ifdef HAVE_LIMITS_H
-
-#include <limits.h>
-
-#define G_MINSHORT SHRT_MIN
-#define G_MAXSHORT SHRT_MAX
-#define G_MININT INT_MIN
-#define G_MAXINT INT_MAX
-#define G_MINLONG LONG_MIN
-#define G_MAXLONG LONG_MAX
-
-#elif HAVE_VALUES_H
-
-#ifdef HAVE_FLOAT_H
-#include <values.h>
-#endif /* HAVE_FLOAT_H */
-
-#define G_MINSHORT MINSHORT
-#define G_MAXSHORT MAXSHORT
-#define G_MININT MININT
-#define G_MAXINT MAXINT
-#define G_MINLONG MINLONG
-#define G_MAXLONG MAXLONG
-
-#endif /* HAVE_VALUES_H */
-
-
-/* Provide definitions for some commonly used macros.
- * These are only provided if they haven't already
- * been defined. It is assumed that if they are already
- * defined then the current definition is correct.
- */
-
-#ifndef FALSE
-#define FALSE 0
-#endif /* FALSE */
-
-#ifndef TRUE
-#define TRUE 1
-#endif /* TRUE */
-
-#ifndef NULL
-#define NULL ((void*) 0)
-#endif /* NULL */
-
-#ifndef MAX
-#define MAX(a, b) (((a) > (b)) ? (a) : (b))
-#endif /* MAX */
-
-#ifndef MIN
-#define MIN(a, b) (((a) < (b)) ? (a) : (b))
-#endif /* MIN */
-
-#ifndef ABS
-#define ABS(a) (((a) < 0) ? -(a) : (a))
-#endif /* ABS */
-
-#ifndef CLAMP
-#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
-#endif /* CLAMP */
-
-#ifndef ATEXIT
-#define ATEXIT(proc) (atexit (proc))
-#endif /* ATEXIT */
-
-
-/* Provide macros for easily allocating memory. The macros
- * will cast the allocated memory to the specified type
- * in order to avoid compiler warnings. (Makes the code neater).
- */
-
-#ifdef __DMALLOC_H__
-
-#define g_new(type,count) ALLOC(type,count)
-#define g_new0(type,count) CALLOC(type,count)
-
-#else /* __DMALLOC_H__ */
-
-#define g_new(type, count) \
- ((type *) g_malloc ((unsigned) sizeof (type) * (count)))
-#define g_new0(type, count) \
- ((type *) g_malloc0 ((unsigned) sizeof (type) * (count)))
-#endif /* __DMALLOC_H__ */
-
-#define g_chunk_new(type, chunk) \
- ((type *) g_mem_chunk_alloc (chunk))
-
-
-#define g_string(x) #x
-
-
-/* Provide simple macro statement wrappers (adapted from Pearl):
- * G_STMT_START { statements; } G_STMT_END;
- * can be used as a single statement, as in
- * if (x) G_STMT_START { ... } G_STMT_END; else ...
- *
- * For gcc we will wrap the statements within `({' and `})' braces.
- * For SunOS they will be wrapped within `if (1)' and `else (void)0',
- * and otherwise within `do' and `while (0)'.
- */
-#if !(defined (G_STMT_START) && defined (G_STMT_END))
-# if defined (__GNUC__) && !defined (__STRICT_ANSI__) && !defined (__cplusplus)
-# define G_STMT_START (void)(
-# define G_STMT_END )
-# else
-# if (defined (sun) || defined (__sun__))
-# define G_STMT_START if (1)
-# define G_STMT_END else (void)0
-# else
-# define G_STMT_START do
-# define G_STMT_END while (0)
-# endif
-# endif
-#endif
-
-
-/* Provide macros for error handling. The "assert" macros will
- * exit on failure. The "return" macros will exit the current
- * function. Two different definitions are given for the macros
- * in order to support gcc's __PRETTY_FUNCTION__ capability.
- */
-
-#ifdef G_DISABLE_ASSERT
-
-#define g_assert(expr)
-#define g_assert_not_reached()
-
-#else /* !G_DISABLE_ASSERT */
-
-#ifdef __GNUC__
-
-#define g_assert(expr) G_STMT_START{\
- if (!(expr)) \
- g_error ("file %s: line %d (%s): \"%s\"", \
- __FILE__, \
- __LINE__, \
- __PRETTY_FUNCTION__, \
- #expr); }G_STMT_END
-
-#define g_assert_not_reached() G_STMT_START{ \
- g_error ("file %s: line %d (%s): \"should not be reached\"", \
- __FILE__, \
- __LINE__, \
- __PRETTY_FUNCTION__); }G_STMT_END
-
-#else /* !__GNUC__ */
-
-#define g_assert(expr) G_STMT_START{\
- if (!(expr)) \
- g_error ("file %s: line %d: \"%s\"", \
- __FILE__, \
- __LINE__, \
- #expr); }G_STMT_END
-
-#define g_assert_not_reached() G_STMT_START{ \
- g_error ("file %s: line %d: \"should not be reached\"", \
- __FILE__, \
- __LINE__); }G_STMT_END
-
-#endif /* __GNUC__ */
-
-#endif /* G_DISABLE_ASSERT */
-
-#ifdef G_DISABLE_CHECKS
-
-#define g_return_if_fail(expr)
-#define g_return_val_if_fail(expr,val)
-
-#else /* !G_DISABLE_CHECKS */
-
-#ifdef __GNUC__
-
-#define g_return_if_fail(expr) G_STMT_START{ \
- if (!(expr)) \
- { \
- g_warning ("file %s: line %d (%s): \"%s\"", \
- __FILE__, \
- __LINE__, \
- __PRETTY_FUNCTION__, \
- #expr); \
- return; \
- }; }G_STMT_END
-
-#define g_return_val_if_fail(expr,val) G_STMT_START{ \
- if (!(expr)) \
- { \
- g_warning ("file %s: line %d (%s): \"%s\"", \
- __FILE__, \
- __LINE__, \
- __PRETTY_FUNCTION__, \
- #expr); \
- return val; \
- }; }G_STMT_END
-
-#else /* !__GNUC__ */
-
-#define g_return_if_fail(expr) G_STMT_START{ \
- if (!(expr)) \
- { \
- g_warning ("file %s: line %d: \"%s\"", \
- __FILE__, \
- __LINE__, \
- #expr); \
- return; \
- }; }G_STMT_END
-
-#define g_return_val_if_fail(expr, val) G_STMT_START{ \
- if (!(expr)) \
- { \
- g_warning ("file %s: line %d: \"%s\"", \
- __FILE__, \
- __LINE__, \
- #expr); \
- return val; \
- }; }G_STMT_END
-
-#endif /* !__GNUC__ */
-
-#endif /* G_DISABLE_CHECKS */
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/* Provide type definitions for commonly used types.
- * These are useful because a "gint8" can be adjusted
- * to be 1 byte (8 bits) on all platforms. Similarly and
- * more importantly, "gint32" can be adjusted to be
- * 4 bytes (32 bits) on all platforms.
- */
-
-typedef char gchar;
-typedef short gshort;
-typedef long glong;
-typedef int gint;
-typedef char gboolean;
-
-typedef unsigned char guchar;
-typedef unsigned short gushort;
-typedef unsigned long gulong;
-typedef unsigned int guint;
-
-typedef float gfloat;
-typedef double gdouble;
-
-/* HAVE_LONG_DOUBLE doesn't work correctly on all platforms.
- * Since gldouble isn't used anywhere, just disable it for now */
-
-#if 0
-#ifdef HAVE_LONG_DOUBLE
-typedef long double gldouble;
-#else /* HAVE_LONG_DOUBLE */
-typedef double gldouble;
-#endif /* HAVE_LONG_DOUBLE */
-#endif /* 0 */
-
-typedef void* gpointer;
-
-#if (SIZEOF_CHAR == 1)
-typedef signed char gint8;
-typedef unsigned char guint8;
-#endif /* SIZEOF_CHAR */
-
-
-#if (SIZEOF_SHORT == 2)
-typedef signed short gint16;
-typedef unsigned short guint16;
-#endif /* SIZEOF_SHORT */
-
-
-#if (SIZEOF_INT == 4)
-typedef signed int gint32;
-typedef unsigned int guint32;
-#elif (SIZEOF_LONG == 4)
-typedef signed long gint32;
-typedef unsigned long guint32;
-#endif /* SIZEOF_INT */
-
-
-typedef struct _GList GList;
-typedef struct _GSList GSList;
-typedef struct _GHashTable GHashTable;
-typedef struct _GCache GCache;
-typedef struct _GTree GTree;
-typedef struct _GTimer GTimer;
-typedef struct _GMemChunk GMemChunk;
-typedef struct _GListAllocator GListAllocator;
-typedef struct _GStringChunk GStringChunk;
-typedef struct _GString GString;
-typedef struct _GArray GArray;
-typedef struct _GDebugKey GDebugKey;
-
-typedef void (*GFunc) (gpointer data, gpointer user_data);
-typedef void (*GHFunc) (gpointer key, gpointer value, gpointer user_data);
-typedef guint (*GHashFunc) (gpointer key);
-typedef gint (*GCompareFunc) (gpointer a, gpointer b);
-typedef gpointer (*GCacheNewFunc) (gpointer key);
-typedef gpointer (*GCacheDupFunc) (gpointer value);
-typedef void (*GCacheDestroyFunc) (gpointer value);
-typedef gint (*GTraverseFunc) (gpointer key,
- gpointer value,
- gpointer data);
-typedef gint (*GSearchFunc) (gpointer key,
- gpointer data);
-typedef void (*GErrorFunc) (gchar *str);
-typedef void (*GWarningFunc) (gchar *str);
-typedef void (*GPrintFunc) (gchar *str);
-
-
-struct _GList
-{
- gpointer data;
- GList *next;
- GList *prev;
-};
-
-struct _GSList
-{
- gpointer data;
- GSList *next;
-};
-
-struct _GString
-{
- gchar *str;
- gint len;
-};
-
-struct _GArray
-{
- gchar *data;
- guint len;
-};
-
-struct _GDebugKey
-{
- gchar *key;
- guint value;
-};
-
-struct _GHashTable { gint dummy; };
-struct _GCache { gint dummy; };
-struct _GTree { gint dummy; };
-struct _GTimer { gint dummy; };
-struct _GMemChunk { gint dummy; };
-struct _GListAllocator { gint dummy; };
-struct _GStringChunk { gint dummy; };
-
-typedef enum
-{
- G_IN_ORDER,
- G_PRE_ORDER,
- G_POST_ORDER
-} GTraverseType;
-
-/* Doubly linked lists
- */
-GList* g_list_alloc (void);
-void g_list_free (GList *list);
-void g_list_free_1 (GList *list);
-GList* g_list_append (GList *list,
- gpointer data);
-GList* g_list_prepend (GList *list,
- gpointer data);
-GList* g_list_insert (GList *list,
- gpointer data,
- gint position);
-GList* g_list_insert_sorted
- (GList *list,
- gpointer data,
- GCompareFunc func);
-GList* g_list_concat (GList *list1,
- GList *list2);
-GList* g_list_remove (GList *list,
- gpointer data);
-GList* g_list_remove_link (GList *list,
- GList *link);
-GList* g_list_reverse (GList *list);
-GList* g_list_nth (GList *list,
- guint n);
-GList* g_list_find (GList *list,
- gpointer data);
-GList* g_list_last (GList *list);
-GList* g_list_first (GList *list);
-guint g_list_length (GList *list);
-void g_list_foreach (GList *list,
- GFunc func,
- gpointer user_data);
-
-#define g_list_previous(list) ((list) ? (((GList *)list)->prev) : NULL)
-#define g_list_next(list) ((list) ? (((GList *)list)->next) : NULL)
-
-/* Singly linked lists
- */
-GSList* g_slist_alloc (void);
-void g_slist_free (GSList *list);
-void g_slist_free_1 (GSList *list);
-GSList* g_slist_append (GSList *list,
- gpointer data);
-GSList* g_slist_prepend (GSList *list,
- gpointer data);
-GSList* g_slist_insert (GSList *list,
- gpointer data,
- gint position);
-GSList* g_slist_insert_sorted
- (GSList *list,
- gpointer data,
- GCompareFunc func);
-GSList* g_slist_concat (GSList *list1,
- GSList *list2);
-GSList* g_slist_remove (GSList *list,
- gpointer data);
-GSList* g_slist_remove_link (GSList *list,
- GSList *link);
-GSList* g_slist_reverse (GSList *list);
-GSList* g_slist_nth (GSList *list,
- guint n);
-GSList* g_slist_find (GSList *list,
- gpointer data);
-GSList* g_slist_last (GSList *list);
-guint g_slist_length (GSList *list);
-void g_slist_foreach (GSList *list,
- GFunc func,
- gpointer user_data);
-
-#define g_slist_next(list) ((list) ? (((GSList *)list)->next) : NULL)
-
-/* List Allocators
- */
-GListAllocator* g_list_allocator_new (void);
-void g_list_allocator_free (GListAllocator* allocator);
-GListAllocator* g_slist_set_allocator (GListAllocator* allocator);
-GListAllocator* g_list_set_allocator (GListAllocator* allocator);
-
-
-/* Hash tables
- */
-GHashTable* g_hash_table_new (GHashFunc hash_func,
- GCompareFunc key_compare_func);
-void g_hash_table_destroy (GHashTable *hash_table);
-void g_hash_table_insert (GHashTable *hash_table,
- gpointer key,
- gpointer value);
-void g_hash_table_remove (GHashTable *hash_table,
- gpointer key);
-gpointer g_hash_table_lookup (GHashTable *hash_table,
- const gpointer key);
-void g_hash_table_freeze (GHashTable *hash_table);
-void g_hash_table_thaw (GHashTable *hash_table);
-void g_hash_table_foreach (GHashTable *hash_table,
- GHFunc func,
- gpointer user_data);
-
-
-/* Caches
- */
-GCache* g_cache_new (GCacheNewFunc value_new_func,
- GCacheDestroyFunc value_destroy_func,
- GCacheDupFunc key_dup_func,
- GCacheDestroyFunc key_destroy_func,
- GHashFunc hash_key_func,
- GHashFunc hash_value_func,
- GCompareFunc key_compare_func);
-void g_cache_destroy (GCache *cache);
-gpointer g_cache_insert (GCache *cache,
- gpointer key);
-void g_cache_remove (GCache *cache,
- gpointer value);
-void g_cache_key_foreach (GCache *cache,
- GHFunc func,
- gpointer user_data);
-void g_cache_value_foreach (GCache *cache,
- GHFunc func,
- gpointer user_data);
-
-
-/* Trees
- */
-GTree* g_tree_new (GCompareFunc key_compare_func);
-void g_tree_destroy (GTree *tree);
-void g_tree_insert (GTree *tree,
- gpointer key,
- gpointer value);
-void g_tree_remove (GTree *tree,
- gpointer key);
-gpointer g_tree_lookup (GTree *tree,
- gpointer key);
-void g_tree_traverse (GTree *tree,
- GTraverseFunc traverse_func,
- GTraverseType traverse_type,
- gpointer data);
-gpointer g_tree_search (GTree *tree,
- GSearchFunc search_func,
- gpointer data);
-gint g_tree_height (GTree *tree);
-gint g_tree_nnodes (GTree *tree);
-
-
-/* Memory
- */
-
-#ifdef USE_DMALLOC
-
-#define g_malloc(size) (gpointer) MALLOC(size)
-#define g_malloc0(size) (gpointer) CALLOC(char,size)
-#define g_realloc(mem,size) (gpointer) REALLOC(mem,char,size)
-#define g_free(mem) FREE(mem)
-
-#else /* USE_DMALLOC */
-
-gpointer g_malloc (gulong size);
-gpointer g_malloc0 (gulong size);
-gpointer g_realloc (gpointer mem,
- gulong size);
-void g_free (gpointer mem);
-
-#endif /* USE_DMALLOC */
-
-void g_mem_profile (void);
-void g_mem_check (gpointer mem);
-
-
-/* "g_mem_chunk_new" creates a new memory chunk.
- * Memory chunks are used to allocate pieces of memory which are
- * always the same size. Lists are a good example of such a data type.
- * The memory chunk allocates and frees blocks of memory as needed.
- * Just be sure to call "g_mem_chunk_free" and not "g_free" on data
- * allocated in a mem chunk. ("g_free" will most likely cause a seg
- * fault...somewhere).
- *
- * Oh yeah, GMemChunk is an opaque data type. (You don't really
- * want to know what's going on inside do you?)
- */
-
-/* ALLOC_ONLY MemChunk's can only allocate memory. The free operation
- * is interpreted as a no op. ALLOC_ONLY MemChunk's save 4 bytes per
- * atom. (They are also useful for lists which use MemChunk to allocate
- * memory but are also part of the MemChunk implementation).
- * ALLOC_AND_FREE MemChunk's can allocate and free memory.
- */
-
-#define G_ALLOC_ONLY 1
-#define G_ALLOC_AND_FREE 2
-
-GMemChunk* g_mem_chunk_new (gchar *name,
- gint atom_size,
- gulong area_size,
- gint type);
-void g_mem_chunk_destroy (GMemChunk *mem_chunk);
-gpointer g_mem_chunk_alloc (GMemChunk *mem_chunk);
-void g_mem_chunk_free (GMemChunk *mem_chunk,
- gpointer mem);
-void g_mem_chunk_clean (GMemChunk *mem_chunk);
-void g_mem_chunk_reset (GMemChunk *mem_chunk);
-void g_mem_chunk_print (GMemChunk *mem_chunk);
-void g_mem_chunk_info (void);
-
-/* Ah yes...we have a "g_blow_chunks" function.
- * "g_blow_chunks" simply compresses all the chunks. This operation
- * consists of freeing every memory area that should be freed (but
- * which we haven't gotten around to doing yet). And, no,
- * "g_blow_chunks" doesn't follow the naming scheme, but it is a
- * much better name than "g_mem_chunk_clean_all" or something
- * similar.
- */
-void g_blow_chunks (void);
-
-
-/* Timer
- */
-GTimer* g_timer_new (void);
-void g_timer_destroy (GTimer *timer);
-void g_timer_start (GTimer *timer);
-void g_timer_stop (GTimer *timer);
-void g_timer_reset (GTimer *timer);
-gdouble g_timer_elapsed (GTimer *timer,
- gulong *microseconds);
-
-
-/* Output
- */
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
-void g_error (gchar *format, ...) __attribute__ ((format (printf, 1, 2)));
-void g_warning (gchar *format, ...) __attribute__ ((format (printf, 1, 2)));
-void g_message (gchar *format, ...) __attribute__ ((format (printf, 1, 2)));
-void g_print (gchar *format, ...) __attribute__ ((format (printf, 1, 2)));
-#else
-void g_error (gchar *format, ...);
-void g_warning (gchar *format, ...);
-void g_message (gchar *format, ...);
-void g_print (gchar *format, ...);
-#endif
-
-/* Utility functions
- */
-gchar* g_strdup (const gchar *str);
-gchar* g_strconcat (const gchar *string1, ...); /* NULL terminated */
-gdouble g_strtod (const gchar *nptr, gchar **endptr);
-gchar* g_strerror (gint errnum);
-gchar* g_strsignal (gint signum);
-gint g_strcasecmp (const gchar *s1, const gchar *s2);
-gint g_snprintf (gchar *str, gulong n, gchar const *fmt, ...);
-
-
-/* We make the assumption that if memmove isn't available, then
- * bcopy will do the job. This isn't safe everywhere. (bcopy can't
- * necessarily handle overlapping copies) */
-#ifdef HAVE_MEMMOVE
-#define g_memmove memmove
-#else
-#define g_memmove(a,b,c) bcopy(b,a,c)
-#endif
-
-/* Errors
- */
-GErrorFunc g_set_error_handler (GErrorFunc func);
-GWarningFunc g_set_warning_handler (GWarningFunc func);
-GPrintFunc g_set_message_handler (GPrintFunc func);
-GPrintFunc g_set_print_handler (GPrintFunc func);
-
-guint g_parse_debug_string (const gchar *string,
- GDebugKey *keys,
- guint nkeys);
-
-void g_debug (char *progname);
-void g_attach_process (char *progname, int query);
-void g_stack_trace (char *progname, int query);
-
-
-/* String Chunks
- */
-GStringChunk* g_string_chunk_new (gint size);
-void g_string_chunk_free (GStringChunk *chunk);
-gchar* g_string_chunk_insert (GStringChunk *chunk,
- gchar* string);
-gchar* g_string_chunk_insert_const (GStringChunk *chunk,
- gchar* string);
-
-/* Strings
- */
-GString* g_string_new (gchar *init);
-void g_string_free (GString *string,
- gint free_segment);
-GString* g_string_assign (GString *lval,
- gchar *rval);
-GString* g_string_truncate (GString *string,
- gint len);
-GString* g_string_append (GString *string,
- gchar *val);
-GString* g_string_append_c (GString *string,
- gchar c);
-GString* g_string_prepend (GString *string,
- gchar *val);
-GString* g_string_prepend_c (GString *string,
- gchar c);
-GString* g_string_insert (GString *fstring,
- gint pos,
- gchar *val);
-GString* g_string_insert_c (GString *fstring,
- gint pos,
- gchar c);
-GString* g_string_erase (GString *fstring,
- gint pos,
- gint len);
-void g_string_sprintf (GString *string,
- gchar *fmt,
- ...);
-void g_string_sprintfa (GString *string,
- gchar *fmt,
- ...);
-
-/* Resizable arrays
- */
-#define g_array_append_val(array,type,val) \
- g_rarray_append (array, (gpointer) &val, sizeof (type))
-#define g_array_append_vals(array,type,vals,nvals) \
- g_rarray_append (array, (gpointer) vals, sizeof (type) * nvals)
-#define g_array_prepend_val(array,type,val) \
- g_rarray_prepend (array, (gpointer) &val, sizeof (type))
-#define g_array_prepend_vals(array,type,vals,nvals) \
- g_rarray_prepend (array, (gpointer) vals, sizeof (type) * nvals)
-#define g_array_truncate(array,type,length) \
- g_rarray_truncate (array, length, sizeof (type))
-#define g_array_index(array,type,index) \
- ((type*) array->data)[index]
-
-GArray* g_array_new (gint zero_terminated);
-void g_array_free (GArray *array,
- gint free_segment);
-GArray* g_rarray_append (GArray *array,
- gpointer data,
- gint size);
-GArray* g_rarray_prepend (GArray *array,
- gpointer data,
- gint size);
-GArray* g_rarray_truncate (GArray *array,
- gint length,
- gint size);
-
-/* Hash Functions
- */
-gint g_str_equal (const gpointer v,
- const gpointer v2);
-guint g_str_hash (const gpointer v);
-
-
-
-/* GScanner: Flexible lexical scanner for general purpose.
- * Copyright (C) 1997 Tim Janik
- */
-
-/* Character sets */
-#define G_CSET_A_2_Z "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-#define G_CSET_a_2_z "abcdefghijklmnopqrstuvwxyz"
-#define G_CSET_LATINC "\300\301\302\303\304\305\306"\
- "\307\310\311\312\313\314\315\316\317\320"\
- "\321\322\323\324\325\326"\
- "\330\331\332\333\334\335\336"
-#define G_CSET_LATINS "\337\340\341\342\343\344\345\346"\
- "\347\350\351\352\353\354\355\356\357\360"\
- "\361\362\363\364\365\366"\
- "\370\371\372\373\374\375\376\377"
-
-typedef union _GValue GValue;
-typedef struct _GScannerConfig GScannerConfig;
-typedef struct _GScanner GScanner;
-
-/* Error types */
-typedef enum
-{
- G_ERR_UNKNOWN,
- G_ERR_UNEXP_EOF,
- G_ERR_UNEXP_EOF_IN_STRING,
- G_ERR_UNEXP_EOF_IN_COMMENT,
- G_ERR_NON_DIGIT_IN_CONST,
- G_ERR_DIGIT_RADIX,
- G_ERR_FLOAT_RADIX,
- G_ERR_FLOAT_MALFORMED
-} GErrorType;
-
-/* Token types */
-typedef enum
-{
- G_TOKEN_EOF = 0,
-
- G_TOKEN_LEFT_PAREN = '(',
- G_TOKEN_RIGHT_PAREN = ')',
- G_TOKEN_LEFT_CURLY = '{',
- G_TOKEN_RIGHT_CURLY = '}',
- G_TOKEN_LEFT_BRACE = '[',
- G_TOKEN_RIGHT_BRACE = ']',
- G_TOKEN_EQUAL_SIGN = '=',
- G_TOKEN_COMMA = ',',
-
- G_TOKEN_NONE = 256,
-
- G_TOKEN_ERROR,
-
- G_TOKEN_CHAR,
- G_TOKEN_BINARY,
- G_TOKEN_OCTAL,
- G_TOKEN_INT,
- G_TOKEN_HEX,
- G_TOKEN_FLOAT,
- G_TOKEN_STRING,
-
- G_TOKEN_SYMBOL,
- G_TOKEN_IDENTIFIER,
- G_TOKEN_IDENTIFIER_NULL,
-
- G_TOKEN_COMMENT_SINGLE,
- G_TOKEN_COMMENT_MULTI,
- G_TOKEN_LAST
-} GTokenType;
-
-union _GValue
-{
- gpointer v_symbol;
- gchar *v_identifier;
- gulong v_binary;
- gulong v_octal;
- gulong v_int;
- gdouble v_float;
- gulong v_hex;
- gchar *v_string;
- gchar *v_comment;
- guchar v_char;
- guint v_error;
-};
-
-struct _GScannerConfig
-{
- /* Character sets
- */
- gchar *cset_skip_characters; /* default: " \t\n" */
- gchar *cset_identifier_first;
- gchar *cset_identifier_nth;
- gchar *cpair_comment_single; /* default: "#\n" */
-
- /* Should symbol lookup work case sensitive?
- */
- guint case_sensitive : 1;
-
- /* Boolean values to be adjusted "on the fly"
- * to configure scanning behaviour.
- */
- guint skip_comment_multi : 1; /* C like comment */
- guint skip_comment_single : 1; /* single line comment */
- guint scan_comment_multi : 1; /* scan multi line comments? */
- guint scan_identifier : 1;
- guint scan_identifier_1char : 1;
- guint scan_identifier_NULL : 1;
- guint scan_symbols : 1;
- guint scan_binary : 1;
- guint scan_octal : 1;
- guint scan_float : 1;
- guint scan_hex : 1; /* `0x0ff0' */
- guint scan_hex_dollar : 1; /* `$0ff0' */
- guint scan_string_sq : 1; /* string: 'anything' */
- guint scan_string_dq : 1; /* string: "\\-escapes!\n" */
- guint numbers_2_int : 1; /* bin, octal, hex => int */
- guint int_2_float : 1; /* int => G_TOKEN_FLOAT? */
- guint identifier_2_string : 1;
- guint char_2_token : 1; /* return G_TOKEN_CHAR? */
- guint symbol_2_token : 1;
-};
-
-struct _GScanner
-{
- /* unused portions */
- gpointer user_data;
- const gchar *input_name;
- guint parse_errors;
- guint max_parse_errors;
-
- /* maintained/used by the g_scanner_*() functions */
- GScannerConfig *config;
- GTokenType token;
- GValue value;
- guint line;
- guint position;
-
- /* to be considered private */
- GTokenType next_token;
- GValue next_value;
- guint next_line;
- guint next_position;
- GHashTable *symbol_table;
- const gchar *text;
- guint text_len;
- gint input_fd;
- gint peeked_char;
-};
-
-GScanner* g_scanner_new (GScannerConfig *config_templ);
-void g_scanner_destroy (GScanner *scanner);
-void g_scanner_input_file (GScanner *scanner,
- gint input_fd);
-void g_scanner_input_text (GScanner *scanner,
- const gchar *text,
- guint text_len);
-GTokenType g_scanner_get_next_token (GScanner *scanner);
-GTokenType g_scanner_peek_next_token (GScanner *scanner);
-GTokenType g_scanner_cur_token (GScanner *scanner);
-GValue g_scanner_cur_value (GScanner *scanner);
-guint g_scanner_cur_line (GScanner *scanner);
-guint g_scanner_cur_position (GScanner *scanner);
-gboolean g_scanner_eof (GScanner *scanner);
-void g_scanner_add_symbol (GScanner *scanner,
- const gchar *symbol,
- gpointer value);
-gpointer g_scanner_lookup_symbol (GScanner *scanner,
- const gchar *symbol);
-void g_scanner_remove_symbol (GScanner *scanner,
- const gchar *symbol);
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __G_LIB_H__ */
diff --git a/glib/glibconfig.h.in b/glib/glibconfig.h.in
deleted file mode 100644
index e64576060d..0000000000
--- a/glib/glibconfig.h.in
+++ /dev/null
@@ -1,78 +0,0 @@
-/* glibconfig.h.in. Generated automatically from configure.in by autoheader. */
-
-/* Define to empty if the keyword does not work. */
-#undef const
-
-/* Define if you don't have vprintf but do have _doprnt. */
-#undef HAVE_DOPRNT
-
-/* Define if you have the vprintf function. */
-#undef HAVE_VPRINTF
-
-/* Define as __inline if that's what the C compiler calls it. */
-#undef inline
-
-/* Define if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Other stuff */
-#undef G_COMPILED_WITH_DEBUGGING
-#undef HAVE_BROKEN_WCTYPE
-#undef HAVE_DOPRNT
-#undef HAVE_FLOAT_H
-#undef HAVE_LIMITS_H
-#undef HAVE_LONG_DOUBLE
-#undef HAVE_SYS_SELECT_H
-#undef HAVE_STRERROR
-#undef HAVE_STRSIGNAL
-#undef HAVE_VSNPRINTF
-#undef HAVE_VALUES_H
-#undef HAVE_VPRINTF
-#undef HAVE_WCHAR_H
-#undef HAVE_WCTYPE_H
-
-#undef NO_FD_SET
-#undef NO_SYS_ERRLIST
-#undef NO_SYS_SIGLIST
-
-/* #undef PACKAGE */
-/* #undef VERSION */
-
-/* The number of bytes in a char. */
-#undef SIZEOF_CHAR
-
-/* The number of bytes in a int. */
-#undef SIZEOF_INT
-
-/* The number of bytes in a long. */
-#undef SIZEOF_LONG
-
-/* The number of bytes in a short. */
-#undef SIZEOF_SHORT
-
-/* The number of bytes in a void *. */
-#undef SIZEOF_VOID_P
-
-/* Define if you have the memmove function. */
-#undef HAVE_MEMMOVE
-
-/* Define if you have the strcasecmp function. */
-#undef HAVE_STRCASECMP
-
-/* Define if you have the strerror function. */
-#undef HAVE_STRERROR
-
-/* Define if you have the strsignal function. */
-#undef HAVE_STRSIGNAL
-
-/* Define if you have the vsnprintf function. */
-#undef HAVE_VSNPRINTF
-
-/* Define if you have the <float.h> header file. */
-#undef HAVE_FLOAT_H
-
-/* Define if you have the <limits.h> header file. */
-#undef HAVE_LIMITS_H
-
-/* Define if you have the <values.h> header file. */
-#undef HAVE_VALUES_H
diff --git a/glib/glist.c b/glib/glist.c
deleted file mode 100644
index 2c0f9249d6..0000000000
--- a/glib/glist.c
+++ /dev/null
@@ -1,414 +0,0 @@
-/* GLIB - Library of useful routines for C programming
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "glib.h"
-
-
-typedef struct _GRealListAllocator GRealListAllocator;
-
-struct _GRealListAllocator
-{
- GMemChunk *list_mem_chunk;
- GList *free_list;
-};
-
-
-static GRealListAllocator *default_allocator = NULL;
-static GRealListAllocator *current_allocator = NULL;
-
-
-GListAllocator*
-g_list_allocator_new ()
-{
- GRealListAllocator* allocator = g_new (GRealListAllocator, 1);
-
- allocator->list_mem_chunk = NULL;
- allocator->free_list = NULL;
-
- return (GListAllocator*) allocator;
-}
-
-void
-g_list_allocator_free (GListAllocator* fallocator)
-{
- GRealListAllocator* allocator = (GRealListAllocator *) fallocator;
-
- if (allocator && allocator->list_mem_chunk)
- g_mem_chunk_destroy (allocator->list_mem_chunk);
- if (allocator)
- g_free (allocator);
-}
-
-GListAllocator*
-g_list_set_allocator (GListAllocator* fallocator)
-{
- GRealListAllocator* allocator = (GRealListAllocator *) fallocator;
- GRealListAllocator* old_allocator = current_allocator;
-
- if (allocator)
- current_allocator = allocator;
- else
- {
- if (!default_allocator)
- default_allocator = (GRealListAllocator*) g_list_allocator_new ();
- current_allocator = default_allocator;
- }
-
- if (!current_allocator->list_mem_chunk)
- current_allocator->list_mem_chunk = g_mem_chunk_new ("list mem chunk",
- sizeof (GList),
- 1024,
- G_ALLOC_ONLY);
-
- return (GListAllocator*) (old_allocator == default_allocator ? NULL : old_allocator);
-}
-
-
-GList*
-g_list_alloc ()
-{
- GList *new_list;
-
- g_list_set_allocator (NULL);
- if (current_allocator->free_list)
- {
- new_list = current_allocator->free_list;
- current_allocator->free_list = current_allocator->free_list->next;
- }
- else
- {
- new_list = g_chunk_new (GList, current_allocator->list_mem_chunk);
- }
-
- new_list->data = NULL;
- new_list->next = NULL;
- new_list->prev = NULL;
-
- return new_list;
-}
-
-void
-g_list_free (GList *list)
-{
- GList *last;
-
- if (list)
- {
- last = g_list_last (list);
- last->next = current_allocator->free_list;
- current_allocator->free_list = list;
- }
-}
-
-void
-g_list_free_1 (GList *list)
-{
- if (list)
- {
- list->next = current_allocator->free_list;
- current_allocator->free_list = list;
- }
-}
-
-GList*
-g_list_append (GList *list,
- gpointer data)
-{
- GList *new_list;
- GList *last;
-
- new_list = g_list_alloc ();
- new_list->data = data;
-
- if (list)
- {
- last = g_list_last (list);
- /* g_assert (last != NULL); */
- last->next = new_list;
- new_list->prev = last;
-
- return list;
- }
- else
- return new_list;
-}
-
-GList*
-g_list_prepend (GList *list,
- gpointer data)
-{
- GList *new_list;
-
- new_list = g_list_alloc ();
- new_list->data = data;
-
- if (list)
- {
- if (list->prev)
- {
- list->prev->next = new_list;
- new_list->prev = list->prev;
- }
- list->prev = new_list;
- new_list->next = list;
- }
-
- return new_list;
-}
-
-GList*
-g_list_insert (GList *list,
- gpointer data,
- gint position)
-{
- GList *new_list;
- GList *tmp_list;
-
- if (position < 0)
- return g_list_append (list, data);
- else if (position == 0)
- return g_list_prepend (list, data);
-
- tmp_list = g_list_nth (list, position);
- if (!tmp_list)
- return g_list_append (list, data);
-
- new_list = g_list_alloc ();
- new_list->data = data;
-
- if (tmp_list->prev)
- {
- tmp_list->prev->next = new_list;
- new_list->prev = tmp_list->prev;
- }
- new_list->next = tmp_list;
- tmp_list->prev = new_list;
-
- if (tmp_list == list)
- return new_list;
- else
- return list;
-}
-
-GList *
-g_list_concat (GList *list1, GList *list2)
-{
- GList *tmp_list;
-
- if (list2)
- {
- tmp_list = g_list_last (list1);
- if (tmp_list)
- tmp_list->next = list2;
- else
- list1 = list2;
- list2->prev = tmp_list;
- }
-
- return list1;
-}
-
-GList*
-g_list_remove (GList *list,
- gpointer data)
-{
- GList *tmp;
-
- tmp = list;
- while (tmp)
- {
- if (tmp->data != data)
- tmp = tmp->next;
- else
- {
- if (tmp->prev)
- tmp->prev->next = tmp->next;
- if (tmp->next)
- tmp->next->prev = tmp->prev;
-
- if (list == tmp)
- list = list->next;
-
- g_list_free_1 (tmp);
-
- break;
- }
- }
- return list;
-}
-
-GList*
-g_list_remove_link (GList *list,
- GList *link)
-{
- if (link)
- {
- if (link->prev)
- link->prev->next = link->next;
- if (link->next)
- link->next->prev = link->prev;
-
- if (link == list)
- list = list->next;
-
- link->next = NULL;
- link->prev = NULL;
- }
-
- return list;
-}
-
-GList*
-g_list_reverse (GList *list)
-{
- GList *last;
-
- last = NULL;
- while (list)
- {
- last = list;
- list = last->next;
- last->next = last->prev;
- last->prev = list;
- }
-
- return last;
-}
-
-GList*
-g_list_nth (GList *list,
- guint n)
-{
- while ((n-- > 0) && list)
- list = list->next;
-
- return list;
-}
-
-GList*
-g_list_find (GList *list,
- gpointer data)
-{
- while (list)
- {
- if (list->data == data)
- break;
- list = list->next;
- }
-
- return list;
-}
-
-GList*
-g_list_last (GList *list)
-{
- if (list)
- {
- while (list->next)
- list = list->next;
- }
-
- return list;
-}
-
-GList*
-g_list_first (GList *list)
-{
- if (list)
- {
- while (list->prev)
- list = list->prev;
- }
-
- return list;
-}
-
-guint
-g_list_length (GList *list)
-{
- guint length;
-
- length = 0;
- while (list)
- {
- length++;
- list = list->next;
- }
-
- return length;
-}
-
-void
-g_list_foreach (GList *list,
- GFunc func,
- gpointer user_data)
-{
- while (list)
- {
- (*func) (list->data, user_data);
- list = list->next;
- }
-}
-
-
-GList*
-g_list_insert_sorted (GList *list,
- gpointer data,
- GCompareFunc func)
-{
- GList *tmp_list = list;
- GList *new_list;
- gint cmp;
-
- if (!list)
- {
- new_list = g_list_alloc();
- new_list->data = data;
- return new_list;
- }
-
- cmp = (*func) (data, tmp_list->data);
-
- while ((tmp_list->next) && (cmp > 0))
- {
- tmp_list = tmp_list->next;
- cmp = (*func) (data, tmp_list->data);
- }
-
- new_list = g_list_alloc();
- new_list->data = data;
-
- if ((!tmp_list->next) && (cmp > 0))
- {
- tmp_list->next = new_list;
- new_list->prev = tmp_list;
- return list;
- }
-
- if (tmp_list->prev)
- {
- tmp_list->prev->next = new_list;
- new_list->prev = tmp_list->prev;
- }
- new_list->next = tmp_list;
- tmp_list->prev = new_list;
-
- if (tmp_list == list)
- return new_list;
- else
- return list;
-}
diff --git a/glib/gmem.c b/glib/gmem.c
deleted file mode 100644
index 35dfdaba37..0000000000
--- a/glib/gmem.c
+++ /dev/null
@@ -1,824 +0,0 @@
-/* GLIB - Library of useful routines for C programming
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <stdlib.h>
-#include <string.h>
-#include "glib.h"
-
-
-/* #define MEM_PROFILE */
-/* #define MEM_CHECK */
-
-
-#define MAX_MEM_AREA 65536L
-#define MEM_AREA_SIZE 4L
-
-#if SIZEOF_VOID_P > SIZEOF_LONG
-#define MEM_ALIGN SIZEOF_VOID_P
-#else
-#define MEM_ALIGN SIZEOF_LONG
-#endif
-
-
-typedef struct _GFreeAtom GFreeAtom;
-typedef struct _GMemArea GMemArea;
-typedef struct _GRealMemChunk GRealMemChunk;
-
-struct _GFreeAtom
-{
- GFreeAtom *next;
-};
-
-struct _GMemArea
-{
- GMemArea *next; /* the next mem area */
- GMemArea *prev; /* the previous mem area */
- gulong index; /* the current index into the "mem" array */
- gulong free; /* the number of free bytes in this mem area */
- gulong allocated; /* the number of atoms allocated from this area */
- gulong mark; /* is this mem area marked for deletion */
- gchar mem[MEM_AREA_SIZE]; /* the mem array from which atoms get allocated
- * the actual size of this array is determined by
- * the mem chunk "area_size". ANSI says that it
- * must be declared to be the maximum size it
- * can possibly be (even though the actual size
- * may be less).
- */
-};
-
-struct _GRealMemChunk
-{
- gchar *name; /* name of this MemChunk...used for debugging output */
- gint type; /* the type of MemChunk: ALLOC_ONLY or ALLOC_AND_FREE */
- gint num_mem_areas; /* the number of memory areas */
- gint num_marked_areas; /* the number of areas marked for deletion */
- guint atom_size; /* the size of an atom */
- gulong area_size; /* the size of a memory area */
- GMemArea *mem_area; /* the current memory area */
- GMemArea *mem_areas; /* a list of all the mem areas owned by this chunk */
- GMemArea *free_mem_area; /* the free area...which is about to be destroyed */
- GFreeAtom *free_atoms; /* the free atoms list */
- GTree *mem_tree; /* tree of mem areas sorted by memory address */
- GRealMemChunk *next; /* pointer to the next chunk */
- GRealMemChunk *prev; /* pointer to the previous chunk */
-};
-
-
-static gulong g_mem_chunk_compute_size (gulong size);
-static gint g_mem_chunk_area_compare (GMemArea *a,
- GMemArea *b);
-static gint g_mem_chunk_area_search (GMemArea *a,
- gchar *addr);
-
-
-static GRealMemChunk *mem_chunks = NULL;
-
-#ifdef MEM_PROFILE
-static gulong allocations[4096] = { 0 };
-static gulong allocated_mem = 0;
-static gulong freed_mem = 0;
-#endif /* MEM_PROFILE */
-
-
-#ifndef USE_DMALLOC
-
-gpointer
-g_malloc (gulong size)
-{
- gpointer p;
-
-
-#if defined(MEM_PROFILE) || defined(MEM_CHECK)
- gulong *t;
-#endif /* MEM_PROFILE || MEM_CHECK */
-
-
- if (size == 0)
- return NULL;
-
-
-#if defined(MEM_PROFILE) || defined(MEM_CHECK)
- size += SIZEOF_LONG;
-#endif /* MEM_PROFILE || MEM_CHECK */
-
-#ifdef MEM_CHECK
- size += SIZEOF_LONG;
-#endif /* MEM_CHECK */
-
-
- p = (gpointer) malloc (size);
- if (!p)
- g_error ("could not allocate %ld bytes", size);
-
-
-#ifdef MEM_CHECK
- size -= SIZEOF_LONG;
-
- t = p;
- p = ((guchar*) p + SIZEOF_LONG);
- *t = 0;
-#endif /* MEM_CHECK */
-
-#if defined(MEM_PROFILE) || defined(MEM_CHECK)
- size -= SIZEOF_LONG;
-
- t = p;
- p = ((guchar*) p + SIZEOF_LONG);
- *t = size;
-
-#ifdef MEM_PROFILE
- if (size <= 4095)
- allocations[size-1] += 1;
- else
- allocations[4095] += 1;
- allocated_mem += size;
-#endif /* MEM_PROFILE */
-#endif /* MEM_PROFILE || MEM_CHECK */
-
-
- return p;
-}
-
-gpointer
-g_malloc0 (gulong size)
-{
- gpointer p;
-
-
-#if defined(MEM_PROFILE) || defined(MEM_CHECK)
- gulong *t;
-#endif /* MEM_PROFILE || MEM_CHECK */
-
-
- if (size == 0)
- return NULL;
-
-
-#ifdef MEM_PROFILE
- size += SIZEOF_LONG;
-#endif /* MEM_PROFILE */
-
-#ifdef MEM_CHECK
- size += SIZEOF_LONG;
-#endif /* MEM_CHECK */
-
-
- p = (gpointer) calloc (size, 1);
- if (!p)
- g_error ("could not allocate %ld bytes", size);
-
-
-#ifdef MEM_CHECK
- size -= SIZEOF_LONG;
-
- t = p;
- p = ((guchar*) p + SIZEOF_LONG);
- *t = 0;
-#endif /* MEM_CHECK */
-
-#if defined(MEM_PROFILE) || defined(MEM_CHECK)
- size -= SIZEOF_LONG;
-
- t = p;
- p = ((guchar*) p + SIZEOF_LONG);
- *t = size;
-
-#ifdef MEM_PROFILE
- if (size <= 4095)
- allocations[size-1] += 1;
- else
- allocations[4095] += 1;
- allocated_mem += size;
-#endif /* MEM_PROFILE */
-#endif /* MEM_PROFILE */
-
-
- return p;
-}
-
-gpointer
-g_realloc (gpointer mem,
- gulong size)
-{
- gpointer p;
-
-#if defined(MEM_PROFILE) || defined(MEM_CHECK)
- gulong *t;
-#endif /* MEM_PROFILE || MEM_CHECK */
-
-
- if (size == 0)
- return NULL;
-
-
-#if defined(MEM_PROFILE) || defined(MEM_CHECK)
- size += SIZEOF_LONG;
-#endif /* MEM_PROFILE || MEM_CHECK */
-
-#ifdef MEM_CHECK
- size += SIZEOF_LONG;
-#endif /* MEM_CHECK */
-
-
- if (!mem)
- p = (gpointer) malloc (size);
- else
- {
-#if defined(MEM_PROFILE) || defined(MEM_CHECK)
- t = (gulong*) ((guchar*) mem - SIZEOF_LONG);
-#ifdef MEM_PROFILE
- freed_mem += *t;
-#endif /* MEM_PROFILE */
- mem = t;
-#endif /* MEM_PROFILE || MEM_CHECK */
-
-#ifdef MEM_CHECK
- t = (gulong*) ((guchar*) mem - SIZEOF_LONG);
- if (*t >= 1)
- g_warning ("trying to realloc freed memory\n");
- mem = t;
-#endif /* MEM_CHECK */
-
- p = (gpointer) realloc (mem, size);
- }
-
- if (!p)
- g_error ("could not reallocate %ld bytes", size);
-
-
-#ifdef MEM_CHECK
- size -= SIZEOF_LONG;
-
- t = p;
- p = ((guchar*) p + SIZEOF_LONG);
- *t = 0;
-#endif /* MEM_CHECK */
-
-#if defined(MEM_PROFILE) || defined(MEM_CHECK)
- size -= SIZEOF_LONG;
-
- t = p;
- p = ((guchar*) p + SIZEOF_LONG);
- *t = size;
-
-#ifdef MEM_PROFILE
- if (size <= 4095)
- allocations[size-1] += 1;
- else
- allocations[4095] += 1;
- allocated_mem += size;
-#endif /* MEM_PROFILE */
-#endif /* MEM_PROFILE || MEM_CHECK */
-
-
- return p;
-}
-
-void
-g_free (gpointer mem)
-{
- if (mem)
- {
-#if defined(MEM_PROFILE) || defined(MEM_CHECK)
- gulong *t;
- gulong size;
-#endif /* MEM_PROFILE || MEM_CHECK */
-
-#if defined(MEM_PROFILE) || defined(MEM_CHECK)
- t = (gulong*) ((guchar*) mem - SIZEOF_LONG);
- size = *t;
-#ifdef MEM_PROFILE
- freed_mem += size;
-#endif /* MEM_PROFILE */
- mem = t;
-#endif /* MEM_PROFILE || MEM_CHECK */
-
-#ifdef MEM_CHECK
- t = (gulong*) ((guchar*) mem - SIZEOF_LONG);
- if (*t >= 1)
- g_warning ("freeing previously freed memory\n");
- *t += 1;
- mem = t;
-
- memset ((guchar*) mem + 8, 0, size);
-#else /* MEM_CHECK */
- free (mem);
-#endif /* MEM_CHECK */
- }
-}
-
-#endif /* ! USE_DMALLOC */
-
-
-void
-g_mem_profile ()
-{
-#ifdef MEM_PROFILE
- gint i;
-
- for (i = 0; i < 4095; i++)
- if (allocations[i] > 0)
- g_print ("%lu allocations of %d bytes\n", allocations[i], i + 1);
-
- if (allocations[4095] > 0)
- g_print ("%lu allocations of greater than 4095 bytes\n", allocations[4095]);
- g_print ("%lu bytes allocated\n", allocated_mem);
- g_print ("%lu bytes freed\n", freed_mem);
- g_print ("%lu bytes in use\n", allocated_mem - freed_mem);
-#endif /* MEM_PROFILE */
-}
-
-void
-g_mem_check (gpointer mem)
-{
-#ifdef MEM_CHECK
- gulong *t;
-
- t = (gulong*) ((guchar*) mem - SIZEOF_LONG - SIZEOF_LONG);
-
- if (*t >= 1)
- g_warning ("mem: 0x%08x has been freed: %lu\n", (gulong) mem, *t);
-#endif /* MEM_CHECK */
-}
-
-GMemChunk*
-g_mem_chunk_new (gchar *name,
- gint atom_size,
- gulong area_size,
- gint type)
-{
- GRealMemChunk *mem_chunk;
- gulong rarea_size;
-
- mem_chunk = g_new (struct _GRealMemChunk, 1);
- mem_chunk->name = name;
- mem_chunk->type = type;
- mem_chunk->num_mem_areas = 0;
- mem_chunk->num_marked_areas = 0;
- mem_chunk->mem_area = NULL;
- mem_chunk->free_mem_area = NULL;
- mem_chunk->free_atoms = NULL;
- mem_chunk->mem_tree = NULL;
- mem_chunk->mem_areas = NULL;
- mem_chunk->atom_size = atom_size;
-
- if (mem_chunk->type == G_ALLOC_AND_FREE)
- mem_chunk->mem_tree = g_tree_new ((GCompareFunc) g_mem_chunk_area_compare);
-
- if (mem_chunk->atom_size % MEM_ALIGN)
- mem_chunk->atom_size += MEM_ALIGN - (mem_chunk->atom_size % MEM_ALIGN);
-
- mem_chunk->area_size = area_size;
- if (mem_chunk->area_size > MAX_MEM_AREA)
- mem_chunk->area_size = MAX_MEM_AREA;
- while (mem_chunk->area_size < mem_chunk->atom_size)
- mem_chunk->area_size *= 2;
-
- rarea_size = mem_chunk->area_size + sizeof (GMemArea) - MEM_AREA_SIZE;
- rarea_size = g_mem_chunk_compute_size (rarea_size);
- mem_chunk->area_size = rarea_size - (sizeof (GMemArea) - MEM_AREA_SIZE);
-
- /*
- mem_chunk->area_size -= (sizeof (GMemArea) - MEM_AREA_SIZE);
- if (mem_chunk->area_size < mem_chunk->atom_size)
- {
- mem_chunk->area_size = (mem_chunk->area_size + sizeof (GMemArea) - MEM_AREA_SIZE) * 2;
- mem_chunk->area_size -= (sizeof (GMemArea) - MEM_AREA_SIZE);
- }
-
- if (mem_chunk->area_size % mem_chunk->atom_size)
- mem_chunk->area_size += mem_chunk->atom_size - (mem_chunk->area_size % mem_chunk->atom_size);
- */
-
- mem_chunk->next = mem_chunks;
- mem_chunk->prev = NULL;
- if (mem_chunks)
- mem_chunks->prev = mem_chunk;
- mem_chunks = mem_chunk;
-
- return ((GMemChunk*) mem_chunk);
-}
-
-void
-g_mem_chunk_destroy (GMemChunk *mem_chunk)
-{
- GRealMemChunk *rmem_chunk;
- GMemArea *mem_areas;
- GMemArea *temp_area;
-
- g_assert (mem_chunk != NULL);
-
- rmem_chunk = (GRealMemChunk*) mem_chunk;
-
- mem_areas = rmem_chunk->mem_areas;
- while (mem_areas)
- {
- temp_area = mem_areas;
- mem_areas = mem_areas->next;
- g_free (temp_area);
- }
-
- if (rmem_chunk->next)
- rmem_chunk->next->prev = rmem_chunk->prev;
- if (rmem_chunk->prev)
- rmem_chunk->prev->next = rmem_chunk->next;
-
- if (rmem_chunk == mem_chunks)
- mem_chunks = mem_chunks->next;
-
- if (rmem_chunk->type == G_ALLOC_AND_FREE)
- g_tree_destroy (rmem_chunk->mem_tree);
-
- g_free (rmem_chunk);
-}
-
-gpointer
-g_mem_chunk_alloc (GMemChunk *mem_chunk)
-{
- GRealMemChunk *rmem_chunk;
- GMemArea *temp_area;
- gpointer mem;
-
- g_assert (mem_chunk != NULL);
-
- rmem_chunk = (GRealMemChunk*) mem_chunk;
-
- while (rmem_chunk->free_atoms)
- {
- /* Get the first piece of memory on the "free_atoms" list.
- * We can go ahead and destroy the list node we used to keep
- * track of it with and to update the "free_atoms" list to
- * point to its next element.
- */
- mem = rmem_chunk->free_atoms;
- rmem_chunk->free_atoms = rmem_chunk->free_atoms->next;
-
- /* Determine which area this piece of memory is allocated from */
- temp_area = g_tree_search (rmem_chunk->mem_tree,
- (GSearchFunc) g_mem_chunk_area_search,
- mem);
-
- /* If the area has been marked, then it is being destroyed.
- * (ie marked to be destroyed).
- * We check to see if all of the segments on the free list that
- * reference this area have been removed. This occurs when
- * the ammount of free memory is less than the allocatable size.
- * If the chunk should be freed, then we place it in the "free_mem_area".
- * This is so we make sure not to free the mem area here and then
- * allocate it again a few lines down.
- * If we don't allocate a chunk a few lines down then the "free_mem_area"
- * will be freed.
- * If there is already a "free_mem_area" then we'll just free this mem area.
- */
- if (temp_area->mark)
- {
- /* Update the "free" memory available in that area */
- temp_area->free += rmem_chunk->atom_size;
-
- if (temp_area->free == rmem_chunk->area_size)
- {
- if (temp_area == rmem_chunk->mem_area)
- rmem_chunk->mem_area = NULL;
-
- if (rmem_chunk->free_mem_area)
- {
- rmem_chunk->num_mem_areas -= 1;
- rmem_chunk->num_marked_areas -= 1;
-
- if (temp_area->next)
- temp_area->next->prev = temp_area->prev;
- if (temp_area->prev)
- temp_area->prev->next = temp_area->next;
- if (temp_area == rmem_chunk->mem_areas)
- rmem_chunk->mem_areas = rmem_chunk->mem_areas->next;
- if (temp_area == rmem_chunk->mem_area)
- rmem_chunk->mem_area = NULL;
-
- g_free (temp_area);
- }
- else
- rmem_chunk->free_mem_area = temp_area;
- }
- }
- else
- {
- /* Update the number of allocated atoms count.
- */
- temp_area->allocated += 1;
-
- /* The area wasn't marked...return the memory
- */
- goto outa_here;
- }
- }
-
- /* If there isn't a current mem area or the current mem area is out of space
- * then allocate a new mem area. We'll first check and see if we can use
- * the "free_mem_area". Otherwise we'll just malloc the mem area.
- */
- if ((!rmem_chunk->mem_area) ||
- ((rmem_chunk->mem_area->index + rmem_chunk->atom_size) > rmem_chunk->area_size))
- {
- if (rmem_chunk->free_mem_area)
- {
- rmem_chunk->mem_area = rmem_chunk->free_mem_area;
- rmem_chunk->free_mem_area = NULL;
- }
- else
- {
- rmem_chunk->mem_area = (GMemArea*) g_malloc (sizeof (GMemArea) -
- MEM_AREA_SIZE +
- rmem_chunk->area_size);
-
- rmem_chunk->num_mem_areas += 1;
- rmem_chunk->mem_area->next = rmem_chunk->mem_areas;
- rmem_chunk->mem_area->prev = NULL;
-
- if (rmem_chunk->mem_areas)
- rmem_chunk->mem_areas->prev = rmem_chunk->mem_area;
- rmem_chunk->mem_areas = rmem_chunk->mem_area;
-
- if (rmem_chunk->type == G_ALLOC_AND_FREE)
- g_tree_insert (rmem_chunk->mem_tree, rmem_chunk->mem_area, rmem_chunk->mem_area);
- }
-
- rmem_chunk->mem_area->index = 0;
- rmem_chunk->mem_area->free = rmem_chunk->area_size;
- rmem_chunk->mem_area->allocated = 0;
- rmem_chunk->mem_area->mark = 0;
- }
- else if (rmem_chunk->free_mem_area)
- {
- rmem_chunk->num_mem_areas -= 1;
-
- if (rmem_chunk->free_mem_area->next)
- rmem_chunk->free_mem_area->next->prev = rmem_chunk->free_mem_area->prev;
- if (rmem_chunk->free_mem_area->prev)
- rmem_chunk->free_mem_area->prev->next = rmem_chunk->free_mem_area->next;
- if (rmem_chunk->free_mem_area == rmem_chunk->mem_areas)
- rmem_chunk->mem_areas = rmem_chunk->mem_areas->next;
-
- if (rmem_chunk->type == G_ALLOC_AND_FREE)
- g_tree_remove (rmem_chunk->mem_tree, rmem_chunk->free_mem_area);
-
- g_free (rmem_chunk->free_mem_area);
- rmem_chunk->free_mem_area = NULL;
- }
-
- /* Get the memory and modify the state variables appropriately.
- */
- mem = (gpointer) &rmem_chunk->mem_area->mem[rmem_chunk->mem_area->index];
- rmem_chunk->mem_area->index += rmem_chunk->atom_size;
- rmem_chunk->mem_area->free -= rmem_chunk->atom_size;
- rmem_chunk->mem_area->allocated += 1;
-
-outa_here:
- return mem;
-}
-
-void
-g_mem_chunk_free (GMemChunk *mem_chunk,
- gpointer mem)
-{
- GRealMemChunk *rmem_chunk;
- GMemArea *temp_area;
- GFreeAtom *free_atom;
-
- g_assert (mem_chunk != NULL);
- g_assert (mem != NULL);
-
- rmem_chunk = (GRealMemChunk*) mem_chunk;
-
- /* Don't do anything if this is an ALLOC_ONLY chunk
- */
- if (rmem_chunk->type == G_ALLOC_AND_FREE)
- {
- /* Place the memory on the "free_atoms" list
- */
- free_atom = (GFreeAtom*) mem;
- free_atom->next = rmem_chunk->free_atoms;
- rmem_chunk->free_atoms = free_atom;
-
- temp_area = g_tree_search (rmem_chunk->mem_tree,
- (GSearchFunc) g_mem_chunk_area_search,
- mem);
-
- temp_area->allocated -= 1;
-
- if (temp_area->allocated == 0)
- {
- temp_area->mark = 1;
- rmem_chunk->num_marked_areas += 1;
-
- g_mem_chunk_clean (mem_chunk);
- }
- }
-}
-
-void
-g_mem_chunk_clean (GMemChunk *mem_chunk)
-{
- GRealMemChunk *rmem_chunk;
- GMemArea *mem_area;
- GFreeAtom *prev_free_atom;
- GFreeAtom *temp_free_atom;
- gpointer mem;
-
- g_assert (mem_chunk != NULL);
-
- rmem_chunk = (GRealMemChunk*) mem_chunk;
-
- if (rmem_chunk->type == G_ALLOC_AND_FREE)
- {
- prev_free_atom = NULL;
- temp_free_atom = rmem_chunk->free_atoms;
-
- while (temp_free_atom)
- {
- mem = (gpointer) temp_free_atom;
-
- mem_area = g_tree_search (rmem_chunk->mem_tree,
- (GSearchFunc) g_mem_chunk_area_search,
- mem);
-
- /* If this mem area is marked for destruction then delete the
- * area and list node and decrement the free mem.
- */
- if (mem_area->mark)
- {
- if (prev_free_atom)
- prev_free_atom->next = temp_free_atom->next;
- else
- rmem_chunk->free_atoms = temp_free_atom->next;
- temp_free_atom = temp_free_atom->next;
-
- mem_area->free += rmem_chunk->atom_size;
- if (mem_area->free == rmem_chunk->area_size)
- {
- rmem_chunk->num_mem_areas -= 1;
- rmem_chunk->num_marked_areas -= 1;
-
- if (mem_area->next)
- mem_area->next->prev = mem_area->prev;
- if (mem_area->prev)
- mem_area->prev->next = mem_area->next;
- if (mem_area == rmem_chunk->mem_areas)
- rmem_chunk->mem_areas = rmem_chunk->mem_areas->next;
- if (mem_area == rmem_chunk->mem_area)
- rmem_chunk->mem_area = NULL;
-
- if (rmem_chunk->type == G_ALLOC_AND_FREE)
- g_tree_remove (rmem_chunk->mem_tree, mem_area);
- g_free (mem_area);
- }
- }
- else
- {
- prev_free_atom = temp_free_atom;
- temp_free_atom = temp_free_atom->next;
- }
- }
- }
-}
-
-void
-g_mem_chunk_reset (GMemChunk *mem_chunk)
-{
- GRealMemChunk *rmem_chunk;
- GMemArea *mem_areas;
- GMemArea *temp_area;
-
- g_assert (mem_chunk != NULL);
-
- rmem_chunk = (GRealMemChunk*) mem_chunk;
-
- mem_areas = rmem_chunk->mem_areas;
- rmem_chunk->num_mem_areas = 0;
- rmem_chunk->mem_areas = NULL;
- rmem_chunk->mem_area = NULL;
-
- while (mem_areas)
- {
- temp_area = mem_areas;
- mem_areas = mem_areas->next;
- g_free (temp_area);
- }
-
- rmem_chunk->free_atoms = NULL;
-
- if (rmem_chunk->mem_tree)
- g_tree_destroy (rmem_chunk->mem_tree);
- rmem_chunk->mem_tree = g_tree_new ((GCompareFunc) g_mem_chunk_area_compare);
-}
-
-void
-g_mem_chunk_print (GMemChunk *mem_chunk)
-{
- GRealMemChunk *rmem_chunk;
- GMemArea *mem_areas;
- gulong mem;
-
- g_assert (mem_chunk != NULL);
-
- rmem_chunk = (GRealMemChunk*) mem_chunk;
- mem_areas = rmem_chunk->mem_areas;
- mem = 0;
-
- while (mem_areas)
- {
- mem += rmem_chunk->area_size - mem_areas->free;
- mem_areas = mem_areas->next;
- }
-
- g_print ("%s: %ld bytes using %d mem areas", rmem_chunk->name, mem, rmem_chunk->num_mem_areas);
-}
-
-void
-g_mem_chunk_info ()
-{
- GRealMemChunk *mem_chunk;
- gint count;
-
- count = 0;
- mem_chunk = mem_chunks;
- while (mem_chunk)
- {
- count += 1;
- mem_chunk = mem_chunk->next;
- }
-
- g_print ("%d mem chunks", count);
-
- mem_chunk = mem_chunks;
- while (mem_chunk)
- {
- g_mem_chunk_print ((GMemChunk*) mem_chunk);
- mem_chunk = mem_chunk->next;
- }
-}
-
-void
-g_blow_chunks ()
-{
- GRealMemChunk *mem_chunk;
-
- mem_chunk = mem_chunks;
- while (mem_chunk)
- {
- g_mem_chunk_clean ((GMemChunk*) mem_chunk);
- mem_chunk = mem_chunk->next;
- }
-}
-
-
-static gulong
-g_mem_chunk_compute_size (gulong size)
-{
- gulong power_of_2;
- gulong lower, upper;
-
- power_of_2 = 16;
- while (power_of_2 < size)
- power_of_2 <<= 1;
-
- lower = power_of_2 >> 1;
- upper = power_of_2;
-
- if ((size - lower) < (upper - size))
- return lower;
- return upper;
-}
-
-static gint
-g_mem_chunk_area_compare (GMemArea *a,
- GMemArea *b)
-{
- return (a->mem - b->mem);
-}
-
-static gint
-g_mem_chunk_area_search (GMemArea *a,
- gchar *addr)
-{
- if (a->mem <= addr)
- {
- if (addr < &a->mem[a->index])
- return 0;
- return 1;
- }
- return -1;
-}
diff --git a/glib/gprimes.c b/glib/gprimes.c
deleted file mode 100644
index 8887c0e660..0000000000
--- a/glib/gprimes.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* GLIB - Library of useful routines for C programming
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "glib.h"
-
-
-gint g_primes[] =
-{
- 11,
- 15,
- 23,
- 35,
- 49,
- 73,
- 109,
- 163,
- 251,
- 367,
- 557,
- 823,
- 1237,
- 1861,
- 2777,
- 4177,
- 6247,
- 9371,
- 14057,
- 21089,
- 31627,
- 47431,
- 71143,
- 106721,
- 160073,
- 240101,
- 360163,
- 540217,
- 810343,
- 1215497,
- 1823231,
- 2734867,
- 4102283,
- 6153409,
- 9230113,
- 13845163,
-};
-
-gint g_nprimes = sizeof (g_primes) / sizeof (g_primes[0]);
diff --git a/glib/gscanner.c b/glib/gscanner.c
deleted file mode 100644
index 662cf16338..0000000000
--- a/glib/gscanner.c
+++ /dev/null
@@ -1,1146 +0,0 @@
-/* GLIB - Library of useful routines for C programming
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * GScanner: Flexible lexical scanner for general purpose.
- * Copyright (C) 1997 Tim Janik
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#define __gscanner_c__
-
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include "glib.h"
-
-
-
-/* --- defines --- */
-#define to_lower(c) ( \
- (guchar) ( \
- ( (((guchar)(c))>='A' && ((guchar)(c))<='Z') * ('a'-'A') ) + \
- ( (((guchar)(c))>=192 && ((guchar)(c))<=214) * (224-192) ) + \
- ( (((guchar)(c))>=216 && ((guchar)(c))<=222) * (248-216) ) + \
- ((guchar)(c)) \
- ) \
-)
-
-
-/* --- typedefs --- */
-typedef struct _GScannerHashVal GScannerHashVal;
-
-struct _GScannerHashVal
-{
- gchar *key;
- gpointer value;
-};
-
-
-
-/* --- variables --- */
-static GScannerConfig g_scanner_config_template =
-{
- (
- " \t\n"
- ) /* cset_skip_characters */,
- (
- G_CSET_a_2_z
- "_"
- G_CSET_A_2_Z
- ) /* cset_identifier_first */,
- (
- G_CSET_a_2_z
- "_0123456789"
- G_CSET_A_2_Z
- G_CSET_LATINS
- G_CSET_LATINC
- ) /* cset_identifier_nth */,
- ( "#\n" ) /* cpair_comment_single */,
-
- FALSE /* case_sensitive */,
-
- TRUE /* skip_comment_multi */,
- TRUE /* skip_comment_single */,
- TRUE /* scan_comment_multi */,
- TRUE /* scan_identifier */,
- FALSE /* scan_identifier_1char */,
- FALSE /* scan_identifier_NULL */,
- TRUE /* scan_symbols */,
- FALSE /* scan_binary */,
- TRUE /* scan_octal */,
- TRUE /* scan_float */,
- TRUE /* scan_hex */,
- FALSE /* scan_hex_dollar */,
- TRUE /* scan_string_sq */,
- TRUE /* scan_string_dq */,
- TRUE /* numbers_2_int */,
- FALSE /* int_2_float */,
- FALSE /* identifier_2_string */,
- TRUE /* char_2_token */,
- FALSE /* symbol_2_token */,
-};
-
-
-/* --- prototypes --- */
-static GScannerHashVal* g_scanner_lookup_internal (GScanner *scanner,
- const gchar *symbol);
-static void g_scanner_get_token_ll (GScanner *scanner,
- GTokenType *token_p,
- GValue *value_p,
- guint *line_p,
- guint *position_p);
-static void g_scanner_get_token_i (GScanner *scanner,
- GTokenType *token_p,
- GValue *value_p,
- guint *line_p,
- guint *position_p);
-static void g_scanner_free_value (GTokenType *token_p,
- GValue *value_p);
-
-static inline
-gint g_scanner_char_2_num (guchar c,
- guchar base);
-static guchar g_scanner_peek_next_char(GScanner *scanner);
-static guchar g_scanner_get_char (GScanner *scanner,
- guint *line_p,
- guint *position_p);
-
-
-/* --- functions --- */
-static gint
-g_scanner_char_2_num (guchar c,
- guchar base)
-{
- if (c >= '0' && c <= '9')
- c -= '0';
- else if (c >= 'A' && c <= 'Z')
- c -= 'A' - 10;
- else if (c >= 'a' && c <= 'z')
- c -= 'a' - 10;
- else
- return -1;
-
- if (c < base)
- return c;
-
- return -1;
-}
-
-GScanner*
-g_scanner_new (GScannerConfig *config_templ)
-{
- register GScanner *scanner;
-
- if (!config_templ)
- config_templ = &g_scanner_config_template;
-
- scanner = g_new0 (GScanner, 1);
-
- scanner->user_data = NULL;
- scanner->input_name = NULL;
- scanner->parse_errors = 0;
- scanner->max_parse_errors = 0;
-
- scanner->config = g_new0 (GScannerConfig, 1);
-
- scanner->config->case_sensitive = config_templ->case_sensitive;
- scanner->config->cset_skip_characters = config_templ->cset_skip_characters;
- scanner->config->cset_identifier_first= config_templ->cset_identifier_first;
- scanner->config->cset_identifier_nth = config_templ->cset_identifier_nth;
- scanner->config->cpair_comment_single = config_templ->cpair_comment_single;
- scanner->config->skip_comment_multi = config_templ->skip_comment_multi;
- scanner->config->skip_comment_single = config_templ->skip_comment_single;
- scanner->config->scan_comment_multi = config_templ->scan_comment_multi;
- scanner->config->scan_identifier = config_templ->scan_identifier;
- scanner->config->scan_identifier_1char= config_templ->scan_identifier_1char;
- scanner->config->scan_identifier_NULL = config_templ->scan_identifier_NULL;
- scanner->config->scan_symbols = config_templ->scan_symbols;
- scanner->config->scan_binary = config_templ->scan_binary;
- scanner->config->scan_octal = config_templ->scan_octal;
- scanner->config->scan_float = config_templ->scan_float;
- scanner->config->scan_hex = config_templ->scan_hex;
- scanner->config->scan_hex_dollar = config_templ->scan_hex_dollar;
- scanner->config->scan_string_sq = config_templ->scan_string_sq;
- scanner->config->scan_string_dq = config_templ->scan_string_dq;
- scanner->config->numbers_2_int = config_templ->numbers_2_int;
- scanner->config->int_2_float = config_templ->int_2_float;
- scanner->config->identifier_2_string = config_templ->identifier_2_string;
- scanner->config->char_2_token = config_templ->char_2_token;
- scanner->config->symbol_2_token = config_templ->symbol_2_token;
-
- scanner->token = G_TOKEN_NONE;
- scanner->value.v_int = 0;
- scanner->line = 1;
- scanner->position = 0;
-
- scanner->next_token = G_TOKEN_NONE;
- scanner->next_value.v_int = 0;
- scanner->next_line = 1;
- scanner->next_position = 0;
-
- scanner->symbol_table = g_hash_table_new (g_str_hash, g_str_equal);
- scanner->text = NULL;
- scanner->text_len = 0;
- scanner->input_fd = -1;
- scanner->peeked_char = -1;
-
- return scanner;
-}
-
-static void
-g_scanner_destroy_symbol_table_entry (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- g_free (key);
- g_free (value);
-}
-
-void
-g_scanner_destroy (GScanner *scanner)
-{
- g_return_if_fail (scanner != NULL);
-
- g_hash_table_foreach (scanner->symbol_table,
- g_scanner_destroy_symbol_table_entry, NULL);
- g_hash_table_destroy (scanner->symbol_table);
- g_scanner_free_value (&scanner->token, &scanner->value);
- g_scanner_free_value (&scanner->next_token, &scanner->next_value);
- g_free (scanner->config);
- g_free (scanner);
-}
-
-void
-g_scanner_input_file (GScanner *scanner,
- gint input_fd)
-{
- g_return_if_fail (input_fd >= 0);
-
- scanner->token = G_TOKEN_NONE;
- scanner->value.v_int = 0;
- scanner->line = 1;
- scanner->position = 0;
- scanner->next_token = G_TOKEN_NONE;
-
- scanner->text = NULL;
- scanner->text_len = 0;
- scanner->input_fd = input_fd;
- scanner->peeked_char = -1;
-}
-
-void
-g_scanner_input_text (GScanner *scanner,
- const gchar *text,
- guint text_len)
-{
- g_return_if_fail (text != NULL);
-
- scanner->token = G_TOKEN_NONE;
- scanner->value.v_int = 0;
- scanner->line = 1;
- scanner->position = 0;
- scanner->next_token = G_TOKEN_NONE;
-
- scanner->text = text;
- scanner->text_len = text_len;
- scanner->input_fd = -1;
- scanner->peeked_char = -1;
-}
-
-void
-g_scanner_add_symbol (GScanner *scanner,
- const gchar *symbol,
- gpointer value)
-{
- register GScannerHashVal *hash_val;
-
- g_return_if_fail (symbol != NULL);
- g_return_if_fail (scanner != NULL);
-
- hash_val = g_scanner_lookup_internal (scanner, symbol);
-
- if (!hash_val)
- {
- hash_val = g_new (GScannerHashVal, 1);
- hash_val->key = g_strdup (symbol);
- hash_val->value = value;
- if (!scanner->config->case_sensitive)
- {
- register guint i, l;
-
- l = strlen (hash_val->key);
- for (i = 0; i < l; i++)
- hash_val->key[i] = to_lower (hash_val->key[i]);
- }
- g_hash_table_insert (scanner->symbol_table, hash_val->key, hash_val);
- }
- else
- hash_val->value = value;
-}
-
-gpointer
-g_scanner_lookup_symbol (GScanner *scanner,
- const gchar *symbol)
-{
- register GScannerHashVal *hash_val;
-
- g_return_val_if_fail (scanner != NULL, NULL);
-
- if (!symbol)
- return NULL;
-
- hash_val = g_scanner_lookup_internal (scanner, symbol);
-
- if (hash_val)
- return hash_val->value;
- else
- return NULL;
-}
-
-void
-g_scanner_remove_symbol (GScanner *scanner,
- const gchar *symbol)
-{
- register GScannerHashVal *hash_val;
-
- hash_val = g_scanner_lookup_internal (scanner, symbol);
-
- if (hash_val)
- {
- g_hash_table_remove (scanner->symbol_table, hash_val->key);
- g_free (hash_val->key);
- g_free (hash_val);
- }
-}
-
-GTokenType
-g_scanner_peek_next_token (GScanner *scanner)
-{
- g_return_val_if_fail (scanner != NULL, G_TOKEN_EOF);
-
- if (scanner->next_token == G_TOKEN_NONE)
- {
- scanner->next_line = scanner->line;
- scanner->next_position = scanner->position;
- g_scanner_get_token_i (scanner,
- &scanner->next_token,
- &scanner->next_value,
- &scanner->next_line,
- &scanner->next_position);
- }
-
- return scanner->next_token;
-}
-
-GTokenType
-g_scanner_get_next_token (GScanner *scanner)
-{
- g_return_val_if_fail (scanner != NULL, G_TOKEN_EOF);
-
- if (scanner->next_token != G_TOKEN_NONE)
- {
- g_scanner_free_value (&scanner->token, &scanner->value);
-
- scanner->token = scanner->next_token;
- scanner->value = scanner->next_value;
- scanner->line = scanner->next_line;
- scanner->position = scanner->next_position;
- scanner->next_token = G_TOKEN_NONE;
- }
- else
- g_scanner_get_token_i (scanner,
- &scanner->token,
- &scanner->value,
- &scanner->line,
- &scanner->position);
-
- return scanner->token;
-}
-
-GTokenType
-g_scanner_cur_token (GScanner *scanner)
-{
- g_return_val_if_fail (scanner != NULL, G_TOKEN_EOF);
-
- return scanner->token;
-}
-
-GValue
-g_scanner_cur_value (GScanner *scanner)
-{
- register GValue v;
-
- v.v_int = 0;
- g_return_val_if_fail (scanner != NULL, v);
-
- return scanner->value;
-}
-
-guint
-g_scanner_cur_line (GScanner *scanner)
-{
- g_return_val_if_fail (scanner != NULL, 0);
-
- return scanner->line;
-}
-
-guint
-g_scanner_cur_position (GScanner *scanner)
-{
- g_return_val_if_fail (scanner != NULL, 0);
-
- return scanner->position;
-}
-
-gboolean
-g_scanner_eof (GScanner *scanner)
-{
- g_return_val_if_fail (scanner != NULL, TRUE);
-
- return scanner->token == G_TOKEN_EOF;
-}
-
-static GScannerHashVal*
-g_scanner_lookup_internal (GScanner *scanner,
- const gchar *symbol)
-{
- register GScannerHashVal *hash_val;
-
- if (!scanner->config->case_sensitive)
- {
- register gchar *buffer;
- register guint i, l;
-
- l = strlen (symbol);
- buffer = g_new (gchar, l + 1);
- for (i = 0; i < l; i++)
- buffer[i] = to_lower (symbol[i]);
- buffer[i] = 0;
- hash_val = g_hash_table_lookup (scanner->symbol_table, buffer);
- g_free (buffer);
- }
- else
- hash_val = g_hash_table_lookup (scanner->symbol_table, (gchar*) symbol);
-
- return hash_val;
-}
-
-static guchar
-g_scanner_peek_next_char (GScanner *scanner)
-{
- guchar fchar;
-
- if (scanner->text_len)
- {
- fchar = scanner->text[0];
- }
- else if (scanner->input_fd >= 0)
- {
- if (scanner->peeked_char < 0)
- {
- register gint count;
-
- do
- {
- count = read (scanner->input_fd, &fchar, 1);
- }
- while (count == -1 &&
- (errno == EINTR ||
- errno == EAGAIN));
-
- if (count != 1)
- fchar = 0;
-
- scanner->peeked_char = fchar;
- }
- else
- fchar = scanner->peeked_char;
- }
- else
- fchar = 0;
-
- return fchar;
-}
-
-static guchar
-g_scanner_get_char (GScanner *scanner,
- guint *line_p,
- guint *position_p)
-{
- guchar fchar;
-
- if (scanner->text_len)
- {
- fchar = *(scanner->text++);
- scanner->text_len--;
- }
- else if (scanner->input_fd >= 0)
- {
- if (scanner->peeked_char < 0)
- {
- register gint count;
-
- do
- {
- count = read (scanner->input_fd, &fchar, 1);
- }
- while (count == -1 &&
- (errno == EINTR ||
- errno == EAGAIN));
- if (count != 1 || fchar == 0)
- {
- fchar = 0;
- scanner->peeked_char = 0;
- }
- }
- else
- {
- fchar = scanner->peeked_char;
- if (fchar)
- scanner->peeked_char = -1;
- }
- }
- else
- fchar = 0;
-
- if (fchar == '\n')
- {
- (*position_p) = 0;
- (*line_p)++;
- }
- else if (fchar)
- {
- (*position_p)++;
- }
-
- return fchar;
-}
-
-static void
-g_scanner_free_value (GTokenType *token_p,
- GValue *value_p)
-{
- switch (*token_p)
- {
- case G_TOKEN_STRING:
- case G_TOKEN_IDENTIFIER:
- case G_TOKEN_IDENTIFIER_NULL:
- case G_TOKEN_COMMENT_SINGLE:
- case G_TOKEN_COMMENT_MULTI:
- g_free (value_p->v_string);
- break;
-
- default:
- break;
- }
-
- *token_p = G_TOKEN_NONE;
-}
-
-static void
-g_scanner_get_token_i (GScanner *scanner,
- GTokenType *token_p,
- GValue *value_p,
- guint *line_p,
- guint *position_p)
-{
- do
- {
- g_scanner_free_value (token_p, value_p);
- g_scanner_get_token_ll (scanner, token_p, value_p, line_p, position_p);
- }
- while (((*token_p > 0 && *token_p < 256) &&
- strchr (scanner->config->cset_skip_characters, *token_p)) ||
- (*token_p == G_TOKEN_CHAR &&
- strchr (scanner->config->cset_skip_characters, value_p->v_char)) ||
- (*token_p == G_TOKEN_COMMENT_MULTI &&
- scanner->config->skip_comment_multi) ||
- (*token_p == G_TOKEN_COMMENT_SINGLE &&
- scanner->config->skip_comment_single));
-
- switch (*token_p)
- {
- case G_TOKEN_IDENTIFIER:
- if (scanner->config->identifier_2_string)
- *token_p = G_TOKEN_STRING;
- break;
-
- case G_TOKEN_SYMBOL:
- if (scanner->config->symbol_2_token)
- *token_p = (GTokenType) value_p->v_symbol;
- break;
-
- case G_TOKEN_BINARY:
- case G_TOKEN_OCTAL:
- case G_TOKEN_HEX:
- if (scanner->config->numbers_2_int)
- *token_p = G_TOKEN_INT;
- break;
-
- default:
- break;
- }
-
- if (*token_p == G_TOKEN_INT &&
- scanner->config->int_2_float)
- {
- *token_p = G_TOKEN_FLOAT;
- value_p->v_float = value_p->v_int;
- }
-
- errno = 0;
-}
-
-static void
-g_scanner_get_token_ll (GScanner *scanner,
- GTokenType *token_p,
- GValue *value_p,
- guint *line_p,
- guint *position_p)
-{
- register GScannerConfig *config;
- register gboolean in_comment_multi;
- register gboolean in_comment_single;
- register gboolean in_string_sq;
- register gboolean in_string_dq;
- static guchar ch;
- register GTokenType token;
- register GValue value;
- register GString *gstring;
-
- config = scanner->config;
- (*value_p).v_int = 0;
-
- if (scanner->token == G_TOKEN_EOF ||
- (!scanner->text_len &&
- (scanner->input_fd < 0 ||
- scanner->peeked_char == 0)))
- {
- *token_p = G_TOKEN_EOF;
- return;
- }
-
- in_comment_multi = FALSE;
- in_comment_single = FALSE;
- in_string_sq = FALSE;
- in_string_dq = FALSE;
- gstring = NULL;
-
- do
- {
- ch = g_scanner_get_char (scanner, line_p, position_p);
-
- value.v_int = 0;
- token = G_TOKEN_NONE;
-
- /* this is *evil*, but needed ;(
- * we first check for identifier first character, because it
- * might interfere with other key chars like slashes or numbers
- */
- if (config->scan_identifier &&
- ch && strchr (config->cset_identifier_first, ch))
- goto identifier_precedence;
-
- switch (ch)
- {
- register gboolean in_number;
- static gchar *endptr;
-
- case 0:
- token = G_TOKEN_EOF;
- (*position_p)++;
- ch = 0;
- break;
-
- case '/':
- if (!config->scan_comment_multi ||
- g_scanner_peek_next_char (scanner) != '*')
- goto default_case;
- g_scanner_get_char (scanner, line_p, position_p);
- token = G_TOKEN_COMMENT_MULTI;
- in_comment_multi = TRUE;
- gstring = g_string_new ("");
- while ((ch = g_scanner_get_char (scanner, line_p, position_p)) != 0)
- {
- if (ch == '*' && g_scanner_peek_next_char (scanner) == '/')
- {
- g_scanner_get_char (scanner, line_p, position_p);
- in_comment_multi = FALSE;
- break;
- }
- else
- gstring = g_string_append_c (gstring, ch);
- }
- ch = 0;
- break;
-
- case '\'':
- if (!config->scan_string_sq)
- goto default_case;
- token = G_TOKEN_STRING;
- in_string_sq = TRUE;
- gstring = g_string_new ("");
- while ((ch = g_scanner_get_char (scanner, line_p, position_p)) != 0)
- {
- if (ch == '\'')
- {
- in_string_sq = FALSE;
- break;
- }
- else
- gstring = g_string_append_c (gstring, ch);
- }
- ch = 0;
- break;
-
- case '"':
- if (!config->scan_string_dq)
- goto default_case;
- token = G_TOKEN_STRING;
- in_string_dq = TRUE;
- gstring = g_string_new ("");
- while ((ch = g_scanner_get_char (scanner, line_p, position_p)) != 0)
- {
- if (ch == '"')
- {
- in_string_dq = FALSE;
- break;
- }
- else
- {
- if (ch == '\\')
- {
- ch = g_scanner_get_char (scanner, line_p, position_p);
- switch (ch)
- {
- register guint i;
- register guint fchar;
-
- case 0:
- break;
-
- case '\\':
- gstring = g_string_append_c (gstring, '\\');
- break;
-
- case 'n':
- gstring = g_string_append_c (gstring, '\n');
- break;
-
- case 't':
- gstring = g_string_append_c (gstring, '\t');
- break;
-
- case 'r':
- gstring = g_string_append_c (gstring, '\r');
- break;
-
- case 'b':
- gstring = g_string_append_c (gstring, '\b');
- break;
-
- case 'f':
- gstring = g_string_append_c (gstring, '\f');
- break;
-
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- i = ch - '0';
- fchar = g_scanner_peek_next_char (scanner);
- if (fchar >= '0' && fchar <= '7')
- {
- ch = g_scanner_get_char (scanner, line_p, position_p);
- i= i * 8 + ch - '0';
- fchar = g_scanner_peek_next_char (scanner);
- if (fchar >= '0' && fchar <= '7')
- {
- ch = g_scanner_get_char (scanner, line_p, position_p);
- i = i * 8 + ch - '0';
- }
- }
- gstring = g_string_append_c (gstring, i);
- break;
-
- default:
- gstring = g_string_append_c (gstring, ch);
- break;
- }
- }
- else
- gstring = g_string_append_c (gstring, ch);
- }
- }
- ch = 0;
- break;
-
- case '.':
- if (!config->scan_float)
- goto default_case;
- token = G_TOKEN_FLOAT;
- ch = g_scanner_get_char (scanner, line_p, position_p);
- goto number_parsing;
-
- case '$':
- if (!config->scan_hex_dollar)
- goto default_case;
- token = G_TOKEN_HEX;
- ch = g_scanner_get_char (scanner, line_p, position_p);
- goto number_parsing;
-
- case '0':
- if (config->scan_octal)
- token = G_TOKEN_OCTAL;
- else
- token = G_TOKEN_INT;
- ch = g_scanner_peek_next_char (scanner);
- if (config->scan_hex && (ch == 'x' || ch == 'X'))
- {
- token = G_TOKEN_HEX;
- g_scanner_get_char (scanner, line_p, position_p);
- ch = g_scanner_get_char (scanner, line_p, position_p);
- if (ch == 0)
- {
- token = G_TOKEN_ERROR;
- value.v_error = G_ERR_UNEXP_EOF;
- (*position_p)++;
- break;
- }
- if (g_scanner_char_2_num (ch, 16) < 0)
- {
- token = G_TOKEN_ERROR;
- value.v_error = G_ERR_DIGIT_RADIX;
- ch = 0;
- break;
- }
- }
- else if (config->scan_binary && (ch == 'b' || ch == 'B'))
- {
- token = G_TOKEN_BINARY;
- g_scanner_get_char (scanner, line_p, position_p);
- ch = g_scanner_get_char (scanner, line_p, position_p);
- if (ch == 0)
- {
- token = G_TOKEN_ERROR;
- value.v_error = G_ERR_UNEXP_EOF;
- (*position_p)++;
- break;
- }
- if (g_scanner_char_2_num (ch, 10) < 0)
- {
- token = G_TOKEN_ERROR;
- value.v_error = G_ERR_NON_DIGIT_IN_CONST;
- ch = 0;
- break;
- }
- }
- else
- ch = '0';
- /* fall through */
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- number_parsing:
- if (token == G_TOKEN_NONE)
- token = G_TOKEN_INT;
-
- gstring = g_string_new ("");
- gstring = g_string_append_c (gstring, ch);
- in_number = TRUE;
- while (in_number)
- {
- register gboolean is_E;
-
- is_E = (ch == 'e' || ch == 'E') && token == G_TOKEN_FLOAT;
- ch = g_scanner_peek_next_char (scanner);
-
- if (g_scanner_char_2_num (ch, 36) >= 0 ||
- (config->scan_float && ch == '.') ||
- (is_E && ch == '+') ||
- (is_E && ch == '-') )
- ch = g_scanner_get_char (scanner, line_p, position_p);
- else
- in_number = FALSE;
-
- if (in_number)
- switch (ch)
- {
- case '.':
- if (token != G_TOKEN_INT &&
- token != G_TOKEN_OCTAL)
- {
- token = G_TOKEN_ERROR;
- if (token == G_TOKEN_FLOAT)
- value.v_error = G_ERR_FLOAT_MALFORMED;
- else
- value.v_error = G_ERR_FLOAT_RADIX;
- in_number = FALSE;
- }
- else
- {
- token = G_TOKEN_FLOAT;
- gstring = g_string_append_c (gstring, ch);
- }
- break;
-
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- gstring = g_string_append_c (gstring, ch);
- break;
-
- case '-':
- case '+':
- if (token != G_TOKEN_FLOAT)
- {
- token = G_TOKEN_ERROR;
- value.v_error = G_ERR_NON_DIGIT_IN_CONST;
- in_number = FALSE;
- }
- else
- gstring = g_string_append_c (gstring, ch);
- break;
-
- case 'e':
- case 'E':
- if ((token != G_TOKEN_HEX && !config->scan_float) ||
- (token != G_TOKEN_HEX &&
- token != G_TOKEN_OCTAL &&
- token != G_TOKEN_FLOAT &&
- token != G_TOKEN_INT))
- {
- token = G_TOKEN_ERROR;
- value.v_error = G_ERR_NON_DIGIT_IN_CONST;
- in_number = FALSE;
- }
- else
- {
- if (token != G_TOKEN_HEX)
- token = G_TOKEN_FLOAT;
- gstring = g_string_append_c (gstring, ch);
- }
- break;
-
- default:
- if (token != G_TOKEN_HEX)
- {
- token = G_TOKEN_ERROR;
- value.v_error = G_ERR_NON_DIGIT_IN_CONST;
- in_number = FALSE;
- }
- else
- gstring = g_string_append_c (gstring, ch);
- break;
- }
- }
- endptr = NULL;
- switch (token)
- {
- case G_TOKEN_BINARY:
- value.v_binary = strtol (gstring->str, &endptr, 2);
- break;
-
- case G_TOKEN_OCTAL:
- value.v_octal = strtol (gstring->str, &endptr, 8);
- break;
-
- case G_TOKEN_INT:
- value.v_int = strtol (gstring->str, &endptr, 10);
- break;
-
- case G_TOKEN_FLOAT:
- value.v_float = g_strtod (gstring->str, &endptr);
- break;
-
- case G_TOKEN_HEX:
- value.v_hex = strtol (gstring->str, &endptr, 16);
- break;
-
- default:
- break;
- }
- if (endptr && *endptr)
- {
- token = G_TOKEN_ERROR;
- if (*endptr == 'e' || *endptr == 'E')
- value.v_error = G_ERR_NON_DIGIT_IN_CONST;
- else
- value.v_error = G_ERR_DIGIT_RADIX;
- }
- g_string_free (gstring, TRUE);
- gstring = NULL;
- ch = 0;
- break;
-
- default:
- default_case:
- if (config->cpair_comment_single &&
- ch == config->cpair_comment_single[0])
- {
- token = G_TOKEN_COMMENT_SINGLE;
- in_comment_single = TRUE;
- gstring = g_string_new ("");
- while ((ch = g_scanner_get_char (scanner,
- line_p,
- position_p)) != 0)
- {
- if (ch == config->cpair_comment_single[1])
- {
- in_comment_single = FALSE;
- ch = 0;
- break;
- }
-
- gstring = g_string_append_c (gstring, ch);
- ch = 0;
- }
- }
- else if (config->scan_identifier && ch &&
- strchr (config->cset_identifier_first, ch))
- {
- identifier_precedence:
-
- if (config->cset_identifier_nth && ch &&
- strchr (config->cset_identifier_nth,
- g_scanner_peek_next_char (scanner)))
- {
- token = G_TOKEN_IDENTIFIER;
- gstring = g_string_new ("");
- gstring = g_string_append_c (gstring, ch);
- do
- {
- ch = g_scanner_get_char (scanner, line_p, position_p);
- gstring = g_string_append_c (gstring, ch);
- ch = g_scanner_peek_next_char (scanner);
- }
- while (ch && strchr (config->cset_identifier_nth, ch));
- ch = 0;
- }
- else if (config->scan_identifier_1char)
- {
- token = G_TOKEN_IDENTIFIER;
- value.v_identifier = g_new0 (gchar, 2);
- value.v_identifier[0] = ch;
- ch = 0;
- }
- }
- if (ch)
- {
- if (config->char_2_token)
- token = ch;
- else
- {
- token = G_TOKEN_CHAR;
- value.v_char = ch;
- }
- ch = 0;
- }
- break;
- }
- g_assert (ch == 0 && token != G_TOKEN_NONE);
- }
- while (ch != 0);
-
- if (in_comment_multi ||
- in_comment_single ||
- in_string_sq ||
- in_string_dq)
- {
- token = G_TOKEN_ERROR;
- if (gstring)
- {
- g_string_free (gstring, TRUE);
- gstring = NULL;
- }
- (*position_p)++;
- if (in_comment_multi || in_comment_single)
- value.v_error = G_ERR_UNEXP_EOF_IN_COMMENT;
- else if (in_string_sq || in_string_dq)
- value.v_error = G_ERR_UNEXP_EOF_IN_STRING;
- }
-
- if (gstring)
- {
- value.v_string = gstring->str;
- g_string_free (gstring, FALSE);
- gstring = NULL;
- }
-
- if (token == G_TOKEN_IDENTIFIER &&
- config->scan_symbols)
- {
- register GScannerHashVal *hash_val;
-
- hash_val = g_scanner_lookup_internal (scanner, value.v_identifier);
-
- if (hash_val)
- {
- g_free (value.v_identifier);
- token = G_TOKEN_SYMBOL;
- value.v_symbol = hash_val->value;
- }
- }
-
- if (token == G_TOKEN_IDENTIFIER &&
- config->scan_identifier_NULL &&
- strlen (value.v_identifier) == 4)
- {
- gchar *null_upper = "NULL";
- gchar *null_lower = "null";
-
- if (scanner->config->case_sensitive)
- {
- if (value.v_identifier[0] == null_upper[0] &&
- value.v_identifier[1] == null_upper[1] &&
- value.v_identifier[2] == null_upper[2] &&
- value.v_identifier[3] == null_upper[3])
- token = G_TOKEN_IDENTIFIER_NULL;
- }
- else
- {
- if ((value.v_identifier[0] == null_upper[0] ||
- value.v_identifier[0] == null_lower[0]) &&
- (value.v_identifier[1] == null_upper[1] ||
- value.v_identifier[1] == null_lower[1]) &&
- (value.v_identifier[2] == null_upper[2] ||
- value.v_identifier[2] == null_lower[2]) &&
- (value.v_identifier[3] == null_upper[3] ||
- value.v_identifier[3] == null_lower[3]))
- token = G_TOKEN_IDENTIFIER_NULL;
- }
- }
-
- *token_p = token;
- *value_p = value;
-}
diff --git a/glib/gslist.c b/glib/gslist.c
deleted file mode 100644
index 5e956cd87c..0000000000
--- a/glib/gslist.c
+++ /dev/null
@@ -1,390 +0,0 @@
-/* GLIB - Library of useful routines for C programming
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "glib.h"
-
-
-typedef struct _GRealListAllocator GRealListAllocator;
-
-struct _GRealListAllocator
-{
- GMemChunk *list_mem_chunk;
- GSList *free_list;
-};
-
-
-static GRealListAllocator *default_allocator = NULL;
-static GRealListAllocator *current_allocator = NULL;
-
-GListAllocator*
-g_slist_set_allocator (GListAllocator* fallocator)
-{
- GRealListAllocator* allocator = (GRealListAllocator *) fallocator;
- GRealListAllocator* old_allocator = current_allocator;
-
- if (allocator)
- current_allocator = allocator;
- else
- {
- if (!default_allocator)
- default_allocator = (GRealListAllocator*) g_list_allocator_new ();
- current_allocator = default_allocator;
- }
-
- if (!current_allocator->list_mem_chunk)
- current_allocator->list_mem_chunk = g_mem_chunk_new ("slist mem chunk",
- sizeof (GSList),
- 1024,
- G_ALLOC_ONLY);
-
- return (GListAllocator*) (old_allocator == default_allocator ? NULL : old_allocator);
-}
-
-
-GSList*
-g_slist_alloc ()
-{
- GSList *new_list;
-
- g_slist_set_allocator (NULL);
- if (current_allocator->free_list)
- {
- new_list = current_allocator->free_list;
- current_allocator->free_list = current_allocator->free_list->next;
- }
- else
- {
- new_list = g_chunk_new (GSList, current_allocator->list_mem_chunk);
- }
-
- new_list->data = NULL;
- new_list->next = NULL;
-
- return new_list;
-}
-
-void
-g_slist_free (GSList *list)
-{
- GSList *last;
-
- if (list)
- {
- last = g_slist_last (list);
- last->next = current_allocator->free_list;
- current_allocator->free_list = list;
- }
-}
-
-void
-g_slist_free_1 (GSList *list)
-{
- if (list)
- {
- list->next = current_allocator->free_list;
- current_allocator->free_list = list;
- }
-}
-
-GSList*
-g_slist_append (GSList *list,
- gpointer data)
-{
- GSList *new_list;
- GSList *last;
-
- new_list = g_slist_alloc ();
- new_list->data = data;
-
- if (list)
- {
- last = g_slist_last (list);
- /* g_assert (last != NULL); */
- last->next = new_list;
-
- return list;
- }
- else
- return new_list;
-}
-
-GSList*
-g_slist_prepend (GSList *list,
- gpointer data)
-{
- GSList *new_list;
-
- new_list = g_slist_alloc ();
- new_list->data = data;
- new_list->next = list;
-
- return new_list;
-}
-
-GSList*
-g_slist_insert (GSList *list,
- gpointer data,
- gint position)
-{
- GSList *prev_list;
- GSList *tmp_list;
- GSList *new_list;
-
- if (position < 0)
- return g_slist_append (list, data);
- else if (position == 0)
- return g_slist_prepend (list, data);
-
- new_list = g_slist_alloc ();
- new_list->data = data;
-
- if (!list)
- return new_list;
-
- prev_list = NULL;
- tmp_list = list;
-
- while ((position-- > 0) && tmp_list)
- {
- prev_list = tmp_list;
- tmp_list = tmp_list->next;
- }
-
- if (prev_list)
- {
- new_list->next = prev_list->next;
- prev_list->next = new_list;
- }
- else
- {
- new_list->next = list;
- list = new_list;
- }
-
- return list;
-}
-
-GSList *
-g_slist_concat (GSList *list1, GSList *list2)
-{
- if (list2)
- {
- if (list1)
- g_slist_last (list1)->next = list2;
- else
- list1 = list2;
- }
-
- return list1;
-}
-
-GSList*
-g_slist_remove (GSList *list,
- gpointer data)
-{
- GSList *tmp;
- GSList *prev;
-
- prev = NULL;
- tmp = list;
-
- while (tmp)
- {
- if (tmp->data == data)
- {
- if (prev)
- prev->next = tmp->next;
- if (list == tmp)
- list = list->next;
-
- tmp->next = NULL;
- g_slist_free (tmp);
-
- break;
- }
-
- prev = tmp;
- tmp = tmp->next;
- }
-
- return list;
-}
-
-GSList*
-g_slist_remove_link (GSList *list,
- GSList *link)
-{
- GSList *tmp;
- GSList *prev;
-
- prev = NULL;
- tmp = list;
-
- while (tmp)
- {
- if (tmp == link)
- {
- if (prev)
- prev->next = tmp->next;
- if (list == tmp)
- list = list->next;
-
- tmp->next = NULL;
- break;
- }
-
- prev = tmp;
- tmp = tmp->next;
- }
-
- return list;
-}
-
-GSList*
-g_slist_reverse (GSList *list)
-{
- GSList *tmp;
- GSList *prev;
- GSList *last;
-
- last = NULL;
- prev = NULL;
-
- while (list)
- {
- last = list;
-
- tmp = list->next;
- list->next = prev;
-
- prev = list;
- list = tmp;
- }
-
- return last;
-}
-
-GSList*
-g_slist_nth (GSList *list,
- guint n)
-{
- while ((n-- > 0) && list)
- list = list->next;
-
- return list;
-}
-
-GSList*
-g_slist_find (GSList *list,
- gpointer data)
-{
- while (list)
- {
- if (list->data == data)
- break;
- list = list->next;
- }
-
- return list;
-}
-
-GSList*
-g_slist_last (GSList *list)
-{
- if (list)
- {
- while (list->next)
- list = list->next;
- }
-
- return list;
-}
-
-guint
-g_slist_length (GSList *list)
-{
- guint length;
-
- length = 0;
- while (list)
- {
- length++;
- list = list->next;
- }
-
- return length;
-}
-
-void
-g_slist_foreach (GSList *list,
- GFunc func,
- gpointer user_data)
-{
- while (list)
- {
- (*func) (list->data, user_data);
- list = list->next;
- }
-}
-
-GSList*
-g_slist_insert_sorted (GSList *list,
- gpointer data,
- GCompareFunc func)
-{
- GSList *tmp_list = list;
- GSList *prev_list = NULL;
- GSList *new_list;
- gint cmp;
-
- if (!list)
- {
- new_list = g_slist_alloc();
- new_list->data = data;
- return new_list;
- }
-
- cmp = (*func) (data, tmp_list->data);
-
- while ((tmp_list->next) && (cmp > 0))
- {
- prev_list = tmp_list;
- tmp_list = tmp_list->next;
- cmp = (*func) (data, tmp_list->data);
- }
-
- new_list = g_slist_alloc();
- new_list->data = data;
-
- if ((!tmp_list->next) && (cmp > 0))
- {
- tmp_list->next = new_list;
- return list;
- }
-
- if (prev_list)
- {
- prev_list->next = new_list;
- new_list->next = tmp_list;
- return list;
- }
- else
- {
- new_list->next = list;
- return new_list;
- }
-}
diff --git a/glib/gstring.c b/glib/gstring.c
deleted file mode 100644
index d4edfa5db9..0000000000
--- a/glib/gstring.c
+++ /dev/null
@@ -1,549 +0,0 @@
-/* GLIB - Library of useful routines for C programming
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <glib.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-
-typedef struct _GRealStringChunk GRealStringChunk;
-typedef struct _GRealString GRealString;
-
-struct _GRealStringChunk
-{
- GHashTable *const_table;
- GSList *storage_list;
- gint storage_next;
- gint this_size;
- gint default_size;
-};
-
-struct _GRealString
-{
- gchar *str;
- gint len;
- gint alloc;
-};
-
-
-static GMemChunk *string_mem_chunk = NULL;
-
-/* Hash Functions.
- */
-
-gint
-g_str_equal (const gpointer v, const gpointer v2)
-{
- return strcmp ((gchar*) v, (gchar*)v2) == 0;
-}
-
-/* a char* hash function from ASU */
-guint
-g_str_hash (const gpointer v)
-{
- char *s = (char*)v;
- char *p;
- guint h=0, g;
-
- for(p = s; *p != '\0'; p += 1) {
- h = ( h << 4 ) + *p;
- if ( ( g = h & 0xf0000000 ) ) {
- h = h ^ (g >> 24);
- h = h ^ g;
- }
- }
-
- return h /* % M */;
-}
-
-
-/* String Chunks.
- */
-
-GStringChunk*
-g_string_chunk_new (gint default_size)
-{
- GRealStringChunk *new_chunk = g_new (GRealStringChunk, 1);
- gint size = 1;
-
- while (size < default_size)
- size <<= 1;
-
- new_chunk->const_table = NULL;
- new_chunk->storage_list = NULL;
- new_chunk->storage_next = size;
- new_chunk->default_size = size;
- new_chunk->this_size = size;
-
- return (GStringChunk*) new_chunk;
-}
-
-void
-g_string_chunk_free (GStringChunk *fchunk)
-{
- GRealStringChunk *chunk = (GRealStringChunk*) fchunk;
- GSList *tmp_list;
-
- if (chunk->storage_list)
- {
- GListAllocator *tmp_allocator = g_slist_set_allocator (NULL);
-
- for (tmp_list = chunk->storage_list; tmp_list; tmp_list = tmp_list->next)
- g_free (tmp_list->data);
-
- g_slist_free (chunk->storage_list);
-
- g_slist_set_allocator (tmp_allocator);
- }
-
- if (chunk->const_table)
- g_hash_table_destroy (chunk->const_table);
-
- g_free (chunk);
-}
-
-gchar*
-g_string_chunk_insert (GStringChunk *fchunk,
- gchar* string)
-{
- GRealStringChunk *chunk = (GRealStringChunk*) fchunk;
- gint len = strlen (string);
- char* pos;
-
- if ((chunk->storage_next + len + 1) > chunk->this_size)
- {
- GListAllocator *tmp_allocator = g_slist_set_allocator (NULL);
- gint new_size = chunk->default_size;
-
- while (new_size < len+1)
- new_size <<= 1;
-
- chunk->storage_list = g_slist_prepend (chunk->storage_list,
- g_new (char, new_size));
-
- chunk->this_size = new_size;
- chunk->storage_next = 0;
-
- g_slist_set_allocator (tmp_allocator);
- }
-
- pos = ((char*)chunk->storage_list->data) + chunk->storage_next;
-
- strcpy (pos, string);
-
- chunk->storage_next += len + 1;
-
- return pos;
-}
-
-gchar*
-g_string_chunk_insert_const (GStringChunk *fchunk,
- gchar* string)
-{
- GRealStringChunk *chunk = (GRealStringChunk*) fchunk;
- char* lookup;
-
- if (!chunk->const_table)
- chunk->const_table = g_hash_table_new (g_str_hash, g_str_equal);
-
- lookup = (char*) g_hash_table_lookup (chunk->const_table, string);
-
- if (!lookup)
- {
- lookup = g_string_chunk_insert (fchunk, string);
- g_hash_table_insert (chunk->const_table, lookup, lookup);
- }
-
- return lookup;
-}
-
-/* Strings.
- */
-static gint
-nearest_pow (gint num)
-{
- gint n = 1;
-
- while (n < num)
- n <<= 1;
-
- return n;
-}
-
-static void
-g_string_maybe_expand (GRealString* string, gint len)
-{
- if (string->len + len >= string->alloc)
- {
- string->alloc = nearest_pow (string->len + len + 1);
- string->str = g_realloc (string->str, string->alloc);
- }
-}
-
-GString*
-g_string_new (gchar *init)
-{
- GRealString *string;
-
- if (!string_mem_chunk)
- string_mem_chunk = g_mem_chunk_new ("string mem chunk",
- sizeof (GRealString),
- 1024, G_ALLOC_AND_FREE);
-
- string = g_chunk_new (GRealString, string_mem_chunk);
-
- string->alloc = 2;
- string->len = 0;
- string->str = g_new0(char, 2);
-
- if (init)
- g_string_append ((GString*)string, init);
-
- return (GString*) string;
-}
-
-void
-g_string_free (GString *string, gint free_segment)
-{
- if (free_segment)
- g_free (string->str);
-
- g_mem_chunk_free (string_mem_chunk, string);
-}
-
-GString*
-g_string_assign (GString *lval,
- char *rval)
-{
- g_string_truncate (lval, 0);
- g_string_append (lval, rval);
-
- return lval;
-}
-
-GString*
-g_string_truncate (GString* fstring, gint len)
-{
- GRealString *string = (GRealString*)fstring;
-
- string->len = len;
-
- string->str[len] = 0;
-
- return fstring;
-}
-
-GString*
-g_string_append (GString *fstring, gchar *val)
-{
- GRealString *string = (GRealString*)fstring;
- int len = strlen (val);
-
- g_string_maybe_expand (string, len);
-
- strcpy (string->str + string->len, val);
-
- string->len += len;
-
- return fstring;
-}
-
-GString*
-g_string_append_c (GString *fstring, char c)
-{
- GRealString *string = (GRealString*)fstring;
-
- g_string_maybe_expand (string, 1);
-
- string->str[string->len++] = c;
- string->str[string->len] = 0;
-
- return fstring;
-}
-
-GString*
-g_string_prepend (GString *fstring, gchar *val)
-{
- GRealString *string = (GRealString*)fstring;
- gint len = strlen (val);
-
- g_string_maybe_expand (string, len);
-
- g_memmove (string->str + len, string->str, string->len);
-
- strncpy (string->str, val, len);
-
- string->len += len;
-
- string->str[string->len] = 0;
-
- return fstring;
-}
-
-GString*
-g_string_prepend_c (GString *fstring, char c)
-{
- GRealString *string = (GRealString*)fstring;
-
- g_string_maybe_expand (string, 1);
-
- g_memmove (string->str + 1, string->str, string->len);
-
- string->str[0] = c;
-
- string->len += 1;
-
- string->str[string->len] = 0;
-
- return fstring;
-}
-
-GString *
-g_string_insert (GString *fstring, gint pos, gchar *val)
-{
- GRealString *string = (GRealString*)fstring;
- gint len = strlen (val);
-
- g_return_val_if_fail (pos <= string->len, fstring);
-
- g_string_maybe_expand (string, len);
-
- g_memmove (string->str + pos + len, string->str + pos, string->len);
-
- strncpy (string->str + pos, val, len);
-
- string->len += len;
-
- string->str[string->len] = 0;
-
- return fstring;
-}
-
-GString *
-g_string_insert_c (GString *fstring, gint pos, gchar c)
-{
- GRealString *string = (GRealString*)fstring;
-
- g_return_val_if_fail (pos <= string->len, fstring);
-
- g_string_maybe_expand (string, 1);
-
- g_memmove (string->str + pos + 1, string->str + pos, string->len);
-
- string->str[pos] = c;
-
- string->len += 1;
-
- string->str[string->len] = 0;
-
- return fstring;
-}
-
-GString *
-g_string_erase (GString *fstring, gint pos, gint len)
-{
- GRealString *string = (GRealString*)fstring;
-
- g_return_val_if_fail (pos <= string->len, fstring);
- g_return_val_if_fail (pos + len <= string->len, fstring);
-
- g_memmove (string->str + pos, string->str + pos + len, string->len - (pos + len));
-
- string->len -= len;
-
- string->str[string->len] = 0;
-
- return fstring;
-}
-
-static int
-get_length_upper_bound (const gchar* fmt, va_list *args)
-{
- int len = 0;
- int short_int;
- int long_int;
- int done;
- char *tmp;
-
- while (*fmt)
- {
- char c = *fmt++;
-
- short_int = FALSE;
- long_int = FALSE;
-
- if (c == '%')
- {
- done = FALSE;
- while (*fmt && !done)
- {
- switch (*fmt++)
- {
- case '*':
- len += va_arg(*args, int);
- break;
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- fmt -= 1;
- len += strtol (fmt, (char **)&fmt, 10);
- break;
- case 'h':
- short_int = TRUE;
- break;
- case 'l':
- long_int = TRUE;
- break;
-
- /* I ignore 'q' and 'L', they're not portable anyway. */
-
- case 's':
- tmp = va_arg(*args, char *);
- if(tmp)
- len += strlen (tmp);
- else
- len += strlen ("(null)");
- done = TRUE;
- break;
- case 'd':
- case 'i':
- case 'o':
- case 'u':
- case 'x':
- case 'X':
- if (long_int)
- (void)va_arg (*args, long);
- else if (short_int)
- (void)va_arg (*args, int);
- else
- (void)va_arg (*args, int);
- len += 32;
- done = TRUE;
- break;
- case 'D':
- case 'O':
- case 'U':
- (void)va_arg (*args, long);
- len += 32;
- done = TRUE;
- break;
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- (void)va_arg (*args, double);
- len += 32;
- done = TRUE;
- break;
- case 'c':
- (void)va_arg (*args, int);
- len += 1;
- done = TRUE;
- break;
- case 'p':
- case 'n':
- (void)va_arg (*args, void*);
- len += 32;
- done = TRUE;
- break;
- case '%':
- len += 1;
- done = TRUE;
- break;
- default:
- break;
- }
- }
- }
- else
- len += 1;
- }
-
- return len;
-}
-
-char*
-g_vsprintf (const gchar *fmt,
- va_list *args,
- va_list *args2)
-{
- static gchar *buf = NULL;
- static gint alloc = 0;
-
- gint len = get_length_upper_bound (fmt, args);
-
- if (len >= alloc)
- {
- if (buf)
- g_free (buf);
-
- alloc = nearest_pow (MAX(len + 1, 1024));
-
- buf = g_new (char, alloc);
- }
-
- vsprintf (buf, fmt, *args2);
-
- return buf;
-}
-
-static void
-g_string_sprintfa_int (GString *string,
- gchar *fmt,
- va_list *args,
- va_list *args2)
-{
- g_string_append (string, g_vsprintf (fmt, args, args2));
-}
-
-void
-g_string_sprintf (GString *string, gchar *fmt, ...)
-{
- va_list args, args2;
-
- va_start(args, fmt);
- va_start(args2, fmt);
-
- g_string_truncate (string, 0);
-
- g_string_sprintfa_int (string, fmt, &args, &args2);
-
- va_end(args);
- va_end(args2);
-}
-
-void
-g_string_sprintfa (GString *string, gchar *fmt, ...)
-{
- va_list args, args2;
-
- va_start(args, fmt);
- va_start(args2, fmt);
-
- g_string_sprintfa_int (string, fmt, &args, &args2);
-
- va_end(args);
- va_end(args2);
-}
diff --git a/glib/gtimer.c b/glib/gtimer.c
deleted file mode 100644
index c3b720df96..0000000000
--- a/glib/gtimer.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/* GLIB - Library of useful routines for C programming
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <sys/time.h>
-#include <unistd.h>
-#include "glib.h"
-
-
-typedef struct _GRealTimer GRealTimer;
-
-struct _GRealTimer
-{
- struct timeval start;
- struct timeval end;
- gint active;
-};
-
-
-GTimer*
-g_timer_new ()
-{
- GRealTimer *timer;
-
- timer = g_new (GRealTimer, 1);
- timer->active = TRUE;
-
- gettimeofday (&timer->start, NULL);
-
- return ((GTimer*) timer);
-}
-
-void
-g_timer_destroy (GTimer *timer)
-{
- g_assert (timer != NULL);
-
- g_free (timer);
-}
-
-void
-g_timer_start (GTimer *timer)
-{
- GRealTimer *rtimer;
-
- g_assert (timer != NULL);
-
- rtimer = (GRealTimer*) timer;
- gettimeofday (&rtimer->start, NULL);
- rtimer->active = 1;
-}
-
-void
-g_timer_stop (GTimer *timer)
-{
- GRealTimer *rtimer;
-
- g_assert (timer != NULL);
-
- rtimer = (GRealTimer*) timer;
- gettimeofday (&rtimer->end, NULL);
- rtimer->active = 0;
-}
-
-void
-g_timer_reset (GTimer *timer)
-{
- GRealTimer *rtimer;
-
- g_assert (timer != NULL);
-
- rtimer = (GRealTimer*) timer;
- gettimeofday (&rtimer->start, NULL);
-}
-
-gdouble
-g_timer_elapsed (GTimer *timer,
- gulong *microseconds)
-{
- GRealTimer *rtimer;
- struct timeval elapsed;
- gdouble total;
-
- g_assert (timer != NULL);
-
- rtimer = (GRealTimer*) timer;
-
- if (rtimer->active)
- gettimeofday (&rtimer->end, NULL);
-
- if (rtimer->start.tv_usec > rtimer->end.tv_usec)
- {
- rtimer->end.tv_usec += 1000000;
- rtimer->end.tv_sec--;
- }
-
- elapsed.tv_usec = rtimer->end.tv_usec - rtimer->start.tv_usec;
- elapsed.tv_sec = rtimer->end.tv_sec - rtimer->start.tv_sec;
-
- total = elapsed.tv_sec + ((gdouble) elapsed.tv_usec / 1e6);
-
- if (microseconds)
- *microseconds = elapsed.tv_usec;
-
- return total;
-}
diff --git a/glib/gtree.c b/glib/gtree.c
deleted file mode 100644
index 61a32a409a..0000000000
--- a/glib/gtree.c
+++ /dev/null
@@ -1,718 +0,0 @@
-/* GLIB - Library of useful routines for C programming
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "glib.h"
-
-
-typedef struct _GRealTree GRealTree;
-typedef struct _GTreeNode GTreeNode;
-
-struct _GRealTree
-{
- GTreeNode *root;
- GCompareFunc key_compare;
-};
-
-struct _GTreeNode
-{
- gint balance; /* height (left) - height (right) */
- GTreeNode *left; /* left subtree */
- GTreeNode *right; /* right subtree */
- gpointer key; /* key for this node */
- gpointer value; /* value stored at this node */
-};
-
-
-static GTreeNode* g_tree_node_new (gpointer key,
- gpointer value);
-static void g_tree_node_destroy (GTreeNode *node);
-static GTreeNode* g_tree_node_insert (GTreeNode *node,
- GCompareFunc compare,
- gpointer key,
- gpointer value,
- gint *inserted);
-static GTreeNode* g_tree_node_remove (GTreeNode *node,
- GCompareFunc compare,
- gpointer key);
-static GTreeNode* g_tree_node_balance (GTreeNode *node);
-static GTreeNode* g_tree_node_remove_leftmost (GTreeNode *node,
- GTreeNode **leftmost);
-static GTreeNode* g_tree_node_restore_left_balance (GTreeNode *node,
- gint old_balance);
-static GTreeNode* g_tree_node_restore_right_balance (GTreeNode *node,
- gint old_balance);
-static gpointer g_tree_node_lookup (GTreeNode *node,
- GCompareFunc compare,
- gpointer key);
-static gint g_tree_node_count (GTreeNode *node);
-static gint g_tree_node_pre_order (GTreeNode *node,
- GTraverseFunc traverse_func,
- gpointer data);
-static gint g_tree_node_in_order (GTreeNode *node,
- GTraverseFunc traverse_func,
- gpointer data);
-static gint g_tree_node_post_order (GTreeNode *node,
- GTraverseFunc traverse_func,
- gpointer data);
-static gpointer g_tree_node_search (GTreeNode *node,
- GSearchFunc search_func,
- gpointer data);
-static gint g_tree_node_height (GTreeNode *node);
-static GTreeNode* g_tree_node_rotate_left (GTreeNode *node);
-static GTreeNode* g_tree_node_rotate_right (GTreeNode *node);
-static void g_tree_node_check (GTreeNode *node);
-
-
-static GMemChunk *node_mem_chunk = NULL;
-static GSList *node_free_list = NULL;
-
-
-GTree*
-g_tree_new (GCompareFunc key_compare_func)
-{
- GRealTree *rtree;
-
- rtree = g_new (GRealTree, 1);
- rtree->root = NULL;
- rtree->key_compare = key_compare_func;
-
- return (GTree*) rtree;
-}
-
-void
-g_tree_destroy (GTree *tree)
-{
- GRealTree *rtree;
-
- g_return_if_fail (tree != NULL);
-
- rtree = (GRealTree*) tree;
-
- g_tree_node_destroy (rtree->root);
- g_free (rtree);
-}
-
-void
-g_tree_insert (GTree *tree,
- gpointer key,
- gpointer value)
-{
- GRealTree *rtree;
- gint inserted;
-
- g_return_if_fail (tree != NULL);
-
- rtree = (GRealTree*) tree;
-
- inserted = FALSE;
- rtree->root = g_tree_node_insert (rtree->root, rtree->key_compare,
- key, value, &inserted);
-}
-
-void
-g_tree_remove (GTree *tree,
- gpointer key)
-{
- GRealTree *rtree;
-
- g_return_if_fail (tree != NULL);
-
- rtree = (GRealTree*) tree;
-
- rtree->root = g_tree_node_remove (rtree->root, rtree->key_compare, key);
-}
-
-gpointer
-g_tree_lookup (GTree *tree,
- gpointer key)
-{
- GRealTree *rtree;
-
- g_return_val_if_fail (tree != NULL, NULL);
-
- rtree = (GRealTree*) tree;
-
- return g_tree_node_lookup (rtree->root, rtree->key_compare, key);
-}
-
-void
-g_tree_traverse (GTree *tree,
- GTraverseFunc traverse_func,
- GTraverseType traverse_type,
- gpointer data)
-{
- GRealTree *rtree;
-
- g_return_if_fail (tree != NULL);
-
- rtree = (GRealTree*) tree;
-
- g_return_if_fail (rtree->root != NULL);
-
- switch (traverse_type)
- {
- case G_PRE_ORDER:
- g_tree_node_pre_order (rtree->root, traverse_func, data);
- break;
-
- case G_IN_ORDER:
- g_tree_node_in_order (rtree->root, traverse_func, data);
- break;
-
- case G_POST_ORDER:
- g_tree_node_post_order (rtree->root, traverse_func, data);
- break;
- }
-}
-
-gpointer
-g_tree_search (GTree *tree,
- GSearchFunc search_func,
- gpointer data)
-{
- GRealTree *rtree;
-
- g_return_val_if_fail (tree != NULL, NULL);
-
- rtree = (GRealTree*) tree;
-
- if (rtree->root)
- return g_tree_node_search (rtree->root, search_func, data);
- return NULL;
-}
-
-gint
-g_tree_height (GTree *tree)
-{
- GRealTree *rtree;
-
- g_return_val_if_fail (tree != NULL, 0);
-
- rtree = (GRealTree*) tree;
-
- if (rtree->root)
- return g_tree_node_height (rtree->root);
- return 0;
-}
-
-gint
-g_tree_nnodes (GTree *tree)
-{
- GRealTree *rtree;
-
- g_return_val_if_fail (tree != NULL, 0);
-
- rtree = (GRealTree*) tree;
-
- if (rtree->root)
- return g_tree_node_count (rtree->root);
- return 0;
-}
-
-
-static GTreeNode*
-g_tree_node_new (gpointer key,
- gpointer value)
-{
- GTreeNode *node;
- GSList *tmp_list;
-
- if (node_free_list)
- {
- tmp_list = node_free_list;
- node_free_list = node_free_list->next;
-
- node = tmp_list->data;
-
- {
- GListAllocator *tmp_allocator = g_list_set_allocator (NULL);
- g_slist_free_1 (tmp_list);
- g_list_set_allocator (tmp_allocator);
- }
- }
- else
- {
- if (!node_mem_chunk)
- node_mem_chunk = g_mem_chunk_new ("tree node mem chunk", sizeof (GTreeNode), 1024, G_ALLOC_ONLY);
-
- node = g_chunk_new (GTreeNode, node_mem_chunk);
- }
-
- node->balance = 0;
- node->left = NULL;
- node->right = NULL;
- node->key = key;
- node->value = value;
-
- return node;
-}
-
-static void
-g_tree_node_destroy (GTreeNode *node)
-{
- if (node)
- {
- node_free_list = g_slist_prepend (node_free_list, node);
- g_tree_node_destroy (node->right);
- g_tree_node_destroy (node->left);
- }
-}
-
-static GTreeNode*
-g_tree_node_insert (GTreeNode *node,
- GCompareFunc compare,
- gpointer key,
- gpointer value,
- gint *inserted)
-{
- gint old_balance;
- gint cmp;
-
- if (!node)
- {
- *inserted = TRUE;
- return g_tree_node_new (key, value);
- }
-
- cmp = (* compare) (key, node->key);
- if (cmp == 0)
- {
- *inserted = FALSE;
- node->value = value;
- return node;
- }
-
- if (cmp < 0)
- {
- if (node->left)
- {
- old_balance = node->left->balance;
- node->left = g_tree_node_insert (node->left, compare, key, value, inserted);
-
- if ((old_balance != node->left->balance) && node->left->balance)
- node->balance -= 1;
- }
- else
- {
- *inserted = TRUE;
- node->left = g_tree_node_new (key, value);
- node->balance -= 1;
- }
- }
- else if (cmp > 0)
- {
- if (node->right)
- {
- old_balance = node->right->balance;
- node->right = g_tree_node_insert (node->right, compare, key, value, inserted);
-
- if ((old_balance != node->right->balance) && node->right->balance)
- node->balance += 1;
- }
- else
- {
- *inserted = TRUE;
- node->right = g_tree_node_new (key, value);
- node->balance += 1;
- }
- }
-
- if (*inserted)
- {
- if ((node->balance < -1) || (node->balance > 1))
- node = g_tree_node_balance (node);
- }
-
- return node;
-}
-
-static GTreeNode*
-g_tree_node_remove (GTreeNode *node,
- GCompareFunc compare,
- gpointer key)
-{
- GTreeNode *garbage;
- GTreeNode *new_root;
- gint old_balance;
- gint cmp;
-
- if (!node)
- return NULL;
-
- cmp = (* compare) (key, node->key);
- if (cmp == 0)
- {
- garbage = node;
-
- if (!node->right)
- {
- node = node->left;
- }
- else
- {
- old_balance = node->right->balance;
- node->right = g_tree_node_remove_leftmost (node->right, &new_root);
- new_root->left = node->left;
- new_root->right = node->right;
- new_root->balance = node->balance;
- node = g_tree_node_restore_right_balance (new_root, old_balance);
- }
-
- node_free_list = g_slist_prepend (node_free_list, garbage);
- }
- else if (cmp < 0)
- {
- if (node->left)
- {
- old_balance = node->left->balance;
- node->left = g_tree_node_remove (node->left, compare, key);
- node = g_tree_node_restore_left_balance (node, old_balance);
- }
- }
- else if (cmp > 0)
- {
- if (node->right)
- {
- old_balance = node->right->balance;
- node->right = g_tree_node_remove (node->right, compare, key);
- node = g_tree_node_restore_right_balance (node, old_balance);
- }
- }
-
- return node;
-}
-
-static GTreeNode*
-g_tree_node_balance (GTreeNode *node)
-{
- if (node->balance < -1)
- {
- if (node->left->balance > 0)
- node->left = g_tree_node_rotate_left (node->left);
- node = g_tree_node_rotate_right (node);
- }
- else if (node->balance > 1)
- {
- if (node->right->balance < 0)
- node->right = g_tree_node_rotate_right (node->right);
- node = g_tree_node_rotate_left (node);
- }
-
- return node;
-}
-
-static GTreeNode*
-g_tree_node_remove_leftmost (GTreeNode *node,
- GTreeNode **leftmost)
-{
- gint old_balance;
-
- if (!node->left)
- {
- *leftmost = node;
- return node->right;
- }
-
- old_balance = node->left->balance;
- node->left = g_tree_node_remove_leftmost (node->left, leftmost);
- return g_tree_node_restore_left_balance (node, old_balance);
-}
-
-static GTreeNode*
-g_tree_node_restore_left_balance (GTreeNode *node,
- gint old_balance)
-{
- if (!node->left)
- node->balance += 1;
- else if ((node->left->balance != old_balance) &&
- (node->left->balance == 0))
- node->balance += 1;
-
- if (node->balance > 1)
- return g_tree_node_balance (node);
- return node;
-}
-
-static GTreeNode*
-g_tree_node_restore_right_balance (GTreeNode *node,
- gint old_balance)
-{
- if (!node->right)
- node->balance -= 1;
- else if ((node->right->balance != old_balance) &&
- (node->right->balance == 0))
- node->balance -= 1;
-
- if (node->balance < -1)
- return g_tree_node_balance (node);
- return node;
-}
-
-static gpointer
-g_tree_node_lookup (GTreeNode *node,
- GCompareFunc compare,
- gpointer key)
-{
- gint cmp;
-
- if (!node)
- return NULL;
-
- cmp = (* compare) (key, node->key);
- if (cmp == 0)
- return node->value;
-
- if (cmp < 0)
- {
- if (node->left)
- return g_tree_node_lookup (node->left, compare, key);
- }
- else if (cmp > 0)
- {
- if (node->right)
- return g_tree_node_lookup (node->right, compare, key);
- }
-
- return NULL;
-}
-
-static gint
-g_tree_node_count (GTreeNode *node)
-{
- gint count;
-
- count = 1;
- if (node->left)
- count += g_tree_node_count (node->left);
- if (node->right)
- count += g_tree_node_count (node->right);
-
- return count;
-}
-
-static gint
-g_tree_node_pre_order (GTreeNode *node,
- GTraverseFunc traverse_func,
- gpointer data)
-{
- if ((*traverse_func) (node->key, node->value, data))
- return TRUE;
- if (node->left)
- {
- if (g_tree_node_pre_order (node->left, traverse_func, data))
- return TRUE;
- }
- if (node->right)
- {
- if (g_tree_node_pre_order (node->right, traverse_func, data))
- return TRUE;
- }
-
- return FALSE;
-}
-
-static gint
-g_tree_node_in_order (GTreeNode *node,
- GTraverseFunc traverse_func,
- gpointer data)
-{
- if (node->left)
- {
- if (g_tree_node_in_order (node->left, traverse_func, data))
- return TRUE;
- }
- if ((*traverse_func) (node->key, node->value, data))
- return TRUE;
- if (node->right)
- {
- if (g_tree_node_in_order (node->right, traverse_func, data))
- return TRUE;
- }
-
- return FALSE;
-}
-
-static gint
-g_tree_node_post_order (GTreeNode *node,
- GTraverseFunc traverse_func,
- gpointer data)
-{
- if (node->left)
- {
- if (g_tree_node_post_order (node->left, traverse_func, data))
- return TRUE;
- }
- if (node->right)
- {
- if (g_tree_node_post_order (node->right, traverse_func, data))
- return TRUE;
- }
- if ((*traverse_func) (node->key, node->value, data))
- return TRUE;
-
- return FALSE;
-}
-
-static gpointer
-g_tree_node_search (GTreeNode *node,
- GSearchFunc search_func,
- gpointer data)
-{
- gint dir;
-
- if (!node)
- return NULL;
-
- do {
- dir = (* search_func) (node->key, data);
- if (dir == 0)
- return node->value;
-
- if (dir < 0)
- node = node->left;
- else if (dir > 0)
- node = node->right;
- } while (node && (dir != 0));
-
- return NULL;
-}
-
-static gint
-g_tree_node_height (GTreeNode *node)
-{
- gint left_height;
- gint right_height;
-
- if (node)
- {
- left_height = 0;
- right_height = 0;
-
- if (node->left)
- left_height = g_tree_node_height (node->left);
-
- if (node->right)
- right_height = g_tree_node_height (node->right);
-
- return MAX (left_height, right_height) + 1;
- }
-
- return 0;
-}
-
-static GTreeNode*
-g_tree_node_rotate_left (GTreeNode *node)
-{
- GTreeNode *left;
- GTreeNode *right;
- gint a_bal;
- gint b_bal;
-
- left = node->left;
- right = node->right;
-
- node->right = right->left;
- right->left = node;
-
- a_bal = node->balance;
- b_bal = right->balance;
-
- if (b_bal <= 0)
- {
- if (a_bal >= 1)
- right->balance = b_bal - 1;
- else
- right->balance = a_bal + b_bal - 2;
- node->balance = a_bal - 1;
- }
- else
- {
- if (a_bal <= b_bal)
- right->balance = a_bal - 2;
- else
- right->balance = b_bal - 1;
- node->balance = a_bal - b_bal - 1;
- }
-
- return right;
-}
-
-static GTreeNode*
-g_tree_node_rotate_right (GTreeNode *node)
-{
- GTreeNode *left;
- GTreeNode *right;
- gint a_bal;
- gint b_bal;
-
- left = node->left;
- right = node->right;
-
- node->left = left->right;
- left->right = node;
-
- a_bal = node->balance;
- b_bal = left->balance;
-
- if (b_bal <= 0)
- {
- if (b_bal > a_bal)
- left->balance = b_bal + 1;
- else
- left->balance = a_bal + 2;
- node->balance = a_bal - b_bal + 1;
- }
- else
- {
- if (a_bal <= -1)
- left->balance = b_bal + 1;
- else
- left->balance = a_bal + b_bal + 2;
- node->balance = a_bal + 1;
- }
-
- return left;
-}
-
-static void
-g_tree_node_check (GTreeNode *node)
-{
- gint left_height;
- gint right_height;
- gint balance;
-
- if (node)
- {
- left_height = 0;
- right_height = 0;
-
- if (node->left)
- left_height = g_tree_node_height (node->left);
- if (node->right)
- right_height = g_tree_node_height (node->right);
-
- balance = right_height - left_height;
- if (balance != node->balance)
- g_print ("g_tree_node_check: failed: %d ( %d )\n",
- balance, node->balance);
-
- if (node->left)
- g_tree_node_check (node->left);
- if (node->right)
- g_tree_node_check (node->right);
- }
-}
diff --git a/glib/gutils.c b/glib/gutils.c
deleted file mode 100644
index 2db0c13b83..0000000000
--- a/glib/gutils.c
+++ /dev/null
@@ -1,911 +0,0 @@
-/* GLIB - Library of useful routines for C programming
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <locale.h>
-#include <ctype.h> /* For tolower() */
-#include "glib.h"
-
-
-static GErrorFunc error_func = NULL;
-static GWarningFunc warning_func = NULL;
-static GPrintFunc message_func = NULL;
-static GPrintFunc print_func = NULL;
-
-extern char* g_vsprintf (const gchar *fmt, va_list *args, va_list *args2);
-
-gchar*
-g_strdup (const gchar *str)
-{
- gchar *new_str;
-
- new_str = NULL;
- if (str)
- {
- new_str = g_new (char, strlen (str) + 1);
- strcpy (new_str, str);
- }
-
- return new_str;
-}
-
-gchar*
-g_strconcat (const gchar *string1, ...)
-{
- guint l;
- va_list args;
- gchar *s;
- gchar *concat;
-
- g_return_val_if_fail (string1 != NULL, NULL);
-
- l = 1 + strlen (string1);
- va_start (args, string1);
- s = va_arg (args, gchar*);
- while (s)
- {
- l += strlen (s);
- s = va_arg (args, gchar*);
- }
- va_end (args);
-
- concat = g_new (gchar, l);
- concat[0] = 0;
-
- strcat (concat, string1);
- va_start (args, string1);
- s = va_arg (args, gchar*);
- while (s)
- {
- strcat (concat, s);
- s = va_arg (args, gchar*);
- }
- va_end (args);
-
- return concat;
-}
-
-gdouble
-g_strtod (const gchar *nptr,
- gchar **endptr)
-{
- gchar *fail_pos_1;
- gchar *fail_pos_2;
- gdouble val_1;
- gdouble val_2 = 0;
-
- g_return_val_if_fail (nptr != NULL, 0);
-
- fail_pos_1 = NULL;
- fail_pos_2 = NULL;
-
- val_1 = strtod (nptr, &fail_pos_1);
-
- if (fail_pos_1 && fail_pos_1[0] != 0)
- {
- gchar *old_locale;
-
- old_locale = setlocale (LC_NUMERIC, "C");
- val_2 = strtod (nptr, &fail_pos_2);
- setlocale (LC_NUMERIC, old_locale);
- }
-
- if (!fail_pos_1 || fail_pos_1[0] == 0 || fail_pos_1 >= fail_pos_2)
- {
- if (endptr)
- *endptr = fail_pos_1;
- return val_1;
- }
- else
- {
- if (endptr)
- *endptr = fail_pos_2;
- return val_2;
- }
-}
-
-gchar*
-g_strerror (gint errnum)
-{
- static char msg[64];
-
-#ifdef HAVE_STRERROR
- return strerror (errnum);
-#elif NO_SYS_ERRLIST
- switch (errnum)
- {
-#ifdef E2BIG
- case E2BIG: return "argument list too long";
-#endif
-#ifdef EACCES
- case EACCES: return "permission denied";
-#endif
-#ifdef EADDRINUSE
- case EADDRINUSE: return "address already in use";
-#endif
-#ifdef EADDRNOTAVAIL
- case EADDRNOTAVAIL: return "can't assign requested address";
-#endif
-#ifdef EADV
- case EADV: return "advertise error";
-#endif
-#ifdef EAFNOSUPPORT
- case EAFNOSUPPORT: return "address family not supported by protocol family";
-#endif
-#ifdef EAGAIN
- case EAGAIN: return "try again";
-#endif
-#ifdef EALIGN
- case EALIGN: return "EALIGN";
-#endif
-#ifdef EALREADY
- case EALREADY: return "operation already in progress";
-#endif
-#ifdef EBADE
- case EBADE: return "bad exchange descriptor";
-#endif
-#ifdef EBADF
- case EBADF: return "bad file number";
-#endif
-#ifdef EBADFD
- case EBADFD: return "file descriptor in bad state";
-#endif
-#ifdef EBADMSG
- case EBADMSG: return "not a data message";
-#endif
-#ifdef EBADR
- case EBADR: return "bad request descriptor";
-#endif
-#ifdef EBADRPC
- case EBADRPC: return "RPC structure is bad";
-#endif
-#ifdef EBADRQC
- case EBADRQC: return "bad request code";
-#endif
-#ifdef EBADSLT
- case EBADSLT: return "invalid slot";
-#endif
-#ifdef EBFONT
- case EBFONT: return "bad font file format";
-#endif
-#ifdef EBUSY
- case EBUSY: return "mount device busy";
-#endif
-#ifdef ECHILD
- case ECHILD: return "no children";
-#endif
-#ifdef ECHRNG
- case ECHRNG: return "channel number out of range";
-#endif
-#ifdef ECOMM
- case ECOMM: return "communication error on send";
-#endif
-#ifdef ECONNABORTED
- case ECONNABORTED: return "software caused connection abort";
-#endif
-#ifdef ECONNREFUSED
- case ECONNREFUSED: return "connection refused";
-#endif
-#ifdef ECONNRESET
- case ECONNRESET: return "connection reset by peer";
-#endif
-#if defined(EDEADLK) && (!defined(EWOULDBLOCK) || (EDEADLK != EWOULDBLOCK))
- case EDEADLK: return "resource deadlock avoided";
-#endif
-#ifdef EDEADLOCK
- case EDEADLOCK: return "resource deadlock avoided";
-#endif
-#ifdef EDESTADDRREQ
- case EDESTADDRREQ: return "destination address required";
-#endif
-#ifdef EDIRTY
- case EDIRTY: return "mounting a dirty fs w/o force";
-#endif
-#ifdef EDOM
- case EDOM: return "math argument out of range";
-#endif
-#ifdef EDOTDOT
- case EDOTDOT: return "cross mount point";
-#endif
-#ifdef EDQUOT
- case EDQUOT: return "disk quota exceeded";
-#endif
-#ifdef EDUPPKG
- case EDUPPKG: return "duplicate package name";
-#endif
-#ifdef EEXIST
- case EEXIST: return "file already exists";
-#endif
-#ifdef EFAULT
- case EFAULT: return "bad address in system call argument";
-#endif
-#ifdef EFBIG
- case EFBIG: return "file too large";
-#endif
-#ifdef EHOSTDOWN
- case EHOSTDOWN: return "host is down";
-#endif
-#ifdef EHOSTUNREACH
- case EHOSTUNREACH: return "host is unreachable";
-#endif
-#ifdef EIDRM
- case EIDRM: return "identifier removed";
-#endif
-#ifdef EINIT
- case EINIT: return "initialization error";
-#endif
-#ifdef EINPROGRESS
- case EINPROGRESS: return "operation now in progress";
-#endif
-#ifdef EINTR
- case EINTR: return "interrupted system call";
-#endif
-#ifdef EINVAL
- case EINVAL: return "invalid argument";
-#endif
-#ifdef EIO
- case EIO: return "I/O error";
-#endif
-#ifdef EISCONN
- case EISCONN: return "socket is already connected";
-#endif
-#ifdef EISDIR
- case EISDIR: return "illegal operation on a directory";
-#endif
-#ifdef EISNAME
- case EISNAM: return "is a name file";
-#endif
-#ifdef ELBIN
- case ELBIN: return "ELBIN";
-#endif
-#ifdef EL2HLT
- case EL2HLT: return "level 2 halted";
-#endif
-#ifdef EL2NSYNC
- case EL2NSYNC: return "level 2 not synchronized";
-#endif
-#ifdef EL3HLT
- case EL3HLT: return "level 3 halted";
-#endif
-#ifdef EL3RST
- case EL3RST: return "level 3 reset";
-#endif
-#ifdef ELIBACC
- case ELIBACC: return "can not access a needed shared library";
-#endif
-#ifdef ELIBBAD
- case ELIBBAD: return "accessing a corrupted shared library";
-#endif
-#ifdef ELIBEXEC
- case ELIBEXEC: return "can not exec a shared library directly";
-#endif
-#ifdef ELIBMAX
- case ELIBMAX: return "attempting to link in more shared libraries than system limit";
-#endif
-#ifdef ELIBSCN
- case ELIBSCN: return ".lib section in a.out corrupted";
-#endif
-#ifdef ELNRNG
- case ELNRNG: return "link number out of range";
-#endif
-#ifdef ELOOP
- case ELOOP: return "too many levels of symbolic links";
-#endif
-#ifdef EMFILE
- case EMFILE: return "too many open files";
-#endif
-#ifdef EMLINK
- case EMLINK: return "too many links";
-#endif
-#ifdef EMSGSIZE
- case EMSGSIZE: return "message too long";
-#endif
-#ifdef EMULTIHOP
- case EMULTIHOP: return "multihop attempted";
-#endif
-#ifdef ENAMETOOLONG
- case ENAMETOOLONG: return "file name too long";
-#endif
-#ifdef ENAVAIL
- case ENAVAIL: return "not available";
-#endif
-#ifdef ENET
- case ENET: return "ENET";
-#endif
-#ifdef ENETDOWN
- case ENETDOWN: return "network is down";
-#endif
-#ifdef ENETRESET
- case ENETRESET: return "network dropped connection on reset";
-#endif
-#ifdef ENETUNREACH
- case ENETUNREACH: return "network is unreachable";
-#endif
-#ifdef ENFILE
- case ENFILE: return "file table overflow";
-#endif
-#ifdef ENOANO
- case ENOANO: return "anode table overflow";
-#endif
-#if defined(ENOBUFS) && (!defined(ENOSR) || (ENOBUFS != ENOSR))
- case ENOBUFS: return "no buffer space available";
-#endif
-#ifdef ENOCSI
- case ENOCSI: return "no CSI structure available";
-#endif
-#ifdef ENODATA
- case ENODATA: return "no data available";
-#endif
-#ifdef ENODEV
- case ENODEV: return "no such device";
-#endif
-#ifdef ENOENT
- case ENOENT: return "no such file or directory";
-#endif
-#ifdef ENOEXEC
- case ENOEXEC: return "exec format error";
-#endif
-#ifdef ENOLCK
- case ENOLCK: return "no locks available";
-#endif
-#ifdef ENOLINK
- case ENOLINK: return "link has be severed";
-#endif
-#ifdef ENOMEM
- case ENOMEM: return "not enough memory";
-#endif
-#ifdef ENOMSG
- case ENOMSG: return "no message of desired type";
-#endif
-#ifdef ENONET
- case ENONET: return "machine is not on the network";
-#endif
-#ifdef ENOPKG
- case ENOPKG: return "package not installed";
-#endif
-#ifdef ENOPROTOOPT
- case ENOPROTOOPT: return "bad proocol option";
-#endif
-#ifdef ENOSPC
- case ENOSPC: return "no space left on device";
-#endif
-#ifdef ENOSR
- case ENOSR: return "out of stream resources";
-#endif
-#ifdef ENOSTR
- case ENOSTR: return "not a stream device";
-#endif
-#ifdef ENOSYM
- case ENOSYM: return "unresolved symbol name";
-#endif
-#ifdef ENOSYS
- case ENOSYS: return "function not implemented";
-#endif
-#ifdef ENOTBLK
- case ENOTBLK: return "block device required";
-#endif
-#ifdef ENOTCONN
- case ENOTCONN: return "socket is not connected";
-#endif
-#ifdef ENOTDIR
- case ENOTDIR: return "not a directory";
-#endif
-#ifdef ENOTEMPTY
- case ENOTEMPTY: return "directory not empty";
-#endif
-#ifdef ENOTNAM
- case ENOTNAM: return "not a name file";
-#endif
-#ifdef ENOTSOCK
- case ENOTSOCK: return "socket operation on non-socket";
-#endif
-#ifdef ENOTTY
- case ENOTTY: return "inappropriate device for ioctl";
-#endif
-#ifdef ENOTUNIQ
- case ENOTUNIQ: return "name not unique on network";
-#endif
-#ifdef ENXIO
- case ENXIO: return "no such device or address";
-#endif
-#ifdef EOPNOTSUPP
- case EOPNOTSUPP: return "operation not supported on socket";
-#endif
-#ifdef EPERM
- case EPERM: return "not owner";
-#endif
-#ifdef EPFNOSUPPORT
- case EPFNOSUPPORT: return "protocol family not supported";
-#endif
-#ifdef EPIPE
- case EPIPE: return "broken pipe";
-#endif
-#ifdef EPROCLIM
- case EPROCLIM: return "too many processes";
-#endif
-#ifdef EPROCUNAVAIL
- case EPROCUNAVAIL: return "bad procedure for program";
-#endif
-#ifdef EPROGMISMATCH
- case EPROGMISMATCH: return "program version wrong";
-#endif
-#ifdef EPROGUNAVAIL
- case EPROGUNAVAIL: return "RPC program not available";
-#endif
-#ifdef EPROTO
- case EPROTO: return "protocol error";
-#endif
-#ifdef EPROTONOSUPPORT
- case EPROTONOSUPPORT: return "protocol not suppored";
-#endif
-#ifdef EPROTOTYPE
- case EPROTOTYPE: return "protocol wrong type for socket";
-#endif
-#ifdef ERANGE
- case ERANGE: return "math result unrepresentable";
-#endif
-#if defined(EREFUSED) && (!defined(ECONNREFUSED) || (EREFUSED != ECONNREFUSED))
- case EREFUSED: return "EREFUSED";
-#endif
-#ifdef EREMCHG
- case EREMCHG: return "remote address changed";
-#endif
-#ifdef EREMDEV
- case EREMDEV: return "remote device";
-#endif
-#ifdef EREMOTE
- case EREMOTE: return "pathname hit remote file system";
-#endif
-#ifdef EREMOTEIO
- case EREMOTEIO: return "remote i/o error";
-#endif
-#ifdef EREMOTERELEASE
- case EREMOTERELEASE: return "EREMOTERELEASE";
-#endif
-#ifdef EROFS
- case EROFS: return "read-only file system";
-#endif
-#ifdef ERPCMISMATCH
- case ERPCMISMATCH: return "RPC version is wrong";
-#endif
-#ifdef ERREMOTE
- case ERREMOTE: return "object is remote";
-#endif
-#ifdef ESHUTDOWN
- case ESHUTDOWN: return "can't send afer socket shutdown";
-#endif
-#ifdef ESOCKTNOSUPPORT
- case ESOCKTNOSUPPORT: return "socket type not supported";
-#endif
-#ifdef ESPIPE
- case ESPIPE: return "invalid seek";
-#endif
-#ifdef ESRCH
- case ESRCH: return "no such process";
-#endif
-#ifdef ESRMNT
- case ESRMNT: return "srmount error";
-#endif
-#ifdef ESTALE
- case ESTALE: return "stale remote file handle";
-#endif
-#ifdef ESUCCESS
- case ESUCCESS: return "Error 0";
-#endif
-#ifdef ETIME
- case ETIME: return "timer expired";
-#endif
-#ifdef ETIMEDOUT
- case ETIMEDOUT: return "connection timed out";
-#endif
-#ifdef ETOOMANYREFS
- case ETOOMANYREFS: return "too many references: can't splice";
-#endif
-#ifdef ETXTBSY
- case ETXTBSY: return "text file or pseudo-device busy";
-#endif
-#ifdef EUCLEAN
- case EUCLEAN: return "structure needs cleaning";
-#endif
-#ifdef EUNATCH
- case EUNATCH: return "protocol driver not attached";
-#endif
-#ifdef EUSERS
- case EUSERS: return "too many users";
-#endif
-#ifdef EVERSION
- case EVERSION: return "version mismatch";
-#endif
-#if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN))
- case EWOULDBLOCK: return "operation would block";
-#endif
-#ifdef EXDEV
- case EXDEV: return "cross-domain link";
-#endif
-#ifdef EXFULL
- case EXFULL: return "message tables full";
-#endif
- }
-#else /* NO_SYS_ERRLIST */
- extern int sys_nerr;
- extern char *sys_errlist[];
-
- if ((errnum > 0) && (errnum <= sys_nerr))
- return sys_errlist [errnum];
-#endif /* NO_SYS_ERRLIST */
-
- sprintf (msg, "unknown error (%d)", errnum);
- return msg;
-}
-
-gchar*
-g_strsignal (gint signum)
-{
- static char msg[64];
-
-#ifdef HAVE_STRSIGNAL
- extern char *strsignal (int sig);
- return strsignal (signum);
-#elif NO_SYS_SIGLIST
- switch (signum)
- {
-#ifdef SIGHUP
- case SIGHUP: return "Hangup";
-#endif
-#ifdef SIGINT
- case SIGINT: return "Interrupt";
-#endif
-#ifdef SIGQUIT
- case SIGQUIT: return "Quit";
-#endif
-#ifdef SIGILL
- case SIGILL: "Illegal instruction";
-#endif
-#ifdef SIGTRAP
- case SIGTRAP: "Trace/breakpoint trap";
-#endif
-#ifdef SIGABRT
- case SIGABRT: "IOT trap/Abort";
-#endif
-#ifdef SIGBUS
- case SIGBUS: "Bus error";
-#endif
-#ifdef SIGFPE
- case SIGFPE: "Floating point exception";
-#endif
-#ifdef SIGKILL
- case SIGKILL: "Killed";
-#endif
-#ifdef SIGUSR1
- case SIGUSR1: "User defined signal 1";
-#endif
-#ifdef SIGSEGV
- case SIGSEGV: "Segmentation fault";
-#endif
-#ifdef SIGUSR2
- case SIGUSR2: "User defined signal 2";
-#endif
-#ifdef SIGPIPE
- case SIGPIPE: "Broken pipe";
-#endif
-#ifdef SIGALRM
- case SIGALRM: "Alarm clock";
-#endif
-#ifdef SIGTERM
- case SIGTERM: "Terminated";
-#endif
-#ifdef SIGSTKFLT
- case SIGSTKFLT: "Stack fault";
-#endif
-#ifdef SIGCHLD
- case SIGCHLD: "Child exited";
-#endif
-#ifdef SIGCONT
- case SIGCONT: "Continued";
-#endif
-#ifdef SIGSTOP
- case SIGSTOP: "Stopped (signal)";
-#endif
-#ifdef SIGTSTP
- case SIGTSTP: "Stopped";
-#endif
-#ifdef SIGTTIN
- case SIGTTIN: "Stopped (tty input)";
-#endif
-#ifdef SIGTTOU
- case SIGTTOU: "Stopped (tty output)";
-#endif
-#ifdef SIGURG
- case SIGURG: "Urgent condition";
-#endif
-#ifdef SIGXCPU
- case SIGXCPU: "CPU time limit exceeded";
-#endif
-#ifdef SIGXFSZ
- case SIGXFSZ: "File size limit exceeded";
-#endif
-#ifdef SIGVTALRM
- case SIGVTALRM: "Virtual time alarm";
-#endif
-#ifdef SIGPROF
- case SIGPROF: "Profile signal";
-#endif
-#ifdef SIGWINCH
- case SIGWINCH: "Window size changed";
-#endif
-#ifdef SIGIO
- case SIGIO: "Possible I/O";
-#endif
-#ifdef SIGPWR
- case SIGPWR: "Power failure";
-#endif
-#ifdef SIGUNUSED
- case SIGUNUSED: return "Unused signal";
-#endif
- }
-#else /* NO_SYS_SIGLIST */
- extern char *sys_siglist[];
- return sys_siglist [signum];
-#endif /* NO_SYS_SIGLIST */
-
- sprintf (msg, "unknown signal (%d)", signum);
- return msg;
-}
-
-void
-g_error (gchar *format, ...)
-{
- va_list args, args2;
- char *buf;
-
- va_start (args, format);
- va_start (args2, format);
- buf = g_vsprintf (format, &args, &args2);
- va_end (args);
- va_end (args2);
-
- if (error_func)
- {
- (* error_func) (buf);
- }
- else
- {
- fputs ("\n** ERROR **: ", stderr);
- fputs (buf, stderr);
- fputc ('\n', stderr);
- }
-
- abort ();
-}
-
-void
-g_warning (gchar *format, ...)
-{
- va_list args, args2;
- char *buf;
-
- va_start (args, format);
- va_start (args2, format);
- buf = g_vsprintf (format, &args, &args2);
- va_end (args);
- va_end (args2);
-
- if (warning_func)
- {
- (* warning_func) (buf);
- }
- else
- {
- fputs ("\n** WARNING **: ", stderr);
- fputs (buf, stderr);
- fputc ('\n', stderr);
- }
-}
-
-void
-g_message (gchar *format, ...)
-{
- va_list args, args2;
- char *buf;
-
- va_start (args, format);
- va_start (args2, format);
- buf = g_vsprintf (format, &args, &args2);
- va_end (args);
- va_end (args2);
-
- if (message_func)
- {
- (* message_func) (buf);
- }
- else
- {
- fputs ("message: ", stdout);
- fputs (buf, stdout);
- fputc ('\n', stdout);
- }
-}
-
-void
-g_print (gchar *format, ...)
-{
- va_list args, args2;
- char *buf;
-
- va_start (args, format);
- va_start (args2, format);
- buf = g_vsprintf (format, &args, &args2);
- va_end (args);
- va_end (args2);
-
- if (print_func)
- {
- (* print_func) (buf);
- }
- else
- {
- fputs (buf, stdout);
- }
-}
-
-GErrorFunc
-g_set_error_handler (GErrorFunc func)
-{
- GErrorFunc old_error_func;
-
- old_error_func = error_func;
- error_func = func;
-
- return old_error_func;
-}
-
-GWarningFunc
-g_set_warning_handler (GWarningFunc func)
-{
- GWarningFunc old_warning_func;
-
- old_warning_func = warning_func;
- warning_func = func;
-
- return old_warning_func;
-}
-
-GPrintFunc
-g_set_message_handler (GPrintFunc func)
-{
- GPrintFunc old_message_func;
-
- old_message_func = message_func;
- message_func = func;
-
- return old_message_func;
-}
-
-GPrintFunc
-g_set_print_handler (GPrintFunc func)
-{
- GPrintFunc old_print_func;
-
- old_print_func = print_func;
- print_func = func;
-
- return old_print_func;
-}
-
-gint
-g_snprintf (gchar *str,
- gulong n,
- gchar const *fmt,
- ...)
-{
-#ifdef HAVE_VSNPRINTF
- va_list args;
- gint retval;
-
- va_start (args, fmt);
- retval = vsnprintf (str, n, fmt, args);
- va_end (args);
-
- return retval;
-
-#else
- gchar *printed;
- va_list args, args2;
-
- va_start (args, fmt);
- va_start (args2, fmt);
-
- printed = g_vsprintf (fmt, &args, &args2);
- strncpy (str, printed, n);
- str[n-1] = '\0';
-
- va_end (args2);
- va_end (args);
-
- return strlen (str);
-
-#endif
-}
-
-gint
-g_strcasecmp (const gchar *s1, const gchar *s2)
-{
-#ifdef HAVE_STRCASECMP
- return strcasecmp(s1, s2);
-#else
- gint c1, c2;
-
- while (*s1 && *s2)
- {
- c1 = tolower((guchar)(*s1++)); c2 = tolower((guchar)(*s2++));
- if (c1 != c2)
- return (c1 - c2);
- }
-
- return (((gint)(guchar) *s1) - ((gint)(guchar) *s2));
-#endif
-}
-
-guint
-g_parse_debug_string (const gchar *string,
- GDebugKey *keys,
- guint nkeys)
-{
- guint i;
- guint result = 0;
-
- g_return_val_if_fail (string != NULL, 0);
-
- if (!strcmp (string, "ALL"))
- {
- for (i=0; i<nkeys; i++)
- result |= keys[i].value;
- }
- else
- {
- gchar *str = g_strdup (string);
- gchar *p = str;
- gchar *q;
- gboolean done = FALSE;
-
- while (*p && !done)
- {
- q = strchr (p, ':');
- if (!q)
- {
- q = p + strlen(p);
- done = TRUE;
- }
-
- *q = 0;
-
- for (i=0; i<nkeys; i++)
- if (!strcmp(keys[i].key, p))
- result |= keys[i].value;
-
- p = q+1;
- }
-
- g_free (str);
- }
-
- return result;
-}
-
diff --git a/glib/install-sh b/glib/install-sh
deleted file mode 100755
index 89fc9b098b..0000000000
--- a/glib/install-sh
+++ /dev/null
@@ -1,238 +0,0 @@
-#! /bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.
-#
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-tranformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd="$cpprog"
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd="$stripprog"
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "install: no input file specified"
- exit 1
-else
- true
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d $dst ]; then
- instcmd=:
- else
- instcmd=mkdir
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f $src -o -d $src ]
- then
- true
- else
- echo "install: $src does not exist"
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "install: no destination specified"
- exit 1
- else
- true
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d $dst ]
- then
- dst="$dst"/`basename $src`
- else
- true
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
-'
-IFS="${IFS-${defaultIFS}}"
-
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp="${pathcomp}${1}"
- shift
-
- if [ ! -d "${pathcomp}" ] ;
- then
- $mkdirprog "${pathcomp}"
- else
- true
- fi
-
- pathcomp="${pathcomp}/"
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd $dst &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename $dst`
- else
- dstfile=`basename $dst $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename $dst`
- else
- true
- fi
-
-# Make a temp file name in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd $src $dsttmp &&
-
- trap "rm -f ${dsttmp}" 0 &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
-
-# Now rename the file to the real destination.
-
- $doit $rmcmd -f $dstdir/$dstfile &&
- $doit $mvcmd $dsttmp $dstdir/$dstfile
-
-fi &&
-
-
-exit 0
diff --git a/glib/ltconfig b/glib/ltconfig
deleted file mode 100755
index e9d3a83795..0000000000
--- a/glib/ltconfig
+++ /dev/null
@@ -1,1415 +0,0 @@
-#! /bin/sh
-
-# ltconfig - Create a system-specific libtool.
-# Generated automatically from ltconfig.in by configure.
-# Copyright (C) 1996, 1997, Free Software Foundation, Inc.
-# Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
-#
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# A lot of this script is taken from autoconf-2.10.
-
-# The name of this program.
-progname=`echo "$0" | sed 's%^.*/%%'`
-
-# Constants:
-PROGRAM=ltconfig
-PACKAGE=libtool
-VERSION=1.0f
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.c $LIBS 1>&5'
-rm="rm -f"
-
-help="Try \`$progname --help' for more information."
-
-# Sed substitution that helps us do robust quoting. It backslashifies
-# metacharacters that are still active within double-quoted strings.
-sed_quote_subst='s/\([\\"$\\\\]\)/\\\1/g'
-
-# Same as above, but don't quote variable references.
-double_quote_subst='s/\([\\"\\\\]\)/\\\1/g'
-
-# Global variables:
-can_build_shared=yes
-enable_shared=yes
-# All known linkers require a `.a' archive for static linking.
-enable_static=yes
-ltmain=
-silent=
-srcdir=
-ac_config_guess=
-ac_config_sub=
-host=
-nonopt=
-verify_host=yes
-with_gcc=no
-with_gnu_ld=no
-
-old_AR="$AR"
-old_CC="$CC"
-old_CFLAGS="$CFLAGS"
-old_CPPFLAGS="$CPPFLAGS"
-old_LD="$LD"
-old_LN_S="$LN_S"
-old_NM="$NM"
-old_RANLIB="$RANLIB"
-
-# Parse the command line options.
-args=
-prev=
-for option
-do
- case "$option" in
- -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) optarg= ;;
- esac
-
- # If the previous option needs an argument, assign it.
- if test -n "$prev"; then
- eval "$prev=\$option"
- prev=
- continue
- fi
-
- case "$option" in
- --help) cat <<EOM
-Usage: $progname [OPTION]... LTMAIN [HOST]
-
-Generate a system-specific libtool script.
-
- --disable-shared do not build shared libraries
- --disable-static do not build static libraries
- --help display this help and exit
- --no-verify do not verify that HOST is a valid host type
- --quiet same as \`--silent'
- --silent don't print informational messages
- --srcdir=DIR find \`config.guess' in DIR
- --version output version information and exit
- --with-gcc assume that the GNU C compiler will be used
- --with-gnu-ld assume that the C compiler uses the GNU linker
-
-LTMAIN is the \`ltmain.sh' shell script fragment that provides basic libtool
-functionality.
-
-HOST is the canonical host system name [default=guessed].
-EOM
- exit 0
- ;;
-
- --disable-shared) enable_shared=no ;;
-
- --disable-static) enable_static=no ;;
-
- --quiet | --silent) silent=yes ;;
-
- --srcdir) prev=srcdir ;;
- --srcdir=*) srcdir="$optarg" ;;
-
- --no-verify) verify_host=no ;;
-
- --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION"; exit 0 ;;
-
- --with-gcc) with_gcc=yes ;;
- --with-gnu-ld) with_gnu_ld=yes ;;
-
- -*)
- echo "$progname: unrecognized option \`$option'" 1>&2
- echo "$help" 1>&2
- exit 1
- ;;
-
- *)
- if test -z "$ltmain"; then
- ltmain="$option"
- elif test -z "$host"; then
-# FIXME This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1
-# if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then
-# echo "$progname: warning \`$option' is not a valid host type" 1>&2
-# fi
- host="$option"
- else
- echo "$progname: too many arguments" 1>&2
- echo "$help" 1>&2
- exit 1
- fi ;;
- esac
-done
-
-if test -z "$ltmain"; then
- echo "$progname: you must specify a LTMAIN file" 1>&2
- echo "$help" 1>&2
- exit 1
-fi
-
-if test -f "$ltmain"; then :
-else
- echo "$progname: warning: \`$ltmain' does not exist" 1>&2
-fi
-
-# Quote any args containing shell metacharacters.
-ltconfig_args=
-for arg
-do
- case "$arg" in
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ltconfig_args="$ltconfig_args '$arg'" ;;
- *) ltconfig_args="$ltconfig_args $arg" ;;
- esac
-done
-
-# A relevant subset of AC_INIT.
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 5 compiler messages saved in config.log
-# 6 checking for... messages and results
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
-fi
-exec 5>>./config.log
-
-# NLS nuisances.
-# Only set LANG and LC_ALL to C if already set.
-# These must not be set unconditionally because not all systems understand
-# e.g. LANG=C (notably SCO).
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
- fi
-else
- ac_n= ac_c='\c' ac_t=
-fi
-
-if test -z "$srcdir"; then
- # Assume the source directory is the same one as the path to ltmain.sh.
- srcdir=`echo "$ltmain" | sed 's%/[^/]*$%%'`
- test "$srcdir" = "$ltmain" && srcdir=.
-fi
-
-trap "$rm conftest*; exit 1" 1 2 15
-if test "$verify_host" = yes; then
- # Check for config.guess and config.sub.
- ac_aux_dir=
- for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/config.guess; then
- ac_aux_dir=$ac_dir
- break
- fi
- done
- if test -z "$ac_aux_dir"; then
- echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2
- echo "$help" 1>&2
- exit 1
- fi
- ac_config_guess=$ac_aux_dir/config.guess
- ac_config_sub=$ac_aux_dir/config.sub
-
- # Make sure we can run config.sub.
- if $ac_config_sub sun4 >/dev/null 2>&1; then :
- else
- echo "$progname: cannot run $ac_config_sub" 1>&2
- echo "$help" 1>&2
- exit 1
- fi
-
- echo $ac_n "checking host system type""... $ac_c" 1>&6
-
- host_alias=$host
- case "$host_alias" in
- "")
- if host_alias=`$ac_config_guess`; then :
- else
- echo "$progname: cannot guess host type; you must specify one" 1>&2
- echo "$help" 1>&2
- exit 1
- fi ;;
- esac
- host=`$ac_config_sub $host_alias`
- echo "$ac_t$host" 1>&6
-
- # Make sure the host verified.
- test -z "$host" && exit 1
-
-elif test -z "$host"; then
- echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2
- echo "$help" 1>&2
- exit 1
-else
- host_alias=$host
-fi
-
-# Transform *-*-linux* to *-*-linux-gnu*, to support old configure scripts.
-case "$host" in
-*-*-linux-gnu*) ;;
-*-*-linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
-esac
-
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-
-case "$host_os" in
-aix*)
- # AIX sometimes has problems with the GCC collect2 program. For some
- # reason, if we set the COLLECT_NAMES environment variable, the problems
- # vanish in a puff of smoke.
- if test "${COLLECT_NAMES+set}" != set; then
- COLLECT_NAMES=
- export COLLECT_NAMES
- fi
- ;;
-esac
-
-# Determine commands to create old-style static archives.
-old_archive_cmds='$AR cru $oldlib$oldobjs'
-old_postinstall_cmds='chmod 644 $oldlib'
-
-# Set a sane default for `AR'.
-test -z "$AR" && AR=ar
-
-# If RANLIB is not set, then run the test.
-if test "${RANLIB+set}" != "set"; then
- result=no
-
- echo $ac_n "checking for ranlib... $ac_c" 1>&6
- IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
- for dir in $PATH; do
- test -z "$dir" && dir=.
- if test -f $dir/ranlib; then
- RANLIB="ranlib"
- result="ranlib"
- break
- fi
- done
- IFS="$save_ifs"
-
- echo "$ac_t$result" 1>&6
-fi
-
-if test -n "$RANLIB"; then
- old_archive_cmds="$old_archive_cmds;\$RANLIB \$oldlib"
- old_postinstall_cmds="$old_postinstall_cmds;\$RANLIB \$oldlib"
-fi
-
-# Check to see if we are using GCC.
-if test "$with_gcc" != yes || test -z "$CC"; then
- # If CC is not set, then try to find GCC or a usable CC.
- if test -z "$CC"; then
- echo $ac_n "checking for gcc... $ac_c" 1>&6
- IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
- for dir in $PATH; do
- IFS="$save_ifs"
- test -z "$dir" && dir=.
- if test -f $dir/gcc; then
- CC="gcc"
- break
- fi
- done
- IFS="$save_ifs"
-
- if test -n "$CC"; then
- echo "$ac_t$CC" 1>&6
- else
- echo "$ac_t"no 1>&6
- fi
- fi
-
- # Not "gcc", so try "cc", rejecting "/usr/ucb/cc".
- if test -z "$CC"; then
- echo $ac_n "checking for cc... $ac_c" 1>&6
- IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
- cc_rejected=no
- for dir in $PATH; do
- test -z "$dir" && dir=.
- if test -f $dir/cc; then
- if test "$dir/cc" = "/usr/ucb/cc"; then
- cc_rejected=yes
- continue
- fi
- CC="cc"
- break
- fi
- done
- IFS="$save_ifs"
- if test $cc_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $CC
- shift
- if test $# -gt 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same name, so the bogon will be chosen
- # first if we set CC to just the name; use the full file name.
- shift
- set dummy "$dir/cc" "$@"
- shift
- CC="$@"
- fi
- fi
-
- if test -n "$CC"; then
- echo "$ac_t$CC" 1>&6
- else
- echo "$ac_t"no 1>&6
- fi
-
- if test -z "$CC"; then
- echo "$progname: error: no acceptable cc found in \$PATH" 1>&2
- exit 1
- fi
- fi
-
- # Now see if the compiler is really GCC.
- with_gcc=no
- echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6
- echo "$progname:394: checking whether we are using GNU C" >&5
-
- $rm conftest.c
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
- if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:402: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- with_gcc=yes
- fi
- $rm conftest.c
- echo "$ac_t$with_gcc" 1>&6
-fi
-
-# Allow CC to be a program name with arguments.
-set dummy $CC
-compiler="$2"
-
-echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6
-pic_flag=
-profile_flag_pattern=
-special_shlib_compile_flags=
-wl=
-link_static_flag=
-no_builtin_flag=
-
-if test "$with_gcc" = yes; then
- profile_flag_pattern='-pg?'
- wl='-Wl,'
- link_static_flag='-static'
- no_builtin_flag=' -fno-builtin'
-
- case "$host_os" in
- aix3* | aix4* | irix5* | irix6* | osf3* | osf4*)
- # PIC is the default for these OSes.
- ;;
- os2*)
- # We can build DLLs from non-PIC.
- ;;
- *)
- pic_flag='-fPIC'
- ;;
- esac
-else
- # PORTME Check for PIC flags for the system compiler.
- case "$host_os" in
- aix3* | aix4*)
- # All AIX code is PIC.
- link_static_flag='-bnso -bI:/lib/syscalls.exp'
- ;;
-
- hpux9* | hpux10*)
- # Is there a better link_static_flag that works with the bundled CC?
- wl='-Wl,'
- link_static_flag='${wl}-a ${wl}archive'
- pic_flag='+Z'
- ;;
-
- irix5* | irix6*)
- wl='-Wl,'
- link_static_flag='-non_shared'
- # PIC (with -KPIC) is the default.
- ;;
-
- os2*)
- # We can build DLLs from non-PIC.
- ;;
-
- osf3* | osf4*)
- # All OSF/1 code is PIC.
- wl='-Wl,'
- link_static_flag='-non_shared'
- ;;
-
- sco3.2v5*)
- pic_flag='-Kpic'
- link_static_flag='-dn'
- special_shlib_compile_flags='-belf'
- ;;
-
- solaris2*)
- pic_flag='-KPIC'
- link_static_flag='-Bstatic'
- wl='-Wl,'
- ;;
-
- sunos4*)
- pic_flag='-PIC'
- link_static_flag='-Bstatic'
- wl='-Qoption ld '
- ;;
-
- uts4*)
- pic_flag='-pic'
- link_static_flag='-Bstatic'
- ;;
-
- *)
- can_build_shared=no
- ;;
- esac
-fi
-
-if test -n "$pic_flag"; then
- echo "$ac_t$pic_flag" 1>&6
-
- # Check to make sure the pic_flag actually works.
- echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6
- $rm conftest*
- echo > conftest.c
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $pic_flag -DPIC"
- echo "$progname:507: checking if $compiler PIC flag $pic_flag works" >&5
- if { (eval echo $progname:508: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then
- # Append any errors to the config.log.
- cat conftest.err 1>&5
-
- # On HP-UX, the stripped-down bundled CC doesn't accept +Z, but also
- # reports no error. So, we need to grep stderr for (Bundled).
- if grep '(Bundled)' conftest.err >/dev/null; then
- echo "$ac_t"no 1>&6
- can_build_shared=no
- pic_flag=
- else
- echo "$ac_t"yes 1>&6
- pic_flag=" $pic_flag"
- fi
- else
- # Append any errors to the config.log.
- cat conftest.err 1>&5
- can_build_shared=no
- pic_flag=
- echo "$ac_t"no 1>&6
- fi
- CFLAGS="$save_CFLAGS"
- $rm conftest*
-else
- echo "$ac_t"none 1>&6
-fi
-
-# Check for any special shared library compilation flags.
-if test -n "$special_shlib_compile_flags"; then
- echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2
- if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then :
- else
- echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2
- can_build_shared=no
- fi
-fi
-
-echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6
-$rm conftest*
-echo 'main(){return(0);}' > conftest.c
-save_LDFLAGS="$LDFLAGS"
-LDFLAGS="$LDFLAGS $link_static_flag"
-echo "$progname:550: checking if $compiler static flag $link_static_flag works" >&5
-if { (eval echo $progname:551: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- echo "$ac_t$link_static_flag" 1>&6
-else
- echo "$ac_t"none 1>&6
- link_static_flag=
-fi
-LDFLAGS="$save_LDFLAGS"
-$rm conftest*
-
-if test -z "$LN_S"; then
- # Check to see if we can use ln -s, or we need hard links.
- echo $ac_n "checking whether ln -s works... $ac_c" 1>&6
- $rm conftestdata
- if ln -s X conftestdata 2>/dev/null; then
- $rm conftestdata
- LN_S="ln -s"
- else
- LN_S=ln
- fi
- if test "$LN_S" = "ln -s"; then
- echo "$ac_t"yes 1>&6
- else
- echo "$ac_t"no 1>&6
- fi
-fi
-
-# Make sure LD is an absolute path.
-if test -z "$LD"; then
- ac_prog=ld
- if test "$with_gcc" = yes; then
- # Check if gcc -print-prog-name=ld gives a path.
- echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6
- echo "$progname:583: checking for ld used by GCC" >&5
- ac_prog=`($CC -print-prog-name=ld) 2>&5`
- case "$ac_prog" in
- # Accept absolute paths.
- /*)
- test -z "$LD" && LD="$ac_prog"
- ;;
- "")
- # If it fails, then pretend we aren't using GCC.
- ac_prog=ld
- ;;
- *)
- # If it is relative, then search for the first ld in PATH.
- with_gnu_ld=unknown
- ;;
- esac
- elif test "$with_gnu_ld" = yes; then
- echo $ac_n "checking for GNU ld... $ac_c" 1>&6
- echo "$progname:601: checking for GNU ld" >&5
- else
- echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
- echo "$progname:604: checking for non-GNU ld" >&5
- fi
-
- if test -z "$LD"; then
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f "$ac_dir/$ac_prog"; then
- LD="$ac_dir/$ac_prog"
- # Check to see if the program is GNU ld. I'd rather use --version,
- # but apparently some GNU ld's only accept -v.
- # Break only if it was the GNU/non-GNU ld that we prefer.
- if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
- test "$with_gnu_ld" != no && break
- else
- test "$with_gnu_ld" != yes && break
- fi
- fi
- done
- IFS="$ac_save_ifs"
- fi
-
- if test -n "$LD"; then
- echo "$ac_t$LD" 1>&6
- else
- echo "$ac_t"no 1>&6
- fi
-
- if test -z "$LD"; then
- echo "$progname: error: no acceptable ld found in \$PATH" 1>&2
- exit 1
- fi
-fi
-
-# Check to see if it really is or isn't GNU ld.
-echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6
-# I'd rather use --version here, but apparently some GNU ld's only accept -v.
-if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
- with_gnu_ld=yes
-else
- with_gnu_ld=no
-fi
-echo "$ac_t$with_gnu_ld" 1>&6
-
-# See if the linker supports building shared libraries.
-echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6
-
-allow_undefined_flag=
-archive_cmds=
-old_archive_from_new_cmds=
-export_dynamic_flag_spec=
-hardcode_libdir_flag_spec=
-hardcode_libdir_separator=
-hardcode_direct=no
-hardcode_minus_L=no
-hardcode_runpath_var=no
-hardcode_shlibpath_var=unsupported
-runpath_var=
-
-ld_shlibs=yes
-if test "$with_gnu_ld" = yes; then
- # See if GNU ld supports shared libraries.
-
- case "$host_os" in
- sunos4*)
- ld_shlibs=yes
- hardcode_direct=yes
- hardcode_shlibpath_var=no
- ;;
-
- *)
- if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
- runpath_var=LD_RUN_PATH
- hardcode_runpath_var=yes
- ld_shlibs=yes
- else
- ld_shlibs=no
- fi
- ;;
- esac
-
- if test "$ld_shlibs" = yes; then
- archive_cmds='$CC -shared ${wl}-soname $wl$soname -o $lib$libobjs$deplibs'
- hardcode_libdir_flag_spec='${wl}-rpath $wl$libdir'
- export_dynamic_flag_spec='${wl}-export-dynamic'
- fi
-else
- # PORTME fill in a description of your system's linker (not GNU ld)
- case "$host_os" in
- aix3*)
- allow_undefined_flag=unsupported
- archive_cmds='$NM$libobjs | $global_symbol_pipe | sed '"'s/.* //'"' > $lib.exp;$LD -o $objdir/$soname$libobjs -bE:$lib.exp -T512 -H512 -bM:SRE$deplibs;$AR cru $lib $objdir/$soname'
- # Note: this linker hardcodes the directories in LIBPATH if there
- # are no directories specified by -L.
- hardcode_minus_L=yes
- if test "$with_gcc" = yes && test -z "$link_static_flag"; then
- # Neither direct hardcoding nor static linking is supported with a
- # broken collect2.
- hardcode_direct=unsupported
- fi
- ;;
-
- aix4*)
- allow_undefined_flag=unsupported
- archive_cmds='$NM$libobjs | $global_symbol_pipe | sed '"'s/.* //'"' > $lib.exp;$CC -o $objdir/$soname$libobjs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry$deplibs;$AR cru $lib $objdir/$soname'
- hardcode_direct=yes
- hardcode_minus_L=yes
- ;;
-
- # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
- # support. Future versions do this automatically, but an explicit c++rt0.o
- # doesn't break anything, and helps significantly (at the cost of a little
- # extra space).
- freebsd2.2*)
- archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs /usr/lib/c++rt0.o'
- hardcode_direct=yes
- hardcode_minus_L=yes
- hardcode_shlibpath_var=no
- ;;
-
- # Unfortunately, older versions of FreeBSD 2 don't have this feature.
- freebsd2*)
- archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs'
- hardcode_direct=yes
- hardcode_minus_L=yes
- hardcode_shlibpath_var=no
- ;;
-
- # FreeBSD 3, at last, uses gcc -shared to do shared libraries.
- freebsd3*)
- archive_cmds='$CC -shared -o $lib$libobjs$deplibs'
- hardcode_libdir_flag_spec='-R$libdir'
- hardcode_direct=yes
- hardcode_minus_L=yes
- hardcode_shlibpath_var=no
- ;;
-
- hpux9*)
- archive_cmds='$rm $objdir/$soname;$LD -b +s +b $install_libdir -o $objdir/$soname$libobjs$deplibs;mv $objdir/$soname $lib'
- hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
- hardcode_direct=yes
- hardcode_minus_L=yes
- ;;
-
- hpux10*)
- archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib$libobjs$deplibs'
- hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
- hardcode_direct=yes
- hardcode_minus_L=yes
- ;;
-
- irix5* | irix6*)
- archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs$deplibs'
- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
- ;;
-
- netbsd*)
- # Tested with NetBSD 1.2 ld
- archive_cmds='$LD -Bshareable -o $lib$libobjs'
- hardcode_libdir_flag_spec='-R$libdir'
- hardcode_direct=yes
- hardcode_shlibpath_var=no
- ;;
-
- openbsd*)
- archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs'
- hardcode_libdir_flag_spec='-R$libdir'
- hardcode_direct=yes
- hardcode_shlibpath_var=no
- ;;
-
- os2*)
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_minus_L=yes
- allow_undefined_flag=unsupported
- archive_cmds='echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def;echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def;echo DATA >> $objdir/$libname.def;echo " SINGLE NONSHARED" >> $objdir/$libname.def;echo EXPORTS >> $objdir/$libname.def;emxexp$libobjs >> $objdir/$libname.def;$CC -Zdll -Zcrtdll -o $lib$libobjs $objdir/$libname.def'
- old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def'
- ;;
-
- osf3* | osf4*)
- allow_undefined_flag=' -expect_unresolved \*'
- archive_cmds='$LD -shared${allow_undefined_flag} -o $lib -soname $soname -set_version $verstring$libobjs$deplibs'
- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
- hardcode_libdir_separator=:
- ;;
-
- sco3.2v5*)
- archive_cmds='$LD -G -o $lib$libobjs$deplibs'
- hardcode_direct=yes
- ;;
-
- solaris2*)
- archive_cmds='$LD -G -z text -h $soname -o $lib$libobjs$deplibs'
- hardcode_libdir_flag_spec='-R$libdir'
- hardcode_shlibpath_var=no
- ;;
-
- sunos4*)
- archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs'
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_direct=yes
- hardcode_minus_L=yes
- hardcode_shlibpath_var=no
- ;;
-
- uts4*)
- archive_cmds='$LD -G -h $soname -o $lib$libobjs$deplibs'
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_direct=no
- hardcode_minus_L=no
- hardcode_shlibpath_var=no
- ;;
-
- *)
- ld_shlibs=no
- can_build_shared=no
- ;;
- esac
-fi
-echo "$ac_t$ld_shlibs" 1>&6
-
-if test -z "$NM"; then
- echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6
- case "$NM" in
- /*) ;; # Let the user override the test with a path.
- *)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in /usr/ucb $PATH /bin; do
- test -z "$ac_dir" && dir=.
- if test -f $ac_dir/nm; then
- # Check to see if the nm accepts a BSD-compat flag.
- if ($ac_dir/nm -B /dev/null 2>&1; exit 0) | grep /dev/null >/dev/null; then
- NM="$ac_dir/nm -B"
- elif ($ac_dir/nm -p /dev/null 2>&1; exit 0) | grep /dev/null >/dev/null; then
- NM="$ac_dir/nm -p"
- else
- NM="$ac_dir/nm"
- fi
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$NM" && NM=nm
- ;;
- esac
- echo "$ac_t$NM" 1>&6
-fi
-
-# Check for command to grab the raw symbol name followed by C symbol from nm.
-echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6
-
-# These are sane defaults that work on at least a few old systems.
-# [They come from Ultrix. What could be older than Ultrix?!! ;)]
-
-# Character class describing NM global symbol codes.
-symcode='[BCDEGRSTU]'
-
-# Regexp to match symbols that can be accessed directly from C.
-sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
-
-# Transform the above into a raw symbol and a C symbol.
-symxfrm='\1 \1'
-
-# Define system-specific variables.
-case "$host_os" in
-aix*)
- symcode='[BCDTU]'
- ;;
-solaris2*)
- symcode='[BDTU]'
- ;;
-esac
-
-# If we're using GNU nm, then use its standard symbol codes.
-if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
- symcode='[ABCDGISTUW]'
-fi
-
-# Write the raw and C identifiers.
-global_symbol_pipe="sed -n -e 's/^.* $symcode $sympat$/$symxfrm/p'"
-
-# Check to see that the pipe works correctly.
-pipe_works=no
-$rm conftest*
-cat > conftest.c <<EOF
-#ifdef __cplusplus
-extern "C" {
-#endif
-char nm_test_var;
-void nm_test_func(){}
-#ifdef __cplusplus
-}
-#endif
-main(){nm_test_var='a';nm_test_func();return(0);}
-EOF
-
-echo "$progname:900: checking if global_symbol_pipe works" >&5
-if { (eval echo $progname:901: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.o; then
- # Now try to grab the symbols.
- nlist=conftest.nm
- if { echo "$progname:904: eval \"$NM conftest.o | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.o | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then
-
- # Try sorting and uniquifying the output.
- if sort "$nlist" | uniq > "$nlist"T; then
- mv -f "$nlist"T "$nlist"
- wcout=`wc "$nlist" 2>/dev/null`
- count=`echo "$wcout" | sed 's/^[ ]*\([0-9][0-9]*\).*$/\1/'`
- (test "$count" -ge 0) 2>/dev/null || count=-1
- else
- rm -f "$nlist"T
- count=-1
- fi
-
- # Make sure that we snagged all the symbols we need.
- if egrep ' nm_test_var$' "$nlist" >/dev/null; then
- if egrep ' nm_test_func$' "$nlist" >/dev/null; then
- cat <<EOF > conftest.c
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-EOF
- # Now generate the symbol file.
- sed 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> conftest.c
-
- cat <<EOF >> conftest.c
-#if defined (__STDC__) && __STDC__
-# define __ptr_t void *
-#else
-# define __ptr_t char *
-#endif
-
-/* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
-int dld_preloaded_symbol_count = $count;
-
-/* The mapping between symbol names and symbols. */
-struct {
- char *name;
- __ptr_t address;
-}
-dld_preloaded_symbols[] =
-{
-EOF
- sed 's/^\(.*\) \(.*\)$/ {"\1", \&\2},/' < "$nlist" >> conftest.c
- cat <<\EOF >> conftest.c
- {0},
-};
-
-#ifdef __cplusplus
-}
-#endif
-EOF
- # Now try linking the two files.
- mv conftest.o conftestm.o
- save_LIBS="$LIBS"
- save_CFLAGS="$CFLAGS"
- LIBS='conftestm.o'
- CFLAGS="$CFLAGS$no_builtin_flag"
- if { (eval echo $progname:962: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- pipe_works=yes
- else
- echo "$progname: failed program was:" >&5
- cat conftest.c >&5
- fi
- LIBS="$save_LIBS"
- else
- echo "cannot find nm_test_func in $nlist" >&5
- fi
- else
- echo "cannot find nm_test_var in $nlist" >&5
- fi
- else
- echo "cannot run $global_symbol_pipe" >&5
- fi
-else
- echo "$progname: failed program was:" >&5
- cat conftest.c >&5
-fi
-$rm conftest*
-
-# Don't use the global_symbol_pipe unless it works.
-echo "$ac_t$pipe_works" 1>&6
-test "$pipe_works" = yes || global_symbol_pipe=
-
-# Check hardcoding attributes.
-echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6
-hardcode_action=
-if test -n "$hardcode_libdir_flag_spec" || \
- test "$hardcode_runpath_var" = yes; then
-
- # We can hardcode non-existant directories.
- if test "$hardcode_direct" != no && \
- test "$hardcode_minus_L" != no && \
- test "$hardcode_shlibpath_var" != no; then
-
- # Linking always hardcodes the temporary library directory.
- hardcode_action=relink
- else
- # We can link without hardcoding, and we can hardcode nonexisting dirs.
- hardcode_action=immediate
- fi
-elif test "$hardcode_direct" != yes && \
- test "$hardcode_minus_L" != yes && \
- test "$hardcode_shlibpath_var" != yes; then
- # We can't hardcode anything.
- hardcode_action=unsupported
-else
- # We can only hardcode existing directories.
- hardcode_action=relink
-fi
-echo "$ac_t$hardcode_action" 1>&6
-test "$hardcode_action" = unsupported && can_build_shared=no
-
-
-reload_flag=
-reload_cmds='$LD$reload_flag -o $output$reload_objs'
-echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6
-# PORTME Some linker may need a different reload flag.
-reload_flag='-r'
-echo "$ac_t$reload_flag"
-test -n "$reload_flag" && reload_flag=" $reload_flag"
-
-# PORTME Fill in your ld.so characteristics
-library_names_spec=
-libname_spec='lib$name'
-soname_spec=
-postinstall_cmds=
-finish_cmds=
-shlibpath_var=
-version_type=none
-dynamic_linker="$host_os ld.so"
-
-echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6
-case "$host_os" in
-aix3* | aix4*)
- version_type=linux
- library_names_spec='$libname.so.$versuffix $libname.a'
- shlibpath_var=LIBPATH
-
- # AIX has no versioning support, so we append a major version to the name.
- soname_spec='$libname.so.$major'
- ;;
-
-freebsd2* | freebsd3*)
- version_type=sunos
- library_names_spec='$libname.so.$versuffix $libname.so'
- finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-gnu*)
- version_type=sunos
- library_names_spec='$libname.so.$versuffix'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-hpux9* | hpux10*)
- # Give a soname corresponding to the major version so that dld.sl refuses to
- # link against other versions.
- dynamic_linker="$host_os dld.sl"
- version_type=sunos
- shlibpath_var=SHLIB_PATH
- library_names_spec='$libname.sl.$versuffix $libname.sl.$major $libname.sl'
- soname_spec='$libname.sl.$major'
- # HP-UX runs *really* slowly unless shared libraries are mode 555.
- postinstall_cmds='chmod 555 $lib'
- ;;
-
-irix5* | irix6*)
- version_type=osf
- soname_spec='$libname.so'
- library_names_spec='$libname.so.$versuffix $libname.so'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-# No shared lib support for Linux oldld, aout, or coff.
-linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
- dynamic_linker=no
- ;;
-
-# This must be Linux ELF.
-linux-gnu*)
- version_type=linux
- library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
- soname_spec='$libname.so.$major'
- finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
- shlibpath_var=LD_LIBRARY_PATH
-
- if test -f /lib/ld.so.1; then
- dynamic_linker='GNU ld.so'
- else
- # Only the GNU ld.so supports shared libraries on MkLinux.
- case "$host_cpu" in
- powerpc*) dynamic_linker=no ;;
- *) dynamic_linker='Linux ld.so' ;;
- esac
- fi
- ;;
-
-netbsd* | openbsd*)
- version_type=sunos
- library_names_spec='$libname.so.$versuffix'
- finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-os2*)
- version_type=none
- libname_spec='$name'
- library_names_spec='$libname.dll $libname.a'
- dynamic_linker='OS/2 ld.exe'
- shlibpath_var=LIBPATH
- ;;
-
-osf3* | osf4*)
- version_type=osf
- soname_spec='$libname.so'
- library_names_spec='$libname.so.$versuffix $libname.so'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-sco3.2v5*)
- version_type=osf
- soname_spec='$libname.so.$major'
- library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-solaris2*)
- version_type=linux
- library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
- soname_spec='$libname.so.$major'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-sunos4*)
- version_type=sunos
- library_names_spec='$libname.so.$versuffix'
- finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-uts4*)
- version_type=linux
- library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
- soname_spec='$libname.so.$major'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-*)
- dynamic_linker=no
- ;;
-esac
-echo "$ac_t$dynamic_linker"
-test "$dynamic_linker" = no && can_build_shared=no
-
-# FIXME add checks for striplib and old_striplib here.
-# strip -x works for most platforms, though not for static libraries on NetBSD
-# HP-UX requires "-r" for library stripping
-striplib=
-old_striplib=
-
-# Report the final consequences.
-echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6
-
-echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6
-test "$can_build_shared" = "no" && enable_shared=no
-
-# On AIX, shared libraries and static libraries use the same namespace, and
-# are all built from PIC.
-case "$host_os" in
-aix*)
- test "$enable_shared" = yes && enable_static=no
- if test -n "$RANLIB"; then
- archive_cmds="$archive_cmds;\$RANLIB \$lib"
- postinstall_cmds='$RANLIB $lib'
- fi
- ;;
-esac
-
-echo "$ac_t$enable_shared" 1>&6
-
-# Make sure either enable_shared or enable_static is yes.
-test "$enable_shared" = yes || enable_static=yes
-
-echo "checking whether to build static libraries... $enable_static" 1>&6
-
-echo $ac_n "checking for objdir... $ac_c" 1>&6
-rm -f .libs 2>/dev/null
-mkdir .libs 2>/dev/null
-if test -d .libs; then
- objdir=.libs
-else
- # MS-DOS does not allow filenames that begin with a dot.
- objdir=_libs
-fi
-rmdir .libs 2>/dev/null
-echo "$ac_t$objdir" 1>&6
-
-# Now quote all the things that may contain metacharacters.
-for var in old_CC old_CFLAGS old_CPPFLAGS old_LD old_NM old_RANLIB \
- old_LN_S AR CC LD LN_S NM reload_flag reload_cmds wl pic_flag \
- link_static_flag no_builtin_flag export_dynamic_flag_spec \
- profile_flag_pattern libname_spec library_names_spec soname_spec RANLIB \
- old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
- archive_cmds postinstall_cmds \
- allow_undefined_flag finish_cmds global_symbol_pipe \
- striplib old_striplib \
- hardcode_libdir_flag_spec hardcode_libdir_separator; do
-
- case "$var" in
- reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
- old_postinstall_cmds | archive_cmds | postinstall_cmds | finish_cmds)
- # Double-quote double-evaled strings.
- eval "$var=\`echo \"\$$var\" | sed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\"\`"
- ;;
- *)
- eval "$var=\`echo \"\$$var\" | sed \"\$sed_quote_subst\"\`"
- ;;
- esac
-done
-
-ofile=libtool
-trap "$rm $ofile; exit 1" 1 2 15
-echo creating $ofile
-$rm $ofile
-cat <<EOF > $ofile
-#! /bin/sh
-
-# libtool - Provide generalized library-building support services.
-#
-# Generated automatically by $PROGRAM - GNU $PACKAGE $VERSION
-# This program was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# CC="$old_CC" CFLAGS="$old_CFLAGS" CPPFLAGS="$old_CPPFLAGS" \\
-# LD="$old_LD" NM="$old_NM" RANLIB="$old_RANLIB" LN_S="$old_LN_S" \\
-# $0$ltconfig_args
-#
-# Compiler and other test output produced by $progname, useful for
-# debugging $progname, is in ./config.log if it exists.
-
-# The version of $progname that generated this script.
-LTCONFIG_VERSION="$VERSION"
-
-# Shell to use when invoking shell scripts.
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-# Whether or not to build libtool libraries.
-build_libtool_libs=$enable_shared
-
-# Whether or not to build old-style libraries.
-build_old_libs=$enable_static
-
-# The host system.
-host_alias="$host_alias"
-host="$host"
-
-# The archiver.
-AR="$AR"
-
-# The default C compiler.
-CC="$CC"
-
-# The linker used to build libraries.
-LD="$LD"
-
-# Whether we need hard or soft links.
-LN_S="$LN_S"
-
-# A BSD-compatible nm program.
-NM="$NM"
-
-# The name of the directory that contains temporary libtool files.
-objdir="$objdir"
-
-# How to create reloadable object files.
-reload_flag="$reload_flag"
-reload_cmds="$reload_cmds"
-
-# How to pass a linker flag through the compiler.
-wl="$wl"
-
-# Additional compiler flags for building library objects.
-pic_flag="$pic_flag"
-
-# Compiler flag to prevent dynamic linking.
-link_static_flag="$link_static_flag"
-
-# Compiler flag to turn off builtin functions.
-no_builtin_flag="$no_builtin_flag"
-
-# Compiler flag to allow reflexive dlopens.
-export_dynamic_flag_spec="$export_dynamic_flag_spec"
-
-# Pattern to match compiler flags for creating libNAME_p libraries:
-profile_flag_pattern="$profile_flag_pattern"
-
-# Library versioning type.
-version_type=$version_type
-
-# Format of library name prefix.
-libname_spec="$libname_spec"
-
-# List of archive names. First name is the real one, the rest are links.
-# The last name is the one that the linker finds with -lNAME.
-library_names_spec="$library_names_spec"
-
-# The coded name of the library, if different from the real name.
-soname_spec="$soname_spec"
-
-# Commands used to build and install an old-style archive.
-RANLIB="$RANLIB"
-old_archive_cmds="$old_archive_cmds"
-old_postinstall_cmds="$old_postinstall_cmds"
-
-# Create an old-style archive from a shared archive.
-old_archive_from_new_cmds="$old_archive_from_new_cmds"
-
-# Commands used to build and install a shared archive.
-archive_cmds="$archive_cmds"
-postinstall_cmds="$postinstall_cmds"
-
-# Flag that allows shared libraries with undefined symbols to be built.
-allow_undefined_flag="$allow_undefined_flag"
-
-# Commands used to finish a libtool library installation in a directory.
-finish_cmds="$finish_cmds"
-
-# Take the output of nm and produce a listing of raw symbols and C names.
-global_symbol_pipe="$global_symbol_pipe"
-
-# How to strip a library file.
-striplib="$striplib"
-old_striplib="$old_striplib"
-
-# This is the shared library runtime path variable.
-runpath_var=$runpath_var
-
-# This is the shared library path variable.
-shlibpath_var=$shlibpath_var
-
-# How to hardcode a shared library path into an executable.
-hardcode_action=$hardcode_action
-
-# Flag to hardcode \$libdir into a binary during linking.
-# This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec="$hardcode_libdir_flag_spec"
-
-# Whether we need a single -rpath flag with a separated argument.
-hardcode_libdir_separator="$hardcode_libdir_separator"
-
-# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
-# resulting binary.
-hardcode_direct=$hardcode_direct
-
-# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
-# resulting binary.
-hardcode_minus_L=$hardcode_minus_L
-
-# Set to yes if using RUNPATH_VAR=DIR during linking hardcodes DIR into the
-# resulting binary.
-hardcode_runpath_var=$hardcode_runpath_var
-
-# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
-# the resulting binary.
-hardcode_shlibpath_var=$hardcode_shlibpath_var
-
-EOF
-
-case "$host_os" in
-aix*)
- cat <<\EOF >> $ofile
-# AIX sometimes has problems with the GCC collect2 program. For some
-# reason, if we set the COLLECT_NAMES environment variable, the problems
-# vanish in a puff of smoke.
-if test "${COLLECT_NAMES+set}" != set; then
- COLLECT_NAMES=
- export COLLECT_NAMES
-fi
-
-EOF
- ;;
-esac
-
-# Detect if we are using a relative or absolute path to ltmain.sh.
-case "$ltmain" in
-/*) cat <<EOF >> $ofile
-# Execute the libtool backend.
-. $ltmain
-EOF
- ;;
-*) cat <<EOF >> $ofile
-# Find the path to this script.
-thisdir=\`echo "\$0" | sed -e 's%/[^/]*\$%%'\`
-test "X\$0" = "X\$thisdir" && thisdir=.
-
-# Execute the libtool backend.
-. \$thisdir/$ltmain
-EOF
- ;;
-esac
-
-echo 'exit 1' >> $ofile
-
-chmod +x $ofile
-exit 0
-
-# Local Variables:
-# mode:shell-script
-# sh-indentation:2
-# End:
diff --git a/glib/ltmain.sh b/glib/ltmain.sh
deleted file mode 100644
index cb46c84987..0000000000
--- a/glib/ltmain.sh
+++ /dev/null
@@ -1,2372 +0,0 @@
-# ltmain.sh - Provide generalized library-building support services.
-# Generated automatically from ltmain.in by configure.
-# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
-# Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-#FIXME: echo=echo
-echo='printf %s\n'
-if test "X`$echo '\t'`" = 'X\t'; then :
-else
- # The Solaris and AIX default echo program unquotes backslashes.
- # This makes it impossible to quote backslashes using
- # echo "$something" | sed 's/\\/\\\\/g'
- # So, we emulate echo with printf '%s\n'
- echo='printf %s\n'
- if test "X`$echo '\t'`" = 'X\t'; then :
- else
- # Oops. We have no working printf. Try to find a not-so-buggy echo.
- echo=echo
- IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
- save_PATH="$PATH"
- PATH="$PATH":/usr/ucb
- for dir in $PATH; do
- if test -f $dir/echo && test "X`$dir/echo '\t'`" = 'X\t'; then
- echo="$dir/echo"
- break
- fi
- done
- IFS="$save_ifs"
- PATH="$save_PATH"
- fi
-fi
-
-# The name of this program.
-progname=`$echo "$0" | sed 's%^.*/%%'`
-
-# Constants.
-PROGRAM=ltmain.sh
-PACKAGE=libtool
-VERSION=1.0f
-
-default_mode=
-help="Try \`$progname --help' for more information."
-magic="%%%MAGIC variable%%%"
-mkdir="mkdir"
-mv="mv -f"
-rm="rm -f"
-
-# Sed substitution that helps us do robust quoting. It backslashifies
-# metacharacters that are still active within double-quoted strings.
-sed_quote_subst='s/\([\\"$\\\\]\)/\\\1/g'
-
-# NLS nuisances.
-# Only set LANG and LC_ALL to C if already set.
-# These must not be set unconditionally because not all systems understand
-# e.g. LANG=C (notably SCO).
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-
-if test "$LTCONFIG_VERSION" != "$VERSION"; then
- $echo "$progname: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
- $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
- exit 1
-fi
-
-if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
- $echo "$progname: not configured to build any kind of library" 1>&2
- $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
- exit 1
-fi
-
-# Global variables.
-mode=$default_mode
-nonopt=
-prev=
-prevopt=
-run=
-show="$echo"
-show_help=
-execute_dlfiles=
-
-# Parse our command line options once, thoroughly.
-while test $# -gt 0
-do
- arg="$1"
- shift
-
- case "$arg" in
- -*=*) optarg=`$echo "$arg" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) optarg= ;;
- esac
-
- # If the previous option needs an argument, assign it.
- if test -n "$prev"; then
- case "$prev" in
- execute_dlfiles)
- eval "$prev=\"\$$prev \$arg\""
- ;;
- *)
- eval "$prev=\$arg"
- ;;
- esac
-
- prev=
- prevopt=
- continue
- fi
-
- # Have we seen a non-optional argument yet?
- case "$arg" in
- --help)
- show_help=yes
- ;;
-
- --version)
- $echo "$PROGRAM (GNU $PACKAGE) $VERSION"
- exit 0
- ;;
-
- --dry-run | -n)
- run=:
- ;;
-
- --features)
- $echo "host: $host"
- if test "$build_libtool_libs" = yes; then
- $echo "enable shared libraries"
- else
- $echo "disable shared libraries"
- fi
- if test "$build_old_libs" = yes; then
- $echo "enable static libraries"
- else
- $echo "disable static libraries"
- fi
- exit 0
- ;;
-
- --finish) mode="finish" ;;
-
- --mode) prevopt="--mode" prev=mode ;;
- --mode=*) mode="$optarg" ;;
-
- --quiet | --silent)
- show=:
- ;;
-
- -dlopen)
- prevopt="-dlopen"
- prev=execute_dlfiles
- ;;
-
- -*)
- $echo "$progname: unrecognized option \`$arg'" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
-
- *)
- nonopt="$arg"
- break
- ;;
- esac
-done
-
-if test -n "$prevopt"; then
- $echo "$progname: option \`$prevopt' requires an argument" 1>&2
- $echo "$help" 1>&2
- exit 1
-fi
-
-if test -z "$show_help"; then
-
- # Infer the operation mode.
- if test -z "$mode"; then
- case "$nonopt" in
- *cc | *++)
- mode=link
- for arg
- do
- case "$arg" in
- -c)
- mode=compile
- break
- ;;
- esac
- done
- ;;
- *db | *dbx)
- mode=execute
- ;;
- *install*|cp)
- mode=install
- ;;
- *rm)
- mode=uninstall
- ;;
- *)
- # If we have no mode, but dlfiles were specified, then do execute mode.
- test -n "$execute_dlfiles" && mode=execute
-
- # Just use the default operation mode.
- if test -z "$mode"; then
- if test -n "$nonopt"; then
- $echo "$progname: warning: cannot infer operation mode from \`$nonopt'" 1>&2
- else
- $echo "$progname: warning: cannot infer operation mode without MODE-ARGS" 1>&2
- fi
- fi
- ;;
- esac
- fi
-
- # Only execute mode is allowed to have -dlopen flags.
- if test -n "$execute_dlfiles" && test "$mode" != execute; then
- $echo "$progname: unrecognized option \`-dlopen'" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- # Change the help message to a mode-specific one.
- generic_help="$help"
- help="Try \`$progname --help --mode=$mode' for more information."
-
- # These modes are in order of execution frequency so that they run quickly.
- case "$mode" in
- # libtool compile mode
- compile)
- progname="$progname: compile"
- # Get the compilation command and the source file.
- base_compile=
- lastarg=
- srcfile="$nonopt"
- suppress_output=
-
- for arg
- do
- # The only flag that cannot be specified is the output filename.
- if test "X$arg" = "X-o"; then
- $echo "$progname: you cannot specify the output filename with \`-o'" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- # Accept the current argument as the source file.
- lastarg="$srcfile"
- srcfile="$arg"
-
- # Aesthetically quote the previous argument.
-
- # Backslashify any backslashes, double quotes, and dollar signs.
- # These are the only characters that are still specially
- # interpreted inside of double-quoted scrings.
- lastarg=`$echo "$lastarg" | sed "$sed_quote_subst"`
-
- # Double-quote args containing other shell metacharacters.
- # Many Bourne shells cannot handle close brackets correctly in scan
- # sets, so we specify it separately.
- case "$lastarg" in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- lastarg="\"$lastarg\""
- ;;
- esac
-
- # Add the previous argument to base_compile.
- if test -z "$base_compile"; then
- base_compile="$lastarg"
- else
- base_compile="$base_compile $lastarg"
- fi
- done
-
- # Get the name of the library object.
- libobj=`$echo "$srcfile" | sed -e 's%^.*/%%'`
-
- # Recognize several different file suffixes.
- xform='[cCFSfm]'
- case "$libobj" in
- *.c++) xform=c++ ;;
- *.cc) xform=cc ;;
- *.cpp) xform=cpp ;;
- *.cxx) xform=cxx ;;
- *.f90) xform=f90 ;;
- *.for) xform=for ;;
- esac
-
- libobj=`$echo "$libobj" | sed -e "s/\.$xform$/.lo/"`
-
- case "$libobj" in
- *.lo) obj=`$echo "$libobj" | sed -e 's/\.lo$/.o/'` ;;
- *)
- $echo "$progname: cannot determine name of library object from \`$srcfile'" 1>&2
- exit 1
- ;;
- esac
-
- if test -z "$base_compile"; then
- $echo "$progname: you must specify a compilation command" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- # Delete any leftover library objects.
- if test "$build_old_libs" = yes; then
- $run $rm $obj $libobj
- trap "$run $rm $obj $libobj; exit 1" 1 2 15
- else
- $run $rm $libobj
- trap "$run $rm $libobj; exit 1" 1 2 15
- fi
-
- # Only build a PIC object if we are building libtool libraries.
- if test "$build_libtool_libs" = yes; then
- # Without this assignment, base_compile gets emptied.
- fbsd_hideous_sh_bug=$base_compile
-
- # All platforms use -DPIC, to notify preprocessed assembler code.
- $show "$base_compile$pic_flag -DPIC $srcfile"
- if $run eval "$base_compile\$pic_flag -DPIC \$srcfile"; then :
- else
- test -n "$obj" && $run $rm $obj
- exit 1
- fi
-
- # If we have no pic_flag, then copy the object into place and finish.
- if test -z "$pic_flag"; then
- $show "$LN_S $obj $libobj"
- $run $LN_S $obj $libobj
- exit $?
- fi
-
- # Just move the object, then go on to compile the next one
- $show "$mv $obj $libobj"
- $run $mv $obj $libobj || exit 1
-
- # Allow error messages only from the first compilation.
- suppress_output=' >/dev/null 2>&1'
- fi
-
- # Only build a position-dependent object if we build old libraries.
- if test "$build_old_libs" = yes; then
- # Suppress compiler output if we already did a PIC compilation.
- $show "$base_compile $srcfile$suppress_output"
- if $run eval "$base_compile \$srcfile$suppress_output"; then :
- else
- $run $rm $obj $libobj
- exit 1
- fi
- fi
-
- # Create an invalid libtool object if no PIC, so that we don't accidentally
- # link it into a program.
- if test "$build_libtool_libs" != yes; then
- $show "$echo timestamp > $libobj"
- $run eval "\$echo timestamp > \$libobj" || exit $?
- fi
-
- exit 0
- ;;
-
- # libtool link mode
- link)
- progname="$progname: link"
- CC="$nonopt"
- allow_undefined=no
- compile_command="$CC"
- finalize_command="$CC"
-
- compile_shlibpath=
- finalize_shlibpath=
- deplibs=
- dlfiles=
- dlprefiles=
- export_dynamic=no
- hardcode_libdirs=
- libobjs=
- link_against_libtool_libs=
- ltlibs=
- objs=
- prev=
- prevarg=
- rpath=
- perm_rpath=
- temp_rpath=
- vinfo=
-
- # We need to know -static, to get the right output filenames.
- for arg
- do
- case "$arg" in
- -all-static | -static)
- if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
- $echo "$progname: warning: complete static linking is impossible in this configuration" 1>&2
- fi
- build_libtool_libs=no
- build_old_libs=yes
- break
- ;;
- esac
- done
-
- # See if our shared archives depend on static archives.
- test -n "$old_archive_from_new_cmds" && build_old_libs=yes
-
- # Go through the arguments, transforming them on the way.
- for arg
- do
- # If the previous option needs an argument, assign it.
- if test -n "$prev"; then
- case "$prev" in
- output)
- compile_command="$compile_command @OUTPUT@"
- finalize_command="$finalize_command @OUTPUT@"
- ;;
- esac
-
- case "$prev" in
- dlfiles|dlprefiles)
- case "$arg" in
- *.la | *.lo) ;; # We handle these cases below.
- *)
- dlprefiles="$dlprefiles $arg"
- test "$prev" = dlfiles && dlfiles="$dlfiles $arg"
- prev=
- ;;
- esac
- ;;
- rpath)
- rpath="$rpath $arg"
- prev=
- continue
- ;;
- *)
- eval "$prev=\"\$arg\""
- prev=
- continue
- ;;
- esac
- fi
-
- prevarg="$arg"
-
- case "$arg" in
- -all-static)
- if test -n "$link_static_flag"; then
- compile_command="$compile_command $link_static_flag"
- finalize_command="$finalize_command $link_static_flag"
- fi
- continue
- ;;
-
- -allow-undefined)
- allow_undefined=yes
- continue
- ;;
-
- -dlopen)
- prev=dlfiles
- continue
- ;;
-
- -dlpreopen)
- prev=dlprefiles
- continue
- ;;
-
- -export-dynamic)
- if test "$export_dynamic" != yes; then
- export_dynamic=yes
- if test -n "$export_dynamic_flag_spec"; then
- arg=`eval \\$echo "$export_dynamic_flag_spec"`
- else
- arg=
- fi
-
- # Add the symbol object into the linking commands.
- compile_command="$compile_command @SYMFILE@"
- finalize_command="$finalize_command @SYMFILE@"
- fi
- ;;
-
- -L*)
- dir=`$echo "$arg" | sed 's%^-L\(.*\)$%\1%'`
- case "$dir" in
- /*)
- # Add the corresponding hardcode_libdir_flag, if it is not identical.
- ;;
- *)
- $echo "$progname: \`-L$dir' cannot specify a relative directory" 1>&2
- exit 1
- ;;
- esac
- deplibs="$deplibs $arg"
- ;;
-
- -l*) deplibs="$deplibs $arg" ;;
-
- -o) prev=output ;;
-
- -rpath)
- prev=rpath
- continue
- ;;
-
- -static)
- # If we have no pic_flag, then this is the same as -all-static.
- if test -z "$pic_flag" && test -n "$link_static_flag"; then
- compile_command="$compile_command $link_static_flag"
- finalize_command="$finalize_command $link_static_flag"
- fi
- continue
- ;;
-
- -version-info)
- prev=vinfo
- continue
- ;;
-
- # Some other compiler flag.
- -* | +*)
- # Unknown arguments in both finalize_command and compile_command need
- # to be aesthetically quoted because they are evaled later.
- arg=`$echo "$arg" | sed "$sed_quote_subst"`
- case "$arg" in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- arg="\"$arg\""
- ;;
- esac
- ;;
-
- *.o | *.a)
- # A standard object.
- objs="$objs $arg"
- ;;
-
- *.lo)
- # A library object.
- if test "$prev" = dlfiles; then
- dlfiles="$dlfiles $arg"
- if test "$build_libtool_libs" = yes; then
- prev=
- continue
- else
- # If libtool objects are unsupported, then we need to preload.
- prev=dlprefiles
- fi
- fi
-
- if test "$prev" = dlprefiles; then
- # Preload the old-style object.
- dlprefiles="$dlprefiles "`$echo "$arg" | sed 's/\.lo$/\.o/'`
- prev=
- fi
- libobjs="$libobjs $arg"
- ;;
-
- *.la)
- # A libtool-controlled library.
-
- dlname=
- libdir=
- library_names=
- old_library=
-
- # Check to see that this really is a libtool archive.
- if egrep '^# Generated by ltmain.sh' $arg >/dev/null 2>&1; then :
- else
- $echo "$progname: \`$arg' is not a valid libtool archive" 1>&2
- exit 1
- fi
-
- # If there is no directory component, then add one.
- case "$arg" in
- */*) . $arg ;;
- *) . ./$arg ;;
- esac
-
- if test -z "$libdir"; then
- $echo "$progname: \`$arg' contains no -rpath information" 1>&2
- exit 1
- fi
-
- # Get the name of the library we link against.
- linklib=
- for l in $old_library $library_names; do
- linklib="$l"
- done
-
- if test -z "$linklib"; then
- $echo "$progname: cannot find name of link library for \`$arg'" 1>&2
- exit 1
- fi
-
- # Find the relevant object directory and library name.
- name=`$echo "$arg" | sed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
- dir=`$echo "$arg" | sed 's%/[^/]*$%%'`
- if test "X$dir" = "X$arg"; then
- dir="$objdir"
- else
- dir="$dir/$objdir"
- fi
-
- # This library was specified with -dlopen.
- if test "$prev" = dlfiles; then
- dlfiles="$dlfiles $arg"
- if test -z "$dlname"; then
- # If there is no dlname, we need to preload.
- prev=dlprefiles
- else
- # We should not create a dependency on this library.
- prev=
- continue
- fi
- fi
-
- # The library was specified with -dlpreopen.
- if test "$prev" = dlprefiles; then
- # Prefer using a static library (so that no silly _DYNAMIC symbols
- # are required to link).
- if test -n "$old_library"; then
- dlprefiles="$dlprefiles $dir/$old_library"
- else
- dlprefiles="$dlprefiles $dir/$linklib"
- fi
- prev=
- fi
-
- if test "$build_libtool_libs" = yes && test -n "$library_names"; then
- link_against_libtool_libs="$link_against_libtool_libs $arg"
- if test -n "$shlibpath_var"; then
- # Make sure the rpath contains only unique directories.
- case "$temp_rpath " in
- *" $dir "*) ;;
- *) temp_rpath="$temp_rpath $dir" ;;
- esac
- fi
-
- # This is the magic to use -rpath.
- if test -n "$hardcode_libdir_flag_spec"; then
- if test -n "$hardcode_libdir_separator"; then
- if test -z "$hardcode_libdirs"; then
- # Put the magic libdir with the hardcode flag.
- hardcode_libdirs="$libdir"
- libdir="@HARDCODE_LIBDIRS@"
- else
- # Just accumulate the unique libdirs.
- case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
- *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- libdir=
- fi
- fi
-
- if test -n "$libdir"; then
- flag=`eval \\$echo \"$hardcode_libdir_flag_spec\"`
-
- compile_command="$compile_command $flag"
- finalize_command="$finalize_command $flag"
- fi
- elif test "$hardcode_runpath_var" = yes; then
- # Do the same for the permanent run path.
- case "$perm_rpath " in
- *" $libdir "*) ;;
- *) perm_rpath="$perm_rpath $libdir" ;;
- esac
- fi
-
-
- case "$hardcode_action" in
- immediate)
- if test "$hardcode_direct" = no; then
- compile_command="$compile_command $dir/$linklib"
- elif test "$hardcode_minus_L" = no; then
- compile_command="$compile_command -L$dir -l$name"
- elif test "$hardcode_shlibpath_var" = no; then
- compile_shlibpath="$compile_shlibpath$dir:"
- compile_command="$compile_command -l$name"
- fi
- ;;
-
- relink)
- # We need an absolute path.
- case "$dir" in
- /*) ;;
- *)
- absdir=`cd "$dir" && pwd`
- if test -z "$absdir"; then
- $echo "$progname: cannot determine absolute directory name of \`$dir'" 1>&2
- exit 1
- fi
- dir="$absdir"
- ;;
- esac
-
- if test "$hardcode_direct" = yes; then
- compile_command="$compile_command $dir/$linklib"
- elif test "$hardcode_minus_L" = yes; then
- compile_command="$compile_command -L$dir -l$name"
- elif test "$hardcode_shlibpath_var" = yes; then
- compile_shlibpath="$compile_shlibpath$dir:"
- compile_command="$compile_command -l$name"
- fi
- ;;
-
- *)
- $echo "$progname: \`$hardcode_action' is an unknown hardcode action" 1>&2
- exit 1
- ;;
- esac
-
- # Finalize command for both is simple: just hardcode it.
- if test "$hardcode_direct" = yes; then
- finalize_command="$finalize_command $libdir/$linklib"
- elif test "$hardcode_minus_L" = yes; then
- finalize_command="$finalize_command -L$libdir -l$name"
- elif test "$hardcode_shlibpath_var" = yes; then
- finalize_shlibpath="$finalize_shlibpath$libdir:"
- finalize_command="$finalize_command -l$name"
- else
- # We can't seem to hardcode it, guess we'll fake it.
- finalize_command="$finalize_command -L$libdir -l$name"
- fi
- else
- # Transform directly to old archives if we don't build new libraries.
- if test -n "$pic_flag" && test -z "$old_library"; then
- $echo "$progname: cannot find static library for \`$arg'" 1>&2
- exit 1
- fi
-
- # Here we assume that one of hardcode_direct or hardcode_minus_L
- # is not unsupported. This is valid on all known static and
- # shared platforms.
- if test "$hardcode_direct" != unsupported; then
- test -n "$old_library" && linklib="$old_library"
- compile_command="$compile_command $dir/$linklib"
- finalize_command="$finalize_command $dir/$linklib"
- else
- compile_command="$compile_command -L$dir -l$name"
- finalize_command="$finalize_command -L$dir -l$name"
- fi
- fi
- continue
- ;;
-
- # Some other compiler argument.
- *)
- # Unknown arguments in both finalize_command and compile_command need
- # to be aesthetically quoted because they are evaled later.
- arg=`$echo "$arg" | sed "$sed_quote_subst"`
- case "$arg" in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- arg="\"$arg\""
- ;;
- esac
- ;;
- esac
-
- # Now actually substitute the argument into the commands.
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- done
-
- if test -n "$prev"; then
- $echo "$progname: the \`$prevarg' option requires an argument" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- oldlib=
- oldobjs=
- case "$output" in
- "")
- $echo "$progname: you must specify an output file" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
-
- */*)
- $echo "$progname: output file \`$output' must have no directory components" 1>&2
- exit 1
- ;;
-
- *.la)
- # Make sure we only generate libraries of the form `libNAME.la'.
- case "$output" in
- lib*) ;;
- *)
- $echo "$progname: libtool library \`$arg' must begin with \`lib'" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
- esac
-
- name=`$echo "$output" | sed -e 's/\.la$//' -e 's/^lib//'`
- libname=`eval \\$echo \"$libname_spec\"`
-
- # All the library-specific variables (install_libdir is set above).
- library_names=
- old_library=
- dlname=
- current=0
- revision=0
- age=0
-
- if test -n "$objs"; then
- $echo "$progname: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
- exit 1
- fi
-
- # How the heck are we supposed to write a wrapper for a shared library?
- if test -n "$link_against_libtool_libs"; then
- $echo "$progname: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2
- exit 1
- fi
-
- # Add libc to deplibs on all systems.
- deplibs="$deplibs -lc"
-
- if test -n "$dlfiles$dlprefiles"; then
- $echo "$progname: warning: \`-dlopen' is ignored while creating libtool libraries" 1>&2
- # Nullify the symbol file.
- compile_command=`$echo "$compile_command" | sed "s% @SYMFILE@%%"`
- finalize_command=`$echo "$finalize_command" | sed "s% @SYMFILE@%%"`
- fi
-
- if test -z "$rpath"; then
- $echo "$progname: you must specify an installation directory with \`-rpath'" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- set dummy $rpath
- if test $# -gt 2; then
- $echo "$progname: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
- fi
- install_libdir="$2"
-
- # Parse the version information argument.
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
- set dummy $vinfo
- IFS="$save_ifs"
-
- if test -n "$5"; then
- $echo "$progname: too many parameters to \`-version-info'" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- test -n "$2" && current="$2"
- test -n "$3" && revision="$3"
- test -n "$4" && age="$4"
-
- # Check that each of the things are valid numbers.
- case "$current" in
- 0 | [1-9] | [1-9][0-9]*) ;;
- *)
- $echo "$progname: CURRENT \`$current' is not a nonnegative integer" 1>&2
- $echo "$progname: \`$vinfo' is not valid version information" 1>&2
- exit 1
- ;;
- esac
-
- case "$revision" in
- 0 | [1-9] | [1-9][0-9]*) ;;
- *)
- $echo "$progname: REVISION \`$revision' is not a nonnegative integer" 1>&2
- $echo "$progname: \`$vinfo' is not valid version information" 1>&2
- exit 1
- ;;
- esac
-
- case "$age" in
- 0 | [1-9] | [1-9][0-9]*) ;;
- *)
- $echo "$progname: AGE \`$age' is not a nonnegative integer" 1>&2
- $echo "$progname: \`$vinfo' is not valid version information" 1>&2
- exit 1
- ;;
- esac
-
- if test $age -gt $current; then
- $echo "$progname: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
- $echo "$progname: \`$vinfo' is not valid version information" 1>&2
- exit 1
- fi
-
- # Calculate the version variables.
- version_vars="version_type current age revision"
- case "$version_type" in
- none) ;;
-
- linux)
- version_vars="$version_vars major versuffix"
- major=`expr $current - $age`
- versuffix="$major.$age.$revision"
- ;;
-
- osf)
- version_vars="$version_vars versuffix verstring"
- major=`expr $current - $age`
- versuffix="$current.$age.$revision"
- verstring="$versuffix"
-
- # Add in all the interfaces that we are compatible with.
- loop=$age
- while test $loop != 0; do
- iface=`expr $current - $loop`
- loop=`expr $loop - 1`
- verstring="$verstring:${iface}.0"
- done
-
- # Make executables depend on our current version.
- verstring="$verstring:${current}.0"
- ;;
-
- sunos)
- version_vars="$version_vars major versuffix"
- major="$current"
- versuffix="$current.$revision"
- ;;
-
- *)
- $echo "$progname: unknown library version type \`$version_type'" 1>&2
- $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
- exit 1
- ;;
- esac
-
- # Create the output directory, or remove our outputs if we need to.
- if test -d $objdir; then
- $show "$rm $objdir/$output $objdir/$libname.*"
- $run $rm $objdir/$output $objdir/$libname.*
- else
- $show "$mkdir $objdir"
- $run $mkdir $objdir
- status=$?
- if test $status -eq 0 || test -d $objdir; then :
- else
- exit $status
- fi
- fi
-
- # Check to see if the archive will have undefined symbols.
- if test "$allow_undefined" = yes; then
- if test "$allow_undefined_flag" = unsupported; then
- $echo "$progname: warning: undefined symbols not allowed in $host shared libraries" 1>&2
- build_libtool_libs=no
- build_old_libs=yes
- fi
- else
- # Clear the flag.
- allow_undefined_flag=
- fi
-
- if test "$build_libtool_libs" = yes; then
- # Get the real and link names of the library.
- library_names=`eval \\$echo \"$library_names_spec\"`
- set dummy $library_names
- realname="$2"
- shift; shift
-
- if test -n "$soname_spec"; then
- soname=`eval \\$echo \"$soname_spec\"`
- else
- soname="$realname"
- fi
-
- lib="$objdir/$realname"
- for link
- do
- linknames="$linknames $link"
- done
-
- # Use standard objects if they are PIC.
- test -z "$pic_flag" && libobjs=`$echo "$libobjs " | sed -e 's/\.lo /.o /g' -e 's/ $//g'`
-
- # Do each of the archive commands.
- cmds=`eval \\$echo \"$archive_cmds\"`
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
-
- # Create links to the real library.
- for link in $linknames; do
- $show "(cd $objdir && $LN_S $realname $link)"
- $run eval '(cd $objdir && $LN_S $realname $link)' || exit $?
- done
-
- # If -export-dynamic was specified, set the dlname.
- if test "$export_dynamic" = yes; then
- # On all known operating systems, these are identical.
- dlname="$soname"
- fi
- fi
- ;;
-
- *.lo | *.o)
- if test -n "$link_against_libtool_libs"; then
- $echo "$progname: error: cannot link libtool libraries into reloadable objects" 1>&2
- exit 1
- fi
-
- if test -n "$deplibs"; then
- $echo "$progname: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2
- fi
-
- if test -n "$dlfiles$dlprefiles"; then
- $echo "$progname: warning: \`-dlopen' is ignored while creating objects" 1>&2
- # Nullify the symbol file.
- compile_command=`$echo "$compile_command" | sed "s% @SYMFILE@%%"`
- finalize_command=`$echo "$finalize_command" | sed "s% @SYMFILE@%%"`
- fi
-
- if test -n "$rpath"; then
- $echo "$progname: warning: \`-rpath' is ignored while creating objects" 1>&2
- fi
-
- if test -n "$vinfo"; then
- $echo "$progname: warning: \`-version-info' is ignored while creating objects" 1>&2
- fi
-
- case "$output" in
- *.lo)
- if test -n "$objs"; then
- $echo "$progname: cannot build library object \`$output' from non-libtool objects" 1>&2
- exit 1
- fi
- libobj="$output"
- obj=`$echo "$output" | sed 's/\.lo$/.o/'`
- ;;
- *)
- libobj=
- obj="$output"
- ;;
- esac
-
- # Delete the old objects.
- $run $rm $obj $libobj
-
- # Create the old-style object.
- reload_objs="$objs"`$echo "$libobjs " | sed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
-
- output="$obj"
- cmds=`eval \\$echo \"$reload_cmds\"`
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
-
- # Exit if we aren't doing a library object file.
- test -z "$libobj" && exit 0
-
- if test "$build_libtool_libs" != yes; then
- # Create an invalid libtool object if no PIC, so that we don't
- # accidentally link it into a program.
- $show "$echo timestamp > $libobj"
- $run eval "\$echo timestamp > $libobj" || exit $?
- exit 0
- fi
-
- if test -n "$pic_flag"; then
- # Only do commands if we really have different PIC objects.
- reload_objs="$libobjs"
- output="$libobj"
- cmds=`eval \\$echo \"$reload_cmds\"`
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- else
- # Just create a symlink.
- $show "$LN_S $obj $libobj"
- $run $LN_S $obj $libobj || exit 1
- fi
-
- exit 0
- ;;
-
- *)
- if test -n "$vinfo"; then
- $echo "$progname: warning: \`-version-info' is ignored while linking programs" 1>&2
- fi
-
- if test -n "$rpath"; then
- # If the user specified any rpath flags, then add them.
- for libdir in $rpath; do
- if test -n "$hardcode_libdir_flag_spec"; then
- if test -n "$hardcode_libdir_separator"; then
- if test -z "$hardcode_libdirs"; then
- # Put the magic libdir with the hardcode flag.
- hardcode_libdirs="$libdir"
- libdir="@HARDCODE_LIBDIRS@"
- else
- # Just accumulate the unique libdirs.
- case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
- *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- libdir=
- fi
- fi
-
- if test -n "$libdir"; then
- flag=`eval \\$echo \"$hardcode_libdir_flag_spec\"`
-
- compile_command="$compile_command $flag"
- finalize_command="$finalize_command $flag"
- fi
- elif test "$hardcode_runpath_var" = yes; then
- case "$perm_rpath " in
- *" $libdir "*) ;;
- *) perm_rpath="$perm_rpath $libdir" ;;
- esac
- fi
- done
- fi
-
- # Substitute the hardcoded libdirs into the compile commands.
- if test -n "$hardcode_libdir_separator"; then
- compile_command=`$echo "$compile_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
- finalize_command=`$echo "$finalize_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
- fi
-
- if test -n "$libobjs" && test "$build_old_libs" = yes; then
- # Transform all the library objects into standard objects.
- compile_command=`$echo "$compile_command " | sed -e 's/\.lo /.o /g' -e 's/ $//'`
- finalize_command=`$echo "$finalize_command " | sed -e 's/\.lo /.o /g' -e 's/ $//'`
- fi
-
- if test "$export_dynamic" = yes && test -n "$NM" && test -n "$global_symbol_pipe"; then
- dlsyms="${output}S.c"
- else
- dlsyms=
- fi
-
- if test -n "$dlsyms"; then
- # Add our own program objects to the preloaded list.
- dlprefiles=`$echo "$objs$dlprefiles " | sed -e 's/\.lo /.o /g' -e 's/ $//'`
-
- # Discover the nlist of each of the dlfiles.
- nlist="$objdir/${output}.nm"
-
- if test -d $objdir; then
- $show "$rm $nlist ${nlist}T"
- $run $rm "$nlist" "${nlist}T"
- else
- $show "$mkdir $objdir"
- $run $mkdir $objdir
- status=$?
- if test $status -eq 0 || test -d $objdir; then :
- else
- exit $status
- fi
- fi
-
- for arg in $dlprefiles; do
- $show "extracting global C symbols from \`$arg'"
- $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
- done
-
- # Parse the name list into a source file.
- $show "creating $objdir/$dlsyms"
- if test -z "$run"; then
- # Make sure we at least have an empty file.
- test -f "$nlist" || : > "$nlist"
-
- # Try sorting and uniquifying the output.
- if sort "$nlist" | uniq > "$nlist"T; then
- mv -f "$nlist"T "$nlist"
- wcout=`wc "$nlist" 2>/dev/null`
- count=`$echo "$wcout" | sed 's/^[ ]*\([0-9][0-9]*\).*$/\1/'`
- (test "$count" -ge 0) 2>/dev/null || count=-1
- else
- $rm "$nlist"T
- count=-1
- fi
-
- case "$dlsyms" in
- "") ;;
- *.c)
- cat <<EOF > "$objdir/$dlsyms"
-/* $dlsyms - symbol resolution table for \`$output' dlsym emulation. */
-/* Generated by $PROGRAM - GNU $PACKAGE $VERSION */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Prevent the only kind of declaration conflicts we can make. */
-#define dld_preloaded_symbol_count some_other_symbol
-#define dld_preloaded_symbols some_other_symbol
-
-/* External symbol declarations for the compiler. */
-EOF
- if test -f "$nlist"; then
- sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$objdir/$dlsyms"
- else
- $echo '/* NONE */' >> "$objdir/$dlsyms"
-EOF
- fi
-
- cat <<EOF >> "$objdir/$dlsyms"
-
-#undef dld_preloaded_symbol_count
-#undef dld_preloaded_symbols
-
-#if defined (__STDC__) && __STDC__
-# define __ptr_t void *
-#else
-# define __ptr_t char *
-#endif
-
-/* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
-int dld_preloaded_symbol_count = $count;
-
-/* The mapping between symbol names and symbols. */
-struct {
- char *name;
- __ptr_t address;
-}
-dld_preloaded_symbols[] =
-{
-EOF
-
- if test -f "$nlist"; then
- sed 's/^\(.*\) \(.*\)$/ {"\1", \&\2},/' < "$nlist" >> "$objdir/$dlsyms"
- fi
-
- cat <<\EOF >> "$objdir/$dlsyms"
- {0},
-};
-
-#ifdef __cplusplus
-}
-#endif
-EOF
- ;;
-
- *)
- echo "$progname: unknown suffix for \`$dlsyms'" 1>&2
- exit 1
- ;;
- esac
- fi
-
- # Now compile the dynamic symbol file.
- $show "(cd $objdir && $CC -c$no_builtin_flag \"$dlsyms\")"
- $run eval '(cd $objdir && $CC -c$no_builtin_flag "$dlsyms")' || exit $?
-
- # Transform the symbol file into the correct name.
- compile_command=`$echo "$compile_command" | sed "s%@SYMFILE@%$objdir/${output}S.o%"`
- finalize_command=`$echo "$finalize_command" | sed "s%@SYMFILE@%$objdir/${output}S.o%"`
- elif test "$export_dynamic" != yes; then
- test -n "$dlfiles$dlprefiles" && $echo "$progname: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2
- else
- # We keep going just in case the user didn't refer to
- # dld_preloaded_symbols. The linker will fail if global_symbol_pipe
- # really was required.
- $echo "$progname: not configured to extract global symbols from dlpreopened files" 1>&2
-
- # Nullify the symbol file.
- compile_command=`$echo "$compile_command" | sed "s% @SYMFILE@%%"`
- finalize_command=`$echo "$finalize_command" | sed "s% @SYMFILE@%%"`
- fi
-
- if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
- # Replace the output file specification.
- compile_command=`$echo "$compile_command" | sed 's%@OUTPUT@%'"$output"'%g'`
- finalize_command=`$echo "$finalize_command" | sed 's%@OUTPUT@%'"$output"'%g'`
-
- # We have no uninstalled library dependencies, so finalize right now.
- $show "$compile_command"
- $run eval "$compile_command"
- exit $?
- fi
-
- # Replace the output file specification.
- compile_command=`$echo "$compile_command" | sed 's%@OUTPUT@%'"$objdir/$output"'%g'`
- finalize_command=`$echo "$finalize_command" | sed 's%@OUTPUT@%'"$objdir/$output"'T%g'`
-
- # Create the binary in the object directory, then wrap it.
- if test -d $objdir; then :
- else
- $show "$mkdir $objdir"
- $run $mkdir $objdir || exit $?
- fi
-
- if test -n "$shlibpath_var"; then
- # We should set the shlibpath_var
- rpath=
- for dir in $temp_rpath; do
- case "$dir" in
- /*)
- # Absolute path.
- rpath="$rpath$dir:"
- ;;
- *)
- # Relative path: add a thisdir entry.
- rpath="$rpath\$thisdir/$dir:"
- ;;
- esac
- done
- temp_rpath="$rpath"
- fi
-
- # Delete the old output file.
- $run $rm $output
-
- if test -n "$compile_shlibpath"; then
- compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command"
- fi
- if test -n "$finalize_shlibpath"; then
- finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
- fi
-
- if test -n "$perm_rpath"; then
- # We should set the runpath_var.
- rpath=
- for dir in $perm_rpath; do
- rpath="$rpath$dir:"
- done
- compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command"
- finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command"
- fi
-
- case "$hardcode_action" in
- relink)
- # AGH! Flame the AIX and HP-UX people for me, will ya?
- $echo "$progname: warning: using a buggy system linker" 1>&2
- $echo "$progname: relinking will be required before \`$output' can be installed" 1>&2
- ;;
- esac
-
- $show "$compile_command"
- $run eval "$compile_command" || exit $?
-
- # Now create the wrapper script.
- $show "creating $output"
-
- # Quote the finalize command for shipping.
- finalize_command=`$echo "$finalize_command" | sed "$sed_quote_subst"`
-
- # Only actually do things if our run command is non-null.
- if test -z "$run"; then
- $rm $output
- trap "$rm $output; exit 1" 1 2 15
-
- cat > $output <<EOF
-#! /bin/sh
-
-# $output - temporary wrapper script for $objdir/$output
-# Generated by ltmain.sh - GNU $PACKAGE $VERSION
-#
-# The $output program cannot be directly executed until all the libtool
-# libraries that it depends on are installed.
-#
-# This wrapper script should never be moved out of \``pwd`'.
-# If it is, it will not operate correctly.
-
-# This environment variable determines our operation mode.
-if test "\$libtool_install_magic" = "$magic"; then
- # install mode needs the following variables:
- link_against_libtool_libs='$link_against_libtool_libs'
- finalize_command="$finalize_command"
-else
- # When we are sourced in execute mode, \$file and \$echo are already set.
- if test "\$libtool_execute_magic" = "$magic"; then :
- else
- echo='$echo'
- file="\$0"
- fi
-
- # Find the directory that this script lives in.
- thisdir=\`\$echo "\$file" | sed 's%/[^/]*$%%'\`
- test "x\$thisdir" = "x\$file" && thisdir=.
-
- # Follow symbolic links until we get to the real thisdir.
- file=\`ls -ld "\$file" | sed -n 's/.*-> //p'\`
- while test -n "\$file"; do
- destdir=\`\$echo "\$file" | sed 's%/[^/]*\$%%'\`
-
- # If there was a directory component, then change thisdir.
- if test "x\$destdir" != "x\$file"; then
- case "\$destdir" in
- /*) thisdir="\$destdir" ;;
- *) thisdir="\$thisdir/\$destdir" ;;
- esac
- fi
-
- file=\`\$echo "\$file" | sed 's%^.*/%%'\`
- file=\`ls -ld "\$thisdir/\$file" | sed -n 's/.*-> //p'\`
- done
-
- # Try to get the absolute directory name.
- absdir=\`cd "\$thisdir" && pwd\`
- test -n "\$absdir" && thisdir="\$absdir"
-
- progdir="\$thisdir/$objdir"
- program='$output'
-
- if test -f "\$progdir/\$program"; then
-EOF
-
- # Export our shlibpath_var if we have one.
- if test -n "$shlibpath_var" && test -n "$temp_rpath"; then
- cat >> $output <<EOF
- # Add our own library path to $shlibpath_var
- $shlibpath_var="$temp_rpath\$$shlibpath_var"
-
- # Some systems cannot cope with colon-terminated $shlibpath_var
- $shlibpath_var=\`\$echo \$$shlibpath_var | sed -e 's/:*\$//'\`
-
- export $shlibpath_var
-
-EOF
- fi
-
- cat >> $output <<EOF
- if test "\$libtool_execute_magic" != "$magic"; then
- # Run the actual program with our arguments.
- args=
- for arg
- do
- # Quote arguments (to preserve shell metacharacters).
- sed_quote_subst='$sed_quote_subst'
- arg=\`\$echo "\$arg" | sed "\$sed_quote_subst"\`
- args="\$args \\"\$arg\\""
- done
-
- # Export the path to the program.
- PATH="\$progdir:\$PATH"
- export PATH
-
- eval "exec \$program \$args"
-
- \$echo "\$0: cannot exec \$program \$args"
- exit 1
- fi
- else
- # The program doesn't exist.
- \$echo "\$0: error: \$progdir/\$program does not exist" 1>&2
- \$echo "This script is just a wrapper for \$program." 1>&2
- \$echo "See the $PACKAGE documentation for more information." 1>&2
- exit 1
- fi
-fi
-EOF
- chmod +x $output
- fi
- exit 0
- ;;
- esac
-
-
- # See if we need to build an old-fashioned archive.
- if test "$build_old_libs" = "yes"; then
- # Now set the variables for building old libraries.
- oldlib="$objdir/$libname.a"
-
- # Transform .lo files to .o files.
- oldobjs="$objs"`$echo "$libobjs " | sed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
-
- if test -d "$objdir"; then
- $show "$rm $oldlib"
- $run $rm $oldlib
- else
- $show "$mkdir $objdir"
- $run $mkdir $objdir
- fi
-
- # Do each command in the archive commands.
- if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
- cmds=`eval \\$echo \"$old_archive_from_new_cmds\"`
- else
- cmds=`eval \\$echo \"$old_archive_cmds\"`
- fi
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- fi
-
- # Now create the libtool archive.
- case "$output" in
- *.la)
- old_library=
- test "$build_old_libs" = yes && old_library="$libname.a"
-
- $show "creating $output"
-
- # Only create the output if not a dry run.
- if test -z "$run"; then
- cat > $output <<EOF
-# $output - a libtool library file
-# Generated by ltmain.sh - GNU $PACKAGE $VERSION
-
-# The name that we can dlopen(3).
-dlname='$dlname'
-
-# Names of this library.
-library_names='$library_names'
-
-# The name of the static archive.
-old_library='$old_library'
-
-# Version information for $libname.
-current=$current
-age=$age
-revision=$revision
-
-# Directory that this library needs to be installed in:
-libdir='$install_libdir'
-EOF
- fi
-
- # Do a symbolic link so that the libtool archive can be found in
- # LD_LIBRARY_PATH before the program is installed.
- $show "(cd $objdir && $LN_S ../$output $output)"
- $run eval "(cd $objdir && $LN_S ../$output $output)" || exit 1
- ;;
- esac
- exit 0
- ;;
-
- # libtool install mode
- install)
- progname="$progname: install"
-
- # There may be an optional /bin/sh argument at the beginning of
- # install_prog (especially on Windows NT).
- if test "$nonopt" = "$SHELL"; then
- # Aesthetically quote it.
- arg=`$echo "$nonopt" | sed "$sed_quote_subst"`
- case "$arg" in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- arg="\"$arg\""
- ;;
- esac
- install_prog="$arg "
- arg="$1"
- shift
- else
- install_prog=
- arg="$nonopt"
- fi
-
- # The real first argument should be the name of the installation program.
- # Aesthetically quote it.
- arg=`$echo "$arg" | sed "$sed_quote_subst"`
- case "$arg" in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- arg="\"$arg\""
- ;;
- esac
- install_prog="$install_prog$arg"
-
- # We need to accept at least all the BSD install flags.
- dest=
- files=
- opts=
- prev=
- install_type=
- isdir=
- stripme=
- for arg
- do
- if test -n "$dest"; then
- files="$files $dest"
- dest="$arg"
- continue
- fi
-
- case "$arg" in
- -d) isdir=yes ;;
- -f) prev="-f" ;;
- -g) prev="-g" ;;
- -m) prev="-m" ;;
- -o) prev="-o" ;;
- -s)
- stripme=" -s"
- continue
- ;;
- -*) ;;
-
- *)
- # If the previous option needed an argument, then skip it.
- if test -n "$prev"; then
- prev=
- else
- dest="$arg"
- continue
- fi
- ;;
- esac
-
- # Aesthetically quote the argument.
- arg=`$echo "$arg" | sed "$sed_quote_subst"`
- case "$arg" in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- arg="\"$arg\""
- ;;
- esac
- install_prog="$install_prog $arg"
- done
-
- if test -z "$install_prog"; then
- $echo "$progname: you must specify an install program" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- if test -n "$prev"; then
- $echo "$progname: the \`$prev' option requires an argument" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- if test -z "$files"; then
- if test -z "$dest"; then
- $echo "$progname: no file or destination specified" 1>&2
- else
- $echo "$progname: you must specify a destination" 1>&2
- fi
- $echo "$help" 1>&2
- exit 1
- fi
-
- # Strip any trailing slash from the destination.
- dest=`$echo "$dest" | sed 's%/$%%'`
-
- # Check to see that the destination is a directory.
- test -d "$dest" && isdir=yes
- if test -n "$isdir"; then
- destdir="$dest"
- destname=
- else
- destdir=`$echo "$dest" | sed 's%/[^/]*$%%'`
- test "X$destdir" = "X$dest" && destdir=.
- destname=`$echo "$dest" | sed 's%^.*/%%'`
-
- # Not a directory, so check to see that there is only one file specified.
- set dummy $files
- if test $# -gt 2; then
- $echo "$progname: \`$dest' is not a directory" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
- fi
- case "$destdir" in
- /*) ;;
- *)
- for file in $files; do
- case "$file" in
- *.lo) ;;
- *)
- $echo "$progname: \`$destdir' must be an absolute directory name" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
- esac
- done
- ;;
- esac
-
- # This variable tells wrapper scripts just to set variables rather
- # than running their programs.
- libtool_install_magic="$magic"
-
- staticlibs=
- future_libdirs=
- current_libdirs=
- for file in $files; do
-
- # Do each installation.
- case "$file" in
- *.a)
- # Do the static libraries later.
- staticlibs="$staticlibs $file"
- ;;
-
- *.la)
- # Check to see that this really is a libtool archive.
- if egrep '^# Generated by ltmain.sh' $file >/dev/null 2>&1; then :
- else
- $echo "$progname: \`$file' is not a valid libtool archive" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- library_names=
- old_library=
- # If there is no directory component, then add one.
- case "$file" in
- */*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Add the libdir to current_libdirs if it is the destination.
- if test "X$destdir" = "X$libdir"; then
- case "$current_libdirs " in
- *" $libdir "*) ;;
- *) current_libdirs="$current_libdirs $libdir" ;;
- esac
- else
- # Note the libdir as a future libdir.
- case "$future_libdirs " in
- *" $libdir "*) ;;
- *) future_libdirs="$future_libdirs $libdir" ;;
- esac
- fi
-
- dir="`$echo "$file" | sed 's%/[^/]*$%%'`/"
- test "X$dir" = "X$file/" && dir=
- dir="$dir$objdir"
-
- # See the names of the shared library.
- set dummy $library_names
- if test -n "$2"; then
- realname="$2"
- shift
- shift
-
- # Install the shared library and build the symlinks.
- $show "$install_prog $dir/$realname $destdir/$realname"
- $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
- test "X$dlname" = "X$realname" && dlname=
-
- # Support stripping libraries.
- if test -n "$stripme"; then
- if test -n "$striplib"; then
- $show "$striplib $destdir/$realname"
- $run $striplib $destdir/$realname || exit $?
- else
- $echo "$progname: warning: no library stripping program" 1>&2
- fi
- fi
-
- if test $# -gt 0; then
- # Delete the old symlinks.
- rmcmd="$rm"
- for linkname
- do
- rmcmd="$rmcmd $destdir/$linkname"
- done
- $show "$rmcmd"
- $run $rmcmd
-
- # ... and create new ones.
- for linkname
- do
- test "X$dlname" = "X$linkname" && dlname=
- $show "(cd $destdir && $LN_S $realname $linkname)"
- $run eval "(cd $destdir && $LN_S $realname $linkname)"
- done
- fi
-
- if test -n "$dlname"; then
- # Install the dynamically-loadable library.
- $show "$install_prog $dir/$dlname $destdir/$dlname"
- $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $?
- fi
-
- # Do each command in the postinstall commands.
- lib="$destdir/$realname"
- cmds=`eval \\$echo \"$postinstall_cmds\"`
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- fi
-
- # Install the pseudo-library for information purposes.
- name=`$echo "$file" | sed 's%^.*/%%'`
- $show "$install_prog $file $destdir/$name"
- $run eval "$install_prog $file $destdir/$name" || exit $?
-
- # Maybe install the static library, too.
- test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
- ;;
-
- *.lo)
- # Install (i.e. copy) a libtool object.
-
- # Figure out destination file name, if it wasn't already specified.
- if test -n "$destname"; then
- destfile="$destdir/$destname"
- else
- destfile=`$echo "$file" | sed 's%^.*/%%'`
- destfile="$destdir/$destfile"
- fi
-
- # Deduce the name of the destination old-style object file.
- case "$destfile" in
- *.lo)
- staticdest=`$echo "$destfile" | sed 's/\.lo$/\.o/'`
- ;;
- *.o)
- staticdest="$destfile"
- destfile=
- ;;
- *)
- $echo "$progname: cannot copy a libtool object to \`$destfile'" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
- esac
-
- # Install the libtool object if requested.
- if test -n "$destfile"; then
- $show "$install_prog $file $destfile"
- $run eval "$install_prog $file $destfile" || exit $?
- fi
-
- # Install the old object if enabled.
- if test "$build_old_libs" = yes; then
- # Deduce the name of the old-style object file.
- staticobj=`$echo "$file" | sed 's/\.lo$/\.o/'`
-
- $show "$install_prog $staticobj $staticdest"
- $run eval "$install_prog \$staticobj \$staticdest" || exit $?
- fi
- exit 0
- ;;
-
- *)
- # Do a test to see if this is really a libtool program.
- if egrep '^# Generated by ltmain.sh' $file >/dev/null 2>&1; then
- link_against_libtool_libs=
- finalize_command=
-
- # If there is no directory component, then add one.
- case "$file" in
- */*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Check the variables that should have been set.
- if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then
- $echo "$progname: invalid libtool wrapper script \`$file'" 1>&2
- exit 1
- fi
-
- finalize=yes
- for lib in $link_against_libtool_libs; do
- # Check to see that each library is installed.
- libdir=
- if test -f "$lib"; then
- # If there is no directory component, then add one.
- case "$lib" in
- */*) . $lib ;;
- *) . ./$lib ;;
- esac
- fi
- libfile="$libdir/`$echo "$lib" | sed 's%^.*/%%g'`"
- if test -z "$libdir"; then
- $echo "$progname: warning: \`$lib' contains no -rpath information" 1>&2
- elif test -f "$libfile"; then :
- else
- $echo "$progname: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
- finalize=no
- fi
- done
-
- if test "$hardcode_action" = relink; then
- if test "$finalize" = yes; then
- $echo "$progname: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
- $show "$finalize_command"
- if $run eval "$finalize_command"; then :
- else
- $echo "$progname: error: relink \`$file' with the above command before installing it" 1>&2
- continue
- fi
- file="$objdir/$file"T
- else
- $echo "$progname: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
- fi
- else
- # Install the binary that we compiled earlier.
- file=`$echo "$file" | sed "s%\([^/]*\)$%$objdir/\1%"`
- fi
- fi
-
- $show "$install_prog$stripme $file $dest"
- $run eval "$install_prog\$stripme \$file \$dest" || exit $?
- ;;
- esac
- done
-
- for file in $staticlibs; do
- name=`$echo "$file" | sed 's%^.*/%%'`
-
- # Set up the ranlib parameters.
- oldlib="$destdir/$name"
-
- $show "$install_prog $file $oldlib"
- $run eval "$install_prog \$file \$oldlib" || exit $?
-
- # Support stripping libraries.
- if test -n "$stripme"; then
- if test -n "$old_striplib"; then
- $show "$old_striplib $oldlib"
- $run $old_striplib $oldlib || exit $?
- else
- $echo "$progname: warning: no static library stripping program" 1>&2
- fi
- fi
-
- # Do each command in the postinstall commands.
- cmds=`eval \\$echo \"$old_postinstall_cmds\"`
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- done
-
- if test -n "$future_libdirs"; then
- $echo "$progname: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
- fi
-
- if test -n "$current_libdirs"; then
- # Maybe just do a dry run.
- test -n "$run" && current_libdirs=" -n$current_libdirs"
- exec $SHELL $0 --finish$current_libdirs
- exit 1
- fi
-
- exit 0
- ;;
-
- # libtool finish mode
- finish)
- progname="$progname: finish"
- libdirs="$nonopt"
-
- if test -n "$finish_cmds" && test -n "$libdirs"; then
- for dir
- do
- libdirs="$libdirs $dir"
- done
-
- for libdir in $libdirs; do
- # Do each command in the postinstall commands.
- cmds=`eval \\$echo \"$finish_cmds\"`
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd"
- done
- IFS="$save_ifs"
- done
- fi
-
- $echo "To link against installed libraries in LIBDIR, users may have to:"
- if test -n "$shlibpath_var"; then
- $echo " - add LIBDIR to their \`$shlibpath_var' environment variable"
- fi
- $echo " - use the \`-LLIBDIR' linker flag"
- exit 0
- ;;
-
- # libtool execute mode
- execute)
- progname="$progname: execute"
-
- # The first argument is the command name.
- cmd="$nonopt"
- if test -z "$cmd"; then
- $echo "$progname: you must specify a COMMAND" 1>&2
- $echo "$help"
- exit 1
- fi
-
- # Handle -dlopen flags immediately.
- for file in $execute_dlfiles; do
- if test -f "$file"; then :
- else
- $echo "$progname: \`$file' is not a file" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- dir=
- case "$file" in
- *.la)
- # Check to see that this really is a libtool archive.
- if egrep '^# Generated by ltmain.sh' $file >/dev/null 2>&1; then :
- else
- $echo "$progname: \`$lib' is not a valid libtool archive" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- # Read the libtool library.
- dlname=
- library_names=
-
- # If there is no directory component, then add one.
- case "$file" in
- */*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Skip this library if it cannot be dlopened.
- if test -z "$dlname"; then
- # Warn if it was a shared library.
- test -n "$library_names" && $echo "$progname: warning: \`$file' was not linked with \`-export-dynamic'"
- continue
- fi
-
- dir=`$echo "$file" | sed 's%/[^/]*$%%'`
- test "X$dir" = "X$file" && dir=.
-
- if test -f "$dir/$objdir/$dlname"; then
- dir="$dir/$objdir"
- else
- $echo "$progname: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
- exit 1
- fi
- ;;
-
- *.lo)
- # Just add the directory containing the .lo file.
- dir=`$echo "$file" | sed 's%/[^/]*$%%'`
- test "X$dir" = "X$file" && dir=.
- ;;
-
- *)
- $echo "$progname: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
- continue
- ;;
- esac
-
- # Get the absolute pathname.
- absdir=`cd "$dir" && pwd`
- test -n "$absdir" && dir="$absdir"
-
- # Now add the directory to shlibpath_var.
- if eval "test -z \"\$$shlibpath_var\""; then
- eval "$shlibpath_var=\"\$dir\""
- else
- eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
- fi
- done
-
- # This variable tells wrapper scripts just to set shlibpath_var
- # rather than running their programs.
- libtool_execute_magic="$magic"
-
- # Check if any of the arguments is a wrapper script.
- args=
- for file
- do
- case "$file" in
- -*) ;;
- *)
- if egrep '^# Generated by ltmain.sh' $file >/dev/null 2>&1; then
- # If there is no directory component, then add one.
- case "$file" in
- */*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Transform arg to wrapped name.
- file="$progdir/$program"
- fi
- ;;
- esac
- # Quote arguments (to preserve shell metacharacters).
- file=`$echo "$file" | sed "$sed_quote_subst"`
- args="$args \"$file\""
- done
-
- if test -z "$run"; then
- # Export the shlibpath_var.
- eval "export $shlibpath_var"
-
- # Now actually exec the command.
- eval "exec \$cmd$args"
-
- $echo "$progname: cannot exec \$cmd$args"
- exit 1
- else
- # Display what would be done.
- eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
- $echo "export $shlibpath_var"
- $echo "$cmd$args"
- exit 0
- fi
- ;;
-
- # libtool uninstall mode
- uninstall)
- progname="$progname: uninstall"
- rm="$nonopt"
- files=
-
- for arg
- do
- case "$arg" in
- -*) rm="$rm $arg" ;;
- *) files="$files $arg" ;;
- esac
- done
-
- if test -z "$rm"; then
- $echo "$progname: you must specify an RM program" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- for file in $files; do
- dir=`$echo "$file" | sed -e 's%/[^/]*$%%'`
- test "X$dir" = "X$file" && dir=.
- name=`$echo "$file" | sed -e 's%^.*/%%'`
-
- rmfiles="$file"
-
- case "$name" in
- *.la)
- # Possibly a libtool archive, so verify it.
- if egrep '^# Generated by ltmain.sh' $file >/dev/null 2>&1; then
- . $dir/$name
-
- # Delete the libtool libraries and symlinks.
- for n in $library_names; do
- rmfiles="$rmfiles $dir/$n"
- test "X$n" = "X$dlname" && dlname=
- done
- test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
- test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
-
- # FIXME: should reinstall the best remaining shared library.
- fi
- ;;
-
- *.lo)
- if test "$build_old_libs" = yes; then
- oldobj=`$echo "$name" | sed 's/\.lo$/\.o/'`
- rmfiles="$rmfiles $dir/$oldobj"
- fi
- ;;
- esac
-
- $show "$rm $rmfiles"
- $run $rm $rmfiles
- done
- exit 0
- ;;
-
- "")
- $echo "$progname: you must specify a MODE" 1>&2
- $echo "$generic_help" 1>&2
- exit 1
- ;;
- esac
-
- $echo "$progname: invalid operation mode \`$mode'" 1>&2
- $echo "$generic_help" 1>&2
- exit 1
-fi # test -z "$show_help"
-
-# We need to display help for each of the modes.
-case "$mode" in
-"") cat <<EOF
-Usage: $progname [OPTION]... [MODE-ARG]...
-
-Provide generalized library-building support services.
-
--n, --dry-run display commands without modifying any files
- --features display configuration information and exit
- --finish same as \`--mode=finish'
- --help display this help message and exit
- --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
- --quiet same as \`--silent'
- --silent don't print informational messages
- --version print version information
-
-MODE must be one of the following:
-
- compile compile a source file into a libtool object
- execute automatically set library path, then run a program
- finish complete the installation of libtool libraries
- install install libraries or executables
- link create a library or an executable
- uninstall remove libraries from an installed directory
-
-MODE-ARGS vary depending on the MODE. Try \`$progname --help --mode=MODE' for
-a more detailed description of MODE.
-EOF
- ;;
-
-compile)
- cat <<EOF
-Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
-
-Compile a source file into a libtool library object.
-
-COMPILE-COMMAND is a command to be used in creating a \`standard' object file
-from the given SOURCEFILE.
-
-The output file name is determined by removing the directory component from
-SOURCEFILE, then substituting the C source code suffix \`.c' with the
-library object suffix, \`.lo'.
-EOF
- ;;
-
-execute)
- cat <<EOF
-Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
-
-Automatically set library path, then run a program.
-
-This mode accepts the following additional options:
-
- -dlopen FILE add the directory containing FILE to the library path
-
-This mode sets the library path environment variable according to \`-dlopen'
-flags.
-
-If any of the ARGS are libtool executable wrappers, then they are translated
-into their corresponding uninstalled binary, and any of their required library
-directories are added to the library path.
-
-Then, COMMAND is executed, with ARGS as arguments.
-EOF
- ;;
-
-finish)
- cat <<EOF
-Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
-
-Complete the installation of libtool libraries.
-
-Each LIBDIR is a directory that contains libtool libraries.
-
-The commands that this mode executes may require superuser privileges. Use
-the \`--dry-run' option if you just want to see what would be executed.
-EOF
- ;;
-
-install)
- cat <<EOF
-Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
-
-Install executables or libraries.
-
-INSTALL-COMMAND is the installation command. The first component should be
-either the \`install' or \`cp' program.
-
-The rest of the components are interpreted as arguments to that command (only
-BSD-compatible install options are recognized).
-EOF
- ;;
-
-link)
- cat <<EOF
-Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
-
-Link object files or libraries together to form another library, or to
-create an executable program.
-
-LINK-COMMAND is a command using the C compiler that you would use to create
-a program from several object files.
-
-The following components of LINK-COMMAND are treated specially:
-
- -all-static do not do any dynamic linking at all
- -allow-undefined allow a libtool library to reference undefined symbols
- -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
- -dlpreopen FILE link in FILE and add its symbols to dld_preloaded_symbols
- -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
- -LLIBDIR search LIBDIR for required installed libraries
- -lNAME OUTPUT-FILE requires the installed library libNAME
- -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
- -rpath LIBDIR the created library will eventually be installed in LIBDIR
- -static do not do any dynamic linking of libtool libraries
- -version-info CURRENT[:REVISION[:AGE]]
- specify library version info [each variable defaults to 0]
-
-All other options (arguments beginning with \`-') are ignored.
-
-Every other argument is treated as a filename. Files ending in \`.la' are
-treated as uninstalled libtool libraries, other files are standard or library
-object files.
-
-If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only
-library objects (\`.lo' files) may be specified, and \`-rpath' is required.
-
-If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar'
-and \`ranlib'.
-
-If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is
-created, otherwise an executable program is created.
-EOF
- ;;
-
-uninstall)
- cat <<EOF
-Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
-
-Remove libraries from an installation directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, all the files associated with it are deleted.
-Otherwise, only FILE itself is deleted using RM.
-EOF
- ;;
-
-*)
- $echo "$progname: invalid operation mode \`$mode'" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
-esac
-
-$echo
-$echo "Try \`$progname --help' for more information about other modes."
-
-exit 0
-
-# Local Variables:
-# mode:shell-script
-# sh-indentation:2
-# End:
diff --git a/glib/missing b/glib/missing
deleted file mode 100755
index e4b838ca92..0000000000
--- a/glib/missing
+++ /dev/null
@@ -1,134 +0,0 @@
-#! /bin/sh
-# Common stub for a few missing GNU programs while installing.
-# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
-# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
-if test $# -eq 0; then
- echo 1>&2 "Try \`$0 --help' for more information"
- exit 1
-fi
-
-case "$1" in
-
- -h|--h|--he|--hel|--help)
- echo "\
-$0 [OPTION]... PROGRAM [ARGUMENT]...
-
-Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
-error status if there is no known handling for PROGRAM.
-
-Options:
- -h, --help display this help and exit
- -v, --version output version information and exit
-
-Supported PROGRAM values:
- aclocal touch file \`aclocal.m4'
- autoconf touch file \`configure'
- autoheader touch file \`config.h.in'
- automake touch all \`Makefile.in' files
- bison touch file \`y.tab.c'
- makeinfo touch the output file
- yacc touch file \`y.tab.c'"
- ;;
-
- -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
- echo "missing - GNU libit 0.0"
- ;;
-
- -*)
- echo 1>&2 "$0: Unknown \`$1' option"
- echo 1>&2 "Try \`$0 --help' for more information"
- exit 1
- ;;
-
- aclocal)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. It should be needed only if
- you modified \`acinclude.m4' or \`configure.in'. You might want
- to install the \`Automake' and \`Perl' packages. Grab them from
- any GNU archive site."
- touch aclocal.m4
- ;;
-
- autoconf)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. It should be needed only if
- you modified \`configure.in'. You might want to install the
- \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
- archive site."
- touch configure
- ;;
-
- autoheader)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. It should be needed only if
- you modified \`acconfig.h' or \`configure.in'. You might want
- to install the \`Autoconf' and \`GNU m4' packages. Grab them
- from any GNU archive site."
- touch config.h.in
- ;;
-
- automake)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. It should be needed only if
- you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
- You might want to install the \`Automake' and \`Perl' packages.
- Grab them from any GNU archive site."
- find . -type f -name Makefile.am -print \
- | sed 's/^\(.*\).am$/touch \1.in/' \
- | sh
- ;;
-
- bison|yacc)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. It should be needed only if
- your modified any \`.y' file. For being effective, your
- modifications might require the \`Bison' package. Grab it from
- any GNU archive site."
- touch y.tab.c
- ;;
-
- makeinfo)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. It should be needed only if
- you modified a \`.texi' or \`.texinfo' file, or any other file
- indirectly affecting the aspect of the manual. The spurious
- call might also be the consequence of using a buggy \`make' (AIX,
- DU, IRIX). You might want to install the \`Texinfo' package or
- the \`GNU make' package. Grab either from any GNU archive site."
- file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
- if test -z "$file"; then
- file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
- file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
- fi
- touch $file
- ;;
-
- *)
- echo 1>&2 "\
-WARNING: \`$1' is needed, and you do not seem to have it handy on your
- system. You might have modified some files without having the
- proper tools for further handling them. Check the \`README' file,
- it often tells you about the needed prerequirements for installing
- this package. You may also peek at any GNU archive site, in case
- some other package would contain this missing \`$1' program."
- exit 1
- ;;
-esac
-
-exit 0
diff --git a/glib/mkinstalldirs b/glib/mkinstalldirs
deleted file mode 100755
index fef1eb9418..0000000000
--- a/glib/mkinstalldirs
+++ /dev/null
@@ -1,36 +0,0 @@
-#! /bin/sh
-# mkinstalldirs --- make directory hierarchy
-# Author: Noah Friedman <friedman@prep.ai.mit.edu>
-# Created: 1993-05-16
-# Last modified: 1994-03-25
-# Public domain
-
-errstatus=0
-
-for file in ${1+"$@"} ; do
- set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
- shift
-
- pathcomp=
- for d in ${1+"$@"} ; do
- pathcomp="$pathcomp$d"
- case "$pathcomp" in
- -* ) pathcomp=./$pathcomp ;;
- esac
-
- if test ! -d "$pathcomp"; then
- echo "mkdir $pathcomp" 1>&2
- mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$?
- fi
-
- if test ! -d "$pathcomp"; then
- errstatus=$lasterr
- fi
-
- pathcomp="$pathcomp/"
- done
-done
-
-exit $errstatus
-
-# mkinstalldirs ends here
diff --git a/glib/stamp-h.in b/glib/stamp-h.in
deleted file mode 100644
index 9788f70238..0000000000
--- a/glib/stamp-h.in
+++ /dev/null
@@ -1 +0,0 @@
-timestamp
diff --git a/glib/testglib.c b/glib/testglib.c
deleted file mode 100644
index 2763e85ce8..0000000000
--- a/glib/testglib.c
+++ /dev/null
@@ -1,406 +0,0 @@
-/* GLIB - Library of useful routines for C programming
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include "glib.h"
-
-int array[10000];
-
-void
-my_hash_callback (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- int *d = value;
- *d = 1;
-}
-
-guint
-my_hash (gpointer key)
-{
- return (guint) *((gint*) key);
-}
-
-gint
-my_hash_compare (gpointer a,
- gpointer b)
-{
- return *((gint*) a) == *((gint*) b);
-}
-
-gint
-my_list_compare_one (gpointer a, gpointer b)
-{
- gint one = *((gint*)a);
- gint two = *((gint*)b);
- return one-two;
-}
-
-gint
-my_list_compare_two (gpointer a, gpointer b)
-{
- gint one = *((gint*)a);
- gint two = *((gint*)b);
- return two-one;
-}
-
-/* void
-my_list_print (gpointer a, gpointer b)
-{
- gint three = *((gint*)a);
- g_print("%d", three);
-}; */
-
-gint
-my_compare (gpointer a,
- gpointer b)
-{
- char *cha = a;
- char *chb = b;
-
- return *cha - *chb;
-}
-
-gint
-my_traverse (gpointer key,
- gpointer value,
- gpointer data)
-{
- char *ch = key;
- g_print ("%c ", *ch);
- return FALSE;
-}
-
-void
-print_compare (gchar *a,
- gchar *b)
-{
- g_print ("%s <=> %s : %d\n", a, b, g_strcasecmp(a,b));
- g_print ("%s <=> %s : %d\n", b, a, g_strcasecmp(b,a));
-}
-
-int
-main (int argc,
- char *argv[])
-{
- GList *list, *t;
- GSList *slist, *st;
- GHashTable *hash_table;
- GMemChunk *mem_chunk;
- GStringChunk *string_chunk;
- GTimer *timer;
- gint nums[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
- gint morenums[10] = { 8, 9, 7, 0, 3, 2, 5, 1, 4, 6};
-
- gchar *mem[10000], *tmp_string, *tmp_string_2;
- gint i, j;
- GArray *garray;
- GString *string1, *string2;
- GTree *tree;
- char chars[62];
-
- g_print ("checking size of gint8...%d (should be 1)\n", sizeof (gint8));
- g_print ("checking size of gint16...%d (should be 2)\n", sizeof (gint16));
- g_print ("checking size of gint32...%d (should be 4)\n", sizeof (gint32));
-
- g_print ("checking doubly linked lists...");
-
- list = NULL;
- for (i = 0; i < 10; i++)
- list = g_list_append (list, &nums[i]);
- list = g_list_reverse (list);
-
- for (i = 0; i < 10; i++)
- {
- t = g_list_nth (list, i);
- if (*((gint*) t->data) != (9 - i))
- g_error ("Regular insert failed");
- }
-
- g_list_free (list);
- list = NULL;
-
- for (i = 0; i < 10; i++)
- list = g_list_insert_sorted (list, &morenums[i], my_list_compare_one);
-
- /*
- g_print("\n");
- g_list_foreach (list, my_list_print, NULL);
- */
-
- for (i = 0; i < 10; i++)
- {
- t = g_list_nth (list, i);
- if (*((gint*) t->data) != i)
- g_error ("Sorted insert failed");
- }
-
- g_list_free (list);
- list = NULL;
-
- for (i = 0; i < 10; i++)
- list = g_list_insert_sorted (list, &morenums[i], my_list_compare_two);
-
- /*
- g_print("\n");
- g_list_foreach (list, my_list_print, NULL);
- */
-
- for (i = 0; i < 10; i++)
- {
- t = g_list_nth (list, i);
- if (*((gint*) t->data) != (9 - i))
- g_error ("Sorted insert failed");
- }
-
- g_list_free (list);
-
- g_print ("ok\n");
-
-
- g_print ("checking singly linked lists...");
-
- slist = NULL;
- for (i = 0; i < 10; i++)
- slist = g_slist_append (slist, &nums[i]);
- slist = g_slist_reverse (slist);
-
- for (i = 0; i < 10; i++)
- {
- st = g_slist_nth (slist, i);
- if (*((gint*) st->data) != (9 - i))
- g_error ("failed");
- }
-
- g_slist_free (slist);
- slist = NULL;
-
- for (i = 0; i < 10; i++)
- slist = g_slist_insert_sorted (slist, &morenums[i], my_list_compare_one);
-
- /*
- g_print("\n");
- g_slist_foreach (slist, my_list_print, NULL);
- */
-
- for (i = 0; i < 10; i++)
- {
- st = g_slist_nth (slist, i);
- if (*((gint*) st->data) != i)
- g_error ("Sorted insert failed");
- }
-
- g_slist_free(slist);
- slist = NULL;
-
- for (i = 0; i < 10; i++)
- slist = g_slist_insert_sorted (slist, &morenums[i], my_list_compare_two);
-
- /*
- g_print("\n");
- g_slist_foreach (slist, my_list_print, NULL);
- */
-
- for (i = 0; i < 10; i++)
- {
- st = g_slist_nth (slist, i);
- if (*((gint*) st->data) != (9 - i))
- g_error("Sorted insert failed");
- }
-
- g_slist_free(slist);
-
- g_print ("ok\n");
-
-
- g_print ("checking trees...\n");
-
- tree = g_tree_new (my_compare);
- i = 0;
- for (j = 0; j < 10; j++, i++)
- {
- chars[i] = '0' + j;
- g_tree_insert (tree, &chars[i], &chars[i]);
- }
- for (j = 0; j < 26; j++, i++)
- {
- chars[i] = 'A' + j;
- g_tree_insert (tree, &chars[i], &chars[i]);
- }
- for (j = 0; j < 26; j++, i++)
- {
- chars[i] = 'a' + j;
- g_tree_insert (tree, &chars[i], &chars[i]);
- }
-
- g_print ("tree height: %d\n", g_tree_height (tree));
- g_print ("tree nnodes: %d\n", g_tree_nnodes (tree));
-
- g_print ("tree: ");
- g_tree_traverse (tree, my_traverse, G_IN_ORDER, NULL);
- g_print ("\n");
-
- for (i = 0; i < 10; i++)
- g_tree_remove (tree, &chars[i]);
-
- g_print ("tree height: %d\n", g_tree_height (tree));
- g_print ("tree nnodes: %d\n", g_tree_nnodes (tree));
-
- g_print ("tree: ");
- g_tree_traverse (tree, my_traverse, G_IN_ORDER, NULL);
- g_print ("\n");
-
- g_print ("ok\n");
-
-
- g_print ("checking mem chunks...");
-
- mem_chunk = g_mem_chunk_new ("test mem chunk", 50, 100, G_ALLOC_AND_FREE);
-
- for (i = 0; i < 10000; i++)
- {
- mem[i] = g_chunk_new (gchar, mem_chunk);
-
- for (j = 0; j < 50; j++)
- mem[i][j] = i * j;
- }
-
- for (i = 0; i < 10000; i++)
- {
- g_mem_chunk_free (mem_chunk, mem[i]);
- }
-
- g_print ("ok\n");
-
-
- g_print ("checking hash tables...");
-
- hash_table = g_hash_table_new (my_hash, my_hash_compare);
- for (i = 0; i < 10000; i++)
- {
- array[i] = i;
- g_hash_table_insert (hash_table, &array[i], &array[i]);
- }
- g_hash_table_foreach (hash_table, my_hash_callback, NULL);
-
- for (i = 0; i < 10000; i++)
- if (array[i] == 0)
- g_print ("%d\n", i);
-
- for (i = 0; i < 10000; i++)
- g_hash_table_remove (hash_table, &array[i]);
-
- g_hash_table_destroy (hash_table);
-
- g_print ("ok\n");
-
-
- g_print ("checking string chunks...");
-
- string_chunk = g_string_chunk_new (1024);
-
- for (i = 0; i < 100000; i ++)
- {
- tmp_string = g_string_chunk_insert (string_chunk, "hi pete");
-
- if (strcmp ("hi pete", tmp_string) != 0)
- g_error ("string chunks are broken.\n");
- }
-
- tmp_string_2 = g_string_chunk_insert_const (string_chunk, tmp_string);
-
- g_assert (tmp_string_2 != tmp_string &&
- strcmp(tmp_string_2, tmp_string) == 0);
-
- tmp_string = g_string_chunk_insert_const (string_chunk, tmp_string);
-
- g_assert (tmp_string_2 == tmp_string);
-
- g_string_chunk_free (string_chunk);
-
- g_print ("ok\n");
-
-
- g_print ("checking arrays...");
-
- garray = g_array_new (FALSE);
- for (i = 0; i < 10000; i++)
- g_array_append_val (garray, gint, i);
-
- for (i = 0; i < 10000; i++)
- if (g_array_index (garray, gint, i) != i)
- g_print ("uh oh: %d ( %d )\n", g_array_index (garray, gint, i), i);
-
- g_array_free (garray, TRUE);
-
- garray = g_array_new (FALSE);
- for (i = 0; i < 10000; i++)
- g_array_prepend_val (garray, gint, i);
-
- for (i = 0; i < 10000; i++)
- if (g_array_index (garray, gint, i) != (10000 - i - 1))
- g_print ("uh oh: %d ( %d )\n", g_array_index (garray, gint, i), 10000 - i - 1);
-
- g_array_free (garray, TRUE);
-
- g_print ("ok\n");
-
-
- g_print ("checking strings...");
-
- string1 = g_string_new ("hi pete!");
- string2 = g_string_new ("");
-
- g_assert (strcmp ("hi pete!", string1->str) == 0);
-
- for (i = 0; i < 10000; i++)
- g_string_append_c (string1, 'a'+(i%26));
-
- g_string_sprintf (string2, "%s|%0100d|%s|%s|%0*d|%*.*f|%10000.10000f",
- "this pete guy sure is a wuss, like he's the number ",
- 1,
- " wuss. everyone agrees.\n",
- string1->str,
- 10, 666, 15, 15, 666.666666666, 666.666666666);
-
- g_print ("ok\n");
-
- g_print ("checking timers...\n");
-
- timer = g_timer_new ();
- g_print (" spinning for 3 seconds...\n");
-
- g_timer_start (timer);
- while (g_timer_elapsed (timer, NULL) < 3)
- ;
-
- g_timer_stop (timer);
- g_timer_destroy (timer);
-
- g_print ("ok\n");
-
- g_print ("checking g_strcasecmp...\n");
- print_compare ("Schloß", "Schlo");
- print_compare ("Äffchen", "Öfchen");
-
- /* g_debug (argv[0]); */
-
-
- return 0;
-}
diff --git a/gtk+.prj b/gtk+.prj
deleted file mode 100644
index 2c16fecaf7..0000000000
--- a/gtk+.prj
+++ /dev/null
@@ -1,334 +0,0 @@
-;; -*- Lisp -*-
-(Created-By-Prcs-Version 1 1 0)
-(Project-Description "")
-(Project-Version gtk+ 0 16)
-(Parent-Version gtk+ 0 15)
-(Descends-From -*- -*- -*-)
-(Version-Log "")
-(New-Version-Log "")
-(Checkin-Time "Wed, 19 Feb 1997 15:49:10 -0800")
-(Checkin-Login pmattis)
-(Populate-Ignore ("\\.o$" "\\.a$" "^core$" "^.*/core$"
- ".*.deps/.*" "\\.dvi$" "\\.aux$" "\\.log"
- "Makefile$" "config.cache$" "config.log$"
- "configure$" "gconfig.h$" "stamp-h$"))
-(Files
-;; This is a comment. Fill in files here.
-;; For example: (prcs/checkout.cc ())
-
-; Files added by populate at Thu, 21 Nov 1996 16:48:40 -0800:
-
- (docs/texinfo.tex (gtk+/1_texinfo.te 1.1 644))
- (docs/gtk.texi (gtk+/2_gtk.texi 1.5 644))
- (docs/gdk.texi (gtk+/3_gdk.texi 1.2 644))
- (docs/Makefile.in (gtk+/4_Makefile.i 1.5 644))
- (docs/Makefile.am (gtk+/5_Makefile.a 1.2 644))
- (gtk/testgtk.c (gtk+/6_testgtk.c 1.14 644))
- (gtk/gtkwindow.h (gtk+/7_gtkwindow. 1.6 644))
- (gtk/gtkwindow.c (gtk+/8_gtkwindow. 1.10 644))
- (gtk/gtkwidget.h (gtk+/9_gtkwidget. 1.8 644))
- (gtk/gtkwidget.c (gtk+/10_gtkwidget. 1.14 644))
- (gtk/gtkvseparator.h (gtk+/11_gtkvsepara 1.3 644))
- (gtk/gtkvseparator.c (gtk+/12_gtkvsepara 1.5 644))
- (gtk/gtkvscrollbar.h (gtk+/13_gtkvscroll 1.3 644))
- (gtk/gtkvscrollbar.c (gtk+/14_gtkvscroll 1.5 644))
- (gtk/gtkvscale.h (gtk+/15_gtkvscale. 1.2 644))
- (gtk/gtkvscale.c (gtk+/16_gtkvscale. 1.7 644))
- (gtk/gtkvruler.h (gtk+/17_gtkvruler. 1.4 644))
- (gtk/gtkvruler.c (gtk+/18_gtkvruler. 1.7 644))
- (gtk/gtkviewport.h (gtk+/19_gtkviewpor 1.3 644))
- (gtk/gtkviewport.c (gtk+/20_gtkviewpor 1.6 644))
- (gtk/gtkvbox.h (gtk+/21_gtkvbox.h 1.2 644))
- (gtk/gtkvbox.c (gtk+/22_gtkvbox.c 1.5 644))
- (gtk/gtktypeutils.h (gtk+/23_gtktypeuti 1.4 644))
- (gtk/gtktypeutils.c (gtk+/24_gtktypeuti 1.6 644))
- (gtk/gtktreeitem.h (gtk+/25_gtktreeite 1.3 644))
- (gtk/gtktreeitem.c (gtk+/26_gtktreeite 1.4 644))
- (gtk/gtktree.h (gtk+/27_gtktree.h 1.3 644))
- (gtk/gtktree.c (gtk+/28_gtktree.c 1.4 644))
- (gtk/gtktogglebutton.h (gtk+/29_gtktoggleb 1.5 644))
- (gtk/gtktogglebutton.c (gtk+/30_gtktoggleb 1.8 644))
- (gtk/gtktable.h (gtk+/31_gtktable.h 1.2 644))
- (gtk/gtktable.c (gtk+/32_gtktable.c 1.8 644))
- (gtk/gtkstyle.h (gtk+/33_gtkstyle.h 1.3 644))
- (gtk/gtkstyle.c (gtk+/34_gtkstyle.c 1.7 644))
- (gtk/gtksignal.h (gtk+/35_gtksignal. 1.7 644))
- (gtk/gtksignal.c (gtk+/36_gtksignal. 1.9 644))
- (gtk/gtkseparator.h (gtk+/37_gtkseparat 1.2 644))
- (gtk/gtkseparator.c (gtk+/38_gtkseparat 1.4 644))
- (gtk/gtkscrolledwindow.h (gtk+/39_gtkscrolle 1.2 644))
- (gtk/gtkscrolledwindow.c (gtk+/40_gtkscrolle 1.8 644))
- (gtk/gtkscrollbar.h (gtk+/41_gtkscrollb 1.2 644))
- (gtk/gtkscrollbar.c (gtk+/42_gtkscrollb 1.4 644))
- (gtk/gtkscale.h (gtk+/43_gtkscale.h 1.4 644))
- (gtk/gtkscale.c (gtk+/44_gtkscale.c 1.7 644))
- (gtk/gtkruler.h (gtk+/45_gtkruler.h 1.5 644))
- (gtk/gtkruler.c (gtk+/46_gtkruler.c 1.8 644))
- (gtk/gtkrc.h (gtk+/47_gtkrc.h 1.3 644))
- (gtk/gtkrc.c (gtk+/48_gtkrc.c 1.4 644))
- (gtk/gtkrange.h (gtk+/49_gtkrange.h 1.4 644))
- (gtk/gtkrange.c (gtk+/50_gtkrange.c 1.6 644))
- (gtk/gtkradiobutton.h (gtk+/51_gtkradiobu 1.3 644))
- (gtk/gtkradiobutton.c (gtk+/b/0_gtkradiobutton.c 1.7 644))
- (gtk/gtkpixmap.h (gtk+/b/1_gtkpixmap. 1.3 644))
- (gtk/gtkpixmap.c (gtk+/b/2_gtkpixmap. 1.5 644))
- (gtk/gtkoptionmenu.h (gtk+/b/3_gtkoptionm 1.5 644))
- (gtk/gtkoptionmenu.c (gtk+/b/4_gtkoptionm 1.7 644))
- (gtk/gtkobject.h (gtk+/b/5_gtkobject. 1.6 644))
- (gtk/gtkobject.c (gtk+/b/6_gtkobject. 1.9 644))
- (gtk/gtkmisc.h (gtk+/b/7_gtkmisc.h 1.2 644))
- (gtk/gtkmisc.c (gtk+/b/8_gtkmisc.c 1.4 644))
- (gtk/gtkmenushell.h (gtk+/b/9_gtkmenushe 1.5 644))
- (gtk/gtkmenushell.c (gtk+/b/10_gtkmenushe 1.8 644))
- (gtk/gtkmenuitem.h (gtk+/b/11_gtkmenuite 1.6 644))
- (gtk/gtkmenuitem.c (gtk+/b/12_gtkmenuite 1.8 644))
- (gtk/gtkmenubar.h (gtk+/b/13_gtkmenubar 1.4 644))
- (gtk/gtkmenubar.c (gtk+/b/14_gtkmenubar 1.7 644))
- (gtk/gtkmenu.h (gtk+/b/15_gtkmenu.h 1.5 644))
- (gtk/gtkmenu.c (gtk+/b/16_gtkmenu.c 1.8 644))
- (gtk/gtkmain.h (gtk+/b/17_gtkmain.h 1.4 644))
- (gtk/gtkmain.c (gtk+/b/18_gtkmain.c 1.11 644))
- (gtk/gtklistitem.h (gtk+/b/19_gtklistite 1.3 644))
- (gtk/gtklistitem.c (gtk+/b/20_gtklistite 1.9 644))
- (gtk/gtklist.h (gtk+/b/21_gtklist.h 1.5 644))
- (gtk/gtklist.c (gtk+/b/22_gtklist.c 1.10 644))
- (gtk/gtklabel.h (gtk+/b/23_gtklabel.h 1.2 644))
- (gtk/gtklabel.c (gtk+/b/24_gtklabel.c 1.7 644))
- (gtk/gtkitem.h (gtk+/b/25_gtkitem.h 1.3 644))
- (gtk/gtkitem.c (gtk+/b/26_gtkitem.c 1.7 644))
- (gtk/gtkimage.h (gtk+/b/27_gtkimage.h 1.2 644))
- (gtk/gtkimage.c (gtk+/b/28_gtkimage.c 1.4 644))
- (gtk/gtkhseparator.h (gtk+/b/29_gtkhsepara 1.2 644))
- (gtk/gtkhseparator.c (gtk+/b/30_gtkhsepara 1.4 644))
- (gtk/gtkhscrollbar.h (gtk+/b/31_gtkhscroll 1.2 644))
- (gtk/gtkhscrollbar.c (gtk+/b/32_gtkhscroll 1.4 644))
- (gtk/gtkhscale.h (gtk+/b/33_gtkhscale. 1.2 644))
- (gtk/gtkhscale.c (gtk+/b/34_gtkhscale. 1.7 644))
- (gtk/gtkhruler.h (gtk+/b/35_gtkhruler. 1.4 644))
- (gtk/gtkhruler.c (gtk+/b/36_gtkhruler. 1.7 644))
- (gtk/gtkhbox.h (gtk+/b/37_gtkhbox.h 1.2 644))
- (gtk/gtkhbox.c (gtk+/b/38_gtkhbox.c 1.5 644))
- (gtk/gtkgc.h (gtk+/b/39_gtkgc.h 1.3 644))
- (gtk/gtkgc.c (gtk+/b/40_gtkgc.c 1.5 644))
- (gtk/gtkframe.h (gtk+/b/41_gtkframe.h 1.2 644))
- (gtk/gtkframe.c (gtk+/b/42_gtkframe.c 1.5 644))
- (gtk/gtkenums.h (gtk+/b/45_gtkenums.h 1.6 644))
- (gtk/gtkentry.h (gtk+/b/46_gtkentry.h 1.5 644))
- (gtk/gtkentry.c (gtk+/b/47_gtkentry.c 1.9 644))
- (gtk/gtkdrawingarea.h (gtk+/b/48_gtkdrawing 1.4 644))
- (gtk/gtkdrawingarea.c (gtk+/b/49_gtkdrawing 1.6 644))
- (gtk/gtkdata.h (gtk+/b/50_gtkdata.h 1.2 644))
- (gtk/gtkdata.c (gtk+/b/51_gtkdata.c 1.7 644))
- (gtk/gtkcontainer.h (gtk+/c/0_gtkcontainer.h 1.6 644))
- (gtk/gtkcontainer.c (gtk+/c/1_gtkcontain 1.10 644))
- (gtk/gtkcheckbutton.h (gtk+/c/2_gtkcheckbu 1.3 644))
- (gtk/gtkcheckbutton.c (gtk+/c/3_gtkcheckbu 1.6 644))
- (gtk/gtkbutton.h (gtk+/c/4_gtkbutton. 1.4 644))
- (gtk/gtkbutton.c (gtk+/c/5_gtkbutton. 1.9 644))
- (gtk/gtkbox.h (gtk+/c/6_gtkbox.h 1.2 644))
- (gtk/gtkbox.c (gtk+/c/7_gtkbox.c 1.5 644))
- (gtk/gtkbin.h (gtk+/c/8_gtkbin.h 1.2 644))
- (gtk/gtkbin.c (gtk+/c/9_gtkbin.c 1.6 644))
- (gtk/gtkarrow.h (gtk+/c/10_gtkarrow.h 1.2 644))
- (gtk/gtkarrow.c (gtk+/c/11_gtkarrow.c 1.4 644))
- (gtk/gtkalignment.h (gtk+/c/12_gtkalignme 1.2 644))
- (gtk/gtkalignment.c (gtk+/c/13_gtkalignme 1.5 644))
- (gtk/gtkadjustment.h (gtk+/c/14_gtkadjustm 1.3 644))
- (gtk/gtkadjustment.c (gtk+/c/15_gtkadjustm 1.7 644))
- (gtk/gtkaccelerator.h (gtk+/c/16_gtkacceler 1.4 644))
- (gtk/gtkaccelerator.c (gtk+/c/17_gtkacceler 1.4 644))
- (gtk/gtk.h (gtk+/c/18_gtk.h 1.7 644))
- (gtk/fnmatch.h (gtk+/c/19_fnmatch.h 1.1 644))
- (gtk/fnmatch.c (gtk+/c/20_fnmatch.c 1.1 644))
- (TODO (gtk+/c/21_TODO 1.13 644))
- (gtk/Makefile.in (gtk+/c/22_Makefile.i 1.10 644))
- (gtk/Makefile.am (gtk+/c/23_Makefile.a 1.10 644))
- (gdk/makekeysyms.sed (gtk+/c/24_makekeysym 1.1 644))
- (gdk/makekeysyms (gtk+/c/25_makekeysym 1.1 755))
- (gdk/makecursors.sed (gtk+/c/26_makecursor 1.1 644))
- (gdk/makecursors (gtk+/c/27_makecursor 1.1 755))
- (gdk/gdkx.h (gtk+/c/28_gdkx.h 1.2 644))
- (gdk/gdkwindow.c (gtk+/c/29_gdkwindow. 1.8 644))
- (gdk/gdkvisual.c (gtk+/c/30_gdkvisual. 1.2 644))
- (gdk/gdktypes.h (gtk+/c/31_gdktypes.h 1.6 644))
- (gdk/gdkrectangle.c (gtk+/c/32_gdkrectang 1.3 644))
- (gdk/gdkprivate.h (gtk+/c/33_gdkprivate 1.4 644))
- (gdk/gdkpixmap.c (gtk+/c/34_gdkpixmap. 1.6 644))
- (gdk/gdkkeysyms.h (gtk+/c/35_gdkkeysyms 1.2 644))
- (gdk/gdkimage.c (gtk+/c/36_gdkimage.c 1.4 644))
- (gdk/gdkglobals.c (gtk+/c/37_gdkglobals 1.3 644))
- (gdk/gdkgc.c (gtk+/c/38_gdkgc.c 1.6 644))
- (gdk/gdkfont.c (gtk+/c/39_gdkfont.c 1.4 644))
- (gdk/gdkdraw.c (gtk+/c/40_gdkdraw.c 1.4 644))
- (gdk/gdkcursors.h (gtk+/c/41_gdkcursors 1.3 644))
- (gdk/gdkcursor.c (gtk+/c/42_gdkcursor. 1.3 644))
- (gdk/gdkcolor.c (gtk+/c/43_gdkcolor.c 1.4 644))
- (gdk/gdk.h (gtk+/c/44_gdk.h 1.6 644))
- (gdk/gdk.c (gtk+/c/45_gdk.c 1.8 644))
- (gdk/Makefile.in (gtk+/c/46_Makefile.i 1.7 644))
- (gdk/Makefile.am (gtk+/c/47_Makefile.a 1.7 644))
- (glib/testglib.c (gtk+/c/48_testglib.c 1.8 644))
- (glib/stamp-h.in (gtk+/c/49_stamp-h.in 1.1 644))
- (glib/mkinstalldirs (gtk+/c/50_mkinstalld 1.1 755))
- (glib/install-sh (gtk+/c/51_install-sh 1.1 755))
- (glib/gutils.c (gtk+/d/0_gutils.c 1.3 644))
- (glib/gtimer.c (gtk+/d/1_gtimer.c 1.2 644))
- (glib/gslist.c (gtk+/d/2_gslist.c 1.6 644))
- (glib/gprimes.c (gtk+/d/3_gprimes.c 1.2 644))
- (glib/gmem.c (gtk+/d/4_gmem.c 1.9 644))
- (glib/glist.c (gtk+/d/5_glist.c 1.4 644))
- (glib/glib.h (gtk+/d/6_glib.h 1.8 644))
- (glib/ghash.c (gtk+/d/7_ghash.c 1.5 644))
- (glib/gerror.c (gtk+/d/8_gerror.c 1.4 644))
- (glib/gconfig.h.in (gtk+/d/9_gconfig.h. 1.3 644))
- (glib/gconfig.h (gtk+/d/10_gconfig.h 1.6 644))
- (glib/gcache.c (gtk+/d/11_gcache.c 1.6 644))
- (glib/configure.in (gtk+/d/12_configure. 1.4 644))
- (glib/configure (gtk+/d/13_configure 1.4 755))
- (glib/config.sub (gtk+/d/14_config.sub 1.2 755))
- (glib/config.guess (gtk+/d/15_config.gue 1.2 755))
- (glib/aclocal.m4 (gtk+/d/16_aclocal.m4 1.4 644))
- (glib/acconfig.h (gtk+/d/17_acconfig.h 1.3 644))
- (glib/README (gtk+/d/18_README 1.1 644))
- (glib/NEWS (gtk+/d/19_NEWS 1.1 644))
- (glib/Makefile.in (gtk+/d/20_Makefile.i 1.7 644))
- (glib/Makefile.am (gtk+/d/21_Makefile.a 1.7 644))
- (glib/INSTALL (gtk+/d/22_INSTALL 1.1 644))
- (glib/ChangeLog (gtk+/d/23_ChangeLog 1.2 644))
- (glib/COPYING (gtk+/d/24_COPYING 1.1 644))
- (glib/AUTHORS (gtk+/d/25_AUTHORS 1.2 644))
- (stamp-h.in (gtk+/d/26_stamp-h.in 1.1 644))
- (mkinstalldirs (gtk+/d/27_mkinstalld 1.1 755))
- (install-sh (gtk+/d/28_install-sh 1.1 755))
- (configure.in (gtk+/d/30_configure. 1.8 644))
- (configure (gtk+/d/31_configure 1.8 755))
- (config.sub (gtk+/d/32_config.sub 1.2 755))
- (config.h.in (gtk+/d/33_config.h.i 1.4 644))
- (config.guess (gtk+/d/34_config.gue 1.2 755))
- (aclocal.m4 (gtk+/d/35_aclocal.m4 1.4 644))
- (acconfig.h (gtk+/d/36_acconfig.h 1.3 644))
- (README (gtk+/d/37_README 1.1 644))
- (NEWS (gtk+/d/38_NEWS 1.1 644))
- (Makefile.in (gtk+/d/39_Makefile.i 1.9 644))
- (Makefile.am (gtk+/d/40_Makefile.a 1.7 644))
- (INSTALL (gtk+/d/41_INSTALL 1.1 644))
- (ChangeLog (gtk+/d/42_ChangeLog 1.14 644))
- (COPYING (gtk+/d/43_COPYING 1.2 644))
- (AUTHORS (gtk+/d/44_AUTHORS 1.2 644))
-
-; Files added by populate at Mon, 30 Dec 1996 13:14:24 -0800:
-
- (gtk/gtkmenufactory.h (gtk+/0_gtkmenufac 1.4 644))
- (gtk/gtkmenufactory.c (gtk+/1_gtkmenufac 1.4 644))
-
-; Files added by populate at Thu, 02 Jan 1997 15:31:44 -0800:
-
- (gtk/testgtkrc (gtk+/0_testgtkrc 1.2 644))
-
-
-; Files added by populate at Fri, 10 Jan 1997 14:19:47 -0800:
-
- (gtk/gtkfilesel.h (gtk+/b/0_gtkfilesel.h 1.3 644))
- (gtk/gtkfilesel.c (gtk+/c/0_gtkfilesel.c 1.7 644))
- (glib/gstring.c (gtk+/d/0_gstring.c 1.4 644))
-
-; Files added by populate at Fri, 10 Jan 1997 18:01:19 -0800:
-
- (gdk/gdkselection.c (gtk+/b/0_gdkselection.c 1.5 644))
-
-; Files added by populate at Sun, 19 Jan 1997 18:29:12 -0800:
-
- (gtk/gtktext.h (gtk+/b/0_gtktext.h 1.4 644))
- (gtk/gtktext.c (gtk+/c/0_gtktext.c 1.7 644))
- (gtk/gtkdialog.h (gtk+/d/0_gtkdialog.h 1.2 644))
- (gtk/gtkdialog.c (gtk+/d/47_gtkdialog. 1.4 644))
- (gdk/gdkxid.c (gtk+/d/48_gdkxid.c 1.2 644))
-
-; Files added by populate at Thu, 23 Jan 1997 01:29:17 -0800:
-
- (gtk/gtknotebook.h (gtk+/b/0_gtknotebook.h 1.3 644))
- (gtk/gtknotebook.c (gtk+/c/0_gtknotebook.c 1.6 644))
-
-; Files added by populate at Thu, 23 Jan 1997 02:06:11 -0800:
-
- (gtk/line-wrap.xbm (gtk+/b/0_line-wrap.xbm 1.1 644))
- (gtk/line-arrow.xbm (gtk+/c/0_line-arrow.xbm 1.1 644))
-
-; Files added by populate at Fri, 24 Jan 1997 13:02:44 -0800:
-
-
-
-
-
-
-; Files deleted by populate at Fri, 24 Jan 1997 13:02:44 -0800:
-
- ; `docs/texinfo3.7.patch'
-
-; Files added by populate at Tue, 28 Jan 1997 16:54:35 -0800:
-
- (gtk/simple.c (gtk+/e/0_simple.c 1.1 644))
- (glib/ltmain.sh (gtk+/e/1_ltmain.sh 1.3 644))
- (glib/ltconfig (gtk+/e/2_ltconfig 1.3 755))
- (ltmain.sh (gtk+/e/3_ltmain.sh 1.3 644))
- (ltconfig (gtk+/e/4_ltconfig 1.3 755))
-
-; Files added by populate at Thu, 30 Jan 1997 01:30:38 -0800:
-
- (glib/gtree.c (gtk+/b/0_gtree.c 1.3 644))
-
-; Files added by populate at Mon, 03 Feb 1997 19:46:14 -0800:
-
- (makecopyright (gtk+/b/0_makecopyright 1.1 755))
-
-; Files added by populate at Sat, 08 Feb 1997 14:41:52 -0800:
-
- (gtk/gtkprogressbar.h (gtk+/b/0_gtkprogressbar.h 1.1 644))
- (gtk/gtkprogressbar.c (gtk+/c/0_gtkprogressbar.c 1.1 644))
- (glib/garray.c (gtk+/d/0_garray.c 1.1 644))
-
-; Files deleted by populate at Sat, 08 Feb 1997 14:41:52 -0800:
-
- ; `interp/Makefile.am'
- ; `interp/Makefile.in'
- ; `interp/interp.c'
-
-;; Files added by populate at Wed, 19 Feb 1997 15:48:04 -0800:
-
- (gtk+.xconfig.in (gtk+/b/0_gtk+.xconfig.in 1.1 644))
-
-;; Files deleted by populate at Wed, 19 Feb 1997 15:48:04 -0800:
-
- ; docs/proposal.tex
-
-;; Files added by populate at Thu, 17 Apr 1997 17:39:47 -0700:
-
- (docs/macros.texi ())
- (gdk/gdkproperty.c ())
- (glib/missing () :symlink)
- (missing () :symlink)
-
-;; Files deleted by populate at Thu, 17 Apr 1997 17:39:47 -0700:
-
- ; gtk/gtkcanvas.c
- ; gtk/gtkcanvas.h
- ; gtk/gtkfill.c
- ; gtk/gtkfill.h
-
-;; Files added by populate at Thu, 17 Apr 1997 17:41:14 -0700:
-
- (gtk/gtktooltips.h ())
- (gtk/gtktooltips.c ())
- (gtk/gtkradiomenuitem.h ())
- (gtk/gtkradiomenuitem.c ())
- (gtk/gtkpreview.h ())
- (gtk/gtkpreview.c ())
- (gtk/gtkcolorsel.h ())
- (gtk/gtkcolorsel.c ())
- (gtk/gtkcheckmenuitem.h ())
- (gtk/gtkcheckmenuitem.c ())
- (gtk/gtkaspectframe.h ())
- (gtk/gtkaspectframe.c ())
-)
-(Merge-Parents)
-(New-Merge-Parents)
diff --git a/gtk+.xconfig.in b/gtk+.xconfig.in
deleted file mode 100644
index 8843df6ce4..0000000000
--- a/gtk+.xconfig.in
+++ /dev/null
@@ -1,3 +0,0 @@
-X_CFLAGS = @x_cflags@
-X_LDFLAGS = @x_ldflags@
-X_LIBS = @x_libs@
diff --git a/gtk/.cvsignore b/gtk/.cvsignore
deleted file mode 100644
index 946f48a269..0000000000
--- a/gtk/.cvsignore
+++ /dev/null
@@ -1,12 +0,0 @@
-*.lo
-Makefile
-Makefile.in
-.deps
-_libs
-.libs
-libgtk.la
-testgtk
-testinput
-testselection
-simple
-testtree
diff --git a/gtk/3DRings.xpm b/gtk/3DRings.xpm
deleted file mode 100644
index 1ca75da752..0000000000
--- a/gtk/3DRings.xpm
+++ /dev/null
@@ -1,116 +0,0 @@
-/* XPM */
-static char * DRings_xpm[] = {
-"48 48 65 1",
-" c None",
-". c #104010404103",
-"X c #1040208130C2",
-"o c #104014515144",
-"O c #000010402081",
-"+ c #1040104030C2",
-"@ c #208120815144",
-"# c #28A241035965",
-"$ c #30C230C26185",
-"% c #208130C24103",
-"& c #104010402081",
-"* c #104000002081",
-"= c #000010401040",
-"- c #492441036185",
-"; c #596559659E79",
-": c #30C220815144",
-"> c #0820186128A2",
-", c #000000001040",
-"< c #2081104030C2",
-"1 c #514459659658",
-"2 c #514455556185",
-"3 c #104000001040",
-"4 c #000008200000",
-"5 c #618569A6AEBA",
-"6 c #618569A69658",
-"7 c #410345148E38",
-"8 c #104020814103",
-"9 c #79E782079658",
-"0 c #208120814103",
-"q c #596571C69E79",
-"w c #4103514471C6",
-"e c #2081208130C2",
-"r c #6185618571C6",
-"t c #28A228A25965",
-"y c #596561858617",
-"u c #96589E79BEFB",
-"i c #28A230C271C6",
-"p c #38E345145144",
-"a c #79E78207A699",
-"s c #30C2492469A6",
-"d c #410330C25965",
-"f c #410351446185",
-"g c #AEBAAAAAD75C",
-"h c #38E338E34103",
-"j c #EFBEEBADEFBE",
-"k c #208130C25144",
-"l c #9658A289DF7D",
-"z c #208110404103",
-"x c #28A228A26185",
-"c c #8E388A28BEFB",
-"v c #208118612081",
-"b c #38E3451479E7",
-"n c #4924618579E7",
-"m c #86178617B6DA",
-"M c #30C220814103",
-"N c #104030C25144",
-"B c #4103410371C6",
-"V c #86178A28D75C",
-"C c #DF7DDB6CE79D",
-"Z c #BEFBC30BD75C",
-"A c #410330C271C6",
-"S c #30C228A230C2",
-"D c #082008201861",
-"F c #186130C238E3",
-"G c #0000208130C2",
-" .Xo ",
-" O+O@#$% ",
-" &*=+X-;: ",
-" >&=,=<11#2 ",
-" +O34,X567& ",
-" 8X+=,90q9w. ",
-" +e<>3r tyu-& ",
-" Xi%.= paus+ ",
-" Od-@= fga$h ",
-" @y7X, Xrjak ",
-" 2:eaw+ $ag;@ ",
-" .X@8@k@o@X+ +pl9tO ",
-" +zX@x$$isikt8o02crv ",
-" 8@%ip7757ywbs$Ohn6#. ",
-" &0%$p7r215ybw1pzp2-0= ",
-" 8tk$#yw21665n;1+%-p$O ",
-" O<e7pbryq5am9ay6XMpM>3& ",
-" 9.NtpBw16amclVcm1t%kX*88 ",
-" +&etd7r6y9ulgglm6>e>3s@83 ",
-" +0k$y-y69cgCCCZVam%+#ik8X ",
-" O&oi$d725amgCjCZu962ybtx8+p ",
-" &X0x$sBym9VZCCCZca;yBbi%08& ",
-" =++@sApMy5muZZgum6y2wds:>+& ",
-" #tp;1;yB#i25cVucma5;w-pti@8& ",
-" .#2alumnBp:@1r59y9y6ywBS$%0X+= ",
-" %$wmZVu;#tX8X07r1656y2wbp$k@%@OD ",
-" 0Byc9a;h%0>&D&hBrr2r1bwB-AF:0<&*= ",
-" kBf;yr#@X+&<%MkhsBwBwpsB#Bktkt8+Oh ",
-" xt7B-t8*,3O.X00:$i#dBd#bptFek0X.+* ",
-" Xt#b#@=, =&O+X0Ft%ibsp$p$ki%l5sX&= ",
-" &<kvX&4 +O*&<X0e:%$pAti%:edugn0= ",
-" +X@&+, V,O&>+Xt>tktktv0%@k;Cls+ ",
-" =+O*4*X:p;9cy3&&8ve0FMtt$ee0>z7cZ6k ",
-" D=D4,=.k$sBs$ee=+X0Fk%-#t%0X&O0nu9bG ",
-" ,,434*&ze@F<eeeeee><tdhdSMe<&&XAaawx ",
-" 4,4,=+><peeeeee&=<%M%$hSF0X&O&kw5r%Z ",
-" D&vSFMF<>&D =0S-2i& ",
-" +>puB> >0h7s. ",
-" SM5VqM &0t#$8 ",
-" XpVV70 &0kMk. ",
-" XdyB%z *X<%@+ ",
-" &k$b0X+=8X08o ",
-" &e:e+=*X.X+& ",
-" +X.O+X0O.=, ",
-" +>&+0>3&* ",
-" &X0k+O, ",
-" >v,3 ",
-" "};
diff --git a/gtk/FilesQueue.xpm b/gtk/FilesQueue.xpm
deleted file mode 100644
index 586d27ec43..0000000000
--- a/gtk/FilesQueue.xpm
+++ /dev/null
@@ -1,98 +0,0 @@
-/* XPM */
-static char * FilesQueue_xpm[] = {
-"44 31 64 1",
-" c None",
-". c #E79DE38DDF7D",
-"X c #CF3CC71BCF3C",
-"o c #71C675D671C6",
-"O c #B6DAB2CAB6DA",
-"+ c #CF3CD34CCF3C",
-"@ c #DF7DE38DE79D",
-"# c #FFFFFBEEFFFF",
-"$ c #EFBEEFBEEFBE",
-"% c #DF7DDB6CDF7D",
-"& c #BEFBBAEAC71B",
-"* c #BEFBBAEABEFB",
-"= c #BEFBC30BC71B",
-"- c #71C66DB671C6",
-"; c #D75CD34CD75C",
-": c #9E799A699E79",
-"> c #E79DE38DE79D",
-", c #CF3CCB2BC71B",
-"< c #B6DAB2CABEFB",
-"1 c #BEFBBAEAB6DA",
-"2 c #B6DAB6DAB6DA",
-"3 c #618561856185",
-"4 c #C71BBAEABEFB",
-"5 c #AEBAAAAAAEBA",
-"6 c #965892488E38",
-"7 c #A699A699A699",
-"8 c #38E338E338E3",
-"9 c #F7DEF7DEF7DE",
-"0 c #E79DEFBEEFBE",
-"q c #DF7DE38DDF7D",
-"w c #C71BC71BC71B",
-"e c #C71BC30BBEFB",
-"r c #BEFBC30BBEFB",
-"t c #B6DAAAAAAEBA",
-"y c #410345144103",
-"u c #D75CDB6CD75C",
-"i c #C71BCB2BC71B",
-"p c #BEFBCB2BBEFB",
-"a c #9E79A289A699",
-"s c #86178E388E38",
-"d c #CF3CCF3CD75C",
-"f c #CF3CD75CCF3C",
-"g c #C71BC30BCF3C",
-"h c #28A22CB228A2",
-"j c #000000000000",
-"k c #D75CD34CDF7D",
-"l c #10400C300820",
-"z c #E79DEBADEFBE",
-"x c #DF7DDB6CD75C",
-"c c #514459655965",
-"v c #8617861779E7",
-"b c #DF7DD34CD75C",
-"n c #CF3CCB2BCF3C",
-"m c #618555555965",
-"M c #861786178617",
-"N c #30C234D330C2",
-"B c #EFBEEBADE79D",
-"V c #DF7DDB6CE79D",
-"C c #D75CE38DD75C",
-"Z c #514449245144",
-"A c #186120812081",
-"S c #79E77DF779E7",
-"D c #6185659569A6",
-"F c #9E7992489E79",
-" .XoOX+ ",
-" @#$%&*=-o;: ",
-" @>,=O<12*&:-<3X ",
-" >%&1*4*2*OO**56758790 ",
-" 9qX+we=r*&e<<<251t5555yu9 ",
-" $qu++;ipi=p*=p**2tOOO27a5s<- ",
-" #9udfXi;,gi&**4**4r*Ot5t55tehj ",
-" 0qku+u;+d,gg=*=r*&**&<255t<*yl1 ",
-" $$zq@%xk%uf;,w,i=i=e**r=12tO1=8cvj ",
-" $@%>.%.%%%xbkx,w+ni,wwrwe*4*1=;8mMNj ",
-" zz@Bz>>>V%%%C+u;;dfnnfwggi&=&X+yZsNll ",
-" af#9@B0>q>qqq>xk.;;;kfX+XnXw=g,fycMhhN5 ",
-" al5#9$$>qzBV.%x%%b;x+fnf+,X,iiqym6NAo-j ",
-" #roS%#$zz>>V%%xkk%f;;+df,XnwnVZD:8AS-j* ",
-" D-9Oy*9$Bz>q%qx%%u;x;;dknX+d>Zm:hhSDjr ",
-" a3o+>S3z#90@@z.%>qCC%uu;ff%@Zm:NhMoj= ",
-" wlvvo#:3599$>B>q>%%%%+f;fk$ymaalMvjr ",
-" 0.a--S49mct9$z@.qkkqC;xu%@Zm5AlvSj* ",
-" ohu%3:Z:9@y609q@@>..>Cx>$Zm5NhMvjr ",
-" -j797Zv5705y=#$0>>V.%>#Z378AMMj* ",
-" Zj9Xo-McBXDv%90.%%#9cc78AsMj* ",
-" 8hM#M-DSF96cvz0>z#c35Nhs6j1 ",
-" jl9#o63vx#-D###mmt8N66j* ",
-" 5jc@fZF3o%+ZFDm<8A6FjO ",
-" :j50sSay<$ss2Nh:FjO ",
-" 6880&SDMF.rNNFFj1 ",
-" 8jr#:SFScA6ajO ",
-" Alr$DSysajO ",
-" >jy#51:jO ",
-" %Dy*gjO ",
-" alla "};
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
deleted file mode 100644
index 77160d1e52..0000000000
--- a/gtk/Makefile.am
+++ /dev/null
@@ -1,277 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-gtkincludedir = $(includedir)/gtk
-
-lib_LTLIBRARIES = libgtk.la
-
-libgtk_la_SOURCES = \
- gtkaccelerator.c \
- gtkadjustment.c \
- gtkaspectframe.c \
- gtkalignment.c \
- gtkarrow.c \
- gtkbin.c \
- gtkbbox.c \
- gtkbox.c \
- gtkbutton.c \
- gtkcheckbutton.c \
- gtkcheckmenuitem.c \
- gtkclist.c \
- gtkcolorsel.c \
- gtkcombo.c \
- gtkcontainer.c \
- gtkcurve.c \
- gtkdata.c \
- gtkdialog.c \
- gtkdrawingarea.c \
- gtkeditable.c \
- gtkentry.c \
- gtkeventbox.c \
- gtkfilesel.c \
- gtkfixed.c \
- gtkframe.c \
- gtkgamma.c \
- gtkgc.c \
- gtkhandlebox.c \
- gtkhbbox.c \
- gtkhbox.c \
- gtkhpaned.c \
- gtkhruler.c \
- gtkhscale.c \
- gtkhscrollbar.c \
- gtkhseparator.c \
- gtkimage.c \
- gtkinputdialog.c \
- gtkitem.c \
- gtklabel.c \
- gtklist.c \
- gtklistitem.c \
- gtkmain.c \
- gtkmenu.c \
- gtkmenubar.c \
- gtkmenufactory.c \
- gtkmenuitem.c \
- gtkmenushell.c \
- gtkmisc.c \
- gtknotebook.c \
- gtkobject.c \
- gtkoptionmenu.c \
- gtkpaned.c \
- gtkpixmap.c \
- gtkpreview.c \
- gtkprogressbar.c \
- gtkradiobutton.c \
- gtkradiomenuitem.c \
- gtkrange.c \
- gtkrc.c \
- gtkruler.c \
- gtkscale.c \
- gtkscrollbar.c \
- gtkscrolledwindow.c \
- gtkselection.c \
- gtkseparator.c \
- gtksignal.c \
- gtkspinbutton.c \
- gtkstyle.c \
- gtkstatusbar.c \
- gtktable.c \
- gtktext.c \
- gtktipsquery.c \
- gtktogglebutton.c \
- gtktoolbar.c \
- gtktooltips.c \
- gtktree.c \
- gtktreeitem.c \
- gtktypeutils.c \
- gtkvbbox.c \
- gtkvbox.c \
- gtkviewport.c \
- gtkvpaned.c \
- gtkvruler.c \
- gtkvscale.c \
- gtkvscrollbar.c \
- gtkvseparator.c \
- gtkwidget.c \
- gtkwindow.c \
- fnmatch.c \
- fnmatch.h
-
-gtkinclude_HEADERS = \
- gtk.h \
- gtkaccelerator.h \
- gtkadjustment.h \
- gtkaspectframe.h \
- gtkalignment.h \
- gtkarrow.h \
- gtkbin.h \
- gtkbbox.h \
- gtkbox.h \
- gtkbutton.h \
- gtkcheckbutton.h \
- gtkcheckmenuitem.h \
- gtkclist.h \
- gtkcolorsel.h \
- gtkcombo.h \
- gtkcontainer.h \
- gtkcurve.h \
- gtkdata.h \
- gtkdebug.h \
- gtkdialog.h \
- gtkdrawingarea.h \
- gtkeditable.h \
- gtkentry.h \
- gtkenums.h \
- gtkeventbox.h \
- gtkfilesel.h \
- gtkfixed.h \
- gtkframe.h \
- gtkgamma.h \
- gtkgc.h \
- gtkhandlebox.h \
- gtkhbbox.h \
- gtkhbox.h \
- gtkhpaned.h \
- gtkhruler.h \
- gtkhscale.h \
- gtkhscrollbar.h \
- gtkhseparator.h \
- gtkimage.h \
- gtkinputdialog.h \
- gtkitem.h \
- gtklabel.h \
- gtklist.h \
- gtklistitem.h \
- gtkmain.h \
- gtkmenu.h \
- gtkmenubar.h \
- gtkmenufactory.h \
- gtkmenuitem.h \
- gtkmenushell.h \
- gtkmisc.h \
- gtknotebook.h \
- gtkobject.h \
- gtkoptionmenu.h \
- gtkpaned.h \
- gtkpixmap.h \
- gtkpreview.h \
- gtkprivate.h \
- gtkprogressbar.h \
- gtkradiobutton.h \
- gtkradiomenuitem.h \
- gtkrange.h \
- gtkrc.h \
- gtkruler.h \
- gtkscale.h \
- gtkscrollbar.h \
- gtkscrolledwindow.h \
- gtkselection.h \
- gtkseparator.h \
- gtksignal.h \
- gtkspinbutton.h \
- gtkstyle.h \
- gtkstatusbar.h \
- gtktable.h \
- gtktext.h \
- gtktipsquery.h \
- gtktogglebutton.h \
- gtktoolbar.h \
- gtktooltips.h \
- gtktree.h \
- gtktreeitem.h \
- gtktypeutils.h \
- gtkvbbox.h \
- gtkvbox.h \
- gtkviewport.h \
- gtkvpaned.h \
- gtkvruler.h \
- gtkvscale.h \
- gtkvscrollbar.h \
- gtkvseparator.h \
- gtkwidget.h \
- gtkwindow.h \
- gtktypebuiltins.h
-
-../gtk/gtktypebuiltins.h: gtk.defs gentypeinfo.el
- $(SHELL) $(srcdir)/runelisp $(srcdir)/gentypeinfo.el idmac $< $@
-
-gtktypebuiltins.c: gtk.defs gentypeinfo.el
- $(SHELL) $(srcdir)/runelisp $(srcdir)/gentypeinfo.el id $< $@
-
-libgtk_la_LDFLAGS = -version-info 1:0:0
-
-EXTRA_DIST = \
- line-arrow.xbm \
- line-wrap.xbm \
- testgtkrc \
- gtk.defs \
- runelisp \
- gentypeinfo.el \
- gtktypebuiltins.c \
- test.xpm \
- marble.xpm \
- 3DRings.xpm \
- FilesQueue.xpm \
- Modeller.xpm \
- tree_plus.xpm \
- tree_minus.xpm \
- tree_plus.xbm \
- tree_minus.xbm \
- circles.xbm
-
-INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/glib -I../glib @x_cflags@
-
-noinst_PROGRAMS = testgtk testinput testselection simple
-testgtk_LDADD = \
- libgtk.la \
- $(top_builddir)/gdk/libgdk.la \
- @x_ldflags@ \
- @x_libs@ \
- $(top_builddir)/glib/libglib.la \
- -lm
-
-testinput_LDADD = \
- libgtk.la \
- $(top_builddir)/gdk/libgdk.la \
- @x_ldflags@ \
- @x_libs@ \
- $(top_builddir)/glib/libglib.la \
- -lm
-
-testselection_LDADD = \
- libgtk.la \
- $(top_builddir)/gdk/libgdk.la \
- @x_ldflags@ \
- @x_libs@ \
- $(top_builddir)/glib/libglib.la \
- -lm
-
-simple_LDADD = \
- libgtk.la \
- $(top_builddir)/gdk/libgdk.la \
- @x_ldflags@ \
- @x_libs@ \
- $(top_builddir)/glib/libglib.la \
- -lm
-
-DEPS = \
- $(top_builddir)/gtk/libgtk.la \
- $(top_builddir)/gdk/libgdk.la \
- $(top_builddir)/glib/libglib.la
-
-testgtk_DEPENDENCIES = $(DEPS)
-testinput_DEPENDENCIES = $(DEPS)
-testselection_DEPENDENCIES = $(DEPS)
-simple_DEPENDENCIES = $(DEPS)
-
-.PHONY: files
-
-files:
- @files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
- echo $$p; \
- done
-
-test: testgtk
- ( CWD=`pwd` ; cd $(srcdir) ; $$CWD/testgtk )
-
-test-debug: testgtk
- ( CWD=`pwd` ; cd $(srcdir) ; gdb $$CWD/testgtk )
diff --git a/gtk/Makefile.in b/gtk/Makefile.in
deleted file mode 100644
index 57c6c3cf26..0000000000
--- a/gtk/Makefile.in
+++ /dev/null
@@ -1,690 +0,0 @@
-# Makefile.in generated automatically by automake 1.2c from Makefile.am
-
-# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-
-SHELL = /bin/sh
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-bindir = @bindir@
-sbindir = @sbindir@
-libexecdir = @libexecdir@
-datadir = @datadir@
-sysconfdir = @sysconfdir@
-sharedstatedir = @sharedstatedir@
-localstatedir = @localstatedir@
-libdir = @libdir@
-infodir = @infodir@
-mandir = @mandir@
-includedir = @includedir@
-oldincludedir = /usr/include
-
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-
-top_builddir = ..
-
-ACLOCAL = @ACLOCAL@
-AUTOCONF = @AUTOCONF@
-AUTOMAKE = @AUTOMAKE@
-AUTOHEADER = @AUTOHEADER@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-transform = @program_transform_name@
-
-NORMAL_INSTALL = true
-PRE_INSTALL = true
-POST_INSTALL = true
-NORMAL_UNINSTALL = true
-PRE_UNINSTALL = true
-POST_UNINSTALL = true
-host_alias = @host_alias@
-host_triplet = @host@
-CC = @CC@
-CPP = @CPP@
-LD = @LD@
-LIBTOOL = @LIBTOOL@
-LN_S = @LN_S@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-NM = @NM@
-PACKAGE = @PACKAGE@
-RANLIB = @RANLIB@
-VERSION = @VERSION@
-x_cflags = @x_cflags@
-x_includes = @x_includes@
-x_ldflags = @x_ldflags@
-x_libs = @x_libs@
-xinput_progs = @xinput_progs@
-
-gtkincludedir = $(includedir)/gtk
-
-lib_LTLIBRARIES = libgtk.la
-
-libgtk_la_SOURCES = \
- gtkaccelerator.c \
- gtkadjustment.c \
- gtkaspectframe.c \
- gtkalignment.c \
- gtkarrow.c \
- gtkbin.c \
- gtkbbox.c \
- gtkbox.c \
- gtkbutton.c \
- gtkcheckbutton.c \
- gtkcheckmenuitem.c \
- gtkclist.c \
- gtkcolorsel.c \
- gtkcombo.c \
- gtkcontainer.c \
- gtkcurve.c \
- gtkdata.c \
- gtkdialog.c \
- gtkdrawingarea.c \
- gtkentry.c \
- gtkeventbox.c \
- gtkfilesel.c \
- gtkfixed.c \
- gtkframe.c \
- gtkgamma.c \
- gtkgc.c \
- gtkhandlebox.c \
- gtkhbbox.c \
- gtkhbox.c \
- gtkhpaned.c \
- gtkhruler.c \
- gtkhscale.c \
- gtkhscrollbar.c \
- gtkhseparator.c \
- gtkimage.c \
- gtkinputdialog.c \
- gtkitem.c \
- gtklabel.c \
- gtklist.c \
- gtklistitem.c \
- gtkmain.c \
- gtkmenu.c \
- gtkmenubar.c \
- gtkmenufactory.c \
- gtkmenuitem.c \
- gtkmenushell.c \
- gtkmisc.c \
- gtknotebook.c \
- gtkobject.c \
- gtkoptionmenu.c \
- gtkpaned.c \
- gtkpixmap.c \
- gtkpreview.c \
- gtkprogressbar.c \
- gtkradiobutton.c \
- gtkradiomenuitem.c \
- gtkrange.c \
- gtkrc.c \
- gtkruler.c \
- gtkscale.c \
- gtkscrollbar.c \
- gtkscrolledwindow.c \
- gtkselection.c \
- gtkseparator.c \
- gtksignal.c \
- gtkstyle.c \
- gtkstatusbar.c \
- gtktable.c \
- gtktext.c \
- gtktogglebutton.c \
- gtktoolbar.c \
- gtktooltips.c \
- gtktree.c \
- gtktreeitem.c \
- gtktypeutils.c \
- gtkvbbox.c \
- gtkvbox.c \
- gtkviewport.c \
- gtkvpaned.c \
- gtkvruler.c \
- gtkvscale.c \
- gtkvscrollbar.c \
- gtkvseparator.c \
- gtkwidget.c \
- gtkwindow.c \
- fnmatch.c \
- fnmatch.h
-
-gtkinclude_HEADERS = \
- gtk.h \
- gtkaccelerator.h \
- gtkadjustment.h \
- gtkaspectframe.h \
- gtkalignment.h \
- gtkarrow.h \
- gtkbin.h \
- gtkbbox.h \
- gtkbox.h \
- gtkbutton.h \
- gtkcheckbutton.h \
- gtkcheckmenuitem.h \
- gtkclist.h \
- gtkcolorsel.h \
- gtkcombo.h \
- gtkcontainer.h \
- gtkcurve.h \
- gtkdata.h \
- gtkdialog.h \
- gtkdrawingarea.h \
- gtkentry.h \
- gtkenums.h \
- gtkeventbox.h \
- gtkfilesel.h \
- gtkfixed.h \
- gtkframe.h \
- gtkgamma.h \
- gtkgc.h \
- gtkhandlebox.h \
- gtkhbbox.h \
- gtkhbox.h \
- gtkhpaned.h \
- gtkhruler.h \
- gtkhscale.h \
- gtkhscrollbar.h \
- gtkhseparator.h \
- gtkimage.h \
- gtkinputdialog.h \
- gtkitem.h \
- gtklabel.h \
- gtklist.h \
- gtklistitem.h \
- gtkmain.h \
- gtkmenu.h \
- gtkmenubar.h \
- gtkmenufactory.h \
- gtkmenuitem.h \
- gtkmenushell.h \
- gtkmisc.h \
- gtknotebook.h \
- gtkobject.h \
- gtkoptionmenu.h \
- gtkpaned.h \
- gtkpixmap.h \
- gtkpreview.h \
- gtkprogressbar.h \
- gtkradiobutton.h \
- gtkradiomenuitem.h \
- gtkrange.h \
- gtkrc.h \
- gtkruler.h \
- gtkscale.h \
- gtkscrollbar.h \
- gtkscrolledwindow.h \
- gtkselection.h \
- gtkseparator.h \
- gtksignal.h \
- gtkstyle.h \
- gtkstatusbar.h \
- gtktable.h \
- gtktext.h \
- gtktogglebutton.h \
- gtktoolbar.h \
- gtktooltips.h \
- gtktree.h \
- gtktreeitem.h \
- gtktypeutils.h \
- gtkvbbox.h \
- gtkvbox.h \
- gtkviewport.h \
- gtkvpaned.h \
- gtkvruler.h \
- gtkvscale.h \
- gtkvscrollbar.h \
- gtkvseparator.h \
- gtkwidget.h \
- gtkwindow.h \
- gtktypebuiltins.h
-
-libgtk_la_LDFLAGS = -version-info 1:0:0
-
-EXTRA_DIST = \
- line-arrow.xbm \
- line-wrap.xbm \
- testgtkrc \
- gtk.defs \
- runelisp \
- gentypeinfo.el \
- gtktypebuiltins.c \
- test.xpm \
- marble.xpm \
- 3DRings.xpm \
- FilesQueue.xpm \
- Modeller.xpm \
- tree_plus.xpm \
- tree_minus.xpm \
- tree_plus.xbm \
- tree_minus.xbm
-
-INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/glib @x_cflags@
-
-noinst_PROGRAMS = testgtk testinput testselection simple testtree
-testgtk_LDADD = \
- libgtk.la \
- $(top_builddir)/gdk/libgdk.la \
- @x_ldflags@ \
- @x_libs@ \
- $(top_builddir)/glib/libglib.la \
- -lm
-
-testinput_LDADD = \
- libgtk.la \
- $(top_builddir)/gdk/libgdk.la \
- @x_ldflags@ \
- @x_libs@ \
- $(top_builddir)/glib/libglib.la \
- -lm
-
-testselection_LDADD = \
- libgtk.la \
- $(top_builddir)/gdk/libgdk.la \
- @x_ldflags@ \
- @x_libs@ \
- $(top_builddir)/glib/libglib.la \
- -lm
-
-simple_LDADD = \
- libgtk.la \
- $(top_builddir)/gdk/libgdk.la \
- @x_ldflags@ \
- @x_libs@ \
- $(top_builddir)/glib/libglib.la \
- -lm
-
-testtree_LDADD = \
- libgtk.la \
- $(top_builddir)/gdk/libgdk.la \
- @x_ldflags@ \
- @x_libs@ \
- $(top_builddir)/glib/libglib.la \
- -lm
-
-DEPS = \
- $(top_builddir)/gtk/libgtk.la \
- $(top_builddir)/gdk/libgdk.la \
- $(top_builddir)/glib/libglib.la
-
-testgtk_DEPENDENCIES = $(DEPS)
-testinput_DEPENDENCIES = $(DEPS)
-testselection_DEPENDENCIES = $(DEPS)
-simple_DEPENDENCIES = $(DEPS)
-testtree_DEPENDENCIES = $(DEPS)
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = ../config.h
-CONFIG_CLEAN_FILES =
-LTLIBRARIES = $(lib_LTLIBRARIES)
-
-
-DEFS = @DEFS@ -I. -I$(srcdir) -I..
-CPPFLAGS = @CPPFLAGS@
-LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
-X_CFLAGS = @X_CFLAGS@
-X_LIBS = @X_LIBS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
-libgtk_la_LIBADD =
-libgtk_la_OBJECTS = gtkaccelerator.lo gtkadjustment.lo \
-gtkaspectframe.lo gtkalignment.lo gtkarrow.lo gtkbin.lo gtkbbox.lo \
-gtkbox.lo gtkbutton.lo gtkcheckbutton.lo gtkcheckmenuitem.lo \
-gtkclist.lo gtkcolorsel.lo gtkcombo.lo gtkcontainer.lo gtkcurve.lo \
-gtkdata.lo gtkdialog.lo gtkdrawingarea.lo gtkentry.lo gtkeventbox.lo \
-gtkfilesel.lo gtkfixed.lo gtkframe.lo gtkgamma.lo gtkgc.lo \
-gtkhandlebox.lo gtkhbbox.lo gtkhbox.lo gtkhpaned.lo gtkhruler.lo \
-gtkhscale.lo gtkhscrollbar.lo gtkhseparator.lo gtkimage.lo \
-gtkinputdialog.lo gtkitem.lo gtklabel.lo gtklist.lo gtklistitem.lo \
-gtkmain.lo gtkmenu.lo gtkmenubar.lo gtkmenufactory.lo gtkmenuitem.lo \
-gtkmenushell.lo gtkmisc.lo gtknotebook.lo gtkobject.lo gtkoptionmenu.lo \
-gtkpaned.lo gtkpixmap.lo gtkpreview.lo gtkprogressbar.lo \
-gtkradiobutton.lo gtkradiomenuitem.lo gtkrange.lo gtkrc.lo gtkruler.lo \
-gtkscale.lo gtkscrollbar.lo gtkscrolledwindow.lo gtkselection.lo \
-gtkseparator.lo gtksignal.lo gtkstyle.lo gtkstatusbar.lo gtktable.lo \
-gtktext.lo gtktogglebutton.lo gtktoolbar.lo gtktooltips.lo gtktree.lo \
-gtktreeitem.lo gtktypeutils.lo gtkvbbox.lo gtkvbox.lo gtkviewport.lo \
-gtkvpaned.lo gtkvruler.lo gtkvscale.lo gtkvscrollbar.lo \
-gtkvseparator.lo gtkwidget.lo gtkwindow.lo fnmatch.lo
-PROGRAMS = $(noinst_PROGRAMS)
-
-testgtk_SOURCES = testgtk.c
-testgtk_OBJECTS = testgtk.o
-testgtk_LDFLAGS =
-testinput_SOURCES = testinput.c
-testinput_OBJECTS = testinput.o
-testinput_LDFLAGS =
-testselection_SOURCES = testselection.c
-testselection_OBJECTS = testselection.o
-testselection_LDFLAGS =
-simple_SOURCES = simple.c
-simple_OBJECTS = simple.o
-simple_LDFLAGS =
-testtree_SOURCES = testtree.c
-testtree_OBJECTS = testtree.o
-testtree_LDFLAGS =
-CFLAGS = @CFLAGS@
-COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
-LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
-HEADERS = $(gtkinclude_HEADERS)
-
-DIST_COMMON = Makefile.am Makefile.in
-
-
-DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-
-TAR = tar
-GZIP = --best
-DEP_FILES = .deps/fnmatch.P .deps/gtkaccelerator.P \
-.deps/gtkadjustment.P .deps/gtkalignment.P .deps/gtkarrow.P \
-.deps/gtkaspectframe.P .deps/gtkbbox.P .deps/gtkbin.P .deps/gtkbox.P \
-.deps/gtkbutton.P .deps/gtkcheckbutton.P .deps/gtkcheckmenuitem.P \
-.deps/gtkclist.P .deps/gtkcolorsel.P .deps/gtkcombo.P \
-.deps/gtkcontainer.P .deps/gtkcurve.P .deps/gtkdata.P .deps/gtkdialog.P \
-.deps/gtkdrawingarea.P .deps/gtkentry.P .deps/gtkeventbox.P \
-.deps/gtkfilesel.P .deps/gtkfixed.P .deps/gtkframe.P .deps/gtkgamma.P \
-.deps/gtkgc.P .deps/gtkhandlebox.P .deps/gtkhbbox.P .deps/gtkhbox.P \
-.deps/gtkhpaned.P .deps/gtkhruler.P .deps/gtkhscale.P \
-.deps/gtkhscrollbar.P .deps/gtkhseparator.P .deps/gtkimage.P \
-.deps/gtkinputdialog.P .deps/gtkitem.P .deps/gtklabel.P .deps/gtklist.P \
-.deps/gtklistitem.P .deps/gtkmain.P .deps/gtkmenu.P .deps/gtkmenubar.P \
-.deps/gtkmenufactory.P .deps/gtkmenuitem.P .deps/gtkmenushell.P \
-.deps/gtkmisc.P .deps/gtknotebook.P .deps/gtkobject.P \
-.deps/gtkoptionmenu.P .deps/gtkpaned.P .deps/gtkpixmap.P \
-.deps/gtkpreview.P .deps/gtkprogressbar.P .deps/gtkradiobutton.P \
-.deps/gtkradiomenuitem.P .deps/gtkrange.P .deps/gtkrc.P \
-.deps/gtkruler.P .deps/gtkscale.P .deps/gtkscrollbar.P \
-.deps/gtkscrolledwindow.P .deps/gtkselection.P .deps/gtkseparator.P \
-.deps/gtksignal.P .deps/gtkstatusbar.P .deps/gtkstyle.P \
-.deps/gtktable.P .deps/gtktext.P .deps/gtktogglebutton.P \
-.deps/gtktoolbar.P .deps/gtktooltips.P .deps/gtktree.P \
-.deps/gtktreeitem.P .deps/gtktypeutils.P .deps/gtkvbbox.P \
-.deps/gtkvbox.P .deps/gtkviewport.P .deps/gtkvpaned.P .deps/gtkvruler.P \
-.deps/gtkvscale.P .deps/gtkvscrollbar.P .deps/gtkvseparator.P \
-.deps/gtkwidget.P .deps/gtkwindow.P .deps/simple.P .deps/testgtk.P \
-.deps/testinput.P .deps/testselection.P .deps/testtree.P
-SOURCES = $(libgtk_la_SOURCES) testgtk.c testinput.c testselection.c simple.c testtree.c
-OBJECTS = $(libgtk_la_OBJECTS) testgtk.o testinput.o testselection.o simple.o testtree.o
-
-default: all
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .o
-$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
- cd $(top_srcdir) && $(AUTOMAKE) --gnu gtk/Makefile
-
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
- cd $(top_builddir) \
- && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-
-
-mostlyclean-libLTLIBRARIES:
-
-clean-libLTLIBRARIES:
- -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
-
-distclean-libLTLIBRARIES:
-
-maintainer-clean-libLTLIBRARIES:
-
-install-libLTLIBRARIES: $(lib_LTLIBRARIES)
- @$(NORMAL_INSTALL)
- $(mkinstalldirs) $(libdir)
- @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
- if test -f $$p; then \
- echo "$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(libdir)/$$p"; \
- $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(libdir)/$$p; \
- else :; fi; \
- done
-
-uninstall-libLTLIBRARIES:
- $(NORMAL_UNINSTALL)
- list='$(lib_LTLIBRARIES)'; for p in $$list; do \
- $(LIBTOOL) --mode=uninstall rm -f $(libdir)/$$p; \
- done
-
-.c.o:
- $(COMPILE) -c $<
-
-mostlyclean-compile:
- -rm -f *.o core
-
-clean-compile:
-
-distclean-compile:
- -rm -f *.tab.c
-
-maintainer-clean-compile:
-
-.c.lo:
- $(LIBTOOL) --mode=compile $(COMPILE) -c $<
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs
-
-distclean-libtool:
-
-maintainer-clean-libtool:
-
-libgtk.la: $(libgtk_la_OBJECTS) $(libgtk_la_DEPENDENCIES)
- $(LINK) -rpath $(libdir) $(libgtk_la_LDFLAGS) $(libgtk_la_OBJECTS) $(libgtk_la_LIBADD) $(LIBS)
-
-mostlyclean-noinstPROGRAMS:
-
-clean-noinstPROGRAMS:
- -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
-
-distclean-noinstPROGRAMS:
-
-maintainer-clean-noinstPROGRAMS:
-
-testgtk: $(testgtk_OBJECTS) $(testgtk_DEPENDENCIES)
- @rm -f testgtk
- $(LINK) $(testgtk_LDFLAGS) $(testgtk_OBJECTS) $(testgtk_LDADD) $(LIBS)
-
-testinput: $(testinput_OBJECTS) $(testinput_DEPENDENCIES)
- @rm -f testinput
- $(LINK) $(testinput_LDFLAGS) $(testinput_OBJECTS) $(testinput_LDADD) $(LIBS)
-
-testselection: $(testselection_OBJECTS) $(testselection_DEPENDENCIES)
- @rm -f testselection
- $(LINK) $(testselection_LDFLAGS) $(testselection_OBJECTS) $(testselection_LDADD) $(LIBS)
-
-simple: $(simple_OBJECTS) $(simple_DEPENDENCIES)
- @rm -f simple
- $(LINK) $(simple_LDFLAGS) $(simple_OBJECTS) $(simple_LDADD) $(LIBS)
-
-testtree: $(testtree_OBJECTS) $(testtree_DEPENDENCIES)
- @rm -f testtree
- $(LINK) $(testtree_LDFLAGS) $(testtree_OBJECTS) $(testtree_LDADD) $(LIBS)
-
-install-gtkincludeHEADERS: $(gtkinclude_HEADERS)
- @$(NORMAL_INSTALL)
- $(mkinstalldirs) $(gtkincludedir)
- @list='$(gtkinclude_HEADERS)'; for p in $$list; do \
- echo " $(INSTALL_DATA) $(srcdir)/$$p $(gtkincludedir)/$$p"; \
- $(INSTALL_DATA) $(srcdir)/$$p $(gtkincludedir)/$$p; \
- done
-
-uninstall-gtkincludeHEADERS:
- $(NORMAL_UNINSTALL)
- list='$(gtkinclude_HEADERS)'; for p in $$list; do \
- rm -f $(gtkincludedir)/$$p; \
- done
-
-tags: TAGS
-
-ID: $(HEADERS) $(SOURCES)
- here=`pwd` && cd $(srcdir) && mkid -f$$here/ID $(SOURCES) $(HEADERS)
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES)
- tags=; \
- here=`pwd`; \
- test -z "$(ETAGS_ARGS)$(SOURCES)$(HEADERS)$$tags" \
- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $(SOURCES) $(HEADERS) -o $$here/TAGS)
-
-mostlyclean-tags:
-
-clean-tags:
-
-distclean-tags:
- -rm -f TAGS ID
-
-maintainer-clean-tags:
-
-distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
-
-subdir = gtk
-
-distdir: $(DISTFILES)
- here=`cd $(top_builddir) && pwd`; \
- top_distdir=`cd $(top_distdir) && pwd`; \
- distdir=`cd $(distdir) && pwd`; \
- cd $(top_srcdir) \
- && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu gtk/Makefile
- @for file in $(DISTFILES); do \
- d=$(srcdir); \
- test -f $(distdir)/$$file \
- || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
- || cp -p $$d/$$file $(distdir)/$$file; \
- done
-
-MKDEP = $(CC) -M $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
-
-DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
--include .deps/.P
-.deps/.P: $(BUILT_SOURCES)
- echo > $@
-
--include $(DEP_FILES)
-
-mostlyclean-depend:
-
-clean-depend:
-
-distclean-depend:
-
-maintainer-clean-depend:
- -rm -rf .deps
-
-.deps/%.P: %.c
- @echo "Computing dependencies for $<..."
- @o='o'; \
- test -n "$o" && o='$$o'; \
- $(MKDEP) $< >$@.tmp \
- && sed "s,^\(.*\)\.o:,\1.$$o \1.l$$o $@:," < $@.tmp > $@ \
- && rm -f $@.tmp
-info:
-dvi:
-check: all
- $(MAKE)
-installcheck:
-install-exec: install-libLTLIBRARIES
- @$(NORMAL_INSTALL)
-
-install-data: install-gtkincludeHEADERS
- @$(NORMAL_INSTALL)
-
-install: install-exec install-data all
- @:
-
-uninstall: uninstall-libLTLIBRARIES uninstall-gtkincludeHEADERS
-
-all: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
-
-install-strip:
- $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
-installdirs:
- $(mkinstalldirs) $(libdir) $(gtkincludedir)
-
-
-mostlyclean-generic:
- -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
-
-clean-generic:
- -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
-
-distclean-generic:
- -rm -f Makefile $(DISTCLEANFILES)
- -rm -f config.cache config.log stamp-h stamp-h[0-9]*
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
- -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
- -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-mostlyclean: mostlyclean-libLTLIBRARIES mostlyclean-compile \
- mostlyclean-libtool mostlyclean-noinstPROGRAMS \
- mostlyclean-tags mostlyclean-depend mostlyclean-generic
-
-clean: clean-libLTLIBRARIES clean-compile clean-libtool \
- clean-noinstPROGRAMS clean-tags clean-depend \
- clean-generic mostlyclean
-
-distclean: distclean-libLTLIBRARIES distclean-compile distclean-libtool \
- distclean-noinstPROGRAMS distclean-tags \
- distclean-depend distclean-generic clean
- -rm -f config.status
- -rm -f libtool
-
-maintainer-clean: maintainer-clean-libLTLIBRARIES \
- maintainer-clean-compile maintainer-clean-libtool \
- maintainer-clean-noinstPROGRAMS maintainer-clean-tags \
- maintainer-clean-depend maintainer-clean-generic \
- distclean
- @echo "This command is intended for maintainers to use;"
- @echo "it deletes files that may require special tools to rebuild."
-
-.PHONY: default mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \
-clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \
-uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \
-distclean-compile clean-compile maintainer-clean-compile \
-mostlyclean-libtool distclean-libtool clean-libtool \
-maintainer-clean-libtool mostlyclean-noinstPROGRAMS \
-distclean-noinstPROGRAMS clean-noinstPROGRAMS \
-maintainer-clean-noinstPROGRAMS uninstall-gtkincludeHEADERS \
-install-gtkincludeHEADERS tags mostlyclean-tags distclean-tags \
-clean-tags maintainer-clean-tags distdir mostlyclean-depend \
-distclean-depend clean-depend maintainer-clean-depend info dvi \
-installcheck install-exec install-data install uninstall all \
-installdirs mostlyclean-generic distclean-generic clean-generic \
-maintainer-clean-generic clean mostlyclean distclean maintainer-clean
-
-
-../gtk/gtktypebuiltins.h: gtk.defs gentypeinfo.el
- $(SHELL) $(srcdir)/runelisp $(srcdir)/gentypeinfo.el idmac $< $@
-
-gtktypebuiltins.c: gtk.defs gentypeinfo.el
- $(SHELL) $(srcdir)/runelisp $(srcdir)/gentypeinfo.el id $< $@
-
-.PHONY: files
-
-files:
- @files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
- echo $$p; \
- done
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/gtk/Modeller.xpm b/gtk/Modeller.xpm
deleted file mode 100644
index 62e27f9853..0000000000
--- a/gtk/Modeller.xpm
+++ /dev/null
@@ -1,117 +0,0 @@
-/* XPM */
-static char * InterfaceModeller_app_2_Tile_xpm[] = {
-"48 48 66 1",
-" c None",
-". c #86174D344103",
-"X c #69A651445144",
-"o c #8617410330C2",
-"O c #69A6410338E3",
-"+ c #30C218611861",
-"@ c #AEBA6DB66185",
-"# c #71C638E328A2",
-"$ c #69A634D328A2",
-"% c #30C228A228A2",
-"& c #79E73CF330C2",
-"* c #BEFB9E799E79",
-"= c #8E3869A66185",
-"- c #514424921861",
-"; c #A699A289B6DA",
-": c #A6999E79A699",
-"> c #71C65D756185",
-", c #9E799A69A699",
-"< c #8E3882078E38",
-"1 c #861779E78617",
-"2 c #A6999A69AEBA",
-"3 c #8E388A289658",
-"4 c #71C675D679E7",
-"5 c #96588A289E79",
-"6 c #30C230C238E3",
-"7 c #C71BC71BC71B",
-"8 c #9E79A289AEBA",
-"9 c #AEBAAAAABEFB",
-"0 c #96589248A699",
-"q c #A699AAAAB6DA",
-"w c #AEBAAAAAB6DA",
-"e c #D75CD34CD75C",
-"r c #EFBEE79DEFBE",
-"t c #BEFBB6DABEFB",
-"y c #B6DABAEAC71B",
-"u c #AEBAAEBAB6DA",
-"i c #E79DDB6CDF7D",
-"p c #96588E389658",
-"a c #596559656185",
-"s c #AEBA8E388E38",
-"d c #CF3CCB2BCF3C",
-"f c #9E799A699E79",
-"g c #86177DF78E38",
-"h c #69A6659571C6",
-"j c #AEBAAEBABEFB",
-"k c #96589E799E79",
-"l c #B6DAA699A699",
-"z c #E79DC71BC71B",
-"x c #B6DAB6DAB6DA",
-"c c #861786179658",
-"v c #B6DAB2CABEFB",
-"b c #BEFBAAAAAEBA",
-"n c #C71BBEFBC71B",
-"m c #514441034103",
-"M c #41033CF34103",
-"N c #492428A228A2",
-"B c #AEBAA289B6DA",
-"V c #618530C22081",
-"C c #69A630C228A2",
-"Z c #69A630C22081",
-"A c #596528A22081",
-"S c #492428A22081",
-"D c #618528A22081",
-"F c #596520811861",
-"G c #69A628A22081",
-"H c #FFFF14514103",
-" .X ",
-" .oO+ ",
-" @.o#++ ",
-" @.o$%+ ",
-" @.&#++ ",
-" @.o#++ ",
-" @.o$++ ",
-" @.&#++ ",
-" .O#++ ",
-" *=-$++ ",
-" ;:>+++ ",
-" ;,<1% ",
-" 2,34 ",
-" 2;,51 ",
-" 2,,,,6 ",
-" 7777 28888,6 ",
-" 77777777 2829,,,06 ",
-" 9qwwe7rrrrr77rr 828,9tyt,6 ",
-" uuwriirrieiiieii77pa< 82,8,,,8,06 ",
-" s=1ttiieeeeded77eufgh>j,8,8,k,0,6 ",
-" =@lzieeeeee77eeex:fpcg4>9,,,,qjv6 ",
-" =O=blt7eeee7deenw:ffp<gha:t979;06 ",
-" =OO@=@zieeee7ex:::fffff0,v72444h6 ",
-" =OOo&Osst7iee7wkf:f:ff;t721444ham ",
-" =#&&&&OO@di7eu:ff:fferiv114444hmMX ",
-" =O&&&..o.sdp33fff:errrii7cc1hhh6mmNX= ",
-" =O&&&@.o.@sberrrrrriiuxuxnB;44aMmVCO#OX ",
-" =O&&o@..o.zrrrie777nnxtuxx:x;n:>mV##&&O$mX ",
-" =O&&o....zrrieieuxunx7txx:nnfwpMmVZ#$ZZZVVN ",
-" =O&oooo.*rrde77ewxnxxtnw:f4M%M%+NA#$Z$ZZVmN> ",
-" =Oo&ooo@iree7inxn7nnuuff4h%M>m%S-AZ$CCZDZmSX ",
-" =O&o.o.@rrn7eulun7xxuwp4mm6ahM%--AZCCZDDDANX ",
-" =Ooooo.*rixenuwwn7nxupph%M>>h6mAADVVZVVDDANX ",
-" =O&o.o.zrexwwnwuxxnughX%mahhmMN-AZCCVVDDAAN> ",
-" *XOoo.*iin7n777xxxtphaM+ama>MSNFVCZZVVDAAAS> ",
-" 1O..izewxux7nuuux4%++%hha>%N-DDCZZVDAAAASX ",
-" 1.=ituu:uButnxxuX%>hh>M%++NADZZZVDADAA--X ",
-" :e7f::lnn7*ppnx6ahm6++mNN-ADCZVDDAAAA-SX ",
-" 7nupp:wxxg%MMau6%++NmmmADADVVVVVDAA---NX ",
-" 7uBgh1wwxg6h>m%:MmmVNAVDZVZCVZZDAAAAF-S+X ",
-" nfgaM%pnwhX6%mXb6$DVVZC$C#C$ZZDVAAA---+NX ",
-" 27a%MaM47:mN.OoolmODGZ####$$ZZVDDA-----SSX ",
-" 2gmg<m6p7wmmOo...O$GZ####$$CZVVDAAA----++X ",
-" qBcaM <gxgmXmo.@.o&$$##$$$CZZZDADA-A-++-NX ",
-" M6> paMa HX.@@@oZ$###$$CZVDDAAAA---SS+X ",
-" 43 p=&@@&&$##$CCCVVVAAA--+S+S+%X ",
-" k =o@.##$VVmmmNNNSSSSSS%XXXX ",
-" s>OSSNmN>>aaa177777 "};
diff --git a/gtk/circles.xbm b/gtk/circles.xbm
deleted file mode 100644
index d82f655848..0000000000
--- a/gtk/circles.xbm
+++ /dev/null
@@ -1,46 +0,0 @@
-#define circles_width 64
-#define circles_height 64
-static unsigned char circles_bits[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
- 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xfc, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
- 0xff, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00,
- 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff,
- 0xff, 0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00,
- 0x00, 0xfe, 0xff, 0x01, 0xf0, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x3f, 0x00,
- 0x80, 0xff, 0x1f, 0x00, 0x80, 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x3f, 0x00,
- 0x80, 0xff, 0x03, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0xc0, 0xff, 0x01, 0x00,
- 0x00, 0xf0, 0x7f, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x00,
- 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x80, 0xff, 0x01, 0xf0, 0x1f, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0x01, 0xf8, 0x1f, 0x00, 0x20, 0x00, 0x00, 0xff, 0x03,
- 0xf8, 0x0f, 0x00, 0xff, 0x07, 0x00, 0xfe, 0x03, 0xfc, 0x07, 0xc0, 0xff,
- 0x1f, 0x00, 0xfc, 0x07, 0xfc, 0x07, 0xf0, 0xff, 0x7f, 0x00, 0xfc, 0x07,
- 0xfc, 0x03, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0x07, 0xfe, 0x03, 0xfc, 0xff,
- 0xff, 0x01, 0xf8, 0x0f, 0xfe, 0x01, 0xfe, 0x8f, 0xff, 0x03, 0xf0, 0x0f,
- 0xfe, 0x01, 0xfe, 0x01, 0xfc, 0x03, 0xf0, 0x0f, 0xff, 0x01, 0xff, 0x00,
- 0xf8, 0x07, 0xf0, 0x1f, 0xff, 0x00, 0x7f, 0x00, 0xf0, 0x07, 0xe0, 0x1f,
- 0xff, 0x80, 0x3f, 0x00, 0xe0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00,
- 0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f,
- 0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x0f, 0x00,
- 0x80, 0x0f, 0xe0, 0x1f, 0xff, 0xc0, 0x0f, 0x00, 0x80, 0x1f, 0xe0, 0x1f,
- 0xff, 0x80, 0x0f, 0x00, 0x80, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00,
- 0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f,
- 0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x81, 0x3f, 0x00,
- 0xe0, 0x0f, 0xf0, 0x1f, 0xfe, 0x01, 0x7f, 0x00, 0xf0, 0x07, 0xf0, 0x0f,
- 0xfe, 0x01, 0xff, 0x00, 0xf8, 0x07, 0xf0, 0x0f, 0xfe, 0x03, 0xfe, 0x01,
- 0xfc, 0x03, 0xf8, 0x0f, 0xfc, 0x03, 0xfe, 0x8f, 0xff, 0x03, 0xf8, 0x07,
- 0xfc, 0x07, 0xfc, 0xff, 0xff, 0x01, 0xfc, 0x07, 0xfc, 0x07, 0xf8, 0xff,
- 0xff, 0x00, 0xfc, 0x07, 0xf8, 0x0f, 0xf0, 0xff, 0x7f, 0x00, 0xfe, 0x03,
- 0xf8, 0x1f, 0xc0, 0xff, 0x1f, 0x00, 0xff, 0x03, 0xf0, 0x1f, 0x00, 0xff,
- 0x07, 0x00, 0xff, 0x01, 0xf0, 0x3f, 0x00, 0x20, 0x00, 0x80, 0xff, 0x01,
- 0xe0, 0x7f, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x00, 0xc0, 0xff, 0x01, 0x00,
- 0x00, 0xf0, 0x7f, 0x00, 0x80, 0xff, 0x03, 0x00, 0x00, 0xf8, 0x3f, 0x00,
- 0x80, 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0xff, 0x3f, 0x00,
- 0x80, 0xff, 0x1f, 0x00, 0x00, 0xfe, 0xff, 0x01, 0xf0, 0xff, 0x0f, 0x00,
- 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xf0, 0xff, 0xff,
- 0xff, 0xff, 0x01, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
- 0x00, 0xc0, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
- 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x07, 0x00, 0x00,
- 0x00, 0x00, 0xe0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
- 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/gtk/fnmatch.c b/gtk/fnmatch.c
deleted file mode 100644
index b33b0bc431..0000000000
--- a/gtk/fnmatch.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with this library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
-
-#ifdef HAVE_CONFIG_H
-#include "../config.h"
-#endif
-
-#include <errno.h>
-
-/* Added for GTK. We need to make sure that all constants are defined
- * to properly compile this file */
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-#include "fnmatch.h"
-
-#include <ctype.h>
-
-
-/* Comment out all this code if we are using the GNU C Library, and are not
- actually compiling the library itself. This code is part of the GNU C
- Library, but also included in many other GNU distributions. Compiling
- and linking in this code is a waste when using the GNU C library
- (especially if it is a shared library). Rather than having every GNU
- program understand `configure --with-gnu-libc' and omit the object files,
- it is simpler to just do this in the source for each such file. */
-
-#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
-
-
-#if !defined(__GNU_LIBRARY__) && !defined(STDC_HEADERS)
-extern int errno;
-#endif
-
-/* Match STRING against the filename pattern PATTERN, returning zero if
- it matches, nonzero if not. */
-int
-fnmatch (pattern, string, flags)
- const char *pattern;
- const char *string;
- int flags;
-{
- register const char *p = pattern, *n = string;
- register char c;
-
-/* Note that this evalutes C many times. */
-#define FOLD(c) ((flags & FNM_CASEFOLD) && isupper (c) ? tolower (c) : (c))
-
- while ((c = *p++) != '\0')
- {
- c = FOLD (c);
-
- switch (c)
- {
- case '?':
- if (*n == '\0')
- return FNM_NOMATCH;
- else if ((flags & FNM_FILE_NAME) && *n == '/')
- return FNM_NOMATCH;
- else if ((flags & FNM_PERIOD) && *n == '.' &&
- (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
- return FNM_NOMATCH;
- break;
-
- case '\\':
- if (!(flags & FNM_NOESCAPE))
- {
- c = *p++;
- c = FOLD (c);
- }
- if (FOLD (*n) != c)
- return FNM_NOMATCH;
- break;
-
- case '*':
- if ((flags & FNM_PERIOD) && *n == '.' &&
- (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
- return FNM_NOMATCH;
-
- for (c = *p++; c == '?' || c == '*'; c = *p++, ++n)
- if (((flags & FNM_FILE_NAME) && *n == '/') ||
- (c == '?' && *n == '\0'))
- return FNM_NOMATCH;
-
- if (c == '\0')
- return 0;
-
- {
- char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c;
- c1 = FOLD (c1);
- for (--p; *n != '\0'; ++n)
- if ((c == '[' || FOLD (*n) == c1) &&
- fnmatch (p, n, flags & ~FNM_PERIOD) == 0)
- return 0;
- return FNM_NOMATCH;
- }
-
- case '[':
- {
- /* Nonzero if the sense of the character class is inverted. */
- register int not;
-
- if (*n == '\0')
- return FNM_NOMATCH;
-
- if ((flags & FNM_PERIOD) && *n == '.' &&
- (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
- return FNM_NOMATCH;
-
- not = (*p == '!' || *p == '^');
- if (not)
- ++p;
-
- c = *p++;
- for (;;)
- {
- register char cstart = c, cend = c;
-
- if (!(flags & FNM_NOESCAPE) && c == '\\')
- cstart = cend = *p++;
-
- cstart = cend = FOLD (cstart);
-
- if (c == '\0')
- /* [ (unterminated) loses. */
- return FNM_NOMATCH;
-
- c = *p++;
- c = FOLD (c);
-
- if ((flags & FNM_FILE_NAME) && c == '/')
- /* [/] can never match. */
- return FNM_NOMATCH;
-
- if (c == '-' && *p != ']')
- {
- cend = *p++;
- if (!(flags & FNM_NOESCAPE) && cend == '\\')
- cend = *p++;
- if (cend == '\0')
- return FNM_NOMATCH;
- cend = FOLD (cend);
-
- c = *p++;
- }
-
- if (FOLD (*n) >= cstart && FOLD (*n) <= cend)
- goto matched;
-
- if (c == ']')
- break;
- }
- if (!not)
- return FNM_NOMATCH;
- break;
-
- matched:;
- /* Skip the rest of the [...] that already matched. */
- while (c != ']')
- {
- if (c == '\0')
- /* [... (unterminated) loses. */
- return FNM_NOMATCH;
-
- c = *p++;
- if (!(flags & FNM_NOESCAPE) && c == '\\')
- /* XXX 1003.2d11 is unclear if this is right. */
- ++p;
- }
- if (not)
- return FNM_NOMATCH;
- }
- break;
-
- default:
- if (c != FOLD (*n))
- return FNM_NOMATCH;
- }
-
- ++n;
- }
-
- if (*n == '\0')
- return 0;
-
- if ((flags & FNM_LEADING_DIR) && *n == '/')
- /* The FNM_LEADING_DIR flag says that "foo*" matches "foobar/frobozz". */
- return 0;
-
- return FNM_NOMATCH;
-}
-
-#endif /* _LIBC or not __GNU_LIBRARY__. */
diff --git a/gtk/fnmatch.h b/gtk/fnmatch.h
deleted file mode 100644
index d9d73b3d86..0000000000
--- a/gtk/fnmatch.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with this library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
-
-#ifndef _FNMATCH_H
-
-#define _FNMATCH_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
-#undef __P
-#define __P(protos) protos
-#else /* Not C++ or ANSI C. */
-#undef __P
-#define __P(protos) ()
-/* We can get away without defining `const' here only because in this file
- it is used only inside the prototype for `fnmatch', which is elided in
- non-ANSI C where `const' is problematical. */
-#endif /* C++ or ANSI C. */
-
-
-/* We #undef these before defining them because some losing systems
- (HP-UX A.08.07 for example) define these in <unistd.h>. */
-#undef FNM_PATHNAME
-#undef FNM_NOESCAPE
-#undef FNM_PERIOD
-
-/* Bits set in the FLAGS argument to `fnmatch'. */
-#define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */
-#define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */
-#define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */
-
-#if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_GNU_SOURCE)
-#define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */
-#define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */
-#define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */
-#endif
-
-/* Value returned by `fnmatch' if STRING does not match PATTERN. */
-#define FNM_NOMATCH 1
-
-/* Match STRING against the filename pattern PATTERN,
- returning zero if it matches, FNM_NOMATCH if not. */
-extern int fnmatch __P ((const char *__pattern, const char *__string,
- int __flags));
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* fnmatch.h */
diff --git a/gtk/gentypeinfo.el b/gtk/gentypeinfo.el
deleted file mode 100644
index 2de6a92d2b..0000000000
--- a/gtk/gentypeinfo.el
+++ /dev/null
@@ -1,137 +0,0 @@
-(require 'cl)
-
-;;; file access
-
-(defun read-file (name)
- (let ((buf (generate-new-buffer "infile"))
- (res nil))
- (save-excursion
- (set-buffer buf)
- (insert-file-contents name)
- (condition-case nil
- (while t
- (setq res (cons (read buf) res)))
- (end-of-file (reverse res))))))
-
-(defun setup-outfile ()
- (setq standard-output (generate-new-buffer "outfile")))
-
-(defun write-outfile (name)
- (save-excursion
- (set-buffer standard-output)
- (write-region (point-min) (point-max) name)))
-
-;;; string stunts
-
-(defun char-upper-case-p (ch)
- (eql (upcase ch) ch))
-
-(defun char-lower-case-p (ch)
- (eql (downcase ch) ch))
-
-(defun canonicalize (str)
- (if (symbolp str)
- (setq str (symbol-name str)))
- (let ((res nil)
- (start 0)
- (pos 0)
- (end (length str))
- (prevlower nil))
- (while (< pos end)
- (let ((ch (elt str pos)))
- (cond ((memq ch '(?- ?_))
- (setq res (cons (substring str start pos) res)
- prevlower nil
- pos (1+ pos)
- start pos))
- ((and (char-upper-case-p ch)
- prevlower)
- (setq res (cons (substring str start pos) res)
- start pos
- pos (1+ pos)
- prevlower nil))
- (t
- (setq pos (1+ pos)
- prevlower (char-lower-case-p ch))))))
- (reverse (mapcar 'downcase (cons (substring str start end) res)))))
-
-(defun syllables-to-string (syls del)
- (let ((res ""))
- (while syls
- (setq res (format "%s%s%s" res (car syls)
- (if (cdr syls) del ""))
- syls (cdr syls)))
- res))
-
-(defun macroname (canon)
- (syllables-to-string (mapcar 'upcase canon) "_"))
-
-(defun funcname (canon)
- (syllables-to-string canon "_"))
-
-(defun typename (canon)
- (syllables-to-string (mapcar 'capitalize canon) ""))
-
-(defun scmname (canon)
- (syllables-to-string canon "-"))
-
-(defun short-name (canon)
- (if (equal (car canon) "gtk") (cdr canon) canon))
-
-;;; Code generation
-
-(defun printf (&rest args)
- (princ (apply 'format args)))
-
-(defun interestingp (form)
- (and (listp form)
- (memq (car form) '(define-enum define-flags define-boxed))))
-
-(defun map-interesting (func defs)
- (mapcar #'(lambda (form)
- (if (interestingp form)
- (funcall func form)))
- defs))
-
-(defun emit-idmacs (defs)
- (let ((i 0))
- (map-interesting
- #'(lambda (form)
- (let ((name (canonicalize (cadr form))))
- (printf "#define GTK_TYPE_%s (gtk_type_builtins[%d])\n"
- (macroname (short-name name)) i))
- (setq i (1+ i)))
- defs)
- (printf "#define GTK_TYPE_NUM_BUILTINS %d\n" i)))
-
-(defun emit-ids (defs)
- (map-interesting
- #'(lambda (form)
- (printf " { %S, %s },\n"
- (symbol-name (cadr form))
- (case (car form)
- ((define-enum) "GTK_TYPE_ENUM")
- ((define-flags) "GTK_TYPE_FLAGS")
- ((define-boxed) "GTK_TYPE_BOXED"))))
- defs))
-
-
-
-(if (< (length command-line-args-left) 3)
- (error "args: op def-file output-file"))
-
-(setq op (intern (car command-line-args-left)))
-(setq defs (read-file (cadr command-line-args-left)))
-(setq outfile (caddr command-line-args-left))
-(setq command-line-args-left nil)
-
-(setup-outfile)
-(printf "/* generated by gentypeinfo from \"gtk.defs\" */\n\n")
-(case op
- ((idmac)
- (emit-idmacs defs))
- ((id)
- (emit-ids defs))
- (else
- (error "supported ops are: idmac id")))
-(write-outfile outfile)
diff --git a/gtk/gtk.defs b/gtk/gtk.defs
deleted file mode 100644
index 3b3fd5aea8..0000000000
--- a/gtk/gtk.defs
+++ /dev/null
@@ -1,1862 +0,0 @@
-;; -*- scheme -*-
-
-;;; Gtk enums
-
-(define-enum GtkWindowType
- (toplevel GTK_WINDOW_TOPLEVEL)
- (dialog GTK_WINDOW_DIALOG)
- (popup GTK_WINDOW_POPUP))
-
-(define-enum GtkStateType
- (normal GTK_STATE_NORMAL)
- (active GTK_STATE_ACTIVE)
- (prelight GTK_STATE_PRELIGHT)
- (selected GTK_STATE_SELECTED)
- (insensitive GTK_STATE_INSENSITIVE))
-
-(define-enum GtkDirectionType
- (tab-forward GTK_DIR_TAB_FORWARD)
- (tab-backward GTK_DIR_TAB_BACKWARD)
- (up GTK_DIR_UP)
- (down GTK_DIR_DOWN)
- (left GTK_DIR_LEFT)
- (right GTK_DIR_RIGHT))
-
-(define-enum GtkShadowType
- (none GTK_SHADOW_NONE)
- (in GTK_SHADOW_IN)
- (out GTK_SHADOW_OUT)
- (etched-in GTK_SHADOW_ETCHED_IN)
- (etched-out GTK_SHADOW_ETCHED_OUT))
-
-(define-enum GtkArrowType
- (up GTK_ARROW_UP)
- (down GTK_ARROW_DOWN)
- (left GTK_ARROW_LEFT)
- (right GTK_ARROW_RIGHT))
-
-(define-enum GtkPackType
- (start GTK_PACK_START)
- (end GTK_PACK_END))
-
-(define-enum GtkPolicyType
- (always GTK_POLICY_ALWAYS)
- (automatic GTK_POLICY_AUTOMATIC))
-
-(define-enum GtkUpdateType
- (continuous GTK_UPDATE_CONTINUOUS)
- (discontinuous GTK_UPDATE_DISCONTINUOUS)
- (delayed GTK_UPDATE_DELAYED))
-
-(define-flags GtkAttachOptions
- (expand GTK_EXPAND)
- (shrink GTK_SHRINK)
- (fill GTK_FILL))
-
-(define-flags GtkSignalRunType
- (first GTK_RUN_FIRST)
- (last GTK_RUN_LAST)
- (both GTK_RUN_BOTH)
- (mask GTK_RUN_MASK)
- (no-recurse GTK_RUN_NO_RECURSE))
-
-(define-enum GtkWindowPosition
- (none GTK_WIN_POS_NONE)
- (center GTK_WIN_POS_CENTER)
- (mouse GTK_WIN_POS_MOUSE))
-
-(define-enum GtkSubmenuDirection
- (left GTK_DIRECTION_LEFT)
- (right GTK_DIRECTION_RIGHT))
-
-(define-enum GtkSubmenuPlacement
- (top-bottom GTK_TOP_BOTTOM)
- (left-right GTK_LEFT_RIGHT))
-
-(define-enum GtkMenuFactoryType
- (menu GTK_MENU_FACTORY_MENU)
- (menu-bar GTK_MENU_FACTORY_MENU_BAR)
- (option-menu GTK_MENU_FACTORY_OPTION_MENU))
-
-(define-enum GtkMetricType
- (pixels GTK_PIXELS)
- (inches GTK_INCHES)
- (centimeters GTK_CENTIMETERS))
-
-(define-enum GtkScrollType
- (none GTK_SCROLL_NONE)
- (step-backward GTK_SCROLL_STEP_BACKWARD)
- (step-forward GTK_SCROLL_STEP_FORWARD)
- (page-backward GTK_SCROLL_PAGE_BACKWARD)
- (page-forward GTK_SCROLL_PAGE_FORWARD))
-
-(define-enum GtkTroughType
- (none GTK_TROUGH_NONE)
- (start GTK_TROUGH_START)
- (end GTK_TROUGH_END))
-
-(define-enum GtkPositionType
- (left GTK_POS_LEFT)
- (right GTK_POS_RIGHT)
- (top GTK_POS_TOP)
- (bottom GTK_POS_BOTTOM))
-
-(define-enum GtkPreviewType
- (color GTK_PREVIEW_COLOR)
- (grayscale GTK_PREVIEW_GRAYSCALE))
-
-(define-flags GtkWidgetFlags
- (visible GTK_VISIBLE)
- (mapped GTK_MAPPED)
- (unmapped GTK_UNMAPPED)
- (realized GTK_REALIZED)
- (sensitive GTK_SENSITIVE)
- (parent-sensitive GTK_PARENT_SENSITIVE)
- (no-window GTK_NO_WINDOW)
- (has-focus GTK_HAS_FOCUS)
- (can-focus GTK_CAN_FOCUS)
- (has-default GTK_HAS_DEFAULT)
- (can-default GTK_CAN_DEFAULT)
- (propagate-state GTK_PROPAGATE_STATE)
- (anchored GTK_ANCHORED)
- (basic GTK_BASIC)
- (user-style GTK_USER_STYLE))
-
-(define-enum GtkSelectionMode
- (single GTK_SELECTION_SINGLE)
- (browse GTK_SELECTION_BROWSE)
- (multiple GTK_SELECTION_MULTIPLE)
- (extended GTK_SELECTION_EXTENDED))
-
-(define-enum GtkCurveType
- (linear GTK_CURVE_TYPE_LINEAR)
- (spline GTK_CURVE_TYPE_SPLINE)
- (free GTK_CURVE_TYPE_FREE))
-
-(define-enum GtkFundamentalType
- (invalid GTK_TYPE_INVALID)
- (none GTK_TYPE_NONE)
- (char GTK_TYPE_CHAR)
- (bool GTK_TYPE_BOOL)
- (int GTK_TYPE_INT)
- (uint GTK_TYPE_UINT)
- (long GTK_TYPE_LONG)
- (ulong GTK_TYPE_ULONG)
- (float GTK_TYPE_FLOAT)
- (string GTK_TYPE_STRING)
- (enum GTK_TYPE_ENUM)
- (flags GTK_TYPE_FLAGS)
- (boxed GTK_TYPE_BOXED)
- (foreign GTK_TYPE_FOREIGN)
- (callback GTK_TYPE_CALLBACK)
- (args GTK_TYPE_ARGS)
- (pointer GTK_TYPE_POINTER)
- (signal GTK_TYPE_SIGNAL)
- (c-callback GTK_TYPE_C_CALLBACK)
- (object GTK_TYPE_OBJECT))
-
-(define-enum GtkJustification
- (left GTK_JUSTIFY_LEFT)
- (right GTK_JUSTIFY_RIGHT)
- (center GTK_JUSTIFY_CENTER)
- (fill GTK_JUSTIFY_FILL))
-
-;;; Gdk enums
-
-(define-enum GdkWindowType
- (root GDK_WINDOW_ROOT)
- (toplevel GDK_WINDOW_TOPLEVEL)
- (child GDK_WINDOW_CHILD)
- (dialog GDK_WINDOW_DIALOG)
- (temp GDK_WINDOW_TEMP)
- (pixmap GDK_WINDOW_PIXMAP))
-
-(define-enum GdkWindowClass
- (input-output GDK_INPUT_OUTPUT)
- (input-only GDK_INPUT_ONLY))
-
-(define-enum GdkImageType
- (normal GDK_IMAGE_NORMAL)
- (shared GDK_IMAGE_SHARED)
- (fastest GDK_IMAGE_FASTEST))
-
-(define-enum GdkVisualType
- (static-gray GDK_VISUAL_STATIC_GRAY)
- (grayscale GDK_VISUAL_GRAYSCALE)
- (static-color GDK_VISUAL_STATIC_COLOR)
- (pseudo-color GDK_VISUAL_PSEUDO_COLOR)
- (true-color GDK_VISUAL_TRUE_COLOR)
- (direct-color GDK_VISUAL_DIRECT_COLOR))
-
-(define-flags GdkWindowAttributesType
- (title GDK_WA_TITLE)
- (x GDK_WA_X)
- (y GDK_WA_Y)
- (cursor GDK_WA_CURSOR)
- (colormap GDK_WA_COLORMAP)
- (visual GDK_WA_VISUAL))
-
-(define-flags GdkWindowHints
- (pos GDK_HINT_POS)
- (min-size GDK_HINT_MIN_SIZE)
- (max-size GDK_HINT_MAX_SIZE))
-
-(define-enum GdkFunction
- (copy GDK_COPY)
- (invert GDK_INVERT)
- (xor GDK_XOR))
-
-(define-enum GdkFill
- (solid GDK_SOLID)
- (tiled GDK_TILED)
- (stippled GDK_STIPPLED)
- (opaque-stippled GDK_OPAQUE_STIPPLED))
-
-(define-enum GdkLineStyle
- (solid GDK_LINE_SOLID)
- (on-off-dash GDK_LINE_ON_OFF_DASH)
- (double-dash GDK_LINE_DOUBLE_DASH))
-
-(define-enum GdkCapStyle
- (not-last GDK_CAP_NOT_LAST)
- (butt GDK_CAP_BUTT)
- (round GDK_CAP_ROUND)
- (projecting GDK_CAP_PROJECTING))
-
-(define-enum GdkJoinStyle
- (miter GDK_JOIN_MITER)
- (round GDK_JOIN_ROUND)
- (bevel GDK_JOIN_BEVEL))
-
-(define-enum GdkCursorType
- (cursor GDK_LAST_CURSOR))
-
-(define-enum GdkEventType
- (nothing GDK_NOTHING)
- (delete GDK_DELETE)
- (destroy GDK_DESTROY)
- (expose GDK_EXPOSE)
- (motion-notify GDK_MOTION_NOTIFY)
- (button-press GDK_BUTTON_PRESS)
- (2button-press GDK_2BUTTON_PRESS)
- (3button-press GDK_3BUTTON_PRESS)
- (button-release GDK_BUTTON_RELEASE)
- (key-press GDK_KEY_PRESS)
- (key-release GDK_KEY_RELEASE)
- (enter-notify GDK_ENTER_NOTIFY)
- (leave-notify GDK_LEAVE_NOTIFY)
- (focus-change GDK_FOCUS_CHANGE)
- (configure GDK_CONFIGURE)
- (map GDK_MAP)
- (unmap GDK_UNMAP)
- (property-notify GDK_PROPERTY_NOTIFY)
- (selection-clear GDK_SELECTION_CLEAR)
- (selection-request GDK_SELECTION_REQUEST)
- (selection-notify GDK_SELECTION_NOTIFY)
- (other-event GDK_OTHER_EVENT))
-
-(define-flags GdkEventMask
- (exposure-mask GDK_EXPOSURE_MASK)
- (pointer-motion-mask GDK_POINTER_MOTION_MASK)
- (pointer-motion-hint-mask GDK_POINTER_MOTION_HINT_MASK)
- (button-motion-mask GDK_BUTTON_MOTION_MASK)
- (button1-motion-mask GDK_BUTTON1_MOTION_MASK)
- (button2-motion-mask GDK_BUTTON2_MOTION_MASK)
- (button3-motion-mask GDK_BUTTON3_MOTION_MASK)
- (button-press-mask GDK_BUTTON_PRESS_MASK)
- (button-release-mask GDK_BUTTON_RELEASE_MASK)
- (key-press-mask GDK_KEY_PRESS_MASK)
- (key-release-mask GDK_KEY_RELEASE_MASK)
- (enter-notify-mask GDK_ENTER_NOTIFY_MASK)
- (leave-notify-mask GDK_LEAVE_NOTIFY_MASK)
- (focus-change-mask GDK_FOCUS_CHANGE_MASK)
- (structure-mask GDK_STRUCTURE_MASK)
- (all-events-mask GDK_ALL_EVENTS_MASK))
-
-(define-enum GdkNotifyType
- (ancestor GDK_NOTIFY_ANCESTOR)
- (virtual GDK_NOTIFY_VIRTUAL)
- (inferior GDK_NOTIFY_INFERIOR)
- (nonlinear GDK_NOTIFY_NONLINEAR)
- (nonlinear-virtual GDK_NOTIFY_NONLINEAR_VIRTUAL)
- (unknown GDK_NOTIFY_UNKNOWN))
-
-(define-flags GdkModifierType
- (shift-mask GDK_SHIFT_MASK)
- (lock-mask GDK_LOCK_MASK)
- (control-mask GDK_CONTROL_MASK)
- (mod1-mask GDK_MOD1_MASK)
- (mod2-mask GDK_MOD2_MASK)
- (mod3-mask GDK_MOD3_MASK)
- (mod4-mask GDK_MOD4_MASK)
- (mod5-mask GDK_MOD5_MASK)
- (button1-mask GDK_BUTTON1_MASK)
- (button2-mask GDK_BUTTON2_MASK)
- (button3-mask GDK_BUTTON3_MASK)
- (button4-mask GDK_BUTTON4_MASK)
- (button5-mask GDK_BUTTON5_MASK))
-
-(define-enum GdkSubwindowMode
- (clip-by-children GDK_CLIP_BY_CHILDREN)
- (include-inferiors GDK_INCLUDE_INFERIORS))
-
-(define-flags GdkInputCondition
- (read GDK_INPUT_READ)
- (write GDK_INPUT_WRITE)
- (exception GDK_INPUT_EXCEPTION))
-
-(define-enum GdkStatus
- (ok GDK_OK)
- (error GDK_ERROR)
- (error-param GDK_ERROR_PARAM)
- (error-file GDK_ERROR_FILE)
- (error-mem GDK_ERROR_MEM))
-
-(define-enum GdkByteOrder
- (lsb-first GDK_LSB_FIRST)
- (msb-first GDK_MSB_FIRST))
-
-(define-flags GdkGCValuesMask
- (foreground GDK_GC_FOREGROUND)
- (background GDK_GC_BACKGROUND)
- (font GDK_GC_FONT)
- (function GDK_GC_FUNCTION)
- (fill GDK_GC_FILL)
- (tile GDK_GC_TILE)
- (stipple GDK_GC_STIPPLE)
- (clip-mask GDK_GC_CLIP_MASK)
- (subwindow GDK_GC_SUBWINDOW)
- (ts-x-origin GDK_GC_TS_X_ORIGIN)
- (ts-y-origin GDK_GC_TS_Y_ORIGIN)
- (clip-x-origin GDK_GC_CLIP_X_ORIGIN)
- (clip-y-origin GDK_GC_CLIP_Y_ORIGIN)
- (exposures GDK_GC_EXPOSURES)
- (line-width GDK_GC_LINE_WIDTH)
- (line-style GDK_GC_LINE_STYLE)
- (cap-style GDK_GC_CAP_STYLE)
- (join-style GDK_GC_JOIN_STYLE))
-
-(define-enum GdkSelection
- (primary GDK_SELECTION_PRIMARY)
- (secondary GDK_SELECTION_SECONDARY))
-
-(define-enum GdkPropertyState
- (new-value GDK_PROPERTY_NEW_VALUE)
- (delete GDK_PROPERTY_DELETE))
-
-(define-enum GdkPropMode
- (replace GDK_PROP_MODE_REPLACE)
- (prepend GDK_PROP_MODE_PREPEND)
- (append GDK_PROP_MODE_APPEND))
-
-;;; Gtk boxed types
-
-(define-boxed GtkAcceleratorTable
- gtk_accelerator_table_ref
- gtk_accelerator_table_unref)
-
-(define-boxed GtkStyle
- gtk_style_ref
- gtk_style_unref)
-
-;;; Gdk boxed types
-
- ;(define-boxed GdkPoint
- ; gdk_point_copy
- ; gdk_point_destroy)
-
-(define-boxed GdkColormap
- gdk_colormap_ref
- gdk_colormap_unref)
-
-(define-boxed GdkVisual
- gdk_visual_ref
- gdk_visual_unref)
-
-(define-boxed GdkFont
- gdk_font_ref
- gdk_font_unref)
-
-(define-boxed GdkWindow
- gdk_window_ref
- gdk_window_unref)
-
-(define-boxed GdkEvent
- gdk_event_copy
- gdk_event_free
- "sizeof(GdkEvent)")
-
-(define-boxed GdkColor
- gdk_color_copy
- gdk_color_free
- "sizeof(GdkColor)")
-
-(define-func gtk_style_get_white_interp
- GdkColor
- ((GtkStyle style)))
-
-;;; Functions
-
-;; Gdk
-
-(define-func gdk_font_load
- GdkFont
- ((string name)))
-
-;; main
-
-(define-func gtk_exit
- none
- ((int code (= "0"))))
-
-(define-func gtk_main
- none
- ())
-
-(define-func gtk_main_quit
- none
- ())
-
-(define-func gtk_main_iteration
- bool
- ())
-
-(define-func gtk_timeout_add_interp
- int
- ((int interval)
- (callback function)))
-
-(define-func gtk_timeout_remove
- none
- ((int tag)))
-
-(define-func gtk_idle_add_interp
- int
- ((callback function)))
-
-(define-func gtk_idle_remove
- none
- ((int tag)))
-
-(define-func gtk_input_add_interp
- int
- ((int source)
- (GdkInputCondition condition)
- (callback callback)))
-
-(define-func gtk_input_remove
- none
- ((int tag)))
-
-(define-func gtk_rc_parse
- none
- ((string file)))
-
-(define-func g_mem_chunk_info
- none
- ())
-
-;; GtkObject
-
-(define-func gtk_object_destroy
- none
- ((GtkObject object)))
-
-;; Signals
-
-(define-func gtk_signal_connect_interp
- int
- ((GtkObject object)
- (string name)
- (callback func)
- (bool after (= "0"))))
-
-;; GtkWidget
-
-(define-object GtkWidget (GtkObject)
- (fields
- (GtkStyle style)))
-
-(define-func gtk_grab_add
- none
- ((GtkWidget widget)))
-
-(define-func gtk_grab_remove
- none
- ((GtkWidget widget)))
-
-(define-func GTK_WIDGET_STATE
- GtkStateType
- ((GtkWidget widget)))
-
-(define-func GTK_WIDGET_FLAGS
- GtkWidgetFlags
- ((GtkWidget widget)))
-
-(define-func GTK_WIDGET_SET_FLAGS
- none
- ((GtkWidget widget)
- (GtkWidgetFlags flags)))
-
-(define-func GTK_WIDGET_UNSET_FLAGS
- none
- ((GtkWidget widget)
- (GtkWidgetFlags flags)))
-
-(define-func gtk_widget_destroy
- none
- ((GtkWidget widget)))
-
-(define-func gtk_widget_unparent
- none
- ((GtkWidget widget)))
-
-(define-func gtk_widget_show
- none
- ((GtkWidget widget)))
-
-(define-func gtk_widget_hide
- none
- ((GtkWidget widget)))
-
-(define-func gtk_widget_map
- none
- ((GtkWidget widget)))
-
-(define-func gtk_widget_unmap
- none
- ((GtkWidget widget)))
-
-(define-func gtk_widget_realize
- none
- ((GtkWidget widget)))
-
-(define-func gtk_widget_unrealize
- none
- ((GtkWidget widget)))
-
- ;(define-func gtk_widget_install_accelerator
- ; none
- ; ((GtkWidget widget)
- ; (GtkAcceleratorTable table)
- ; (string signal_name)
- ; (char key)
- ; (...)))
-
-(define-func gtk_widget_remove_accelerator
- none
- ((GtkWidget widget)
- (GtkAcceleratorTable table)
- (string signal_name)))
-
-(define-func gtk_widget_event
- bool
- ((GtkWidget widget)
- (GdkEvent event)))
-
-(define-func gtk_widget_activate
- none
- ((GtkWidget widget)))
-
-(define-func gtk_widget_reparent
- none
- ((GtkWidget widget)
- (GtkWidget new_parent)))
-
-(define-func gtk_widget_popup
- none
- ((GtkWidget widget)
- (int x)
- (int y)))
-
-(define-func gtk_widget_basic
- bool
- ((GtkWidget widget)))
-
-(define-func gtk_widget_grab_focus
- none
- ((GtkWidget widget)))
-
-(define-func gtk_widget_grab_default
- none
- ((GtkWidget widget)))
-
-(define-func gtk_widget_restore_state
- none
- ((GtkWidget widget)))
-
-(define-func gtk_widget_set_name
- none
- ((GtkWidget widget)
- (string name)))
-
-(define-func gtk_widget_get_name
- static_string
- ((GtkWidget widget)))
-
-(define-func gtk_widget_set_state
- none
- ((GtkWidget widget)
- (GtkStateType state)))
-
-(define-func gtk_widget_set_sensitive
- none
- ((GtkWidget widget)
- (bool sensitive)))
-
-(define-func gtk_widget_set_style
- none
- ((GtkWidget widget)
- (GtkStyle style)))
-
-(define-func gtk_widget_set_uposition
- none
- ((GtkWidget widget)
- (int x)
- (int y)))
-
-(define-func gtk_widget_set_usize
- none
- ((GtkWidget widget)
- (int height)
- (int width)))
-
-(define-func gtk_widget_set_events
- none
- ((GtkWidget widget)
- (GdkEventMask events)))
-
-(define-func gtk_widget_set_extension_events
- none
- ((GtkWidget widget)
- (GdkEventMask events)))
-
-(define-func gtk_widget_get_toplevel
- GtkWidget
- ((GtkWidget widget)))
-
- ;(define-func gtk_widget_get_ancestor
- ; GtkWidget
- ; ((GtkWidget widget)
- ; (GtkType type)))
-
-(define-func gtk_widget_get_colormap
- GdkColormap
- ((GtkWidget widget)))
-
-(define-func gtk_widget_get_visual
- GdkVisual
- ((GtkWidget widget)))
-
-(define-func gtk_widget_get_style
- GtkStyle
- ((GtkWidget widget)))
-
-(define-func gtk_widget_get_events
- GdkEventMask
- ((GtkWidget widget)))
-
-(define-func gtk_widget_get_extension_events
- GdkEventMask
- ((GtkWidget widget)))
-
-(define-func gtk_widget_push_colormap
- none
- ((GdkColormap cmap)))
-
-(define-func gtk_widget_push_visual
- none
- ((GdkVisual visual)))
-
-(define-func gtk_widget_push_style
- none
- ((GtkStyle style)))
-
-(define-func gtk_widget_pop_colormap
- none
- ())
-
-(define-func gtk_widget_pop_visual
- none
- ())
-
-(define-func gtk_widget_pop_style
- none
- ())
-
-(define-func gtk_widget_set_default_colormap
- none
- ((GdkColormap cmap)))
-
-(define-func gtk_widget_set_default_visual
- none
- ((GdkVisual visual)))
-
-(define-func gtk_widget_set_default_style
- none
- ((GtkStyle style)))
-
-(define-func gtk_widget_get_default_colormap
- GdkColormap
- ())
-
-(define-func gtk_widget_get_default_visual
- GdkVisual
- ())
-
-(define-func gtk_widget_get_default_style
- GtkStyle
- ())
-
-;;; Container
-
-(define-object GtkContainer (GtkWidget))
-
-(define-func gtk_container_border_width
- none
- ((GtkContainer container)
- (int border_width)))
-
-(define-func gtk_container_add
- none
- ((GtkContainer container)
- (GtkWidget widget)))
-
-(define-func gtk_container_remove
- none
- ((GtkContainer container)
- (GtkWidget widget)))
-
-(define-func gtk_container_disable_resize
- none
- ((GtkContainer container)))
-
-(define-func gtk_container_enable_resize
- none
- ((GtkContainer container)))
-
-(define-func gtk_container_block_resize
- none
- ((GtkContainer container)))
-
-(define-func gtk_container_unblock_resize
- none
- ((GtkContainer container)))
-
-(define-func gtk_container_need_resize
- bool
- ((GtkContainer container)))
-
-(define-func gtk_container_focus
- GtkDirectionType
- ((GtkContainer container)
- (GtkDirectionType direction)))
-
-;;; Bin
-
-(define-object GtkBin (GtkContainer))
-
-;;; Window
-
-(define-object GtkWindow (GtkBin))
-
-(define-func gtk_window_new
- GtkWidget
- ((GtkWindowType type)))
-
-(define-func gtk_window_set_title
- none
- ((GtkWindow window)
- (string title)))
-
-(define-func gtk_window_set_focus
- none
- ((GtkWindow window)
- (GtkWidget focus)))
-
-(define-func gtk_window_set_default
- none
- ((GtkWindow window)
- (GtkWidget default)))
-
-(define-func gtk_window_set_policy
- none
- ((GtkWindow window)
- (bool allow_shrink)
- (bool allow_grow)
- (bool auto_shrink)))
-
-(define-func gtk_window_add_accelerator_table
- none
- ((GtkWindow window)
- (GtkAcceleratorTable table)))
-
-(define-func gtk_window_remove_accelerator_table
- none
- ((GtkWindow window)
- (GtkAcceleratorTable table)))
-
-(define-func gtk_window_position
- none
- ((GtkWindow window)
- (GtkWindowPosition position)))
-
-;;; Box
-
-(define-object GtkBox (GtkContainer))
-
-(define-func gtk_box_pack_start
- none
- ((GtkBox box)
- (GtkWidget child)
- (bool expand (= "TRUE"))
- (bool fill (= "TRUE"))
- (int padding (= "0"))))
-
-(define-func gtk_box_pack_end
- none
- ((GtkBox box)
- (GtkWidget child)
- (bool expand (= "TRUE"))
- (bool fill (= "TRUE"))
- (int padding (= "0"))))
-
-(define-func gtk_box_pack_start_defaults
- none
- ((GtkBox box)
- (GtkWidget child)))
-
-(define-func gtk_box_pack_end_defaults
- none
- ((GtkBox box)
- (GtkWidget child)))
-
-(define-func gtk_box_set_homogeneous
- none
- ((GtkBox box)
- (bool homogenous)))
-
-(define-func gtk_box_set_spacing
- none
- ((GtkBox box)
- (int spacing)))
-
-;;; Table
-
-(define-object GtkTable (GtkContainer))
-
-(define-func gtk_table_new
- GtkWidget
- ((int rows)
- (int columns)
- (bool homogenous)))
-
-(define-func gtk_table_attach
- none
- ((GtkTable table)
- (GtkWidget child)
- (int left_attach)
- (int right_attach)
- (int top_attach)
- (int bottom_attach)
- (GtkAttachOptions xoptions (= "GTK_EXPAND|GTK_FILL"))
- (GtkAttachOptions yoptions (= "GTK_EXPAND|GTK_FILL"))
- (int xpadding (= "0"))
- (int ypadding (= "0"))))
-
-(define-func gtk_table_attach_defaults
- none
- ((GtkTable table)
- (GtkWidget child)
- (int left_attach)
- (int right_attach)
- (int top_attach)
- (int bottom_attach)))
-
-(define-func gtk_table_set_row_spacing
- none
- ((GtkTable table)
- (int row)
- (int spacing)))
-
-(define-func gtk_table_set_col_spacing
- none
- ((GtkTable table)
- (int column)
- (int spacing)))
-
-(define-func gtk_table_set_row_spacings
- none
- ((GtkTable table)
- (int spacing)))
-
-(define-func gtk_table_set_col_spacings
- none
- ((GtkTable table)
- (int spacing)))
-
-;;; Button
-
-(define-object GtkButton (GtkContainer))
-
-(define-func gtk_button_new
- GtkWidget
- ())
-
-(define-func gtk_button_new_with_label
- GtkWidget
- ((string label)))
-
-(define-func gtk_button_pressed
- none
- ((GtkButton button)))
-
-(define-func gtk_button_released
- none
- ((GtkButton button)))
-
-(define-func gtk_button_clicked
- none
- ((GtkButton button)))
-
-(define-func gtk_button_enter
- none
- ((GtkButton button)))
-
-(define-func gtk_button_leave
- none
- ((GtkButton button)))
-
-;;; ToggleButton
-
-(define-object GtkToggleButton (GtkButton))
-
-(define-func gtk_toggle_button_new
- GtkWidget
- ())
-
-(define-func gtk_toggle_button_new_with_label
- GtkWidget
- ((string label)))
-
-(define-func gtk_toggle_button_set_mode
- none
- ((GtkToggleButton toggle_button)
- (bool draw_indicator)))
-
-(define-func gtk_toggle_button_set_state
- none
- ((GtkToggleButton toggle_button)
- (bool state)))
-
-(define-func gtk_toggle_button_toggled
- none
- ((GtkToggleButton toggle_button)))
-
-;;; CheckButton
-
-(define-object GtkCheckButton (GtkToggleButton))
-
-(define-func gtk_check_button_new
- GtkWidget
- ())
-
-(define-func gtk_check_button_new_with_label
- GtkWidget
- ((string label)))
-
-;;; RadioButton
-
-(define-object GtkRadioButton (GtkCheckButton))
-
-(define-func gtk_radio_button_new_interp
- GtkWidget
- ((GtkRadioButton group (null-ok))))
-
-(define-func gtk_radio_button_new_with_label_interp
- GtkWidget
- ((GtkRadioButton group (null-ok))
- (string label)))
-
-;;; Misc
-
-(define-object GtkMisc (GkWidget))
-
-(define-func gtk_misc_set_alignment
- none
- ((GtkMisc misc)
- (float xalign)
- (float yalign)))
-
-(define-func gtk_misc_set_padding
- none
- ((GtkMisc misc)
- (int xpad)
- (int ypad)))
-
-;;; Label
-
-(define-object GtkLabel (GtkMisc))
-
-(define-func gtk_label_new
- GtkWidget
- ((string str)))
-
-(define-func gtk_label_set
- none
- ((GtkLabel label)
- (string str)))
-
-(define-func gtk_label_get_interp
- static_string
- ((GtkLabel label)))
-
-;; VBox
-
-(define-object GtkVBox (GtkBox))
-
-(define-func gtk_vbox_new
- GtkWidget
- ((bool homogenous)
- (int spacing)))
-
-;; HBox
-
-(define-object GtkHBox (GtkBox))
-
-(define-func gtk_hbox_new
- GtkWidget
- ((bool homogenous)
- (int spacing)))
-
-;; Separator
-
-(define-object GtkSeparator (GtkWidget))
-
-;; HSeparator
-
-(define-object GtkHSeparator (GtkSeparator))
-
-(define-func gtk_hseparator_new
- GtkWidget
- ())
-
-;; VSeparator
-
-(define-object GtkVSeparator (GtkSeparator))
-
-(define-func gtk_vseparator_new
- GtkWidget
- ())
-
-;; Frame
-
-(define-object GtkFrame (GtkBin))
-
-(define-func gtk_frame_new
- GtkWidget
- ((string label (null-ok))))
-
-(define-func gtk_frame_set_label
- none
- ((GtkFrame frame)
- (string label)))
-
-(define-func gtk_frame_set_label_align
- none
- ((GtkFrame frame)
- (float xalign)
- (float yalign)))
-
-(define-func gtk_frame_set_shadow_type
- none
- ((GtkFrame frame)
- (GtkShadowType type)))
-
-;; Progress Bar
-
-(define-object GtkProgressBar (GtkWidget)
- (fields
- (float percentage)))
-
-(define-func gtk_progress_bar_new
- GtkWidget
- ())
-
-(define-func gtk_progress_bar_update
- none
- ((GtkProgressBar progress_bar)
- (float percentage)))
-
- ;(define-func gtk_progress_bar_percentage
- ; float
- ; ((GtkProgressBar progress_bar)))
-
-;; Tooltips
-
-(define-boxed GtkTooltips
- gtk_tooltips_ref
- gtk_tooltips_unref)
-
-(define-func gtk_tooltips_new
- GtkTooltips
- ())
-
-(define-func gtk_tooltips_destroy
- none
- ((GtkTooltips tooltips)))
-
-(define-func gtk_tooltips_enable
- none
- ((GtkTooltips tooltips)))
-
-(define-func gtk_tooltips_disable
- none
- ((GtkTooltips tooltips)))
-
-(define-func gtk_tooltips_set_delay
- none
- ((GtkTooltips tooltips)
- (int delay)))
-
-(define-func gtk_tooltips_set_tips
- none
- ((GtkTooltips tooltips)
- (GtkWidget widget)
- (string tips_text (null-ok))))
-
-(define-func gtk_tooltips_set_colors
- none
- ((GtkTooltips tooltips)
- (GdkColor background)
- (GdkColor foreground)))
-
-;; MenuShell
-
-(define-object GtkMenuShell (GtkContainer))
-
-(define-func gtk_menu_shell_append
- none
- ((GtkMenuShell menu_shell)
- (GtkWidget child)))
-
-(define-func gtk_menu_shell_prepend
- none
- ((GtkMenuShell menu_shell)
- (GtkWidget child)))
-
-(define-func gtk_menu_shell_insert
- none
- ((GtkMenuShell menu_shell)
- (GtkWidget child)
- (int position)))
-
-(define-func gtk_menu_shell_deactivate
- none
- ((GtkMenuShell menu_shell)))
-
-;; MenuBar
-
-(define-object GtkMenuBar (GtkMenuShell))
-
-(define-func gtk_menu_bar_new
- GtkWidget
- ())
-
-(define-func gtk_menu_bar_append
- none
- ((GtkMenuBar menu_bar)
- (GtkWidget child)))
-
-(define-func gtk_menu_bar_prepend
- none
- ((GtkMenuBar menu_bar)
- (GtkWidget child)))
-
-(define-func gtk_menu_bar_insert
- none
- ((GtkMenuBar menu_bar)
- (GtkWidget child)
- (int position)))
-
-;; Menu
-
-(define-object GtkMenu (GtkMenuShell))
-
-(define-func gtk_menu_new
- GtkWidget
- ())
-
-(define-func gtk_menu_append
- none
- ((GtkMenu menu)
- (GtkWidget child)))
-
-(define-func gtk_menu_prepend
- none
- ((GtkMenu menu)
- (GtkWidget child)))
-
-(define-func gtk_menu_insert
- none
- ((GtkMenu menu)
- (GtkWidget child)
- (int position)))
-
-(define-func gtk_menu_popup_interp
- none
- ((GtkMenu menu)
- (GtkWidget parent_menu_shell)
- (GtkWidget parent_menu_item)
- (int button)
- (int activate_time)))
-
-(define-func gtk_menu_popdown
- none
- ((GtkMenu menu)))
-
-(define-func gtk_menu_get_active
- GtkWidget
- ((GtkMenu menu)))
-
-(define-func gtk_menu_set_active
- none
- ((GtkMenu menu)
- (int index)))
-
-(define-func gtk_menu_set_accelerator_table
- none
- ((GtkMenu menu)
- (GtkAcceleratorTable table)))
-
-
-;; Item
-
-(define-object GtkItem (GtkBin))
-
-(define-func gtk_item_select
- none
- ((GtkItem item)))
-
-(define-func gtk_item_deselect
- none
- ((GtkItem item)))
-
-(define-func gtk_item_toggle
- none
- ((GtkItem item)))
-
-;; MenuItem
-
-(define-object GtkMenuItem (GtkItem))
-
-(define-func gtk_menu_item_new
- GtkWidget
- ())
-
-(define-func gtk_menu_item_new_with_label
- GtkWidget
- ((string label)))
-
-(define-func gtk_menu_item_set_submenu
- none
- ((GtkMenuItem menu_item)
- (GtkWidget submenu)))
-
-(define-func gtk_menu_item_set_placement
- none
- ((GtkMenuItem menu_item)
- (GtkSubmenuPlacement placement)))
-
-(define-func gtk_menu_item_accelerator_size
- none
- ((GtkMenuItem menu_item)))
-
-(define-func gtk_menu_item_configure
- none
- ((GtkMenuItem menu_item)
- (bool show_toggle_indicator)
- (bool show_submenu_indicator)))
-
-(define-func gtk_menu_item_select
- none
- ((GtkMenuItem menu_item)))
-
-(define-func gtk_menu_item_deselect
- none
- ((GtkMenuItem menu_item)))
-
-(define-func gtk_menu_item_activate
- none
- ((GtkMenuItem menu_item)))
-
-;; CheckMenuItem
-
-(define-object GtkCheckMenuItem (GtkMenuItem))
-
-(define-func gtk_check_menu_item_new
- GtkWidget
- ())
-
-(define-func gtk_check_menu_item_new_with_label
- GtkWidget
- ((string label)))
-
-(define-func gtk_check_menu_item_set_state
- none
- ((GtkCheckMenuItem check_menu_item)
- (bool state)))
-
-(define-func gtk_check_menu_item_toggled
- none
- ((GtkCheckMenuItem check_menu_item)))
-
-;; RadioMenuItem
-
-(define-object GtkRadioMenuItem (GtkCheckMenuItem))
-
-(define-func gtk_radio_menu_item_new_interp
- GtkWidget
- ((GtkRadioMenuItem group (null-ok))))
-
-(define-func gtk_radio_menu_item_new_with_label_interp
- GtkWidget
- ((GtkRadioMenuItem group (null-ok))
- (string label)))
-
-;; OptionMenu
-
-(define-object GtkOptionMenu (GtkButton))
-
-(define-func gtk_option_menu_new
- GtkWidget
- ())
-
-(define-func gtk_option_menu_get_menu
- GtkWidget
- ((GtkOptionMenu option_menu)))
-
-(define-func gtk_option_menu_set_menu
- none
- ((GtkOptionMenu option_menu)
- (GtkWidget menu)))
-
-(define-func gtk_option_menu_remove_menu
- none
- ((GtkOptionMenu option_menu)))
-
-(define-func gtk_option_menu_set_history
- none
- ((GtkOptionMenu option_menu)
- (int index)))
-
-;; Pixmaps
-
-(define-object GtkPixmap (GtkMisc))
-
-(define-func gtk_pixmap_new_interp
- GtkWidget
- ((string xpm_file)
- (GtkWidget intended_parent)))
-
-;; Data
-
-(define-object GtkData (GtkObject))
-
-;; Adjustment
-
-(define-object GtkAdjustment (GtkData))
-
-(define-func gtk_adjustment_new
- GtkObject
- ((float value)
- (float lower)
- (float upper)
- (float step_increment)
- (float page_increment)
- (float page_size)))
-
-;; ScrolledWidow
-
-(define-object GtkScrolledWindow (GtkContainer))
-
-(define-func gtk_scrolled_window_new
- GtkWidget
- ((GtkAdjustment hadjustment (null-ok) (= "NULL"))
- (GtkAdjustment vadjustment (null-ok) (= "NULL"))))
-
-(define-func gtk_scrolled_window_get_hadjustment
- GtkAdjustment
- ((GtkScrolledWindow scrolled_window)))
-
-(define-func gtk_scrolled_window_get_vadjustment
- GtkAdjustment
- ((GtkScrolledWindow scrolled_window)))
-
-(define-func gtk_scrolled_window_set_policy
- none
- ((GtkScrolledWindow scrolled_window)
- (GtkPolicyType hscrollbar_policy)
- (GtkPolicyType vscrollbar_policy)))
-
-;; ListItem
-
-(define-object GtkListItem (GtkItem))
-
-(define-func gtk_list_item_new
- GtkWidget
- ())
-
-(define-func gtk_list_item_new_with_label
- GtkWidget
- ((string label)))
-
-(define-func gtk_list_item_select
- none
- ((GtkListItem list_item)))
-
-(define-func gtk_list_item_deselect
- none
- ((GtkListItem list_item)))
-
-;; List
-
-(define-object GtkList (GtkContainer))
-
-(define-func gtk_list_new
- GtkWidget
- ())
-
-(define-func gtk_list_append_item
- none
- ((GtkList list)
- (GtkListItem item)))
-
-(define-func gtk_list_prepend_item
- none
- ((GtkList list)
- (GtkListItem item)))
-
-;; XXX many missing
-
-(define-func gtk_list_clear_items
- none
- ((GtkList list)
- (int start)
- (int end)))
-
-(define-func gtk_list_select_item
- none
- ((GtkList list)
- (int item)))
-
-(define-func gtk_list_unselect_item
- none
- ((GtkList list)
- (int item)))
-
-(define-func gtk_list_select_child
- none
- ((GtkList list)
- (GtkWidget child)))
-
-(define-func gtk_list_unselect_child
- none
- ((GtkList list)
- (GtkWidget child)))
-
-(define-func gtk_list_child_position
- int
- ((GtkList list)
- (GtkWidget child)))
-
-(define-func gtk_list_set_selection_mode
- none
- ((GtkList list)
- (GtkSelectionMode mode)))
-
-;; Notebook
-
-(define-object GtkNotebook (GtkContainer)
- (fields
- (GtkPositionType tab_pos)))
-
-(define-func gtk_notebook_new
- GtkWidget
- ())
-
-(define-func gtk_notebook_append_page
- none
- ((GtkNotebook notebook)
- (GtkWidget child)
- (GtkWidget tab_label)))
-
-(define-func gtk_notebook_prepend_page
- none
- ((GtkNotebook notebook)
- (GtkWidget child)
- (GtkWidget tab_label)))
-
-(define-func gtk_notebook_insert_page
- none
- ((GtkNotebook notebook)
- (GtkWidget child)
- (GtkWidget tab_label)
- (int position)))
-
-(define-func gtk_notebook_remove_page
- none
- ((GtkNotebook notebook)
- (int page_num)))
-
-(define-func gtk_notebook_current_page
- int
- ((GtkNotebook notebook)))
-
-(define-func gtk_notebook_set_page
- none
- ((GtkNotebook notebook)
- (int page_num)))
-
-(define-func gtk_notebook_next_page
- none
- ((GtkNotebook notebook)))
-
-(define-func gtk_notebook_prev_page
- none
- ((GtkNotebook notebook)))
-
-(define-func gtk_notebook_set_tab_pos
- none
- ((GtkNotebook notebook)
- (GtkPositionType pos)))
-
-(define-func gtk_notebook_set_show_tabs
- none
- ((GtkNotebook notebook)
- (bool show_tabs)))
-
-(define-func gtk_notebook_set_show_border
- none
- ((GtkNotebook notebook)
- (bool show_border)))
-
-;; Entry
-
-(define-object GtkEntry (GtkWidget))
-
-(define-func gtk_entry_new
- GtkWidget
- ())
-
-(define-func gtk_entry_set_text
- none
- ((GtkEntry entry)
- (string text)))
-
-(define-func gtk_entry_append_text
- none
- ((GtkEntry entry)
- (string text)))
-
-(define-func gtk_entry_prepend_text
- none
- ((GtkEntry entry)
- (string text)))
-
-(define-func gtk_entry_set_position
- none
- ((GtkEntry entry)
- (int position)))
-
-(define-func gtk_entry_get_text
- static_string
- ((GtkEntry entry)))
-
-;; Text
-
-(define-object GtkText (GtkWidget))
-
-(define-func gtk_text_new
- GtkWidget
- ((GtkAdjustment hadj (null-ok))
- (GtkAdjustment vadj (null-ok))))
-
-(define-func gtk_text_set_editable
- none
- ((GtkText text)
- (bool editable)))
-
-(define-func gtk_text_set_adjustments
- none
- ((GtkText text)
- (GtkAdjustment hadj)
- (GtkAdjustment vadj)))
-
-(define-func gtk_text_set_point
- none
- ((GtkText text)
- (uint index)))
-
-(define-func gtk_text_get_point
- uint
- ((GtkText text)))
-
-(define-func gtk_text_get_length
- uint
- ((GtkText text)))
-
-(define-func gtk_text_freeze
- none
- ((GtkText text)))
-
-(define-func gtk_text_thaw
- none
- ((GtkText text)))
-
-(define-func gtk_text_insert
- none
- ((GtkText text)
- (GdkFont font (null-ok))
- (GdkColor fore (null-ok))
- (GdkColor back (null-ok))
- (string chars)
- (int length)))
-
-(define-func gtk_text_backward_delete
- none
- ((GtkText text)
- (uint nchars)))
-
-(define-func gtk_text_foreward_delete
- none
- ((GtkText text)
- (uint nchars)))
-
-;; Alignment
-
-(define-object GtkAlignment (GtkBin))
-
-(define-func gtk_alignment_new
- GtkWidget
- ((float xalign)
- (float yalign)
- (float xscale)
- (float yscale)))
-
-(define-func gtk_alignment_set
- none
- ((GtkAlignment alignment)
- (float xalign)
- (float yalign)
- (float xscale)
- (float yscale)))
-
-;; Color
-
- ; XXX lots missing
-
-(define-func gdk_color_parse_interp
- GdkColor
- ((string spec)))
-
-;; Preview
-
-(define-object GtkPreview (GtkWidget))
-
-;; XXX lots missing
-
-(define-func gtk_preview_set_install_cmap
- none
- ((bool install_cmap)))
-
-(define-func gtk_preview_set_reserved
- none
- ((int nreserved)))
-
-(define-func gtk_preview_get_visual
- GdkVisual
- ())
-
-(define-func gtk_preview_get_cmap
- GdkColormap
- ())
-
-;; ColorSelectionDialog
-
-(define-object GtkColorSelectionDialog (GtkWindow)
- (fields
- (GtkWidget colorsel)
- (GtkWidget main_vbox)
- (GtkWidget ok_button)
- (GtkWidget reset_button)
- (GtkWidget cancel_button)
- (GtkWidget help_button)))
-
-(define-func gtk_color_selection_dialog_new
- GtkWidget
- ((string title)))
-
-;; ColorSelection
-
-(define-object GtkColorSelection (GtkVBox))
-
-(define-func gtk_color_selection_new
- GtkWidget
- ())
-
-(define-func gtk_color_selection_set_update_policy
- none
- ((GtkColorSelection colorsel)
- (GtkUpdateType policy)))
-
-(define-func gtk_color_selection_set_opacity
- none
- ((GtkColorSelection colorsel)
- (bool use_opacity)))
-
-;; Range
-
-(define-object GtkRange (GtkWidget))
-
-(define-func gtk_range_get_adjustment
- GtkAdjustment
- ((GtkRange range)))
-
-(define-func gtk_range_set_update_policy
- none
- ((GtkRange range)
- (GtkUpdateType policy)))
-
-(define-func gtk_range_set_adjustment
- none
- ((GtkRange range)
- (GtkAdjustment adjustment)))
-
-;; Scale
-
-(define-object GtkScale (GtkRange))
-
-(define-func gtk_scale_set_digits
- none
- ((GtkScale scale)
- (bool digits)))
-
-(define-func gtk_scale_set_draw_value
- none
- ((GtkScale scale)
- (bool draw_value)))
-
-(define-func gtk_scale_set_value_pos
- none
- ((GtkScale scale)
- (GtkPositionType pos)))
-
-;; HScale
-
-(define-object GtkHScale (GtkScale))
-
-(define-func gtk_hscale_new
- GtkWidget
- ((GtkAdjustment adjustment)))
-
-;; VScale
-
-(define-object GtkVScale (GtkScale))
-
-(define-func gtk_vscale_new
- GtkWidget
- ((GtkAdjustment adjustment)))
-
-;; Scrollbar
-
-(define-object GtkScrollbar (GtkRange))
-
-;; HScrollbar
-
-(define-object GtkHScrollbar (GtkScrollbar))
-
-(define-func gtk_hscrollbar_new
- GtkWidget
- ((GtkAdjustment adjustment)))
-
-;; VScrollbar
-
-(define-object GtkVScrollbar (GtkScrollbar))
-
-(define-func gtk_vscrollbar_new
- GtkWidget
- ((GtkAdjustment adjustment)))
-
-;; Dialog
-
-(define-object GtkDialog (GtkWindow)
- (fields
- (GtkWidget vbox)
- (GtkWidget action_area)))
-
-(define-func gtk_dialog_new
- GtkWidget
- ())
-
-;; Paned
-
-(define-object GtkPaned (GtkContainer))
-
-(define-func gtk_paned_add1
- none
- ((GtkPaned paned)
- (GtkWidget child)))
-
-(define-func gtk_paned_add2
- none
- ((GtkPaned paned)
- (GtkWidget child)))
-
-(define-func gtk_paned_handle_size
- none
- ((GtkPaned paned)
- (int size)))
-
-(define-func gtk_paned_gutter_size
- none
- ((GtkPaned paned)
- (int size)))
-
-;; HPaned
-
-(define-object GtkHPaned (GtkPaned))
-
-(define-func gtk_hpaned_new
- GtkWidget
- ())
-
-;; VPaned
-
-(define-object GtkVPaned (GtkPaned))
-
-(define-func gtk_vpaned_new
- GtkWidget
- ())
-
-;;; hack
-
-;(define-func panel_register_toy
-; none
-; ((gpointer panel)
-; (GtkWidget applet)
-; (string id)
-; (string params)
-; (int x)
-; (int y)
-; (int flags)))
-
-;(define-func panel_quit
-; none
-; ((gpointer panel)))
-
-;(define-func panel_new_applet
-; none
-; ((gpointer panel)
-; (string applet)
-; (string params)))
diff --git a/gtk/gtk.h b/gtk/gtk.h
deleted file mode 100644
index fc7f3bff90..0000000000
--- a/gtk/gtk.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_H__
-#define __GTK_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkaccelerator.h>
-#include <gtk/gtkadjustment.h>
-#include <gtk/gtkalignment.h>
-#include <gtk/gtkaspectframe.h>
-#include <gtk/gtkarrow.h>
-#include <gtk/gtkbin.h>
-#include <gtk/gtkbox.h>
-#include <gtk/gtkbbox.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkcheckbutton.h>
-#include <gtk/gtkcheckmenuitem.h>
-#include <gtk/gtkclist.h>
-#include <gtk/gtkcolorsel.h>
-#include <gtk/gtkcombo.h>
-#include <gtk/gtkcontainer.h>
-#include <gtk/gtkcurve.h>
-#include <gtk/gtkdata.h>
-#include <gtk/gtkdialog.h>
-#include <gtk/gtkdrawingarea.h>
-#include <gtk/gtkeditable.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkenums.h>
-#include <gtk/gtkeventbox.h>
-#include <gtk/gtkfilesel.h>
-#include <gtk/gtkfixed.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtkgamma.h>
-#include <gtk/gtkgc.h>
-#include <gtk/gtkhandlebox.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkhbbox.h>
-#include <gtk/gtkhpaned.h>
-#include <gtk/gtkhruler.h>
-#include <gtk/gtkhscale.h>
-#include <gtk/gtkhscrollbar.h>
-#include <gtk/gtkhseparator.h>
-#include <gtk/gtkimage.h>
-#include <gtk/gtkinputdialog.h>
-#include <gtk/gtkitem.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtklist.h>
-#include <gtk/gtklistitem.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkmenubar.h>
-#include <gtk/gtkmenufactory.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtkmenushell.h>
-#include <gtk/gtkmisc.h>
-#include <gtk/gtknotebook.h>
-#include <gtk/gtkobject.h>
-#include <gtk/gtkoptionmenu.h>
-#include <gtk/gtkpaned.h>
-#include <gtk/gtkpixmap.h>
-#include <gtk/gtkpreview.h>
-#include <gtk/gtkprogressbar.h>
-#include <gtk/gtkradiobutton.h>
-#include <gtk/gtkradiomenuitem.h>
-#include <gtk/gtkrange.h>
-#include <gtk/gtkrc.h>
-#include <gtk/gtkruler.h>
-#include <gtk/gtkscale.h>
-#include <gtk/gtkscrollbar.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtkselection.h>
-#include <gtk/gtkseparator.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkspinbutton.h>
-#include <gtk/gtkstyle.h>
-#include <gtk/gtkstatusbar.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtktext.h>
-#include <gtk/gtktipsquery.h>
-#include <gtk/gtktogglebutton.h>
-#include <gtk/gtktoolbar.h>
-#include <gtk/gtktooltips.h>
-#include <gtk/gtktree.h>
-#include <gtk/gtktreeitem.h>
-#include <gtk/gtktypeutils.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkvbbox.h>
-#include <gtk/gtkviewport.h>
-#include <gtk/gtkvpaned.h>
-#include <gtk/gtkvruler.h>
-#include <gtk/gtkvscale.h>
-#include <gtk/gtkvscrollbar.h>
-#include <gtk/gtkvseparator.h>
-#include <gtk/gtkwidget.h>
-#include <gtk/gtkwindow.h>
-
-
-#endif /* __GTK_H__ */
diff --git a/gtk/gtkaccelerator.c b/gtk/gtkaccelerator.c
deleted file mode 100644
index e6e0b864bb..0000000000
--- a/gtk/gtkaccelerator.c
+++ /dev/null
@@ -1,345 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <ctype.h>
-#include "gtkaccelerator.h"
-#include "gtksignal.h"
-#include "gtkwidget.h"
-
-
-typedef struct _GtkAcceleratorEntry GtkAcceleratorEntry;
-
-struct _GtkAcceleratorEntry
-{
- guint8 modifiers;
- GtkObject *object;
- guint signal_id;
-};
-
-
-static void gtk_accelerator_table_init (GtkAcceleratorTable *table);
-static void gtk_accelerator_table_clean (GtkAcceleratorTable *table);
-
-
-static GtkAcceleratorTable *default_table = NULL;
-static GSList *tables = NULL;
-static guint8 gtk_accelerator_table_default_mod_mask = (guint8) ~0;
-
-
-GtkAcceleratorTable*
-gtk_accelerator_table_new ()
-{
- GtkAcceleratorTable *table;
-
- table = g_new (GtkAcceleratorTable, 1);
- gtk_accelerator_table_init (table);
-
- tables = g_slist_prepend (tables, table);
-
- return table;
-}
-
-GtkAcceleratorTable*
-gtk_accelerator_table_find (GtkObject *object,
- const gchar *signal_name,
- guchar accelerator_key,
- guint8 accelerator_mods)
-{
- GtkAcceleratorTable *table;
- GtkAcceleratorEntry *entry;
- GSList *tmp_list;
- GList *entries;
- guint signal_id;
- guint hash;
-
- g_return_val_if_fail (object != NULL, NULL);
- g_return_val_if_fail (signal_name != NULL, NULL);
-
- signal_id = gtk_signal_lookup (signal_name, GTK_OBJECT_TYPE (object));
- hash = (guint) accelerator_key;
-
- tmp_list = tables;
- while (tmp_list)
- {
- table = tmp_list->data;
- tmp_list = tmp_list->next;
-
- entries = table->entries[hash];
- while (entries)
- {
- entry = entries->data;
- entries = entries->next;
-
- if ((entry->object == object) &&
- (entry->signal_id == signal_id) &&
- ((entry->modifiers & table->modifier_mask) ==
- (accelerator_mods & table->modifier_mask)))
- return table;
- }
- }
-
- return NULL;
-}
-
-GtkAcceleratorTable*
-gtk_accelerator_table_ref (GtkAcceleratorTable *table)
-{
- g_return_val_if_fail (table != NULL, NULL);
-
- table->ref_count += 1;
- return table;
-}
-
-void
-gtk_accelerator_table_unref (GtkAcceleratorTable *table)
-{
- g_return_if_fail (table != NULL);
-
- table->ref_count -= 1;
- if (table->ref_count <= 0)
- {
- tables = g_slist_remove (tables, table);
- gtk_accelerator_table_clean (table);
- g_free (table);
- }
-}
-
-void
-gtk_accelerator_table_install (GtkAcceleratorTable *table,
- GtkObject *object,
- const gchar *signal_name,
- guchar accelerator_key,
- guint8 accelerator_mods)
-{
- GtkAcceleratorEntry *entry;
- GList *entries;
- gchar *signame;
- guint signal_id;
- guint hash;
-
- g_return_if_fail (object != NULL);
-
- if (!table)
- {
- if (!default_table)
- default_table = gtk_accelerator_table_new ();
- table = default_table;
- }
-
- signal_id = gtk_signal_lookup (signal_name, GTK_OBJECT_TYPE (object));
- g_return_if_fail (signal_id != 0);
-
- hash = (guint) accelerator_key;
- entries = table->entries[hash];
-
- while (entries)
- {
- entry = entries->data;
-
- if ((entry->modifiers & table->modifier_mask) ==
- (accelerator_mods & table->modifier_mask))
- {
- if (GTK_IS_WIDGET (entry->object))
- {
- signame = gtk_signal_name (entry->signal_id);
- gtk_signal_emit_by_name (entry->object,
- "remove_accelerator",
- signame);
- }
-
- entry->modifiers = accelerator_mods;
- entry->object = object;
- entry->signal_id = signal_id;
- return;
- }
-
- entries = entries->next;
- }
-
- entry = g_new (GtkAcceleratorEntry, 1);
- entry->modifiers = accelerator_mods;
- entry->object = object;
- entry->signal_id = signal_id;
-
- table->entries[hash] = g_list_prepend (table->entries[hash], entry);
-}
-
-void
-gtk_accelerator_table_remove (GtkAcceleratorTable *table,
- GtkObject *object,
- const gchar *signal_name)
-{
- GtkAcceleratorEntry *entry;
- GList *entries;
- GList *temp_list;
- guint signal_id;
- gint i;
-
- g_return_if_fail (object != NULL);
-
- if (!table)
- {
- if (!default_table)
- default_table = gtk_accelerator_table_new ();
- table = default_table;
- }
-
- signal_id = gtk_signal_lookup (signal_name, GTK_OBJECT_TYPE (object));
- g_return_if_fail (signal_id != 0);
-
- for (i = 0; i < 256; i++)
- {
- entries = table->entries[i];
-
- while (entries)
- {
- entry = entries->data;
-
- if ((entry->object == object) && (entry->signal_id == signal_id))
- {
- g_free (entry);
-
- temp_list = entries;
- if (entries->next)
- entries->next->prev = entries->prev;
- if (entries->prev)
- entries->prev->next = entries->next;
- if (table->entries[i] == entries)
- table->entries[i] = entries->next;
-
- temp_list->next = NULL;
- temp_list->prev = NULL;
- g_list_free (temp_list);
-
- return;
- }
-
- entries = entries->next;
- }
- }
-}
-
-gint
-gtk_accelerator_table_check (GtkAcceleratorTable *table,
- const guchar accelerator_key,
- guint8 accelerator_mods)
-{
- GtkAcceleratorEntry *entry;
- GList *entries;
- guint hash;
-
- if (!table)
- {
- if (!default_table)
- default_table = gtk_accelerator_table_new ();
- table = default_table;
- }
-
- hash = (guint) accelerator_key;
- entries = table->entries[hash];
-
- while (entries)
- {
- entry = entries->data;
-
- if ((entry->modifiers & table->modifier_mask) ==
- (accelerator_mods & table->modifier_mask))
- {
- gtk_signal_emit (entry->object, entry->signal_id);
- return TRUE;
- }
-
- entries = entries->next;
- }
-
- if (!isupper (hash))
- {
- hash = toupper (hash);
- entries = table->entries[hash];
-
- while (entries)
- {
- entry = entries->data;
-
- if (((entry->modifiers & table->modifier_mask) ==
- (accelerator_mods & table->modifier_mask)) &&
- (GTK_IS_WIDGET (entry->object) &&
- GTK_WIDGET_SENSITIVE (entry->object)))
- {
- gtk_signal_emit (entry->object, entry->signal_id);
- return TRUE;
- }
-
- entries = entries->next;
- }
- }
-
- return FALSE;
-}
-
-void
-gtk_accelerator_table_set_mod_mask (GtkAcceleratorTable *table,
- guint8 modifier_mask)
-{
- if (table == NULL)
- {
- gtk_accelerator_table_default_mod_mask = modifier_mask;
- }
- else
- {
- table->modifier_mask = modifier_mask;
- }
-}
-
-static void
-gtk_accelerator_table_init (GtkAcceleratorTable *table)
-{
- gint i;
-
- g_return_if_fail (table != NULL);
-
- for (i = 0; i < 256; i++)
- table->entries[i] = NULL;
-
- table->ref_count = 1;
- table->modifier_mask = gtk_accelerator_table_default_mod_mask;
-}
-
-static void
-gtk_accelerator_table_clean (GtkAcceleratorTable *table)
-{
- GtkAcceleratorEntry *entry;
- GList *entries;
- gint i;
-
- g_return_if_fail (table != NULL);
-
- for (i = 0; i < 256; i++)
- {
- entries = table->entries[i];
- while (entries)
- {
- entry = entries->data;
- entries = entries->next;
-
- g_free (entry);
- }
-
- g_list_free (table->entries[i]);
- table->entries[i] = NULL;
- }
-}
diff --git a/gtk/gtkaccelerator.h b/gtk/gtkaccelerator.h
deleted file mode 100644
index 35fdc2d261..0000000000
--- a/gtk/gtkaccelerator.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_ACCELERATOR_H__
-#define __GTK_ACCELERATOR_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkobject.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-typedef struct _GtkAcceleratorTable GtkAcceleratorTable;
-
-struct _GtkAcceleratorTable
-{
- GList *entries[256];
- gint ref_count;
- guint8 modifier_mask;
-};
-
-
-/* Accelerator tables.
- */
-GtkAcceleratorTable* gtk_accelerator_table_new (void);
-GtkAcceleratorTable* gtk_accelerator_table_find (GtkObject *object,
- const gchar *signal_name,
- guchar accelerator_key,
- guint8 accelerator_mods);
-
-GtkAcceleratorTable *gtk_accelerator_table_ref (GtkAcceleratorTable *table);
-void gtk_accelerator_table_unref (GtkAcceleratorTable *table);
-void gtk_accelerator_table_install (GtkAcceleratorTable *table,
- GtkObject *object,
- const gchar *signal_name,
- guchar accelerator_key,
- guint8 accelerator_mods);
-void gtk_accelerator_table_remove (GtkAcceleratorTable *table,
- GtkObject *object,
- const gchar *signal_name);
-gint gtk_accelerator_table_check (GtkAcceleratorTable *table,
- const guchar accelerator_key,
- guint8 accelerator_mods);
-
-void gtk_accelerator_table_set_mod_mask (GtkAcceleratorTable *table,
- guint8 modifier_mask);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_ACCELERATOR_H__ */
diff --git a/gtk/gtkadjustment.c b/gtk/gtkadjustment.c
deleted file mode 100644
index 104af6f2d6..0000000000
--- a/gtk/gtkadjustment.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkadjustment.h"
-#include "gtksignal.h"
-
-
-enum {
- CHANGED,
- VALUE_CHANGED,
- LAST_SIGNAL
-};
-
-
-static void gtk_adjustment_class_init (GtkAdjustmentClass *klass);
-static void gtk_adjustment_init (GtkAdjustment *adjustment);
-
-
-static guint adjustment_signals[LAST_SIGNAL] = { 0 };
-
-
-guint
-gtk_adjustment_get_type ()
-{
- static guint adjustment_type = 0;
-
- if (!adjustment_type)
- {
- GtkTypeInfo adjustment_info =
- {
- "GtkAdjustment",
- sizeof (GtkAdjustment),
- sizeof (GtkAdjustmentClass),
- (GtkClassInitFunc) gtk_adjustment_class_init,
- (GtkObjectInitFunc) gtk_adjustment_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- adjustment_type = gtk_type_unique (gtk_data_get_type (), &adjustment_info);
- }
-
- return adjustment_type;
-}
-
-static void
-gtk_adjustment_class_init (GtkAdjustmentClass *class)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass*) class;
-
- adjustment_signals[CHANGED] =
- gtk_signal_new ("changed",
- GTK_RUN_FIRST | GTK_RUN_NO_RECURSE,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkAdjustmentClass, changed),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
- adjustment_signals[VALUE_CHANGED] =
- gtk_signal_new ("value_changed",
- GTK_RUN_FIRST | GTK_RUN_NO_RECURSE,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkAdjustmentClass, value_changed),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, adjustment_signals, LAST_SIGNAL);
-
- class->changed = NULL;
- class->value_changed = NULL;
-}
-
-static void
-gtk_adjustment_init (GtkAdjustment *adjustment)
-{
- adjustment->value = 0.0;
- adjustment->lower = 0.0;
- adjustment->upper = 0.0;
- adjustment->step_increment = 0.0;
- adjustment->page_increment = 0.0;
- adjustment->page_size = 0.0;
-}
-
-GtkObject*
-gtk_adjustment_new (gfloat value,
- gfloat lower,
- gfloat upper,
- gfloat step_increment,
- gfloat page_increment,
- gfloat page_size)
-{
- GtkAdjustment *adjustment;
-
- adjustment = gtk_type_new (gtk_adjustment_get_type ());
-
- adjustment->value = value;
- adjustment->lower = lower;
- adjustment->upper = upper;
- adjustment->step_increment = step_increment;
- adjustment->page_increment = page_increment;
- adjustment->page_size = page_size;
-
- return GTK_OBJECT (adjustment);
-}
-
-void
-gtk_adjustment_set_value (GtkAdjustment *adjustment,
- gfloat value)
-{
- g_return_if_fail (adjustment != NULL);
- g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
-
- adjustment->value = CLAMP (value, adjustment->lower, adjustment->upper);
-
- gtk_signal_emit_by_name (GTK_OBJECT (adjustment), "value_changed");
-}
diff --git a/gtk/gtkadjustment.h b/gtk/gtkadjustment.h
deleted file mode 100644
index b2bb1577b9..0000000000
--- a/gtk/gtkadjustment.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_ADJUSTMENT_H__
-#define __GTK_ADJUSTMENT_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkdata.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_ADJUSTMENT(obj) GTK_CHECK_CAST (obj, gtk_adjustment_get_type (), GtkAdjustment)
-#define GTK_ADJUSTMENT_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_adjustment_get_type (), GtkAdjustmentClass)
-#define GTK_IS_ADJUSTMENT(obj) GTK_CHECK_TYPE (obj, gtk_adjustment_get_type ())
-
-
-typedef struct _GtkAdjustment GtkAdjustment;
-typedef struct _GtkAdjustmentClass GtkAdjustmentClass;
-
-struct _GtkAdjustment
-{
- GtkData data;
-
- gfloat lower;
- gfloat upper;
- gfloat value;
- gfloat step_increment;
- gfloat page_increment;
- gfloat page_size;
-};
-
-struct _GtkAdjustmentClass
-{
- GtkDataClass parent_class;
-
- void (* changed) (GtkAdjustment *adjustment);
- void (* value_changed) (GtkAdjustment *adjustment);
-};
-
-
-guint gtk_adjustment_get_type (void);
-GtkObject* gtk_adjustment_new (gfloat value,
- gfloat lower,
- gfloat upper,
- gfloat step_increment,
- gfloat page_increment,
- gfloat page_size);
-void gtk_adjustment_set_value (GtkAdjustment *adjustment,
- gfloat value);
-
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_ADJUSTMENT_H__ */
diff --git a/gtk/gtkalignment.c b/gtk/gtkalignment.c
deleted file mode 100644
index 2ea50ed587..0000000000
--- a/gtk/gtkalignment.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkalignment.h"
-
-
-static void gtk_alignment_class_init (GtkAlignmentClass *klass);
-static void gtk_alignment_init (GtkAlignment *alignment);
-static void gtk_alignment_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_alignment_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-
-
-guint
-gtk_alignment_get_type ()
-{
- static guint alignment_type = 0;
-
- if (!alignment_type)
- {
- GtkTypeInfo alignment_info =
- {
- "GtkAlignment",
- sizeof (GtkAlignment),
- sizeof (GtkAlignmentClass),
- (GtkClassInitFunc) gtk_alignment_class_init,
- (GtkObjectInitFunc) gtk_alignment_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- alignment_type = gtk_type_unique (gtk_bin_get_type (), &alignment_info);
- }
-
- return alignment_type;
-}
-
-static void
-gtk_alignment_class_init (GtkAlignmentClass *class)
-{
- GtkWidgetClass *widget_class;
-
- widget_class = (GtkWidgetClass*) class;
-
- widget_class->size_request = gtk_alignment_size_request;
- widget_class->size_allocate = gtk_alignment_size_allocate;
-}
-
-static void
-gtk_alignment_init (GtkAlignment *alignment)
-{
- GTK_WIDGET_SET_FLAGS (alignment, GTK_NO_WINDOW | GTK_BASIC);
-
- alignment->xalign = 0.5;
- alignment->yalign = 0.5;
- alignment->xscale = 1.0;
- alignment->yscale = 1.0;
-}
-
-GtkWidget*
-gtk_alignment_new (gfloat xalign,
- gfloat yalign,
- gfloat xscale,
- gfloat yscale)
-{
- GtkAlignment *alignment;
-
- alignment = gtk_type_new (gtk_alignment_get_type ());
-
- alignment->xalign = CLAMP (xalign, 0.0, 1.0);
- alignment->yalign = CLAMP (yalign, 0.0, 1.0);
- alignment->xscale = CLAMP (xscale, 0.0, 1.0);
- alignment->yscale = CLAMP (yscale, 0.0, 1.0);
-
- return GTK_WIDGET (alignment);
-}
-
-void
-gtk_alignment_set (GtkAlignment *alignment,
- gfloat xalign,
- gfloat yalign,
- gfloat xscale,
- gfloat yscale)
-{
- g_return_if_fail (alignment != NULL);
- g_return_if_fail (GTK_IS_ALIGNMENT (alignment));
-
- xalign = CLAMP (xalign, 0.0, 1.0);
- yalign = CLAMP (yalign, 0.0, 1.0);
- xscale = CLAMP (xscale, 0.0, 1.0);
- yscale = CLAMP (yscale, 0.0, 1.0);
-
- if ((alignment->xalign != xalign) ||
- (alignment->yalign != yalign) ||
- (alignment->xscale != xscale) ||
- (alignment->yscale != yscale))
- {
- alignment->xalign = xalign;
- alignment->yalign = yalign;
- alignment->xscale = xscale;
- alignment->yscale = yscale;
-
- gtk_widget_size_allocate (GTK_WIDGET (alignment), &(GTK_WIDGET (alignment)->allocation));
- gtk_widget_queue_draw (GTK_WIDGET (alignment));
- }
-}
-
-
-static void
-gtk_alignment_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkAlignment *alignment;
- GtkBin *bin;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_ALIGNMENT (widget));
- g_return_if_fail (requisition != NULL);
-
- alignment = GTK_ALIGNMENT (widget);
- bin = GTK_BIN (widget);
-
- requisition->width = GTK_CONTAINER (widget)->border_width * 2;
- requisition->height = GTK_CONTAINER (widget)->border_width * 2;
-
- if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
- {
- gtk_widget_size_request (bin->child, &bin->child->requisition);
-
- requisition->width += bin->child->requisition.width;
- requisition->height += bin->child->requisition.height;
- }
-}
-
-static void
-gtk_alignment_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkAlignment *alignment;
- GtkBin *bin;
- GtkAllocation child_allocation;
- gint width, height;
- gint x, y;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_ALIGNMENT (widget));
- g_return_if_fail (allocation != NULL);
-
- widget->allocation = *allocation;
- alignment = GTK_ALIGNMENT (widget);
- bin = GTK_BIN (widget);
-
- if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
- {
- x = GTK_CONTAINER (alignment)->border_width;
- y = GTK_CONTAINER (alignment)->border_width;
- width = allocation->width - 2 * x;
- height = allocation->height - 2 * y;
-
- if (width > bin->child->requisition.width)
- child_allocation.width = (bin->child->requisition.width *
- (1.0 - alignment->xscale) +
- width * alignment->xscale);
- else
- child_allocation.width = width;
-
- if (height > bin->child->requisition.height)
- child_allocation.height = (bin->child->requisition.height *
- (1.0 - alignment->yscale) +
- height * alignment->yscale);
- else
- child_allocation.height = height;
-
- child_allocation.x = alignment->xalign * (width - child_allocation.width) + allocation->x + x;
- child_allocation.y = alignment->yalign * (height - child_allocation.height) + allocation->y + y;
-
- gtk_widget_size_allocate (bin->child, &child_allocation);
- }
-}
diff --git a/gtk/gtkalignment.h b/gtk/gtkalignment.h
deleted file mode 100644
index c80ad7f14b..0000000000
--- a/gtk/gtkalignment.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_ALIGNMENT_H__
-#define __GTK_ALIGNMENT_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkbin.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_ALIGNMENT(obj) GTK_CHECK_CAST (obj, gtk_alignment_get_type (), GtkAlignment)
-#define GTK_ALIGNMENT_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_alignment_get_type (), GtkAlignmentClass)
-#define GTK_IS_ALIGNMENT(obj) GTK_CHECK_TYPE (obj, gtk_alignment_get_type ())
-
-
-typedef struct _GtkAlignment GtkAlignment;
-typedef struct _GtkAlignmentClass GtkAlignmentClass;
-
-struct _GtkAlignment
-{
- GtkBin bin;
-
- gfloat xalign;
- gfloat yalign;
- gfloat xscale;
- gfloat yscale;
-};
-
-struct _GtkAlignmentClass
-{
- GtkBinClass parent_class;
-};
-
-
-guint gtk_alignment_get_type (void);
-GtkWidget* gtk_alignment_new (gfloat xalign,
- gfloat yalign,
- gfloat xscale,
- gfloat yscale);
-void gtk_alignment_set (GtkAlignment *alignment,
- gfloat xalign,
- gfloat yalign,
- gfloat xscale,
- gfloat yscale);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_ALIGNMENT_H__ */
diff --git a/gtk/gtkarrow.c b/gtk/gtkarrow.c
deleted file mode 100644
index 5fb53f5e76..0000000000
--- a/gtk/gtkarrow.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkarrow.h"
-
-
-#define MIN_ARROW_SIZE 11
-
-
-static void gtk_arrow_class_init (GtkArrowClass *klass);
-static void gtk_arrow_init (GtkArrow *arrow);
-static gint gtk_arrow_expose (GtkWidget *widget,
- GdkEventExpose *event);
-
-
-guint
-gtk_arrow_get_type ()
-{
- static guint arrow_type = 0;
-
- if (!arrow_type)
- {
- GtkTypeInfo arrow_info =
- {
- "GtkArrow",
- sizeof (GtkArrow),
- sizeof (GtkArrowClass),
- (GtkClassInitFunc) gtk_arrow_class_init,
- (GtkObjectInitFunc) gtk_arrow_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- arrow_type = gtk_type_unique (gtk_misc_get_type (), &arrow_info);
- }
-
- return arrow_type;
-}
-
-static void
-gtk_arrow_class_init (GtkArrowClass *class)
-{
- GtkWidgetClass *widget_class;
-
- widget_class = (GtkWidgetClass*) class;
-
- widget_class->expose_event = gtk_arrow_expose;
-}
-
-static void
-gtk_arrow_init (GtkArrow *arrow)
-{
- GTK_WIDGET_SET_FLAGS (arrow, GTK_NO_WINDOW);
-
- arrow->arrow_type = GTK_ARROW_RIGHT;
- arrow->shadow_type = GTK_SHADOW_OUT;
-}
-
-GtkWidget*
-gtk_arrow_new (GtkArrowType arrow_type,
- GtkShadowType shadow_type)
-{
- GtkArrow *arrow;
-
- arrow = gtk_type_new (gtk_arrow_get_type ());
-
- GTK_WIDGET (arrow)->requisition.width = MIN_ARROW_SIZE + GTK_MISC (arrow)->xpad * 2;
- GTK_WIDGET (arrow)->requisition.height = MIN_ARROW_SIZE + GTK_MISC (arrow)->ypad * 2;
-
- arrow->arrow_type = arrow_type;
- arrow->shadow_type = shadow_type;
-
- return GTK_WIDGET (arrow);
-}
-
-void
-gtk_arrow_set (GtkArrow *arrow,
- GtkArrowType arrow_type,
- GtkShadowType shadow_type)
-{
- g_return_if_fail (arrow != NULL);
- g_return_if_fail (GTK_IS_ARROW (arrow));
-
- if (((GtkArrowType) arrow->arrow_type != arrow_type) ||
- ((GtkShadowType) arrow->shadow_type != shadow_type))
- {
- arrow->arrow_type = arrow_type;
- arrow->shadow_type = shadow_type;
-
- if (GTK_WIDGET_DRAWABLE (arrow))
- {
- gdk_window_clear_area (GTK_WIDGET (arrow)->window,
- GTK_WIDGET (arrow)->allocation.x + 1,
- GTK_WIDGET (arrow)->allocation.y + 1,
- GTK_WIDGET (arrow)->allocation.width - 2,
- GTK_WIDGET (arrow)->allocation.height - 2);
- gtk_widget_queue_draw (GTK_WIDGET (arrow));
- }
- }
-}
-
-
-static gint
-gtk_arrow_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkArrow *arrow;
- GtkMisc *misc;
- GtkShadowType shadow_type;
- gint width, height;
- gint x, y;
- gint extent;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_ARROW (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- arrow = GTK_ARROW (widget);
- misc = GTK_MISC (widget);
-
- width = widget->allocation.width - misc->xpad * 2;
- height = widget->allocation.height - misc->ypad * 2;
- extent = MIN (width, height);
-
- x = ((widget->allocation.x + misc->xpad) * (1.0 - misc->xalign) +
- (widget->allocation.x + widget->allocation.width - extent - misc->ypad) * misc->xalign);
- y = ((widget->allocation.y + misc->ypad) * (1.0 - misc->yalign) +
- (widget->allocation.y + widget->allocation.height - extent - misc->ypad) * misc->yalign);
-
- shadow_type = arrow->shadow_type;
-
- if (widget->state == GTK_STATE_ACTIVE)
- {
- if (shadow_type == GTK_SHADOW_IN)
- shadow_type = GTK_SHADOW_OUT;
- else if (shadow_type == GTK_SHADOW_OUT)
- shadow_type = GTK_SHADOW_IN;
- else if (shadow_type == GTK_SHADOW_ETCHED_IN)
- shadow_type = GTK_SHADOW_ETCHED_OUT;
- else if (shadow_type == GTK_SHADOW_ETCHED_OUT)
- shadow_type = GTK_SHADOW_ETCHED_IN;
- }
-
- gtk_draw_arrow (widget->style, widget->window,
- widget->state, shadow_type, arrow->arrow_type, TRUE,
- x, y, extent, extent);
- }
-
- return FALSE;
-}
diff --git a/gtk/gtkarrow.h b/gtk/gtkarrow.h
deleted file mode 100644
index 5a2edb0f5d..0000000000
--- a/gtk/gtkarrow.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_ARROW_H__
-#define __GTK_ARROW_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkmisc.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_ARROW(obj) GTK_CHECK_CAST (obj, gtk_arrow_get_type (), GtkArrow)
-#define GTK_ARROW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_arrow_get_type (), GtkArrowClass)
-#define GTK_IS_ARROW(obj) GTK_CHECK_TYPE (obj, gtk_arrow_get_type ())
-
-
-typedef struct _GtkArrow GtkArrow;
-typedef struct _GtkArrowClass GtkArrowClass;
-
-struct _GtkArrow
-{
- GtkMisc misc;
-
- gint16 arrow_type;
- gint16 shadow_type;
-};
-
-struct _GtkArrowClass
-{
- GtkMiscClass parent_class;
-};
-
-
-guint gtk_arrow_get_type (void);
-GtkWidget* gtk_arrow_new (GtkArrowType arrow_type,
- GtkShadowType shadow_type);
-void gtk_arrow_set (GtkArrow *arrow,
- GtkArrowType arrow_type,
- GtkShadowType shadow_type);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_ARROW_H__ */
diff --git a/gtk/gtkaspectframe.c b/gtk/gtkaspectframe.c
deleted file mode 100644
index fd05844f1a..0000000000
--- a/gtk/gtkaspectframe.c
+++ /dev/null
@@ -1,345 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * GtkAspectFrame: Ensure that the child window has a specified aspect ratio
- * or, if obey_child, has the same aspect ratio as its requested size
- *
- * Copyright Owen Taylor 4/9/97
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkaspectframe.h"
-
-static void gtk_aspect_frame_class_init (GtkAspectFrameClass *klass);
-static void gtk_aspect_frame_init (GtkAspectFrame *aspect_frame);
-static void gtk_aspect_frame_draw (GtkWidget *widget,
- GdkRectangle *area);
-static void gtk_aspect_frame_paint (GtkWidget *widget,
- GdkRectangle *area);
-static gint gtk_aspect_frame_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static void gtk_aspect_frame_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-
-#define MAX_RATIO 10000.0
-#define MIN_RATIO 0.0001
-
-guint
-gtk_aspect_frame_get_type ()
-{
- static guint aspect_frame_type = 0;
-
- if (!aspect_frame_type)
- {
- GtkTypeInfo aspect_frame_info =
- {
- "GtkAspectFrame",
- sizeof (GtkAspectFrame),
- sizeof (GtkAspectFrameClass),
- (GtkClassInitFunc) gtk_aspect_frame_class_init,
- (GtkObjectInitFunc) gtk_aspect_frame_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- aspect_frame_type = gtk_type_unique (gtk_frame_get_type (), &aspect_frame_info);
- }
-
- return aspect_frame_type;
-}
-
-static void
-gtk_aspect_frame_class_init (GtkAspectFrameClass *class)
-{
- GtkWidgetClass *widget_class;
-
- widget_class = (GtkWidgetClass*) class;
-
- widget_class->draw = gtk_aspect_frame_draw;
- widget_class->expose_event = gtk_aspect_frame_expose;
- widget_class->size_allocate = gtk_aspect_frame_size_allocate;
-}
-
-static void
-gtk_aspect_frame_init (GtkAspectFrame *aspect_frame)
-{
- aspect_frame->xalign = 0.5;
- aspect_frame->yalign = 0.5;
- aspect_frame->ratio = 1.0;
- aspect_frame->obey_child = 1;
- aspect_frame->center_allocation.x = -1;
- aspect_frame->center_allocation.y = -1;
- aspect_frame->center_allocation.width = 1;
- aspect_frame->center_allocation.height = 1;
-}
-
-GtkWidget*
-gtk_aspect_frame_new (const gchar *label,
- gfloat xalign,
- gfloat yalign,
- gfloat ratio,
- gint obey_child)
-{
- GtkAspectFrame *aspect_frame;
-
- aspect_frame = gtk_type_new (gtk_aspect_frame_get_type ());
-
- aspect_frame->xalign = CLAMP (xalign, 0.0, 1.0);
- aspect_frame->yalign = CLAMP (yalign, 0.0, 1.0);
- aspect_frame->ratio = CLAMP (ratio, MIN_RATIO, MAX_RATIO);
- aspect_frame->obey_child = obey_child;
-
- gtk_frame_set_label (GTK_FRAME(aspect_frame), label);
-
- return GTK_WIDGET (aspect_frame);
-}
-
-void
-gtk_aspect_frame_set (GtkAspectFrame *aspect_frame,
- gfloat xalign,
- gfloat yalign,
- gfloat ratio,
- gint obey_child)
-{
- g_return_if_fail (aspect_frame != NULL);
- g_return_if_fail (GTK_IS_ASPECT_FRAME (aspect_frame));
-
- xalign = CLAMP (xalign, 0.0, 1.0);
- yalign = CLAMP (yalign, 0.0, 1.0);
- ratio = CLAMP (ratio, MIN_RATIO, MAX_RATIO);
-
- if ((aspect_frame->xalign != xalign) ||
- (aspect_frame->yalign != yalign) ||
- (aspect_frame->ratio != ratio) ||
- (aspect_frame->obey_child != obey_child))
- {
- GtkWidget *widget = GTK_WIDGET(aspect_frame);
-
- aspect_frame->xalign = xalign;
- aspect_frame->yalign = yalign;
- aspect_frame->ratio = ratio;
- aspect_frame->obey_child = obey_child;
-
- if (GTK_WIDGET_DRAWABLE(widget))
- gdk_window_clear_area (widget->window,
- widget->allocation.x,
- widget->allocation.y,
- widget->allocation.width,
- widget->allocation.height);
-
- gtk_widget_queue_resize (widget);
- }
-}
-
-static void
-gtk_aspect_frame_paint (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkFrame *frame;
- gint height_extra;
- gint label_area_width;
- gint x, y;
- GtkAllocation *allocation;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_ASPECT_FRAME (widget));
- g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- frame = GTK_FRAME (widget);
- allocation = &GTK_ASPECT_FRAME(widget)->center_allocation;
-
- height_extra = frame->label_height - widget->style->klass->xthickness;
- height_extra = MAX (height_extra, 0);
-
- x = GTK_CONTAINER (frame)->border_width;
- y = GTK_CONTAINER (frame)->border_width;
-
- gtk_draw_shadow (widget->style, widget->window,
- GTK_STATE_NORMAL, frame->shadow_type,
- allocation->x + x,
- allocation->y + y + height_extra / 2,
- allocation->width - x * 2,
- allocation->height - y * 2 - height_extra / 2);
-
- if (frame->label)
- {
- label_area_width = (allocation->width +
- GTK_CONTAINER (frame)->border_width * 2 -
- widget->style->klass->xthickness * 2);
-
- x = ((label_area_width - frame->label_width) * frame->label_xalign +
- GTK_CONTAINER (frame)->border_width + widget->style->klass->xthickness);
- y = (GTK_CONTAINER (frame)->border_width + widget->style->font->ascent);
-
- gdk_window_clear_area (widget->window,
- allocation->x + x + 2,
- allocation->y + GTK_CONTAINER (frame)->border_width,
- frame->label_width - 4, frame->label_height);
- gtk_draw_string (widget->style, widget->window, GTK_WIDGET_STATE (widget),
- allocation->x + x + 3,
- allocation->y + y,
- frame->label);
- }
- }
-}
-
-/* the only modification to the next two routines is to call
- gtk_aspect_frame_paint instead of gtk_frame_paint */
-
-static void
-gtk_aspect_frame_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkBin *bin;
- GdkRectangle child_area;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_ASPECT_FRAME (widget));
- g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- bin = GTK_BIN (widget);
-
- gtk_aspect_frame_paint (widget, area);
-
- if (bin->child && gtk_widget_intersect (bin->child, area, &child_area))
- gtk_widget_draw (bin->child, &child_area);
- }
-}
-
-static gint
-gtk_aspect_frame_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkBin *bin;
- GdkEventExpose child_event;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_ASPECT_FRAME (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- bin = GTK_BIN (widget);
-
- gtk_aspect_frame_paint (widget, &event->area);
-
- child_event = *event;
- if (bin->child &&
- GTK_WIDGET_NO_WINDOW (bin->child) &&
- gtk_widget_intersect (bin->child, &event->area, &child_event.area))
- gtk_widget_event (bin->child, (GdkEvent*) &child_event);
- }
-
- return FALSE;
-}
-
-static void
-gtk_aspect_frame_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkFrame *frame;
- GtkAspectFrame *aspect_frame;
- GtkBin *bin;
-
- GtkAllocation child_allocation;
- gint x,y;
- gint width,height;
- gdouble ratio;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_ASPECT_FRAME (widget));
- g_return_if_fail (allocation != NULL);
-
- aspect_frame = GTK_ASPECT_FRAME (widget);
- frame = GTK_FRAME (widget);
- bin = GTK_BIN (widget);
-
- if (GTK_WIDGET_DRAWABLE (widget) &&
- ((widget->allocation.x != allocation->x) ||
- (widget->allocation.y != allocation->y) ||
- (widget->allocation.width != allocation->width) ||
- (widget->allocation.height != allocation->height)) &&
- (widget->allocation.width != 0) &&
- (widget->allocation.height != 0))
- gdk_window_clear_area (widget->window,
- widget->allocation.x,
- widget->allocation.y,
- widget->allocation.width,
- widget->allocation.height);
-
- widget->allocation = *allocation;
-
- if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
- {
- if (aspect_frame->obey_child)
- {
- if (bin->child->requisition.height != 0)
- {
- ratio = (gdouble)bin->child->requisition.width /
- bin->child->requisition.height;
- if (ratio < MIN_RATIO) ratio = MIN_RATIO;
- }
- else
- if (bin->child->requisition.height != 0)
- ratio = MAX_RATIO;
- else
- ratio = 1.0;
- }
- else
- ratio = aspect_frame->ratio;
-
- x = (GTK_CONTAINER (frame)->border_width +
- GTK_WIDGET (frame)->style->klass->xthickness);
- width = allocation->width - x * 2;
-
- y = (GTK_CONTAINER (frame)->border_width +
- MAX (frame->label_height, GTK_WIDGET (frame)->style->klass->ythickness));
- height = (allocation->height - y -
- GTK_CONTAINER (frame)->border_width -
- GTK_WIDGET (frame)->style->klass->ythickness);
-
- /* make sure we don't allocate a negative width or height,
- * since that will be cast to a (very big) guint16 */
- width = MAX (0, width);
- height = MAX (0, height);
-
- if (ratio * height > width)
- {
- child_allocation.width = width;
- child_allocation.height = width/ratio + 0.5;
- }
- else
- {
- child_allocation.width = ratio*height + 0.5;
- child_allocation.height = height;
- }
-
- child_allocation.x = aspect_frame->xalign * (width - child_allocation.width) + allocation->x + x;
- child_allocation.y = aspect_frame->yalign * (height - child_allocation.height) + allocation->y + y;
-
- aspect_frame->center_allocation.width = child_allocation.width + 2*x;
- aspect_frame->center_allocation.x = child_allocation.x - x;
- aspect_frame->center_allocation.height = child_allocation.height + y +
- GTK_CONTAINER (frame)->border_width +
- GTK_WIDGET (frame)->style->klass->ythickness;
- aspect_frame->center_allocation.y = child_allocation.y - y;
-
- gtk_widget_size_allocate (bin->child, &child_allocation);
- }
-}
diff --git a/gtk/gtkaspectframe.h b/gtk/gtkaspectframe.h
deleted file mode 100644
index 07f08a4cce..0000000000
--- a/gtk/gtkaspectframe.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_ASPECT_FRAME_H__
-#define __GTK_ASPECT_FRAME_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkbin.h>
-#include <gtk/gtkframe.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_ASPECT_FRAME(obj) ((GtkAspectFrame*) obj)
-#define GTK_ASPECT_FRAME_CLASS(obj) ((GtkAspectFrameClass*) GTK_OBJECT_CLASS (obj))
-#define GTK_IS_ASPECT_FRAME(obj) (gtk_type_is_a (GTK_WIDGET_TYPE (obj), gtk_aspect_frame_get_type ()))
-
-
-typedef struct _GtkAspectFrame GtkAspectFrame;
-typedef struct _GtkAspectFrameClass GtkAspectFrameClass;
-
-struct _GtkAspectFrame
-{
- GtkFrame frame;
-
- gfloat xalign;
- gfloat yalign;
- gfloat ratio;
- gint obey_child;
-
- GtkAllocation center_allocation;
-};
-
-struct _GtkAspectFrameClass
-{
- GtkBinClass parent_class;
-};
-
-
-guint gtk_aspect_frame_get_type (void);
-GtkWidget* gtk_aspect_frame_new (const gchar *label,
- gfloat xalign,
- gfloat yalign,
- gfloat ratio,
- gint obey_child);
-void gtk_aspect_frame_set (GtkAspectFrame *aspect_frame,
- gfloat xalign,
- gfloat yalign,
- gfloat ratio,
- gint obey_child);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_ASPECT_FRAME_H__ */
diff --git a/gtk/gtkbbox.c b/gtk/gtkbbox.c
deleted file mode 100644
index e0ae2df887..0000000000
--- a/gtk/gtkbbox.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkbbox.h"
-
-
-static void gtk_button_box_class_init (GtkButtonBoxClass *klass);
-static void gtk_button_box_init (GtkButtonBox *box);
-
-
-static gint default_child_min_width = 85;
-static gint default_child_min_height = 27;
-static gint default_child_ipad_x = 7;
-static gint default_child_ipad_y = 0;
-
-
-guint
-gtk_button_box_get_type ()
-{
- static guint button_box_type = 0;
-
- if (!button_box_type)
- {
- GtkTypeInfo button_box_info =
- {
- "GtkButtonBox",
- sizeof (GtkButtonBox),
- sizeof (GtkButtonBoxClass),
- (GtkClassInitFunc) gtk_button_box_class_init,
- (GtkObjectInitFunc) gtk_button_box_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- button_box_type = gtk_type_unique (gtk_box_get_type (), &button_box_info);
- }
-
- return button_box_type;
-}
-
-static void
-gtk_button_box_class_init (GtkButtonBoxClass *class)
-{
- GtkWidgetClass *widget_class;
-
- widget_class = (GtkWidgetClass*) class;
-}
-
-static void
-gtk_button_box_init (GtkButtonBox *button_box)
-{
- button_box->spacing = GTK_BUTTONBOX_DEFAULT;
- button_box->child_min_width = GTK_BUTTONBOX_DEFAULT;
- button_box->child_min_height = GTK_BUTTONBOX_DEFAULT;
- button_box->child_ipad_x = GTK_BUTTONBOX_DEFAULT;
- button_box->child_ipad_y = GTK_BUTTONBOX_DEFAULT;
- button_box->layout_style = GTK_BUTTONBOX_DEFAULT_STYLE;
-}
-
-
-/* set default values for child size and child internal padding */
-/* default spacing is in defined in subclasses */
-
-void gtk_button_box_set_child_size_default (gint width, gint height)
-{
- default_child_min_width = width;
- default_child_min_height = height;
-}
-
-void gtk_button_box_set_child_ipadding_default (gint ipad_x, gint ipad_y)
-{
- default_child_ipad_x = ipad_x;
- default_child_ipad_y = ipad_y;
-}
-
-/* get default values for child size and child internal padding */
-
-void gtk_button_box_get_child_size_default (gint *width, gint *height)
-{
- *width = default_child_min_width;
- *height = default_child_min_height;
-}
-
-void gtk_button_box_get_child_ipadding_default (gint *ipad_x, gint *ipad_y)
-{
- *ipad_x = default_child_ipad_x;
- *ipad_y = default_child_ipad_y;
-}
-
-/* set per widget values for spacing, child size and child internal padding */
-
-void gtk_button_box_set_spacing (GtkButtonBox *widget, gint spacing)
-{
- widget->spacing = spacing;
-}
-
-void gtk_button_box_set_child_size (GtkButtonBox *widget, gint width, gint height)
-{
- widget->child_min_width = width;
- widget->child_min_height = height;
-}
-
-void gtk_button_box_set_child_ipadding (GtkButtonBox *widget,
- gint ipad_x, gint ipad_y)
-{
- widget->child_ipad_x = ipad_x;
- widget->child_ipad_y = ipad_y;
-}
-
-void gtk_button_box_set_layout (GtkButtonBox *widget,
- GtkButtonBoxStyle layout_style)
-{
- g_return_if_fail (layout_style >= GTK_BUTTONBOX_DEFAULT_STYLE &&
- layout_style <= GTK_BUTTONBOX_END);
-
- widget->layout_style = layout_style;
-}
-
-
-/* get per widget values for spacing, child size and child internal padding */
-
-gint gtk_button_box_get_spacing (GtkButtonBox *widget)
-{
- return widget->spacing;
-}
-
-void gtk_button_box_get_child_size (GtkButtonBox *widget,
- gint *width, gint *height)
-{
- *width = widget->child_min_width;
- *height = widget->child_min_height;
-}
-
-void gtk_button_box_get_child_ipadding (GtkButtonBox *widget,
- gint* ipad_x, gint *ipad_y)
-{
- *ipad_x = widget->child_ipad_x;
- *ipad_y = widget->child_ipad_y;
-}
-
-GtkButtonBoxStyle gtk_button_box_get_layout (GtkButtonBox *widget)
-{
- return widget->layout_style;
-}
-
-
-
-/* Ask children how much space they require and round up
- to match minimum size and internal padding.
- Returns the size each single child should have. */
-void
-gtk_button_box_child_requisition (GtkWidget *widget,
- int *nvis_children,
- int *width,
- int *height)
-{
- GtkButtonBox *bbox;
- GtkBoxChild *child;
- GList *children;
- gint nchildren;
- gint needed_width;
- gint needed_height;
- GtkRequisition child_requisition;
- gint ipad_w;
- gint ipad_h;
- gint width_default;
- gint height_default;
- gint ipad_x_default;
- gint ipad_y_default;
-
- gint child_min_width;
- gint child_min_height;
- gint ipad_x;
- gint ipad_y;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_BUTTON_BOX (widget));
-
- bbox = GTK_BUTTON_BOX (widget);
-
- gtk_button_box_get_child_size_default (&width_default, &height_default);
- gtk_button_box_get_child_ipadding_default (&ipad_x_default, &ipad_y_default);
-
- child_min_width = bbox->child_min_width != GTK_BUTTONBOX_DEFAULT
- ? bbox->child_min_width : width_default;
- child_min_height = bbox->child_min_height !=GTK_BUTTONBOX_DEFAULT
- ? bbox->child_min_height : height_default;
- ipad_x = bbox->child_ipad_x != GTK_BUTTONBOX_DEFAULT
- ? bbox->child_ipad_x : ipad_x_default;
- ipad_y = bbox->child_ipad_y != GTK_BUTTONBOX_DEFAULT
- ? bbox->child_ipad_y : ipad_y_default;
-
- nchildren = 0;
- children = GTK_BOX(bbox)->children;
- needed_width = child_min_width;
- needed_height = child_min_height;
- ipad_w = ipad_x * 2;
- ipad_h = ipad_y * 2;
-
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child->widget))
- {
- nchildren += 1;
- gtk_widget_size_request (child->widget, &child_requisition);
- if (child_requisition.width + ipad_w > needed_width)
- needed_width = child_requisition.width + ipad_w;
- if (child_requisition.height + ipad_h > needed_height)
- needed_height = child_requisition.height + ipad_h;
- }
- }
-
- *nvis_children = nchildren;
- *width = needed_width;
- *height = needed_height;
-}
diff --git a/gtk/gtkbbox.h b/gtk/gtkbbox.h
deleted file mode 100644
index 6b454978a9..0000000000
--- a/gtk/gtkbbox.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_BUTTON_BOX_H__
-#define __GTK_BUTTON_BOX_H__
-
-#include "gtkbox.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_BUTTON_BOX(obj) GTK_CHECK_CAST (obj, gtk_button_box_get_type (), GtkButtonBox)
-#define GTK_BUTTON_BOX_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_button_box_get_type (), GtkButtonBoxClass)
-#define GTK_IS_BUTTON_BOX(obj) GTK_CHECK_TYPE (obj, gtk_button_box_get_type ())
-
-
-#define GTK_BUTTONBOX_DEFAULT -1
-
-typedef enum {
- GTK_BUTTONBOX_DEFAULT_STYLE,
- GTK_BUTTONBOX_SPREAD,
- GTK_BUTTONBOX_EDGE,
- GTK_BUTTONBOX_START,
- GTK_BUTTONBOX_END
-} GtkButtonBoxStyle;
-
-typedef struct _GtkButtonBox GtkButtonBox;
-typedef struct _GtkButtonBoxClass GtkButtonBoxClass;
-
-struct _GtkButtonBox
-{
- GtkBox box;
- gint spacing;
- gint child_min_width;
- gint child_min_height;
- gint child_ipad_x;
- gint child_ipad_y;
- GtkButtonBoxStyle layout_style;
-};
-
-struct _GtkButtonBoxClass
-{
- GtkBoxClass parent_class;
-};
-
-
-guint gtk_button_box_get_type (void);
-
-void gtk_button_box_get_child_size_default (gint *min_width, gint *min_height);
-void gtk_button_box_get_child_ipadding_default (gint *ipad_x, gint *ipad_y);
-
-void gtk_button_box_set_child_size_default (gint min_width, gint min_height);
-void gtk_button_box_set_child_ipadding_default (gint ipad_x, gint ipad_y);
-
-gint gtk_button_box_get_spacing (GtkButtonBox *widget);
-GtkButtonBoxStyle gtk_button_box_get_layout (GtkButtonBox *widget);
-void gtk_button_box_get_child_size (GtkButtonBox *widget,
- gint *min_width, gint *min_height);
-void gtk_button_box_get_child_ipadding (GtkButtonBox *widget, gint *ipad_x, gint *ipad_y);
-
-void gtk_button_box_set_spacing (GtkButtonBox *widget, gint spacing);
-void gtk_button_box_set_layout (GtkButtonBox *widget,
- GtkButtonBoxStyle layout_style);
-void gtk_button_box_set_child_size (GtkButtonBox *widget,
- gint min_width, gint min_height);
-void gtk_button_box_set_child_ipadding (GtkButtonBox *widget, gint ipad_x, gint ipad_y);
-
-
-/* Internal method - do not use. */
-void gtk_button_box_child_requisition (GtkWidget *widget,
- int *nvis_children,
- int *width,
- int *height);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_BUTTON_BOX_H__ */
-
-
diff --git a/gtk/gtkbin.c b/gtk/gtkbin.c
deleted file mode 100644
index aff8043e43..0000000000
--- a/gtk/gtkbin.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkbin.h"
-
-
-static void gtk_bin_class_init (GtkBinClass *klass);
-static void gtk_bin_init (GtkBin *bin);
-static void gtk_bin_map (GtkWidget *widget);
-static void gtk_bin_unmap (GtkWidget *widget);
-static void gtk_bin_draw (GtkWidget *widget,
- GdkRectangle *area);
-static gint gtk_bin_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static void gtk_bin_add (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_bin_remove (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_bin_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data);
-
-
-static GtkContainerClass *parent_class = NULL;
-
-
-guint
-gtk_bin_get_type ()
-{
- static guint bin_type = 0;
-
- if (!bin_type)
- {
- GtkTypeInfo bin_info =
- {
- "GtkBin",
- sizeof (GtkBin),
- sizeof (GtkBinClass),
- (GtkClassInitFunc) gtk_bin_class_init,
- (GtkObjectInitFunc) gtk_bin_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- bin_type = gtk_type_unique (gtk_container_get_type (), &bin_info);
- }
-
- return bin_type;
-}
-
-static void
-gtk_bin_class_init (GtkBinClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GtkObjectClass*) class;
- widget_class = (GtkWidgetClass*) class;
- container_class = (GtkContainerClass*) class;
-
- parent_class = gtk_type_class (gtk_container_get_type ());
-
- widget_class->map = gtk_bin_map;
- widget_class->unmap = gtk_bin_unmap;
- widget_class->draw = gtk_bin_draw;
- widget_class->expose_event = gtk_bin_expose;
-
- container_class->add = gtk_bin_add;
- container_class->remove = gtk_bin_remove;
- container_class->foreach = gtk_bin_foreach;
-}
-
-static void
-gtk_bin_init (GtkBin *bin)
-{
- GTK_WIDGET_SET_FLAGS (bin, GTK_NO_WINDOW);
-
- bin->child = NULL;
-}
-
-
-static void
-gtk_bin_map (GtkWidget *widget)
-{
- GtkBin *bin;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_BIN (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
- bin = GTK_BIN (widget);
-
- if (!GTK_WIDGET_NO_WINDOW (widget))
- gdk_window_show (widget->window);
- else
- gtk_widget_queue_draw (widget);
-
- if (bin->child &&
- GTK_WIDGET_VISIBLE (bin->child) &&
- !GTK_WIDGET_MAPPED (bin->child))
- gtk_widget_map (bin->child);
-}
-
-static void
-gtk_bin_unmap (GtkWidget *widget)
-{
- GtkBin *bin;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_BIN (widget));
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
- bin = GTK_BIN (widget);
-
- if (GTK_WIDGET_NO_WINDOW (widget))
- gdk_window_clear_area (widget->window,
- widget->allocation.x,
- widget->allocation.y,
- widget->allocation.width,
- widget->allocation.height);
- else
- gdk_window_hide (widget->window);
-
- if (bin->child &&
- GTK_WIDGET_VISIBLE (bin->child) &&
- GTK_WIDGET_MAPPED (bin->child))
- gtk_widget_unmap (bin->child);
-}
-
-static void
-gtk_bin_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkBin *bin;
- GdkRectangle child_area;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_BIN (widget));
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget))
- {
- bin = GTK_BIN (widget);
-
- if (bin->child &&
- gtk_widget_intersect (bin->child, area, &child_area))
- gtk_widget_draw (bin->child, &child_area);
- }
-}
-
-static gint
-gtk_bin_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkBin *bin;
- GdkEventExpose child_event;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_BIN (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- bin = GTK_BIN (widget);
-
- child_event = *event;
- if (bin->child &&
- GTK_WIDGET_NO_WINDOW (bin->child) &&
- gtk_widget_intersect (bin->child, &event->area, &child_event.area))
- gtk_widget_event (bin->child, (GdkEvent*) &child_event);
- }
-
- return FALSE;
-}
-
-
-static void
-gtk_bin_add (GtkContainer *container,
- GtkWidget *widget)
-{
- GtkBin *bin;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_BIN (container));
- g_return_if_fail (widget != NULL);
-
- bin = GTK_BIN (container);
-
- if (!bin->child)
- {
- gtk_widget_set_parent (widget, GTK_WIDGET (container));
-
- if (GTK_WIDGET_VISIBLE (widget->parent))
- {
- if (GTK_WIDGET_REALIZED (widget->parent) &&
- !GTK_WIDGET_REALIZED (widget))
- gtk_widget_realize (widget);
-
- if (GTK_WIDGET_MAPPED (widget->parent) &&
- !GTK_WIDGET_MAPPED (widget))
- gtk_widget_map (widget);
- }
-
- bin->child = widget;
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (container))
- gtk_widget_queue_resize (widget);
- }
-}
-
-static void
-gtk_bin_remove (GtkContainer *container,
- GtkWidget *widget)
-{
- GtkBin *bin;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_BIN (container));
- g_return_if_fail (widget != NULL);
-
- bin = GTK_BIN (container);
-
- if (bin->child == widget)
- {
- gtk_widget_unparent (widget);
- bin->child = NULL;
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (container))
- gtk_widget_queue_resize (GTK_WIDGET (container));
- }
-}
-
-static void
-gtk_bin_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
-{
- GtkBin *bin;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_BIN (container));
- g_return_if_fail (callback != NULL);
-
- bin = GTK_BIN (container);
-
- if (bin->child)
- (* callback) (bin->child, callback_data);
-}
diff --git a/gtk/gtkbin.h b/gtk/gtkbin.h
deleted file mode 100644
index c8676ab849..0000000000
--- a/gtk/gtkbin.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_BIN_H__
-#define __GTK_BIN_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkcontainer.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_BIN(obj) GTK_CHECK_CAST (obj, gtk_bin_get_type (), GtkBin)
-#define GTK_BIN_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_bin_get_type (), GtkBinClass)
-#define GTK_IS_BIN(obj) GTK_CHECK_TYPE (obj, gtk_bin_get_type ())
-
-
-typedef struct _GtkBin GtkBin;
-typedef struct _GtkBinClass GtkBinClass;
-
-struct _GtkBin
-{
- GtkContainer container;
-
- GtkWidget *child;
-};
-
-struct _GtkBinClass
-{
- GtkContainerClass parent_class;
-};
-
-
-guint gtk_bin_get_type (void);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_BIN_H__ */
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
deleted file mode 100644
index dc3a38a652..0000000000
--- a/gtk/gtkbox.c
+++ /dev/null
@@ -1,613 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkbox.h"
-
-enum {
- ARG_0,
- ARG_SPACING,
- ARG_HOMOGENEOUS
-};
-
-static void gtk_box_class_init (GtkBoxClass *klass);
-static void gtk_box_init (GtkBox *box);
-static void gtk_box_get_arg (GtkBox *box,
- GtkArg *arg,
- guint arg_id);
-static void gtk_box_set_arg (GtkBox *box,
- GtkArg *arg,
- guint arg_id);
-static void gtk_box_map (GtkWidget *widget);
-static void gtk_box_unmap (GtkWidget *widget);
-static void gtk_box_draw (GtkWidget *widget,
- GdkRectangle *area);
-static gint gtk_box_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static void gtk_box_add (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_box_remove (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_box_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data);
-
-
-static GtkContainerClass *parent_class = NULL;
-
-
-guint
-gtk_box_get_type ()
-{
- static guint box_type = 0;
-
- if (!box_type)
- {
- GtkTypeInfo box_info =
- {
- "GtkBox",
- sizeof (GtkBox),
- sizeof (GtkBoxClass),
- (GtkClassInitFunc) gtk_box_class_init,
- (GtkObjectInitFunc) gtk_box_init,
- (GtkArgSetFunc) gtk_box_set_arg,
- (GtkArgGetFunc) gtk_box_get_arg,
- };
-
- box_type = gtk_type_unique (gtk_container_get_type (), &box_info);
- }
-
- return box_type;
-}
-
-static void
-gtk_box_class_init (GtkBoxClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GtkObjectClass*) class;
- widget_class = (GtkWidgetClass*) class;
- container_class = (GtkContainerClass*) class;
-
- parent_class = gtk_type_class (gtk_container_get_type ());
-
- gtk_object_add_arg_type ("GtkBox::spacing", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_SPACING);
- gtk_object_add_arg_type ("GtkBox::homogeneous", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HOMOGENEOUS);
-
- widget_class->map = gtk_box_map;
- widget_class->unmap = gtk_box_unmap;
- widget_class->draw = gtk_box_draw;
- widget_class->expose_event = gtk_box_expose;
-
- container_class->add = gtk_box_add;
- container_class->remove = gtk_box_remove;
- container_class->foreach = gtk_box_foreach;
-}
-
-static void
-gtk_box_init (GtkBox *box)
-{
- GTK_WIDGET_SET_FLAGS (box, GTK_NO_WINDOW | GTK_BASIC);
-
- box->children = NULL;
- box->spacing = 0;
- box->homogeneous = FALSE;
-}
-
-static void
-gtk_box_set_arg (GtkBox *box,
- GtkArg *arg,
- guint arg_id)
-{
- switch (arg_id)
- {
- case ARG_SPACING:
- gtk_box_set_spacing (box, GTK_VALUE_INT (*arg));
- break;
- case ARG_HOMOGENEOUS:
- gtk_box_set_homogeneous (box, GTK_VALUE_BOOL (*arg));
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-gtk_box_get_arg (GtkBox *box,
- GtkArg *arg,
- guint arg_id)
-{
- switch (arg_id)
- {
- case ARG_SPACING:
- GTK_VALUE_INT (*arg) = box->spacing;
- break;
- case ARG_HOMOGENEOUS:
- GTK_VALUE_BOOL (*arg) = box->homogeneous;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-void
-gtk_box_pack_start (GtkBox *box,
- GtkWidget *child,
- gint expand,
- gint fill,
- gint padding)
-{
- GtkBoxChild *child_info;
-
- g_return_if_fail (box != NULL);
- g_return_if_fail (GTK_IS_BOX (box));
- g_return_if_fail (child != NULL);
-
- child_info = g_new (GtkBoxChild, 1);
- child_info->widget = child;
- child_info->padding = padding;
- child_info->expand = expand ? TRUE : FALSE;
- child_info->fill = fill ? TRUE : FALSE;
- child_info->pack = GTK_PACK_START;
-
- box->children = g_list_append (box->children, child_info);
-
- gtk_widget_set_parent (child, GTK_WIDGET (box));
-
- if (GTK_WIDGET_VISIBLE (GTK_WIDGET (box)))
- {
- if (GTK_WIDGET_REALIZED (GTK_WIDGET (box)) &&
- !GTK_WIDGET_REALIZED (child))
- gtk_widget_realize (child);
-
- if (GTK_WIDGET_MAPPED (GTK_WIDGET (box)) &&
- !GTK_WIDGET_MAPPED (child))
- gtk_widget_map (child);
- }
-
- if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (box))
- gtk_widget_queue_resize (child);
-}
-
-void
-gtk_box_pack_end (GtkBox *box,
- GtkWidget *child,
- gint expand,
- gint fill,
- gint padding)
-{
- GtkBoxChild *child_info;
-
- g_return_if_fail (box != NULL);
- g_return_if_fail (GTK_IS_BOX (box));
- g_return_if_fail (child != NULL);
-
- child_info = g_new (GtkBoxChild, 1);
- child_info->widget = child;
- child_info->padding = padding;
- child_info->expand = expand ? TRUE : FALSE;
- child_info->fill = fill ? TRUE : FALSE;
- child_info->pack = GTK_PACK_END;
-
- box->children = g_list_append (box->children, child_info);
-
- gtk_widget_set_parent (child, GTK_WIDGET (box));
-
- if (GTK_WIDGET_VISIBLE (GTK_WIDGET (box)))
- {
- if (GTK_WIDGET_REALIZED (GTK_WIDGET (box)) &&
- !GTK_WIDGET_REALIZED (child))
- gtk_widget_realize (child);
-
- if (GTK_WIDGET_MAPPED (GTK_WIDGET (box)) &&
- !GTK_WIDGET_MAPPED (child))
- gtk_widget_map (child);
- }
-
- if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (box))
- gtk_widget_queue_resize (child);
-}
-
-void
-gtk_box_pack_start_defaults (GtkBox *box,
- GtkWidget *child)
-{
- g_return_if_fail (box != NULL);
- g_return_if_fail (GTK_IS_BOX (box));
- g_return_if_fail (child != NULL);
-
- gtk_box_pack_start (box, child, TRUE, TRUE, 0);
-}
-
-void
-gtk_box_pack_end_defaults (GtkBox *box,
- GtkWidget *child)
-{
- g_return_if_fail (box != NULL);
- g_return_if_fail (GTK_IS_BOX (box));
- g_return_if_fail (child != NULL);
-
- gtk_box_pack_end (box, child, TRUE, TRUE, 0);
-}
-
-void
-gtk_box_set_homogeneous (GtkBox *box,
- gint homogeneous)
-{
- g_return_if_fail (box != NULL);
- g_return_if_fail (GTK_IS_BOX (box));
-
- if ((homogeneous ? TRUE : FALSE) != box->homogeneous)
- {
- box->homogeneous = homogeneous ? TRUE : FALSE;
- gtk_widget_queue_resize (GTK_WIDGET (box));
- }
-}
-
-void
-gtk_box_set_spacing (GtkBox *box,
- gint spacing)
-{
- g_return_if_fail (box != NULL);
- g_return_if_fail (GTK_IS_BOX (box));
-
- if (spacing != box->spacing)
- {
- box->spacing = spacing;
- gtk_widget_queue_resize (GTK_WIDGET (box));
- }
-}
-
-void
-gtk_box_reorder_child (GtkBox *box,
- GtkWidget *child,
- guint pos)
-{
- GList *list;
-
- g_return_if_fail (box != NULL);
- g_return_if_fail (GTK_IS_BOX (box));
- g_return_if_fail (child != NULL);
-
- list = box->children;
- while (list)
- {
- GtkBoxChild *child_info;
-
- child_info = list->data;
- if (child_info->widget == child)
- break;
-
- list = list->next;
- }
-
- if (list && box->children->next)
- {
- GList *tmp_list;
-
- if (list->next)
- list->next->prev = list->prev;
- if (list->prev)
- list->prev->next = list->next;
- else
- box->children = list->next;
-
- tmp_list = box->children;
- while (pos && tmp_list->next)
- {
- pos--;
- tmp_list = tmp_list->next;
- }
-
- if (pos)
- {
- tmp_list->next = list;
- list->prev = tmp_list;
- list->next = NULL;
- }
- else
- {
- if (tmp_list->prev)
- tmp_list->prev->next = list;
- else
- box->children = list;
- list->prev = tmp_list->prev;
- tmp_list->prev = list;
- list->next = tmp_list;
- }
-
- if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (box))
- gtk_widget_queue_resize (child);
- }
-}
-
-void
-gtk_box_query_child_packing (GtkBox *box,
- GtkWidget *child,
- gint *expand,
- gint *fill,
- gint *padding,
- GtkPackType *pack_type)
-{
- GList *list;
- GtkBoxChild *child_info;
-
- g_return_if_fail (box != NULL);
- g_return_if_fail (GTK_IS_BOX (box));
- g_return_if_fail (child != NULL);
-
- list = box->children;
- while (list)
- {
- child_info = list->data;
- if (child_info->widget == child)
- break;
-
- list = list->next;
- }
-
- if (list)
- {
- if (expand)
- *expand = child_info->expand;
- if (fill)
- *fill = child_info->fill;
- if (padding)
- *padding = child_info->padding;
- if (pack_type)
- *pack_type = child_info->pack;
- }
-}
-
-void
-gtk_box_set_child_packing (GtkBox *box,
- GtkWidget *child,
- gint expand,
- gint fill,
- gint padding,
- GtkPackType pack_type)
-{
- GList *list;
- GtkBoxChild *child_info;
-
- g_return_if_fail (box != NULL);
- g_return_if_fail (GTK_IS_BOX (box));
- g_return_if_fail (child != NULL);
-
- list = box->children;
- while (list)
- {
- child_info = list->data;
- if (child_info->widget == child)
- break;
-
- list = list->next;
- }
-
- if (list)
- {
- child_info->expand = expand != FALSE;
- child_info->fill = fill != FALSE;
- child_info->padding = padding;
- if (pack_type == GTK_PACK_END)
- child_info->pack = GTK_PACK_END;
- else
- child_info->pack = GTK_PACK_START;
-
- if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (box))
- gtk_widget_queue_resize (child);
- }
-}
-
-static void
-gtk_box_map (GtkWidget *widget)
-{
- GtkBox *box;
- GtkBoxChild *child;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_BOX (widget));
-
- box = GTK_BOX (widget);
- GTK_WIDGET_SET_FLAGS (box, GTK_MAPPED);
-
- children = box->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child->widget) &&
- !GTK_WIDGET_MAPPED (child->widget))
- gtk_widget_map (child->widget);
- }
-}
-
-static void
-gtk_box_unmap (GtkWidget *widget)
-{
- GtkBox *box;
- GtkBoxChild *child;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_BOX (widget));
-
- box = GTK_BOX (widget);
- GTK_WIDGET_UNSET_FLAGS (box, GTK_MAPPED);
-
- children = box->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child->widget) &&
- GTK_WIDGET_MAPPED (child->widget))
- gtk_widget_unmap (child->widget);
- }
-}
-
-static void
-gtk_box_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkBox *box;
- GtkBoxChild *child;
- GdkRectangle child_area;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_BOX (widget));
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- box = GTK_BOX (widget);
-
- children = box->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (gtk_widget_intersect (child->widget, area, &child_area))
- gtk_widget_draw (child->widget, &child_area);
- }
- }
-}
-
-static gint
-gtk_box_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkBox *box;
- GtkBoxChild *child;
- GdkEventExpose child_event;
- GList *children;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_BOX (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- box = GTK_BOX (widget);
-
- child_event = *event;
-
- children = box->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_NO_WINDOW (child->widget) &&
- gtk_widget_intersect (child->widget, &event->area, &child_event.area))
- gtk_widget_event (child->widget, (GdkEvent*) &child_event);
- }
- }
-
- return FALSE;
-}
-
-static void
-gtk_box_add (GtkContainer *container,
- GtkWidget *widget)
-{
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_BOX (container));
- g_return_if_fail (widget != NULL);
-
- gtk_box_pack_start_defaults (GTK_BOX (container), widget);
-}
-
-static void
-gtk_box_remove (GtkContainer *container,
- GtkWidget *widget)
-{
- GtkBox *box;
- GtkBoxChild *child;
- GList *children;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_BOX (container));
- g_return_if_fail (widget != NULL);
-
- box = GTK_BOX (container);
-
- children = box->children;
- while (children)
- {
- child = children->data;
-
- if (child->widget == widget)
- {
- gtk_widget_unparent (widget);
-
- box->children = g_list_remove_link (box->children, children);
- g_list_free (children);
- g_free (child);
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (container))
- gtk_widget_queue_resize (GTK_WIDGET (container));
-
- break;
- }
-
- children = children->next;
- }
-}
-
-static void
-gtk_box_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
-{
- GtkBox *box;
- GtkBoxChild *child;
- GList *children;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_BOX (container));
- g_return_if_fail (callback != NULL);
-
- box = GTK_BOX (container);
-
- children = box->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (child->pack == GTK_PACK_START)
- (* callback) (child->widget, callback_data);
- }
-
- children = g_list_last (box->children);
- while (children)
- {
- child = children->data;
- children = children->prev;
-
- if (child->pack == GTK_PACK_END)
- (* callback) (child->widget, callback_data);
- }
-}
diff --git a/gtk/gtkbox.h b/gtk/gtkbox.h
deleted file mode 100644
index a7931b8a62..0000000000
--- a/gtk/gtkbox.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_BOX_H__
-#define __GTK_BOX_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkcontainer.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_BOX(obj) GTK_CHECK_CAST (obj, gtk_box_get_type (), GtkBox)
-#define GTK_BOX_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_box_get_type (), GtkBoxClass)
-#define GTK_IS_BOX(obj) GTK_CHECK_TYPE (obj, gtk_box_get_type ())
-
-
-typedef struct _GtkBox GtkBox;
-typedef struct _GtkBoxClass GtkBoxClass;
-typedef struct _GtkBoxChild GtkBoxChild;
-
-struct _GtkBox
-{
- GtkContainer container;
-
- GList *children;
- gint16 spacing;
- guint homogeneous : 1;
-};
-
-struct _GtkBoxClass
-{
- GtkContainerClass parent_class;
-};
-
-struct _GtkBoxChild
-{
- GtkWidget *widget;
- guint16 padding;
- guint expand : 1;
- guint fill : 1;
- guint pack : 1;
-};
-
-
-guint gtk_box_get_type (void);
-void gtk_box_pack_start (GtkBox *box,
- GtkWidget *child,
- gint expand,
- gint fill,
- gint padding);
-void gtk_box_pack_end (GtkBox *box,
- GtkWidget *child,
- gint expand,
- gint fill,
- gint padding);
-void gtk_box_pack_start_defaults (GtkBox *box,
- GtkWidget *widget);
-void gtk_box_pack_end_defaults (GtkBox *box,
- GtkWidget *widget);
-void gtk_box_set_homogeneous (GtkBox *box,
- gint homogeneous);
-void gtk_box_set_spacing (GtkBox *box,
- gint spacing);
-void gtk_box_reorder_child (GtkBox *box,
- GtkWidget *child,
- guint pos);
-void gtk_box_query_child_packing (GtkBox *box,
- GtkWidget *child,
- gint *expand,
- gint *fill,
- gint *padding,
- GtkPackType *pack_type);
-void gtk_box_set_child_packing (GtkBox *box,
- GtkWidget *child,
- gint expand,
- gint fill,
- gint padding,
- GtkPackType pack_type);
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_BOX_H__ */
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
deleted file mode 100644
index ea303e0962..0000000000
--- a/gtk/gtkbutton.c
+++ /dev/null
@@ -1,909 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <string.h>
-#include "gtkbutton.h"
-#include "gtklabel.h"
-#include "gtkmain.h"
-#include "gtksignal.h"
-
-
-#define CHILD_SPACING 1
-#define DEFAULT_LEFT_POS 4
-#define DEFAULT_TOP_POS 4
-#define DEFAULT_SPACING 7
-
-
-enum {
- PRESSED,
- RELEASED,
- CLICKED,
- ENTER,
- LEAVE,
- LAST_SIGNAL
-};
-enum {
- ARG_0,
- ARG_LABEL
-};
-
-
-
-static void gtk_button_class_init (GtkButtonClass *klass);
-static void gtk_button_init (GtkButton *button);
-static void gtk_button_set_arg (GtkButton *button,
- GtkArg *arg,
- guint arg_id);
-static void gtk_button_map (GtkWidget *widget);
-static void gtk_button_unmap (GtkWidget *widget);
-static void gtk_button_realize (GtkWidget *widget);
-static void gtk_button_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_button_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_button_paint (GtkWidget *widget,
- GdkRectangle *area);
-static void gtk_button_draw (GtkWidget *widget,
- GdkRectangle *area);
-static void gtk_button_draw_focus (GtkWidget *widget);
-static void gtk_button_draw_default (GtkWidget *widget);
-static gint gtk_button_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static gint gtk_button_button_press (GtkWidget *widget,
- GdkEventButton *event);
-static gint gtk_button_button_release (GtkWidget *widget,
- GdkEventButton *event);
-static gint gtk_button_enter_notify (GtkWidget *widget,
- GdkEventCrossing *event);
-static gint gtk_button_leave_notify (GtkWidget *widget,
- GdkEventCrossing *event);
-static gint gtk_button_focus_in (GtkWidget *widget,
- GdkEventFocus *event);
-static gint gtk_button_focus_out (GtkWidget *widget,
- GdkEventFocus *event);
-static void gtk_button_add (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_button_remove (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_button_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data);
-static void gtk_real_button_pressed (GtkButton *button);
-static void gtk_real_button_released (GtkButton *button);
-static void gtk_real_button_enter (GtkButton *button);
-static void gtk_real_button_leave (GtkButton *button);
-
-
-static GtkContainerClass *parent_class;
-static guint button_signals[LAST_SIGNAL] = { 0 };
-
-
-guint
-gtk_button_get_type ()
-{
- static guint button_type = 0;
-
- if (!button_type)
- {
- GtkTypeInfo button_info =
- {
- "GtkButton",
- sizeof (GtkButton),
- sizeof (GtkButtonClass),
- (GtkClassInitFunc) gtk_button_class_init,
- (GtkObjectInitFunc) gtk_button_init,
- (GtkArgSetFunc) gtk_button_set_arg,
- (GtkArgGetFunc) NULL,
- };
-
- button_type = gtk_type_unique (gtk_container_get_type (), &button_info);
- }
-
- return button_type;
-}
-
-static void
-gtk_button_class_init (GtkButtonClass *klass)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GtkObjectClass*) klass;
- widget_class = (GtkWidgetClass*) klass;
- container_class = (GtkContainerClass*) klass;
-
- parent_class = gtk_type_class (gtk_container_get_type ());
-
- gtk_object_add_arg_type ("GtkButton::label", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_LABEL);
-
- button_signals[PRESSED] =
- gtk_signal_new ("pressed",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkButtonClass, pressed),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
- button_signals[RELEASED] =
- gtk_signal_new ("released",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkButtonClass, released),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
- button_signals[CLICKED] =
- gtk_signal_new ("clicked",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkButtonClass, clicked),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
- button_signals[ENTER] =
- gtk_signal_new ("enter",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkButtonClass, enter),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
- button_signals[LEAVE] =
- gtk_signal_new ("leave",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkButtonClass, leave),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, button_signals, LAST_SIGNAL);
-
- widget_class->activate_signal = button_signals[CLICKED];
- widget_class->map = gtk_button_map;
- widget_class->unmap = gtk_button_unmap;
- widget_class->realize = gtk_button_realize;
- widget_class->draw = gtk_button_draw;
- widget_class->draw_focus = gtk_button_draw_focus;
- widget_class->draw_default = gtk_button_draw_default;
- widget_class->size_request = gtk_button_size_request;
- widget_class->size_allocate = gtk_button_size_allocate;
- widget_class->expose_event = gtk_button_expose;
- widget_class->button_press_event = gtk_button_button_press;
- widget_class->button_release_event = gtk_button_button_release;
- widget_class->enter_notify_event = gtk_button_enter_notify;
- widget_class->leave_notify_event = gtk_button_leave_notify;
- widget_class->focus_in_event = gtk_button_focus_in;
- widget_class->focus_out_event = gtk_button_focus_out;
-
- container_class->add = gtk_button_add;
- container_class->remove = gtk_button_remove;
- container_class->foreach = gtk_button_foreach;
-
- klass->pressed = gtk_real_button_pressed;
- klass->released = gtk_real_button_released;
- klass->clicked = NULL;
- klass->enter = gtk_real_button_enter;
- klass->leave = gtk_real_button_leave;
-}
-
-static void
-gtk_button_init (GtkButton *button)
-{
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_FOCUS);
-
- button->child = NULL;
- button->in_button = FALSE;
- button->button_down = FALSE;
-}
-
-static void
-gtk_button_set_arg (GtkButton *button,
- GtkArg *arg,
- guint arg_id)
-{
- GtkWidget *label;
-
- switch (arg_id)
- {
- case ARG_LABEL:
- gtk_container_disable_resize (GTK_CONTAINER (button));
-
- if (button->child)
- {
- gtk_widget_unparent (button->child);
- button->child = NULL;
- }
-
- label = gtk_label_new (GTK_VALUE_STRING(*arg));
- gtk_widget_show (label);
-
- gtk_container_add (GTK_CONTAINER (button), label);
- gtk_container_enable_resize (GTK_CONTAINER (button));
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-GtkWidget*
-gtk_button_new ()
-{
- return GTK_WIDGET (gtk_type_new (gtk_button_get_type ()));
-}
-
-GtkWidget*
-gtk_button_new_with_label (const gchar *label)
-{
- GtkWidget *button;
- GtkWidget *label_widget;
-
- button = gtk_button_new ();
- label_widget = gtk_label_new (label);
- gtk_misc_set_alignment (GTK_MISC (label_widget), 0.5, 0.5);
-
- gtk_container_add (GTK_CONTAINER (button), label_widget);
- gtk_widget_show (label_widget);
-
- return button;
-}
-
-void
-gtk_button_pressed (GtkButton *button)
-{
- gtk_signal_emit (GTK_OBJECT (button), button_signals[PRESSED]);
-}
-
-void
-gtk_button_released (GtkButton *button)
-{
- gtk_signal_emit (GTK_OBJECT (button), button_signals[RELEASED]);
-}
-
-void
-gtk_button_clicked (GtkButton *button)
-{
- gtk_signal_emit (GTK_OBJECT (button), button_signals[CLICKED]);
-}
-
-void
-gtk_button_enter (GtkButton *button)
-{
- gtk_signal_emit (GTK_OBJECT (button), button_signals[ENTER]);
-}
-
-void
-gtk_button_leave (GtkButton *button)
-{
- gtk_signal_emit (GTK_OBJECT (button), button_signals[LEAVE]);
-}
-
-static void
-gtk_button_map (GtkWidget *widget)
-{
- GtkButton *button;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_BUTTON (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
- gdk_window_show (widget->window);
-
- button = GTK_BUTTON (widget);
-
- if (button->child &&
- GTK_WIDGET_VISIBLE (button->child) &&
- !GTK_WIDGET_MAPPED (button->child))
- gtk_widget_map (button->child);
-}
-
-static void
-gtk_button_unmap (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_BUTTON (widget));
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
- gdk_window_hide (widget->window);
-}
-
-static void
-gtk_button_realize (GtkWidget *widget)
-{
- GtkButton *button;
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_BUTTON (widget));
-
- button = GTK_BUTTON (widget);
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget);
- attributes.event_mask |= (GDK_EXPOSURE_MASK |
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_ENTER_NOTIFY_MASK |
- GDK_LEAVE_NOTIFY_MASK);
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, button);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
-}
-
-static void
-gtk_button_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkButton *button;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_BUTTON (widget));
- g_return_if_fail (requisition != NULL);
-
- button = GTK_BUTTON (widget);
-
- requisition->width = (GTK_CONTAINER (widget)->border_width + CHILD_SPACING +
- GTK_WIDGET (widget)->style->klass->xthickness) * 2;
- requisition->height = (GTK_CONTAINER (widget)->border_width + CHILD_SPACING +
- GTK_WIDGET (widget)->style->klass->ythickness) * 2;
-
- if (GTK_WIDGET_CAN_DEFAULT (widget))
- {
- requisition->width += (GTK_WIDGET (widget)->style->klass->xthickness * 2 +
- DEFAULT_SPACING);
- requisition->height += (GTK_WIDGET (widget)->style->klass->ythickness * 2 +
- DEFAULT_SPACING);
- }
-
- if (button->child && GTK_WIDGET_VISIBLE (button->child))
- {
- gtk_widget_size_request (button->child, &button->child->requisition);
-
- requisition->width += button->child->requisition.width;
- requisition->height += button->child->requisition.height;
- }
-}
-
-static void
-gtk_button_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkButton *button;
- GtkAllocation child_allocation;
- gint border_width;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_BUTTON (widget));
- g_return_if_fail (allocation != NULL);
-
- widget->allocation = *allocation;
- border_width = GTK_CONTAINER (widget)->border_width;
-
- if (GTK_WIDGET_REALIZED (widget))
- gdk_window_move_resize (widget->window,
- widget->allocation.x + border_width,
- widget->allocation.y + border_width,
- widget->allocation.width - border_width * 2,
- widget->allocation.height - border_width * 2);
-
- button = GTK_BUTTON (widget);
-
- if (button->child && GTK_WIDGET_VISIBLE (button->child))
- {
- child_allocation.x = (CHILD_SPACING + GTK_WIDGET (widget)->style->klass->xthickness);
- child_allocation.y = (CHILD_SPACING + GTK_WIDGET (widget)->style->klass->ythickness);
-
- child_allocation.width = widget->allocation.width - child_allocation.x * 2 -
- border_width * 2;
- child_allocation.height = widget->allocation.height - child_allocation.y * 2 -
- border_width * 2;
-
- if (GTK_WIDGET_CAN_DEFAULT (button))
- {
- child_allocation.x += (GTK_WIDGET (widget)->style->klass->xthickness +
- DEFAULT_LEFT_POS);
- child_allocation.y += (GTK_WIDGET (widget)->style->klass->ythickness +
- DEFAULT_TOP_POS);
- child_allocation.width -= (GTK_WIDGET (widget)->style->klass->xthickness * 2 +
- DEFAULT_SPACING);
- child_allocation.height -= (GTK_WIDGET (widget)->style->klass->xthickness * 2 +
- DEFAULT_SPACING);
- }
-
- gtk_widget_size_allocate (button->child, &child_allocation);
- }
-}
-
-static void
-gtk_button_paint (GtkWidget *widget,
- GdkRectangle *area)
-{
- GdkRectangle restrict_area;
- GdkRectangle new_area;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_BUTTON (widget));
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- restrict_area.x = GTK_WIDGET (widget)->style->klass->xthickness;
- restrict_area.y = GTK_WIDGET (widget)->style->klass->ythickness;
- restrict_area.width = (GTK_WIDGET (widget)->allocation.width - restrict_area.x * 2 -
- GTK_CONTAINER (widget)->border_width * 2);
- restrict_area.height = (GTK_WIDGET (widget)->allocation.height - restrict_area.y * 2 -
- GTK_CONTAINER (widget)->border_width * 2);
-
- if (GTK_WIDGET_CAN_DEFAULT (widget))
- {
- restrict_area.x += DEFAULT_LEFT_POS;
- restrict_area.y += DEFAULT_TOP_POS;
- restrict_area.width -= DEFAULT_SPACING;
- restrict_area.height -= DEFAULT_SPACING;
- }
-
- if (gdk_rectangle_intersect (area, &restrict_area, &new_area))
- {
- gtk_style_set_background (widget->style, widget->window, GTK_WIDGET_STATE (widget));
- gdk_window_clear_area (widget->window,
- new_area.x, new_area.y,
- new_area.width, new_area.height);
- }
- }
-}
-
-static void
-gtk_button_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkButton *button;
- GdkRectangle child_area;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_BUTTON (widget));
- g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- button = GTK_BUTTON (widget);
-
- gtk_button_paint (widget, area);
-
- if (button->child && gtk_widget_intersect (button->child, area, &child_area))
- gtk_widget_draw (button->child, &child_area);
-
- gtk_widget_draw_default (widget);
- gtk_widget_draw_focus (widget);
- }
-}
-
-static void
-gtk_button_draw_focus (GtkWidget *widget)
-{
- GtkButton *button;
- GtkShadowType shadow_type;
- gint width, height;
- gint x, y;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_BUTTON (widget));
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- button = GTK_BUTTON (widget);
-
- x = 0;
- y = 0;
- width = widget->allocation.width - GTK_CONTAINER (widget)->border_width * 2;
- height = widget->allocation.height - GTK_CONTAINER (widget)->border_width * 2;
-
- if (GTK_WIDGET_CAN_DEFAULT (widget))
- {
- x += widget->style->klass->xthickness;
- y += widget->style->klass->ythickness;
- width -= 2 * x + DEFAULT_SPACING;
- height -= 2 * y + DEFAULT_SPACING;
- x += DEFAULT_LEFT_POS;
- y += DEFAULT_TOP_POS;
- }
-
- if (GTK_WIDGET_HAS_FOCUS (widget))
- {
- x += 1;
- y += 1;
- width -= 2;
- height -= 2;
- }
- else
- {
- if (GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE)
- gdk_draw_rectangle (widget->window,
- widget->style->bg_gc[GTK_WIDGET_STATE (widget)], FALSE,
- x + 1, y + 1, width - 4, height - 4);
- else
- gdk_draw_rectangle (widget->window,
- widget->style->bg_gc[GTK_WIDGET_STATE (widget)], FALSE,
- x + 2, y + 2, width - 5, height - 5);
- }
-
- if (GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE)
- shadow_type = GTK_SHADOW_IN;
- else
- shadow_type = GTK_SHADOW_OUT;
-
- gtk_draw_shadow (widget->style, widget->window,
- GTK_WIDGET_STATE (widget), shadow_type,
- x, y, width, height);
-
- if (GTK_WIDGET_HAS_FOCUS (widget))
- {
- x -= 1;
- y -= 1;
- width += 2;
- height += 2;
-
- gdk_draw_rectangle (widget->window,
- widget->style->black_gc, FALSE,
- x, y, width - 1, height - 1);
- }
- }
-}
-
-static void
-gtk_button_draw_default (GtkWidget *widget)
-{
- gint width, height;
- gint x, y;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_BUTTON (widget));
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- x = 0;
- y = 0;
- width = widget->allocation.width - GTK_CONTAINER (widget)->border_width * 2;
- height = widget->allocation.height - GTK_CONTAINER (widget)->border_width * 2;
-
- if (GTK_WIDGET_HAS_DEFAULT (widget))
- {
- gtk_draw_shadow (widget->style, widget->window,
- GTK_STATE_NORMAL, GTK_SHADOW_IN,
- x, y, width, height);
- }
- else
- {
- gdk_draw_rectangle (widget->window, widget->style->bg_gc[GTK_STATE_NORMAL],
- FALSE, x, y, width - 1, height - 1);
- gdk_draw_rectangle (widget->window, widget->style->bg_gc[GTK_STATE_NORMAL],
- FALSE, x + 1, y + 1, width - 3, height - 3);
- }
- }
-}
-
-static gint
-gtk_button_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkButton *button;
- GdkEventExpose child_event;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_BUTTON (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- button = GTK_BUTTON (widget);
-
- gtk_button_paint (widget, &event->area);
-
- child_event = *event;
- if (button->child && GTK_WIDGET_NO_WINDOW (button->child) &&
- gtk_widget_intersect (button->child, &event->area, &child_event.area))
- gtk_widget_event (button->child, (GdkEvent*) &child_event);
-
- gtk_widget_draw_default (widget);
- gtk_widget_draw_focus (widget);
- }
-
- return FALSE;
-}
-
-static gint
-gtk_button_button_press (GtkWidget *widget,
- GdkEventButton *event)
-{
- GtkButton *button;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_BUTTON (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (event->type == GDK_BUTTON_PRESS)
- {
- button = GTK_BUTTON (widget);
-
- if (GTK_WIDGET_CAN_DEFAULT (widget) && (event->button == 1))
- gtk_widget_grab_default (widget);
- if (!GTK_WIDGET_HAS_FOCUS (widget))
- gtk_widget_grab_focus (widget);
-
- if (event->button == 1)
- {
- gtk_grab_add (GTK_WIDGET (button));
- gtk_button_pressed (button);
- }
- }
-
- return TRUE;
-}
-
-static gint
-gtk_button_button_release (GtkWidget *widget,
- GdkEventButton *event)
-{
- GtkButton *button;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_BUTTON (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (event->button == 1)
- {
- button = GTK_BUTTON (widget);
- gtk_grab_remove (GTK_WIDGET (button));
- gtk_button_released (button);
- }
-
- return TRUE;
-}
-
-static gint
-gtk_button_enter_notify (GtkWidget *widget,
- GdkEventCrossing *event)
-{
- GtkButton *button;
- GtkWidget *event_widget;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_BUTTON (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- button = GTK_BUTTON (widget);
- event_widget = gtk_get_event_widget ((GdkEvent*) event);
-
- if ((event_widget == widget) &&
- (event->detail != GDK_NOTIFY_INFERIOR))
- {
- button->in_button = TRUE;
- gtk_button_enter (button);
- }
-
- return FALSE;
-}
-
-static gint
-gtk_button_leave_notify (GtkWidget *widget,
- GdkEventCrossing *event)
-{
- GtkButton *button;
- GtkWidget *event_widget;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_BUTTON (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- button = GTK_BUTTON (widget);
- event_widget = gtk_get_event_widget ((GdkEvent*) event);
-
- if ((event_widget == widget) &&
- (event->detail != GDK_NOTIFY_INFERIOR))
- {
- button->in_button = FALSE;
- gtk_button_leave (button);
- }
-
- return FALSE;
-}
-
-static gint
-gtk_button_focus_in (GtkWidget *widget,
- GdkEventFocus *event)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_BUTTON (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
- gtk_widget_draw_focus (widget);
-
- return FALSE;
-}
-
-static gint
-gtk_button_focus_out (GtkWidget *widget,
- GdkEventFocus *event)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_BUTTON (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
- gtk_widget_draw_focus (widget);
-
- return FALSE;
-}
-
-static void
-gtk_button_add (GtkContainer *container,
- GtkWidget *widget)
-{
- GtkButton *button;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_BUTTON (container));
- g_return_if_fail (widget != NULL);
- g_return_if_fail (gtk_widget_basic (widget));
-
- button = GTK_BUTTON (container);
-
- if (!button->child)
- {
- gtk_widget_set_parent (widget, GTK_WIDGET (container));
-
- if (GTK_WIDGET_VISIBLE (widget->parent))
- {
- if (GTK_WIDGET_REALIZED (widget->parent) &&
- !GTK_WIDGET_REALIZED (widget))
- gtk_widget_realize (widget);
-
- if (GTK_WIDGET_MAPPED (widget->parent) &&
- !GTK_WIDGET_MAPPED (widget))
- gtk_widget_map (widget);
- }
-
- button->child = widget;
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (container))
- gtk_widget_queue_resize (widget);
- }
-}
-
-static void
-gtk_button_remove (GtkContainer *container,
- GtkWidget *widget)
-{
- GtkButton *button;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_BUTTON (container));
- g_return_if_fail (widget != NULL);
-
- button = GTK_BUTTON (container);
-
- if (button->child == widget)
- {
- gtk_widget_unparent (widget);
-
- button->child = NULL;
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (container))
- gtk_widget_queue_resize (GTK_WIDGET (container));
- }
-}
-
-static void
-gtk_button_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
-{
- GtkButton *button;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_BUTTON (container));
- g_return_if_fail (callback != NULL);
-
- button = GTK_BUTTON (container);
-
- if (button->child)
- (* callback) (button->child, callback_data);
-}
-
-static void
-gtk_real_button_pressed (GtkButton *button)
-{
- GtkStateType new_state;
-
- g_return_if_fail (button != NULL);
- g_return_if_fail (GTK_IS_BUTTON (button));
-
- button->button_down = TRUE;
-
- new_state = (button->in_button ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL);
-
- if (GTK_WIDGET_STATE (button) != new_state)
- {
- gtk_widget_set_state (GTK_WIDGET (button), new_state);
- gtk_widget_queue_draw (GTK_WIDGET (button));
- }
-}
-
-static void
-gtk_real_button_released (GtkButton *button)
-{
- GtkStateType new_state;
-
- g_return_if_fail (button != NULL);
- g_return_if_fail (GTK_IS_BUTTON (button));
-
- if (button->button_down)
- {
- button->button_down = FALSE;
-
- if (button->in_button)
- gtk_button_clicked (button);
-
- new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL);
-
- if (GTK_WIDGET_STATE (button) != new_state)
- {
- gtk_widget_set_state (GTK_WIDGET (button), new_state);
- gtk_widget_queue_draw (GTK_WIDGET (button));
- }
- }
-}
-
-static void
-gtk_real_button_enter (GtkButton *button)
-{
- GtkStateType new_state;
-
- g_return_if_fail (button != NULL);
- g_return_if_fail (GTK_IS_BUTTON (button));
-
- new_state = (button->button_down ? GTK_STATE_ACTIVE : GTK_STATE_PRELIGHT);
-
- if (GTK_WIDGET_STATE (button) != new_state)
- {
- gtk_widget_set_state (GTK_WIDGET (button), new_state);
- gtk_widget_queue_draw (GTK_WIDGET (button));
- }
-}
-
-static void
-gtk_real_button_leave (GtkButton *button)
-{
- g_return_if_fail (button != NULL);
- g_return_if_fail (GTK_IS_BUTTON (button));
-
- if (GTK_WIDGET_STATE (button) != GTK_STATE_NORMAL)
- {
- gtk_widget_set_state (GTK_WIDGET (button), GTK_STATE_NORMAL);
- gtk_widget_queue_draw (GTK_WIDGET (button));
- }
-}
diff --git a/gtk/gtkbutton.h b/gtk/gtkbutton.h
deleted file mode 100644
index ec72c99f78..0000000000
--- a/gtk/gtkbutton.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_BUTTON_H__
-#define __GTK_BUTTON_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkcontainer.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_BUTTON(obj) GTK_CHECK_CAST (obj, gtk_button_get_type (), GtkButton)
-#define GTK_BUTTON_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_button_get_type (), GtkButtonClass)
-#define GTK_IS_BUTTON(obj) GTK_CHECK_TYPE (obj, gtk_button_get_type ())
-
-
-typedef struct _GtkButton GtkButton;
-typedef struct _GtkButtonClass GtkButtonClass;
-
-struct _GtkButton
-{
- GtkContainer container;
-
- GtkWidget *child;
-
- guint in_button : 1;
- guint button_down : 1;
-};
-
-struct _GtkButtonClass
-{
- GtkContainerClass parent_class;
-
- void (* pressed) (GtkButton *button);
- void (* released) (GtkButton *button);
- void (* clicked) (GtkButton *button);
- void (* enter) (GtkButton *button);
- void (* leave) (GtkButton *button);
-};
-
-
-guint gtk_button_get_type (void);
-GtkWidget* gtk_button_new (void);
-GtkWidget* gtk_button_new_with_label (const gchar *label);
-void gtk_button_pressed (GtkButton *button);
-void gtk_button_released (GtkButton *button);
-void gtk_button_clicked (GtkButton *button);
-void gtk_button_enter (GtkButton *button);
-void gtk_button_leave (GtkButton *button);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_BUTTON_H__ */
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
deleted file mode 100644
index c7244f3c41..0000000000
--- a/gtk/gtkcheckbutton.c
+++ /dev/null
@@ -1,379 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkcheckbutton.h"
-#include "gtklabel.h"
-
-
-#define INDICATOR_SIZE 10
-#define INDICATOR_SPACING 2
-
-#define CHECK_BUTTON_CLASS(w) GTK_CHECK_BUTTON_CLASS (GTK_OBJECT (w)->klass)
-
-
-static void gtk_check_button_class_init (GtkCheckButtonClass *klass);
-static void gtk_check_button_init (GtkCheckButton *check_button);
-static void gtk_check_button_draw (GtkWidget *widget,
- GdkRectangle *area);
-static void gtk_check_button_draw_focus (GtkWidget *widget);
-static void gtk_check_button_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_check_button_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static gint gtk_check_button_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static void gtk_check_button_draw_indicator (GtkCheckButton *check_button,
- GdkRectangle *area);
-static void gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
- GdkRectangle *area);
-
-
-static GtkToggleButtonClass *parent_class = NULL;
-
-
-guint
-gtk_check_button_get_type ()
-{
- static guint check_button_type = 0;
-
- if (!check_button_type)
- {
- GtkTypeInfo check_button_info =
- {
- "GtkCheckButton",
- sizeof (GtkCheckButton),
- sizeof (GtkCheckButtonClass),
- (GtkClassInitFunc) gtk_check_button_class_init,
- (GtkObjectInitFunc) gtk_check_button_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- check_button_type = gtk_type_unique (gtk_toggle_button_get_type (), &check_button_info);
- }
-
- return check_button_type;
-}
-
-static void
-gtk_check_button_class_init (GtkCheckButtonClass *class)
-{
- GtkWidgetClass *widget_class;
-
- widget_class = (GtkWidgetClass*) class;
- parent_class = gtk_type_class (gtk_toggle_button_get_type ());
-
- widget_class->draw = gtk_check_button_draw;
- widget_class->draw_focus = gtk_check_button_draw_focus;
- widget_class->size_request = gtk_check_button_size_request;
- widget_class->size_allocate = gtk_check_button_size_allocate;
- widget_class->expose_event = gtk_check_button_expose;
-
- class->indicator_size = INDICATOR_SIZE;
- class->indicator_spacing = INDICATOR_SPACING;
- class->draw_indicator = gtk_real_check_button_draw_indicator;
-}
-
-static void
-gtk_check_button_init (GtkCheckButton *check_button)
-{
- check_button->toggle_button.draw_indicator = TRUE;
-}
-
-GtkWidget*
-gtk_check_button_new ()
-{
- return GTK_WIDGET (gtk_type_new (gtk_check_button_get_type ()));
-}
-
-
-GtkWidget*
-gtk_check_button_new_with_label (const gchar *label)
-{
- GtkWidget *check_button;
- GtkWidget *label_widget;
-
- check_button = gtk_check_button_new ();
- label_widget = gtk_label_new (label);
- gtk_misc_set_alignment (GTK_MISC (label_widget), 0.0, 0.5);
-
- gtk_container_add (GTK_CONTAINER (check_button), label_widget);
- gtk_widget_show (label_widget);
-
- return check_button;
-}
-
-static void
-gtk_check_button_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkButton *button;
- GtkCheckButton *check_button;
- GdkRectangle child_area;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_CHECK_BUTTON (widget));
- g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget))
- {
- check_button = GTK_CHECK_BUTTON (widget);
-
- if (check_button->toggle_button.draw_indicator)
- {
- button = GTK_BUTTON (widget);
-
- gtk_check_button_draw_indicator (check_button, area);
-
- if (button->child && GTK_WIDGET_NO_WINDOW (button->child) &&
- gtk_widget_intersect (button->child, area, &child_area))
- gtk_widget_draw (button->child, &child_area);
-
- gtk_widget_draw_focus (widget);
- }
- else
- {
- if (GTK_WIDGET_CLASS (parent_class)->draw)
- (* GTK_WIDGET_CLASS (parent_class)->draw) (widget, area);
- }
- }
-}
-
-static void
-gtk_check_button_draw_focus (GtkWidget *widget)
-{
- GtkCheckButton *check_button;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_CHECK_BUTTON (widget));
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- check_button = GTK_CHECK_BUTTON (widget);
- if (check_button->toggle_button.draw_indicator)
- {
- gint border_width;
-
- border_width = GTK_CONTAINER (widget)->border_width;
- if (GTK_WIDGET_HAS_FOCUS (widget))
- gdk_draw_rectangle (widget->window,
- widget->style->black_gc, FALSE,
- border_width, border_width,
- widget->allocation.width - 2 * border_width - 1,
- widget->allocation.height - 2 * border_width - 1);
- else
- gdk_draw_rectangle (widget->window,
- widget->style->bg_gc[GTK_STATE_NORMAL], FALSE,
- border_width, border_width,
- widget->allocation.width - 2 * border_width - 1,
- widget->allocation.height - 2 * border_width - 1);
- }
- else
- {
- if (GTK_WIDGET_CLASS (parent_class)->draw_focus)
- (* GTK_WIDGET_CLASS (parent_class)->draw_focus) (widget);
- }
- }
-}
-
-static void
-gtk_check_button_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkCheckButton *check_button;
- GtkButton *button;
- gint temp;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_CHECK_BUTTON (widget));
- g_return_if_fail (requisition != NULL);
-
- check_button = GTK_CHECK_BUTTON (widget);
-
- if (GTK_WIDGET_CLASS (parent_class)->size_request)
- (* GTK_WIDGET_CLASS (parent_class)->size_request) (widget, requisition);
-
- if (check_button->toggle_button.draw_indicator)
- {
- button = GTK_BUTTON (widget);
-
- requisition->width += (CHECK_BUTTON_CLASS (widget)->indicator_size +
- CHECK_BUTTON_CLASS (widget)->indicator_spacing * 3 + 2);
-
- temp = (CHECK_BUTTON_CLASS (widget)->indicator_size +
- CHECK_BUTTON_CLASS (widget)->indicator_spacing * 2);
- requisition->height = MAX (requisition->height, temp) + 2;
- }
-}
-
-static void
-gtk_check_button_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkCheckButton *check_button;
- GtkButton *button;
- GtkAllocation child_allocation;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_CHECK_BUTTON (widget));
- g_return_if_fail (allocation != NULL);
-
- check_button = GTK_CHECK_BUTTON (widget);
- if (check_button->toggle_button.draw_indicator)
- {
- widget->allocation = *allocation;
- if (GTK_WIDGET_REALIZED (widget))
- gdk_window_move_resize (widget->window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
-
- button = GTK_BUTTON (widget);
-
- if (button->child && GTK_WIDGET_VISIBLE (button->child))
- {
- child_allocation.x = (GTK_CONTAINER (widget)->border_width +
- CHECK_BUTTON_CLASS (widget)->indicator_size +
- CHECK_BUTTON_CLASS (widget)->indicator_spacing * 3 + 1);
- child_allocation.y = GTK_CONTAINER (widget)->border_width + 1;
- child_allocation.width = (allocation->width - child_allocation.x -
- GTK_CONTAINER (widget)->border_width - 1);
- child_allocation.height = allocation->height - child_allocation.y * 2;
-
- gtk_widget_size_allocate (button->child, &child_allocation);
- }
- }
- else
- {
- if (GTK_WIDGET_CLASS (parent_class)->size_allocate)
- (* GTK_WIDGET_CLASS (parent_class)->size_allocate) (widget, allocation);
- }
-}
-
-static gint
-gtk_check_button_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkButton *button;
- GtkCheckButton *check_button;
- GdkEventExpose child_event;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_CHECK_BUTTON (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget))
- {
- check_button = GTK_CHECK_BUTTON (widget);
-
- if (check_button->toggle_button.draw_indicator)
- {
- button = GTK_BUTTON (widget);
-
- gtk_check_button_draw_indicator (check_button, &event->area);
-
- child_event = *event;
- if (button->child && GTK_WIDGET_NO_WINDOW (button->child) &&
- gtk_widget_intersect (button->child, &event->area, &child_event.area))
- gtk_widget_event (button->child, (GdkEvent*) &child_event);
-
- gtk_widget_draw_focus (widget);
- }
- else
- {
- if (GTK_WIDGET_CLASS (parent_class)->expose_event)
- (* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
- }
- }
-
- return FALSE;
-}
-
-
-static void
-gtk_check_button_draw_indicator (GtkCheckButton *check_button,
- GdkRectangle *area)
-{
- GtkCheckButtonClass *class;
-
- g_return_if_fail (check_button != NULL);
- g_return_if_fail (GTK_IS_CHECK_BUTTON (check_button));
- g_return_if_fail (CHECK_BUTTON_CLASS (check_button) != NULL);
-
- class = CHECK_BUTTON_CLASS (check_button);
-
- if (class->draw_indicator)
- (* class->draw_indicator) (check_button, area);
-}
-
-static void
-gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
- GdkRectangle *area)
-{
- GtkWidget *widget;
- GtkToggleButton *toggle_button;
- GtkStateType state_type;
- GtkShadowType shadow_type;
- GdkRectangle restrict_area;
- GdkRectangle new_area;
- gint width, height;
- gint x, y;
-
- g_return_if_fail (check_button != NULL);
- g_return_if_fail (GTK_IS_CHECK_BUTTON (check_button));
-
- if (GTK_WIDGET_DRAWABLE (check_button))
- {
- widget = GTK_WIDGET (check_button);
- toggle_button = GTK_TOGGLE_BUTTON (check_button);
-
- state_type = GTK_WIDGET_STATE (widget);
- if ((state_type != GTK_STATE_NORMAL) &&
- (state_type != GTK_STATE_PRELIGHT))
- state_type = GTK_STATE_NORMAL;
-
- restrict_area.x = GTK_CONTAINER (widget)->border_width;
- restrict_area.y = restrict_area.x;
- restrict_area.width = widget->allocation.width - restrict_area.x * 2;
- restrict_area.height = widget->allocation.height - restrict_area.x * 2;
-
- if (gdk_rectangle_intersect (area, &restrict_area, &new_area))
- {
- gtk_style_set_background (widget->style, widget->window, state_type);
- gdk_window_clear_area (widget->window, new_area.x, new_area.y,
- new_area.width, new_area.height);
- }
-
- x = CHECK_BUTTON_CLASS (widget)->indicator_spacing + GTK_CONTAINER (widget)->border_width;
- y = (widget->allocation.height - CHECK_BUTTON_CLASS (widget)->indicator_size) / 2;
- width = CHECK_BUTTON_CLASS (widget)->indicator_size;
- height = CHECK_BUTTON_CLASS (widget)->indicator_size;
-
- if (GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE)
- shadow_type = GTK_SHADOW_IN;
- else if ((GTK_WIDGET_STATE (widget) == GTK_STATE_PRELIGHT) && toggle_button->active)
- shadow_type = GTK_SHADOW_IN;
- else
- shadow_type = GTK_SHADOW_OUT;
-
- gdk_draw_rectangle (widget->window,
- widget->style->bg_gc[GTK_WIDGET_STATE (widget)],
- TRUE, x + 1, y + 1, width, height);
- gtk_draw_shadow (widget->style, widget->window,
- GTK_WIDGET_STATE (widget), shadow_type,
- x + 1, y + 1, width, height);
- }
-}
diff --git a/gtk/gtkcheckbutton.h b/gtk/gtkcheckbutton.h
deleted file mode 100644
index 8994db563e..0000000000
--- a/gtk/gtkcheckbutton.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_CHECK_BUTTON_H__
-#define __GTK_CHECK_BUTTON_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtktogglebutton.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_CHECK_BUTTON(obj) GTK_CHECK_CAST (obj, gtk_check_button_get_type (), GtkCheckButton)
-#define GTK_CHECK_BUTTON_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_check_button_get_type (), GtkCheckButtonClass)
-#define GTK_IS_CHECK_BUTTON(obj) GTK_CHECK_TYPE (obj, gtk_check_button_get_type ())
-
-
-typedef struct _GtkCheckButton GtkCheckButton;
-typedef struct _GtkCheckButtonClass GtkCheckButtonClass;
-
-struct _GtkCheckButton
-{
- GtkToggleButton toggle_button;
-};
-
-struct _GtkCheckButtonClass
-{
- GtkToggleButtonClass parent_class;
-
- guint16 indicator_size;
- guint16 indicator_spacing;
-
- void (* draw_indicator) (GtkCheckButton *check_button,
- GdkRectangle *area);
-};
-
-
-guint gtk_check_button_get_type (void);
-GtkWidget* gtk_check_button_new (void);
-GtkWidget* gtk_check_button_new_with_label (const gchar *label);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_CHECK_BUTTON_H__ */
diff --git a/gtk/gtkcheckmenuitem.c b/gtk/gtkcheckmenuitem.c
deleted file mode 100644
index fb81c2f602..0000000000
--- a/gtk/gtkcheckmenuitem.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkcheckmenuitem.h"
-#include "gtklabel.h"
-#include "gtksignal.h"
-
-
-#define CHECK_MENU_ITEM_CLASS(w) GTK_CHECK_MENU_ITEM_CLASS (GTK_OBJECT (w)->klass)
-
-
-enum {
- TOGGLED,
- LAST_SIGNAL
-};
-
-
-static void gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass);
-static void gtk_check_menu_item_init (GtkCheckMenuItem *check_menu_item);
-static void gtk_check_menu_item_draw (GtkWidget *widget,
- GdkRectangle *area);
-static gint gtk_check_menu_item_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static void gtk_check_menu_item_activate (GtkMenuItem *menu_item);
-static void gtk_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
- GdkRectangle *area);
-static void gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
- GdkRectangle *area);
-
-
-static GtkMenuItemClass *parent_class = NULL;
-static guint check_menu_item_signals[LAST_SIGNAL] = { 0 };
-
-
-guint
-gtk_check_menu_item_get_type ()
-{
- static guint check_menu_item_type = 0;
-
- if (!check_menu_item_type)
- {
- GtkTypeInfo check_menu_item_info =
- {
- "GtkCheckMenuItem",
- sizeof (GtkCheckMenuItem),
- sizeof (GtkCheckMenuItemClass),
- (GtkClassInitFunc) gtk_check_menu_item_class_init,
- (GtkObjectInitFunc) gtk_check_menu_item_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- check_menu_item_type = gtk_type_unique (gtk_menu_item_get_type (), &check_menu_item_info);
- }
-
- return check_menu_item_type;
-}
-
-GtkWidget*
-gtk_check_menu_item_new ()
-{
- return GTK_WIDGET (gtk_type_new (gtk_check_menu_item_get_type ()));
-}
-
-GtkWidget*
-gtk_check_menu_item_new_with_label (const gchar *label)
-{
- GtkWidget *check_menu_item;
- GtkWidget *label_widget;
-
- check_menu_item = gtk_check_menu_item_new ();
- label_widget = gtk_label_new (label);
- gtk_misc_set_alignment (GTK_MISC (label_widget), 0.0, 0.5);
-
- gtk_container_add (GTK_CONTAINER (check_menu_item), label_widget);
- gtk_widget_show (label_widget);
-
- return check_menu_item;
-}
-
-void
-gtk_check_menu_item_set_state (GtkCheckMenuItem *check_menu_item,
- gint state)
-{
- g_return_if_fail (check_menu_item != NULL);
- g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item));
-
- if (check_menu_item->active != state)
- gtk_menu_item_activate (GTK_MENU_ITEM (check_menu_item));
-}
-
-void
-gtk_check_menu_item_set_show_toggle (GtkCheckMenuItem *menu_item,
- gboolean always)
-{
- g_return_if_fail (menu_item != NULL);
- g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (menu_item));
-
- menu_item->always_show_toggle = always != FALSE;
-}
-
-void
-gtk_check_menu_item_toggled (GtkCheckMenuItem *check_menu_item)
-{
- gtk_signal_emit (GTK_OBJECT (check_menu_item), check_menu_item_signals[TOGGLED]);
-}
-
-static void
-gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkMenuItemClass *menu_item_class;
-
- object_class = (GtkObjectClass*) klass;
- widget_class = (GtkWidgetClass*) klass;
- menu_item_class = (GtkMenuItemClass*) klass;
-
- parent_class = gtk_type_class (gtk_menu_item_get_type ());
-
- check_menu_item_signals[TOGGLED] =
- gtk_signal_new ("toggled",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkCheckMenuItemClass, toggled),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, check_menu_item_signals, LAST_SIGNAL);
-
- widget_class->draw = gtk_check_menu_item_draw;
- widget_class->expose_event = gtk_check_menu_item_expose;
-
- menu_item_class->activate = gtk_check_menu_item_activate;
- menu_item_class->toggle_size = 12;
-
- klass->toggled = NULL;
- klass->draw_indicator = gtk_real_check_menu_item_draw_indicator;
-}
-
-static void
-gtk_check_menu_item_init (GtkCheckMenuItem *check_menu_item)
-{
- check_menu_item->active = FALSE;
- check_menu_item->always_show_toggle = FALSE;
-}
-
-static void
-gtk_check_menu_item_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (widget));
- g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_CLASS (parent_class)->draw)
- (* GTK_WIDGET_CLASS (parent_class)->draw) (widget, area);
-
- gtk_check_menu_item_draw_indicator (GTK_CHECK_MENU_ITEM (widget), area);
-}
-
-static gint
-gtk_check_menu_item_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_CHECK_MENU_ITEM (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_CLASS (parent_class)->expose_event)
- (* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
-
- gtk_check_menu_item_draw_indicator (GTK_CHECK_MENU_ITEM (widget), &event->area);
-
- return FALSE;
-}
-
-static void
-gtk_check_menu_item_activate (GtkMenuItem *menu_item)
-{
- GtkCheckMenuItem *check_menu_item;
-
- g_return_if_fail (menu_item != NULL);
- g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (menu_item));
-
- check_menu_item = GTK_CHECK_MENU_ITEM (menu_item);
- check_menu_item->active = !check_menu_item->active;
-
- gtk_check_menu_item_toggled (check_menu_item);
- gtk_widget_queue_draw (GTK_WIDGET (check_menu_item));
-}
-
-static void
-gtk_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
- GdkRectangle *area)
-{
- g_return_if_fail (check_menu_item != NULL);
- g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item));
- g_return_if_fail (CHECK_MENU_ITEM_CLASS (check_menu_item) != NULL);
-
- if (CHECK_MENU_ITEM_CLASS (check_menu_item)->draw_indicator)
- (* CHECK_MENU_ITEM_CLASS (check_menu_item)->draw_indicator) (check_menu_item, area);
-}
-
-static void
-gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
- GdkRectangle *area)
-{
- GtkWidget *widget;
- GtkStateType state_type;
- GtkShadowType shadow_type;
- gint width, height;
- gint x, y;
-
- g_return_if_fail (check_menu_item != NULL);
- g_return_if_fail (GTK_IS_CHECK_MENU_ITEM (check_menu_item));
-
- if (GTK_WIDGET_DRAWABLE (check_menu_item))
- {
- widget = GTK_WIDGET (check_menu_item);
-
- width = 8;
- height = 8;
- x = (GTK_CONTAINER (check_menu_item)->border_width +
- widget->style->klass->xthickness + 2);
- y = (widget->allocation.height - height) / 2;
-
- gdk_window_clear_area (widget->window, x, y, width, height);
-
- if (check_menu_item->active ||
- check_menu_item->always_show_toggle ||
- (GTK_WIDGET_STATE (check_menu_item) == GTK_STATE_PRELIGHT))
- {
- state_type = GTK_WIDGET_STATE (widget);
-
- if (check_menu_item->always_show_toggle)
- {
- shadow_type = GTK_SHADOW_OUT;
- if (check_menu_item->active)
- shadow_type = GTK_SHADOW_IN;
- }
- else
- {
- shadow_type = GTK_SHADOW_IN;
- if (check_menu_item->active &&
- (state_type == GTK_STATE_PRELIGHT))
- shadow_type = GTK_SHADOW_OUT;
- }
-
- gdk_draw_rectangle (widget->window,
- widget->style->bg_gc[state_type],
- TRUE, x, y, width, height);
- gtk_draw_shadow (widget->style, widget->window,
- state_type, shadow_type,
- x, y, width, height);
- }
- }
-}
diff --git a/gtk/gtkcheckmenuitem.h b/gtk/gtkcheckmenuitem.h
deleted file mode 100644
index e2b195dcfd..0000000000
--- a/gtk/gtkcheckmenuitem.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_MENU_CHECK_ITEM_H__
-#define __GTK_MENU_CHECK_ITEM_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkmenuitem.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_CHECK_MENU_ITEM(obj) ((GtkCheckMenuItem*) obj)
-#define GTK_CHECK_MENU_ITEM_CLASS(obj) ((GtkCheckMenuItemClass*) GTK_OBJECT_CLASS (obj))
-#define GTK_IS_CHECK_MENU_ITEM(obj) (gtk_type_is_a (GTK_WIDGET_TYPE (obj), gtk_check_menu_item_get_type ()))
-
-
-typedef struct _GtkCheckMenuItem GtkCheckMenuItem;
-typedef struct _GtkCheckMenuItemClass GtkCheckMenuItemClass;
-
-struct _GtkCheckMenuItem
-{
- GtkMenuItem menu_item;
-
- guint active : 1;
- guint always_show_toggle : 1;
-};
-
-struct _GtkCheckMenuItemClass
-{
- GtkMenuItemClass parent_class;
-
- void (* toggled) (GtkCheckMenuItem *check_menu_item);
- void (* draw_indicator) (GtkCheckMenuItem *check_menu_item,
- GdkRectangle *area);
-};
-
-
-guint gtk_check_menu_item_get_type (void);
-GtkWidget* gtk_check_menu_item_new (void);
-GtkWidget* gtk_check_menu_item_new_with_label (const gchar *label);
-void gtk_check_menu_item_set_state (GtkCheckMenuItem *check_menu_item,
- gint state);
-void gtk_check_menu_item_set_show_toggle(GtkCheckMenuItem *menu_item,
- gboolean always);
-void gtk_check_menu_item_toggled (GtkCheckMenuItem *check_menu_item);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_CHECK_MENU_ITEM_H__ */
diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c
deleted file mode 100644
index d3ad6621f5..0000000000
--- a/gtk/gtkclist.c
+++ /dev/null
@@ -1,3784 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball, Josh MacDonald,
- * Copyright (C) 1997-1998 Jay Painter <jpaint@serv.net><jpaint@gimp.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <stdlib.h>
-#include "../config.h"
-#include "gtkclist.h"
-
-/* the number rows memchunk expands at a time */
-#define CLIST_OPTIMUM_SIZE 512
-
-/* the width of the column resize windows */
-#define DRAG_WIDTH 6
-
-/* minimum allowed width of a column */
-#define COLUMN_MIN_WIDTH 5
-
-/* this defigns the base grid spacing */
-#define CELL_SPACING 1
-
-/* added the horizontal space at the beginning and end of a row*/
-#define COLUMN_INSET 3
-
-/* scrollbar spacing class macro */
-#define SCROLLBAR_SPACING(w) (GTK_CLIST_CLASS (GTK_OBJECT (w)->klass)->scrollbar_spacing)
-
-/* gives the top pixel of the given row in context of
- * the clist's voffset */
-#define ROW_TOP_YPIXEL(clist, row) (((clist)->row_height * (row)) + \
- (((row) + 1) * CELL_SPACING) + \
- (clist)->voffset)
-
-/* returns the row index from a y pixel location in the
- * context of the clist's voffset */
-#define ROW_FROM_YPIXEL(clist, y) (((y) - (clist)->voffset) / \
- ((clist)->row_height + CELL_SPACING))
-
-/* gives the left pixel of the given column in context of
- * the clist's hoffset */
-#define COLUMN_LEFT_XPIXEL(clist, column) ((clist)->column[(column)].area.x + \
- (clist)->hoffset)
-
-/* returns the column index from a x pixel location in the
- * context of the clist's hoffset */
-static inline gint
-COLUMN_FROM_XPIXEL (GtkCList * clist,
- gint x)
-{
- gint i, cx;
-
- for (i = 0; i < clist->columns; i++)
- {
- cx = clist->column[i].area.x + clist->hoffset;
-
- if (x >= (cx - (COLUMN_INSET + CELL_SPACING)) &&
- x <= (cx + clist->column[i].area.width + COLUMN_INSET))
- return i;
- }
-
- /* no match */
- return -1;
-}
-
-/* returns the top pixel of the given row in the context of
- * the list height */
-#define ROW_TOP(clist, row) (((clist)->row_height + CELL_SPACING) * (row))
-
-/* returns the left pixel of the given column in the context of
- * the list width */
-#define COLUMN_LEFT(clist, column) ((clist)->column[(column)].area.x)
-
-/* returns the total height of the list */
-#define LIST_HEIGHT(clist) (((clist)->row_height * ((clist)->rows)) + \
- (CELL_SPACING * ((clist)->rows + 1)))
-
-/* returns the total width of the list */
-#define LIST_WIDTH(clist) ((clist)->column[(clist)->columns - 1].area.x + \
- (clist)->column[(clist)->columns - 1].area.width + \
- COLUMN_INSET + CELL_SPACING)
-
-
-/* Signals */
-enum
-{
- SELECT_ROW,
- UNSELECT_ROW,
- CLICK_COLUMN,
- LAST_SIGNAL
-};
-
-enum
-{
- SYNC_REMOVE,
- SYNC_INSERT
-};
-
-
-typedef void (*GtkCListSignal1) (GtkObject * object,
- gint arg1,
- gint arg2,
- GdkEventButton * arg3,
- gpointer data);
-
-typedef void (*GtkCListSignal2) (GtkObject * object,
- gint arg1,
- gpointer data);
-
-
-static void sync_selection (GtkCList * clist,
- gint row,
- gint mode);
-
-/* GtkCList Methods */
-static void gtk_clist_class_init (GtkCListClass * klass);
-static void gtk_clist_init (GtkCList * clist);
-
-/* GtkObject Methods */
-static void gtk_clist_destroy (GtkObject * object);
-static void gtk_clist_finalize (GtkObject * object);
-
-
-/* GtkWidget Methods */
-static void gtk_clist_realize (GtkWidget * widget);
-static void gtk_clist_unrealize (GtkWidget * widget);
-static void gtk_clist_map (GtkWidget * widget);
-static void gtk_clist_unmap (GtkWidget * widget);
-static void gtk_clist_draw (GtkWidget * widget,
- GdkRectangle * area);
-static gint gtk_clist_expose (GtkWidget * widget,
- GdkEventExpose * event);
-static gint gtk_clist_button_press (GtkWidget * widget,
- GdkEventButton * event);
-static gint gtk_clist_button_release (GtkWidget * widget,
- GdkEventButton * event);
-static gint gtk_clist_motion (GtkWidget * widget,
- GdkEventMotion * event);
-
-static void gtk_clist_size_request (GtkWidget * widget,
- GtkRequisition * requisition);
-static void gtk_clist_size_allocate (GtkWidget * widget,
- GtkAllocation * allocation);
-static gint get_selection_info (GtkCList * clist,
- gint x,
- gint y,
- gint * row,
- gint * column);
-
-/* GtkContainer Methods */
-static void gtk_clist_foreach (GtkContainer * container,
- GtkCallback callback,
- gpointer callback_data);
-
-/* Drawing */
-static void draw_row (GtkCList * clist,
- GdkRectangle * area,
- gint row,
- GtkCListRow * clist_row);
-static void draw_rows (GtkCList * clist,
- GdkRectangle * area);
-
-/* Size Allocation */
-static void size_allocate_title_buttons (GtkCList * clist);
-static void size_allocate_columns (GtkCList * clist);
-
-/* Selection */
-static void toggle_row (GtkCList * clist,
- gint row,
- gint column,
- GdkEventButton * event);
-static void select_row (GtkCList * clist,
- gint row,
- gint column,
- GdkEventButton * event);
-static void unselect_row (GtkCList * clist,
- gint row,
- gint column,
- GdkEventButton * event);
-
-static void real_select_row (GtkCList * clist,
- gint row,
- gint column,
- GdkEventButton * event);
-static void real_unselect_row (GtkCList * clist,
- gint row,
- gint column,
- GdkEventButton * event);
-
-/* Resize Columns */
-static void draw_xor_line (GtkCList * clist);
-static gint new_column_width (GtkCList * clist,
- gint column,
- gint * x,
- gint * visible);
-static void resize_column (GtkCList * clist,
- gint column,
- gint width);
-
-/* Buttons */
-static void column_button_create (GtkCList * clist,
- gint column);
-static void column_button_clicked (GtkWidget * widget,
- gpointer data);
-
-/* Scrollbars */
-static void create_scrollbars (GtkCList * clist);
-static void adjust_scrollbars (GtkCList * clist);
-static void check_exposures (GtkCList * clist);
-static void vadjustment_changed (GtkAdjustment * adjustment,
- gpointer data);
-static void vadjustment_value_changed (GtkAdjustment * adjustment,
- gpointer data);
-static void hadjustment_changed (GtkAdjustment * adjustment,
- gpointer data);
-static void hadjustment_value_changed (GtkAdjustment * adjustment,
- gpointer data);
-
-
-/* Memory Allocation/Distruction Routines */
-static GtkCListColumn *columns_new (GtkCList * clist);
-
-static void column_title_new (GtkCList * clist,
- gint column,
- gchar * title);
-static void columns_delete (GtkCList * clist);
-
-static GtkCListRow *row_new (GtkCList * clist);
-
-static void row_delete (GtkCList * clist,
- GtkCListRow * clist_row);
-static void cell_empty (GtkCList * clist,
- GtkCListRow * clist_row,
- gint column);
-static void cell_set_text (GtkCList * clist,
- GtkCListRow * clist_row,
- gint column,
- gchar * text);
-static void cell_set_pixmap (GtkCList * clist,
- GtkCListRow * clist_row,
- gint column,
- GdkPixmap * pixmap,
- GdkBitmap * mask);
-static void cell_set_pixtext (GtkCList * clist,
- GtkCListRow * clist_row,
- gint column,
- gchar * text,
- guint8 spacing,
- GdkPixmap * pixmap,
- GdkBitmap * mask);
-
-/* Signals */
-static void gtk_clist_marshal_signal_1 (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg * args);
-static void gtk_clist_marshal_signal_2 (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg * args);
-
-/* Fill in data after widget is realized and has style */
-
-static void add_style_data (GtkCList * clist);
-
-static GtkContainerClass *parent_class = NULL;
-static guint clist_signals[LAST_SIGNAL] = {0};
-
-
-guint
-gtk_clist_get_type ()
-{
- static guint clist_type = 0;
-
- if (!clist_type)
- {
- GtkTypeInfo clist_info =
- {
- "GtkCList",
- sizeof (GtkCList),
- sizeof (GtkCListClass),
- (GtkClassInitFunc) gtk_clist_class_init,
- (GtkObjectInitFunc) gtk_clist_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- clist_type = gtk_type_unique (gtk_container_get_type (), &clist_info);
- }
-
- return clist_type;
-}
-
-static void
-gtk_clist_class_init (GtkCListClass * klass)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GtkObjectClass *) klass;
- widget_class = (GtkWidgetClass *) klass;
- container_class = (GtkContainerClass *) klass;
-
- parent_class = gtk_type_class (gtk_container_get_type ());
-
- clist_signals[SELECT_ROW] =
- gtk_signal_new ("select_row",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkCListClass, select_row),
- gtk_clist_marshal_signal_1,
- GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER);
- clist_signals[UNSELECT_ROW] =
- gtk_signal_new ("unselect_row",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkCListClass, unselect_row),
- gtk_clist_marshal_signal_1,
- GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER);
- clist_signals[CLICK_COLUMN] =
- gtk_signal_new ("click_column",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkCListClass, click_column),
- gtk_clist_marshal_signal_2,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
- gtk_object_class_add_signals (object_class, clist_signals, LAST_SIGNAL);
-
- object_class->destroy = gtk_clist_destroy;
- object_class->finalize = gtk_clist_finalize;
-
- widget_class->realize = gtk_clist_realize;
- widget_class->unrealize = gtk_clist_unrealize;
- widget_class->map = gtk_clist_map;
- widget_class->unmap = gtk_clist_unmap;
- widget_class->draw = gtk_clist_draw;
- widget_class->button_press_event = gtk_clist_button_press;
- widget_class->button_release_event = gtk_clist_button_release;
- widget_class->motion_notify_event = gtk_clist_motion;
- widget_class->expose_event = gtk_clist_expose;
- widget_class->size_request = gtk_clist_size_request;
- widget_class->size_allocate = gtk_clist_size_allocate;
-
- container_class->add = NULL;
- container_class->remove = NULL;
- container_class->foreach = gtk_clist_foreach;
-
- klass->select_row = real_select_row;
- klass->unselect_row = real_unselect_row;
- klass->click_column = NULL;
-
- klass->scrollbar_spacing = 5;
-}
-
-static void
-gtk_clist_marshal_signal_1 (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg * args)
-{
- GtkCListSignal1 rfunc;
-
- rfunc = (GtkCListSignal1) func;
-
- (*rfunc) (object, GTK_VALUE_INT (args[0]),
- GTK_VALUE_INT (args[1]),
- GTK_VALUE_POINTER (args[2]),
- func_data);
-}
-
-static void
-gtk_clist_marshal_signal_2 (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg * args)
-{
- GtkCListSignal2 rfunc;
-
- rfunc = (GtkCListSignal2) func;
-
- (*rfunc) (object, GTK_VALUE_INT (args[0]),
- func_data);
-}
-
-static void
-gtk_clist_init (GtkCList * clist)
-{
- clist->flags = 0;
-
- GTK_WIDGET_UNSET_FLAGS (clist, GTK_NO_WINDOW);
- GTK_CLIST_SET_FLAGS (clist, CLIST_FROZEN);
-
- clist->row_mem_chunk = NULL;
- clist->cell_mem_chunk = NULL;
-
- clist->rows = 0;
- clist->row_center_offset = 0;
- clist->row_height = 0;
- clist->row_list = NULL;
- clist->row_list_end = NULL;
-
- clist->columns = 0;
-
- clist->title_window = NULL;
- clist->column_title_area.x = 0;
- clist->column_title_area.y = 0;
- clist->column_title_area.width = 0;
- clist->column_title_area.height = 0;
-
- clist->clist_window = NULL;
- clist->clist_window_width = 0;
- clist->clist_window_height = 0;
-
- clist->hoffset = 0;
- clist->voffset = 0;
-
- clist->shadow_type = GTK_SHADOW_IN;
- clist->hscrollbar_policy = GTK_POLICY_ALWAYS;
- clist->vscrollbar_policy = GTK_POLICY_ALWAYS;
-
- clist->cursor_drag = NULL;
- clist->xor_gc = NULL;
- clist->fg_gc = NULL;
- clist->bg_gc = NULL;
- clist->x_drag = 0;
-
- clist->selection_mode = GTK_SELECTION_SINGLE;
- clist->selection = NULL;
-}
-
-/* Constructors */
-void
-gtk_clist_construct (GtkCList * clist,
- gint columns,
- gchar *titles[])
-{
- int i;
-
- g_return_if_fail (clist != NULL);
- g_return_if_fail (GTK_IS_CLIST (clist));
- g_return_if_fail (clist->row_mem_chunk == NULL);
-
-
- /* initalize memory chunks */
- clist->row_mem_chunk = g_mem_chunk_new ("clist row mem chunk",
- sizeof (GtkCListRow),
- sizeof (GtkCListRow) * CLIST_OPTIMUM_SIZE,
- G_ALLOC_AND_FREE);
-
- clist->cell_mem_chunk = g_mem_chunk_new ("clist cell mem chunk",
- sizeof (GtkCell) * columns,
- sizeof (GtkCell) * columns * CLIST_OPTIMUM_SIZE,
- G_ALLOC_AND_FREE);
-
- /* set number of columns, allocate memory */
- clist->columns = columns;
- clist->column = columns_new (clist);
-
- /* there needs to be at least one column button
- * because there is alot of code that will break if it
- * isn't there*/
- column_button_create (clist, 0);
-
- /* create scrollbars */
- create_scrollbars (clist);
-
- if (titles)
- {
- GTK_CLIST_SET_FLAGS (clist, CLIST_SHOW_TITLES);
- for (i = 0; i < columns; i++)
- gtk_clist_set_column_title (clist, i, titles[i]);
- }
- else
- {
- GTK_CLIST_UNSET_FLAGS (clist, CLIST_SHOW_TITLES);
- }
-}
-
-/*
- * GTKCLIST PUBLIC INTERFACE
- * gtk_clist_new_with_titles
- * gtk_clist_new
- */
-GtkWidget *
-gtk_clist_new_with_titles (gint columns,
- gchar * titles[])
-{
- GtkWidget *widget;
-
- g_return_val_if_fail (titles != NULL, NULL);
-
- widget = gtk_type_new (gtk_clist_get_type ());
-
- gtk_clist_construct (GTK_CLIST (widget), columns, titles);
-
- return widget;
-}
-
-GtkWidget *
-gtk_clist_new (gint columns)
-{
- GtkCList *clist;
-
- if (columns < 1)
- return NULL;
-
- clist = gtk_type_new (gtk_clist_get_type ());
- gtk_clist_construct (clist, columns, NULL);
- return GTK_WIDGET (clist);
-}
-
-void
-gtk_clist_set_border (GtkCList * clist,
- GtkShadowType border)
-{
- g_return_if_fail (clist != NULL);
-
- clist->shadow_type = border;
-
- if (GTK_WIDGET_VISIBLE (clist))
- gtk_widget_queue_resize (GTK_WIDGET (clist));
-}
-
-void
-gtk_clist_set_selection_mode (GtkCList * clist,
- GtkSelectionMode mode)
-{
- g_return_if_fail (clist != NULL);
-
- clist->selection_mode = mode;
-}
-
-void
-gtk_clist_freeze (GtkCList * clist)
-{
- g_return_if_fail (clist != NULL);
-
- GTK_CLIST_SET_FLAGS (clist, CLIST_FROZEN);
-}
-
-void
-gtk_clist_thaw (GtkCList * clist)
-{
- g_return_if_fail (clist != NULL);
-
- GTK_CLIST_UNSET_FLAGS (clist, CLIST_FROZEN);
-
- adjust_scrollbars (clist);
- draw_rows (clist, NULL);
-}
-
-void
-gtk_clist_column_titles_show (GtkCList * clist)
-{
- g_return_if_fail (clist != NULL);
-
- if (!GTK_CLIST_SHOW_TITLES (clist))
- {
- GTK_CLIST_SET_FLAGS (clist, CLIST_SHOW_TITLES);
- gdk_window_show (clist->title_window);
- gtk_widget_queue_resize (GTK_WIDGET (clist));
- }
-}
-
-void
-gtk_clist_column_titles_hide (GtkCList * clist)
-{
- g_return_if_fail (clist != NULL);
-
- if (GTK_CLIST_SHOW_TITLES (clist))
- {
- GTK_CLIST_UNSET_FLAGS (clist, CLIST_SHOW_TITLES);
- gdk_window_hide (clist->title_window);
- gtk_widget_queue_resize (GTK_WIDGET (clist));
- }
-}
-
-void
-gtk_clist_column_title_active (GtkCList * clist,
- gint column)
-{
- g_return_if_fail (clist != NULL);
-
- if (column < 0 || column >= clist->columns)
- return;
-
- if (!GTK_WIDGET_SENSITIVE (clist->column[column].button) ||
- !GTK_WIDGET_CAN_FOCUS (clist->column[column].button))
- {
- GTK_WIDGET_SET_FLAGS (clist->column[column].button, GTK_SENSITIVE | GTK_CAN_FOCUS);
- if (GTK_WIDGET_VISIBLE (clist))
- gtk_widget_queue_draw (clist->column[column].button);
- }
-}
-
-void
-gtk_clist_column_title_passive (GtkCList * clist,
- gint column)
-{
- g_return_if_fail (clist != NULL);
-
- if (column < 0 || column >= clist->columns)
- return;
-
- if (GTK_WIDGET_SENSITIVE (clist->column[column].button) ||
- GTK_WIDGET_CAN_FOCUS (clist->column[column].button))
- {
- GTK_WIDGET_UNSET_FLAGS (clist->column[column].button, GTK_SENSITIVE | GTK_CAN_FOCUS);
- if (GTK_WIDGET_VISIBLE (clist))
- gtk_widget_queue_draw (clist->column[column].button);
- }
-}
-
-void
-gtk_clist_column_titles_active (GtkCList * clist)
-{
- gint i;
-
- g_return_if_fail (clist != NULL);
-
- for (i = 0; i < clist->columns; i++)
- if (clist->column[i].button)
- gtk_clist_column_title_active (clist, i);
-}
-
-void
-gtk_clist_column_titles_passive (GtkCList * clist)
-{
- gint i;
-
- g_return_if_fail (clist != NULL);
-
- for (i = 0; i < clist->columns; i++)
- if (clist->column[i].button)
- gtk_clist_column_title_passive (clist, i);
-}
-
-void
-gtk_clist_set_column_title (GtkCList * clist,
- gint column,
- gchar * title)
-{
- gint new_button = 0;
- GtkWidget *old_widget;
- GtkWidget *alignment = NULL;
- GtkWidget *label;
-
- g_return_if_fail (clist != NULL);
-
- if (column < 0 || column >= clist->columns)
- return;
-
- /* if the column button doesn't currently exist,
- * it has to be created first */
- if (!clist->column[column].button)
- {
- column_button_create (clist, column);
- new_button = 1;
- }
-
- column_title_new (clist, column, title);
-
- /* remove and destroy the old widget */
- old_widget = GTK_BUTTON (clist->column[column].button)->child;
- if (old_widget)
- {
- gtk_container_remove (GTK_CONTAINER (clist->column[column].button), old_widget);
- gtk_widget_destroy (old_widget);
- }
-
- /* create new alignment based no column justification */
- switch (clist->column[column].justification)
- {
- case GTK_JUSTIFY_LEFT:
- alignment = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
- break;
-
- case GTK_JUSTIFY_RIGHT:
- alignment = gtk_alignment_new (1.0, 0.5, 0.0, 0.0);
- break;
-
- case GTK_JUSTIFY_CENTER:
- alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
- break;
-
- case GTK_JUSTIFY_FILL:
- alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
- break;
- }
-
- label = gtk_label_new (clist->column[column].title);
- gtk_container_add (GTK_CONTAINER (alignment), label);
- gtk_container_add (GTK_CONTAINER (clist->column[column].button), alignment);
- gtk_widget_show (label);
- gtk_widget_show (alignment);
-
- /* if this button didn't previously exist, then the
- * column button positions have to be re-computed */
- if (GTK_WIDGET_VISIBLE (clist) && new_button)
- size_allocate_title_buttons (clist);
-}
-
-void
-gtk_clist_set_column_widget (GtkCList * clist,
- gint column,
- GtkWidget * widget)
-{
- gint new_button = 0;
- GtkWidget *old_widget;
-
- g_return_if_fail (clist != NULL);
-
- if (column < 0 || column >= clist->columns)
- return;
-
- /* if the column button doesn't currently exist,
- * it has to be created first */
- if (!clist->column[column].button)
- {
- column_button_create (clist, column);
- new_button = 1;
- }
-
- column_title_new (clist, column, NULL);
-
- /* remove and destroy the old widget */
- old_widget = GTK_BUTTON (clist->column[column].button)->child;
- if (old_widget)
- {
- gtk_container_remove (GTK_CONTAINER (clist->column[column].button), old_widget);
- gtk_widget_destroy (old_widget);
- }
-
- /* add and show the widget */
- if (widget)
- {
- gtk_container_add (GTK_CONTAINER (clist->column[column].button), widget);
- gtk_widget_show (widget);
- }
-
- /* if this button didn't previously exist, then the
- * column button positions have to be re-computed */
- if (GTK_WIDGET_VISIBLE (clist) && new_button)
- size_allocate_title_buttons (clist);
-}
-
-void
-gtk_clist_set_column_justification (GtkCList * clist,
- gint column,
- GtkJustification justification)
-{
- GtkWidget *alignment;
-
- g_return_if_fail (clist != NULL);
-
- if (column < 0 || column >= clist->columns)
- return;
-
- clist->column[column].justification = justification;
-
- /* change the alinment of the button title if it's not a
- * custom widget */
- if (clist->column[column].title)
- {
- alignment = GTK_BUTTON (clist->column[column].button)->child;
-
- switch (clist->column[column].justification)
- {
- case GTK_JUSTIFY_LEFT:
- gtk_alignment_set (GTK_ALIGNMENT (alignment), 0.0, 0.5, 0.0, 0.0);
- break;
-
- case GTK_JUSTIFY_RIGHT:
- gtk_alignment_set (GTK_ALIGNMENT (alignment), 1.0, 0.5, 0.0, 0.0);
- break;
-
- case GTK_JUSTIFY_CENTER:
- gtk_alignment_set (GTK_ALIGNMENT (alignment), 0.5, 0.5, 0.0, 0.0);
- break;
-
- case GTK_JUSTIFY_FILL:
- gtk_alignment_set (GTK_ALIGNMENT (alignment), 0.5, 0.5, 0.0, 0.0);
- break;
-
- default:
- break;
- }
- }
-
- if (!GTK_CLIST_FROZEN (clist))
- draw_rows (clist, NULL);
-}
-
-void
-gtk_clist_set_column_width (GtkCList * clist,
- gint column,
- gint width)
-{
- g_return_if_fail (clist != NULL);
-
- if (column < 0 || column >= clist->columns)
- return;
-
- clist->column[column].width = width;
- clist->column[column].width_set = TRUE;
-
- /* FIXME: this is quite expensive to do if the widget hasn't
- * been size_allocated yet, and pointless. Should
- * a flag be kept
- */
- size_allocate_columns (clist);
- size_allocate_title_buttons (clist);
-
- if (!GTK_CLIST_FROZEN (clist))
- {
- adjust_scrollbars (clist);
- draw_rows (clist, NULL);
- }
-}
-
-void
-gtk_clist_set_row_height (GtkCList * clist,
- gint height)
-{
- gint text_height;
-
- g_return_if_fail (clist != NULL);
-
- if (height > 0)
- clist->row_height = height;
- else
- return;
-
- GTK_CLIST_SET_FLAGS (clist, CLIST_ROW_HEIGHT_SET);
-
- if (GTK_WIDGET_REALIZED (clist))
- {
- text_height = height - (GTK_WIDGET (clist)->style->font->ascent +
- GTK_WIDGET (clist) ->style->font->descent + 1);
- clist->row_center_offset = (text_height / 2) + GTK_WIDGET (clist)->style->font->ascent + 1.5;
- }
-
- if (!GTK_CLIST_FROZEN (clist))
- {
- adjust_scrollbars (clist);
- draw_rows (clist, NULL);
- }
-}
-
-void
-gtk_clist_moveto (GtkCList * clist,
- gint row,
- gint column,
- gfloat row_align,
- gfloat col_align)
-{
- gint x, y;
-
- g_return_if_fail (clist != NULL);
-
- if (row < -1 || row >= clist->rows)
- return;
- if (column < -1 || column >= clist->columns)
- return;
-
- /* adjust vertical scrollbar */
- if (row >= 0)
- {
- x = ROW_TOP (clist, row) - (row_align * (clist->clist_window_height -
- (clist->row_height + 2 * CELL_SPACING)));
-
- if (x < 0)
- GTK_RANGE (clist->vscrollbar)->adjustment->value = 0.0;
- else if (x > LIST_HEIGHT (clist) - clist->clist_window_height)
- GTK_RANGE (clist->vscrollbar)->adjustment->value = LIST_HEIGHT (clist) -
- clist->clist_window_height;
- else
- GTK_RANGE (clist->vscrollbar)->adjustment->value = x;
-
- gtk_signal_emit_by_name (GTK_OBJECT (GTK_RANGE (clist->vscrollbar)->adjustment),
- "value_changed");
- }
-
- /* adjust horizontal scrollbar */
- if (column >= 0)
- {
- y = COLUMN_LEFT (clist, column) - (col_align * (clist->clist_window_width -
- clist->column[column].area.width +
- 2 * (CELL_SPACING + COLUMN_INSET)));
-
- if (y < 0)
- GTK_RANGE (clist->hscrollbar)->adjustment->value = 0.0;
- else if (y > LIST_WIDTH (clist) - clist->clist_window_width)
- GTK_RANGE (clist->hscrollbar)->adjustment->value = LIST_WIDTH (clist) -
- clist->clist_window_width;
- else
- GTK_RANGE (clist->hscrollbar)->adjustment->value = y;
-
- gtk_signal_emit_by_name (GTK_OBJECT (GTK_RANGE (clist->hscrollbar)->adjustment),
- "value_changed");
- }
-}
-
-GtkCellType
-gtk_clist_get_cell_type (GtkCList * clist,
- gint row,
- gint column)
-{
- GtkCListRow *clist_row;
-
- g_return_val_if_fail (clist != NULL, -1);
-
- if (row < 0 || row >= clist->rows)
- return -1;
- if (column < 0 || column >= clist->columns)
- return -1;
-
- clist_row = (g_list_nth (clist->row_list, row))->data;
-
- return clist_row->cell[column].type;
-}
-
-void
-gtk_clist_set_text (GtkCList * clist,
- gint row,
- gint column,
- gchar * text)
-{
- GtkCListRow *clist_row;
-
- g_return_if_fail (clist != NULL);
-
- if (row < 0 || row >= clist->rows)
- return;
- if (column < 0 || column >= clist->columns)
- return;
-
- clist_row = (g_list_nth (clist->row_list, row))->data;
-
- /* if text is null, then the cell is empty */
- if (text)
- cell_set_text (clist, clist_row, column, text);
- else
- cell_empty (clist, clist_row, column);
-
- /* redraw the list if it's not frozen */
- if (!GTK_CLIST_FROZEN (clist))
- {
- if (gtk_clist_row_is_visible (clist, row))
- draw_row (clist, NULL, row, clist_row);
- }
-}
-
-gint
-gtk_clist_get_text (GtkCList * clist,
- gint row,
- gint column,
- gchar ** text)
-{
- GtkCListRow *clist_row;
-
- g_return_val_if_fail (clist != NULL, 0);
-
- if (row < 0 || row >= clist->rows)
- return 0;
- if (column < 0 || column >= clist->columns)
- return 0;
-
- clist_row = (g_list_nth (clist->row_list, row))->data;
-
- if (clist_row->cell[column].type != GTK_CELL_TEXT)
- return 0;
-
- if (text)
- *text = GTK_CELL_TEXT (clist_row->cell[column])->text;
-
- return 1;
-}
-
-void
-gtk_clist_set_pixmap (GtkCList * clist,
- gint row,
- gint column,
- GdkPixmap * pixmap,
- GdkBitmap * mask)
-{
- GtkCListRow *clist_row;
-
- g_return_if_fail (clist != NULL);
-
- if (row < 0 || row >= clist->rows)
- return;
- if (column < 0 || column >= clist->columns)
- return;
-
- clist_row = (g_list_nth (clist->row_list, row))->data;
-
- gdk_pixmap_ref (pixmap);
-
- if (mask) gdk_pixmap_ref (mask);
-
- cell_set_pixmap (clist, clist_row, column, pixmap, mask);
-
- /* redraw the list if it's not frozen */
- if (!GTK_CLIST_FROZEN (clist))
- {
- if (gtk_clist_row_is_visible (clist, row))
- draw_row (clist, NULL, row, clist_row);
- }
-}
-
-gint
-gtk_clist_get_pixmap (GtkCList * clist,
- gint row,
- gint column,
- GdkPixmap ** pixmap,
- GdkBitmap ** mask)
-{
- GtkCListRow *clist_row;
-
- g_return_val_if_fail (clist != NULL, 0);
-
- if (row < 0 || row >= clist->rows)
- return 0;
- if (column < 0 || column >= clist->columns)
- return 0;
-
- clist_row = (g_list_nth (clist->row_list, row))->data;
-
- if (clist_row->cell[column].type != GTK_CELL_PIXMAP)
- return 0;
-
- if (pixmap)
- {
- *pixmap = GTK_CELL_PIXMAP (clist_row->cell[column])->pixmap;
- /* mask can be NULL */
- *mask = GTK_CELL_PIXMAP (clist_row->cell[column])->mask;
- }
-
- return 1;
-}
-
-void
-gtk_clist_set_pixtext (GtkCList * clist,
- gint row,
- gint column,
- gchar * text,
- guint8 spacing,
- GdkPixmap * pixmap,
- GdkBitmap * mask)
-{
- GtkCListRow *clist_row;
-
- g_return_if_fail (clist != NULL);
-
- if (row < 0 || row >= clist->rows)
- return;
- if (column < 0 || column >= clist->columns)
- return;
-
- clist_row = (g_list_nth (clist->row_list, row))->data;
-
- gdk_pixmap_ref (pixmap);
- if (mask) gdk_pixmap_ref (mask);
- cell_set_pixtext (clist, clist_row, column, text, spacing, pixmap, mask);
-
- /* redraw the list if it's not frozen */
- if (!GTK_CLIST_FROZEN (clist))
- {
- if (gtk_clist_row_is_visible (clist, row))
- draw_row (clist, NULL, row, clist_row);
- }
-}
-
-gint
-gtk_clist_get_pixtext (GtkCList * clist,
- gint row,
- gint column,
- gchar ** text,
- guint8 * spacing,
- GdkPixmap ** pixmap,
- GdkBitmap ** mask)
-{
- GtkCListRow *clist_row;
-
- g_return_val_if_fail (clist != NULL, 0);
-
- if (row < 0 || row >= clist->rows)
- return 0;
- if (column < 0 || column >= clist->columns)
- return 0;
-
- clist_row = (g_list_nth (clist->row_list, row))->data;
-
- if (clist_row->cell[column].type != GTK_CELL_PIXTEXT)
- return 0;
-
- if (text)
- *text = GTK_CELL_PIXTEXT (clist_row->cell[column])->text;
- if (spacing)
- *spacing = GTK_CELL_PIXTEXT (clist_row->cell[column])->spacing;
- if (pixmap)
- *pixmap = GTK_CELL_PIXTEXT (clist_row->cell[column])->pixmap;
-
- /* mask can be NULL */
- *mask = GTK_CELL_PIXTEXT (clist_row->cell[column])->mask;
-
- return 1;
-}
-
-void
-gtk_clist_set_foreground (GtkCList * clist,
- gint row,
- GdkColor * color)
-{
- GtkCListRow *clist_row;
-
- g_return_if_fail (clist != NULL);
-
- if (row < 0 || row >= clist->rows)
- return;
-
- clist_row = (g_list_nth (clist->row_list, row))->data;
-
- if (color)
- {
- clist_row->foreground = *color;
- clist_row->fg_set = TRUE;
- }
- else
- clist_row->fg_set = FALSE;
-
- if (!GTK_CLIST_FROZEN (clist) && gtk_clist_row_is_visible (clist, row))
- draw_row (clist, NULL, row, clist_row);
-}
-
-void
-gtk_clist_set_background (GtkCList * clist,
- gint row,
- GdkColor * color)
-{
- GtkCListRow *clist_row;
-
- g_return_if_fail (clist != NULL);
-
- if (row < 0 || row >= clist->rows)
- return;
-
- clist_row = (g_list_nth (clist->row_list, row))->data;
-
- if (color)
- {
- clist_row->background = *color;
- clist_row->bg_set = TRUE;
- }
- else
- clist_row->bg_set = FALSE;
-
- if (!GTK_CLIST_FROZEN (clist) && gtk_clist_row_is_visible (clist, row))
- draw_row (clist, NULL, row, clist_row);
-}
-
-void
-gtk_clist_set_shift (GtkCList * clist,
- gint row,
- gint column,
- gint vertical,
- gint horizontal)
-{
- GtkCListRow *clist_row;
-
- g_return_if_fail (clist != NULL);
-
- if (row < 0 || row >= clist->rows)
- return;
- if (column < 0 || column >= clist->columns)
- return;
-
- clist_row = (g_list_nth (clist->row_list, row))->data;
-
- clist_row->cell[column].vertical = vertical;
- clist_row->cell[column].horizontal = horizontal;
-
- if (!GTK_CLIST_FROZEN (clist) && gtk_clist_row_is_visible (clist, row))
- draw_row (clist, NULL, row, clist_row);
-}
-
-gint
-gtk_clist_append (GtkCList * clist,
- gchar * text[])
-{
- gint i;
- GtkCListRow *clist_row;
-
- g_return_val_if_fail (clist != NULL, -1);
-
- clist_row = row_new (clist);
- clist->rows++;
-
- /* set the text in the row's columns */
- if (text)
- for (i = 0; i < clist->columns; i++)
- if (text[i])
- cell_set_text (clist, clist_row, i, text[i]);
-
- /* keeps track of the end of the list so the list
- * doesn't have to be traversed every time a item is added */
- if (!clist->row_list)
- {
- clist->row_list = g_list_append (clist->row_list, clist_row);
- clist->row_list_end = clist->row_list;
-
- /* check the selection mode to see if we should select
- * the first row automaticly */
- switch (clist->selection_mode)
- {
- case GTK_SELECTION_BROWSE:
- gtk_clist_select_row (clist, 0, -1);
- break;
-
- default:
- break;
- }
- }
- else
- clist->row_list_end = (g_list_append (clist->row_list_end, clist_row))->next;
-
- /* redraw the list if it's not frozen */
- if (!GTK_CLIST_FROZEN (clist))
- {
- adjust_scrollbars (clist);
-
- if (gtk_clist_row_is_visible (clist, clist->rows - 1))
- draw_rows (clist, NULL);
- }
-
- /* return index of the row */
- return clist->rows - 1;
-}
-
-void
-gtk_clist_insert (GtkCList * clist,
- gint row,
- gchar * text[])
-{
- gint i;
- GtkCListRow *clist_row;
-
- g_return_if_fail (clist != NULL);
- g_return_if_fail (text != NULL);
-
- /* return if out of bounds */
- if (row < 0 || row > clist->rows)
- return;
-
- if (clist->rows == 0)
- gtk_clist_append (clist, text);
- else
- {
- /* create the row */
- clist_row = row_new (clist);
-
- /* set the text in the row's columns */
- if (text)
- for (i = 0; i < clist->columns; i++)
- if (text[i])
- cell_set_text (clist, clist_row, i, text[i]);
-
- /* reset the row end pointer if we're inserting at the
- * end of the list */
- if (row == clist->rows)
- clist->row_list_end = (g_list_append (clist->row_list_end, clist_row))->next;
- else
- clist->row_list = g_list_insert (clist->row_list, clist_row, row);
-
- clist->rows++;
-
- /* syncronize the selection list */
- sync_selection (clist, row, SYNC_INSERT);
- }
-
- /* redraw the list if it isn't frozen */
- if (!GTK_CLIST_FROZEN (clist))
- {
- adjust_scrollbars (clist);
-
- if (gtk_clist_row_is_visible (clist, row))
- draw_rows (clist, NULL);
- }
-}
-
-void
-gtk_clist_remove (GtkCList * clist,
- gint row)
-{
- gint was_visible, was_selected;
- GList *list;
- GtkCListRow *clist_row;
-
- g_return_if_fail (clist != NULL);
-
- /* return if out of bounds */
- if (row < 0 || row > (clist->rows - 1))
- return;
-
- was_visible = gtk_clist_row_is_visible (clist, row);
- was_selected = 0;
-
- /* get the row we're going to delete */
- list = g_list_nth (clist->row_list, row);
- clist_row = list->data;
-
- /* if we're removing a selected row, we have to make sure
- * it's properly unselected, and then sync up the clist->selected
- * list to reflect the deincrimented indexies of rows after the
- * removal */
- if (clist_row->state == GTK_STATE_SELECTED)
- {
- was_selected = 1;
-
- switch (clist->selection_mode)
- {
- case GTK_SELECTION_SINGLE:
- case GTK_SELECTION_BROWSE:
- case GTK_SELECTION_MULTIPLE:
- gtk_clist_unselect_row (clist, row, -1);
- break;
-
- default:
- break;
- }
- }
-
- /* reset the row end pointer if we're removing at the
- * end of the list */
- if (row == clist->rows - 1)
- clist->row_list_end = list->prev;
-
- clist->row_list = g_list_remove (clist->row_list, clist_row);
- clist->rows--;
- sync_selection (clist, row, SYNC_REMOVE);
-
- /* preform any selections required by the selection mode */
- if (was_selected)
- {
- switch (clist->selection_mode)
- {
- case GTK_SELECTION_BROWSE:
- if (row == clist->rows)
- gtk_clist_select_row (clist, row - 1, -1);
- else
- gtk_clist_select_row (clist, row, -1);
- break;
-
- default:
- break;
- }
- }
-
- /* toast the row */
- row_delete (clist, clist_row);
-
- /* redraw the row if it isn't frozen */
- if (!GTK_CLIST_FROZEN (clist))
- {
- adjust_scrollbars (clist);
-
- if (was_visible)
- draw_rows (clist, NULL);
- }
-}
-
-static void
-sync_selection (GtkCList * clist,
- gint row,
- gint mode)
-{
- GList *list;
-
- list = clist->selection;
- while (list)
- {
- if ((gint) list->data >= row)
- switch (mode)
- {
- case SYNC_INSERT:
- (gint) list->data = (gint) list->data + 1;
- break;
-
- case SYNC_REMOVE:
- (gint) list->data = (gint) list->data - 1;
- break;
-
- default:
- break;
- }
-
- list = list->next;
- }
-}
-
-void
-gtk_clist_clear (GtkCList * clist)
-{
- GList *list;
-
- g_return_if_fail (clist != NULL);
-
- /* remove all the rows */
- for (list = clist->row_list; list; list = list->next)
- {
- GtkCListRow *clist_row;
-
- clist_row = list->data;
- row_delete (clist, clist_row);
- }
- g_list_free (clist->row_list);
-
- /* free up the selection list */
- g_list_free (clist->selection);
-
- clist->row_list = NULL;
- clist->row_list_end = NULL;
- clist->selection = NULL;
- clist->voffset = 0;
- clist->rows = 0;
-
- /* zero-out the scrollbars */
- if (clist->vscrollbar)
- {
- GTK_RANGE (clist->vscrollbar)->adjustment->value = 0.0;
- gtk_signal_emit_by_name (GTK_OBJECT (GTK_RANGE (clist->vscrollbar)->adjustment), "changed");
-
- if (!GTK_CLIST_FROZEN (clist))
- {
- adjust_scrollbars (clist);
- draw_rows (clist, NULL);
- }
- }
-}
-
-void
-gtk_clist_set_row_data (GtkCList * clist,
- gint row,
- gpointer data)
-{
- gtk_clist_set_row_data_full (clist, row, data, NULL);
-}
-
-void
-gtk_clist_set_row_data_full (GtkCList * clist,
- gint row,
- gpointer data,
- GtkDestroyNotify destroy)
-{
- GtkCListRow *clist_row;
-
- g_return_if_fail (clist != NULL);
-
- if (row < 0 || row > (clist->rows - 1))
- return;
-
- clist_row = (g_list_nth (clist->row_list, row))->data;
- clist_row->data = data;
- clist_row->destroy = destroy;
-
- /* re-send the selected signal if data is changed/added
- * so the application can respond to the new data --
- * this could be questionable behavior */
- if (clist_row->state == GTK_STATE_SELECTED)
- gtk_clist_select_row (clist, 0, 0);
-}
-
-gpointer
-gtk_clist_get_row_data (GtkCList * clist,
- gint row)
-{
- GtkCListRow *clist_row;
-
- g_return_val_if_fail (clist != NULL, NULL);
-
- if (row < 0 || row > (clist->rows - 1))
- return NULL;
-
- clist_row = (g_list_nth (clist->row_list, row))->data;
- return clist_row->data;
-}
-
-gint
-gtk_clist_find_row_from_data (GtkCList * clist,
- gpointer data)
-{
- GList *list;
- gint n;
-
- g_return_val_if_fail (clist != NULL, -1);
- g_return_val_if_fail (GTK_IS_CLIST (clist), -1);
-
- if (clist->rows < 1)
- return -1; /* is this an optimization or just worthless? */
-
- n = 0;
- list = clist->row_list;
- while (list)
- {
- GtkCListRow *clist_row;
-
- clist_row = list->data;
- if (clist_row->data == data)
- break;
- n++;
- list = list->next;
- }
-
- if (list)
- return n;
-
- return -1;
-}
-
-void
-gtk_clist_select_row (GtkCList * clist,
- gint row,
- gint column)
-{
- g_return_if_fail (clist != NULL);
-
- if (row < 0 || row >= clist->rows)
- return;
-
- if (column < -1 || column >= clist->columns)
- return;
-
- select_row (clist, row, column, NULL);
-}
-
-void
-gtk_clist_unselect_row (GtkCList * clist,
- gint row,
- gint column)
-{
- g_return_if_fail (clist != NULL);
-
- if (row < 0 || row >= clist->rows)
- return;
-
- if (column < -1 || column >= clist->columns)
- return;
-
- unselect_row (clist, row, column, NULL);
-}
-
-gint
-gtk_clist_row_is_visible (GtkCList * clist,
- gint row)
-{
- g_return_val_if_fail (clist != NULL, 0);
-
- if (row < 0 || row >= clist->rows)
- return 0;
-
- if (clist->row_height == 0)
- return 0;
-
- if (row < ROW_FROM_YPIXEL (clist, 0))
- return 0;
-
- if (row > ROW_FROM_YPIXEL (clist, clist->clist_window_height))
- return 0;
-
- return 1;
-}
-
-GtkAdjustment *
-gtk_clist_get_vadjustment (GtkCList * clist)
-{
- g_return_val_if_fail (clist != NULL, NULL);
- g_return_val_if_fail (GTK_IS_CLIST (clist), NULL);
-
- return gtk_range_get_adjustment (GTK_RANGE (clist->vscrollbar));
-}
-
-GtkAdjustment *
-gtk_clist_get_hadjustment (GtkCList * clist)
-{
- g_return_val_if_fail (clist != NULL, NULL);
- g_return_val_if_fail (GTK_IS_CLIST (clist), NULL);
-
- return gtk_range_get_adjustment (GTK_RANGE (clist->hscrollbar));
-}
-
-void
-gtk_clist_set_policy (GtkCList * clist,
- GtkPolicyType vscrollbar_policy,
- GtkPolicyType hscrollbar_policy)
-{
- g_return_if_fail (clist != NULL);
- g_return_if_fail (GTK_IS_CLIST (clist));
-
- if (clist->vscrollbar_policy != vscrollbar_policy)
- {
- clist->vscrollbar_policy = vscrollbar_policy;
-
- if (GTK_WIDGET (clist)->parent)
- gtk_widget_queue_resize (GTK_WIDGET (clist));
- }
-
- if (clist->hscrollbar_policy != hscrollbar_policy)
- {
- clist->hscrollbar_policy = hscrollbar_policy;
-
- if (GTK_WIDGET (clist)->parent)
- gtk_widget_queue_resize (GTK_WIDGET (clist));
- }
-}
-
-/*
- * GTKOBJECT
- * gtk_clist_destroy
- * gtk_clist_finalize
- */
-static void
-gtk_clist_destroy (GtkObject * object)
-{
- gint i;
- GtkCList *clist;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_CLIST (object));
-
- clist = GTK_CLIST (object);
-
- /* freeze the list */
- GTK_CLIST_SET_FLAGS (clist, CLIST_FROZEN);
-
- /* get rid of all the rows */
- gtk_clist_clear (clist);
-
- /* Since we don't have a _remove method, unparent the children
- * instead of destroying them so the focus will be unset properly.
- * (For other containers, the _remove method takes care of the
- * unparent) The destroy will happen when the refcount drops
- * to zero.
- */
-
- /* destroy the scrollbars */
- if (clist->vscrollbar)
- {
- gtk_widget_unparent (clist->vscrollbar);
- clist->vscrollbar = NULL;
- }
- if (clist->hscrollbar)
- {
- gtk_widget_unparent (clist->hscrollbar);
- clist->hscrollbar = NULL;
- }
-
- /* destroy the column buttons */
- for (i = 0; i < clist->columns; i++)
- if (clist->column[i].button)
- {
- gtk_widget_unparent (clist->column[i].button);
- clist->column[i].button = NULL;
- }
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (*GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-static void
-gtk_clist_finalize (GtkObject * object)
-{
- GtkCList *clist;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_CLIST (object));
-
- clist = GTK_CLIST (object);
-
- columns_delete (clist);
-
- g_mem_chunk_destroy (clist->cell_mem_chunk);
- g_mem_chunk_destroy (clist->row_mem_chunk);
-
- if (GTK_OBJECT_CLASS (parent_class)->finalize)
- (*GTK_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-/*
- * GTKWIDGET
- * gtk_clist_realize
- * gtk_clist_unrealize
- * gtk_clist_map
- * gtk_clist_unmap
- * gtk_clist_draw
- * gtk_clist_expose
- * gtk_clist_button_press
- * gtk_clist_button_release
- * gtk_clist_button_motion
- * gtk_clist_size_request
- * gtk_clist_size_allocate
- */
-static void
-gtk_clist_realize (GtkWidget * widget)
-{
- gint i;
- GtkCList *clist;
- GdkWindowAttr attributes;
- gint attributes_mask;
- GdkGCValues values;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_CLIST (widget));
-
- clist = GTK_CLIST (widget);
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget);
- attributes.event_mask |= (GDK_EXPOSURE_MASK |
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_KEY_PRESS_MASK);
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
-
- /* main window */
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, clist);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
-
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
-
- /* column-title window */
- clist->title_window = gdk_window_new (widget->window, &attributes, attributes_mask);
- gdk_window_set_user_data (clist->title_window, clist);
-
- gtk_style_set_background (widget->style, clist->title_window, GTK_STATE_SELECTED);
- gdk_window_show (clist->title_window);
-
- /* set things up so column buttons are drawn in title window */
- for (i = 0; i < clist->columns; i++)
- if (clist->column[i].button)
- gtk_widget_set_parent_window (clist->column[i].button, clist->title_window);
-
- /* clist-window */
- clist->clist_window = gdk_window_new (widget->window, &attributes, attributes_mask);
- gdk_window_set_user_data (clist->clist_window, clist);
-
- gdk_window_set_background (clist->clist_window, &widget->style->bg[GTK_STATE_PRELIGHT]);
- gdk_window_show (clist->clist_window);
- gdk_window_get_size (clist->clist_window, &clist->clist_window_width,
- &clist->clist_window_height);
-
- /* create resize windows */
- attributes.wclass = GDK_INPUT_ONLY;
- attributes.event_mask = (GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_POINTER_MOTION_MASK |
- GDK_POINTER_MOTION_HINT_MASK);
- attributes.cursor = clist->cursor_drag = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW);
- attributes_mask = GDK_WA_CURSOR;
-
- for (i = 0; i < clist->columns; i++)
- {
- clist->column[i].window = gdk_window_new (clist->title_window, &attributes, attributes_mask);
- gdk_window_set_user_data (clist->column[i].window, clist);
- gdk_window_show (clist->column[i].window);
- }
-
- /* GCs */
- clist->fg_gc = gdk_gc_new (widget->window);
- clist->bg_gc = gdk_gc_new (widget->window);
-
- /* We'll use this gc to do scrolling as well */
- gdk_gc_set_exposures (clist->fg_gc, TRUE);
-
- values.foreground = widget->style->white;
- values.function = GDK_XOR;
- values.subwindow_mode = GDK_INCLUDE_INFERIORS;
- clist->xor_gc = gdk_gc_new_with_values (widget->window,
- &values,
- GDK_GC_FOREGROUND |
- GDK_GC_FUNCTION |
- GDK_GC_SUBWINDOW);
-
- add_style_data (clist);
-}
-
-static void
-gtk_clist_unrealize (GtkWidget * widget)
-{
- gint i;
- GtkCList *clist;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_CLIST (widget));
-
- clist = GTK_CLIST (widget);
-
- GTK_CLIST_SET_FLAGS (clist, CLIST_FROZEN);
-
- gdk_cursor_destroy (clist->cursor_drag);
- gdk_gc_destroy (clist->xor_gc);
- gdk_gc_destroy (clist->fg_gc);
- gdk_gc_destroy (clist->bg_gc);
-
- for (i = 0; i < clist->columns; i++)
- if (clist->column[i].window)
- {
- gdk_window_set_user_data (clist->column[i].window, NULL);
- gdk_window_destroy (clist->column[i].window);
- clist->column[i].window = NULL;
- }
-
- gdk_window_set_user_data (clist->clist_window, NULL);
- gdk_window_destroy (clist->clist_window);
- clist->clist_window = NULL;
-
- gdk_window_set_user_data (clist->title_window, NULL);
- gdk_window_destroy (clist->title_window);
- clist->title_window = NULL;
-
- clist->cursor_drag = NULL;
- clist->xor_gc = NULL;
- clist->fg_gc = NULL;
- clist->bg_gc = NULL;
-
- if (GTK_WIDGET_CLASS (parent_class)->unrealize)
- (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
-}
-
-static void
-gtk_clist_map (GtkWidget * widget)
-{
- gint i;
- GtkCList *clist;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_CLIST (widget));
-
- clist = GTK_CLIST (widget);
-
- if (!GTK_WIDGET_MAPPED (widget))
- {
- GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
-
- gdk_window_show (widget->window);
- gdk_window_show (clist->title_window);
- gdk_window_show (clist->clist_window);
-
- /* map column buttons */
- for (i = 0; i < clist->columns; i++)
- if (clist->column[i].button &&
- GTK_WIDGET_VISIBLE (clist->column[i].button) &&
- !GTK_WIDGET_MAPPED (clist->column[i].button))
- gtk_widget_map (clist->column[i].button);
-
- /* map resize windows AFTER column buttons (above) */
- for (i = 0; i < clist->columns; i++)
- if (clist->column[i].window && clist->column[i].button)
- gdk_window_show (clist->column[i].window);
-
- /* map vscrollbars */
- if (GTK_WIDGET_VISIBLE (clist->vscrollbar) &&
- !GTK_WIDGET_MAPPED (clist->vscrollbar))
- gtk_widget_map (clist->vscrollbar);
-
- if (GTK_WIDGET_VISIBLE (clist->hscrollbar) &&
- !GTK_WIDGET_MAPPED (clist->hscrollbar))
- gtk_widget_map (clist->hscrollbar);
-
- /* unfreeze the list */
- GTK_CLIST_UNSET_FLAGS (clist, CLIST_FROZEN);
- }
-}
-
-static void
-gtk_clist_unmap (GtkWidget * widget)
-{
- gint i;
- GtkCList *clist;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_CLIST (widget));
-
- clist = GTK_CLIST (widget);
-
- if (GTK_WIDGET_MAPPED (widget))
- {
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
-
- for (i = 0; i < clist->columns; i++)
- if (clist->column[i].window)
- gdk_window_hide (clist->column[i].window);
-
- gdk_window_hide (clist->clist_window);
- gdk_window_hide (clist->title_window);
- gdk_window_hide (widget->window);
-
- /* unmap scrollbars */
- if (GTK_WIDGET_MAPPED (clist->vscrollbar))
- gtk_widget_unmap (clist->vscrollbar);
-
- if (GTK_WIDGET_MAPPED (clist->hscrollbar))
- gtk_widget_unmap (clist->hscrollbar);
-
- /* unmap column buttons */
- for (i = 0; i < clist->columns; i++)
- if (clist->column[i].button &&
- GTK_WIDGET_MAPPED (clist->column[i].button))
- gtk_widget_unmap (clist->column[i].button);
-
- /* freeze the list */
- GTK_CLIST_SET_FLAGS (clist, CLIST_FROZEN);
- }
-}
-
-static void
-gtk_clist_draw (GtkWidget * widget,
- GdkRectangle * area)
-{
- GtkCList *clist;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_CLIST (widget));
- g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- clist = GTK_CLIST (widget);
-
- gdk_window_clear_area (widget->window,
- area->x, area->y,
- area->width, area->height);
-
- /* draw list shadow/border */
- gtk_draw_shadow (widget->style, widget->window,
- GTK_STATE_NORMAL, clist->shadow_type,
- 0, 0,
- clist->clist_window_width + (2 * widget->style->klass->xthickness),
- clist->clist_window_height + (2 * widget->style->klass->ythickness) +
- clist->column_title_area.height);
-
- gdk_window_clear_area (clist->clist_window,
- 0, 0, -1, -1);
-
- draw_rows (clist, NULL);
- }
-}
-
-static gint
-gtk_clist_expose (GtkWidget * widget,
- GdkEventExpose * event)
-{
- GtkCList *clist;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_CLIST (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- clist = GTK_CLIST (widget);
-
- /* draw border */
- if (event->window == widget->window)
- gtk_draw_shadow (widget->style, widget->window,
- GTK_STATE_NORMAL, clist->shadow_type,
- 0, 0,
- clist->clist_window_width + (2 * widget->style->klass->xthickness),
- clist->clist_window_height + (2 * widget->style->klass->ythickness) +
- clist->column_title_area.height);
-
- /* exposure events on the list */
- if (event->window == clist->clist_window)
- draw_rows (clist, &event->area);
- }
-
- return FALSE;
-}
-
-static gint
-gtk_clist_button_press (GtkWidget * widget,
- GdkEventButton * event)
-{
- gint i;
- GtkCList *clist;
- gint x, y, row, column;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_CLIST (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- clist = GTK_CLIST (widget);
-
- /* selections on the list */
- if (event->window == clist->clist_window)
- {
- x = event->x;
- y = event->y;
-
- if (get_selection_info (clist, x, y, &row, &column))
- toggle_row (clist, row, column, event);
-
- return FALSE;
- }
-
- /* press on resize windows */
- for (i = 0; i < clist->columns; i++)
- if (clist->column[i].window && event->window == clist->column[i].window)
- {
- GTK_CLIST_SET_FLAGS (clist, CLIST_IN_DRAG);
- gtk_widget_get_pointer (widget, &clist->x_drag, NULL);
-
- gdk_pointer_grab (clist->column[i].window, FALSE,
- GDK_POINTER_MOTION_HINT_MASK |
- GDK_BUTTON1_MOTION_MASK |
- GDK_BUTTON_RELEASE_MASK,
- NULL, NULL, event->time);
-
- draw_xor_line (clist);
- return FALSE;
- }
-
- return FALSE;
-}
-
-static gint
-gtk_clist_button_release (GtkWidget * widget,
- GdkEventButton * event)
-{
- gint i, x, width, visible;
- GtkCList *clist;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_CLIST (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- clist = GTK_CLIST (widget);
-
- /* release on resize windows */
- if (GTK_CLIST_IN_DRAG (clist))
- for (i = 0; i < clist->columns; i++)
- if (clist->column[i].window && event->window == clist->column[i].window)
- {
- GTK_CLIST_UNSET_FLAGS (clist, CLIST_IN_DRAG);
- gtk_widget_get_pointer (widget, &x, NULL);
- width = new_column_width (clist, i, &x, &visible);
- gdk_pointer_ungrab (event->time);
-
- if (visible)
- draw_xor_line (clist);
-
- resize_column (clist, i, width);
- return FALSE;
- }
-
- return FALSE;
-}
-
-static gint
-gtk_clist_motion (GtkWidget * widget,
- GdkEventMotion * event)
-{
- gint i, x, visible;
- GtkCList *clist;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_CLIST (widget), FALSE);
-
- clist = GTK_CLIST (widget);
-
- if (GTK_CLIST_IN_DRAG (clist))
- for (i = 0; i < clist->columns; i++)
- if (clist->column[i].window && event->window == clist->column[i].window)
- {
- if (event->is_hint || event->window != widget->window)
- gtk_widget_get_pointer (widget, &x, NULL);
- else
- x = event->x;
-
- new_column_width (clist, i, &x, &visible);
- /* Welcome to my hack! I'm going to use a value of x_drage = -99999 to
- * indicate the the xor line is already no visible */
- if (!visible && clist->x_drag != -99999)
- {
- draw_xor_line (clist);
- clist->x_drag = -99999;
- }
-
- if (x != clist->x_drag && visible)
- {
- if (clist->x_drag != -99999)
- draw_xor_line (clist);
-
- clist->x_drag = x;
- draw_xor_line (clist);
- }
- }
-
- return TRUE;
-}
-
-static void
-gtk_clist_size_request (GtkWidget * widget,
- GtkRequisition * requisition)
-{
- gint i;
- GtkCList *clist;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_CLIST (widget));
- g_return_if_fail (requisition != NULL);
-
- clist = GTK_CLIST (widget);
-
- requisition->width = 0;
- requisition->height = 0;
-
- /* compute the size of the column title (title) area */
- clist->column_title_area.height = 0;
- if (GTK_CLIST_SHOW_TITLES (clist))
- for (i = 0; i < clist->columns; i++)
- if (clist->column[i].button)
- {
- gtk_widget_size_request (clist->column[i].button, &clist->column[i].button->requisition);
- clist->column_title_area.height = MAX (clist->column_title_area.height,
- clist->column[i].button->requisition.height);
- }
- requisition->height += clist->column_title_area.height;
-
- /* add the vscrollbar space */
- if ((clist->vscrollbar_policy == GTK_POLICY_AUTOMATIC) ||
- GTK_WIDGET_VISIBLE (clist->vscrollbar))
- {
- gtk_widget_size_request (clist->vscrollbar, &clist->vscrollbar->requisition);
-
- requisition->width += clist->vscrollbar->requisition.width + SCROLLBAR_SPACING (clist);
- requisition->height = MAX (requisition->height,
- clist->vscrollbar->requisition.height);
- }
-
- /* add the hscrollbar space */
- if ((clist->hscrollbar_policy == GTK_POLICY_AUTOMATIC) ||
- GTK_WIDGET_VISIBLE (clist->hscrollbar))
- {
- gtk_widget_size_request (clist->hscrollbar, &clist->hscrollbar->requisition);
-
- requisition->height += clist->hscrollbar->requisition.height + SCROLLBAR_SPACING (clist);
- requisition->width = MAX (clist->hscrollbar->requisition.width,
- requisition->width -
- clist->vscrollbar->requisition.width);
-
- }
-
- requisition->width += widget->style->klass->xthickness * 2 +
- GTK_CONTAINER (widget)->border_width * 2;
- requisition->height += widget->style->klass->ythickness * 2 +
- GTK_CONTAINER (widget)->border_width * 2;
-}
-
-static void
-gtk_clist_size_allocate (GtkWidget * widget,
- GtkAllocation * allocation)
-{
- GtkCList *clist;
- GtkAllocation clist_allocation;
- GtkAllocation child_allocation;
- gint i, vscrollbar_vis, hscrollbar_vis;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_CLIST (widget));
- g_return_if_fail (allocation != NULL);
-
- clist = GTK_CLIST (widget);
- widget->allocation = *allocation;
-
- if (GTK_WIDGET_REALIZED (widget))
- {
- gdk_window_move_resize (widget->window,
- allocation->x + GTK_CONTAINER (widget)->border_width,
- allocation->y + GTK_CONTAINER (widget)->border_width,
- allocation->width - GTK_CONTAINER (widget)->border_width * 2,
- allocation->height - GTK_CONTAINER (widget)->border_width * 2);
-
- /* use internal allocation structure for all the math
- * because it's easier than always subtracting the container
- * border width */
- clist->internal_allocation.x = 0;
- clist->internal_allocation.y = 0;
- clist->internal_allocation.width = allocation->width -
- GTK_CONTAINER (widget)->border_width * 2;
- clist->internal_allocation.height = allocation->height -
- GTK_CONTAINER (widget)->border_width * 2;
-
- /* allocate clist window assuming no scrollbars */
- clist_allocation.x = clist->internal_allocation.x + widget->style->klass->xthickness;
- clist_allocation.y = clist->internal_allocation.y + widget->style->klass->ythickness +
- clist->column_title_area.height;
- clist_allocation.width = clist->internal_allocation.width -
- (2 * widget->style->klass->xthickness);
- clist_allocation.height = clist->internal_allocation.height -
- (2 * widget->style->klass->xthickness) -
- clist->column_title_area.height;
-
- /*
- * here's where we decide to show/not show the scrollbars
- */
- vscrollbar_vis = 0;
- hscrollbar_vis = 0;
-
- for (i = 0; i <= 1; i++)
- {
- if (LIST_HEIGHT (clist) <= clist_allocation.height &&
- clist->vscrollbar_policy == GTK_POLICY_AUTOMATIC)
- {
- vscrollbar_vis = 0;
- }
- else
- {
- if (!vscrollbar_vis)
- {
- vscrollbar_vis = 1;
- clist_allocation.width -= clist->vscrollbar->requisition.width +
- SCROLLBAR_SPACING (clist);
- }
- }
-
- if (LIST_WIDTH (clist) <= clist_allocation.width &&
- clist->hscrollbar_policy == GTK_POLICY_AUTOMATIC)
- {
- hscrollbar_vis = 0;
- }
- else
- {
- if (!hscrollbar_vis)
- {
- hscrollbar_vis = 1;
- clist_allocation.height -= clist->hscrollbar->requisition.height +
- SCROLLBAR_SPACING (clist);
- }
- }
- }
-
- clist->clist_window_width = clist_allocation.width;
- clist->clist_window_height = clist_allocation.height;
-
- gdk_window_move_resize (clist->clist_window,
- clist_allocation.x,
- clist_allocation.y,
- clist_allocation.width,
- clist_allocation.height);
-
- /* position the window which holds the column title buttons */
- clist->column_title_area.x = widget->style->klass->xthickness;
- clist->column_title_area.y = widget->style->klass->ythickness;
- clist->column_title_area.width = clist_allocation.width;
-
- gdk_window_move_resize (clist->title_window,
- clist->column_title_area.x,
- clist->column_title_area.y,
- clist->column_title_area.width,
- clist->column_title_area.height);
-
- /* column button allocation */
- size_allocate_columns (clist);
- size_allocate_title_buttons (clist);
- adjust_scrollbars (clist);
-
- /* allocate the vscrollbar */
- if (vscrollbar_vis)
- {
- if (!GTK_WIDGET_VISIBLE (clist->vscrollbar))
- gtk_widget_show (clist->vscrollbar);
-
- child_allocation.x = clist->internal_allocation.x +
- clist->internal_allocation.width -
- clist->vscrollbar->requisition.width;
- child_allocation.y = clist->internal_allocation.y;
- child_allocation.width = clist->vscrollbar->requisition.width;
- child_allocation.height = clist->internal_allocation.height -
- (hscrollbar_vis ? (clist->hscrollbar->requisition.height + SCROLLBAR_SPACING (clist)) : 0);
-
- gtk_widget_size_allocate (clist->vscrollbar, &child_allocation);
- }
- else
- {
- if (GTK_WIDGET_VISIBLE (clist->vscrollbar))
- gtk_widget_hide (clist->vscrollbar);
- }
-
- if (hscrollbar_vis)
- {
- if (!GTK_WIDGET_VISIBLE (clist->hscrollbar))
- gtk_widget_show (clist->hscrollbar);
-
- child_allocation.x = clist->internal_allocation.x;
- child_allocation.y = clist->internal_allocation.y +
- clist->internal_allocation.height -
- clist->hscrollbar->requisition.height;
- child_allocation.width = clist->internal_allocation.width -
- (vscrollbar_vis ? (clist->vscrollbar->requisition.width + SCROLLBAR_SPACING (clist)) : 0);
- child_allocation.height = clist->hscrollbar->requisition.height;
-
- gtk_widget_size_allocate (clist->hscrollbar, &child_allocation);
- }
- else
- {
- if (GTK_WIDGET_VISIBLE (clist->hscrollbar))
- gtk_widget_hide (clist->hscrollbar);
- }
- }
-
- /* set the vscrollbar adjustments */
- adjust_scrollbars (clist);
-}
-
-gint
-gtk_clist_row_from_ypixel (GtkCList *clist, gint y)
-{
- g_return_val_if_fail (GTK_IS_CLIST (clist), 0);
- g_return_val_if_fail (y >= 0, 0);
-
- return ROW_FROM_YPIXEL (clist, y);
-}
-
-/*
- * GTKCONTAINER
- * gtk_clist_foreach
- */
-static void
-gtk_clist_foreach (GtkContainer * container,
- GtkCallback callback,
- gpointer callback_data)
-{
- gint i;
- GtkCList *clist;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_CLIST (container));
- g_return_if_fail (callback != NULL);
-
- clist = GTK_CLIST (container);
-
- /* callback for the column buttons */
- for (i = 0; i < clist->columns; i++)
- if (clist->column[i].button)
- (*callback) (clist->column[i].button, callback_data);
-
- /* callbacks for the scrollbars */
- if (clist->vscrollbar)
- (*callback) (clist->vscrollbar, callback_data);
- if (clist->hscrollbar)
- (*callback) (clist->hscrollbar, callback_data);
-}
-
-/*
- * DRAWING
- * draw_row
- * draw_rows
- */
-static void
-draw_row (GtkCList * clist,
- GdkRectangle * area,
- gint row,
- GtkCListRow * clist_row)
-{
- GtkWidget *widget;
- GdkGC *fg_gc, *bg_gc;
- GdkRectangle row_rectangle, cell_rectangle, clip_rectangle, intersect_rectangle,
- *rect;
- gint i, offset = 0, width, height, pixmap_width = 0;
- gint xsrc, ysrc, xdest, ydest;
-
- g_return_if_fail (clist != NULL);
-
- /* bail now if we arn't drawable yet */
- if (!GTK_WIDGET_DRAWABLE (clist))
- return;
-
- if (row < 0 || row >= clist->rows)
- return;
-
- widget = GTK_WIDGET (clist);
-
- /* if the function is passed the pointer to the row instead of null,
- * it avoids this expensive lookup */
- if (!clist_row)
- clist_row = (g_list_nth (clist->row_list, row))->data;
-
- /* rectangle of the entire row */
- row_rectangle.x = 0;
- row_rectangle.y = ROW_TOP_YPIXEL (clist, row);
- row_rectangle.width = clist->clist_window_width;
- row_rectangle.height = clist->row_height;
-
- /* rectangle of the cell spacing above the row */
- cell_rectangle.x = 0;
- cell_rectangle.y = row_rectangle.y - CELL_SPACING;
- cell_rectangle.width = row_rectangle.width;
- cell_rectangle.height = CELL_SPACING;
-
- /* rectangle used to clip drawing operations, it's y and height
- * positions only need to be set once, so we set them once here.
- * the x and width are set withing the drawing loop below once per
- * column */
- clip_rectangle.y = row_rectangle.y;
- clip_rectangle.height = row_rectangle.height;
-
- /* select GC for background rectangle */
- if (clist_row->state == GTK_STATE_SELECTED)
- {
- fg_gc = widget->style->fg_gc[GTK_STATE_SELECTED];
- bg_gc = widget->style->bg_gc[GTK_STATE_SELECTED];
- }
- else
- {
- if (clist_row->fg_set)
- {
- gdk_gc_set_foreground (clist->fg_gc, &clist_row->foreground);
- fg_gc = clist->fg_gc;
- }
- else
- fg_gc = widget->style->fg_gc[GTK_STATE_NORMAL];
-
- if (clist_row->bg_set)
- {
- gdk_gc_set_foreground (clist->bg_gc, &clist_row->background);
- bg_gc = clist->bg_gc;
- }
- else
- bg_gc = widget->style->bg_gc[GTK_STATE_PRELIGHT];
- }
-
- /* draw the cell borders and background */
- if (area)
- {
- if (gdk_rectangle_intersect (area, &cell_rectangle, &intersect_rectangle))
- gdk_draw_rectangle (clist->clist_window,
- widget->style->white_gc,
- TRUE,
- intersect_rectangle.x,
- intersect_rectangle.y,
- intersect_rectangle.width,
- intersect_rectangle.height);
-
- /* the last row has to clear it's bottom cell spacing too */
- if (clist_row == clist->row_list_end->data)
- {
- cell_rectangle.y += clist->row_height + CELL_SPACING;
-
- if (gdk_rectangle_intersect (area, &cell_rectangle, &intersect_rectangle))
- gdk_draw_rectangle (clist->clist_window,
- widget->style->white_gc,
- TRUE,
- intersect_rectangle.x,
- intersect_rectangle.y,
- intersect_rectangle.width,
- intersect_rectangle.height);
- }
-
- if (!gdk_rectangle_intersect (area, &row_rectangle, &intersect_rectangle))
- return;
-
- if (clist_row->state == GTK_STATE_SELECTED || clist_row->fg_set)
- gdk_draw_rectangle (clist->clist_window,
- bg_gc,
- TRUE,
- intersect_rectangle.x,
- intersect_rectangle.y,
- intersect_rectangle.width,
- intersect_rectangle.height);
- else
- gdk_window_clear_area (clist->clist_window,
- intersect_rectangle.x,
- intersect_rectangle.y,
- intersect_rectangle.width,
- intersect_rectangle.height);
- }
- else
- {
- gdk_draw_rectangle (clist->clist_window,
- widget->style->white_gc,
- TRUE,
- cell_rectangle.x,
- cell_rectangle.y,
- cell_rectangle.width,
- cell_rectangle.height);
-
- /* the last row has to clear it's bottom cell spacing too */
- if (clist_row == clist->row_list_end->data)
- {
- cell_rectangle.y += clist->row_height + CELL_SPACING;
-
- gdk_draw_rectangle (clist->clist_window,
- widget->style->white_gc,
- TRUE,
- cell_rectangle.x,
- cell_rectangle.y,
- cell_rectangle.width,
- cell_rectangle.height);
- }
-
- if (clist_row->state == GTK_STATE_SELECTED || clist_row->fg_set)
- gdk_draw_rectangle (clist->clist_window,
- bg_gc,
- TRUE,
- row_rectangle.x,
- row_rectangle.y,
- row_rectangle.width,
- row_rectangle.height);
- else
- gdk_window_clear_area (clist->clist_window,
- row_rectangle.x,
- row_rectangle.y,
- row_rectangle.width,
- row_rectangle.height);
- }
-
- /* iterate and draw all the columns (row cells) and draw their contents */
- for (i = 0; i < clist->columns; i++)
- {
- clip_rectangle.x = clist->column[i].area.x + clist->hoffset;
- clip_rectangle.width = clist->column[i].area.width;
-
- /* calculate clipping region clipping region */
- if (!area)
- {
- rect = &clip_rectangle;
- }
- else
- {
- if (!gdk_rectangle_intersect (area, &clip_rectangle, &intersect_rectangle))
- continue;
- rect = &intersect_rectangle;
- }
-
- /* calculate real width for column justification */
- switch (clist_row->cell[i].type)
- {
- case GTK_CELL_EMPTY:
- continue;
- break;
-
- case GTK_CELL_TEXT:
- width = gdk_string_width (GTK_WIDGET (clist)->style->font,
- GTK_CELL_TEXT (clist_row->cell[i])->text);
- break;
-
- case GTK_CELL_PIXMAP:
- gdk_window_get_size (GTK_CELL_PIXMAP (clist_row->cell[i])->pixmap, &width, &height);
- pixmap_width = width;
- break;
-
- case GTK_CELL_PIXTEXT:
- gdk_window_get_size (GTK_CELL_PIXTEXT (clist_row->cell[i])->pixmap, &width, &height);
- pixmap_width = width;
- width += GTK_CELL_PIXTEXT (clist_row->cell[i])->spacing;
- width = gdk_string_width (GTK_WIDGET (clist)->style->font,
- GTK_CELL_PIXTEXT (clist_row->cell[i])->text);
- break;
-
- case GTK_CELL_WIDGET:
- /* unimplimented */
- continue;
- break;
-
- default:
- continue;
- break;
- }
-
- switch (clist->column[i].justification)
- {
- case GTK_JUSTIFY_LEFT:
- offset = clip_rectangle.x;
- break;
-
- case GTK_JUSTIFY_RIGHT:
- offset = (clip_rectangle.x + clip_rectangle.width) - width;
- break;
-
- case GTK_JUSTIFY_CENTER:
- offset = (clip_rectangle.x + (clip_rectangle.width / 2)) - (width / 2);
- break;
-
- case GTK_JUSTIFY_FILL:
- offset = (clip_rectangle.x + (clip_rectangle.width / 2)) - (width / 2);
- break;
-
- default:
- offset = 0;
- break;
- };
-
- /* Draw Text or Pixmap */
- switch (clist_row->cell[i].type)
- {
- case GTK_CELL_EMPTY:
- continue;
- break;
-
- case GTK_CELL_TEXT:
- gdk_gc_set_clip_rectangle (fg_gc, rect);
-
- gdk_draw_string (clist->clist_window,
- widget->style->font,
- fg_gc,
- offset + clist_row->cell[i].horizontal,
- row_rectangle.y + clist->row_center_offset +
- clist_row->cell[i].vertical,
- GTK_CELL_TEXT (clist_row->cell[i])->text);
-
- gdk_gc_set_clip_rectangle (fg_gc, NULL);
- break;
-
- case GTK_CELL_PIXMAP:
- xsrc = 0;
- ysrc = 0;
- xdest = offset + clist_row->cell[i].horizontal;
- ydest = (clip_rectangle.y + (clip_rectangle.height / 2)) - height / 2 +
- clist_row->cell[i].vertical;
-
- if (GTK_CELL_PIXMAP (clist_row->cell[i])->mask)
- {
- gdk_gc_set_clip_mask (fg_gc, GTK_CELL_PIXMAP (clist_row->cell[i])->mask);
- gdk_gc_set_clip_origin (fg_gc, xdest, ydest);
- }
- gdk_draw_pixmap (clist->clist_window,
- fg_gc,
- GTK_CELL_PIXMAP (clist_row->cell[i])->pixmap,
- xsrc, ysrc,
- xdest,
- ydest,
- pixmap_width, height);
-
- if (GTK_CELL_PIXMAP (clist_row->cell[i])->mask)
- {
- gdk_gc_set_clip_origin (fg_gc, 0, 0);
- gdk_gc_set_clip_mask (fg_gc, NULL);
- }
- break;
-
- case GTK_CELL_PIXTEXT:
- /* draw the pixmap */
- xsrc = 0;
- ysrc = 0;
- xdest = offset + clist_row->cell[i].horizontal;
- ydest = (clip_rectangle.y + (clip_rectangle.height / 2)) - height / 2 +
- clist_row->cell[i].vertical;
-
- if (GTK_CELL_PIXTEXT (clist_row->cell[i])->mask)
- {
- gdk_gc_set_clip_mask (fg_gc, GTK_CELL_PIXTEXT (clist_row->cell[i])->mask);
- gdk_gc_set_clip_origin (fg_gc, xdest, ydest);
- }
-
- gdk_draw_pixmap (clist->clist_window,
- fg_gc,
- GTK_CELL_PIXTEXT (clist_row->cell[i])->pixmap,
- xsrc, ysrc,
- xdest,
- ydest,
- pixmap_width, height);
-
- gdk_gc_set_clip_origin (fg_gc, 0, 0);
-
- offset += pixmap_width + GTK_CELL_PIXTEXT (clist_row->cell[i])->spacing;
-
- /* draw the string */
- gdk_gc_set_clip_rectangle (fg_gc, rect);
-
- gdk_draw_string (clist->clist_window,
- widget->style->font,
- fg_gc,
- offset + clist_row->cell[i].horizontal,
- row_rectangle.y + clist->row_center_offset +
- clist_row->cell[i].vertical,
- GTK_CELL_PIXTEXT (clist_row->cell[i])->text);
-
- gdk_gc_set_clip_rectangle (fg_gc, NULL);
-
- break;
-
- case GTK_CELL_WIDGET:
- /* unimplimented */
- continue;
- break;
-
- default:
- continue;
- break;
- }
- }
-}
-
-static void
-draw_rows (GtkCList * clist,
- GdkRectangle * area)
-{
- GList *list;
- GtkCListRow *clist_row;
- int i, first_row, last_row;
-
- g_return_if_fail (clist != NULL);
- g_return_if_fail (GTK_IS_CLIST (clist));
-
- if (clist->row_height == 0 ||
- !GTK_WIDGET_DRAWABLE (clist))
- return;
-
- if (area)
- {
- first_row = ROW_FROM_YPIXEL (clist, area->y);
- last_row = ROW_FROM_YPIXEL (clist, area->y + area->height);
- }
- else
- {
- first_row = ROW_FROM_YPIXEL (clist, 0);
- last_row = ROW_FROM_YPIXEL (clist, clist->clist_window_height);
- }
-
- /* this is a small special case which exposes the bottom cell line
- * on the last row -- it might go away if I change the wall the cell spacings
- * are drawn */
- if (clist->rows == first_row)
- first_row--;
-
- list = g_list_nth (clist->row_list, first_row);
- i = first_row;
- while (list)
- {
- clist_row = list->data;
- list = list->next;
-
- if (i > last_row)
- return;
-
- draw_row (clist, area, i, clist_row);
- i++;
- }
-
- if (!area)
- gdk_window_clear_area (clist->clist_window, 0, ROW_TOP_YPIXEL (clist, i), -1, -1);
-}
-
-/*
- * SIZE ALLOCATION
- * size_allocate_title_buttons
- * size_allocate_columns
- */
-static void
-size_allocate_title_buttons (GtkCList * clist)
-{
- gint i, last_button = 0;
- GtkAllocation button_allocation;
-
- if (!GTK_WIDGET_REALIZED (clist))
- return;
-
- button_allocation.x = clist->hoffset;
- button_allocation.y = 0;
- button_allocation.width = 0;
- button_allocation.height = clist->column_title_area.height;
-
- for (i = 0; i < clist->columns; i++)
- {
- button_allocation.width += clist->column[i].area.width;
-
- if (i == clist->columns - 1)
- button_allocation.width += 2 * (CELL_SPACING + COLUMN_INSET);
- else
- button_allocation.width += CELL_SPACING + (2 * COLUMN_INSET);
-
- if (i == (clist->columns - 1) || clist->column[i + 1].button)
- {
- gtk_widget_size_allocate (clist->column[last_button].button, &button_allocation);
- button_allocation.x += button_allocation.width;
- button_allocation.width = 0;
-
- gdk_window_show (clist->column[last_button].window);
- gdk_window_move_resize (clist->column[last_button].window,
- button_allocation.x - (DRAG_WIDTH / 2),
- 0, DRAG_WIDTH, clist->column_title_area.height);
-
- last_button = i + 1;
- }
- else
- {
- gdk_window_hide (clist->column[i].window);
- }
- }
-}
-
-static void
-size_allocate_columns (GtkCList * clist)
-{
- gint i, xoffset = 0;
-
- if (!GTK_WIDGET_REALIZED (clist))
- return;
-
- for (i = 0; i < clist->columns; i++)
- {
- clist->column[i].area.x = xoffset + CELL_SPACING + COLUMN_INSET;
-
- if (i == clist->columns - 1)
- {
- gint width;
-
- if (clist->column[i].width_set)
- width = clist->column[i].width;
- else
- width = gdk_string_width (GTK_WIDGET (clist)->style->font, clist->column[i].title);
- clist->column[i].area.width = MAX (width,
- clist->clist_window_width -
- xoffset - (2 * (CELL_SPACING + COLUMN_INSET)));
-
- }
- else
- {
- clist->column[i].area.width = clist->column[i].width;
- }
-
- xoffset += clist->column[i].area.width + CELL_SPACING + (2 * COLUMN_INSET);
- }
-}
-
-/*
- * SELECTION
- * select_row
- * real_select_row
- * real_unselect_row
- * get_selection_info
- */
-static void
-toggle_row (GtkCList * clist,
- gint row,
- gint column,
- GdkEventButton * event)
-{
- gint i;
- GList *list;
- GtkCListRow *clist_row, *selected_row;
-
- i = 0;
- list = clist->row_list;
- selected_row = NULL;
-
- switch (clist->selection_mode)
- {
- case GTK_SELECTION_SINGLE:
- while (list)
- {
- clist_row = list->data;
- list = list->next;
-
- if (row == i)
- selected_row = clist_row;
- else if (clist_row->state == GTK_STATE_SELECTED)
- gtk_signal_emit (GTK_OBJECT (clist), clist_signals[UNSELECT_ROW],
- i, column, event);
-
- i++;
- }
-
- if (selected_row && selected_row->state == GTK_STATE_SELECTED)
- gtk_signal_emit (GTK_OBJECT (clist), clist_signals[UNSELECT_ROW],
- row, column, event);
- else
- gtk_signal_emit (GTK_OBJECT (clist), clist_signals[SELECT_ROW],
- row, column, event);
- break;
-
-
- case GTK_SELECTION_BROWSE:
- while (list)
- {
- clist_row = list->data;
- list = list->next;
-
- if (i != row && clist_row->state == GTK_STATE_SELECTED)
- gtk_signal_emit (GTK_OBJECT (clist), clist_signals[UNSELECT_ROW],
- i, column, event);
- i++;
- }
-
- gtk_signal_emit (GTK_OBJECT (clist), clist_signals[SELECT_ROW],
- row, column, event);
- break;
-
-
- case GTK_SELECTION_MULTIPLE:
- clist_row = (g_list_nth (clist->row_list, row))->data;
-
- if (clist_row->state == GTK_STATE_SELECTED)
- gtk_signal_emit (GTK_OBJECT (clist), clist_signals[UNSELECT_ROW],
- row, column, event);
- else
- gtk_signal_emit (GTK_OBJECT (clist), clist_signals[SELECT_ROW],
- row, column, event);
- break;
-
-
- case GTK_SELECTION_EXTENDED:
- break;
-
- default:
- break;
- }
-}
-
-static void
-select_row (GtkCList * clist,
- gint row,
- gint column,
- GdkEventButton * event)
-{
- gint i;
- GList *list;
- GtkCListRow *clist_row;
-
- switch (clist->selection_mode)
- {
- case GTK_SELECTION_SINGLE:
- case GTK_SELECTION_BROWSE:
- i = 0;
- list = clist->row_list;
- while (list)
- {
- clist_row = list->data;
- list = list->next;
-
- if (row != i && clist_row->state == GTK_STATE_SELECTED)
- gtk_signal_emit (GTK_OBJECT (clist), clist_signals[UNSELECT_ROW],
- i, column, event);
-
- i++;
- }
-
- gtk_signal_emit (GTK_OBJECT (clist), clist_signals[SELECT_ROW],
- row, column, event);
- break;
-
- case GTK_SELECTION_MULTIPLE:
- gtk_signal_emit (GTK_OBJECT (clist), clist_signals[SELECT_ROW],
- row, column, event);
-
- break;
-
- case GTK_SELECTION_EXTENDED:
- break;
-
- default:
- break;
- }
-}
-
-static void
-unselect_row (GtkCList * clist,
- gint row,
- gint column,
- GdkEventButton * event)
-{
- switch (clist->selection_mode)
- {
- case GTK_SELECTION_SINGLE:
- case GTK_SELECTION_BROWSE:
- case GTK_SELECTION_MULTIPLE:
- gtk_signal_emit (GTK_OBJECT (clist), clist_signals[UNSELECT_ROW],
- row, column, event);
- break;
-
- case GTK_SELECTION_EXTENDED:
- break;
-
- default:
- break;
- }
-}
-
-static void
-real_select_row (GtkCList * clist,
- gint row,
- gint column,
- GdkEventButton * event)
-{
- GtkCListRow *clist_row;
-
- g_return_if_fail (clist != NULL);
-
- if (row < 0 || row > (clist->rows - 1))
- return;
-
- clist_row = (g_list_nth (clist->row_list, row))->data;
-
- if (clist_row->state == GTK_STATE_NORMAL)
- {
- clist_row->state = GTK_STATE_SELECTED;
- clist->selection = g_list_append (clist->selection, (gpointer) row);
-
- if (!GTK_CLIST_FROZEN (clist) && gtk_clist_row_is_visible (clist, row))
- draw_row (clist, NULL, row, clist_row);
- }
-}
-
-static void
-real_unselect_row (GtkCList * clist,
- gint row,
- gint column,
- GdkEventButton * event)
-{
- GtkCListRow *clist_row;
-
- g_return_if_fail (clist != NULL);
-
- if (row < 0 || row > (clist->rows - 1))
- return;
-
- clist_row = (g_list_nth (clist->row_list, row))->data;
-
- if (clist_row->state == GTK_STATE_SELECTED)
- {
- clist_row->state = GTK_STATE_NORMAL;
- clist->selection = g_list_remove (clist->selection, (gpointer) row);
-
- if (!GTK_CLIST_FROZEN (clist) && gtk_clist_row_is_visible (clist, row))
- draw_row (clist, NULL, row, clist_row);
- }
-}
-
-static gint
-get_selection_info (GtkCList * clist,
- gint x,
- gint y,
- gint * row,
- gint * column)
-{
- gint trow, tcol;
-
- g_return_val_if_fail (clist != NULL, 0);
-
- /* bounds checking, return false if the user clicked
- * on a blank area */
- trow = ROW_FROM_YPIXEL (clist, y);
- if (trow >= clist->rows)
- return 0;
-
- if (row)
- *row = trow;
-
- tcol = COLUMN_FROM_XPIXEL (clist, x);
- if (tcol >= clist->columns)
- return 0;
-
- if (column)
- *column = tcol;
-
- return 1;
-}
-
-gint
-gtk_clist_get_selection_info (GtkCList *clist, gint x, gint y, gint *row, gint *column)
-{
- g_return_val_if_fail (clist != NULL, 0);
- g_return_val_if_fail (GTK_IS_CLIST (clist), 0);
- return get_selection_info (clist, x, y, row, column);
-}
-
-/*
- * RESIZE COLUMNS
- * draw_xor_line
- * new_column_width
- * resize_column
- */
-static void
-draw_xor_line (GtkCList * clist)
-{
- GtkWidget *widget;
-
- g_return_if_fail (clist != NULL);
-
- widget = GTK_WIDGET (clist);
-
- gdk_draw_line (widget->window, clist->xor_gc,
- clist->x_drag,
- widget->style->klass->ythickness,
- clist->x_drag,
- clist->column_title_area.height + clist->clist_window_height + 1);
-}
-
-/* this function returns the new width of the column being resized given
- * the column and x position of the cursor; the x cursor position is passed
- * in as a pointer and automagicly corrected if it's beyond min/max limits */
-static gint
-new_column_width (GtkCList * clist,
- gint column,
- gint * x,
- gint * visible)
-{
- gint cx, rx, width;
-
- cx = *x;
-
- /* first translate the x position from widget->window
- * to clist->clist_window */
- cx -= GTK_WIDGET (clist)->style->klass->xthickness;
-
- /* rx is x from the list beginning */
- rx = cx - clist->hoffset;
-
- /* you can't shrink a column to less than its minimum width */
- if (cx < (COLUMN_LEFT_XPIXEL (clist, column) + CELL_SPACING + COLUMN_INSET + COLUMN_MIN_WIDTH))
- {
- *x = cx = COLUMN_LEFT_XPIXEL (clist, column) + CELL_SPACING + COLUMN_INSET + COLUMN_MIN_WIDTH +
- GTK_WIDGET (clist)->style->klass->xthickness;
- cx -= GTK_WIDGET (clist)->style->klass->xthickness;
- rx = cx - clist->hoffset;
- }
-
- if (cx > clist->clist_window_width)
- *visible = 0;
- else
- *visible = 1;
-
- /* calculate new column width making sure it doesn't end up
- * less than the minimum width */
- width = (rx - COLUMN_LEFT (clist, column)) - COLUMN_INSET -
- ((clist->columns == (column - 1)) ? CELL_SPACING : 0);
- if (width < COLUMN_MIN_WIDTH)
- width = COLUMN_MIN_WIDTH;
-
- return width;
-}
-
-/* this will do more later */
-static void
-resize_column (GtkCList * clist,
- gint column,
- gint width)
-{
- gtk_clist_set_column_width (clist, column, width);
-}
-
-/* BUTTONS */
-static void
-column_button_create (GtkCList * clist,
- gint column)
-{
- GtkWidget *button;
-
- button = clist->column[column].button = gtk_button_new ();
- gtk_widget_set_parent (button, GTK_WIDGET (clist));
- if (GTK_WIDGET_REALIZED (clist) && clist->title_window)
- gtk_widget_set_parent_window (clist->column[column].button, clist->title_window);
-
- gtk_signal_connect (GTK_OBJECT (button),
- "clicked",
- (GtkSignalFunc) column_button_clicked,
- (gpointer) clist);
-
- gtk_widget_show (button);
-}
-
-static void
-column_button_clicked (GtkWidget * widget,
- gpointer data)
-{
- gint i;
- GtkCList *clist;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_CLIST (data));
-
- clist = GTK_CLIST (data);
-
- /* find the column who's button was pressed */
- for (i = 0; i < clist->columns; i++)
- if (clist->column[i].button == widget)
- break;
-
- gtk_signal_emit (GTK_OBJECT (clist), clist_signals[CLICK_COLUMN], i);
-}
-
-/*
- * SCROLLBARS
- *
- * functions:
- * create_scrollbars
- * adjust_scrollbars
- * vadjustment_changed
- * hadjustment_changed
- * vadjustment_value_changed
- * hadjustment_value_changed
- */
-static void
-create_scrollbars (GtkCList * clist)
-{
- GtkAdjustment *adjustment;
-
- clist->vscrollbar = gtk_vscrollbar_new (NULL);
- adjustment = gtk_range_get_adjustment (GTK_RANGE (clist->vscrollbar));
-
- gtk_signal_connect (GTK_OBJECT (adjustment), "changed",
- (GtkSignalFunc) vadjustment_changed,
- (gpointer) clist);
-
- gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
- (GtkSignalFunc) vadjustment_value_changed,
- (gpointer) clist);
-
- gtk_widget_set_parent (clist->vscrollbar, GTK_WIDGET (clist));
- gtk_widget_show (clist->vscrollbar);
-
- clist->hscrollbar = gtk_hscrollbar_new (NULL);
- adjustment = gtk_range_get_adjustment (GTK_RANGE (clist->hscrollbar));
-
- gtk_signal_connect (GTK_OBJECT (adjustment), "changed",
- (GtkSignalFunc) hadjustment_changed,
- (gpointer) clist);
-
- gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
- (GtkSignalFunc) hadjustment_value_changed,
- (gpointer) clist);
-
- gtk_widget_set_parent (clist->hscrollbar, GTK_WIDGET (clist));
- gtk_widget_show (clist->hscrollbar);
-}
-
-static void
-adjust_scrollbars (GtkCList * clist)
-{
- GTK_RANGE (clist->vscrollbar)->adjustment->page_size = clist->clist_window_height;
- GTK_RANGE (clist->vscrollbar)->adjustment->page_increment = clist->clist_window_height / 2;
- GTK_RANGE (clist->vscrollbar)->adjustment->step_increment = 10;
- GTK_RANGE (clist->vscrollbar)->adjustment->lower = 0;
- GTK_RANGE (clist->vscrollbar)->adjustment->upper = LIST_HEIGHT (clist);
-
- if (clist->clist_window_height - clist->voffset > LIST_HEIGHT (clist))
- {
- GTK_RANGE (clist->vscrollbar)->adjustment->value = LIST_HEIGHT (clist) -
- clist->clist_window_height;
- gtk_signal_emit_by_name (GTK_OBJECT (GTK_RANGE (clist->vscrollbar)->adjustment),
- "value_changed");
- }
-
- GTK_RANGE (clist->hscrollbar)->adjustment->page_size = clist->clist_window_width;
- GTK_RANGE (clist->hscrollbar)->adjustment->page_increment = clist->clist_window_width / 2;
- GTK_RANGE (clist->hscrollbar)->adjustment->step_increment = 10;
- GTK_RANGE (clist->hscrollbar)->adjustment->lower = 0;
- GTK_RANGE (clist->hscrollbar)->adjustment->upper = LIST_WIDTH (clist);
-
- if (clist->clist_window_width - clist->hoffset > LIST_WIDTH (clist))
- {
- GTK_RANGE (clist->hscrollbar)->adjustment->value = LIST_WIDTH (clist) -
- clist->clist_window_width;
- gtk_signal_emit_by_name (GTK_OBJECT (GTK_RANGE (clist->hscrollbar)->adjustment),
- "value_changed");
- }
-
- if (LIST_HEIGHT (clist) <= clist->clist_window_height &&
- clist->vscrollbar_policy == GTK_POLICY_AUTOMATIC)
- {
- if (GTK_WIDGET_VISIBLE (clist->vscrollbar))
- {
- gtk_widget_hide (clist->vscrollbar);
- gtk_widget_queue_resize (GTK_WIDGET (clist));
- }
- }
- else
- {
- if (!GTK_WIDGET_VISIBLE (clist->vscrollbar))
- {
- gtk_widget_show (clist->vscrollbar);
- gtk_widget_queue_resize (GTK_WIDGET (clist));
- }
- }
-
- if (LIST_WIDTH (clist) <= clist->clist_window_width &&
- clist->hscrollbar_policy == GTK_POLICY_AUTOMATIC)
- {
- if (GTK_WIDGET_VISIBLE (clist->hscrollbar))
- {
- gtk_widget_hide (clist->hscrollbar);
- gtk_widget_queue_resize (GTK_WIDGET (clist));
- }
- }
- else
- {
- if (!GTK_WIDGET_VISIBLE (clist->hscrollbar))
- {
- gtk_widget_show (clist->hscrollbar);
- gtk_widget_queue_resize (GTK_WIDGET (clist));
- }
- }
-
- gtk_signal_emit_by_name (GTK_OBJECT (GTK_RANGE (clist->vscrollbar)->adjustment), "changed");
- gtk_signal_emit_by_name (GTK_OBJECT (GTK_RANGE (clist->hscrollbar)->adjustment), "changed");
-}
-
-static void
-vadjustment_changed (GtkAdjustment * adjustment,
- gpointer data)
-{
- GtkCList *clist;
-
- g_return_if_fail (adjustment != NULL);
- g_return_if_fail (data != NULL);
-
- clist = GTK_CLIST (data);
-}
-
-static void
-hadjustment_changed (GtkAdjustment * adjustment,
- gpointer data)
-{
- GtkCList *clist;
-
- g_return_if_fail (adjustment != NULL);
- g_return_if_fail (data != NULL);
-
- clist = GTK_CLIST (data);
-}
-
-static void
-check_exposures (GtkCList *clist)
-{
- GdkEvent *event;
-
- if (!GTK_WIDGET_REALIZED (clist))
- return;
-
- /* Make sure graphics expose events are processed before scrolling
- * again */
- while ((event = gdk_event_get_graphics_expose (clist->clist_window)) != NULL)
- {
- gtk_widget_event (GTK_WIDGET (clist), event);
- if (event->expose.count == 0)
- {
- gdk_event_free (event);
- break;
- }
- gdk_event_free (event);
- }
-}
-
-static void
-vadjustment_value_changed (GtkAdjustment * adjustment,
- gpointer data)
-{
- GtkCList *clist;
- GdkRectangle area;
- gint diff, value;
-
- g_return_if_fail (adjustment != NULL);
- g_return_if_fail (data != NULL);
- g_return_if_fail (GTK_IS_CLIST (data));
-
- clist = GTK_CLIST (data);
-
- if (!GTK_WIDGET_DRAWABLE (clist))
- return;
-
- value = adjustment->value;
-
- if (adjustment == gtk_range_get_adjustment (GTK_RANGE (clist->vscrollbar)))
- {
- if (value > -clist->voffset)
- {
- /* scroll down */
- diff = value + clist->voffset;
-
- /* we have to re-draw the whole screen here... */
- if (diff >= clist->clist_window_height)
- {
- clist->voffset = -value;
- draw_rows (clist, NULL);
- return;
- }
-
- if ((diff != 0) && (diff != clist->clist_window_height))
- gdk_window_copy_area (clist->clist_window,
- clist->fg_gc,
- 0, 0,
- clist->clist_window,
- 0,
- diff,
- clist->clist_window_width,
- clist->clist_window_height - diff);
-
- area.x = 0;
- area.y = clist->clist_window_height - diff;
- area.width = clist->clist_window_width;
- area.height = diff;
- }
- else
- {
- /* scroll up */
- diff = -clist->voffset - value;
-
- /* we have to re-draw the whole screen here... */
- if (diff >= clist->clist_window_height)
- {
- clist->voffset = -value;
- draw_rows (clist, NULL);
- return;
- }
-
- if ((diff != 0) && (diff != clist->clist_window_height))
- gdk_window_copy_area (clist->clist_window,
- clist->fg_gc,
- 0, diff,
- clist->clist_window,
- 0,
- 0,
- clist->clist_window_width,
- clist->clist_window_height - diff);
-
- area.x = 0;
- area.y = 0;
- area.width = clist->clist_window_width;
- area.height = diff;
-
- }
-
- clist->voffset = -value;
- if ((diff != 0) && (diff != clist->clist_window_height))
- check_exposures (clist);
- }
-
- draw_rows (clist, &area);
-}
-
-static void
-hadjustment_value_changed (GtkAdjustment * adjustment,
- gpointer data)
-{
- GtkCList *clist;
- GdkRectangle area;
- gint i, diff, value;
-
- g_return_if_fail (adjustment != NULL);
- g_return_if_fail (data != NULL);
- g_return_if_fail (GTK_IS_CLIST (data));
-
- clist = GTK_CLIST (data);
-
- if (!GTK_WIDGET_DRAWABLE (clist))
- return;
-
- value = adjustment->value;
-
- if (adjustment == gtk_range_get_adjustment (GTK_RANGE (clist->hscrollbar)))
- {
- /* move the column buttons and resize windows */
- for (i = 0; i < clist->columns; i++)
- {
- if (clist->column[i].button)
- {
- clist->column[i].button->allocation.x -= value + clist->hoffset;
-
- if (clist->column[i].button->window)
- {
- gdk_window_move (clist->column[i].button->window,
- clist->column[i].button->allocation.x,
- clist->column[i].button->allocation.y);
-
- if (clist->column[i].window)
- gdk_window_move (clist->column[i].window,
- clist->column[i].button->allocation.x +
- clist->column[i].button->allocation.width -
- (DRAG_WIDTH / 2), 0);
- }
- }
- }
-
- if (value > -clist->hoffset)
- {
- /* scroll right */
- diff = value + clist->hoffset;
-
- /* we have to re-draw the whole screen here... */
- if (diff >= clist->clist_window_width)
- {
- clist->hoffset = -value;
- draw_rows (clist, NULL);
- return;
- }
-
- if ((diff != 0) && (diff != clist->clist_window_width))
- gdk_window_copy_area (clist->clist_window,
- clist->fg_gc,
- 0, 0,
- clist->clist_window,
- diff,
- 0,
- clist->clist_window_width - diff,
- clist->clist_window_height);
-
- area.x = clist->clist_window_width - diff;
- area.y = 0;
- area.width = diff;
- area.height = clist->clist_window_height;
- }
- else
- {
- /* scroll left */
- diff = -clist->hoffset - value;
-
- /* we have to re-draw the whole screen here... */
- if (diff >= clist->clist_window_width)
- {
- clist->hoffset = -value;
- draw_rows (clist, NULL);
- return;
- }
-
- if ((diff != 0) && (diff != clist->clist_window_width))
- gdk_window_copy_area (clist->clist_window,
- clist->fg_gc,
- diff, 0,
- clist->clist_window,
- 0,
- 0,
- clist->clist_window_width - diff,
- clist->clist_window_height);
-
- area.x = 0;
- area.y = 0;
- area.width = diff;
- area.height = clist->clist_window_height;
- }
-
- clist->hoffset = -value;
- if ((diff != 0) && (diff != clist->clist_window_width))
- check_exposures (clist);
- }
-
- draw_rows (clist, &area);
-}
-
-/*
- * Memory Allocation/Distruction Routines for GtkCList stuctures
- *
- * functions:
- * columns_new
- * column_title_new
- * columns_delete
- * row_new
- * row_delete
- * cell_empty
- * cell_set_text
- * cell_set_pixmap
- */
-static GtkCListColumn *
-columns_new (GtkCList * clist)
-{
- gint i;
- GtkCListColumn *column;
-
- column = g_new (GtkCListColumn, clist->columns);
-
- for (i = 0; i < clist->columns; i++)
- {
- column[i].area.x = 0;
- column[i].area.y = 0;
- column[i].area.width = 0;
- column[i].area.height = 0;
- column[i].title = NULL;
- column[i].button = NULL;
- column[i].window = NULL;
- column[i].width = 0;
- column[i].width_set = FALSE;
- column[i].justification = GTK_JUSTIFY_LEFT;
- }
-
- return column;
-}
-
-static void
-column_title_new (GtkCList * clist,
- gint column,
- gchar * title)
-{
- if (clist->column[column].title)
- g_free (clist->column[column].title);
-
- clist->column[column].title = g_strdup (title);
-}
-
-static void
-columns_delete (GtkCList * clist)
-{
- gint i;
-
- for (i = 0; i < clist->columns; i++)
- if (clist->column[i].title)
- g_free (clist->column[i].title);
-
- g_free (clist->column);
-}
-
-static GtkCListRow *
-row_new (GtkCList * clist)
-{
- int i;
- GtkCListRow *clist_row;
-
- clist_row = g_chunk_new (GtkCListRow, clist->row_mem_chunk);
- clist_row->cell = g_chunk_new (GtkCell, clist->cell_mem_chunk);
-
- for (i = 0; i < clist->columns; i++)
- {
- clist_row->cell[i].type = GTK_CELL_EMPTY;
- clist_row->cell[i].vertical = 0;
- clist_row->cell[i].horizontal = 0;
- }
-
- clist_row->fg_set = FALSE;
- clist_row->bg_set = FALSE;
- clist_row->state = GTK_STATE_NORMAL;
- clist_row->data = NULL;
- clist_row->destroy = NULL;
-
- return clist_row;
-}
-
-static void
-row_delete (GtkCList * clist,
- GtkCListRow * clist_row)
-{
- gint i;
-
- for (i = 0; i < clist->columns; i++)
- cell_empty (clist, clist_row, i);
-
- if (clist_row->destroy)
- clist_row->destroy (clist_row->data);
-
- g_mem_chunk_free (clist->cell_mem_chunk, clist_row->cell);
- g_mem_chunk_free (clist->row_mem_chunk, clist_row);
-}
-
-static void
-cell_empty (GtkCList * clist,
- GtkCListRow * clist_row,
- gint column)
-{
- switch (clist_row->cell[column].type)
- {
- case GTK_CELL_EMPTY:
- break;
-
- case GTK_CELL_TEXT:
- g_free (GTK_CELL_TEXT (clist_row->cell[column])->text);
- break;
-
- case GTK_CELL_PIXMAP:
- gdk_pixmap_unref (GTK_CELL_PIXMAP (clist_row->cell[column])->pixmap);
- if (GTK_CELL_PIXMAP (clist_row->cell[column])->mask)
- gdk_bitmap_unref (GTK_CELL_PIXMAP (clist_row->cell[column])->mask);
- break;
-
- case GTK_CELL_PIXTEXT:
- g_free (GTK_CELL_PIXTEXT (clist_row->cell[column])->text);
- gdk_pixmap_unref (GTK_CELL_PIXTEXT (clist_row->cell[column])->pixmap);
- if (GTK_CELL_PIXTEXT (clist_row->cell[column])->mask)
- gdk_bitmap_unref (GTK_CELL_PIXTEXT (clist_row->cell[column])->mask);
- break;
-
- case GTK_CELL_WIDGET:
- /* unimplimented */
- break;
-
- default:
- break;
- }
-
- clist_row->cell[column].type = GTK_CELL_EMPTY;
-}
-
-static void
-cell_set_text (GtkCList * clist,
- GtkCListRow * clist_row,
- gint column,
- gchar * text)
-{
- cell_empty (clist, clist_row, column);
-
- if (text)
- {
- clist_row->cell[column].type = GTK_CELL_TEXT;
- GTK_CELL_TEXT (clist_row->cell[column])->text = g_strdup (text);
- }
-}
-
-static void
-cell_set_pixmap (GtkCList * clist,
- GtkCListRow * clist_row,
- gint column,
- GdkPixmap * pixmap,
- GdkBitmap * mask)
-{
- cell_empty (clist, clist_row, column);
-
- if (pixmap)
- {
- clist_row->cell[column].type = GTK_CELL_PIXMAP;
- GTK_CELL_PIXMAP (clist_row->cell[column])->pixmap = pixmap;
- /* We set the mask even if it is NULL */
- GTK_CELL_PIXMAP (clist_row->cell[column])->mask = mask;
- }
-}
-
-static void
-cell_set_pixtext (GtkCList * clist,
- GtkCListRow * clist_row,
- gint column,
- gchar * text,
- guint8 spacing,
- GdkPixmap * pixmap,
- GdkBitmap * mask)
-{
- cell_empty (clist, clist_row, column);
-
- if (text && pixmap)
- {
- clist_row->cell[column].type = GTK_CELL_PIXTEXT;
- GTK_CELL_PIXTEXT (clist_row->cell[column])->text = g_strdup (text);
- GTK_CELL_PIXTEXT (clist_row->cell[column])->spacing = spacing;
- GTK_CELL_PIXTEXT (clist_row->cell[column])->pixmap = pixmap;
- GTK_CELL_PIXTEXT (clist_row->cell[column])->mask = mask;
- }
-}
-
-/* Fill in data after widget is realized and has style */
-
-static void
-add_style_data (GtkCList * clist)
-{
- GtkWidget *widget;
-
- widget = GTK_WIDGET(clist);
-
- /* text properties */
- if (!GTK_CLIST_ROW_HEIGHT_SET (clist))
- {
- clist->row_height = widget->style->font->ascent + widget->style->font->descent + 1;
- clist->row_center_offset = widget->style->font->ascent + 1.5;
- }
- else
- {
- gint text_height;
- text_height = clist->row_height - (GTK_WIDGET (clist)->style->font->ascent +
- GTK_WIDGET (clist) ->style->font->descent + 1);
- clist->row_center_offset = (text_height / 2) + GTK_WIDGET (clist)->style->font->ascent + 1.5;
- }
-
- /* Column widths */
-}
diff --git a/gtk/gtkclist.h b/gtk/gtkclist.h
deleted file mode 100644
index 73518468df..0000000000
--- a/gtk/gtkclist.h
+++ /dev/null
@@ -1,488 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball, Josh MacDonald
- * Copyright (C) 1997-1998 Jay Painter <jpaint@serv.net><jpaint@gimp.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_CLIST_H__
-#define __GTK_CLIST_H__
-
-#include <gdk/gdk.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkalignment.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkhscrollbar.h>
-#include <gtk/gtkvscrollbar.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-/* clist flags */
-enum
-{
- CLIST_FROZEN = 1 << 0,
- CLIST_IN_DRAG = 1 << 1,
- CLIST_ROW_HEIGHT_SET = 1 << 2,
- CLIST_SHOW_TITLES = 1 << 3
-};
-
-/* cell types */
-typedef enum
-{
- GTK_CELL_EMPTY,
- GTK_CELL_TEXT,
- GTK_CELL_PIXMAP,
- GTK_CELL_PIXTEXT,
- GTK_CELL_WIDGET
-} GtkCellType;
-
-#define GTK_CLIST(obj) GTK_CHECK_CAST (obj, gtk_clist_get_type (), GtkCList)
-#define GTK_CLIST_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_clist_get_type (), GtkCListClass)
-#define GTK_IS_CLIST(obj) GTK_CHECK_TYPE (obj, gtk_clist_get_type ())
-
-#define GTK_CLIST_FLAGS(clist) (GTK_CLIST (clist)->flags)
-#define GTK_CLIST_SET_FLAGS(clist,flag) (GTK_CLIST_FLAGS (clist) |= (flag))
-#define GTK_CLIST_UNSET_FLAGS(clist,flag) (GTK_CLIST_FLAGS (clist) &= ~(flag))
-
-#define GTK_CLIST_FROZEN(clist) (GTK_CLIST_FLAGS (clist) & CLIST_FROZEN)
-#define GTK_CLIST_IN_DRAG(clist) (GTK_CLIST_FLAGS (clist) & CLIST_IN_DRAG)
-#define GTK_CLIST_ROW_HEIGHT_SET(clist) (GTK_CLIST_FLAGS (clist) & CLIST_ROW_HEIGHT_SET)
-#define GTK_CLIST_SHOW_TITLES(clist) (GTK_CLIST_FLAGS (clist) & CLIST_SHOW_TITLES)
-
-/* pointer casting for cells */
-#define GTK_CELL_TEXT(cell) (((GtkCellText *) &(cell)))
-#define GTK_CELL_PIXMAP(cell) (((GtkCellPixmap *) &(cell)))
-#define GTK_CELL_PIXTEXT(cell) (((GtkCellPixText *) &(cell)))
-#define GTK_CELL_WIDGET(cell) (((GtkCellWidget *) &(cell)))
-
-typedef struct _GtkCList GtkCList;
-typedef struct _GtkCListClass GtkCListClass;
-typedef struct _GtkCListColumn GtkCListColumn;
-typedef struct _GtkCListRow GtkCListRow;
-
-typedef struct _GtkCell GtkCell;
-typedef struct _GtkCellText GtkCellText;
-typedef struct _GtkCellPixmap GtkCellPixmap;
-typedef struct _GtkCellPixText GtkCellPixText;
-typedef struct _GtkCellWidget GtkCellWidget;
-
-struct _GtkCList
-{
- GtkContainer container;
-
- guint8 flags;
-
- /* mem chunks */
- GMemChunk *row_mem_chunk;
- GMemChunk *cell_mem_chunk;
-
- /* allocation rectangle after the conatiner_border_width
- * and the width of the shadow border */
- GdkRectangle internal_allocation;
-
- /* rows */
- gint rows;
- gint row_center_offset;
- gint row_height;
- GList *row_list;
- GList *row_list_end;
-
- /* columns */
- gint columns;
- GdkRectangle column_title_area;
- GdkWindow *title_window;
-
- /* dynamicly allocated array of column structures */
- GtkCListColumn *column;
-
- /*the scrolling window and it's height and width to
- * make things a little speedier */
- GdkWindow *clist_window;
- gint clist_window_width;
- gint clist_window_height;
-
- /* offsets for scrolling */
- gint hoffset;
- gint voffset;
-
- /* border shadow style */
- GtkShadowType shadow_type;
-
- /* the list's selection mode (gtkenums.h) */
- GtkSelectionMode selection_mode;
-
- /* list of selected rows */
- GList *selection;
-
- /* scrollbars */
- GtkWidget *vscrollbar;
- GtkWidget *hscrollbar;
- guint8 vscrollbar_policy;
- guint8 hscrollbar_policy;
-
- /* xor GC for the vertical drag line */
- GdkGC *xor_gc;
-
- /* gc for drawing unselected cells */
- GdkGC *fg_gc;
- GdkGC *bg_gc;
-
- /* cursor used to indicate dragging */
- GdkCursor *cursor_drag;
-
- /* the current x-pixel location of the xor-drag line */
- gint x_drag;
-};
-
-struct _GtkCListClass
-{
- GtkContainerClass parent_class;
-
- void (*select_row) (GtkCList * clist,
- gint row,
- gint column,
- GdkEventButton * event);
- void (*unselect_row) (GtkCList * clist,
- gint row,
- gint column,
- GdkEventButton * event);
- void (*click_column) (GtkCList * clist,
- gint column);
-
- gint scrollbar_spacing;
-};
-
-struct _GtkCListColumn
-{
- gchar *title;
- GdkRectangle area;
-
- GtkWidget *button;
- GdkWindow *window;
-
- gint width;
- GtkJustification justification;
-
- gint width_set : 1;
-};
-
-struct _GtkCListRow
-{
- GtkCell *cell;
- GtkStateType state;
-
- GdkColor foreground;
- GdkColor background;
-
- gpointer data;
- GtkDestroyNotify destroy;
-
- gint fg_set : 1;
- gint bg_set : 1;
-};
-
-/* Cell Structures */
-struct _GtkCellText
-{
- GtkCellType type;
-
- gint vertical;
- gint horizontal;
-
- gchar *text;
-};
-
-struct _GtkCellPixmap
-{
- GtkCellType type;
-
- gint vertical;
- gint horizontal;
-
- GdkPixmap *pixmap;
- GdkBitmap *mask;
-};
-
-struct _GtkCellPixText
-{
- GtkCellType type;
-
- gint vertical;
- gint horizontal;
-
- gchar *text;
- guint8 spacing;
- GdkPixmap *pixmap;
- GdkBitmap *mask;
-};
-
-struct _GtkCellWidget
-{
- GtkCellType type;
-
- gint vertical;
- gint horizontal;
-
- GtkWidget *widget;
-};
-
-struct _GtkCell
-{
- GtkCellType type;
-
- gint vertical;
- gint horizontal;
-
- union {
- gchar *text;
-
- struct {
- GdkPixmap *pixmap;
- GdkBitmap *mask;
- } pm;
-
- struct {
- gchar *text;
- guint8 spacing;
- GdkPixmap *pixmap;
- GdkBitmap *mask;
- } pt;
-
- GtkWidget *widget;
- } u;
-};
-
-guint gtk_clist_get_type (void);
-
-/* constructers useful for gtk-- wrappers */
-void gtk_clist_construct (GtkCList * clist,
- gint columns,
- gchar * titles[]);
-
-/* create a new GtkCList */
-GtkWidget *gtk_clist_new (gint columns);
-GtkWidget *gtk_clist_new_with_titles (gint columns,
- gchar * titles[]);
-
-/* set the border style of the clist */
-void gtk_clist_set_border (GtkCList * clist,
- GtkShadowType border);
-
-/* set the clist's selection mode */
-void gtk_clist_set_selection_mode (GtkCList * clist,
- GtkSelectionMode mode);
-
-/* set policy on the scrollbar, to either show them all the time
- * or show them only when they are needed, ie., when there is more than one page
- * of information */
-void gtk_clist_set_policy (GtkCList * clist,
- GtkPolicyType vscrollbar_policy,
- GtkPolicyType hscrollbar_policy);
-
-/* freeze all visual updates of the list, and then thaw the list after you have made
- * a number of changes and the updates wil occure in a more efficent mannor than if
- * you made them on a unfrozen list */
-void gtk_clist_freeze (GtkCList * clist);
-void gtk_clist_thaw (GtkCList * clist);
-
-/* show and hide the column title buttons */
-void gtk_clist_column_titles_show (GtkCList * clist);
-void gtk_clist_column_titles_hide (GtkCList * clist);
-
-/* set the column title to be a active title (responds to button presses,
- * prelights, and grabs keyboard focus), or passive where it acts as just
- * a title */
-void gtk_clist_column_title_active (GtkCList * clist,
- gint column);
-void gtk_clist_column_title_passive (GtkCList * clist,
- gint column);
-void gtk_clist_column_titles_active (GtkCList * clist);
-void gtk_clist_column_titles_passive (GtkCList * clist);
-
-/* set the title in the column title button */
-void gtk_clist_set_column_title (GtkCList * clist,
- gint column,
- gchar * title);
-
-/* set a widget instead of a title for the column title button */
-void gtk_clist_set_column_widget (GtkCList * clist,
- gint column,
- GtkWidget * widget);
-
-/* set the justification on a column */
-void gtk_clist_set_column_justification (GtkCList * clist,
- gint column,
- GtkJustification justification);
-
-/* set the pixel width of a column; this is a necessary step in
- * creating a CList because otherwise the column width is chozen from
- * the width of the column title, which will never be right */
-void gtk_clist_set_column_width (GtkCList * clist,
- gint column,
- gint width);
-
-/* change the height of the rows, the default is the hight of the current
- * font */
-void gtk_clist_set_row_height (GtkCList * clist,
- gint height);
-
-/* scroll the viewing area of the list to the given column
- * and row; row_align and col_align are between 0-1 representing the
- * location the row should appear on the screnn, 0.0 being top or left,
- * 1.0 being bottom or right; if row or column is -1 then then there
- * is no change */
-void gtk_clist_moveto (GtkCList * clist,
- gint row,
- gint column,
- gfloat row_align,
- gfloat col_align);
-
-/* returns true if the row is visible */
-gint gtk_clist_row_is_visible (GtkCList * clist,
- gint row);
-
-/* returns the cell type */
-GtkCellType gtk_clist_get_cell_type (GtkCList * clist,
- gint row,
- gint column);
-
-/* sets a given cell's text, replacing it's current contents */
-void gtk_clist_set_text (GtkCList * clist,
- gint row,
- gint column,
- gchar * text);
-
-/* for the "get" functions, any of the return pointer can be
- * NULL if you are not interested */
-gint gtk_clist_get_text (GtkCList * clist,
- gint row,
- gint column,
- gchar ** text);
-
-/* sets a given cell's pixmap, replacing it's current contents */
-void gtk_clist_set_pixmap (GtkCList * clist,
- gint row,
- gint column,
- GdkPixmap * pixmap,
- GdkBitmap * mask);
-
-gint gtk_clist_get_pixmap (GtkCList * clist,
- gint row,
- gint column,
- GdkPixmap ** pixmap,
- GdkBitmap ** mask);
-
-/* sets a given cell's pixmap and text, replacing it's current contents */
-void gtk_clist_set_pixtext (GtkCList * clist,
- gint row,
- gint column,
- gchar * text,
- guint8 spacing,
- GdkPixmap * pixmap,
- GdkBitmap * mask);
-
-gint gtk_clist_get_pixtext (GtkCList * clist,
- gint row,
- gint column,
- gchar ** text,
- guint8 * spacing,
- GdkPixmap ** pixmap,
- GdkBitmap ** mask);
-
-/* sets the foreground color of a row, the colar must already
- * be allocated */
-void gtk_clist_set_foreground (GtkCList * clist,
- gint row,
- GdkColor * color);
-
-/* sets the background color of a row, the colar must already
- * be allocated */
-void gtk_clist_set_background (GtkCList * clist,
- gint row,
- GdkColor * color);
-
-/* this sets a horizontal and vertical shift for drawing
- * the contents of a cell; it can be positive or negitive; this is
- * partuculary useful for indenting items in a column */
-void gtk_clist_set_shift (GtkCList * clist,
- gint row,
- gint column,
- gint vertical,
- gint horizontal);
-
-/* append returns the index of the row you just added, making
- * it easier to append and modify a row */
-gint gtk_clist_append (GtkCList * clist,
- gchar * text[]);
-
-/* inserts a row at index row */
-void gtk_clist_insert (GtkCList * clist,
- gint row,
- gchar * text[]);
-
-/* removes row at index row */
-void gtk_clist_remove (GtkCList * clist,
- gint row);
-
-/* sets a arbitrary data pointer for a given row */
-void gtk_clist_set_row_data (GtkCList * clist,
- gint row,
- gpointer data);
-
-/* sets a data pointer for a given row with destroy notification */
-void gtk_clist_set_row_data_full (GtkCList * clist,
- gint row,
- gpointer data,
- GtkDestroyNotify destroy);
-
-/* returns the data set for a row */
-gpointer gtk_clist_get_row_data (GtkCList * clist,
- gint row);
-
-/* givin a data pointer, find the first (and hopefully only!)
- * row that points to that data, or -1 if none do */
-gint gtk_clist_find_row_from_data (GtkCList * clist,
- gpointer data);
-
-/* force selection of a row */
-void gtk_clist_select_row (GtkCList * clist,
- gint row,
- gint column);
-
-/* force unselection of a row */
-void gtk_clist_unselect_row (GtkCList * clist,
- gint row,
- gint column);
-
-/* clear the entire list -- this is much faster than removing each item
- * with gtk_clist_remove */
-void gtk_clist_clear (GtkCList * clist);
-
-/* return the row column corresponding to the x and y coordinates */
-gint gtk_clist_get_selection_info (GtkCList * clist,
- gint x,
- gint y,
- gint * row,
- gint * column);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_CLIST_H__ */
diff --git a/gtk/gtkcolorsel.c b/gtk/gtkcolorsel.c
deleted file mode 100644
index 5ce2e8811b..0000000000
--- a/gtk/gtkcolorsel.c
+++ /dev/null
@@ -1,1476 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <math.h>
-#include "gtkcolorsel.h"
-
-/*
- * If you change the way the color values are stored,
- * please make sure to update the drag & drop support so it sends
- * across all the color info (currently RGBA). - Elliot
- */
-
-#define DEGTORAD(a) (2.0*M_PI*a/360.0)
-#define SQR(a) (a*a)
-
-#define TIMER_DELAY 300
-
-#define CIRCLE_RADIUS 65
-
-#define WHEEL_WIDTH 2*CIRCLE_RADIUS+2
-#define WHEEL_HEIGHT 2*CIRCLE_RADIUS+2
-
-#define VALUE_WIDTH 32
-#define VALUE_HEIGHT WHEEL_HEIGHT
-
-#define SAMPLE_WIDTH WHEEL_WIDTH+VALUE_WIDTH+5
-#define SAMPLE_HEIGHT 28
-
-static void gtk_color_selection_class_init (GtkColorSelectionClass *klass);
-static void gtk_color_selection_init (GtkColorSelection *colorsel);
-static void gtk_color_selection_dialog_class_init(GtkColorSelectionDialogClass *klass);
-static void gtk_color_selection_dialog_init(GtkColorSelectionDialog *colorseldiag);
-
-enum
-{
- COLOR_CHANGED,
- LAST_SIGNAL
-};
-
-enum
-{
- RGB_INPUTS = 1 << 0,
- HSV_INPUTS = 1 << 1,
- OPACITY_INPUTS = 1 << 2
-};
-
-enum
-{
- SCALE,
- ENTRY,
- BOTH
-};
-
-enum
-{
- HUE,
- SATURATION,
- VALUE,
- RED,
- GREEN,
- BLUE,
- OPACITY,
- NUM_CHANNELS
-};
-
-typedef struct
-{
- gchar *label;
- gfloat lower, upper, step_inc, page_inc;
- GtkSignalFunc updater;
-} scale_val_type;
-
-
-#define HSV_TO_RGB() gtk_color_selection_hsv_to_rgb( \
- colorsel->values[HUE], \
- colorsel->values[SATURATION], \
- colorsel->values[VALUE], \
- &colorsel->values[RED], \
- &colorsel->values[GREEN], \
- &colorsel->values[BLUE])
-
-#define RGB_TO_HSV() gtk_color_selection_rgb_to_hsv( \
- colorsel->values[RED], \
- colorsel->values[GREEN], \
- colorsel->values[BLUE], \
- &colorsel->values[HUE], \
- &colorsel->values[SATURATION], \
- &colorsel->values[VALUE])
-
-
-static void gtk_color_selection_hsv_updater (GtkWidget *widget,
- gpointer data);
-static void gtk_color_selection_rgb_updater (GtkWidget *widget,
- gpointer data);
-static void gtk_color_selection_opacity_updater (GtkWidget *widget,
- gpointer data);
-static void gtk_color_selection_realize (GtkWidget *widget);
-static void gtk_color_selection_finalize (GtkObject *object);
-static void gtk_color_selection_color_changed (GtkColorSelection *colorsel);
-static void gtk_color_selection_update_input (GtkWidget *scale,
- GtkWidget *entry,
- gdouble value);
-static void gtk_color_selection_update_inputs (GtkColorSelection *colorsel,
- gint inputs,
- gint which);
-static void gtk_color_selection_update_value (GtkColorSelection *colorsel,
- gint y);
-static void gtk_color_selection_update_wheel (GtkColorSelection *colorsel,
- gint x,
- gint y);
-static void gtk_color_selection_value_resize (GtkWidget *widget,
- gpointer data);
-static gint gtk_color_selection_value_events (GtkWidget *area,
- GdkEvent *event);
-static gint gtk_color_selection_value_timeout (GtkColorSelection *colorsel);
-static void gtk_color_selection_wheel_resize (GtkWidget *widget,
- gpointer data);
-static gint gtk_color_selection_wheel_events (GtkWidget *area,
- GdkEvent *event);
-static gint gtk_color_selection_wheel_timeout (GtkColorSelection *colorsel);
-static void gtk_color_selection_sample_resize (GtkWidget *widget,
- gpointer data);
-static void gtk_color_selection_drop_handle (GtkWidget *widget,
- GdkEvent *event,
- GtkWidget *theclorsel);
-static void gtk_color_selection_drag_handle (GtkWidget *widget,
- GdkEvent *event,
- GtkWidget *thecolorsel);
-static void gtk_color_selection_draw_wheel_marker (GtkColorSelection *colorsel);
-static void gtk_color_selection_draw_wheel_frame (GtkColorSelection *colorsel);
-static void gtk_color_selection_draw_value_marker (GtkColorSelection *colorsel);
-static void gtk_color_selection_draw_value_bar (GtkColorSelection *colorsel,
- gint resize);
-static void gtk_color_selection_draw_wheel (GtkColorSelection *colorsel,
- gint resize);
-static void gtk_color_selection_draw_sample (GtkColorSelection *colorsel,
- gint resize);
-
-static gint gtk_color_selection_eval_wheel (gint x, gint y,
- gdouble cx, gdouble cy,
- gdouble *h, gdouble *s);
-
-static void gtk_color_selection_hsv_to_rgb (gdouble h, gdouble s, gdouble v,
- gdouble *r, gdouble *g, gdouble *b);
-static void gtk_color_selection_rgb_to_hsv (gdouble r, gdouble g, gdouble b,
- gdouble *h, gdouble *s, gdouble *v);
-
-
-static GtkVBoxClass *color_selection_parent_class = NULL;
-static GtkWindowClass *color_selection_dialog_parent_class = NULL;
-
-
-static guint color_selection_signals[LAST_SIGNAL] = {0};
-
-static const gchar *value_index_key = "gtk-value-index";
-
-
-#define SF GtkSignalFunc
-
-
-scale_val_type scale_vals[NUM_CHANNELS] =
-{
- {"Hue:", 0.0, 360.0, 1.00, 10.00, (SF) gtk_color_selection_hsv_updater},
- {"Saturation:", 0.0, 1.0, 0.01, 0.01, (SF) gtk_color_selection_hsv_updater},
- {"Value:", 0.0, 1.0, 0.01, 0.01, (SF) gtk_color_selection_hsv_updater},
- {"Red:", 0.0, 1.0, 0.01, 0.01, (SF) gtk_color_selection_rgb_updater},
- {"Green:", 0.0, 1.0, 0.01, 0.01, (SF) gtk_color_selection_rgb_updater},
- {"Blue:", 0.0, 1.0, 0.01, 0.01, (SF) gtk_color_selection_rgb_updater},
- {"Opacity:", 0.0, 1.0, 0.01, 0.01, (SF) gtk_color_selection_opacity_updater}
-};
-
-guint
-gtk_color_selection_get_type ()
-{
- static guint color_selection_type = 0;
-
- if (!color_selection_type)
- {
- GtkTypeInfo colorsel_info =
- {
- "GtkColorSelection",
- sizeof (GtkColorSelection),
- sizeof (GtkColorSelectionClass),
- (GtkClassInitFunc) gtk_color_selection_class_init,
- (GtkObjectInitFunc) gtk_color_selection_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- color_selection_type = gtk_type_unique (gtk_vbox_get_type (), &colorsel_info);
- }
-
- return color_selection_type;
-}
-
-static void
-gtk_color_selection_class_init (GtkColorSelectionClass *klass)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GtkObjectClass*) klass;
- widget_class = (GtkWidgetClass*) klass;
- container_class = (GtkContainerClass*) klass;
-
- color_selection_parent_class = gtk_type_class (gtk_vbox_get_type ());
-
- color_selection_signals[COLOR_CHANGED] =
- gtk_signal_new ("color_changed",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkColorSelectionClass, color_changed),
- gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, color_selection_signals, LAST_SIGNAL);
-
- object_class->finalize = gtk_color_selection_finalize;
-
- widget_class->realize = gtk_color_selection_realize;
-}
-
-static void
-gtk_color_selection_init (GtkColorSelection *colorsel)
-{
- GtkWidget *frame, *hbox, *vbox, *hbox2, *label, *table;
- GtkObject *adj;
- gint old_mask, n;
- gchar txt[32];
-
- for (n = RED; n <= OPACITY; n++)
- colorsel->values[n] = 1.0;
-
- RGB_TO_HSV ();
-
- for (n = HUE; n <= OPACITY; n++)
- colorsel->old_values[n] = colorsel->values[n];
-
- colorsel->wheel_gc = NULL;
- colorsel->value_gc = NULL;
- colorsel->sample_gc = NULL;
- colorsel->wheel_buf = NULL;
- colorsel->value_buf = NULL;
- colorsel->sample_buf = NULL;
-
- colorsel->use_opacity = FALSE;
- colorsel->timer_active = FALSE;
- colorsel->policy = GTK_UPDATE_CONTINUOUS;
-
- hbox = gtk_hbox_new (FALSE, 5);
- gtk_container_border_width (GTK_CONTAINER (hbox), 5);
- gtk_container_add (GTK_CONTAINER (colorsel), hbox);
-
- vbox = gtk_vbox_new (FALSE, 5);
- gtk_container_add (GTK_CONTAINER (hbox), vbox);
- gtk_widget_show (vbox);
-
- hbox2 = gtk_hbox_new (FALSE, 5);
- gtk_container_add (GTK_CONTAINER (vbox), hbox2);
- gtk_widget_show (hbox2);
-
- colorsel->wheel_area = gtk_preview_new (GTK_PREVIEW_COLOR);
- old_mask = gtk_widget_get_events(colorsel->wheel_area);
- gtk_widget_set_events (colorsel->wheel_area,
- old_mask |
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_BUTTON_MOTION_MASK |
- GDK_POINTER_MOTION_HINT_MASK);
- gtk_preview_size (GTK_PREVIEW (colorsel->wheel_area), WHEEL_WIDTH, WHEEL_HEIGHT);
- gtk_preview_set_expand (GTK_PREVIEW (colorsel->wheel_area), TRUE);
- gtk_container_add (GTK_CONTAINER (hbox2), colorsel->wheel_area);
- gtk_widget_show (colorsel->wheel_area);
-
- old_mask = gtk_widget_get_events (colorsel->wheel_area);
-
- gtk_signal_connect (GTK_OBJECT (colorsel->wheel_area), "event",
- (SF) gtk_color_selection_wheel_events, (gpointer) colorsel->wheel_area);
- gtk_signal_connect_after (GTK_OBJECT (colorsel->wheel_area), "expose_event",
- (SF) gtk_color_selection_wheel_events, (gpointer) colorsel->wheel_area);
- gtk_signal_connect_after (GTK_OBJECT (colorsel->wheel_area), "size_allocate",
- (SF) gtk_color_selection_wheel_resize, (gpointer) colorsel->wheel_area);
- gtk_object_set_data (GTK_OBJECT (colorsel->wheel_area), "_GtkColorSelection", (gpointer) colorsel);
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
- gtk_container_border_width (GTK_CONTAINER (frame), 0);
- gtk_box_pack_start (GTK_BOX (hbox2), frame, FALSE, TRUE, 0);
- gtk_widget_show (frame);
-
- colorsel->value_area = gtk_preview_new (GTK_PREVIEW_COLOR);
- gtk_preview_size (GTK_PREVIEW (colorsel->value_area), VALUE_WIDTH, VALUE_HEIGHT);
- gtk_preview_set_expand (GTK_PREVIEW (colorsel->value_area), TRUE);
- gtk_container_add (GTK_CONTAINER (frame), colorsel->value_area);
- gtk_widget_show (colorsel->value_area);
-
- old_mask = gtk_widget_get_events (colorsel->value_area);
- gtk_widget_set_events (colorsel->value_area,
- old_mask |
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_BUTTON_MOTION_MASK |
- GDK_POINTER_MOTION_HINT_MASK);
-
- gtk_signal_connect_after (GTK_OBJECT (colorsel->value_area), "expose_event",
- (SF) gtk_color_selection_value_events, (gpointer) colorsel->value_area);
- gtk_signal_connect_after (GTK_OBJECT (colorsel->value_area), "size_allocate",
- (SF) gtk_color_selection_value_resize, (gpointer) colorsel->value_area);
- gtk_signal_connect (GTK_OBJECT (colorsel->value_area), "event",
- (SF) gtk_color_selection_value_events, (gpointer) colorsel->value_area);
- gtk_object_set_data (GTK_OBJECT (colorsel->value_area), "_GtkColorSelection", (gpointer) colorsel);
-
- /* New/old color samples */
- /* ===================== */
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
- gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
- gtk_widget_show (frame);
-
-/* colorsel->sample_area_eb = gtk_button_new ();
- gtk_container_add (GTK_CONTAINER (frame), colorsel->sample_area_eb);
- gtk_widget_show (colorsel->sample_area_eb); */
-
- colorsel->sample_area = gtk_preview_new (GTK_PREVIEW_COLOR);
- gtk_preview_size (GTK_PREVIEW (colorsel->sample_area), SAMPLE_WIDTH, SAMPLE_HEIGHT);
- gtk_preview_set_expand (GTK_PREVIEW (colorsel->sample_area), TRUE);
- gtk_container_add (GTK_CONTAINER (frame),
- colorsel->sample_area);
- gtk_widget_set_events(colorsel->sample_area,
- gtk_widget_get_events(colorsel->sample_area)
- | GDK_BUTTON_MOTION_MASK
- | GDK_BUTTON_PRESS_MASK
- | GDK_BUTTON_RELEASE_MASK
- | GDK_ENTER_NOTIFY_MASK
- | GDK_LEAVE_NOTIFY_MASK);
- gtk_widget_show (colorsel->sample_area);
-
- gtk_signal_connect_after (GTK_OBJECT (colorsel->sample_area),
- "size_allocate",
- GTK_SIGNAL_FUNC (gtk_color_selection_sample_resize),
- colorsel->sample_area);
- gtk_object_set_data (GTK_OBJECT (colorsel->sample_area), "_GtkColorSelection", (gpointer) colorsel);
-
- table = gtk_table_new (NUM_CHANNELS, 3, FALSE);
- gtk_table_set_col_spacings (GTK_TABLE (table), 3);
- gtk_box_pack_start (GTK_BOX (hbox), table, FALSE, TRUE, 0);
-
- for (n = HUE; n <= OPACITY; n++)
- {
- label = gtk_label_new (scale_vals[n].label);
- gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
- gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, n, n + 1);
-
- adj = gtk_adjustment_new (colorsel->values[n], scale_vals[n].lower,
- scale_vals[n].upper, scale_vals[n].step_inc,
- scale_vals[n].page_inc, 0.0);
- colorsel->scales[n] = gtk_hscale_new (GTK_ADJUSTMENT (adj));
- gtk_widget_set_usize (colorsel->scales[n], 128, 0);
- gtk_scale_set_value_pos (GTK_SCALE (colorsel->scales[n]), GTK_POS_TOP);
-
- gtk_range_set_update_policy (GTK_RANGE (colorsel->scales[n]), colorsel->policy);
- gtk_scale_set_draw_value (GTK_SCALE (colorsel->scales[n]), FALSE);
- gtk_scale_set_digits (GTK_SCALE (colorsel->scales[n]), 2);
- gtk_table_attach_defaults (GTK_TABLE (table), colorsel->scales[n], 1, 2, n, n + 1);
-
- colorsel->entries[n] = gtk_entry_new ();
- gtk_widget_set_usize (colorsel->entries[n], 40, 0);
- sprintf (txt, "%.2f", colorsel->values[n]);
- gtk_entry_set_text (GTK_ENTRY (colorsel->entries[n]), txt);
- gtk_table_attach_defaults (GTK_TABLE (table), colorsel->entries[n], 2, 3, n, n + 1);
-
- if (n != OPACITY)
- {
- gtk_widget_show (label);
- gtk_widget_show (colorsel->scales[n]);
- gtk_widget_show (colorsel->entries[n]);
- }
-
- gtk_signal_connect_object (GTK_OBJECT (adj), "value_changed",
- scale_vals[n].updater, (gpointer) colorsel->scales[n]);
- gtk_object_set_data (GTK_OBJECT (colorsel->scales[n]), "_GtkColorSelection", (gpointer) colorsel);
- gtk_object_set_data (GTK_OBJECT (colorsel->scales[n]), value_index_key, (gpointer) n);
- gtk_signal_connect_object (GTK_OBJECT (colorsel->entries[n]), "changed",
- scale_vals[n].updater, (gpointer) colorsel->entries[n]);
- gtk_object_set_data (GTK_OBJECT (colorsel->entries[n]), "_GtkColorSelection", (gpointer) colorsel);
- gtk_object_set_data (GTK_OBJECT (colorsel->entries[n]), value_index_key, (gpointer) n);
- }
-
- colorsel->opacity_label = label;
-
- gtk_widget_show (table);
- gtk_widget_show (hbox);
-}
-
-GtkWidget *
-gtk_color_selection_new (void)
-{
- GtkColorSelection *colorsel;
-
- colorsel = gtk_type_new (gtk_color_selection_get_type ());
-
- return GTK_WIDGET (colorsel);
-}
-
-void
-gtk_color_selection_set_update_policy (GtkColorSelection *colorsel,
- GtkUpdateType policy)
-{
- gint n;
-
- g_return_if_fail (colorsel != NULL);
-
- if (policy != colorsel->policy)
- {
- colorsel->policy = policy;
-
- for (n = 0; n < NUM_CHANNELS; n++)
- gtk_range_set_update_policy (GTK_RANGE (colorsel->scales[n]), policy);
- }
-}
-
-
-void
-gtk_color_selection_set_color (GtkColorSelection *colorsel,
- gdouble *color)
-{
- gint n, i = 0;
-
- g_return_if_fail (colorsel != NULL);
- g_return_if_fail (GTK_IS_COLOR_SELECTION (colorsel));
-
- if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (colorsel)))
- gtk_color_selection_draw_wheel_marker (colorsel);
-
- for (n = RED; n <= BLUE; n++)
- {
- colorsel->old_values[n] = colorsel->values[n];
- colorsel->values[n] = color[i++];
- }
-
- if (colorsel->use_opacity == TRUE)
- {
- colorsel->old_values[OPACITY] = colorsel->values[OPACITY];
- colorsel->values[OPACITY] = color[i];
- }
-
- RGB_TO_HSV ();
-
- gtk_color_selection_update_inputs (colorsel, RGB_INPUTS | HSV_INPUTS | OPACITY_INPUTS, BOTH);
-
- if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (colorsel)))
- {
- gtk_color_selection_draw_value_bar (colorsel, FALSE);
- gtk_color_selection_draw_sample (colorsel, FALSE);
- gtk_color_selection_draw_wheel_marker (colorsel);
- }
-}
-
-void
-gtk_color_selection_get_color (GtkColorSelection *colorsel,
- gdouble *color)
-{
- gint n, i = 0;
-
- g_return_if_fail (colorsel != NULL);
- g_return_if_fail (GTK_IS_COLOR_SELECTION (colorsel));
-
- for (n = RED; n <= BLUE; n++)
- color[i++] = colorsel->values[n];
- if (colorsel->use_opacity == TRUE)
- color[i] = colorsel->values[OPACITY];
-}
-
-static void
-gtk_color_selection_realize (GtkWidget *widget)
-{
- GtkColorSelection *colorsel;
- gchar *type_accept_list[] = {"application/x-color"};
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_COLOR_SELECTION (widget));
-
- colorsel = GTK_COLOR_SELECTION (widget);
-
- if (GTK_WIDGET_CLASS (color_selection_parent_class)->realize)
- (*GTK_WIDGET_CLASS (color_selection_parent_class)->realize) (widget);
-
- gtk_widget_dnd_drag_set (colorsel->sample_area,
- 1, type_accept_list, 1);
- gtk_widget_dnd_drop_set (colorsel->sample_area,
- 1, type_accept_list, 1, 0);
- gtk_signal_connect_after (GTK_OBJECT (colorsel->sample_area),
- "drop_data_available_event",
- GTK_SIGNAL_FUNC (gtk_color_selection_drop_handle),
- colorsel);
- gtk_signal_connect_after (GTK_OBJECT (colorsel->sample_area),
- "drag_request_event",
- GTK_SIGNAL_FUNC (gtk_color_selection_drag_handle),
- colorsel);
-}
-
-static void
-gtk_color_selection_finalize (GtkObject *object)
-{
- GtkColorSelection *colorsel;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_COLOR_SELECTION (object));
-
- colorsel = GTK_COLOR_SELECTION (object);
-
- if (colorsel->wheel_buf != NULL)
- g_free (colorsel->wheel_buf);
- if (colorsel->value_buf != NULL)
- g_free (colorsel->value_buf);
- if (colorsel->sample_buf != NULL)
- g_free (colorsel->sample_buf);
-
- (*GTK_OBJECT_CLASS (color_selection_parent_class)->finalize) (object);
-}
-
-static void
-gtk_color_selection_color_changed (GtkColorSelection *colorsel)
-{
- gtk_signal_emit (GTK_OBJECT (colorsel), color_selection_signals[COLOR_CHANGED]);
-}
-
-static void
-gtk_color_selection_update_input (GtkWidget *scale,
- GtkWidget *entry,
- gdouble value)
-{
- GtkAdjustment *adj;
- gchar txt[32];
-
- if (scale != NULL)
- {
- adj = gtk_range_get_adjustment (GTK_RANGE (scale));
- adj->value = (gfloat) value;
- gtk_signal_handler_block_by_data (GTK_OBJECT (adj), (gpointer) scale);
- gtk_signal_emit_by_name (GTK_OBJECT (adj), "value_changed");
- gtk_range_slider_update (GTK_RANGE (scale));
- gtk_signal_handler_unblock_by_data (GTK_OBJECT (adj), (gpointer) scale);
- }
-
- if (entry != NULL)
- {
- gtk_signal_handler_block_by_data (GTK_OBJECT (entry), (gpointer) entry);
- sprintf (txt, "%.2f", value);
- gtk_entry_set_text (GTK_ENTRY (entry), txt);
- gtk_signal_handler_unblock_by_data (GTK_OBJECT (entry), (gpointer) entry);
- }
-}
-
-static void
-gtk_color_selection_update_inputs (GtkColorSelection *colorsel,
- gint inputs,
- gint which)
-{
- gint n;
-
- switch (which)
- {
- case SCALE:
- if ((inputs & RGB_INPUTS) != 0)
- for (n = RED; n <= BLUE; n++)
- gtk_color_selection_update_input (colorsel->scales[n], NULL,
- colorsel->values[n]);
- if ((inputs & HSV_INPUTS) != 0)
- for (n = HUE; n <= VALUE; n++)
- gtk_color_selection_update_input (colorsel->scales[n], NULL,
- colorsel->values[n]);
- if ((inputs & OPACITY_INPUTS) != 0)
- gtk_color_selection_update_input(colorsel->scales[OPACITY], NULL,
- colorsel->values[OPACITY]);
- break;
- case ENTRY:
- if ((inputs & RGB_INPUTS) != 0)
- for (n = RED; n <= BLUE; n++)
- gtk_color_selection_update_input (NULL, colorsel->entries[n], colorsel->values[n]);
- if ((inputs & HSV_INPUTS) != 0)
- for (n = HUE; n <= VALUE; n++)
- gtk_color_selection_update_input (NULL, colorsel->entries[n], colorsel->values[n]);
- if ((inputs & OPACITY_INPUTS) != 0)
- gtk_color_selection_update_input(NULL, colorsel->entries[OPACITY], colorsel->values[OPACITY]);
- break;
- default:
- if ((inputs & RGB_INPUTS) != 0)
- for (n = RED; n <= BLUE; n++)
- gtk_color_selection_update_input (colorsel->scales[n], colorsel->entries[n],
- colorsel->values[n]);
- if ((inputs & HSV_INPUTS) != 0)
- for (n = HUE; n <= VALUE; n++)
- gtk_color_selection_update_input (colorsel->scales[n], colorsel->entries[n],
- colorsel->values[n]);
- if ((inputs & OPACITY_INPUTS) != 0)
- gtk_color_selection_update_input(colorsel->scales[OPACITY], colorsel->entries[OPACITY],
- colorsel->values[OPACITY]);
- break;
- }
-}
-
-static void
-gtk_color_selection_hsv_updater (GtkWidget *widget,
- gpointer data)
-{
- GtkColorSelection *colorsel;
- GtkAdjustment *adj;
- gdouble newvalue;
- gint i, which = SCALE;
-
- if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (widget)))
- {
- colorsel = (GtkColorSelection*) gtk_object_get_data (GTK_OBJECT (widget), "_GtkColorSelection");
- i = (gint) gtk_object_get_data (GTK_OBJECT (widget), value_index_key);
-
- if (GTK_IS_SCALE (widget))
- {
- adj = gtk_range_get_adjustment (GTK_RANGE (GTK_SCALE (widget)));
- newvalue = (gdouble) adj->value;
- which = ENTRY;
- }
- else
- newvalue = (gdouble) atof (gtk_entry_get_text (GTK_ENTRY (widget)));
-
- if (i == VALUE)
- {
- gtk_color_selection_draw_value_marker (colorsel);
- colorsel->values[i] = newvalue;
-
- HSV_TO_RGB ();
-
- gtk_color_selection_draw_value_marker (colorsel);
- }
- else
- {
- gtk_color_selection_draw_wheel_marker (colorsel);
- colorsel->values[i] = newvalue;
-
- HSV_TO_RGB ();
-
- gtk_color_selection_draw_wheel_marker (colorsel);
- gtk_color_selection_draw_value_bar (colorsel, FALSE);
- }
-
- gtk_color_selection_draw_sample (colorsel, FALSE);
- gtk_color_selection_color_changed (colorsel);
- gtk_color_selection_update_inputs (colorsel, HSV_INPUTS, which);
- gtk_color_selection_update_inputs (colorsel, RGB_INPUTS, BOTH);
- }
-}
-
-static void
-gtk_color_selection_rgb_updater (GtkWidget *widget,
- gpointer data)
-{
- GtkColorSelection *colorsel;
- GtkAdjustment *adj;
- gdouble newvalue;
- gint i, which = SCALE;
-
- if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (widget)))
- {
- colorsel = (GtkColorSelection*) gtk_object_get_data (GTK_OBJECT (widget), "_GtkColorSelection");
- i = (gint) gtk_object_get_data (GTK_OBJECT (widget), value_index_key);
-
- if (GTK_IS_SCALE (widget))
- {
- adj = gtk_range_get_adjustment (GTK_RANGE (GTK_SCALE (widget)));
- newvalue = (gdouble) adj->value;
- which = ENTRY;
- }
- else
- newvalue = (gdouble) atof (gtk_entry_get_text (GTK_ENTRY (widget)));
-
- gtk_color_selection_draw_wheel_marker (colorsel);
-
- colorsel->values[i] = newvalue;
- RGB_TO_HSV ();
-
- gtk_color_selection_draw_wheel_marker (colorsel);
- gtk_color_selection_draw_value_bar (colorsel, FALSE);
- gtk_color_selection_draw_sample (colorsel, FALSE);
- gtk_color_selection_color_changed (colorsel);
- gtk_color_selection_update_inputs (colorsel, RGB_INPUTS, which);
- gtk_color_selection_update_inputs (colorsel, HSV_INPUTS, BOTH);
- }
-}
-
-static void
-gtk_color_selection_opacity_updater (GtkWidget *widget,
- gpointer data)
-{
- GtkColorSelection *colorsel;
- GtkAdjustment *adj;
-
- colorsel = (GtkColorSelection*) gtk_object_get_data (GTK_OBJECT (widget), "_GtkColorSelection");
-
- if (GTK_IS_SCALE (widget))
- {
- adj = gtk_range_get_adjustment (GTK_RANGE (widget));
- colorsel->values[OPACITY] = (gdouble) adj->value;
- gtk_color_selection_update_input (NULL, colorsel->entries[OPACITY], colorsel->values[OPACITY]);
- }
- else
- {
- colorsel->values[OPACITY] = (gdouble) atof (gtk_entry_get_text (GTK_ENTRY (widget)));
- gtk_color_selection_update_input (colorsel->scales[OPACITY], NULL, colorsel->values[OPACITY]);
- }
-
- gtk_color_selection_draw_sample (colorsel, FALSE);
- gtk_color_selection_color_changed (colorsel);
-}
-
-void
-gtk_color_selection_set_opacity (GtkColorSelection *colorsel,
- gint use_opacity)
-{
- g_return_if_fail (colorsel != NULL);
-
- colorsel->use_opacity = use_opacity;
-
- if (use_opacity == FALSE && GTK_WIDGET_VISIBLE (colorsel->scales[OPACITY]))
- {
- gtk_widget_hide (colorsel->opacity_label);
- gtk_widget_hide (colorsel->scales[OPACITY]);
- gtk_widget_hide (colorsel->entries[OPACITY]);
- }
- else if (use_opacity == TRUE && !GTK_WIDGET_VISIBLE (colorsel->scales[OPACITY]))
- {
- gtk_widget_show (colorsel->opacity_label);
- gtk_widget_show (colorsel->scales[OPACITY]);
- gtk_widget_show (colorsel->entries[OPACITY]);
- }
-
- if (GTK_WIDGET_DRAWABLE (colorsel->sample_area))
- gtk_color_selection_draw_sample (colorsel, FALSE);
-}
-
-static void
-gtk_color_selection_value_resize (GtkWidget *widget,
- gpointer data)
-{
- GtkColorSelection *colorsel;
-
- colorsel = (GtkColorSelection*) gtk_object_get_data (GTK_OBJECT (widget), "_GtkColorSelection");
- gtk_color_selection_draw_value_bar (colorsel, TRUE);
-}
-
-static void
-gtk_color_selection_wheel_resize (GtkWidget *widget,
- gpointer data)
-{
- GtkColorSelection *colorsel;
-
- colorsel = (GtkColorSelection*) gtk_object_get_data (GTK_OBJECT (widget), "_GtkColorSelection");
- gtk_color_selection_draw_wheel (colorsel, TRUE);
-}
-
-static void
-gtk_color_selection_sample_resize (GtkWidget *widget,
- gpointer data)
-{
- GtkColorSelection *colorsel;
-
- colorsel = (GtkColorSelection*) gtk_object_get_data (GTK_OBJECT (widget), "_GtkColorSelection");
- gtk_color_selection_draw_sample (colorsel, TRUE);
-}
-
-static void
-gtk_color_selection_drop_handle (GtkWidget *widget, GdkEvent *event,
- GtkWidget *thecolorsel)
-{
- /* This is currently a gdouble array of the format (I think):
- use_opacity
- R
- G
- B
- opacity
- */
- gdouble *v = event->dropdataavailable.data;
- gtk_color_selection_set_opacity(GTK_COLOR_SELECTION(thecolorsel),
- (v[0]==1.0)?TRUE:FALSE);
- gtk_color_selection_set_color(GTK_COLOR_SELECTION(thecolorsel),
- v + 1);
- g_free(event->dropdataavailable.data);
- g_free(event->dropdataavailable.data_type);
-}
-
-static void
-gtk_color_selection_drag_handle (GtkWidget *widget, GdkEvent *event,
- GtkWidget *thecolorsel)
-{
- gdouble sendvals[(BLUE - RED + 1) + 3];
-
- sendvals[0] = (GTK_COLOR_SELECTION(thecolorsel)->use_opacity)?1.0:0.0;
- gtk_color_selection_get_color(GTK_COLOR_SELECTION(thecolorsel),
- sendvals + 1);
-
- gtk_widget_dnd_data_set(widget,
- event,
- (gpointer)sendvals,
- sizeof(sendvals));
-}
-
-static void
-gtk_color_selection_draw_wheel_marker (GtkColorSelection *colorsel)
-{
- gint xpos, ypos;
-
- gdk_gc_set_function (colorsel->wheel_gc, GDK_INVERT);
-
- xpos = (gint) ((-(gdouble) (colorsel->wheel_area->allocation.width) / 2.0) *
- colorsel->values[SATURATION] * cos (DEGTORAD ((colorsel->values[HUE] - 90)))) +
- (colorsel->wheel_area->allocation.width >> 1) - 4;
- ypos = (gint) (((gdouble) (colorsel->wheel_area->allocation.height) / 2.0) *
- colorsel->values[SATURATION] * sin (DEGTORAD ((colorsel->values[HUE] - 90)))) +
- (colorsel->wheel_area->allocation.height >> 1) - 4;
-
- gdk_draw_arc (colorsel->wheel_area->window, colorsel->wheel_gc, FALSE, xpos, ypos, 8, 8, 0, 360 * 64);
-}
-
-static void
-gtk_color_selection_draw_value_marker (GtkColorSelection *colorsel)
-{
- gint y;
-
- gdk_gc_set_function (colorsel->value_gc, GDK_INVERT);
-
- y = (gint) ((gdouble) (colorsel->value_area->allocation.height) * (1.0 - colorsel->values[VALUE]));
- gdk_draw_line (colorsel->value_area->window, colorsel->value_gc,
- 0, y, colorsel->value_area->allocation.width, y);
-}
-
-static void
-gtk_color_selection_update_value (GtkColorSelection *colorsel,
- gint y)
-{
- gtk_color_selection_draw_value_marker (colorsel);
-
- if (y < 0)
- y = 0;
- else if (y > colorsel->value_area->allocation.height - 1)
- y = colorsel->value_area->allocation.height - 1;
-
- colorsel->values[VALUE] = 1.0 - (gdouble) y / (gdouble) (colorsel->value_area->allocation.height);
-
- HSV_TO_RGB ();
-
- gtk_color_selection_draw_value_marker (colorsel);
- gtk_color_selection_draw_sample (colorsel, FALSE);
- gtk_color_selection_update_input (colorsel->scales[VALUE], colorsel->entries[VALUE],
- colorsel->values[VALUE]);
- gtk_color_selection_update_inputs (colorsel, RGB_INPUTS, BOTH);
-}
-
-static void
-gtk_color_selection_update_wheel (GtkColorSelection *colorsel,
- gint x,
- gint y)
-{
- gdouble wid, heig;
- gint res;
-
- gtk_color_selection_draw_wheel_marker (colorsel);
-
- wid = (gdouble) (colorsel->wheel_area->allocation.width) / 2.0;
- heig = (gdouble) (colorsel->wheel_area->allocation.height) / 2.0;
-
- res = gtk_color_selection_eval_wheel (x, y, wid, heig, &colorsel->values[HUE],
- &colorsel->values[SATURATION]);
-
- HSV_TO_RGB ();
-
- gtk_color_selection_draw_wheel_marker (colorsel);
- gtk_color_selection_draw_value_bar (colorsel, FALSE);
- gtk_color_selection_draw_sample (colorsel, FALSE);
- gtk_color_selection_update_inputs (colorsel, RGB_INPUTS | HSV_INPUTS, BOTH);
-}
-
-static gint
-gtk_color_selection_value_timeout (GtkColorSelection *colorsel)
-{
- gint x, y;
-
- gdk_window_get_pointer (colorsel->value_area->window, &x, &y, NULL);
- gtk_color_selection_update_value (colorsel, y);
- gtk_color_selection_color_changed (colorsel);
-
- return (TRUE);
-}
-
-static gint
-gtk_color_selection_value_events (GtkWidget *area,
- GdkEvent *event)
-{
- GtkColorSelection *colorsel;
- gint y;
-
- colorsel = (GtkColorSelection*) gtk_object_get_data (GTK_OBJECT (area), "_GtkColorSelection");
-
- switch (event->type)
- {
- case GDK_MAP:
- gtk_color_selection_draw_value_marker (colorsel);
- break;
- case GDK_EXPOSE:
- if (colorsel->value_gc == NULL)
- colorsel->value_gc = gdk_gc_new (colorsel->value_area->window);
- gtk_color_selection_draw_value_marker (colorsel);
- break;
- case GDK_BUTTON_PRESS:
- gtk_grab_add (area);
- gtk_color_selection_update_value (colorsel, event->button.y);
- gtk_color_selection_color_changed (colorsel);
- break;
- case GDK_BUTTON_RELEASE:
- gtk_grab_remove (area);
- if (colorsel->timer_active == TRUE)
- gtk_timeout_remove (colorsel->timer_tag);
- colorsel->timer_active = FALSE;
-
- y = event->button.y;
- if (event->button.window != area->window)
- gdk_window_get_pointer (area->window, NULL, &y, NULL);
-
- gtk_color_selection_update_value (colorsel, y);
- gtk_color_selection_color_changed (colorsel);
- break;
- case GDK_MOTION_NOTIFY:
- y = event->motion.y;
-
- if (event->motion.is_hint || (event->motion.window != area->window))
- gdk_window_get_pointer (area->window, NULL, &y, NULL);
-
- switch (colorsel->policy)
- {
- case GTK_UPDATE_CONTINUOUS:
- gtk_color_selection_update_value (colorsel, y);
- gtk_color_selection_color_changed (colorsel);
- break;
- case GTK_UPDATE_DELAYED:
- if (colorsel->timer_active == TRUE)
- gtk_timeout_remove (colorsel->timer_tag);
-
- colorsel->timer_tag = gtk_timeout_add (TIMER_DELAY,
- (GtkFunction) gtk_color_selection_value_timeout,
- (gpointer) colorsel);
- colorsel->timer_active = TRUE;
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
-
- return (FALSE);
-}
-
-static gint
-gtk_color_selection_wheel_timeout (GtkColorSelection *colorsel)
-{
- gint x, y;
-
- gdk_window_get_pointer (colorsel->wheel_area->window, &x, &y, NULL);
- gtk_color_selection_update_wheel (colorsel, x, y);
- gtk_color_selection_color_changed (colorsel);
-
- return (TRUE);
-}
-
-static gint
-gtk_color_selection_wheel_events (GtkWidget *area,
- GdkEvent *event)
-{
- GtkColorSelection *colorsel;
- gint x, y;
-
- colorsel = (GtkColorSelection*) gtk_object_get_data (GTK_OBJECT (area), "_GtkColorSelection");
-
- switch (event->type)
- {
- case GDK_MAP:
- gtk_color_selection_draw_wheel (colorsel, TRUE);
- gtk_color_selection_draw_wheel_marker (colorsel);
- gtk_color_selection_draw_sample (colorsel, TRUE);
- break;
- case GDK_EXPOSE:
- if (colorsel->wheel_gc == NULL)
- colorsel->wheel_gc = gdk_gc_new (colorsel->wheel_area->window);
- if (colorsel->sample_gc == NULL)
- colorsel->sample_gc = gdk_gc_new (colorsel->sample_area->window);
- if (colorsel->value_gc == NULL)
- colorsel->value_gc = gdk_gc_new (colorsel->value_area->window);
- gtk_color_selection_draw_wheel_marker (colorsel);
- gtk_color_selection_draw_wheel_frame (colorsel);
- break;
- case GDK_BUTTON_PRESS:
- gtk_grab_add (area);
- gtk_color_selection_update_wheel (colorsel, event->button.x, event->button.y);
- gtk_color_selection_color_changed (colorsel);
- break;
- case GDK_BUTTON_RELEASE:
- gtk_grab_remove (area);
- if (colorsel->timer_active == TRUE)
- gtk_timeout_remove (colorsel->timer_tag);
- colorsel->timer_active = FALSE;
-
- x = event->button.x;
- y = event->button.y;
-
- if (event->button.window != area->window)
- gdk_window_get_pointer (area->window, &x, &y, NULL);
-
- gtk_color_selection_update_wheel (colorsel, x, y);
- gtk_color_selection_color_changed (colorsel);
- break;
- case GDK_MOTION_NOTIFY:
- x = event->motion.x;
- y = event->motion.y;
-
- if (event->motion.is_hint || (event->motion.window != area->window))
- gdk_window_get_pointer (area->window, &x, &y, NULL);
-
- switch (colorsel->policy)
- {
- case GTK_UPDATE_CONTINUOUS:
- gtk_color_selection_update_wheel (colorsel, x, y);
- gtk_color_selection_color_changed (colorsel);
- break;
- case GTK_UPDATE_DELAYED:
- if (colorsel->timer_active == TRUE)
- gtk_timeout_remove (colorsel->timer_tag);
- colorsel->timer_tag = gtk_timeout_add (TIMER_DELAY,
- (GtkFunction) gtk_color_selection_wheel_timeout,
- (gpointer) colorsel);
- colorsel->timer_active = TRUE;
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
-
- return (FALSE);
-}
-
-static void
-gtk_color_selection_draw_value_bar (GtkColorSelection *colorsel,
- gint resize)
-{
- gint x, y, i, wid, heig, n;
- gdouble sv, v, c[3];
- guchar rc[3];
-
- wid = colorsel->value_area->allocation.width;
- heig = colorsel->value_area->allocation.height;
-
- if (resize)
- {
- if (colorsel->value_buf != NULL)
- g_free (colorsel->value_buf);
-
- colorsel->value_buf = g_new(guchar, 3 * wid);
- }
-
- v = 1.0;
- sv = 1.0 / (gdouble) (heig - 1);
-
- for (y = 0; y < heig; y++)
- {
- i = 0;
-
- gtk_color_selection_hsv_to_rgb (colorsel->values[HUE],colorsel->values[SATURATION],v,
- &c[0], &c[1], &c[2]);
-
- for (n = 0; n < 3; n++)
- rc[n] = (guchar) (255.0 * c[n]);
-
- for (x = 0; x < wid; x++)
- {
- for (n = 0; n < 3; n++)
- colorsel->value_buf[i++] = rc[n];
- }
-
- gtk_preview_draw_row (GTK_PREVIEW (colorsel->value_area), colorsel->value_buf, 0, y, wid);
- v -= sv;
- }
-
- gtk_widget_draw (colorsel->value_area, NULL);
-}
-
-static void
-gtk_color_selection_draw_wheel_frame (GtkColorSelection *colorsel)
-{
- GtkStyle *style;
- gint w, h;
-
- style = gtk_widget_get_style (GTK_WIDGET (colorsel));
-
- w = colorsel->wheel_area->allocation.width;
- h = colorsel->wheel_area->allocation.height;
-
- gdk_draw_arc (colorsel->wheel_area->window, style->black_gc,
- FALSE, 1, 1, w - 1, h - 1, 30 * 64, 180 * 64);
- gdk_draw_arc (colorsel->wheel_area->window, style->mid_gc[GTK_STATE_NORMAL],
- FALSE, 0, 0, w, h, 30 * 64, 180 * 64);
-
- gdk_draw_arc (colorsel->wheel_area->window, style->bg_gc[GTK_STATE_NORMAL],
- FALSE, 1, 1, w - 1, h - 1, 210 * 64, 180 * 64);
- gdk_draw_arc (colorsel->wheel_area->window, style->light_gc[GTK_STATE_NORMAL],
- FALSE, 0, 0, w, h, 210 * 64, 180 * 64);
-}
-
-static void
-gtk_color_selection_draw_wheel (GtkColorSelection *colorsel,
- gint resize)
-{
- gint x, y, i, wid, heig, n;
- gdouble cx, cy, h, s, c[3];
- guchar bg[3];
- GtkStyle *style = gtk_widget_get_style (GTK_WIDGET (colorsel));
-
- wid = colorsel->wheel_area->allocation.width;
- heig = colorsel->wheel_area->allocation.height;
-
- if (resize)
- {
- if (colorsel->wheel_buf != NULL)
- g_free (colorsel->wheel_buf);
-
- colorsel->wheel_buf = g_new(guchar, 3 * wid);
- }
-
- cx = (gdouble) (wid) / 2.0;
- cy = (gdouble) (heig) / 2.0;
-
- bg[0] = style->bg[GTK_STATE_NORMAL].red >> 8;
- bg[1] = style->bg[GTK_STATE_NORMAL].green >> 8;
- bg[2] = style->bg[GTK_STATE_NORMAL].blue >> 8;
-
- for (y = 0; y < heig; y++)
- {
- i = 0;
- for (x = 0; x < wid; x++)
- {
- if (gtk_color_selection_eval_wheel (x, y, cx, cy, &h, &s) == TRUE)
- {
- for (n = 0; n < 3; n++)
- colorsel->wheel_buf[i++] = bg[n];
- }
- else
- {
- gtk_color_selection_hsv_to_rgb (h, s, 1.0, &c[0], &c[1], &c[2]);
- for (n = 0; n < 3; n++)
- colorsel->wheel_buf[i++] = (guchar) (255.0 * c[n]);
- }
- }
-
- gtk_preview_draw_row (GTK_PREVIEW (colorsel->wheel_area), colorsel->wheel_buf, 0, y, wid);
- }
-
- gtk_widget_draw (colorsel->wheel_area, NULL);
-}
-
-static void
-gtk_color_selection_draw_sample (GtkColorSelection *colorsel,
- gint resize)
-{
- gint x, y, i, wid, heig, f, half, n;
- guchar c[3 * 2], cc[3 * 4], *cp = c;
- gdouble o, oldo;
-
- wid = colorsel->sample_area->allocation.width;
- heig = colorsel->sample_area->allocation.height;
- half = wid >> 1;
-
- if (resize)
- {
- if (colorsel->sample_buf != NULL)
- g_free (colorsel->sample_buf);
-
- colorsel->sample_buf = g_new(guchar, 3 * wid);
- }
-
- i = RED;
- for (n = 0; n < 3; n++)
- {
- c[n] = (guchar) (255.0 * colorsel->old_values[i]);
- c[n + 3] = (guchar) (255.0 * colorsel->values[i++]);
- }
-
- if (colorsel->use_opacity == TRUE)
- {
- o = colorsel->values[OPACITY];
- oldo = colorsel->old_values[OPACITY];
-
- for (n = 0; n < 3; n++)
- {
- cc[n] = (guchar) ((1.0 - oldo) * 192 + (oldo * (gdouble) c[n]));
- cc[n + 3] = (guchar) ((1.0 - oldo) * 128 + (oldo * (gdouble) c[n]));
- cc[n + 6] = (guchar) ((1.0 - o) * 192 + (o * (gdouble) c[n + 3]));
- cc[n + 9] = (guchar) ((1.0 - o) * 128 + (o * (gdouble) c[n + 3]));
- }
- cp = cc;
- }
-
- for (y = 0; y < heig; y++)
- {
- i = 0;
- for (x = 0; x < wid; x++)
- {
- if (colorsel->use_opacity)
- {
- f = 3 * (((x % 32) < 16) ^ ((y % 32) < 16));
- f += (x > half) * 6;
- }
- else
- f = (x > half) * 3;
-
- for (n = 0; n < 3; n++)
- colorsel->sample_buf[i++] = cp[n + f];
- }
-
- gtk_preview_draw_row (GTK_PREVIEW (colorsel->sample_area), colorsel->sample_buf, 0, y, wid);
- }
-
- gtk_widget_draw (colorsel->sample_area, NULL);
-}
-
-static gint
-gtk_color_selection_eval_wheel (gint x, gint y,
- gdouble cx, gdouble cy,
- gdouble *h, gdouble *s)
-{
- gdouble d, r, rx, ry, l;
-
- rx = (gdouble) x - cx;
- ry = (gdouble) y - cy;
-
- d = (SQR (cy) * SQR (rx) + SQR (cx) * SQR (ry) - SQR (cx) * SQR (cy));
-
- r = sqrt (SQR (rx) + SQR (ry));
-
- if (r != 0.0)
- *h = atan2 (rx / r, ry / r);
- else
- *h = 0.0;
-
- l = sqrt (SQR ((cx * cos (*h + 0.5 * M_PI))) + SQR ((cy * sin (*h + 0.5 * M_PI))));
- *s = r / l;
- *h = 360.0 * (*h) / (2.0 * M_PI) + 180;
-
- if (*s == 0.0)
- *s = 0.00001;
- else if (*s > 1.0)
- *s = 1.0;
-
- return ((d > 0.0));
-}
-
-static void
-gtk_color_selection_hsv_to_rgb (gdouble h, gdouble s, gdouble v,
- gdouble *r, gdouble *g, gdouble *b)
-{
- gint i;
- gdouble f, w, q, t;
-
- if (s == 0.0)
- s = 0.000001;
-
- if (h == -1.0)
- {
- *r = v;
- *g = v;
- *b = v;
- }
- else
- {
- if (h == 360.0)
- h = 0.0;
- h = h / 60.0;
- i = (gint) h;
- f = h - i;
- w = v * (1.0 - s);
- q = v * (1.0 - (s * f));
- t = v * (1.0 - (s * (1.0 - f)));
-
- switch (i)
- {
- case 0:
- *r = v;
- *g = t;
- *b = w;
- break;
- case 1:
- *r = q;
- *g = v;
- *b = w;
- break;
- case 2:
- *r = w;
- *g = v;
- *b = t;
- break;
- case 3:
- *r = w;
- *g = q;
- *b = v;
- break;
- case 4:
- *r = t;
- *g = w;
- *b = v;
- break;
- case 5:
- *r = v;
- *g = w;
- *b = q;
- break;
- }
- }
-}
-
-static void
-gtk_color_selection_rgb_to_hsv (gdouble r, gdouble g, gdouble b,
- gdouble *h, gdouble *s, gdouble *v)
-{
- double max, min, delta;
-
- max = r;
- if (g > max)
- max = g;
- if (b > max)
- max = b;
-
- min = r;
- if (g < min)
- min = g;
- if (b < min)
- min = b;
-
- *v = max;
-
- if (max != 0.0)
- *s = (max - min) / max;
- else
- *s = 0.0;
-
- if (*s == 0.0)
- *h = -1.0;
- else
- {
- delta = max - min;
-
- if (r == max)
- *h = (g - b) / delta;
- else if (g == max)
- *h = 2.0 + (b - r) / delta;
- else if (b == max)
- *h = 4.0 + (r - g) / delta;
-
- *h = *h * 60.0;
-
- if (*h < 0.0)
- *h = *h + 360;
- }
-}
-
-/***************************/
-/* GtkColorSelectionDialog */
-/***************************/
-
-guint
-gtk_color_selection_dialog_get_type ()
-{
- static guint color_selection_dialog_type = 0;
-
- if (!color_selection_dialog_type)
- {
- GtkTypeInfo colorsel_diag_info =
- {
- "GtkColorSelectionDialog",
- sizeof (GtkColorSelectionDialog),
- sizeof (GtkColorSelectionDialogClass),
- (GtkClassInitFunc) gtk_color_selection_dialog_class_init,
- (GtkObjectInitFunc) gtk_color_selection_dialog_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- color_selection_dialog_type = gtk_type_unique (gtk_window_get_type (), &colorsel_diag_info);
- }
-
- return color_selection_dialog_type;
-}
-
-static void
-gtk_color_selection_dialog_class_init (GtkColorSelectionDialogClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass*) klass;
-
- color_selection_dialog_parent_class = gtk_type_class (gtk_window_get_type ());
-}
-
-static void
-gtk_color_selection_dialog_init (GtkColorSelectionDialog *colorseldiag)
-{
- GtkWidget *action_area, *frame;
-
- colorseldiag->main_vbox = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (colorseldiag), 10);
- gtk_container_add (GTK_CONTAINER (colorseldiag), colorseldiag->main_vbox);
- gtk_widget_show (colorseldiag->main_vbox);
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
- gtk_container_add (GTK_CONTAINER (colorseldiag->main_vbox), frame);
- gtk_widget_show (frame);
-
- colorseldiag->colorsel = gtk_color_selection_new ();
- gtk_container_add (GTK_CONTAINER (frame), colorseldiag->colorsel);
- gtk_widget_show (colorseldiag->colorsel);
-
- action_area = gtk_hbox_new (TRUE, 10);
- gtk_box_pack_end (GTK_BOX (colorseldiag->main_vbox), action_area, FALSE, FALSE, 0);
- gtk_widget_show (action_area);
-
- colorseldiag->ok_button = gtk_button_new_with_label ("OK");
- GTK_WIDGET_SET_FLAGS (colorseldiag->ok_button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (action_area), colorseldiag->ok_button, TRUE, TRUE, 0);
- gtk_widget_grab_default (colorseldiag->ok_button);
- gtk_widget_show (colorseldiag->ok_button);
-
- colorseldiag->cancel_button = gtk_button_new_with_label ("Cancel");
- GTK_WIDGET_SET_FLAGS (colorseldiag->cancel_button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (action_area), colorseldiag->cancel_button, TRUE, TRUE, 0);
- gtk_widget_show (colorseldiag->cancel_button);
-
- colorseldiag->help_button = gtk_button_new_with_label ("Help");
- GTK_WIDGET_SET_FLAGS (colorseldiag->help_button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (action_area), colorseldiag->help_button, TRUE, TRUE, 0);
- gtk_widget_show (colorseldiag->help_button);
-}
-
-GtkWidget *
-gtk_color_selection_dialog_new (const gchar *title)
-{
- GtkColorSelectionDialog *colorseldiag;
-
- colorseldiag = gtk_type_new (gtk_color_selection_dialog_get_type ());
- gtk_window_set_title (GTK_WINDOW (colorseldiag), title);
-
- return GTK_WIDGET (colorseldiag);
-}
diff --git a/gtk/gtkcolorsel.h b/gtk/gtkcolorsel.h
deleted file mode 100644
index 48b46bc938..0000000000
--- a/gtk/gtkcolorsel.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_COLORSEL_H__
-#define __GTK_COLORSEL_H__
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <gdk/gdk.h>
-
-#include "gtkwindow.h"
-#include "gtkvbox.h"
-#include "gtkframe.h"
-#include "gtkpreview.h"
-#include "gtkbutton.h"
-#include "gtkentry.h"
-#include "gtkhbox.h"
-#include "gtklabel.h"
-#include "gtkmain.h"
-#include "gtksignal.h"
-#include "gtkmisc.h"
-#include "gtkrange.h"
-#include "gtkscale.h"
-#include "gtkhscale.h"
-#include "gtktable.h"
-#include "gtkeventbox.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_COLOR_SELECTION(obj) GTK_CHECK_CAST (obj, gtk_color_selection_get_type (), GtkColorSelection)
-#define GTK_COLOR_SELECTION_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_color_selection_get_type (), GtkColorSelectionClass)
-#define GTK_IS_COLOR_SELECTION(obj) GTK_CHECK_TYPE (obj, gtk_color_selection_get_type ())
-
-#define GTK_COLOR_SELECTION_DIALOG(obj) GTK_CHECK_CAST (obj, gtk_color_selection_dialog_get_type (), GtkColorSelectionDialog)
-#define GTK_COLOR_SELECTION_DIALOG_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_color_selection_dialog_get_type (), GtkColorSelectionDialogClass)
-#define GTK_IS_COLOR_SELECTION_DIALOG(obj) GTK_CHECK_TYPE (obj, gtk_color_selection_dialog_get_type ())
-
-
-typedef struct _GtkColorSelection GtkColorSelection;
-typedef struct _GtkColorSelectionClass GtkColorSelectionClass;
-
-typedef struct _GtkColorSelectionDialog GtkColorSelectionDialog;
-typedef struct _GtkColorSelectionDialogClass GtkColorSelectionDialogClass;
-
-
-struct _GtkColorSelection
-{
- GtkVBox vbox;
-
- GtkWidget *wheel_area;
- GtkWidget *value_area;
- GtkWidget *sample_area;
- GtkWidget *sample_area_eb;
-
- GtkWidget *scales[8];
- GtkWidget *entries[8];
- GtkWidget *opacity_label;
-
- GdkGC *wheel_gc;
- GdkGC *value_gc;
- GdkGC *sample_gc;
-
- GtkUpdateType policy;
- gint use_opacity;
- gint timer_active;
- gint timer_tag;
- gdouble values[8];
- gdouble old_values[8];
-
- guchar *wheel_buf;
- guchar *value_buf;
- guchar *sample_buf;
-};
-
-struct _GtkColorSelectionClass
-{
- GtkVBoxClass parent_class;
-
- void (* color_changed) (GtkColorSelection *colorsel);
-};
-
-struct _GtkColorSelectionDialog
-{
- GtkWindow window;
-
- GtkWidget *colorsel;
- GtkWidget *main_vbox;
- GtkWidget *ok_button;
- GtkWidget *reset_button;
- GtkWidget *cancel_button;
- GtkWidget *help_button;
-};
-
-struct _GtkColorSelectionDialogClass
-{
- GtkWindowClass parent_class;
-};
-
-
-/* ColorSelection */
-
-guint gtk_color_selection_get_type (void);
-
-GtkWidget* gtk_color_selection_new (void);
-
-void gtk_color_selection_set_update_policy (GtkColorSelection *colorsel,
- GtkUpdateType policy);
-
-void gtk_color_selection_set_opacity (GtkColorSelection *colorsel,
- gint use_opacity);
-
-void gtk_color_selection_set_color (GtkColorSelection *colorsel,
- gdouble *color);
-
-void gtk_color_selection_get_color (GtkColorSelection *colorsel,
- gdouble *color);
-
-/* ColorSelectionDialog */
-
-guint gtk_color_selection_dialog_get_type (void);
-
-GtkWidget* gtk_color_selection_dialog_new (const gchar *title);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_COLORSEL_H__ */
diff --git a/gtk/gtkcombo.c b/gtk/gtkcombo.c
deleted file mode 100644
index 8e22038093..0000000000
--- a/gtk/gtkcombo.c
+++ /dev/null
@@ -1,541 +0,0 @@
-/* gtkcombo - combo widget for gtk+
- * Copyright 1997 Paolo Molaro
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/* $Id$ */
-
-#include <string.h>
-
-#include "gtkarrow.h"
-#include "gtklabel.h"
-#include "gtklist.h"
-#include "gtkentry.h"
-#include "gtkbutton.h"
-#include "gtklistitem.h"
-#include "gtkscrolledwindow.h"
-#include "gtkmain.h"
-#include "gtksignal.h"
-#include "gtkwindow.h"
-#include "gdk/gdkkeysyms.h"
-#include "gtkcombo.h"
-
-const gchar *gtk_combo_string_key = "gtk-combo-string-value";
-
-#define COMBO_LIST_MAX_HEIGHT 400
-
-static void gtk_combo_class_init (GtkComboClass *klass);
-static void gtk_combo_init (GtkCombo *combo);
-static void gtk_combo_destroy (GtkObject *combo);
-static GtkListItem *gtk_combo_find (GtkCombo *combo);
-static gchar * gtk_combo_func (GtkListItem *li);
-static gint gtk_combo_focus_idle (GtkCombo *combo);
-static gint gtk_combo_entry_focus_out (GtkEntry *entry,
- GdkEventFocus *event,
- GtkCombo *combo);
-static void gtk_combo_get_pos (GtkCombo *combo,
- gint *x,
- gint *y,
- gint *height,
- gint *width);
-static void gtk_combo_popup_list (GtkButton *button,
- GtkCombo *combo);
-static void gtk_combo_update_entry (GtkList *list,
- GtkCombo *combo);
-static void gtk_combo_update_list (GtkEntry *entry,
- GtkCombo *combo);
-static gint gtk_combo_button_press (GtkWidget *widget,
- GdkEvent *event,
- GtkCombo *combo);
-static gint gtk_combo_list_key_press (GtkWidget *widget,
- GdkEventKey *event,
- GtkCombo *combo);
-static gint gtk_combo_entry_key_press (GtkEntry *widget,
- GdkEventKey *event,
- GtkCombo *combo);
-static void gtk_combo_item_destroy (GtkObject *object);
-
-static GtkHBoxClass *parent_class = NULL;
-
-void
-gtk_combo_class_init (GtkComboClass * klass)
-{
- GtkObjectClass *oclass;
-
- parent_class = gtk_type_class (gtk_hbox_get_type ());
- oclass = (GtkObjectClass *) klass;
-
- oclass->destroy = gtk_combo_destroy;
-}
-
-static void
-gtk_combo_destroy (GtkObject * combo)
-{
- gtk_widget_destroy (GTK_COMBO (combo)->popwin);
- gtk_widget_unref (GTK_COMBO (combo)->popwin);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (*GTK_OBJECT_CLASS (parent_class)->destroy) (combo);
-}
-
-static int
-gtk_combo_entry_key_press (GtkEntry * entry, GdkEventKey * event, GtkCombo * combo)
-{
- GList *li;
- /* completion? */
- /*if ( event->keyval == GDK_Tab ) {
- gtk_signal_emit_stop_by_name (GTK_OBJECT (entry), "key_press_event");
- return TRUE;
- } else */
- if (!combo->use_arrows || !GTK_LIST (combo->list)->children)
- return FALSE;
- li = g_list_find (GTK_LIST (combo->list)->children, gtk_combo_find (combo));
-
- if ((event->keyval == GDK_Up)
- || (event->keyval == GDK_KP_Up)
- || ((event->state & GDK_MOD1_MASK) && ((event->keyval == 'p') || (event->keyval == 'P'))))
- {
- if (li)
- li = li->prev;
- if (!li && combo->use_arrows_always)
- {
- li = g_list_last (GTK_LIST (combo->list)->children);
- }
- if (li)
- {
- gtk_list_select_child (GTK_LIST (combo->list), GTK_WIDGET (li->data));
- gtk_signal_emit_stop_by_name (GTK_OBJECT (entry), "key_press_event");
- return TRUE;
- }
- }
- else if ((event->keyval == GDK_Down)
- || (event->keyval == GDK_KP_Down)
- || ((event->state & GDK_MOD1_MASK) && ((event->keyval == 'n') || (event->keyval == 'N'))))
- {
- if (li)
- li = li->next;
- if (!li && combo->use_arrows_always)
- {
- li = GTK_LIST (combo->list)->children;
- }
- if (li)
- {
- gtk_list_select_child (GTK_LIST (combo->list), GTK_WIDGET (li->data));
- gtk_signal_emit_stop_by_name (GTK_OBJECT (entry), "key_press_event");
- return TRUE;
- }
- }
- return FALSE;
-}
-
-static GtkListItem *
-gtk_combo_find (GtkCombo * combo)
-{
- gchar *text;
- gchar *ltext;
- GList *clist;
- int (*string_compare) (const char *, const char *);
-
- if (combo->case_sensitive)
- string_compare = strcmp;
- else
- string_compare = g_strcasecmp;
-
- text = gtk_entry_get_text (GTK_ENTRY (combo->entry));
- clist = GTK_LIST (combo->list)->children;
-
- while (clist && clist->data)
- {
- ltext = gtk_combo_func (GTK_LIST_ITEM (clist->data));
- if (!ltext)
- continue;
- if (!(*string_compare) (ltext, text))
- return (GtkListItem *) clist->data;
- clist = clist->next;
- }
-
- return NULL;
-}
-
-static gchar *
-gtk_combo_func (GtkListItem * li)
-{
- GtkWidget *label;
- gchar *ltext = NULL;
-
- ltext = (gchar *) gtk_object_get_data (GTK_OBJECT (li), gtk_combo_string_key);
- if (!ltext)
- {
- label = GTK_BIN (li)->child;
- if (!label || !GTK_IS_LABEL (label))
- return NULL;
- gtk_label_get (GTK_LABEL (label), &ltext);
- }
- return ltext;
-}
-
-static gint
-gtk_combo_focus_idle (GtkCombo * combo)
-{
- if (combo)
- gtk_widget_grab_focus (combo->entry);
- return FALSE;
-}
-
-static gint
-gtk_combo_entry_focus_out (GtkEntry * entry, GdkEventFocus * event, GtkCombo * combo)
-{
-
- if (combo->value_in_list && !gtk_combo_find (combo))
- {
- /* gdk_beep(); *//* this can be annoying */
- if (combo->ok_if_empty && !strcmp (gtk_entry_get_text (entry), ""))
- return FALSE;
-#ifdef TEST
- printf ("INVALID ENTRY: `%s'\n", gtk_entry_get_text (entry));
-#endif
- gtk_grab_add (GTK_WIDGET (combo));
- /* this is needed because if we call gtk_widget_grab_focus()
- it isn't guaranteed it's the *last* call before the main-loop,
- so the focus can be lost anyway...
- the signal_emit_stop doesn't seem to work either...
- */
- gtk_idle_add ((GtkFunction) gtk_combo_focus_idle, combo);
- /*gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "focus_out_event"); */
- return TRUE;
- }
- return FALSE;
-}
-
-static void
-gtk_combo_get_pos (GtkCombo * combo, gint * x, gint * y, gint * height, gint * width)
-{
- GtkAllocation *pos = &(GTK_WIDGET (combo->entry)->allocation);
- GtkRequisition req1;
- GtkRequisition req3;
- gint some_more = 10 + GTK_CONTAINER (combo->popup)->border_width * 2; /* FIXME: calc from border_width ... */
-
- gtk_widget_size_request (combo->popup, &req1);
- gtk_widget_size_request (combo->list, &req3);
-
- *width = pos->width;
- gdk_window_get_origin (GTK_WIDGET (combo->entry)->window, x, y);
- *y += pos->height;
- *height = MIN (COMBO_LIST_MAX_HEIGHT, gdk_screen_height () - *y);
-
- if (some_more + req3.width > *width)
- some_more += 11 + 2 * 2; /* FIXME: get from the scrollbar and scrollbar_spacing */
- if (some_more + req3.height < *height)
- *height = some_more + req3.height;
-
-}
-
-static void
-gtk_combo_popup_list (GtkButton * button, GtkCombo * combo)
-{
- gint height, width, x, y;
-
- if (!GTK_LIST (combo->list)->children)
- return;
- gtk_combo_get_pos (combo, &x, &y, &height, &width);
-
- gtk_widget_set_uposition (combo->popwin, x, y);
- gtk_widget_set_usize (combo->popwin, width, height);
- gtk_widget_realize (combo->popwin);
- /* gdk_window_set_cursor (combo->popwin->window, gdk_cursor_new (GDK_TOP_LEFT_ARROW));
- */
- gdk_window_resize (combo->popwin->window, width, height);
- gtk_widget_show (combo->popwin);
- gtk_widget_grab_focus (combo->popwin);
- gtk_grab_add (combo->popwin);
- gdk_pointer_grab (combo->popwin->window, TRUE,
- GDK_BUTTON_PRESS_MASK, NULL, NULL, GDK_CURRENT_TIME);
-}
-
-#if 0
-static void
-prelight_bug (GtkButton * b, GtkCombo * combo)
-{
- /* avoid prelight state... */
- gtk_widget_set_state (combo->button, GTK_STATE_NORMAL);
-
-}
-#endif
-
-static void
-gtk_combo_update_entry (GtkList * list, GtkCombo * combo)
-{
- char *text;
-
- gtk_grab_remove (GTK_WIDGET (combo));
- gtk_signal_handler_block (GTK_OBJECT (list), combo->list_change_id);
- if (list->selection)
- {
- text = gtk_combo_func (GTK_LIST_ITEM (list->selection->data));
- if (!text)
- text = "";
- gtk_entry_set_text (GTK_ENTRY (combo->entry), text);
- }
- gtk_widget_hide (combo->popwin);
- gtk_grab_remove (combo->popwin);
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
- gtk_signal_handler_unblock (GTK_OBJECT (list), combo->list_change_id);
-}
-
-static void
-gtk_combo_update_list (GtkEntry * entry, GtkCombo * combo)
-{
- GtkList *list = GTK_LIST (combo->list);
- GList *slist = list->selection;
- GtkListItem *li;
-
- gtk_grab_remove (GTK_WIDGET (combo));
-
- gtk_signal_handler_block (GTK_OBJECT (entry), combo->entry_change_id);
- if (slist && slist->data)
- gtk_list_unselect_child (list, GTK_WIDGET (slist->data));
- li = gtk_combo_find (combo);
- if (li)
- gtk_list_select_child (list, GTK_WIDGET (li));
- gtk_signal_handler_unblock (GTK_OBJECT (entry), combo->entry_change_id);
-}
-
-static gint
-gtk_combo_button_press (GtkWidget * widget, GdkEvent * event, GtkCombo * combo)
-{
- GtkWidget *child;
-
- child = gtk_get_event_widget (event);
-
- /* We don't ask for button press events on the grab widget, so
- * if an event is reported directly to the grab widget, it must
- * be on a window outside the application (and thus we remove
- * the popup window). Otherwise, we check if the widget is a child
- * of the grab widget, and only remove the popup window if it
- * is not.
- */
- if (child != widget)
- {
- while (child)
- {
- if (child == widget)
- return FALSE;
- child = child->parent;
- }
- }
-
- gtk_widget_hide (combo->popwin);
- gtk_grab_remove (combo->popwin);
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
-
- return TRUE;
-}
-
-static int
-gtk_combo_list_key_press (GtkWidget * widget, GdkEventKey * event, GtkCombo * combo)
-{
- if (event->keyval == GDK_Escape)
- {
- gtk_widget_hide (combo->popwin);
- gtk_grab_remove (combo->popwin);
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
- return TRUE;
- }
- return FALSE;
-}
-
-void
-gtk_combo_init (GtkCombo * combo)
-{
- GtkWidget *arrow;
-
- combo->case_sensitive = 0;
- combo->value_in_list = 0;
- combo->ok_if_empty = 1;
- combo->use_arrows = 1;
- combo->use_arrows_always = 0;
- combo->entry = gtk_entry_new ();
- combo->button = gtk_button_new ();
- arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_OUT);
- gtk_widget_show (arrow);
- gtk_container_add (GTK_CONTAINER (combo->button), arrow);
- gtk_box_pack_start (GTK_BOX (combo), combo->entry, TRUE, TRUE, 0);
- gtk_box_pack_end (GTK_BOX (combo), combo->button, FALSE, FALSE, 0);
- gtk_widget_show (combo->entry);
- gtk_widget_show (combo->button);
- combo->entry_change_id = gtk_signal_connect (GTK_OBJECT (combo->entry), "changed",
- (GtkSignalFunc) gtk_combo_update_list, combo);
- gtk_signal_connect (GTK_OBJECT (combo->entry), "key_press_event",
- (GtkSignalFunc) gtk_combo_entry_key_press, combo);
- gtk_signal_connect_after (GTK_OBJECT (combo->entry), "focus_out_event",
- (GtkSignalFunc) gtk_combo_entry_focus_out, combo);
- gtk_signal_connect (GTK_OBJECT (combo->entry), "activate",
- (GtkSignalFunc) gtk_combo_popup_list, combo);
- gtk_signal_connect (GTK_OBJECT (combo->button), "clicked",
- (GtkSignalFunc) gtk_combo_popup_list, combo);
- /*gtk_signal_connect(GTK_OBJECT(combo->button), "clicked",
- (GtkSignalFunc)prelight_bug, combo); */
-
- combo->popwin = gtk_window_new (GTK_WINDOW_POPUP);
- gtk_widget_ref (combo->popwin);
- gtk_window_set_policy (GTK_WINDOW (combo->popwin), 1, 1, 0);
- combo->popup = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (combo->popup),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- combo->list = gtk_list_new ();
- gtk_list_set_selection_mode(GTK_LIST(combo->list), GTK_SELECTION_BROWSE);
- gtk_container_add (GTK_CONTAINER (combo->popwin), combo->popup);
- gtk_container_add (GTK_CONTAINER (combo->popup), combo->list);
- gtk_widget_show (combo->list);
- gtk_widget_show (combo->popup);
- gtk_widget_set_events (combo->popwin, gtk_widget_get_events (combo->popwin) | GDK_KEY_PRESS_MASK);
- combo->list_change_id = gtk_signal_connect (GTK_OBJECT (combo->list), "selection_changed",
- (GtkSignalFunc) gtk_combo_update_entry, combo);
- gtk_signal_connect (GTK_OBJECT (combo->popwin), "key_press_event",
- (GtkSignalFunc) gtk_combo_list_key_press, combo);
- gtk_signal_connect (GTK_OBJECT (combo->popwin), "button_press_event",
- GTK_SIGNAL_FUNC (gtk_combo_button_press), combo);
-
-}
-
-guint
-gtk_combo_get_type ()
-{
- static guint combo_type = 0;
-
- if (!combo_type)
- {
- GtkTypeInfo combo_info =
- {
- "GtkCombo",
- sizeof (GtkCombo),
- sizeof (GtkComboClass),
- (GtkClassInitFunc) gtk_combo_class_init,
- (GtkObjectInitFunc) gtk_combo_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
- combo_type = gtk_type_unique (gtk_hbox_get_type (), &combo_info);
- }
- return combo_type;
-}
-
-GtkWidget *
-gtk_combo_new ()
-{
- return GTK_WIDGET (gtk_type_new (gtk_combo_get_type ()));
-}
-
-void
-gtk_combo_set_value_in_list (GtkCombo * combo, gint val, gint ok_if_empty)
-{
- g_return_if_fail (combo != NULL);
- g_return_if_fail (GTK_IS_COMBO (combo));
-
- combo->value_in_list = val;
- combo->ok_if_empty = ok_if_empty;
-}
-
-void
-gtk_combo_set_case_sensitive (GtkCombo * combo, gint val)
-{
- g_return_if_fail (combo != NULL);
- g_return_if_fail (GTK_IS_COMBO (combo));
-
- combo->case_sensitive = val;
-}
-
-void
-gtk_combo_set_use_arrows (GtkCombo * combo, gint val)
-{
- g_return_if_fail (combo != NULL);
- g_return_if_fail (GTK_IS_COMBO (combo));
-
- combo->use_arrows = val;
-}
-
-void
-gtk_combo_set_use_arrows_always (GtkCombo * combo, gint val)
-{
- g_return_if_fail (combo != NULL);
- g_return_if_fail (GTK_IS_COMBO (combo));
-
- combo->use_arrows_always = val;
- combo->use_arrows = 1;
-}
-
-void
-gtk_combo_set_popdown_strings (GtkCombo * combo, GList * strings)
-{
- GList *list;
- GtkWidget *li;
-
- g_return_if_fail (combo != NULL);
- g_return_if_fail (GTK_IS_COMBO (combo));
- g_return_if_fail (strings != NULL);
-
- gtk_list_clear_items (GTK_LIST (combo->list), 0, -1);
- list = strings;
- while (list)
- {
- li = gtk_list_item_new_with_label ((gchar *) list->data);
- gtk_widget_show (li);
- gtk_container_add (GTK_CONTAINER (combo->list), li);
- list = list->next;
- }
-}
-
-static void
-gtk_combo_item_destroy (GtkObject * object)
-{
- gchar *key;
-
- key = gtk_object_get_data (object, gtk_combo_string_key);
- if (key)
- g_free (key);
-}
-
-void
-gtk_combo_set_item_string (GtkCombo * combo, GtkItem * item, const gchar * item_value)
-{
- gchar *val;
- gint connected = 0;
-
- g_return_if_fail (combo != NULL);
- g_return_if_fail (GTK_IS_COMBO (combo));
- g_return_if_fail (item != NULL);
-
- val = gtk_object_get_data (GTK_OBJECT (item), gtk_combo_string_key);
- if (val)
- {
- g_free (val);
- connected = 1;
- }
- if (item_value)
- {
- val = g_strdup(item_value);
- gtk_object_set_data (GTK_OBJECT (item), gtk_combo_string_key, val);
- if (!connected)
- gtk_signal_connect (GTK_OBJECT (item), "destroy",
- (GtkSignalFunc) gtk_combo_item_destroy, val);
- }
- else
- {
- gtk_object_set_data (GTK_OBJECT (item), gtk_combo_string_key, NULL);
- if (connected)
- gtk_signal_disconnect_by_data(GTK_OBJECT (item), val);
- }
-}
diff --git a/gtk/gtkcombo.h b/gtk/gtkcombo.h
deleted file mode 100644
index 81522f46ae..0000000000
--- a/gtk/gtkcombo.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* gtkcombo - combo widget for gtk+
- * Copyright 1997 Paolo Molaro
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-#ifndef __GTK_SMART_COMBO_H__
-#define __GTK_SMART_COMBO_H__
-
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkitem.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define GTK_COMBO(obj) GTK_CHECK_CAST (obj, gtk_combo_get_type (), GtkCombo)
-#define GTK_COMBO_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_combo_get_type (), GtkComboClass)
-#define GTK_IS_COMBO(obj) GTK_CHECK_TYPE (obj, gtk_combo_get_type ())
-
-typedef struct _GtkCombo GtkCombo;
-typedef struct _GtkComboClass GtkComboClass;
-
-/* you should access only the entry and list fields directly */
-struct _GtkCombo {
- GtkHBox hbox;
- GtkWidget *entry;
- GtkWidget *button;
- GtkWidget *popup;
- GtkWidget *popwin;
- GtkWidget *list;
-
- guint entry_change_id;
- guint list_change_id;
-
- guint value_in_list:1;
- guint ok_if_empty:1;
- guint case_sensitive:1;
- guint use_arrows:1;
- guint use_arrows_always:1;
-};
-
-struct _GtkComboClass {
- GtkHBoxClass parent_class;
-};
-
-guint gtk_combo_get_type (void);
-
-GtkWidget *gtk_combo_new (void);
-/* the text in the entry must be or not be in the list */
-void gtk_combo_set_value_in_list (GtkCombo* combo,
- gint val,
- gint ok_if_empty);
-/* set/unset arrows working for changing the value (can be annoying */
-void gtk_combo_set_use_arrows (GtkCombo* combo,
- gint val);
-/* up/down arrows change value if current value not in list */
-void gtk_combo_set_use_arrows_always (GtkCombo* combo,
- gint val);
-/* perform case-sensitive compares */
-void gtk_combo_set_case_sensitive (GtkCombo* combo,
- gint val);
-/* call this function on an item if it isn't a label or you
- want it to have a different value to be displayed in the entry */
-void gtk_combo_set_item_string (GtkCombo* combo,
- GtkItem* item,
- const gchar* item_value);
-/* simple interface */
-void gtk_combo_set_popdown_strings (GtkCombo* combo,
- GList *strings);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __GTK_SMART_COMBO_H__ */
-
-
diff --git a/gtk/gtkcontainer.h b/gtk/gtkcontainer.h
deleted file mode 100644
index 3585d20e4b..0000000000
--- a/gtk/gtkcontainer.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_CONTAINER_H__
-#define __GTK_CONTAINER_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkenums.h>
-#include <gtk/gtkwidget.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_CONTAINER(obj) (GTK_CHECK_CAST ((obj), gtk_container_get_type (), GtkContainer))
-#define GTK_CONTAINER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), gtk_container_get_type, GtkContainerClass))
-#define GTK_IS_CONTAINER(obj) (GTK_CHECK_TYPE ((obj), gtk_container_get_type ()))
-
-#define GTK_TYPE_CONTAINER (gtk_container_get_type ())
-
-typedef struct _GtkContainer GtkContainer;
-typedef struct _GtkContainerClass GtkContainerClass;
-
-struct _GtkContainer
-{
- GtkWidget widget;
-
- GtkWidget *focus_child;
-
- gint16 border_width;
- guint auto_resize : 1;
- guint need_resize : 1;
- guint block_resize : 1;
-
-
- /* The list of children that requested a resize
- */
- GSList *resize_widgets;
-};
-
-struct _GtkContainerClass
-{
- GtkWidgetClass parent_class;
-
- void (* add) (GtkContainer *container,
- GtkWidget *widget);
- void (* remove) (GtkContainer *container,
- GtkWidget *widget);
- gint (* need_resize) (GtkContainer *container);
- void (* foreach) (GtkContainer *container,
- GtkCallback callback,
- gpointer callbabck_data);
- gint (* focus) (GtkContainer *container,
- GtkDirectionType direction);
-};
-
-
-
-guint gtk_container_get_type (void);
-void gtk_container_border_width (GtkContainer *container,
- gint border_width);
-void gtk_container_add (GtkContainer *container,
- GtkWidget *widget);
-void gtk_container_remove (GtkContainer *container,
- GtkWidget *widget);
-void gtk_container_disable_resize (GtkContainer *container);
-void gtk_container_enable_resize (GtkContainer *container);
-void gtk_container_block_resize (GtkContainer *container);
-void gtk_container_unblock_resize (GtkContainer *container);
-gint gtk_container_need_resize (GtkContainer *container);
-void gtk_container_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data);
-void gtk_container_foreach_interp (GtkContainer *container,
- GtkCallbackMarshal marshal,
- gpointer callback_data,
- GtkDestroyNotify notify);
-void gtk_container_foreach_full (GtkContainer *container,
- GtkCallback callback,
- GtkCallbackMarshal marshal,
- gpointer callback_data,
- GtkDestroyNotify notify);
-gint gtk_container_focus (GtkContainer *container,
- GtkDirectionType direction);
-GList* gtk_container_children (GtkContainer *container);
-
-void gtk_container_register_toplevel (GtkContainer *container);
-void gtk_container_unregister_toplevel (GtkContainer *container);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_CONTAINER_H__ */
diff --git a/gtk/gtkcurve.c b/gtk/gtkcurve.c
deleted file mode 100644
index 0790917f63..0000000000
--- a/gtk/gtkcurve.c
+++ /dev/null
@@ -1,861 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1997 David Mosberger
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include "gtkcurve.h"
-#include "gtkdrawingarea.h"
-#include "gtkmain.h"
-#include "gtkradiobutton.h"
-#include "gtksignal.h"
-#include "gtktable.h"
-
-#define BOUNDS(a,x,y) (((a) < (x)) ? (x) : (((a) > (y)) ? (y) : (a)))
-#define RADIUS 3 /* radius of the control points */
-#define MIN_DISTANCE 8 /* min distance between control points */
-
-#define GRAPH_MASK (GDK_EXPOSURE_MASK | \
- GDK_POINTER_MOTION_MASK | \
- GDK_POINTER_MOTION_HINT_MASK | \
- GDK_ENTER_NOTIFY_MASK | \
- GDK_BUTTON_PRESS_MASK | \
- GDK_BUTTON_RELEASE_MASK | \
- GDK_BUTTON1_MOTION_MASK)
-
-static GtkDrawingAreaClass *parent_class = NULL;
-static guint curve_type_changed_signal = 0;
-
-
-/* forward declarations: */
-static void gtk_curve_class_init (GtkCurveClass *class);
-static void gtk_curve_init (GtkCurve *curve);
-static void gtk_curve_finalize (GtkObject *object);
-
-
-guint
-gtk_curve_get_type (void)
-{
- static guint curve_type = 0;
-
- if (!curve_type)
- {
- GtkTypeInfo curve_info =
- {
- "GtkCurve",
- sizeof (GtkCurve),
- sizeof (GtkCurveClass),
- (GtkClassInitFunc) gtk_curve_class_init,
- (GtkObjectInitFunc) gtk_curve_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- curve_type = gtk_type_unique (gtk_drawing_area_get_type (), &curve_info);
- }
- return curve_type;
-}
-
-static void
-gtk_curve_class_init (GtkCurveClass *class)
-{
- GtkObjectClass *object_class;
-
- parent_class = gtk_type_class (gtk_drawing_area_get_type ());
-
- object_class = (GtkObjectClass *) class;
-
- curve_type_changed_signal =
- gtk_signal_new ("curve_type_changed", GTK_RUN_FIRST, object_class->type,
- GTK_SIGNAL_OFFSET (GtkCurveClass, curve_type_changed),
- gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
- gtk_object_class_add_signals (object_class, &curve_type_changed_signal, 1);
-
- object_class->finalize = gtk_curve_finalize;
-}
-
-static void
-gtk_curve_init (GtkCurve *curve)
-{
- curve->cursor_type = GDK_TOP_LEFT_ARROW;
- curve->pixmap = NULL;
- curve->curve_type = GTK_CURVE_TYPE_SPLINE;
- curve->height = 0;
- curve->grab_point = -1;
-
- curve->num_points = 0;
- curve->point = 0;
-
- curve->num_ctlpoints = 0;
- curve->ctlpoint = NULL;
-}
-
-static int
-project (gfloat value, gfloat min, gfloat max, int norm)
-{
- return (norm - 1) * ((value - min) / (max - min)) + 0.5;
-}
-
-static gfloat
-unproject (gint value, gfloat min, gfloat max, int norm)
-{
- return value / (gfloat) (norm - 1) * (max - min) + min;
-}
-
-/* Solve the tridiagonal equation system that determines the second
- derivatives for the interpolation points. (Based on Numerical
- Recipies 2nd Edition.) */
-static void
-spline_solve (int n, gfloat x[], gfloat y[], gfloat y2[])
-{
- gfloat p, sig, *u;
- gint i, k;
-
- u = g_malloc ((n - 1) * sizeof (u[0]));
-
- y2[0] = u[0] = 0.0; /* set lower boundary condition to "natural" */
-
- for (i = 1; i < n - 1; ++i)
- {
- sig = (x[i] - x[i - 1]) / (x[i + 1] - x[i - 1]);
- p = sig * y2[i - 1] + 2.0;
- y2[i] = (sig - 1.0) / p;
- u[i] = ((y[i + 1] - y[i])
- / (x[i + 1] - x[i]) - (y[i] - y[i - 1]) / (x[i] - x[i - 1]));
- u[i] = (6.0 * u[i] / (x[i + 1] - x[i - 1]) - sig * u[i - 1]) / p;
- }
-
- y2[n - 1] = 0.0;
- for (k = n - 2; k >= 0; --k)
- y2[k] = y2[k] * y2[k + 1] + u[k];
-
- g_free (u);
-}
-
-static gfloat
-spline_eval (int n, gfloat x[], gfloat y[], gfloat y2[], gfloat val)
-{
- gint k_lo, k_hi, k;
- gfloat h, b, a;
-
- /* do a binary search for the right interval: */
- k_lo = 0; k_hi = n - 1;
- while (k_hi - k_lo > 1)
- {
- k = (k_hi + k_lo) / 2;
- if (x[k] > val)
- k_hi = k;
- else
- k_lo = k;
- }
-
- h = x[k_hi] - x[k_lo];
- g_assert (h > 0.0);
-
- a = (x[k_hi] - val) / h;
- b = (val - x[k_lo]) / h;
- return a*y[k_lo] + b*y[k_hi] +
- ((a*a*a - a)*y2[k_lo] + (b*b*b - b)*y2[k_hi]) * (h*h)/6.0;
-}
-
-static void
-gtk_curve_interpolate (GtkCurve *c, gint width, gint height)
-{
- gfloat *vector;
- int i;
-
- vector = g_malloc (width * sizeof (vector[0]));
-
- gtk_curve_get_vector (c, width, vector);
-
- c->height = height;
- if (c->num_points != width)
- {
- c->num_points = width;
- if (c->point)
- g_free (c->point);
- c->point = g_malloc (c->num_points * sizeof (c->point[0]));
- }
-
- for (i = 0; i < width; ++i)
- {
- c->point[i].x = RADIUS + i;
- c->point[i].y = RADIUS + height
- - project (vector[i], c->min_y, c->max_y, height);
- }
-}
-
-static void
-gtk_curve_draw (GtkCurve *c, gint width, gint height)
-{
- GtkStateType state;
- GtkStyle *style;
- gint i;
-
- if (!c->pixmap)
- return;
-
- if (c->height != height || c->num_points != width)
- gtk_curve_interpolate (c, width, height);
-
- state = GTK_STATE_NORMAL;
- if (!GTK_WIDGET_IS_SENSITIVE (GTK_WIDGET (c)))
- state = GTK_STATE_INSENSITIVE;
-
- style = GTK_WIDGET (c)->style;
-
- /* clear the pixmap: */
- gdk_draw_rectangle (c->pixmap, style->bg_gc[state], TRUE,
- 0, 0, width + RADIUS * 2, height + RADIUS * 2);
-
- /* draw the grid lines: (XXX make more meaningful) */
- for (i = 0; i < 5; i++)
- {
- gdk_draw_line (c->pixmap, style->dark_gc[state],
- RADIUS, i * (height / 4.0) + RADIUS,
- width + RADIUS, i * (height / 4.0) + RADIUS);
- gdk_draw_line (c->pixmap, style->dark_gc[state],
- i * (width / 4.0) + RADIUS, RADIUS,
- i * (width / 4.0) + RADIUS, height + RADIUS);
- }
-
- gdk_draw_points (c->pixmap, style->fg_gc[state], c->point, c->num_points);
- if (c->curve_type != GTK_CURVE_TYPE_FREE)
- for (i = 0; i < c->num_ctlpoints; ++i)
- {
- gint x, y;
-
- if (c->ctlpoint[i][0] < c->min_x)
- continue;
-
- x = project (c->ctlpoint[i][0], c->min_x, c->max_x,
- width);
- y = height -
- project (c->ctlpoint[i][1], c->min_y, c->max_y,
- height);
-
- /* draw a bullet: */
- gdk_draw_arc (c->pixmap, style->fg_gc[state], TRUE, x, y,
- RADIUS * 2, RADIUS*2, 0, 360*64);
- }
- gdk_draw_pixmap (GTK_WIDGET (c)->window, style->fg_gc[state], c->pixmap,
- 0, 0, 0, 0, width + RADIUS * 2, height + RADIUS * 2);
-}
-
-static gint
-gtk_curve_graph_events (GtkWidget *widget, GdkEvent *event, GtkCurve *c)
-{
- GdkCursorType new_type = c->cursor_type;
- gint i, src, dst, leftbound, rightbound;
- GdkEventButton *bevent;
- GdkEventMotion *mevent;
- GtkWidget *w;
- gint tx, ty;
- gint cx, x, y, width, height;
- gint closest_point = 0;
- gfloat rx, ry, min_x;
- guint distance;
- gint x1, x2, y1, y2;
-
- w = GTK_WIDGET (c);
- width = w->allocation.width - RADIUS * 2;
- height = w->allocation.height - RADIUS * 2;
-
- /* get the pointer position */
- gdk_window_get_pointer (w->window, &tx, &ty, NULL);
- x = BOUNDS ((tx - RADIUS), 0, width);
- y = BOUNDS ((ty - RADIUS), 0, height);
-
- min_x = c->min_x;
-
- distance = ~0U;
- for (i = 0; i < c->num_ctlpoints; ++i)
- {
- cx = project (c->ctlpoint[i][0], min_x, c->max_x, width);
- if ((guint) abs (x - cx) < distance)
- {
- distance = abs (x - cx);
- closest_point = i;
- }
- }
-
- switch (event->type)
- {
- case GDK_CONFIGURE:
- if (c->pixmap)
- gdk_pixmap_unref (c->pixmap);
- c->pixmap = 0;
- /* fall through */
- case GDK_EXPOSE:
- if (!c->pixmap)
- c->pixmap = gdk_pixmap_new (w->window,
- w->allocation.width,
- w->allocation.height, -1);
- gtk_curve_draw (c, width, height);
- break;
-
- case GDK_BUTTON_PRESS:
- gtk_grab_add (widget);
-
- bevent = (GdkEventButton *) event;
- new_type = GDK_TCROSS;
-
- switch (c->curve_type)
- {
- case GTK_CURVE_TYPE_LINEAR:
- case GTK_CURVE_TYPE_SPLINE:
- if (distance > MIN_DISTANCE)
- {
- /* insert a new control point */
- if (c->num_ctlpoints > 0)
- {
- cx = project (c->ctlpoint[closest_point][0], min_x,
- c->max_x, width);
- if (x > cx)
- ++closest_point;
- }
- ++c->num_ctlpoints;
- c->ctlpoint =
- g_realloc (c->ctlpoint,
- c->num_ctlpoints * sizeof (*c->ctlpoint));
- for (i = c->num_ctlpoints - 1; i > closest_point; --i)
- memcpy (c->ctlpoint + i, c->ctlpoint + i - 1,
- sizeof (*c->ctlpoint));
- }
- c->grab_point = closest_point;
- c->ctlpoint[c->grab_point][0] =
- unproject (x, min_x, c->max_x, width);
- c->ctlpoint[c->grab_point][1] =
- unproject (height - y, c->min_y, c->max_y, height);
-
- gtk_curve_interpolate (c, width, height);
- break;
-
- case GTK_CURVE_TYPE_FREE:
- c->point[x].x = RADIUS + x;
- c->point[x].y = RADIUS + y;
- c->grab_point = x;
- c->last = y;
- break;
- }
- gtk_curve_draw (c, width, height);
- break;
-
- case GDK_BUTTON_RELEASE:
- gtk_grab_remove (widget);
-
- /* delete inactive points: */
- if (c->curve_type != GTK_CURVE_TYPE_FREE)
- {
- for (src = dst = 0; src < c->num_ctlpoints; ++src)
- {
- if (c->ctlpoint[src][0] >= min_x)
- {
- memcpy (c->ctlpoint + dst, c->ctlpoint + src,
- sizeof (*c->ctlpoint));
- ++dst;
- }
- }
- if (dst < src)
- {
- c->num_ctlpoints -= (src - dst);
- if (c->num_ctlpoints <= 0)
- {
- c->num_ctlpoints = 1;
- c->ctlpoint[0][0] = min_x;
- c->ctlpoint[0][1] = c->min_y;
- gtk_curve_interpolate (c, width, height);
- gtk_curve_draw (c, width, height);
- }
- c->ctlpoint =
- g_realloc (c->ctlpoint,
- c->num_ctlpoints * sizeof (*c->ctlpoint));
- }
- }
- new_type = GDK_FLEUR;
- c->grab_point = -1;
- break;
-
- case GDK_MOTION_NOTIFY:
- mevent = (GdkEventMotion *) event;
- if (mevent->is_hint)
- {
- mevent->x = tx;
- mevent->y = ty;
- }
- switch (c->curve_type)
- {
- case GTK_CURVE_TYPE_LINEAR:
- case GTK_CURVE_TYPE_SPLINE:
- if (c->grab_point == -1)
- {
- /* if no point is grabbed... */
- if (distance <= MIN_DISTANCE)
- new_type = GDK_FLEUR;
- else
- new_type = GDK_TCROSS;
- }
- else
- {
- /* drag the grabbed point */
- new_type = GDK_TCROSS;
-
- leftbound = -MIN_DISTANCE;
- if (c->grab_point > 0)
- leftbound = project (c->ctlpoint[c->grab_point - 1][0],
- min_x, c->max_x, width);
-
- rightbound = width + RADIUS * 2 + MIN_DISTANCE;
- if (c->grab_point + 1 < c->num_ctlpoints)
- rightbound = project (c->ctlpoint[c->grab_point + 1][0],
- min_x, c->max_x, width);
-
- if (tx <= leftbound || tx >= rightbound
- || ty > height + RADIUS * 2 + MIN_DISTANCE
- || ty < -MIN_DISTANCE)
- c->ctlpoint[c->grab_point][0] = min_x - 1.0;
- else
- {
- rx = unproject (x, min_x, c->max_x, width);
- ry = unproject (height - y, c->min_y, c->max_y, height);
- c->ctlpoint[c->grab_point][0] = rx;
- c->ctlpoint[c->grab_point][1] = ry;
- }
- gtk_curve_interpolate (c, width, height);
- gtk_curve_draw (c, width, height);
- }
- break;
-
- case GTK_CURVE_TYPE_FREE:
- if (c->grab_point != -1)
- {
- if (c->grab_point > x)
- {
- x1 = x;
- x2 = c->grab_point;
- y1 = y;
- y2 = c->last;
- }
- else
- {
- x1 = c->grab_point;
- x2 = x;
- y1 = c->last;
- y2 = y;
- }
-
- if (x2 != x1)
- for (i = x1; i <= x2; i++)
- {
- c->point[i].x = RADIUS + i;
- c->point[i].y = RADIUS +
- (y1 + ((y2 - y1) * (i - x1)) / (x2 - x1));
- }
- else
- {
- c->point[x].x = RADIUS + x;
- c->point[x].y = RADIUS + y;
- }
- c->grab_point = x;
- c->last = y;
- gtk_curve_draw (c, width, height);
- }
- if (mevent->state & GDK_BUTTON1_MASK)
- new_type = GDK_TCROSS;
- else
- new_type = GDK_PENCIL;
- break;
- }
- if (new_type != (GdkCursorType) c->cursor_type)
- {
- GdkCursor *cursor;
-
- c->cursor_type = new_type;
-
- cursor = gdk_cursor_new (c->cursor_type);
- gdk_window_set_cursor (w->window, cursor);
- gdk_cursor_destroy (cursor);
- }
- break;
-
- default:
- break;
- }
- return FALSE;
-}
-
-void
-gtk_curve_set_curve_type (GtkCurve *c, GtkCurveType new_type)
-{
- gfloat rx, dx;
- gint x, i;
-
- if (new_type != c->curve_type)
- {
- gint width, height;
-
- width = GTK_WIDGET(c)->allocation.width - RADIUS * 2;
- height = GTK_WIDGET(c)->allocation.height - RADIUS * 2;
-
- if (new_type == GTK_CURVE_TYPE_FREE)
- {
- gtk_curve_interpolate (c, width, height);
- c->curve_type = new_type;
- }
- else if (c->curve_type == GTK_CURVE_TYPE_FREE)
- {
- if (c->ctlpoint)
- g_free (c->ctlpoint);
- c->num_ctlpoints = 9;
- c->ctlpoint = g_malloc (c->num_ctlpoints * sizeof (*c->ctlpoint));
-
- rx = 0.0;
- dx = (width - 1) / (gfloat) (c->num_ctlpoints - 1);
-
- for (i = 0; i < c->num_ctlpoints; ++i, rx += dx)
- {
- x = (int) (rx + 0.5);
- c->ctlpoint[i][0] =
- unproject (x, c->min_x, c->max_x, width);
- c->ctlpoint[i][1] =
- unproject (RADIUS + height - c->point[x].y,
- c->min_y, c->max_y, height);
- }
- c->curve_type = new_type;
- gtk_curve_interpolate (c, width, height);
- }
- else
- {
- c->curve_type = new_type;
- gtk_curve_interpolate (c, width, height);
- }
- gtk_signal_emit (GTK_OBJECT (c), curve_type_changed_signal);
- gtk_curve_draw (c, width, height);
- }
-}
-
-static void
-gtk_curve_size_graph (GtkCurve *curve)
-{
- gint width, height;
- gfloat aspect;
-
- width = (curve->max_x - curve->min_x) + 1;
- height = (curve->max_y - curve->min_y) + 1;
- aspect = width / (gfloat) height;
- if (width > gdk_screen_width () / 4)
- width = gdk_screen_width () / 4;
- if (height > gdk_screen_height () / 4)
- height = gdk_screen_height () / 4;
-
- if (aspect < 1.0)
- width = height * aspect;
- else
- height = width / aspect;
-
- gtk_drawing_area_size (GTK_DRAWING_AREA (curve),
- width + RADIUS * 2, height + RADIUS * 2);
-}
-
-static void
-gtk_curve_reset_vector (GtkCurve *curve)
-{
- if (curve->ctlpoint)
- g_free (curve->ctlpoint);
-
- curve->num_ctlpoints = 2;
- curve->ctlpoint = g_malloc (2 * sizeof (curve->ctlpoint[0]));
- curve->ctlpoint[0][0] = curve->min_x;
- curve->ctlpoint[0][1] = curve->min_y;
- curve->ctlpoint[1][0] = curve->max_x;
- curve->ctlpoint[1][1] = curve->max_y;
-
- if (curve->pixmap)
- {
- gint width, height;
-
- width = GTK_WIDGET (curve)->allocation.width - RADIUS * 2;
- height = GTK_WIDGET (curve)->allocation.height - RADIUS * 2;
-
- if (curve->curve_type == GTK_CURVE_TYPE_FREE)
- {
- curve->curve_type = GTK_CURVE_TYPE_LINEAR;
- gtk_curve_interpolate (curve, width, height);
- curve->curve_type = GTK_CURVE_TYPE_FREE;
- }
- else
- gtk_curve_interpolate (curve, width, height);
- gtk_curve_draw (curve, width, height);
- }
-}
-
-void
-gtk_curve_reset (GtkCurve *c)
-{
- GtkCurveType old_type;
-
- old_type = c->curve_type;
- c->curve_type = GTK_CURVE_TYPE_SPLINE;
- gtk_curve_reset_vector (c);
-
- if (old_type != GTK_CURVE_TYPE_SPLINE)
- gtk_signal_emit (GTK_OBJECT (c), curve_type_changed_signal);
-}
-
-void
-gtk_curve_set_gamma (GtkCurve *c, gfloat gamma)
-{
- gfloat x, one_over_gamma, height, one_over_width;
- GtkCurveType old_type;
- gint i;
-
- if (c->num_points < 2)
- return;
-
- old_type = c->curve_type;
- c->curve_type = GTK_CURVE_TYPE_FREE;
-
- if (gamma <= 0)
- one_over_gamma = 1.0;
- else
- one_over_gamma = 1.0 / gamma;
- one_over_width = 1.0 / (c->num_points - 1);
- height = c->height;
- for (i = 0; i < c->num_points; ++i)
- {
- x = (gfloat) i / (c->num_points - 1);
- c->point[i].x = RADIUS + i;
- c->point[i].y =
- RADIUS + (height * (1.0 - pow (x, one_over_gamma)) + 0.5);
- }
-
- if (old_type != GTK_CURVE_TYPE_FREE)
- gtk_signal_emit (GTK_OBJECT (c), curve_type_changed_signal);
-
- gtk_curve_draw (c, c->num_points, c->height);
-}
-
-void
-gtk_curve_set_range (GtkCurve *curve,
- gfloat min_x, gfloat max_x, gfloat min_y, gfloat max_y)
-{
- curve->min_x = min_x;
- curve->max_x = max_x;
- curve->min_y = min_y;
- curve->max_y = max_y;
-
- gtk_curve_size_graph (curve);
- gtk_curve_reset_vector (curve);
-}
-
-void
-gtk_curve_set_vector (GtkCurve *c, int veclen, gfloat vector[])
-{
- GtkCurveType old_type;
- gfloat rx, dx, ry;
- gint i, height;
-
- old_type = c->curve_type;
- c->curve_type = GTK_CURVE_TYPE_FREE;
-
- if (c->point)
- height = GTK_WIDGET (c)->allocation.height - RADIUS * 2;
- else
- {
- height = (c->max_y - c->min_y);
- if (height > gdk_screen_height () / 4)
- height = gdk_screen_height () / 4;
-
- c->height = height;
- c->num_points = veclen;
- c->point = g_malloc (c->num_points * sizeof (c->point[0]));
- }
- rx = 0;
- dx = (veclen - 1.0) / (c->num_points - 1.0);
-
- for (i = 0; i < c->num_points; ++i, rx += dx)
- {
- ry = vector[(int) (rx + 0.5)];
- if (ry > c->max_y) ry = c->max_y;
- if (ry < c->min_y) ry = c->min_y;
- c->point[i].x = RADIUS + i;
- c->point[i].y =
- RADIUS + height - project (ry, c->min_y, c->max_y, height);
- }
- if (old_type != GTK_CURVE_TYPE_FREE)
- gtk_signal_emit (GTK_OBJECT (c), curve_type_changed_signal);
-
- gtk_curve_draw (c, c->num_points, height);
-}
-
-void
-gtk_curve_get_vector (GtkCurve *c, int veclen, gfloat vector[])
-{
- gfloat rx, ry, dx, dy, min_x, delta_x, *mem, *xv, *yv, *y2v, prev;
- gint dst, i, x, next, num_active_ctlpoints = 0, first_active = -1;
-
- min_x = c->min_x;
-
- if (c->curve_type != GTK_CURVE_TYPE_FREE)
- {
- /* count active points: */
- prev = min_x - 1.0;
- for (i = num_active_ctlpoints = 0; i < c->num_ctlpoints; ++i)
- if (c->ctlpoint[i][0] > prev)
- {
- if (first_active < 0)
- first_active = i;
- prev = c->ctlpoint[i][0];
- ++num_active_ctlpoints;
- }
-
- /* handle degenerate case: */
- if (num_active_ctlpoints < 2)
- {
- if (num_active_ctlpoints > 0)
- ry = c->ctlpoint[first_active][1];
- else
- ry = c->min_y;
- if (ry < c->min_y) ry = c->min_y;
- if (ry > c->max_y) ry = c->max_y;
- for (x = 0; x < veclen; ++x)
- vector[x] = ry;
- return;
- }
- }
-
- switch (c->curve_type)
- {
- case GTK_CURVE_TYPE_SPLINE:
- mem = g_malloc (3 * num_active_ctlpoints * sizeof (gfloat));
- xv = mem;
- yv = mem + num_active_ctlpoints;
- y2v = mem + 2*num_active_ctlpoints;
-
- prev = min_x - 1.0;
- for (i = dst = 0; i < c->num_ctlpoints; ++i)
- if (c->ctlpoint[i][0] > prev)
- {
- prev = c->ctlpoint[i][0];
- xv[dst] = c->ctlpoint[i][0];
- yv[dst] = c->ctlpoint[i][1];
- ++dst;
- }
-
- spline_solve (num_active_ctlpoints, xv, yv, y2v);
-
- rx = min_x;
- dx = (c->max_x - min_x) / (veclen - 1);
- for (x = 0; x < veclen; ++x, rx += dx)
- {
- ry = spline_eval (num_active_ctlpoints, xv, yv, y2v, rx);
- if (ry < c->min_y) ry = c->min_y;
- if (ry > c->max_y) ry = c->max_y;
- vector[x] = ry;
- }
-
- g_free (mem);
- break;
-
- case GTK_CURVE_TYPE_LINEAR:
- dx = (c->max_x - min_x) / (veclen - 1);
- rx = min_x;
- ry = c->min_y;
- dy = 0.0;
- i = first_active;
- for (x = 0; x < veclen; ++x, rx += dx)
- {
- if (rx >= c->ctlpoint[i][0])
- {
- if (rx > c->ctlpoint[i][0])
- ry = c->min_y;
- dy = 0.0;
- next = i + 1;
- while (next < c->num_ctlpoints
- && c->ctlpoint[next][0] <= c->ctlpoint[i][0])
- ++next;
- if (next < c->num_ctlpoints)
- {
- delta_x = c->ctlpoint[next][0] - c->ctlpoint[i][0];
- dy = ((c->ctlpoint[next][1] - c->ctlpoint[i][1])
- / delta_x);
- dy *= dx;
- ry = c->ctlpoint[i][1];
- i = next;
- }
- }
- vector[x] = ry;
- ry += dy;
- }
- break;
-
- case GTK_CURVE_TYPE_FREE:
- if (c->point)
- {
- rx = 0.0;
- dx = c->num_points / (double) veclen;
- for (x = 0; x < veclen; ++x, rx += dx)
- vector[x] = unproject (RADIUS + c->height - c->point[(int) rx].y,
- c->min_y, c->max_y,
- c->height);
- }
- else
- memset (vector, 0, veclen * sizeof (vector[0]));
- break;
- }
-}
-
-GtkWidget*
-gtk_curve_new (void)
-{
- GtkCurve *curve;
- gint old_mask;
-
- curve = gtk_type_new (gtk_curve_get_type ());
- curve->min_x = 0.0;
- curve->max_x = 1.0;
- curve->min_y = 0.0;
- curve->max_y = 1.0;
-
- old_mask = gtk_widget_get_events (GTK_WIDGET (curve));
- gtk_widget_set_events (GTK_WIDGET (curve), old_mask | GRAPH_MASK);
- gtk_signal_connect (GTK_OBJECT (curve), "event",
- (GtkSignalFunc) gtk_curve_graph_events, curve);
- gtk_curve_size_graph (curve);
-
- return GTK_WIDGET (curve);
-}
-
-static void
-gtk_curve_finalize (GtkObject *object)
-{
- GtkCurve *curve;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_CURVE (object));
-
- curve = GTK_CURVE (object);
- if (curve->pixmap)
- gdk_pixmap_unref (curve->pixmap);
- if (curve->point)
- g_free (curve->point);
- if (curve->ctlpoint)
- g_free (curve->ctlpoint);
-
- (*GTK_OBJECT_CLASS (parent_class)->finalize) (object);
-}
diff --git a/gtk/gtkcurve.h b/gtk/gtkcurve.h
deleted file mode 100644
index 0e1568bc74..0000000000
--- a/gtk/gtkcurve.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_CURVE_H__
-#define __GTK_CURVE_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkdrawingarea.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_CURVE(obj) GTK_CHECK_CAST (obj, gtk_curve_get_type (), GtkCurve)
-#define GTK_CURVE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_curve_get_type, GtkCurveClass)
-#define GTK_IS_CURVE(obj) GTK_CHECK_TYPE (obj, gtk_curve_get_type ())
-
-
-typedef struct _GtkCurve GtkCurve;
-typedef struct _GtkCurveClass GtkCurveClass;
-
-typedef enum
-{
- GTK_CURVE_TYPE_LINEAR, /* linear interpolation */
- GTK_CURVE_TYPE_SPLINE, /* spline interpolation */
- GTK_CURVE_TYPE_FREE /* free form curve */
-} GtkCurveType;
-
-struct _GtkCurve
-{
- GtkDrawingArea graph;
-
- gint cursor_type;
- gfloat min_x;
- gfloat max_x;
- gfloat min_y;
- gfloat max_y;
- GdkPixmap *pixmap;
- GtkCurveType curve_type;
- gint height; /* (cached) graph height in pixels */
- gint grab_point; /* point currently grabbed */
- gint last;
-
- /* (cached) curve points: */
- gint num_points;
- GdkPoint *point;
-
- /* control points: */
- gint num_ctlpoints; /* number of control points */
- gfloat (*ctlpoint)[2]; /* array of control points */
-};
-
-struct _GtkCurveClass
-{
- GtkDrawingAreaClass parent_class;
-
- void (* curve_type_changed) (GtkCurve *curve);
-};
-
-
-guint gtk_curve_get_type (void);
-GtkWidget* gtk_curve_new (void);
-void gtk_curve_reset (GtkCurve *curve);
-void gtk_curve_set_gamma (GtkCurve *curve, gfloat gamma);
-void gtk_curve_set_range (GtkCurve *curve,
- gfloat min_x, gfloat max_x,
- gfloat min_y, gfloat max_y);
-void gtk_curve_get_vector (GtkCurve *curve,
- int veclen, gfloat vector[]);
-void gtk_curve_set_vector (GtkCurve *curve,
- int veclen, gfloat vector[]);
-void gtk_curve_set_curve_type (GtkCurve *curve, GtkCurveType type);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_CURVE_H__ */
diff --git a/gtk/gtkdata.c b/gtk/gtkdata.c
deleted file mode 100644
index 4af9a1a8e7..0000000000
--- a/gtk/gtkdata.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkdata.h"
-#include "gtksignal.h"
-
-
-enum {
- DISCONNECT,
- LAST_SIGNAL
-};
-
-
-static void gtk_data_class_init (GtkDataClass *klass);
-
-
-static guint data_signals[LAST_SIGNAL] = { 0 };
-
-
-guint
-gtk_data_get_type ()
-{
- static guint data_type = 0;
-
- if (!data_type)
- {
- GtkTypeInfo data_info =
- {
- "GtkData",
- sizeof (GtkData),
- sizeof (GtkDataClass),
- (GtkClassInitFunc) gtk_data_class_init,
- (GtkObjectInitFunc) NULL,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- data_type = gtk_type_unique (gtk_object_get_type (), &data_info);
- }
-
- return data_type;
-}
-
-static void
-gtk_data_class_init (GtkDataClass *class)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass*) class;
-
- data_signals[DISCONNECT] =
- gtk_signal_new ("disconnect",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkDataClass, disconnect),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, data_signals, LAST_SIGNAL);
-}
diff --git a/gtk/gtkdata.h b/gtk/gtkdata.h
deleted file mode 100644
index 2e9d30b315..0000000000
--- a/gtk/gtkdata.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_DATA_H__
-#define __GTK_DATA_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkobject.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_DATA(obj) GTK_CHECK_CAST (obj, gtk_data_get_type (), GtkData)
-#define GTK_DATA_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_data_get_type (), GtkDataClass)
-#define GTK_IS_DATA(obj) GTK_CHECK_TYPE (obj, gtk_data_get_type ())
-
-
-typedef struct _GtkData GtkData;
-typedef struct _GtkDataClass GtkDataClass;
-
-struct _GtkData
-{
- GtkObject object;
-};
-
-struct _GtkDataClass
-{
- GtkObjectClass parent_class;
-
- void (* disconnect) (GtkData *data);
-};
-
-
-guint gtk_data_get_type (void);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_DATA_H__ */
diff --git a/gtk/gtkdebug.h b/gtk/gtkdebug.h
deleted file mode 100644
index 3940f8f1f0..0000000000
--- a/gtk/gtkdebug.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_DEBUG_H__
-#define __GTK_DEBUG_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-typedef enum {
- GTK_DEBUG_OBJECTS = 1<<0
-} GtkDebugFlag;
-
-#ifdef G_ENABLE_DEBUG
-
-#define GTK_NOTE(type,action) G_STMT_START { \
- if (gtk_debug_flags & GTK_DEBUG_##type) \
- { action; }; } G_STMT_END
-
-#else /* !G_ENABLE_DEBUG */
-
-#define GTK_NOTE
-
-#endif /* G_ENABLE_DEBUG */
-
-extern guint gtk_debug_flags;
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_DEBUG_H__ */
diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c
deleted file mode 100644
index 693611cf2b..0000000000
--- a/gtk/gtkdialog.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkbutton.h"
-#include "gtkdialog.h"
-#include "gtkhbox.h"
-#include "gtkhseparator.h"
-#include "gtkvbox.h"
-
-
-static void gtk_dialog_class_init (GtkDialogClass *klass);
-static void gtk_dialog_init (GtkDialog *dialog);
-
-
-guint
-gtk_dialog_get_type ()
-{
- static guint dialog_type = 0;
-
- if (!dialog_type)
- {
- GtkTypeInfo dialog_info =
- {
- "GtkDialog",
- sizeof (GtkDialog),
- sizeof (GtkDialogClass),
- (GtkClassInitFunc) gtk_dialog_class_init,
- (GtkObjectInitFunc) gtk_dialog_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- dialog_type = gtk_type_unique (gtk_window_get_type (), &dialog_info);
- }
-
- return dialog_type;
-}
-
-static void
-gtk_dialog_class_init (GtkDialogClass *class)
-{
-}
-
-static void
-gtk_dialog_init (GtkDialog *dialog)
-{
- GtkWidget *separator;
-
- dialog->vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (dialog), dialog->vbox);
- gtk_widget_show (dialog->vbox);
-
- dialog->action_area = gtk_hbox_new (TRUE, 5);
- gtk_container_border_width (GTK_CONTAINER (dialog->action_area), 10);
- gtk_box_pack_end (GTK_BOX (dialog->vbox), dialog->action_area, FALSE, TRUE, 0);
- gtk_widget_show (dialog->action_area);
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_end (GTK_BOX (dialog->vbox), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-}
-
-GtkWidget*
-gtk_dialog_new ()
-{
- return GTK_WIDGET (gtk_type_new (gtk_dialog_get_type ()));
-}
diff --git a/gtk/gtkdialog.h b/gtk/gtkdialog.h
deleted file mode 100644
index 139699682b..0000000000
--- a/gtk/gtkdialog.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_DIALOG_H__
-#define __GTK_DIALOG_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkwindow.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_DIALOG(obj) GTK_CHECK_CAST (obj, gtk_dialog_get_type (), GtkDialog)
-#define GTK_DIALOG_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_dialog_get_type (), GtkDialogClass)
-#define GTK_IS_DIALOG(obj) GTK_CHECK_TYPE (obj, gtk_dialog_get_type ())
-
-
-typedef struct _GtkDialog GtkDialog;
-typedef struct _GtkDialogClass GtkDialogClass;
-typedef struct _GtkDialogButton GtkDialogButton;
-
-
-struct _GtkDialog
-{
- GtkWindow window;
-
- GtkWidget *vbox;
- GtkWidget *action_area;
-};
-
-struct _GtkDialogClass
-{
- GtkWindowClass parent_class;
-};
-
-
-guint gtk_dialog_get_type (void);
-GtkWidget* gtk_dialog_new (void);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_DIALOG_H__ */
diff --git a/gtk/gtkdrawingarea.c b/gtk/gtkdrawingarea.c
deleted file mode 100644
index 8fdb23b0f7..0000000000
--- a/gtk/gtkdrawingarea.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkdrawingarea.h"
-
-
-static void gtk_drawing_area_class_init (GtkDrawingAreaClass *klass);
-static void gtk_drawing_area_init (GtkDrawingArea *darea);
-static void gtk_drawing_area_realize (GtkWidget *widget);
-static void gtk_drawing_area_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-
-
-guint
-gtk_drawing_area_get_type ()
-{
- static guint drawing_area_type = 0;
-
- if (!drawing_area_type)
- {
- GtkTypeInfo drawing_area_info =
- {
- "GtkDrawingArea",
- sizeof (GtkDrawingArea),
- sizeof (GtkDrawingAreaClass),
- (GtkClassInitFunc) gtk_drawing_area_class_init,
- (GtkObjectInitFunc) gtk_drawing_area_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- drawing_area_type = gtk_type_unique (gtk_widget_get_type (), &drawing_area_info);
- }
-
- return drawing_area_type;
-}
-
-static void
-gtk_drawing_area_class_init (GtkDrawingAreaClass *class)
-{
- GtkWidgetClass *widget_class;
-
- widget_class = (GtkWidgetClass*) class;
-
- widget_class->realize = gtk_drawing_area_realize;
- widget_class->size_allocate = gtk_drawing_area_size_allocate;
-}
-
-static void
-gtk_drawing_area_init (GtkDrawingArea *darea)
-{
- GTK_WIDGET_SET_FLAGS (darea, GTK_BASIC);
-
- darea->draw_data = NULL;
-}
-
-
-GtkWidget*
-gtk_drawing_area_new ()
-{
- return GTK_WIDGET (gtk_type_new (gtk_drawing_area_get_type ()));
-}
-
-void
-gtk_drawing_area_size (GtkDrawingArea *darea,
- gint width,
- gint height)
-{
- g_return_if_fail (darea != NULL);
- g_return_if_fail (GTK_IS_DRAWING_AREA (darea));
-
- GTK_WIDGET (darea)->requisition.width = width;
- GTK_WIDGET (darea)->requisition.height = height;
-}
-
-static void
-gtk_drawing_area_realize (GtkWidget *widget)
-{
- GtkDrawingArea *darea;
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_DRAWING_AREA (widget));
-
- darea = GTK_DRAWING_AREA (widget);
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget);
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, darea);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
-}
-
-static void
-gtk_drawing_area_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GdkEventConfigure event;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_DRAWING_AREA (widget));
- g_return_if_fail (allocation != NULL);
-
- widget->allocation = *allocation;
-
- if (GTK_WIDGET_REALIZED (widget))
- {
- gdk_window_move_resize (widget->window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
-
- event.type = GDK_CONFIGURE;
- event.window = widget->window;
- event.x = allocation->x;
- event.y = allocation->y;
- event.width = allocation->width;
- event.height = allocation->height;
-
- gtk_widget_event (widget, (GdkEvent*) &event);
- }
-}
diff --git a/gtk/gtkdrawingarea.h b/gtk/gtkdrawingarea.h
deleted file mode 100644
index 9e5431878a..0000000000
--- a/gtk/gtkdrawingarea.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_DRAWING_AREA_H__
-#define __GTK_DRAWING_AREA_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkwidget.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_DRAWING_AREA(obj) GTK_CHECK_CAST (obj, gtk_drawing_area_get_type (), GtkDrawingArea)
-#define GTK_DRAWING_AREA_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_drawing_area_get_type (), GtkDrawingAreaClass)
-#define GTK_IS_DRAWING_AREA(obj) GTK_CHECK_TYPE (obj, gtk_drawing_area_get_type ())
-
-
-typedef struct _GtkDrawingArea GtkDrawingArea;
-typedef struct _GtkDrawingAreaClass GtkDrawingAreaClass;
-
-struct _GtkDrawingArea
-{
- GtkWidget widget;
-
- gpointer draw_data;
-};
-
-struct _GtkDrawingAreaClass
-{
- GtkWidgetClass parent_class;
-};
-
-
-guint gtk_drawing_area_get_type (void);
-GtkWidget* gtk_drawing_area_new (void);
-void gtk_drawing_area_size (GtkDrawingArea *darea,
- gint width,
- gint height);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_DRAWING_AREA_H__ */
diff --git a/gtk/gtkeditable.c b/gtk/gtkeditable.c
index 81cc887a3e..8702e69fbc 100644
--- a/gtk/gtkeditable.c
+++ b/gtk/gtkeditable.c
@@ -298,7 +298,8 @@ gtk_editable_selection_clear (GtkWidget *widget,
/* Let the selection handling code know that the selection
* has been changed, since we've overriden the default handler */
- gtk_selection_clear (widget, event);
+ if (!gtk_selection_clear (widget, event))
+ return FALSE;
editable = GTK_EDITABLE (widget);
@@ -317,7 +318,7 @@ gtk_editable_selection_clear (GtkWidget *widget,
editable->clipboard_text = NULL;
}
- return FALSE;
+ return TRUE;
}
static void
diff --git a/gtk/gtkeditable.h b/gtk/gtkeditable.h
deleted file mode 100644
index a2fd4a1b68..0000000000
--- a/gtk/gtkeditable.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_EDITABLE_H__
-#define __GTK_EDITABLE_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkwidget.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_EDITABLE(obj) GTK_CHECK_CAST (obj, gtk_editable_get_type (), GtkEditable)
-#define GTK_EDITABLE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_editable_get_type (), GtkEditableClass)
-#define GTK_IS_EDITABLE(obj) GTK_CHECK_TYPE (obj, gtk_editable_get_type ())
-
-
-typedef struct _GtkEditable GtkEditable;
-typedef struct _GtkEditableClass GtkEditableClass;
-
-typedef void (*GtkTextFunction) (GtkEditable *editable, guint32 time);
-
-struct _GtkEditable
-{
- GtkWidget widget;
-
- guint current_pos;
-
- guint selection_start_pos;
- guint selection_end_pos;
- guint has_selection : 1;
- guint editable : 1;
- GdkIC ic;
-
- gchar *clipboard_text;
-};
-
-struct _GtkEditableClass
-{
- GtkWidgetClass parent_class;
-
- void (* insert_text) (GtkEditable *editable,
- const gchar *text,
- gint length,
- gint *position);
- void (* delete_text) (GtkEditable *editable,
- gint start_pos,
- gint end_pos);
- void (* update_text) (GtkEditable *editable,
- gint start_pos,
- gint end_pos);
- gchar* (* get_chars) (GtkEditable *editable,
- gint start_pos,
- gint end_pos);
- void (* set_selection)(GtkEditable *editable,
- gint start_pos,
- gint end_pos);
- void (* activate) (GtkEditable *editable);
- void (* changed) (GtkEditable *editable);
-};
-
-guint gtk_editable_get_type (void);
-void gtk_editable_select_region (GtkEditable *editable,
- gint start,
- gint end);
-void gtk_editable_insert_text (GtkEditable *editable,
- const gchar *new_text,
- gint new_text_length,
- gint *position);
-void gtk_editable_delete_text (GtkEditable *editable,
- gint start_pos,
- gint end_pos);
-gchar * gtk_editable_get_chars (GtkEditable *editable,
- gint start_pos,
- gint end_pos);
-void gtk_editable_cut_clipboard (GtkEditable *editable,
- guint32 time);
-void gtk_editable_copy_clipboard (GtkEditable *editable,
- guint32 time);
-void gtk_editable_paste_clipboard (GtkEditable *editable,
- guint32 time);
-void gtk_editable_claim_selection (GtkEditable *editable,
- gboolean claim,
- guint32 time);
-void gtk_editable_delete_selection (GtkEditable *editable);
-
-void gtk_editable_changed (GtkEditable *editable);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_EDITABLE_H__ */
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 70c68003e9..8c77386d1f 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -97,8 +97,10 @@ static void gtk_delete_forward_word (GtkEntry *entry);
static void gtk_delete_backward_word (GtkEntry *entry);
static void gtk_delete_line (GtkEntry *entry);
static void gtk_delete_to_line_end (GtkEntry *entry);
-static void gtk_select_word (GtkEntry *entry);
-static void gtk_select_line (GtkEntry *entry);
+static void gtk_select_word (GtkEntry *entry,
+ guint32 time);
+static void gtk_select_line (GtkEntry *entry,
+ guint32 time);
static void gtk_entry_set_selection (GtkEditable *editable,
@@ -705,7 +707,7 @@ gtk_entry_button_press (GtkWidget *widget,
entry = GTK_ENTRY (widget);
editable = GTK_EDITABLE (widget);
- if (entry->button)
+ if (entry->button && (event->type == GDK_BUTTON_PRESS))
{
GdkEventButton release_event = *event;
@@ -736,11 +738,11 @@ gtk_entry_button_press (GtkWidget *widget,
break;
case GDK_2BUTTON_PRESS:
- gtk_select_word (entry);
+ gtk_select_word (entry, event->time);
break;
case GDK_3BUTTON_PRESS:
- gtk_select_line (entry);
+ gtk_select_line (entry, event->time);
break;
default:
@@ -1424,9 +1426,12 @@ gtk_entry_insert_text (GtkEditable *editable,
new_text_length = entry->text_max_length - entry->text_length;
/* Don't insert anything, if there was nothing to insert. */
- if (new_text_length <= 0)
+ if (new_text_length == 0)
return;
+ if (new_text_length < 0)
+ new_text_length = strlen (new_text);
+
start_pos = *position;
end_pos = start_pos + new_text_length;
last_pos = new_text_length + entry->text_length;
@@ -1523,14 +1528,19 @@ gtk_entry_get_chars (GtkEditable *editable,
start_pos = MIN(entry->text_length, start_pos);
end_pos = MIN(entry->text_length, end_pos);
- c = entry->text[end_pos];
- entry->text[end_pos] = '\0';
-
- retval = g_strdup (&entry->text[start_pos]);
-
- entry->text[end_pos] = c;
-
- return retval;
+ if (start_pos <= end_pos)
+ {
+ c = entry->text[end_pos];
+ entry->text[end_pos] = '\0';
+
+ retval = g_strdup (&entry->text[start_pos]);
+
+ entry->text[end_pos] = c;
+
+ return retval;
+ }
+ else
+ return NULL;
}
static void
@@ -1767,7 +1777,7 @@ gtk_delete_to_line_end (GtkEntry *entry)
}
static void
-gtk_select_word (GtkEntry *entry)
+gtk_select_word (GtkEntry *entry, guint32 time)
{
gint start_pos;
gint end_pos;
@@ -1781,16 +1791,21 @@ gtk_select_word (GtkEntry *entry)
gtk_move_forward_word (entry);
end_pos = editable->current_pos;
+ editable->has_selection = TRUE;
gtk_entry_set_selection (editable, start_pos, end_pos);
+ gtk_editable_claim_selection (editable, start_pos != end_pos, time);
}
static void
-gtk_select_line (GtkEntry *entry)
+gtk_select_line (GtkEntry *entry, guint32 time)
{
GtkEditable *editable;
editable = GTK_EDITABLE (entry);
+ editable->has_selection = TRUE;
gtk_entry_set_selection (editable, 0, entry->text_length);
+ gtk_editable_claim_selection (editable, entry->text_length != 0, time);
+
editable->current_pos = editable->selection_end_pos;
}
diff --git a/gtk/gtkentry.h b/gtk/gtkentry.h
deleted file mode 100644
index 5974934ebd..0000000000
--- a/gtk/gtkentry.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_ENTRY_H__
-#define __GTK_ENTRY_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkeditable.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_ENTRY(obj) GTK_CHECK_CAST (obj, gtk_entry_get_type (), GtkEntry)
-#define GTK_ENTRY_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_entry_get_type (), GtkEntryClass)
-#define GTK_IS_ENTRY(obj) GTK_CHECK_TYPE (obj, gtk_entry_get_type ())
-
-
-typedef struct _GtkEntry GtkEntry;
-typedef struct _GtkEntryClass GtkEntryClass;
-
-struct _GtkEntry
-{
- GtkEditable editable;
-
- GdkWindow *text_area;
- GdkPixmap *backing_pixmap;
- GdkCursor *cursor;
- gchar *text;
-
- guint16 text_size;
- guint16 text_length;
- guint16 text_max_length;
- gint16 scroll_offset;
- guint visible : 1;
- guint32 timer;
- guint button;
-};
-
-struct _GtkEntryClass
-{
- GtkEditableClass parent_class;
-};
-
-guint gtk_entry_get_type (void);
-GtkWidget* gtk_entry_new (void);
-GtkWidget* gtk_entry_new_with_max_length (guint16 max);
-void gtk_entry_set_text (GtkEntry *entry,
- const gchar *text);
-void gtk_entry_append_text (GtkEntry *entry,
- const gchar *text);
-void gtk_entry_prepend_text (GtkEntry *entry,
- const gchar *text);
-void gtk_entry_set_position (GtkEntry *entry,
- gint position);
-gchar* gtk_entry_get_text (GtkEntry *entry);
-void gtk_entry_select_region (GtkEntry *entry,
- gint start,
- gint end);
-void gtk_entry_set_visibility (GtkEntry *entry,
- gboolean visible);
-void gtk_entry_set_editable (GtkEntry *entry,
- gboolean editable);
-
-/* If entry->text is already > max it's up to you to change it */
-void gtk_entry_set_max_length (GtkEntry *entry,
- guint16 max);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_ENTRY_H__ */
diff --git a/gtk/gtkenums.h b/gtk/gtkenums.h
deleted file mode 100644
index 357fec1320..0000000000
--- a/gtk/gtkenums.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_ENUMS_H__
-#define __GTK_ENUMS_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/* Widget states */
-typedef enum
-{
- GTK_STATE_NORMAL,
- GTK_STATE_ACTIVE,
- GTK_STATE_PRELIGHT,
- GTK_STATE_SELECTED,
- GTK_STATE_INSENSITIVE
-} GtkStateType;
-
-/* Window types */
-typedef enum
-{
- GTK_WINDOW_TOPLEVEL,
- GTK_WINDOW_DIALOG,
- GTK_WINDOW_POPUP
-} GtkWindowType;
-
-/* Focus movement types */
-typedef enum
-{
- GTK_DIR_TAB_FORWARD,
- GTK_DIR_TAB_BACKWARD,
- GTK_DIR_UP,
- GTK_DIR_DOWN,
- GTK_DIR_LEFT,
- GTK_DIR_RIGHT
-} GtkDirectionType;
-
-/* Shadow types */
-typedef enum
-{
- GTK_SHADOW_NONE,
- GTK_SHADOW_IN,
- GTK_SHADOW_OUT,
- GTK_SHADOW_ETCHED_IN,
- GTK_SHADOW_ETCHED_OUT
-} GtkShadowType;
-
-/* Arrow types */
-typedef enum
-{
- GTK_ARROW_UP,
- GTK_ARROW_DOWN,
- GTK_ARROW_LEFT,
- GTK_ARROW_RIGHT
-} GtkArrowType;
-
-/* Packing types (for boxes) */
-typedef enum
-{
- GTK_PACK_START,
- GTK_PACK_END
-} GtkPackType;
-
-/* Scrollbar policy types (for scrolled windows) */
-typedef enum
-{
- GTK_POLICY_ALWAYS,
- GTK_POLICY_AUTOMATIC
-} GtkPolicyType;
-
-/* Data update types (for ranges) */
-typedef enum
-{
- GTK_UPDATE_CONTINUOUS,
- GTK_UPDATE_DISCONTINUOUS,
- GTK_UPDATE_DELAYED
-} GtkUpdateType;
-
-/* Attach options (for tables) */
-typedef enum
-{
- GTK_EXPAND = 1 << 0,
- GTK_SHRINK = 1 << 1,
- GTK_FILL = 1 << 2
-} GtkAttachOptions;
-
-typedef enum
-{
- GTK_RUN_FIRST = 0x1,
- GTK_RUN_LAST = 0x2,
- GTK_RUN_BOTH = 0x3,
- GTK_RUN_MASK = 0xF,
- GTK_RUN_NO_RECURSE = 0x10
-} GtkSignalRunType;
-
-typedef enum
-{
- GTK_WIN_POS_NONE,
- GTK_WIN_POS_CENTER,
- GTK_WIN_POS_MOUSE
-} GtkWindowPosition;
-
-typedef enum
-{
- GTK_DIRECTION_LEFT,
- GTK_DIRECTION_RIGHT
-} GtkSubmenuDirection;
-
-typedef enum
-{
- GTK_TOP_BOTTOM,
- GTK_LEFT_RIGHT
-} GtkSubmenuPlacement;
-
-typedef enum
-{
- GTK_MENU_FACTORY_MENU,
- GTK_MENU_FACTORY_MENU_BAR,
- GTK_MENU_FACTORY_OPTION_MENU
-} GtkMenuFactoryType;
-
-typedef enum
-{
- GTK_PIXELS,
- GTK_INCHES,
- GTK_CENTIMETERS
-} GtkMetricType;
-
-typedef enum
-{
- GTK_SCROLL_NONE,
- GTK_SCROLL_STEP_BACKWARD,
- GTK_SCROLL_STEP_FORWARD,
- GTK_SCROLL_PAGE_BACKWARD,
- GTK_SCROLL_PAGE_FORWARD,
- GTK_SCROLL_JUMP
-} GtkScrollType;
-
-typedef enum
-{
- GTK_TROUGH_NONE,
- GTK_TROUGH_START,
- GTK_TROUGH_END,
- GTK_TROUGH_JUMP
-} GtkTroughType;
-
-typedef enum
-{
- GTK_POS_LEFT,
- GTK_POS_RIGHT,
- GTK_POS_TOP,
- GTK_POS_BOTTOM
-} GtkPositionType;
-
-typedef enum
-{
- GTK_PREVIEW_COLOR,
- GTK_PREVIEW_GRAYSCALE
-} GtkPreviewType;
-
-/* justification for label and maybe other widgets (text?) */
-typedef enum
-{
- GTK_JUSTIFY_LEFT,
- GTK_JUSTIFY_RIGHT,
- GTK_JUSTIFY_CENTER,
- GTK_JUSTIFY_FILL
-} GtkJustification;
-
-/* list selection modes */
-typedef enum
-{
- GTK_SELECTION_SINGLE,
- GTK_SELECTION_BROWSE,
- GTK_SELECTION_MULTIPLE,
- GTK_SELECTION_EXTENDED
-} GtkSelectionMode;
-
-/* Orientation for toolbars, etc. */
-typedef enum
-{
- GTK_ORIENTATION_HORIZONTAL,
- GTK_ORIENTATION_VERTICAL
-} GtkOrientation;
-
-/* Style for toolbars */
-typedef enum
-{
- GTK_TOOLBAR_ICONS,
- GTK_TOOLBAR_TEXT,
- GTK_TOOLBAR_BOTH
-} GtkToolbarStyle;
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_ENUMS_H__ */
diff --git a/gtk/gtkeventbox.c b/gtk/gtkeventbox.c
deleted file mode 100644
index ac9d8746da..0000000000
--- a/gtk/gtkeventbox.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtksignal.h"
-#include "gtkeventbox.h"
-
-
-static void gtk_event_box_class_init (GtkEventBoxClass *klass);
-static void gtk_event_box_init (GtkEventBox *event_box);
-static void gtk_event_box_realize (GtkWidget *widget);
-static void gtk_event_box_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_event_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_event_box_draw (GtkWidget *widget,
- GdkRectangle *area);
-static gint gtk_event_box_expose (GtkWidget *widget,
- GdkEventExpose *event);
-
-
-guint
-gtk_event_box_get_type ()
-{
- static guint event_box_type = 0;
-
- if (!event_box_type)
- {
- GtkTypeInfo event_box_info =
- {
- "GtkEventBox",
- sizeof (GtkEventBox),
- sizeof (GtkEventBoxClass),
- (GtkClassInitFunc) gtk_event_box_class_init,
- (GtkObjectInitFunc) gtk_event_box_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- event_box_type = gtk_type_unique (gtk_bin_get_type (), &event_box_info);
- }
-
- return event_box_type;
-}
-
-static void
-gtk_event_box_class_init (GtkEventBoxClass *class)
-{
- GtkWidgetClass *widget_class;
-
- widget_class = (GtkWidgetClass*) class;
-
- widget_class->realize = gtk_event_box_realize;
- widget_class->size_request = gtk_event_box_size_request;
- widget_class->size_allocate = gtk_event_box_size_allocate;
- widget_class->draw = gtk_event_box_draw;
- widget_class->expose_event = gtk_event_box_expose;
-}
-
-static void
-gtk_event_box_init (GtkEventBox *event_box)
-{
- GTK_WIDGET_UNSET_FLAGS (event_box, GTK_NO_WINDOW);
- GTK_WIDGET_SET_FLAGS (event_box, GTK_BASIC);
-}
-
-GtkWidget*
-gtk_event_box_new ()
-{
- return GTK_WIDGET ( gtk_type_new (gtk_event_box_get_type ()));
-}
-
-static void
-gtk_event_box_realize (GtkWidget *widget)
-{
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_EVENT_BOX (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget)
- | GDK_BUTTON_MOTION_MASK
- | GDK_BUTTON_PRESS_MASK
- | GDK_BUTTON_RELEASE_MASK
- | GDK_EXPOSURE_MASK
- | GDK_ENTER_NOTIFY_MASK
- | GDK_LEAVE_NOTIFY_MASK;
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
-}
-
-static void
-gtk_event_box_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkBin *bin;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_EVENT_BOX (widget));
- g_return_if_fail (requisition != NULL);
-
- bin = GTK_BIN (widget);
-
- requisition->width = GTK_CONTAINER (widget)->border_width * 2;
- requisition->height = GTK_CONTAINER (widget)->border_width * 2;
-
- if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
- {
- gtk_widget_size_request (bin->child, &bin->child->requisition);
-
- requisition->width += bin->child->requisition.width;
- requisition->height += bin->child->requisition.height;
- }
-}
-
-static void
-gtk_event_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkBin *bin;
- GtkAllocation child_allocation;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_EVENT_BOX (widget));
- g_return_if_fail (allocation != NULL);
-
- widget->allocation = *allocation;
- bin = GTK_BIN (widget);
-
- child_allocation.x = 0;
- child_allocation.y = 0;
- child_allocation.width = allocation->width - GTK_CONTAINER (widget)->border_width * 2;
- child_allocation.height = allocation->height - GTK_CONTAINER (widget)->border_width * 2;
-
- if (GTK_WIDGET_REALIZED (widget))
- {
- gdk_window_move_resize (widget->window,
- allocation->x + GTK_CONTAINER (widget)->border_width,
- allocation->y + GTK_CONTAINER (widget)->border_width,
- child_allocation.width,
- child_allocation.height);
- }
-
- if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
- {
- gtk_widget_size_allocate (bin->child, &child_allocation);
- }
-}
-
-static void
-gtk_event_box_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkBin *bin;
- GdkRectangle child_area;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_EVENT_BOX (widget));
- g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- bin = GTK_BIN (widget);
-
- if (bin->child)
- {
- if (gtk_widget_intersect (bin->child, area, &child_area))
- gtk_widget_draw (bin->child, &child_area);
- }
- }
-}
-
-static gint
-gtk_event_box_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkBin *bin;
- GdkEventExpose child_event;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_EVENT_BOX (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- bin = GTK_BIN (widget);
-
- child_event = *event;
- if (bin->child &&
- GTK_WIDGET_NO_WINDOW (bin->child) &&
- gtk_widget_intersect (bin->child, &event->area, &child_event.area))
- gtk_widget_event (bin->child, (GdkEvent*) &child_event);
- }
-
- return FALSE;
-}
-
diff --git a/gtk/gtkeventbox.h b/gtk/gtkeventbox.h
deleted file mode 100644
index d90213dee3..0000000000
--- a/gtk/gtkeventbox.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_EVENT_BOX_H__
-#define __GTK_EVENT_BOX_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkbin.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_EVENT_BOX(obj) GTK_CHECK_CAST (obj, gtk_event_box_get_type (), GtkEventBox)
-#define GTK_EVENT_BOX_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_event_box_get_type (), GtkEventBoxClass)
-#define GTK_IS_EVENT_BOX(obj) GTK_CHECK_TYPE (obj, gtk_event_box_get_type ())
-
-
-typedef struct _GtkEventBox GtkEventBox;
-typedef struct _GtkEventBoxClass GtkEventBoxClass;
-
-struct _GtkEventBox
-{
- GtkBin bin;
-};
-
-struct _GtkEventBoxClass
-{
- GtkBinClass parent_class;
-};
-
-guint gtk_event_box_get_type (void);
-GtkWidget* gtk_event_box_new (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_EVENT_BOX_H__ */
diff --git a/gtk/gtkfilesel.c b/gtk/gtkfilesel.c
deleted file mode 100644
index 0d1e4767be..0000000000
--- a/gtk/gtkfilesel.c
+++ /dev/null
@@ -1,2571 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/param.h>
-#include <dirent.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <pwd.h>
-#include "fnmatch.h"
-
-#include "gdk/gdkkeysyms.h"
-#include "gtkbutton.h"
-#include "gtkentry.h"
-#include "gtkfilesel.h"
-#include "gtkhbox.h"
-#include "gtklabel.h"
-#include "gtklist.h"
-#include "gtklistitem.h"
-#include "gtkmain.h"
-#include "gtkscrolledwindow.h"
-#include "gtksignal.h"
-#include "gtkvbox.h"
-#include "gtkmenu.h"
-#include "gtkmenuitem.h"
-#include "gtkoptionmenu.h"
-#include "gtkclist.h"
-#include "gtkdialog.h"
-
-#define DIR_LIST_WIDTH 180
-#define DIR_LIST_HEIGHT 180
-#define FILE_LIST_WIDTH 180
-#define FILE_LIST_HEIGHT 180
-
-/* I've put this here so it doesn't get confused with the
- * file completion interface */
-typedef struct _HistoryCallbackArg HistoryCallbackArg;
-
-struct _HistoryCallbackArg
-{
- gchar *directory;
- GtkWidget *menu_item;
-};
-
-
-typedef struct _CompletionState CompletionState;
-typedef struct _CompletionDir CompletionDir;
-typedef struct _CompletionDirSent CompletionDirSent;
-typedef struct _CompletionDirEntry CompletionDirEntry;
-typedef struct _CompletionUserDir CompletionUserDir;
-typedef struct _PossibleCompletion PossibleCompletion;
-
-/* Non-external file completion decls and structures */
-
-/* A contant telling PRCS how many directories to cache. Its actually
- * kept in a list, so the geometry isn't important. */
-#define CMPL_DIRECTORY_CACHE_SIZE 10
-
-/* A constant used to determine whether a substring was an exact
- * match by first_diff_index()
- */
-#define PATTERN_MATCH -1
-/* The arguments used by all fnmatch() calls below
- */
-#define FNMATCH_FLAGS (FNM_PATHNAME | FNM_PERIOD)
-
-#define CMPL_ERRNO_TOO_LONG ((1<<16)-1)
-
-/* This structure contains all the useful information about a directory
- * for the purposes of filename completion. These structures are cached
- * in the CompletionState struct. CompletionDir's are reference counted.
- */
-struct _CompletionDirSent
-{
- ino_t inode;
- time_t mtime;
-
- gint entry_count;
- gchar *name_buffer; /* memory segment containing names of all entries */
-
- struct _CompletionDirEntry *entries;
-};
-
-struct _CompletionDir
-{
- CompletionDirSent *sent;
-
- gchar *fullname;
- gint fullname_len;
-
- struct _CompletionDir *cmpl_parent;
- gint cmpl_index;
- gchar *cmpl_text;
-};
-
-/* This structure contains pairs of directory entry names with a flag saying
- * whether or not they are a valid directory. NOTE: This information is used
- * to provide the caller with information about whether to update its completions
- * or try to open a file. Since directories are cached by the directory mtime,
- * a symlink which points to an invalid file (which will not be a directory),
- * will not be reevaluated if that file is created, unless the containing
- * directory is touched. I consider this case to be worth ignoring (josh).
- */
-struct _CompletionDirEntry
-{
- gint is_dir;
- gchar *entry_name;
-};
-
-struct _CompletionUserDir
-{
- gchar *login;
- gchar *homedir;
-};
-
-struct _PossibleCompletion
-{
- /* accessible fields, all are accessed externally by functions
- * declared above
- */
- gchar *text;
- gint is_a_completion;
- gint is_directory;
-
- /* Private fields
- */
- gint text_alloc;
-};
-
-struct _CompletionState
-{
- gint last_valid_char;
- gchar *updated_text;
- gint updated_text_len;
- gint updated_text_alloc;
- gint re_complete;
-
- gchar *user_dir_name_buffer;
- gint user_directories_len;
- gchar *user_home_dir;
-
- gchar *last_completion_text;
-
- gint user_completion_index; /* if >= 0, currently completing ~user */
-
- struct _CompletionDir *completion_dir; /* directory completing from */
- struct _CompletionDir *active_completion_dir;
-
- struct _PossibleCompletion the_completion;
-
- struct _CompletionDir *reference_dir; /* initial directory */
-
- GList* directory_storage;
- GList* directory_sent_storage;
-
- struct _CompletionUserDir *user_directories;
-};
-
-
-/* File completion functions which would be external, were they used
- * outside of this file.
- */
-
-static CompletionState* cmpl_init_state (void);
-static void cmpl_free_state (CompletionState *cmpl_state);
-static gint cmpl_state_okay (CompletionState* cmpl_state);
-static gchar* cmpl_strerror (gint);
-
-static PossibleCompletion* cmpl_completion_matches(gchar *text_to_complete,
- gchar **remaining_text,
- CompletionState *cmpl_state);
-
-/* Returns a name for consideration, possibly a completion, this name
- * will be invalid after the next call to cmpl_next_completion.
- */
-static char* cmpl_this_completion (PossibleCompletion*);
-
-/* True if this completion matches the given text. Otherwise, this
- * output can be used to have a list of non-completions.
- */
-static gint cmpl_is_a_completion (PossibleCompletion*);
-
-/* True if the completion is a directory
- */
-static gint cmpl_is_directory (PossibleCompletion*);
-
-/* Obtains the next completion, or NULL
- */
-static PossibleCompletion* cmpl_next_completion (CompletionState*);
-
-/* Updating completions: the return value of cmpl_updated_text() will
- * be text_to_complete completed as much as possible after the most
- * recent call to cmpl_completion_matches. For the present
- * application, this is the suggested replacement for the user's input
- * string. You must CALL THIS AFTER ALL cmpl_text_completions have
- * been received.
- */
-static gchar* cmpl_updated_text (CompletionState* cmpl_state);
-
-/* After updating, to see if the completion was a directory, call
- * this. If it was, you should consider re-calling completion_matches.
- */
-static gint cmpl_updated_dir (CompletionState* cmpl_state);
-
-/* Current location: if using file completion, return the current
- * directory, from which file completion begins. More specifically,
- * the cwd concatenated with all exact completions up to the last
- * directory delimiter('/').
- */
-static gchar* cmpl_reference_position (CompletionState* cmpl_state);
-
-/* backing up: if cmpl_completion_matches returns NULL, you may query
- * the index of the last completable character into cmpl_updated_text.
- */
-static gint cmpl_last_valid_char (CompletionState* cmpl_state);
-
-/* When the user selects a non-directory, call cmpl_completion_fullname
- * to get the full name of the selected file.
- */
-static gchar* cmpl_completion_fullname (gchar*, CompletionState* cmpl_state);
-
-
-/* Directory operations. */
-static CompletionDir* open_ref_dir (gchar* text_to_complete,
- gchar** remaining_text,
- CompletionState* cmpl_state);
-static CompletionDir* open_dir (gchar* dir_name,
- CompletionState* cmpl_state);
-static CompletionDir* open_user_dir (gchar* text_to_complete,
- CompletionState *cmpl_state);
-static CompletionDir* open_relative_dir (gchar* dir_name, CompletionDir* dir,
- CompletionState *cmpl_state);
-static CompletionDirSent* open_new_dir (gchar* dir_name, struct stat* sbuf);
-static gint correct_dir_fullname (CompletionDir* cmpl_dir);
-static gint correct_parent (CompletionDir* cmpl_dir,
- struct stat *sbuf);
-static gchar* find_parent_dir_fullname (gchar* dirname);
-static CompletionDir* attach_dir (CompletionDirSent* sent,
- gchar* dir_name,
- CompletionState *cmpl_state);
-static void free_dir_sent (CompletionDirSent* sent);
-static void free_dir (CompletionDir *dir);
-static void prune_memory_usage(CompletionState *cmpl_state);
-
-/* Completion operations */
-static PossibleCompletion* attempt_homedir_completion(gchar* text_to_complete,
- CompletionState *cmpl_state);
-static PossibleCompletion* attempt_file_completion(CompletionState *cmpl_state);
-static CompletionDir* find_completion_dir(gchar* text_to_complete,
- gchar** remaining_text,
- CompletionState* cmpl_state);
-static PossibleCompletion* append_completion_text(gchar* text,
- CompletionState* cmpl_state);
-static gint get_pwdb(CompletionState* cmpl_state);
-static gint first_diff_index(gchar* pat, gchar* text);
-static gint compare_user_dir(const void* a, const void* b);
-static gint compare_cmpl_dir(const void* a, const void* b);
-static void update_cmpl(PossibleCompletion* poss,
- CompletionState* cmpl_state);
-
-static void gtk_file_selection_class_init (GtkFileSelectionClass *klass);
-static void gtk_file_selection_init (GtkFileSelection *filesel);
-static void gtk_file_selection_destroy (GtkObject *object);
-static gint gtk_file_selection_key_press (GtkWidget *widget,
- GdkEventKey *event,
- gpointer user_data);
-
-static void gtk_file_selection_file_button (GtkWidget *widget,
- gint row,
- gint column,
- GdkEventButton *bevent,
- gpointer user_data);
-
-static void gtk_file_selection_dir_button (GtkWidget *widget,
- gint row,
- gint column,
- GdkEventButton *bevent,
- gpointer data);
-
-static void gtk_file_selection_populate (GtkFileSelection *fs,
- gchar *rel_path,
- gint try_complete);
-static void gtk_file_selection_abort (GtkFileSelection *fs);
-
-static void gtk_file_selection_update_history_menu (GtkFileSelection *fs,
- gchar *current_dir);
-
-static void gtk_file_selection_create_dir (GtkWidget *widget, gpointer data);
-static void gtk_file_selection_delete_file (GtkWidget *widget, gpointer data);
-static void gtk_file_selection_rename_file (GtkWidget *widget, gpointer data);
-
-
-
-static GtkWindowClass *parent_class = NULL;
-
-/* Saves errno when something cmpl does fails. */
-static gint cmpl_errno;
-
-guint
-gtk_file_selection_get_type ()
-{
- static guint file_selection_type = 0;
-
- if (!file_selection_type)
- {
- GtkTypeInfo filesel_info =
- {
- "GtkFileSelection",
- sizeof (GtkFileSelection),
- sizeof (GtkFileSelectionClass),
- (GtkClassInitFunc) gtk_file_selection_class_init,
- (GtkObjectInitFunc) gtk_file_selection_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- file_selection_type = gtk_type_unique (gtk_window_get_type (), &filesel_info);
- }
-
- return file_selection_type;
-}
-
-static void
-gtk_file_selection_class_init (GtkFileSelectionClass *class)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass*) class;
-
- parent_class = gtk_type_class (gtk_window_get_type ());
-
- object_class->destroy = gtk_file_selection_destroy;
-}
-
-static void
-gtk_file_selection_init (GtkFileSelection *filesel)
-{
- GtkWidget *entry_vbox;
- GtkWidget *label;
- GtkWidget *list_hbox;
- GtkWidget *confirm_area;
- GtkWidget *pulldown_hbox;
- char *dir_title [] = { "Directories", };
- char *file_title [] = { "Files", };
-
- filesel->cmpl_state = cmpl_init_state ();
-
- /* The dialog-sized vertical box */
- filesel->main_vbox = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (filesel), 10);
- gtk_container_add (GTK_CONTAINER (filesel), filesel->main_vbox);
- gtk_widget_show (filesel->main_vbox);
-
- /* The horizontal box containing create, rename etc. buttons */
- filesel->button_area = gtk_hbox_new (TRUE, 0);
- gtk_box_pack_start (GTK_BOX (filesel->main_vbox), filesel->button_area,
- FALSE, FALSE, 0);
- gtk_widget_show (filesel->button_area);
-
- gtk_file_selection_show_fileop_buttons(filesel);
-
- /* hbox for pulldown menu */
- pulldown_hbox = gtk_hbox_new (TRUE, 5);
- gtk_box_pack_start (GTK_BOX (filesel->main_vbox), pulldown_hbox, FALSE, FALSE, 0);
- gtk_widget_show (pulldown_hbox);
-
- /* Pulldown menu */
- filesel->history_pulldown = gtk_option_menu_new ();
- gtk_widget_show (filesel->history_pulldown);
- gtk_box_pack_start (GTK_BOX (pulldown_hbox), filesel->history_pulldown,
- FALSE, FALSE, 0);
-
- /* The horizontal box containing the directory and file listboxes */
- list_hbox = gtk_hbox_new (FALSE, 5);
- gtk_box_pack_start (GTK_BOX (filesel->main_vbox), list_hbox, TRUE, TRUE, 0);
- gtk_widget_show (list_hbox);
-
- /* The directories clist */
- filesel->dir_list = gtk_clist_new_with_titles (1, dir_title);
- gtk_widget_set_usize (filesel->dir_list, DIR_LIST_WIDTH, DIR_LIST_HEIGHT);
- gtk_signal_connect (GTK_OBJECT (filesel->dir_list), "select_row",
- (GtkSignalFunc) gtk_file_selection_dir_button,
- (gpointer) filesel);
- gtk_clist_set_policy (GTK_CLIST (filesel->dir_list), GTK_POLICY_ALWAYS, GTK_POLICY_AUTOMATIC);
- gtk_clist_column_titles_passive (GTK_CLIST (filesel->dir_list));
- gtk_container_border_width (GTK_CONTAINER (filesel->dir_list), 5);
- gtk_box_pack_start (GTK_BOX (list_hbox), filesel->dir_list, TRUE, TRUE, 0);
- gtk_widget_show (filesel->dir_list);
-
- /* The files clist */
- filesel->file_list = gtk_clist_new_with_titles (1, file_title);
- gtk_widget_set_usize (filesel->file_list, FILE_LIST_WIDTH, FILE_LIST_HEIGHT);
- gtk_signal_connect (GTK_OBJECT (filesel->file_list), "select_row",
- (GtkSignalFunc) gtk_file_selection_file_button,
- (gpointer) filesel);
- gtk_clist_set_policy (GTK_CLIST (filesel->file_list), GTK_POLICY_ALWAYS, GTK_POLICY_AUTOMATIC);
- gtk_clist_column_titles_passive (GTK_CLIST (filesel->file_list));
- gtk_container_border_width (GTK_CONTAINER (filesel->file_list), 5);
- gtk_box_pack_start (GTK_BOX (list_hbox), filesel->file_list, TRUE, TRUE, 0);
- gtk_widget_show (filesel->file_list);
-
- /* action area for packing buttons into. */
- filesel->action_area = gtk_hbox_new (TRUE, 0);
- gtk_box_pack_start (GTK_BOX (filesel->main_vbox), filesel->action_area,
- FALSE, FALSE, 0);
- gtk_widget_show (filesel->action_area);
-
- /* The OK/Cancel button area */
- confirm_area = gtk_hbox_new (TRUE, 10);
- gtk_box_pack_end (GTK_BOX (filesel->main_vbox), confirm_area, FALSE, FALSE, 0);
- gtk_widget_show (confirm_area);
-
- /* The OK button */
- filesel->ok_button = gtk_button_new_with_label ("OK");
- GTK_WIDGET_SET_FLAGS (filesel->ok_button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (confirm_area), filesel->ok_button, TRUE, TRUE, 0);
- gtk_widget_grab_default (filesel->ok_button);
- gtk_widget_show (filesel->ok_button);
-
- /* The Cancel button */
- filesel->cancel_button = gtk_button_new_with_label ("Cancel");
- GTK_WIDGET_SET_FLAGS (filesel->cancel_button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (confirm_area), filesel->cancel_button, TRUE, TRUE, 0);
- gtk_widget_show (filesel->cancel_button);
-
- /* The selection entry widget */
- entry_vbox = gtk_vbox_new (FALSE, 2);
- gtk_box_pack_end (GTK_BOX (filesel->main_vbox), entry_vbox, FALSE, FALSE, 0);
- gtk_widget_show (entry_vbox);
-
- filesel->selection_text = label = gtk_label_new ("");
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_box_pack_start (GTK_BOX (entry_vbox), label, FALSE, FALSE, 0);
- gtk_widget_show (label);
-
- filesel->selection_entry = gtk_entry_new ();
- gtk_signal_connect (GTK_OBJECT (filesel->selection_entry), "key_press_event",
- (GtkSignalFunc) gtk_file_selection_key_press, filesel);
- gtk_signal_connect_object (GTK_OBJECT (filesel->selection_entry), "focus_in_event",
- (GtkSignalFunc) gtk_widget_grab_default,
- GTK_OBJECT (filesel->ok_button));
- gtk_signal_connect_object (GTK_OBJECT (filesel->selection_entry), "activate",
- (GtkSignalFunc) gtk_button_clicked,
- GTK_OBJECT (filesel->ok_button));
- gtk_box_pack_start (GTK_BOX (entry_vbox), filesel->selection_entry, TRUE, TRUE, 0);
- gtk_widget_show (filesel->selection_entry);
-
- if (!cmpl_state_okay (filesel->cmpl_state))
- {
- gchar err_buf[256];
-
- sprintf (err_buf, "Directory unreadable: %s", cmpl_strerror (cmpl_errno));
-
- gtk_label_set (GTK_LABEL (filesel->selection_text), err_buf);
- }
- else
- {
- gtk_file_selection_populate (filesel, "", FALSE);
- }
-
- gtk_widget_grab_focus (filesel->selection_entry);
-}
-
-GtkWidget*
-gtk_file_selection_new (const gchar *title)
-{
- GtkFileSelection *filesel;
-
- filesel = gtk_type_new (gtk_file_selection_get_type ());
- gtk_window_set_title (GTK_WINDOW (filesel), title);
-
- return GTK_WIDGET (filesel);
-}
-
-void
-gtk_file_selection_show_fileop_buttons (GtkFileSelection *filesel)
-{
- g_return_if_fail (filesel != NULL);
- g_return_if_fail (GTK_IS_FILE_SELECTION (filesel));
-
- /* delete, create directory, and rename */
- if (!filesel->fileop_c_dir)
- {
- filesel->fileop_c_dir = gtk_button_new_with_label ("Create Dir");
- gtk_signal_connect (GTK_OBJECT (filesel->fileop_c_dir), "clicked",
- (GtkSignalFunc) gtk_file_selection_create_dir,
- (gpointer) filesel);
- gtk_box_pack_start (GTK_BOX (filesel->button_area),
- filesel->fileop_c_dir, TRUE, TRUE, 0);
- gtk_widget_show (filesel->fileop_c_dir);
- }
-
- if (!filesel->fileop_del_file)
- {
- filesel->fileop_del_file = gtk_button_new_with_label ("Delete File");
- gtk_signal_connect (GTK_OBJECT (filesel->fileop_del_file), "clicked",
- (GtkSignalFunc) gtk_file_selection_delete_file,
- (gpointer) filesel);
- gtk_box_pack_start (GTK_BOX (filesel->button_area),
- filesel->fileop_del_file, TRUE, TRUE, 0);
- gtk_widget_show (filesel->fileop_del_file);
- }
-
- if (!filesel->fileop_ren_file)
- {
- filesel->fileop_ren_file = gtk_button_new_with_label ("Rename File");
- gtk_signal_connect (GTK_OBJECT (filesel->fileop_ren_file), "clicked",
- (GtkSignalFunc) gtk_file_selection_rename_file,
- (gpointer) filesel);
- gtk_box_pack_start (GTK_BOX (filesel->button_area),
- filesel->fileop_ren_file, TRUE, TRUE, 0);
- gtk_widget_show (filesel->fileop_ren_file);
- }
-}
-
-void
-gtk_file_selection_hide_fileop_buttons (GtkFileSelection *filesel)
-{
- g_return_if_fail (filesel != NULL);
- g_return_if_fail (GTK_IS_FILE_SELECTION (filesel));
-
- if (filesel->fileop_ren_file)
- {
- gtk_widget_destroy (filesel->fileop_ren_file);
- filesel->fileop_ren_file = NULL;
- }
-
- if (filesel->fileop_del_file)
- {
- gtk_widget_destroy (filesel->fileop_del_file);
- filesel->fileop_del_file = NULL;
- }
-
- if (filesel->fileop_c_dir)
- {
- gtk_widget_destroy (filesel->fileop_c_dir);
- filesel->fileop_c_dir = NULL;
- }
-}
-
-
-
-void
-gtk_file_selection_set_filename (GtkFileSelection *filesel,
- const gchar *filename)
-{
- char buf[MAXPATHLEN];
- const char *name, *last_slash;
-
- g_return_if_fail (filesel != NULL);
- g_return_if_fail (GTK_IS_FILE_SELECTION (filesel));
- g_return_if_fail (filename != NULL);
-
- last_slash = strrchr (filename, '/');
-
- if (!last_slash)
- {
- buf[0] = 0;
- name = filename;
- }
- else
- {
- gint len = MIN (MAXPATHLEN - 1, last_slash - filename + 1);
-
- strncpy (buf, filename, len);
- buf[len] = 0;
-
- name = last_slash + 1;
- }
-
- gtk_file_selection_populate (filesel, buf, FALSE);
-
- if (filesel->selection_entry)
- gtk_entry_set_text (GTK_ENTRY (filesel->selection_entry), name);
-}
-
-gchar*
-gtk_file_selection_get_filename (GtkFileSelection *filesel)
-{
- static char nothing[2] = "";
- char *text;
- char *filename;
-
- g_return_val_if_fail (filesel != NULL, nothing);
- g_return_val_if_fail (GTK_IS_FILE_SELECTION (filesel), nothing);
-
- text = gtk_entry_get_text (GTK_ENTRY (filesel->selection_entry));
- if (text)
- {
- filename = cmpl_completion_fullname (text, filesel->cmpl_state);
- return filename;
- }
-
- return nothing;
-}
-
-static void
-gtk_file_selection_destroy (GtkObject *object)
-{
- GtkFileSelection *filesel;
- GList *list;
- HistoryCallbackArg *callback_arg;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_FILE_SELECTION (object));
-
- filesel = GTK_FILE_SELECTION (object);
-
- if (filesel->fileop_dialog)
- gtk_widget_destroy (filesel->fileop_dialog);
-
- if (filesel->history_list)
- {
- list = filesel->history_list;
- while (list)
- {
- callback_arg = list->data;
- g_free (callback_arg->directory);
- list = list->next;
- }
- g_list_free (filesel->history_list);
- filesel->history_list = NULL;
- }
-
- cmpl_free_state (filesel->cmpl_state);
- filesel->cmpl_state = NULL;
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-/* Begin file operations callbacks */
-
-static void
-gtk_file_selection_fileop_error (gchar *error_message)
-{
- GtkWidget *label;
- GtkWidget *vbox;
- GtkWidget *button;
- GtkWidget *dialog;
-
- g_return_if_fail (error_message != NULL);
-
- /* main dialog */
- dialog = gtk_dialog_new ();
- /*
- gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
- (GtkSignalFunc) gtk_file_selection_fileop_destroy,
- (gpointer) fs);
- */
- gtk_window_set_title (GTK_WINDOW (dialog), "Error");
- gtk_window_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
-
- vbox = gtk_vbox_new(FALSE, 0);
- gtk_container_border_width(GTK_CONTAINER(vbox), 8);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), vbox,
- FALSE, FALSE, 0);
- gtk_widget_show(vbox);
-
- label = gtk_label_new(error_message);
- gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
- gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5);
- gtk_widget_show(label);
-
- /* yes, we free it */
- g_free (error_message);
-
- /* close button */
- button = gtk_button_new_with_label ("Close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) gtk_widget_destroy,
- (gpointer) dialog);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area),
- button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default(button);
- gtk_widget_show (button);
-
- gtk_widget_show (dialog);
-}
-
-static void
-gtk_file_selection_fileop_destroy (GtkWidget *widget, gpointer data)
-{
- GtkFileSelection *fs = data;
-
- g_return_if_fail (fs != NULL);
- g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
-
- fs->fileop_dialog = NULL;
-}
-
-
-static void
-gtk_file_selection_create_dir_confirmed (GtkWidget *widget, gpointer data)
-{
- GtkFileSelection *fs = data;
- gchar *dirname;
- gchar *path;
- gchar *full_path;
- gchar *buf;
- CompletionState *cmpl_state;
-
- g_return_if_fail (fs != NULL);
- g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
-
- dirname = gtk_entry_get_text (GTK_ENTRY (fs->fileop_entry));
- cmpl_state = (CompletionState*) fs->cmpl_state;
- path = cmpl_reference_position (cmpl_state);
-
- full_path = g_strconcat (path, "/", dirname, NULL);
- if ( (mkdir (full_path, 0755) < 0) )
- {
- buf = g_strconcat ("Error creating directory \"", dirname, "\": ",
- g_strerror(errno), NULL);
- gtk_file_selection_fileop_error (buf);
- }
- g_free (full_path);
-
- gtk_widget_destroy (fs->fileop_dialog);
- gtk_file_selection_populate (fs, "", FALSE);
-}
-
-static void
-gtk_file_selection_create_dir (GtkWidget *widget, gpointer data)
-{
- GtkFileSelection *fs = data;
- GtkWidget *label;
- GtkWidget *dialog;
- GtkWidget *vbox;
- GtkWidget *button;
-
- g_return_if_fail (fs != NULL);
- g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
-
- if (fs->fileop_dialog)
- return;
-
- /* main dialog */
- fs->fileop_dialog = dialog = gtk_dialog_new ();
- gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
- (GtkSignalFunc) gtk_file_selection_fileop_destroy,
- (gpointer) fs);
- gtk_window_set_title (GTK_WINDOW (dialog), "Create Directory");
- gtk_window_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
- gtk_widget_show (dialog);
-
- vbox = gtk_vbox_new(FALSE, 0);
- gtk_container_border_width(GTK_CONTAINER(vbox), 8);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), vbox,
- FALSE, FALSE, 0);
- gtk_widget_show(vbox);
-
- label = gtk_label_new("Directory name:");
- gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
- gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5);
- gtk_widget_show(label);
-
- /* The directory entry widget */
- fs->fileop_entry = gtk_entry_new ();
- gtk_box_pack_start (GTK_BOX (vbox), fs->fileop_entry,
- TRUE, TRUE, 5);
- GTK_WIDGET_SET_FLAGS(fs->fileop_entry, GTK_CAN_DEFAULT);
- gtk_widget_show (fs->fileop_entry);
-
- /* buttons */
- button = gtk_button_new_with_label ("Create");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) gtk_file_selection_create_dir_confirmed,
- (gpointer) fs);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area),
- button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
- gtk_widget_show(button);
-
- button = gtk_button_new_with_label ("Cancel");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) gtk_widget_destroy,
- (gpointer) dialog);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area),
- button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default(button);
- gtk_widget_show (button);
-}
-
-static void
-gtk_file_selection_delete_file_confirmed (GtkWidget *widget, gpointer data)
-{
- GtkFileSelection *fs = data;
- CompletionState *cmpl_state;
- gchar *path;
- gchar *full_path;
- gchar *buf;
-
- g_return_if_fail (fs != NULL);
- g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
-
- cmpl_state = (CompletionState*) fs->cmpl_state;
- path = cmpl_reference_position (cmpl_state);
-
- full_path = g_strconcat (path, "/", fs->fileop_file, NULL);
- if ( (unlink (full_path) < 0) )
- {
- buf = g_strconcat ("Error deleting file \"", fs->fileop_file, "\": ",
- g_strerror(errno), NULL);
- gtk_file_selection_fileop_error (buf);
- }
- g_free (full_path);
-
- gtk_widget_destroy (fs->fileop_dialog);
- gtk_file_selection_populate (fs, "", FALSE);
-}
-
-static void
-gtk_file_selection_delete_file (GtkWidget *widget, gpointer data)
-{
- GtkFileSelection *fs = data;
- GtkWidget *label;
- GtkWidget *vbox;
- GtkWidget *button;
- GtkWidget *dialog;
- gchar *filename;
- gchar *buf;
-
- g_return_if_fail (fs != NULL);
- g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
-
- if (fs->fileop_dialog)
- return;
-
- filename = gtk_entry_get_text (GTK_ENTRY (fs->selection_entry));
- if (strlen(filename) < 1)
- return;
-
- fs->fileop_file = filename;
-
- /* main dialog */
- fs->fileop_dialog = dialog = gtk_dialog_new ();
- gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
- (GtkSignalFunc) gtk_file_selection_fileop_destroy,
- (gpointer) fs);
- gtk_window_set_title (GTK_WINDOW (dialog), "Delete File");
- gtk_window_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
-
- vbox = gtk_vbox_new(FALSE, 0);
- gtk_container_border_width(GTK_CONTAINER(vbox), 8);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), vbox,
- FALSE, FALSE, 0);
- gtk_widget_show(vbox);
-
- buf = g_strconcat ("Really delete file \"", filename, "\" ?", NULL);
- label = gtk_label_new(buf);
- gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
- gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5);
- gtk_widget_show(label);
- g_free(buf);
-
- /* buttons */
- button = gtk_button_new_with_label ("Delete");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) gtk_file_selection_delete_file_confirmed,
- (gpointer) fs);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area),
- button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
- gtk_widget_show(button);
-
- button = gtk_button_new_with_label ("Cancel");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) gtk_widget_destroy,
- (gpointer) dialog);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area),
- button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default(button);
- gtk_widget_show (button);
-
- gtk_widget_show (dialog);
-}
-
-static void
-gtk_file_selection_rename_file_confirmed (GtkWidget *widget, gpointer data)
-{
- GtkFileSelection *fs = data;
- gchar *buf;
- gchar *file;
- gchar *path;
- gchar *new_filename;
- gchar *old_filename;
- CompletionState *cmpl_state;
-
- g_return_if_fail (fs != NULL);
- g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
-
- file = gtk_entry_get_text (GTK_ENTRY (fs->fileop_entry));
- cmpl_state = (CompletionState*) fs->cmpl_state;
- path = cmpl_reference_position (cmpl_state);
-
- new_filename = g_strconcat (path, "/", file, NULL);
- old_filename = g_strconcat (path, "/", fs->fileop_file, NULL);
-
- if ( (rename (old_filename, new_filename)) < 0)
- {
- buf = g_strconcat ("Error renaming file \"", file, "\": ",
- g_strerror(errno), NULL);
- gtk_file_selection_fileop_error (buf);
- }
- g_free (new_filename);
- g_free (old_filename);
-
- gtk_widget_destroy (fs->fileop_dialog);
- gtk_file_selection_populate (fs, "", FALSE);
-}
-
-static void
-gtk_file_selection_rename_file (GtkWidget *widget, gpointer data)
-{
- GtkFileSelection *fs = data;
- GtkWidget *label;
- GtkWidget *dialog;
- GtkWidget *vbox;
- GtkWidget *button;
- gchar *buf;
-
- g_return_if_fail (fs != NULL);
- g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
-
- if (fs->fileop_dialog)
- return;
-
- fs->fileop_file = gtk_entry_get_text (GTK_ENTRY (fs->selection_entry));
- if (strlen(fs->fileop_file) < 1)
- return;
-
- /* main dialog */
- fs->fileop_dialog = dialog = gtk_dialog_new ();
- gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
- (GtkSignalFunc) gtk_file_selection_fileop_destroy,
- (gpointer) fs);
- gtk_window_set_title (GTK_WINDOW (dialog), "Rename File");
- gtk_window_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
- gtk_widget_show (dialog);
-
- vbox = gtk_vbox_new(FALSE, 0);
- gtk_container_border_width(GTK_CONTAINER(vbox), 8);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), vbox,
- FALSE, FALSE, 0);
- gtk_widget_show(vbox);
-
- buf = g_strconcat ("Rename file \"", fs->fileop_file, "\" to:", NULL);
- label = gtk_label_new(buf);
- gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
- gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5);
- gtk_widget_show(label);
- g_free(buf);
-
- /* New filename entry */
- fs->fileop_entry = gtk_entry_new ();
- gtk_box_pack_start (GTK_BOX (vbox), fs->fileop_entry,
- TRUE, TRUE, 5);
- GTK_WIDGET_SET_FLAGS(fs->fileop_entry, GTK_CAN_DEFAULT);
- gtk_widget_show (fs->fileop_entry);
-
- gtk_entry_set_text (GTK_ENTRY (fs->fileop_entry), fs->fileop_file);
- gtk_editable_select_region (GTK_EDITABLE (fs->fileop_entry),
- 0, strlen (fs->fileop_file));
-
- /* buttons */
- button = gtk_button_new_with_label ("Rename");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) gtk_file_selection_rename_file_confirmed,
- (gpointer) fs);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area),
- button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
- gtk_widget_show(button);
-
- button = gtk_button_new_with_label ("Cancel");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) gtk_widget_destroy,
- (gpointer) dialog);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area),
- button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default(button);
- gtk_widget_show (button);
-}
-
-
-static gint
-gtk_file_selection_key_press (GtkWidget *widget,
- GdkEventKey *event,
- gpointer user_data)
-{
- GtkFileSelection *fs;
- char *text;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (event->keyval == GDK_Tab)
- {
- gtk_signal_emit_stop_by_name (GTK_OBJECT (widget), "key_press_event");
-
- fs = GTK_FILE_SELECTION (user_data);
- text = gtk_entry_get_text (GTK_ENTRY (fs->selection_entry));
- gtk_file_selection_populate (fs, text, TRUE);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-
-static void
-gtk_file_selection_history_callback (GtkWidget *widget, gpointer data)
-{
- GtkFileSelection *fs = data;
- HistoryCallbackArg *callback_arg;
- GList *list;
-
- g_return_if_fail (fs != NULL);
- g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
-
- list = fs->history_list;
-
- while (list) {
- callback_arg = list->data;
-
- if (callback_arg->menu_item == widget)
- {
- gtk_file_selection_populate (fs, callback_arg->directory, FALSE);
- break;
- }
-
- list = list->next;
- }
-}
-
-static void
-gtk_file_selection_update_history_menu (GtkFileSelection *fs,
- gchar *current_directory)
-{
- HistoryCallbackArg *callback_arg;
- GtkWidget *menu_item;
- GList *list;
- gchar *current_dir;
- gchar *directory;
- gint dir_len;
- gint i;
-
- g_return_if_fail (fs != NULL);
- g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
- g_return_if_fail (current_directory != NULL);
-
- list = fs->history_list;
-
- if (fs->history_menu)
- {
- while (list) {
- callback_arg = list->data;
- g_free (callback_arg->directory);
- list = list->next;
- }
- g_list_free (fs->history_list);
- fs->history_list = NULL;
-
- gtk_widget_destroy (fs->history_menu);
- }
-
- fs->history_menu = gtk_menu_new();
-
- current_dir = g_strdup (current_directory);
-
- dir_len = strlen (current_dir);
-
- for (i = dir_len; i >= 0; i--)
- {
- /* the i == dir_len is to catch the full path for the first
- * entry. */
- if ( (current_dir[i] == '/') || (i == dir_len))
- {
- /* another small hack to catch the full path */
- if (i != dir_len)
- current_dir[i + 1] = '\0';
- menu_item = gtk_menu_item_new_with_label (current_dir);
- directory = g_strdup (current_dir);
-
- callback_arg = g_new (HistoryCallbackArg, 1);
- callback_arg->menu_item = menu_item;
-
- /* since the autocompletion gets confused if you don't
- * supply a trailing '/' on a dir entry, set the full
- * (current) path to "" which just refreshes the filesel */
- if (dir_len == i) {
- callback_arg->directory = g_strdup ("");
- } else {
- callback_arg->directory = directory;
- }
-
- fs->history_list = g_list_append (fs->history_list, callback_arg);
-
- gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
- (GtkSignalFunc) gtk_file_selection_history_callback,
- (gpointer) fs);
- gtk_menu_append (GTK_MENU (fs->history_menu), menu_item);
- gtk_widget_show (menu_item);
- }
- }
-
- gtk_option_menu_set_menu (GTK_OPTION_MENU (fs->history_pulldown),
- fs->history_menu);
- g_free (current_dir);
-}
-
-static void
-gtk_file_selection_file_button (GtkWidget *widget,
- gint row,
- gint column,
- GdkEventButton *bevent,
- gpointer user_data)
-{
- GtkFileSelection *fs = NULL;
- gchar *filename;
-
- g_return_if_fail (GTK_IS_CLIST (widget));
-
- fs = user_data;
- g_return_if_fail (fs != NULL);
- g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
-
- filename = gtk_clist_get_row_data (GTK_CLIST (fs->file_list), row);
-
- if (bevent && filename)
- {
- switch (bevent->type)
- {
- case GDK_BUTTON_PRESS:
- gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
- break;
-
- case GDK_2BUTTON_PRESS:
- gtk_button_clicked (GTK_BUTTON (fs->ok_button));
- break;
-
- default:
- break;
- }
- }
-}
-
-static void
-gtk_file_selection_dir_button (GtkWidget *widget,
- gint row,
- gint column,
- GdkEventButton *bevent,
- gpointer user_data)
-{
- GtkFileSelection *fs = NULL;
- gchar *filename;
-
- g_return_if_fail (GTK_IS_CLIST (widget));
-
- fs = GTK_FILE_SELECTION (user_data);
- g_return_if_fail (fs != NULL);
- g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
-
- filename = gtk_clist_get_row_data (GTK_CLIST (fs->dir_list), row);
-
- if (bevent && filename) {
-
- switch (bevent->type)
- {
- case GDK_BUTTON_PRESS:
- gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
- break;
-
- case GDK_2BUTTON_PRESS:
- gtk_file_selection_populate (fs, filename, FALSE);
- break;
-
- default:
- break;
- }
- }
-}
-
-static void
-gtk_file_selection_populate (GtkFileSelection *fs,
- gchar *rel_path,
- gint try_complete)
-{
- CompletionState *cmpl_state;
- PossibleCompletion* poss;
- gchar* filename;
- gint row;
- gchar* rem_path = rel_path;
- gchar* sel_text;
- gchar* text[2];
- gint did_recurse = FALSE;
- gint possible_count = 0;
- gint selection_index = -1;
-
- g_return_if_fail (fs != NULL);
- g_return_if_fail (GTK_IS_FILE_SELECTION (fs));
-
- cmpl_state = (CompletionState*) fs->cmpl_state;
- poss = cmpl_completion_matches (rel_path, &rem_path, cmpl_state);
-
- if (!cmpl_state_okay (cmpl_state))
- {
- /* Something went wrong. */
- gtk_file_selection_abort (fs);
- return;
- }
-
- g_assert (cmpl_state->reference_dir);
-
- gtk_clist_freeze (GTK_CLIST (fs->dir_list));
- gtk_clist_clear (GTK_CLIST (fs->dir_list));
- gtk_clist_freeze (GTK_CLIST (fs->file_list));
- gtk_clist_clear (GTK_CLIST (fs->file_list));
-
- /* Set the dir_list to include ./ and ../ */
- text[1] = NULL;
- text[0] = "./";
- row = gtk_clist_append (GTK_CLIST (fs->dir_list), text);
- gtk_clist_set_row_data (GTK_CLIST (fs->dir_list), row, "./");
-
- text[0] = "../";
- row = gtk_clist_append (GTK_CLIST (fs->dir_list), text);
- gtk_clist_set_row_data (GTK_CLIST (fs->dir_list), row, "../");
-
- while (poss)
- {
- if (cmpl_is_a_completion (poss))
- {
- possible_count += 1;
-
- filename = g_strdup (cmpl_this_completion (poss));
-
- text[0] = filename;
-
- if (cmpl_is_directory (poss))
- {
- if (strcmp (filename, "./") != 0 &&
- strcmp (filename, "../") != 0)
- {
- row = gtk_clist_append (GTK_CLIST (fs->dir_list), text);
- gtk_clist_set_row_data_full (GTK_CLIST (fs->dir_list), row,
- filename, (GtkDestroyNotify) g_free);
- }
- }
- else
- {
- row = gtk_clist_append (GTK_CLIST (fs->file_list), text);
- gtk_clist_set_row_data_full (GTK_CLIST (fs->file_list), row,
- filename ,(GtkDestroyNotify) g_free);
- }
- }
-
- poss = cmpl_next_completion (cmpl_state);
- }
-
- gtk_clist_thaw (GTK_CLIST (fs->dir_list));
- gtk_clist_thaw (GTK_CLIST (fs->file_list));
-
- /* File lists are set. */
-
- g_assert (cmpl_state->reference_dir);
-
- if (try_complete)
- {
-
- /* User is trying to complete filenames, so advance the user's input
- * string to the updated_text, which is the common leading substring
- * of all possible completions, and if its a directory attempt
- * attempt completions in it. */
-
- if (cmpl_updated_text (cmpl_state)[0])
- {
-
- if (cmpl_updated_dir (cmpl_state))
- {
- gchar* dir_name = g_strdup (cmpl_updated_text (cmpl_state));
-
- did_recurse = TRUE;
-
- gtk_file_selection_populate (fs, dir_name, TRUE);
-
- g_free (dir_name);
- }
- else
- {
- if (fs->selection_entry)
- gtk_entry_set_text (GTK_ENTRY (fs->selection_entry),
- cmpl_updated_text (cmpl_state));
- }
- }
- else
- {
- selection_index = cmpl_last_valid_char (cmpl_state) -
- (strlen (rel_path) - strlen (rem_path));
- if (fs->selection_entry)
- gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), rem_path);
- }
- }
- else
- {
- if (fs->selection_entry)
- gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), "");
- }
-
- if (!did_recurse)
- {
- if (fs->selection_entry)
- gtk_entry_set_position (GTK_ENTRY (fs->selection_entry), selection_index);
-
- if (fs->selection_entry)
- {
- sel_text = g_new (char, strlen (cmpl_reference_position (cmpl_state)) +
- sizeof ("Selection: "));
- strcpy (sel_text, "Selection: ");
- strcat (sel_text, cmpl_reference_position (cmpl_state));
-
- gtk_label_set (GTK_LABEL (fs->selection_text), sel_text);
- g_free (sel_text);
- }
-
- if (fs->history_pulldown)
- {
- gtk_file_selection_update_history_menu (fs, cmpl_reference_position (cmpl_state));
- }
-
- }
-}
-
-static void
-gtk_file_selection_abort (GtkFileSelection *fs)
-{
- gchar err_buf[256];
-
- sprintf (err_buf, "Directory unreadable: %s", cmpl_strerror (cmpl_errno));
-
- /* BEEP gdk_beep(); */
-
- if (fs->selection_entry)
- gtk_label_set (GTK_LABEL (fs->selection_text), err_buf);
-}
-
-/**********************************************************************/
-/* External Interface */
-/**********************************************************************/
-
-/* The four completion state selectors
- */
-static gchar*
-cmpl_updated_text (CompletionState* cmpl_state)
-{
- return cmpl_state->updated_text;
-}
-
-static gint
-cmpl_updated_dir (CompletionState* cmpl_state)
-{
- return cmpl_state->re_complete;
-}
-
-static gchar*
-cmpl_reference_position (CompletionState* cmpl_state)
-{
- return cmpl_state->reference_dir->fullname;
-}
-
-static gint
-cmpl_last_valid_char (CompletionState* cmpl_state)
-{
- return cmpl_state->last_valid_char;
-}
-
-static gchar*
-cmpl_completion_fullname (gchar* text, CompletionState* cmpl_state)
-{
- if (text[0] == '/')
- {
- strcpy (cmpl_state->updated_text, text);
- }
- else if (text[0] == '~')
- {
- CompletionDir* dir;
- char* slash;
-
- dir = open_user_dir (text, cmpl_state);
-
- if (!dir)
- {
- /* spencer says just return ~something, so
- * for now just do it. */
- strcpy (cmpl_state->updated_text, text);
- }
- else
- {
-
- strcpy (cmpl_state->updated_text, dir->fullname);
-
- slash = strchr (text, '/');
-
- if (slash)
- strcat (cmpl_state->updated_text, slash);
- }
- }
- else
- {
- strcpy (cmpl_state->updated_text, cmpl_state->reference_dir->fullname);
- strcat (cmpl_state->updated_text, "/");
- strcat (cmpl_state->updated_text, text);
- }
-
- return cmpl_state->updated_text;
-}
-
-/* The three completion selectors
- */
-static gchar*
-cmpl_this_completion (PossibleCompletion* pc)
-{
- return pc->text;
-}
-
-static gint
-cmpl_is_directory (PossibleCompletion* pc)
-{
- return pc->is_directory;
-}
-
-static gint
-cmpl_is_a_completion (PossibleCompletion* pc)
-{
- return pc->is_a_completion;
-}
-
-/**********************************************************************/
-/* Construction, deletion */
-/**********************************************************************/
-
-static CompletionState*
-cmpl_init_state (void)
-{
- gchar getcwd_buf[2*MAXPATHLEN];
- CompletionState *new_state;
-
- new_state = g_new (CompletionState, 1);
-
- if (!getcwd (getcwd_buf, MAXPATHLEN))
- {
- cmpl_errno = errno;
- return NULL;
- }
-
- new_state->reference_dir = NULL;
- new_state->completion_dir = NULL;
- new_state->active_completion_dir = NULL;
-
- if ((new_state->user_home_dir = getenv("HOME")) != NULL)
- {
- /* if this fails, get_pwdb will fill it in. */
- new_state->user_home_dir = g_strdup(new_state->user_home_dir);
- }
-
- new_state->directory_storage = NULL;
- new_state->directory_sent_storage = NULL;
- new_state->last_valid_char = 0;
- new_state->updated_text = g_new (gchar, MAXPATHLEN);
- new_state->updated_text_alloc = MAXPATHLEN;
- new_state->the_completion.text = g_new (gchar, MAXPATHLEN);
- new_state->the_completion.text_alloc = MAXPATHLEN;
- new_state->user_dir_name_buffer = NULL;
- new_state->user_directories = NULL;
-
- new_state->reference_dir = open_dir (getcwd_buf, new_state);
-
- if (!new_state->reference_dir)
- return NULL;
-
- return new_state;
-}
-
-static void
-cmpl_free_dir_list(GList* dp0)
-{
- GList *dp = dp0;
-
- while (dp) {
- free_dir (dp->data);
- dp = dp->next;
- }
-
- g_list_free(dp0);
-}
-
-static void
-cmpl_free_dir_sent_list(GList* dp0)
-{
- GList *dp = dp0;
-
- while (dp) {
- free_dir_sent (dp->data);
- dp = dp->next;
- }
-
- g_list_free(dp0);
-}
-
-static void
-cmpl_free_state (CompletionState* cmpl_state)
-{
- cmpl_free_dir_list (cmpl_state->directory_storage);
- cmpl_free_dir_sent_list (cmpl_state->directory_sent_storage);
-
- if (cmpl_state->user_dir_name_buffer)
- g_free (cmpl_state->user_dir_name_buffer);
- if (cmpl_state->user_directories)
- g_free (cmpl_state->user_directories);
- if (cmpl_state->the_completion.text)
- g_free (cmpl_state->the_completion.text);
- if (cmpl_state->updated_text)
- g_free (cmpl_state->updated_text);
-
- g_free (cmpl_state);
-}
-
-static void
-free_dir(CompletionDir* dir)
-{
- g_free(dir->fullname);
- g_free(dir);
-}
-
-static void
-free_dir_sent(CompletionDirSent* sent)
-{
- g_free(sent->name_buffer);
- g_free(sent->entries);
- g_free(sent);
-}
-
-static void
-prune_memory_usage(CompletionState *cmpl_state)
-{
- GList* cdsl = cmpl_state->directory_sent_storage;
- GList* cdl = cmpl_state->directory_storage;
- GList* cdl0 = cdl;
- gint len = 0;
-
- for(; cdsl && len < CMPL_DIRECTORY_CACHE_SIZE; len += 1)
- cdsl = cdsl->next;
-
- if (cdsl) {
- cmpl_free_dir_sent_list(cdsl->next);
- cdsl->next = NULL;
- }
-
- cmpl_state->directory_storage = NULL;
- while (cdl) {
- if (cdl->data == cmpl_state->reference_dir)
- cmpl_state->directory_storage = g_list_prepend(NULL, cdl->data);
- else
- free_dir (cdl->data);
- cdl = cdl->next;
- }
-
- g_list_free(cdl0);
-}
-
-/**********************************************************************/
-/* The main entrances. */
-/**********************************************************************/
-
-static PossibleCompletion*
-cmpl_completion_matches (gchar* text_to_complete,
- gchar** remaining_text,
- CompletionState* cmpl_state)
-{
- gchar* first_slash;
- PossibleCompletion *poss;
-
- prune_memory_usage(cmpl_state);
-
- g_assert(text_to_complete);
-
- cmpl_state->user_completion_index = -1;
- cmpl_state->last_completion_text = text_to_complete;
- cmpl_state->the_completion.text[0] = 0;
- cmpl_state->last_valid_char = 0;
- cmpl_state->updated_text_len = -1;
- cmpl_state->updated_text[0] = 0;
- cmpl_state->re_complete = FALSE;
-
- first_slash = strchr(text_to_complete, '/');
-
- if(text_to_complete[0] == '~' && !first_slash)
- {
- /* Text starts with ~ and there is no slash, show all the
- * home directory completions.
- */
- poss = attempt_homedir_completion(text_to_complete, cmpl_state);
-
- update_cmpl(poss, cmpl_state);
-
- return poss;
- }
-
- cmpl_state->reference_dir =
- open_ref_dir(text_to_complete, remaining_text, cmpl_state);
-
- if(!cmpl_state->reference_dir)
- return NULL;
-
- cmpl_state->completion_dir =
- find_completion_dir(*remaining_text, remaining_text, cmpl_state);
-
- cmpl_state->last_valid_char = *remaining_text - text_to_complete;
-
- if(!cmpl_state->completion_dir)
- return NULL;
-
- cmpl_state->completion_dir->cmpl_index = -1;
- cmpl_state->completion_dir->cmpl_parent = NULL;
- cmpl_state->completion_dir->cmpl_text = *remaining_text;
-
- cmpl_state->active_completion_dir = cmpl_state->completion_dir;
-
- cmpl_state->reference_dir = cmpl_state->completion_dir;
-
- poss = attempt_file_completion(cmpl_state);
-
- update_cmpl(poss, cmpl_state);
-
- return poss;
-}
-
-static PossibleCompletion*
-cmpl_next_completion (CompletionState* cmpl_state)
-{
- PossibleCompletion* poss = NULL;
-
- cmpl_state->the_completion.text[0] = 0;
-
- if(cmpl_state->user_completion_index >= 0)
- poss = attempt_homedir_completion(cmpl_state->last_completion_text, cmpl_state);
- else
- poss = attempt_file_completion(cmpl_state);
-
- update_cmpl(poss, cmpl_state);
-
- return poss;
-}
-
-/**********************************************************************/
-/* Directory Operations */
-/**********************************************************************/
-
-/* Open the directory where completion will begin from, if possible. */
-static CompletionDir*
-open_ref_dir(gchar* text_to_complete,
- gchar** remaining_text,
- CompletionState* cmpl_state)
-{
- gchar* first_slash;
- CompletionDir *new_dir;
-
- first_slash = strchr(text_to_complete, '/');
-
- if (text_to_complete[0] == '/' || !cmpl_state->reference_dir)
- {
- new_dir = open_dir("/", cmpl_state);
-
- if(new_dir)
- *remaining_text = text_to_complete + 1;
- }
- else if (text_to_complete[0] == '~')
- {
- new_dir = open_user_dir(text_to_complete, cmpl_state);
-
- if(new_dir)
- {
- if(first_slash)
- *remaining_text = first_slash + 1;
- else
- *remaining_text = text_to_complete + strlen(text_to_complete);
- }
- else
- {
- return NULL;
- }
- }
- else
- {
- *remaining_text = text_to_complete;
-
- new_dir = open_dir(cmpl_state->reference_dir->fullname, cmpl_state);
- }
-
- if(new_dir)
- {
- new_dir->cmpl_index = -1;
- new_dir->cmpl_parent = NULL;
- }
-
- return new_dir;
-}
-
-/* open a directory by user name */
-static CompletionDir*
-open_user_dir(gchar* text_to_complete,
- CompletionState *cmpl_state)
-{
- gchar *first_slash;
- gint cmp_len;
-
- g_assert(text_to_complete && text_to_complete[0] == '~');
-
- first_slash = strchr(text_to_complete, '/');
-
- if (first_slash)
- cmp_len = first_slash - text_to_complete - 1;
- else
- cmp_len = strlen(text_to_complete + 1);
-
- if(!cmp_len)
- {
- /* ~/ */
- if (!cmpl_state->user_home_dir &&
- !get_pwdb(cmpl_state))
- return NULL;
- return open_dir(cmpl_state->user_home_dir, cmpl_state);
- }
- else
- {
- /* ~user/ */
- char* copy = g_new(char, cmp_len + 1);
- struct passwd *pwd;
- strncpy(copy, text_to_complete + 1, cmp_len);
- copy[cmp_len] = 0;
- pwd = getpwnam(copy);
- g_free(copy);
- if (!pwd)
- {
- cmpl_errno = errno;
- return NULL;
- }
-
- return open_dir(pwd->pw_dir, cmpl_state);
- }
-}
-
-/* open a directory relative the the current relative directory */
-static CompletionDir*
-open_relative_dir(gchar* dir_name,
- CompletionDir* dir,
- CompletionState *cmpl_state)
-{
- gchar path_buf[2*MAXPATHLEN];
-
- if(dir->fullname_len + strlen(dir_name) + 2 >= MAXPATHLEN)
- {
- cmpl_errno = CMPL_ERRNO_TOO_LONG;
- return NULL;
- }
-
- strcpy(path_buf, dir->fullname);
-
- if(dir->fullname_len > 1)
- {
- path_buf[dir->fullname_len] = '/';
- strcpy(path_buf + dir->fullname_len + 1, dir_name);
- }
- else
- {
- strcpy(path_buf + dir->fullname_len, dir_name);
- }
-
- return open_dir(path_buf, cmpl_state);
-}
-
-/* after the cache lookup fails, really open a new directory */
-static CompletionDirSent*
-open_new_dir(gchar* dir_name, struct stat* sbuf)
-{
- CompletionDirSent* sent;
- DIR* directory;
- gchar *buffer_ptr;
- struct dirent *dirent_ptr;
- gint buffer_size = 0;
- gint entry_count = 0;
- gint i;
- struct stat ent_sbuf;
- char path_buf[MAXPATHLEN*2];
- gint path_buf_len;
-
- sent = g_new(CompletionDirSent, 1);
- sent->mtime = sbuf->st_mtime;
- sent->inode = sbuf->st_ino;
-
- path_buf_len = strlen(dir_name);
-
- if (path_buf_len > MAXPATHLEN)
- {
- cmpl_errno = CMPL_ERRNO_TOO_LONG;
- return NULL;
- }
-
- strcpy(path_buf, dir_name);
-
- directory = opendir(dir_name);
-
- if(!directory)
- {
- cmpl_errno = errno;
- return NULL;
- }
-
- while((dirent_ptr = readdir(directory)) != NULL)
- {
- int entry_len = strlen(dirent_ptr->d_name);
- buffer_size += entry_len + 1;
- entry_count += 1;
-
- if(path_buf_len + entry_len + 2 >= MAXPATHLEN)
- {
- cmpl_errno = CMPL_ERRNO_TOO_LONG;
- closedir(directory);
- return NULL;
- }
- }
-
- sent->name_buffer = g_new(gchar, buffer_size);
- sent->entries = g_new(CompletionDirEntry, entry_count);
- sent->entry_count = entry_count;
-
- buffer_ptr = sent->name_buffer;
-
- rewinddir(directory);
-
- for(i = 0; i < entry_count; i += 1)
- {
- dirent_ptr = readdir(directory);
-
- if(!dirent_ptr)
- {
- cmpl_errno = errno;
- closedir(directory);
- return NULL;
- }
-
- strcpy(buffer_ptr, dirent_ptr->d_name);
- sent->entries[i].entry_name = buffer_ptr;
- buffer_ptr += strlen(dirent_ptr->d_name);
- *buffer_ptr = 0;
- buffer_ptr += 1;
-
- path_buf[path_buf_len] = '/';
- strcpy(path_buf + path_buf_len + 1, dirent_ptr->d_name);
-
- if(stat(path_buf, &ent_sbuf) >= 0 && S_ISDIR(ent_sbuf.st_mode))
- sent->entries[i].is_dir = 1;
- else
- /* stat may fail, and we don't mind, since it could be a
- * dangling symlink. */
- sent->entries[i].is_dir = 0;
- }
-
- qsort(sent->entries, sent->entry_count, sizeof(CompletionDirEntry), compare_cmpl_dir);
-
- closedir(directory);
-
- return sent;
-}
-
-/* open a directory by absolute pathname */
-static CompletionDir*
-open_dir(gchar* dir_name, CompletionState* cmpl_state)
-{
- struct stat sbuf;
- CompletionDirSent *sent;
- GList* cdsl;
-
- if(stat(dir_name, &sbuf) < 0)
- {
- cmpl_errno = errno;
- return NULL;
- }
-
- cdsl = cmpl_state->directory_sent_storage;
-
- while (cdsl)
- {
- sent = cdsl->data;
-
- if(sent->inode == sbuf.st_ino &&
- sent->mtime == sbuf.st_mtime)
- return attach_dir(sent, dir_name, cmpl_state);
-
- cdsl = cdsl->next;
- }
-
- sent = open_new_dir(dir_name, &sbuf);
-
- if (sent) {
- cmpl_state->directory_sent_storage =
- g_list_prepend(cmpl_state->directory_sent_storage, sent);
-
- return attach_dir(sent, dir_name, cmpl_state);
- }
-
- return NULL;
-}
-
-static CompletionDir*
-attach_dir(CompletionDirSent* sent, gchar* dir_name, CompletionState *cmpl_state)
-{
- CompletionDir* new_dir;
-
- new_dir = g_new(CompletionDir, 1);
-
- cmpl_state->directory_storage =
- g_list_prepend(cmpl_state->directory_storage, new_dir);
-
- new_dir->sent = sent;
- new_dir->fullname = g_strdup(dir_name);
- new_dir->fullname_len = strlen(dir_name);
-
- return new_dir;
-}
-
-static gint
-correct_dir_fullname(CompletionDir* cmpl_dir)
-{
- gint length = strlen(cmpl_dir->fullname);
- struct stat sbuf;
-
- if (strcmp(cmpl_dir->fullname + length - 2, "/.") == 0)
- {
- if (length == 2)
- {
- strcpy(cmpl_dir->fullname, "/");
- cmpl_dir->fullname_len = 1;
- return TRUE;
- } else {
- cmpl_dir->fullname[length - 2] = 0;
- }
- }
- else if (strcmp(cmpl_dir->fullname + length - 3, "/./") == 0)
- cmpl_dir->fullname[length - 2] = 0;
- else if (strcmp(cmpl_dir->fullname + length - 3, "/..") == 0)
- {
- if(length == 3)
- {
- strcpy(cmpl_dir->fullname, "/");
- cmpl_dir->fullname_len = 1;
- return TRUE;
- }
-
- if(stat(cmpl_dir->fullname, &sbuf) < 0)
- {
- cmpl_errno = errno;
- return FALSE;
- }
-
- cmpl_dir->fullname[length - 2] = 0;
-
- if(!correct_parent(cmpl_dir, &sbuf))
- return FALSE;
- }
- else if (strcmp(cmpl_dir->fullname + length - 4, "/../") == 0)
- {
- if(length == 4)
- {
- strcpy(cmpl_dir->fullname, "/");
- cmpl_dir->fullname_len = 1;
- return TRUE;
- }
-
- if(stat(cmpl_dir->fullname, &sbuf) < 0)
- {
- cmpl_errno = errno;
- return FALSE;
- }
-
- cmpl_dir->fullname[length - 3] = 0;
-
- if(!correct_parent(cmpl_dir, &sbuf))
- return FALSE;
- }
-
- cmpl_dir->fullname_len = strlen(cmpl_dir->fullname);
-
- return TRUE;
-}
-
-static gint
-correct_parent(CompletionDir* cmpl_dir, struct stat *sbuf)
-{
- struct stat parbuf;
- gchar *last_slash;
- gchar *new_name;
- gchar c = 0;
-
- last_slash = strrchr(cmpl_dir->fullname, '/');
-
- g_assert(last_slash);
-
- if(last_slash != cmpl_dir->fullname)
- { /* last_slash[0] = 0; */ }
- else
- {
- c = last_slash[1];
- last_slash[1] = 0;
- }
-
- if (stat(cmpl_dir->fullname, &parbuf) < 0)
- {
- cmpl_errno = errno;
- return FALSE;
- }
-
- if (parbuf.st_ino == sbuf->st_ino && parbuf.st_dev == sbuf->st_dev)
- /* it wasn't a link */
- return TRUE;
-
- if(c)
- last_slash[1] = c;
- /* else
- last_slash[0] = '/'; */
-
- /* it was a link, have to figure it out the hard way */
-
- new_name = find_parent_dir_fullname(cmpl_dir->fullname);
-
- if (!new_name)
- return FALSE;
-
- g_free(cmpl_dir->fullname);
-
- cmpl_dir->fullname = new_name;
-
- return TRUE;
-}
-
-static gchar*
-find_parent_dir_fullname(gchar* dirname)
-{
- gchar buffer[MAXPATHLEN];
- gchar buffer2[MAXPATHLEN];
-
- if(!getcwd(buffer, MAXPATHLEN))
- {
- cmpl_errno = errno;
- return NULL;
- }
-
- if(chdir(dirname) != 0 || chdir("..") != 0)
- {
- cmpl_errno = errno;
- return NULL;
- }
-
- if(!getcwd(buffer2, MAXPATHLEN))
- {
- chdir(buffer);
- cmpl_errno = errno;
-
- return NULL;
- }
-
- if(chdir(buffer) != 0)
- {
- cmpl_errno = errno;
- return NULL;
- }
-
- return g_strdup(buffer2);
-}
-
-/**********************************************************************/
-/* Completion Operations */
-/**********************************************************************/
-
-static PossibleCompletion*
-attempt_homedir_completion(gchar* text_to_complete,
- CompletionState *cmpl_state)
-{
- gint index, length;
-
- if (!cmpl_state->user_dir_name_buffer &&
- !get_pwdb(cmpl_state))
- return NULL;
- length = strlen(text_to_complete) - 1;
-
- cmpl_state->user_completion_index += 1;
-
- while(cmpl_state->user_completion_index < cmpl_state->user_directories_len)
- {
- index = first_diff_index(text_to_complete + 1,
- cmpl_state->user_directories
- [cmpl_state->user_completion_index].login);
-
- switch(index)
- {
- case PATTERN_MATCH:
- break;
- default:
- if(cmpl_state->last_valid_char < (index + 1))
- cmpl_state->last_valid_char = index + 1;
- cmpl_state->user_completion_index += 1;
- continue;
- }
-
- cmpl_state->the_completion.is_a_completion = 1;
- cmpl_state->the_completion.is_directory = 1;
-
- append_completion_text("~", cmpl_state);
-
- append_completion_text(cmpl_state->
- user_directories[cmpl_state->user_completion_index].login,
- cmpl_state);
-
- return append_completion_text("/", cmpl_state);
- }
-
- if(text_to_complete[1] ||
- cmpl_state->user_completion_index > cmpl_state->user_directories_len)
- {
- cmpl_state->user_completion_index = -1;
- return NULL;
- }
- else
- {
- cmpl_state->user_completion_index += 1;
- cmpl_state->the_completion.is_a_completion = 1;
- cmpl_state->the_completion.is_directory = 1;
-
- return append_completion_text("~/", cmpl_state);
- }
-}
-
-/* returns the index (>= 0) of the first differing character,
- * PATTERN_MATCH if the completion matches */
-static gint
-first_diff_index(gchar* pat, gchar* text)
-{
- gint diff = 0;
-
- while(*pat && *text && *text == *pat)
- {
- pat += 1;
- text += 1;
- diff += 1;
- }
-
- if(*pat)
- return diff;
-
- return PATTERN_MATCH;
-}
-
-static PossibleCompletion*
-append_completion_text(gchar* text, CompletionState* cmpl_state)
-{
- gint len, i = 1;
-
- if(!cmpl_state->the_completion.text)
- return NULL;
-
- len = strlen(text) + strlen(cmpl_state->the_completion.text) + 1;
-
- if(cmpl_state->the_completion.text_alloc > len)
- {
- strcat(cmpl_state->the_completion.text, text);
- return &cmpl_state->the_completion;
- }
-
- while(i < len) { i <<= 1; }
-
- cmpl_state->the_completion.text_alloc = i;
-
- cmpl_state->the_completion.text = (gchar*)g_realloc(cmpl_state->the_completion.text, i);
-
- if(!cmpl_state->the_completion.text)
- return NULL;
- else
- {
- strcat(cmpl_state->the_completion.text, text);
- return &cmpl_state->the_completion;
- }
-}
-
-static CompletionDir*
-find_completion_dir(gchar* text_to_complete,
- gchar** remaining_text,
- CompletionState* cmpl_state)
-{
- gchar* first_slash = strchr(text_to_complete, '/');
- CompletionDir* dir = cmpl_state->reference_dir;
- *remaining_text = text_to_complete;
-
- while(first_slash)
- {
- gint len = first_slash - *remaining_text;
- gint found = 0;
- gint found_index = -1;
- gint i;
- gchar* pat_buf = g_new (gchar, len + 1);
-
- strncpy(pat_buf, *remaining_text, len);
- pat_buf[len] = 0;
-
- for(i = 0; i < dir->sent->entry_count; i += 1)
- {
- if(dir->sent->entries[i].is_dir &&
- fnmatch(pat_buf, dir->sent->entries[i].entry_name,
- FNMATCH_FLAGS)!= FNM_NOMATCH)
- {
- if(found)
- {
- g_free (pat_buf);
- return dir;
- }
- else
- {
- found = 1;
- found_index = i;
- }
- }
- }
-
- if(found)
- {
- CompletionDir* next = open_relative_dir(dir->sent->entries[found_index].entry_name,
- dir, cmpl_state);
-
- if(!next)
- {
- g_free (pat_buf);
- return NULL;
- }
-
- next->cmpl_parent = dir;
-
- dir = next;
-
- if(!correct_dir_fullname(dir))
- {
- g_free(pat_buf);
- return NULL;
- }
-
- *remaining_text = first_slash + 1;
- first_slash = strchr(*remaining_text, '/');
- }
- else
- {
- g_free (pat_buf);
- return NULL;
- }
-
- g_free (pat_buf);
- }
-
- return dir;
-}
-
-static void
-update_cmpl(PossibleCompletion* poss, CompletionState* cmpl_state)
-{
- gint cmpl_len;
-
- if(!poss || !cmpl_is_a_completion(poss))
- return;
-
- cmpl_len = strlen(cmpl_this_completion(poss));
-
- if(cmpl_state->updated_text_alloc < cmpl_len + 1)
- {
- cmpl_state->updated_text =
- (gchar*)g_realloc(cmpl_state->updated_text,
- cmpl_state->updated_text_alloc);
- cmpl_state->updated_text_alloc = 2*cmpl_len;
- }
-
- if(cmpl_state->updated_text_len < 0)
- {
- strcpy(cmpl_state->updated_text, cmpl_this_completion(poss));
- cmpl_state->updated_text_len = cmpl_len;
- cmpl_state->re_complete = cmpl_is_directory(poss);
- }
- else if(cmpl_state->updated_text_len == 0)
- {
- cmpl_state->re_complete = FALSE;
- }
- else
- {
- gint first_diff =
- first_diff_index(cmpl_state->updated_text,
- cmpl_this_completion(poss));
-
- cmpl_state->re_complete = FALSE;
-
- if(first_diff == PATTERN_MATCH)
- return;
-
- if(first_diff > cmpl_state->updated_text_len)
- strcpy(cmpl_state->updated_text, cmpl_this_completion(poss));
-
- cmpl_state->updated_text_len = first_diff;
- cmpl_state->updated_text[first_diff] = 0;
- }
-}
-
-static PossibleCompletion*
-attempt_file_completion(CompletionState *cmpl_state)
-{
- gchar *pat_buf, *first_slash;
- CompletionDir *dir = cmpl_state->active_completion_dir;
-
- dir->cmpl_index += 1;
-
- if(dir->cmpl_index == dir->sent->entry_count)
- {
- if(dir->cmpl_parent == NULL)
- {
- cmpl_state->active_completion_dir = NULL;
-
- return NULL;
- }
- else
- {
- cmpl_state->active_completion_dir = dir->cmpl_parent;
-
- return attempt_file_completion(cmpl_state);
- }
- }
-
- g_assert(dir->cmpl_text);
-
- first_slash = strchr(dir->cmpl_text, '/');
-
- if(first_slash)
- {
- gint len = first_slash - dir->cmpl_text;
-
- pat_buf = g_new (gchar, len + 1);
- strncpy(pat_buf, dir->cmpl_text, len);
- pat_buf[len] = 0;
- }
- else
- {
- gint len = strlen(dir->cmpl_text);
-
- pat_buf = g_new (gchar, len + 2);
- strcpy(pat_buf, dir->cmpl_text);
- strcpy(pat_buf + len, "*");
- }
-
- if(first_slash)
- {
- if(dir->sent->entries[dir->cmpl_index].is_dir)
- {
- if(fnmatch(pat_buf, dir->sent->entries[dir->cmpl_index].entry_name,
- FNMATCH_FLAGS) != FNM_NOMATCH)
- {
- CompletionDir* new_dir;
-
- new_dir = open_relative_dir(dir->sent->entries[dir->cmpl_index].entry_name,
- dir, cmpl_state);
-
- if(!new_dir)
- {
- g_free (pat_buf);
- return NULL;
- }
-
- new_dir->cmpl_parent = dir;
-
- new_dir->cmpl_index = -1;
- new_dir->cmpl_text = first_slash + 1;
-
- cmpl_state->active_completion_dir = new_dir;
-
- g_free (pat_buf);
- return attempt_file_completion(cmpl_state);
- }
- else
- {
- g_free (pat_buf);
- return attempt_file_completion(cmpl_state);
- }
- }
- else
- {
- g_free (pat_buf);
- return attempt_file_completion(cmpl_state);
- }
- }
- else
- {
- if(dir->cmpl_parent != NULL)
- {
- append_completion_text(dir->fullname +
- strlen(cmpl_state->completion_dir->fullname) + 1,
- cmpl_state);
- append_completion_text("/", cmpl_state);
- }
-
- append_completion_text(dir->sent->entries[dir->cmpl_index].entry_name, cmpl_state);
-
- cmpl_state->the_completion.is_a_completion =
- (fnmatch(pat_buf, dir->sent->entries[dir->cmpl_index].entry_name,
- FNMATCH_FLAGS) != FNM_NOMATCH);
-
- cmpl_state->the_completion.is_directory = dir->sent->entries[dir->cmpl_index].is_dir;
- if(dir->sent->entries[dir->cmpl_index].is_dir)
- append_completion_text("/", cmpl_state);
-
- g_free (pat_buf);
- return &cmpl_state->the_completion;
- }
-}
-
-
-static gint
-get_pwdb(CompletionState* cmpl_state)
-{
- struct passwd *pwd_ptr;
- gchar* buf_ptr, *home_dir = NULL;
- gint len = 0, i, count = 0;
-
- if(cmpl_state->user_dir_name_buffer)
- return TRUE;
- setpwent ();
-
- while ((pwd_ptr = getpwent()) != NULL)
- {
- len += strlen(pwd_ptr->pw_name);
- len += strlen(pwd_ptr->pw_dir);
- len += 2;
- count += 1;
- }
-
- if (!cmpl_state->user_home_dir)
- {
- /* the loser doesn't have $HOME set */
- setpwent ();
-
- pwd_ptr = getpwuid(getuid());
- if(!pwd_ptr)
- {
- cmpl_errno = errno;
- goto error;
- }
- home_dir = pwd_ptr->pw_dir;
-
- len += strlen(home_dir);
- len += 1;
- }
-
- setpwent ();
-
- cmpl_state->user_dir_name_buffer = g_new(gchar, len);
- cmpl_state->user_directories = g_new(CompletionUserDir, count);
- cmpl_state->user_directories_len = count;
-
- buf_ptr = cmpl_state->user_dir_name_buffer;
-
- if (!cmpl_state->user_home_dir)
- {
- strcpy(buf_ptr, home_dir);
- cmpl_state->user_home_dir = buf_ptr;
- buf_ptr += strlen(buf_ptr);
- buf_ptr += 1;
- }
-
- for(i = 0; i < count; i += 1)
- {
- pwd_ptr = getpwent();
- if(!pwd_ptr)
- {
- cmpl_errno = errno;
- goto error;
- }
-
- strcpy(buf_ptr, pwd_ptr->pw_name);
- cmpl_state->user_directories[i].login = buf_ptr;
- buf_ptr += strlen(buf_ptr);
- buf_ptr += 1;
- strcpy(buf_ptr, pwd_ptr->pw_dir);
- cmpl_state->user_directories[i].homedir = buf_ptr;
- buf_ptr += strlen(buf_ptr);
- buf_ptr += 1;
- }
-
- qsort(cmpl_state->user_directories,
- cmpl_state->user_directories_len,
- sizeof(CompletionUserDir),
- compare_user_dir);
-
- endpwent();
-
- return TRUE;
-
-error:
-
- if(cmpl_state->user_dir_name_buffer)
- g_free(cmpl_state->user_dir_name_buffer);
- if(cmpl_state->user_directories)
- g_free(cmpl_state->user_directories);
-
- cmpl_state->user_dir_name_buffer = NULL;
- cmpl_state->user_directories = NULL;
-
- return FALSE;
-}
-
-static gint
-compare_user_dir(const void* a, const void* b)
-{
- return strcmp((((CompletionUserDir*)a))->login,
- (((CompletionUserDir*)b))->login);
-}
-
-static gint
-compare_cmpl_dir(const void* a, const void* b)
-{
- return strcmp((((CompletionDirEntry*)a))->entry_name,
- (((CompletionDirEntry*)b))->entry_name);
-}
-
-static gint
-cmpl_state_okay(CompletionState* cmpl_state)
-{
- return cmpl_state && cmpl_state->reference_dir;
-}
-
-static gchar*
-cmpl_strerror(gint err)
-{
- if(err == CMPL_ERRNO_TOO_LONG)
- return "Name too long";
- else
- return g_strerror (err);
-}
diff --git a/gtk/gtkfilesel.h b/gtk/gtkfilesel.h
deleted file mode 100644
index 797420e168..0000000000
--- a/gtk/gtkfilesel.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_FILESEL_H__
-#define __GTK_FILESEL_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkwindow.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_FILE_SELECTION(obj) GTK_CHECK_CAST (obj, gtk_file_selection_get_type (), GtkFileSelection)
-#define GTK_FILE_SELECTION_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_file_selection_get_type (), GtkFileSelectionClass)
-#define GTK_IS_FILE_SELECTION(obj) GTK_CHECK_TYPE (obj, gtk_file_selection_get_type ())
-
-
-typedef struct _GtkFileSelection GtkFileSelection;
-typedef struct _GtkFileSelectionClass GtkFileSelectionClass;
-
-struct _GtkFileSelection
-{
- GtkWindow window;
-
- GtkWidget *dir_list;
- GtkWidget *file_list;
- GtkWidget *selection_entry;
- GtkWidget *selection_text;
- GtkWidget *main_vbox;
- GtkWidget *ok_button;
- GtkWidget *cancel_button;
- GtkWidget *help_button;
- GtkWidget *history_pulldown;
- GtkWidget *history_menu;
- GList *history_list;
- GtkWidget *fileop_dialog;
- GtkWidget *fileop_entry;
- gchar *fileop_file;
- gpointer cmpl_state;
-
- GtkWidget *fileop_c_dir;
- GtkWidget *fileop_del_file;
- GtkWidget *fileop_ren_file;
-
- GtkWidget *button_area;
- GtkWidget *action_area;
-
-};
-
-struct _GtkFileSelectionClass
-{
- GtkWindowClass parent_class;
-};
-
-
-guint gtk_file_selection_get_type (void);
-GtkWidget* gtk_file_selection_new (const gchar *title);
-void gtk_file_selection_set_filename (GtkFileSelection *filesel,
- const gchar *filename);
-gchar* gtk_file_selection_get_filename (GtkFileSelection *filesel);
-void gtk_file_selection_show_fileop_buttons (GtkFileSelection *filesel);
-void gtk_file_selection_hide_fileop_buttons (GtkFileSelection *filesel);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_FILESEL_H__ */
-
-
-
-
-
-
-
-
-
-
diff --git a/gtk/gtkfixed.c b/gtk/gtkfixed.c
deleted file mode 100644
index 9b304cffc0..0000000000
--- a/gtk/gtkfixed.c
+++ /dev/null
@@ -1,478 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkfixed.h"
-
-
-static void gtk_fixed_class_init (GtkFixedClass *klass);
-static void gtk_fixed_init (GtkFixed *fixed);
-static void gtk_fixed_map (GtkWidget *widget);
-static void gtk_fixed_unmap (GtkWidget *widget);
-static void gtk_fixed_realize (GtkWidget *widget);
-static void gtk_fixed_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_fixed_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_fixed_paint (GtkWidget *widget,
- GdkRectangle *area);
-static void gtk_fixed_draw (GtkWidget *widget,
- GdkRectangle *area);
-static gint gtk_fixed_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static void gtk_fixed_add (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_fixed_remove (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_fixed_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data);
-
-
-static GtkContainerClass *parent_class = NULL;
-
-
-guint
-gtk_fixed_get_type ()
-{
- static guint fixed_type = 0;
-
- if (!fixed_type)
- {
- GtkTypeInfo fixed_info =
- {
- "GtkFixed",
- sizeof (GtkFixed),
- sizeof (GtkFixedClass),
- (GtkClassInitFunc) gtk_fixed_class_init,
- (GtkObjectInitFunc) gtk_fixed_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- fixed_type = gtk_type_unique (gtk_container_get_type (), &fixed_info);
- }
-
- return fixed_type;
-}
-
-static void
-gtk_fixed_class_init (GtkFixedClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GtkObjectClass*) class;
- widget_class = (GtkWidgetClass*) class;
- container_class = (GtkContainerClass*) class;
-
- parent_class = gtk_type_class (gtk_container_get_type ());
-
- widget_class->map = gtk_fixed_map;
- widget_class->unmap = gtk_fixed_unmap;
- widget_class->realize = gtk_fixed_realize;
- widget_class->size_request = gtk_fixed_size_request;
- widget_class->size_allocate = gtk_fixed_size_allocate;
- widget_class->draw = gtk_fixed_draw;
- widget_class->expose_event = gtk_fixed_expose;
-
- container_class->add = gtk_fixed_add;
- container_class->remove = gtk_fixed_remove;
- container_class->foreach = gtk_fixed_foreach;
-}
-
-static void
-gtk_fixed_init (GtkFixed *fixed)
-{
- GTK_WIDGET_UNSET_FLAGS (fixed, GTK_NO_WINDOW);
- GTK_WIDGET_SET_FLAGS (fixed, GTK_BASIC);
-
- fixed->children = NULL;
-}
-
-GtkWidget*
-gtk_fixed_new ()
-{
- GtkFixed *fixed;
-
- fixed = gtk_type_new (gtk_fixed_get_type ());
- return GTK_WIDGET (fixed);
-}
-
-void
-gtk_fixed_put (GtkFixed *fixed,
- GtkWidget *widget,
- gint16 x,
- gint16 y)
-{
- GtkFixedChild *child_info;
-
- g_return_if_fail (fixed != NULL);
- g_return_if_fail (GTK_IS_FIXED (fixed));
- g_return_if_fail (widget != NULL);
-
- child_info = g_new (GtkFixedChild, 1);
- child_info->widget = widget;
- child_info->x = x;
- child_info->y = y;
-
- gtk_widget_set_parent (widget, GTK_WIDGET (fixed));
-
- fixed->children = g_list_append (fixed->children, child_info);
-
- if (GTK_WIDGET_REALIZED (fixed) && !GTK_WIDGET_REALIZED (widget))
- gtk_widget_realize (widget);
-
- if (GTK_WIDGET_MAPPED (fixed) && !GTK_WIDGET_MAPPED (widget))
- gtk_widget_map (widget);
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (fixed))
- gtk_widget_queue_resize (GTK_WIDGET (fixed));
-}
-
-void
-gtk_fixed_move (GtkFixed *fixed,
- GtkWidget *widget,
- gint16 x,
- gint16 y)
-{
- GtkFixedChild *child;
- GList *children;
-
- g_return_if_fail (fixed != NULL);
- g_return_if_fail (GTK_IS_FIXED (fixed));
- g_return_if_fail (widget != NULL);
-
- children = fixed->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (child->widget == widget)
- {
- child->x = x;
- child->y = y;
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (fixed))
- gtk_widget_queue_resize (GTK_WIDGET (fixed));
-
- break;
- }
- }
-}
-
-static void
-gtk_fixed_map (GtkWidget *widget)
-{
- GtkFixed *fixed;
- GtkFixedChild *child;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_FIXED (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
- fixed = GTK_FIXED (widget);
-
- gdk_window_show (widget->window);
-
- children = fixed->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child->widget) &&
- !GTK_WIDGET_MAPPED (child->widget))
- gtk_widget_map (child->widget);
- }
-}
-
-static void
-gtk_fixed_unmap (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_FIXED (widget));
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
-}
-
-static void
-gtk_fixed_realize (GtkWidget *widget)
-{
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_FIXED (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget);
- attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK;
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes,
- attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
-}
-
-static void
-gtk_fixed_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkFixed *fixed;
- GtkFixedChild *child;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_FIXED (widget));
- g_return_if_fail (requisition != NULL);
-
- fixed = GTK_FIXED (widget);
- requisition->width = 0;
- requisition->height = 0;
-
- children = fixed->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child->widget))
- {
- gtk_widget_size_request (child->widget, &child->widget->requisition);
-
- requisition->height = MAX (requisition->height,
- child->y +
- child->widget->requisition.height);
- requisition->width = MAX (requisition->width,
- child->x +
- child->widget->requisition.width);
- }
- }
-
- requisition->height += GTK_CONTAINER (fixed)->border_width * 2;
- requisition->width += GTK_CONTAINER (fixed)->border_width * 2;
-}
-
-static void
-gtk_fixed_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkFixed *fixed;
- GtkFixedChild *child;
- GtkAllocation child_allocation;
- GList *children;
- guint16 border_width;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_FIXED(widget));
- g_return_if_fail (allocation != NULL);
-
- fixed = GTK_FIXED (widget);
-
- widget->allocation = *allocation;
- if (GTK_WIDGET_REALIZED (widget))
- gdk_window_move_resize (widget->window,
- allocation->x,
- allocation->y,
- allocation->width,
- allocation->height);
-
- border_width = GTK_CONTAINER (fixed)->border_width;
-
- children = fixed->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child->widget))
- {
- child_allocation.x = child->x + border_width;
- child_allocation.y = child->y + border_width;
- child_allocation.width = child->widget->requisition.width;
- child_allocation.height = child->widget->requisition.height;
- gtk_widget_size_allocate (child->widget, &child_allocation);
- }
- }
-}
-
-static void
-gtk_fixed_paint (GtkWidget *widget,
- GdkRectangle *area)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_FIXED (widget));
- g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- gdk_window_clear_area (widget->window,
- area->x, area->y,
- area->width, area->height);
-}
-
-static void
-gtk_fixed_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkFixed *fixed;
- GtkFixedChild *child;
- GdkRectangle child_area;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_FIXED (widget));
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- fixed = GTK_FIXED (widget);
- gtk_fixed_paint (widget, area);
-
- children = fixed->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (gtk_widget_intersect (child->widget, area, &child_area))
- gtk_widget_draw (child->widget, &child_area);
- }
- }
-}
-
-static gint
-gtk_fixed_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkFixed *fixed;
- GtkFixedChild *child;
- GdkEventExpose child_event;
- GList *children;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_FIXED (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- fixed = GTK_FIXED (widget);
-
- child_event = *event;
-
- children = fixed->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_NO_WINDOW (child->widget) &&
- gtk_widget_intersect (child->widget, &event->area,
- &child_event.area))
- gtk_widget_event (child->widget, (GdkEvent*) &child_event);
- }
- }
-
- return FALSE;
-}
-
-static void
-gtk_fixed_add (GtkContainer *container,
- GtkWidget *widget)
-{
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_FIXED (container));
- g_return_if_fail (widget != NULL);
-
- gtk_fixed_put (GTK_FIXED (container), widget, 0, 0);
-}
-
-static void
-gtk_fixed_remove (GtkContainer *container,
- GtkWidget *widget)
-{
- GtkFixed *fixed;
- GtkFixedChild *child;
- GList *children;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_FIXED (container));
- g_return_if_fail (widget != NULL);
-
- fixed = GTK_FIXED (container);
-
- children = fixed->children;
- while (children)
- {
- child = children->data;
-
- if (child->widget == widget)
- {
- gtk_widget_unparent (widget);
-
- fixed->children = g_list_remove_link (fixed->children, children);
- g_list_free (children);
- g_free (child);
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (container))
- gtk_widget_queue_resize (GTK_WIDGET (container));
-
- break;
- }
-
- children = children->next;
- }
-}
-
-static void
-gtk_fixed_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
-{
- GtkFixed *fixed;
- GtkFixedChild *child;
- GList *children;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_FIXED (container));
- g_return_if_fail (callback != NULL);
-
- fixed = GTK_FIXED (container);
-
- children = fixed->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- (* callback) (child->widget, callback_data);
- }
-}
diff --git a/gtk/gtkfixed.h b/gtk/gtkfixed.h
deleted file mode 100644
index 08fb9969f8..0000000000
--- a/gtk/gtkfixed.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_FIXED_H__
-#define __GTK_FIXED_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkcontainer.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_FIXED(obj) GTK_CHECK_CAST (obj, gtk_fixed_get_type (), GtkFixed)
-#define GTK_FIXED_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_fixed_get_type (), GtkFixedClass)
-#define GTK_IS_FIXED(obj) GTK_CHECK_TYPE (obj, gtk_fixed_get_type ())
-
-
-typedef struct _GtkFixed GtkFixed;
-typedef struct _GtkFixedClass GtkFixedClass;
-typedef struct _GtkFixedChild GtkFixedChild;
-
-struct _GtkFixed
-{
- GtkContainer container;
-
- GList *children;
-};
-
-struct _GtkFixedClass
-{
- GtkContainerClass parent_class;
-};
-
-struct _GtkFixedChild
-{
- GtkWidget *widget;
- gint16 x;
- gint16 y;
-};
-
-
-guint gtk_fixed_get_type (void);
-GtkWidget* gtk_fixed_new (void);
-void gtk_fixed_put (GtkFixed *fixed,
- GtkWidget *widget,
- gint16 x,
- gint16 y);
-void gtk_fixed_move (GtkFixed *fixed,
- GtkWidget *widget,
- gint16 x,
- gint16 y);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_FIXED_H__ */
diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c
deleted file mode 100644
index d1f5189c3c..0000000000
--- a/gtk/gtkframe.c
+++ /dev/null
@@ -1,505 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <string.h>
-#include "gtkframe.h"
-
-enum {
- ARG_0,
- ARG_LABEL,
- ARG_LABEL_XALIGN,
- ARG_LABEL_YALIGN,
- ARG_SHADOW
-};
-
-
-static void gtk_frame_class_init (GtkFrameClass *klass);
-static void gtk_frame_init (GtkFrame *frame);
-static void gtk_frame_set_arg (GtkFrame *frame,
- GtkArg *arg,
- guint arg_id);
-static void gtk_frame_get_arg (GtkFrame *frame,
- GtkArg *arg,
- guint arg_id);
-static void gtk_frame_finalize (GtkObject *object);
-static void gtk_frame_paint (GtkWidget *widget,
- GdkRectangle *area);
-static void gtk_frame_draw (GtkWidget *widget,
- GdkRectangle *area);
-static gint gtk_frame_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static void gtk_frame_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_frame_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_frame_style_set (GtkWidget *widget,
- GtkStyle *previous_style);
-
-
-static GtkBinClass *parent_class = NULL;
-
-
-guint
-gtk_frame_get_type ()
-{
- static guint frame_type = 0;
-
- if (!frame_type)
- {
- GtkTypeInfo frame_info =
- {
- "GtkFrame",
- sizeof (GtkFrame),
- sizeof (GtkFrameClass),
- (GtkClassInitFunc) gtk_frame_class_init,
- (GtkObjectInitFunc) gtk_frame_init,
- (GtkArgSetFunc) gtk_frame_set_arg,
- (GtkArgGetFunc) gtk_frame_get_arg,
- };
-
- frame_type = gtk_type_unique (gtk_bin_get_type (), &frame_info);
- }
-
- return frame_type;
-}
-
-static void
-gtk_frame_class_init (GtkFrameClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- object_class = (GtkObjectClass*) class;
- widget_class = (GtkWidgetClass*) class;
-
- parent_class = gtk_type_class (gtk_bin_get_type ());
-
- gtk_object_add_arg_type ("GtkFrame::label", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_LABEL);
- gtk_object_add_arg_type ("GtkFrame::label_xalign", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_LABEL_XALIGN);
- gtk_object_add_arg_type ("GtkFrame::label_yalign", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_LABEL_YALIGN);
- gtk_object_add_arg_type ("GtkFrame::shadow", GTK_TYPE_ENUM, GTK_ARG_READWRITE, ARG_SHADOW);
-
- object_class->finalize = gtk_frame_finalize;
-
- widget_class->draw = gtk_frame_draw;
- widget_class->expose_event = gtk_frame_expose;
- widget_class->size_request = gtk_frame_size_request;
- widget_class->size_allocate = gtk_frame_size_allocate;
- widget_class->style_set = gtk_frame_style_set;
-}
-
-static void
-gtk_frame_init (GtkFrame *frame)
-{
- GTK_WIDGET_SET_FLAGS (frame, GTK_BASIC);
-
- frame->label = NULL;
- frame->shadow_type = GTK_SHADOW_ETCHED_IN;
- frame->label_width = 0;
- frame->label_height = 0;
- frame->label_xalign = 0.0;
- frame->label_yalign = 0.5;
-}
-
-static void
-gtk_frame_set_arg (GtkFrame *frame,
- GtkArg *arg,
- guint arg_id)
-{
- switch (arg_id)
- {
- case ARG_LABEL:
- gtk_frame_set_label (frame, GTK_VALUE_STRING (*arg));
- break;
- case ARG_LABEL_XALIGN:
- gtk_frame_set_label_align (frame, GTK_VALUE_DOUBLE (*arg), frame->label_yalign);
- break;
- case ARG_LABEL_YALIGN:
- gtk_frame_set_label_align (frame, frame->label_xalign, GTK_VALUE_DOUBLE (*arg));
- break;
- case ARG_SHADOW:
- gtk_frame_set_shadow_type (frame, GTK_VALUE_ENUM (*arg));
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-gtk_frame_get_arg (GtkFrame *frame,
- GtkArg *arg,
- guint arg_id)
-{
- switch (arg_id)
- {
- case ARG_LABEL:
- GTK_VALUE_STRING (*arg) = g_strdup (frame->label);
- break;
- case ARG_LABEL_XALIGN:
- GTK_VALUE_DOUBLE (*arg) = frame->label_xalign;
- break;
- case ARG_LABEL_YALIGN:
- GTK_VALUE_DOUBLE (*arg) = frame->label_yalign;
- break;
- case ARG_SHADOW:
- GTK_VALUE_ENUM (*arg) = frame->shadow_type;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-GtkWidget*
-gtk_frame_new (const gchar *label)
-{
- GtkFrame *frame;
-
- frame = gtk_type_new (gtk_frame_get_type ());
-
- gtk_frame_set_label (frame, label);
-
- return GTK_WIDGET (frame);
-}
-
-static void
-gtk_frame_style_set (GtkWidget *widget,
- GtkStyle *previous_style)
-{
- GtkFrame *frame;
-
- frame = GTK_FRAME (widget);
-
- if (frame->label)
- {
- frame->label_width = gdk_string_measure (GTK_WIDGET (frame)->style->font, frame->label) + 7;
- frame->label_height = (GTK_WIDGET (frame)->style->font->ascent +
- GTK_WIDGET (frame)->style->font->descent + 1);
- }
-
- if (GTK_WIDGET_CLASS (parent_class)->style_set)
- GTK_WIDGET_CLASS (parent_class)->style_set (widget, previous_style);
-}
-
-void
-gtk_frame_set_label (GtkFrame *frame,
- const gchar *label)
-{
- g_return_if_fail (frame != NULL);
- g_return_if_fail (GTK_IS_FRAME (frame));
-
- if ((label && frame->label && (strcmp (frame->label, label) == 0)) ||
- (!label && !frame->label))
- return;
-
- if (frame->label)
- g_free (frame->label);
- frame->label = NULL;
-
- if (label)
- {
- frame->label = g_strdup (label);
- frame->label_width = gdk_string_measure (GTK_WIDGET (frame)->style->font, frame->label) + 7;
- frame->label_height = (GTK_WIDGET (frame)->style->font->ascent +
- GTK_WIDGET (frame)->style->font->descent + 1);
- }
- else
- {
- frame->label_width = 0;
- frame->label_height = 0;
- }
-
- if (GTK_WIDGET_DRAWABLE (frame))
- {
- GtkWidget *widget;
-
- /* clear the old label area
- */
- widget = GTK_WIDGET (frame);
- gdk_window_clear_area (widget->window,
- widget->allocation.x + GTK_CONTAINER (frame)->border_width,
- widget->allocation.y + GTK_CONTAINER (frame)->border_width,
- widget->allocation.width - GTK_CONTAINER (frame)->border_width,
- widget->allocation.y + frame->label_height);
-
- }
-
- gtk_widget_queue_resize (GTK_WIDGET (frame));
-}
-
-void
-gtk_frame_set_label_align (GtkFrame *frame,
- gfloat xalign,
- gfloat yalign)
-{
- g_return_if_fail (frame != NULL);
- g_return_if_fail (GTK_IS_FRAME (frame));
-
- xalign = CLAMP (xalign, 0.0, 1.0);
- yalign = CLAMP (yalign, 0.0, 1.0);
-
- if ((xalign != frame->label_xalign) || (yalign != frame->label_yalign))
- {
- frame->label_xalign = xalign;
- frame->label_yalign = yalign;
-
- if (GTK_WIDGET_DRAWABLE (frame))
- {
- GtkWidget *widget;
-
- /* clear the old label area
- */
- widget = GTK_WIDGET (frame);
- gdk_window_clear_area (widget->window,
- widget->allocation.x + GTK_CONTAINER (frame)->border_width,
- widget->allocation.y + GTK_CONTAINER (frame)->border_width,
- widget->allocation.width - GTK_CONTAINER (frame)->border_width,
- widget->allocation.y + frame->label_height);
-
- }
- gtk_widget_queue_resize (GTK_WIDGET (frame));
- }
-}
-
-void
-gtk_frame_set_shadow_type (GtkFrame *frame,
- GtkShadowType type)
-{
- g_return_if_fail (frame != NULL);
- g_return_if_fail (GTK_IS_FRAME (frame));
-
- if ((GtkShadowType) frame->shadow_type != type)
- {
- frame->shadow_type = type;
-
- if (GTK_WIDGET_DRAWABLE (frame))
- {
- gdk_window_clear_area (GTK_WIDGET (frame)->window,
- GTK_WIDGET (frame)->allocation.x,
- GTK_WIDGET (frame)->allocation.y,
- GTK_WIDGET (frame)->allocation.width,
- GTK_WIDGET (frame)->allocation.height);
- }
- gtk_widget_queue_resize (GTK_WIDGET (frame));
- }
-}
-
-
-static void
-gtk_frame_finalize (GtkObject *object)
-{
- GtkFrame *frame;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_FRAME (object));
-
- frame = GTK_FRAME (object);
-
- if (frame->label)
- g_free (frame->label);
-
- (* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-static void
-gtk_frame_paint (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkFrame *frame;
- gint height_extra;
- gint label_area_width;
- gint x, y;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_FRAME (widget));
- g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- frame = GTK_FRAME (widget);
-
- height_extra = frame->label_height - widget->style->klass->xthickness;
- height_extra = MAX (height_extra, 0);
-
- x = GTK_CONTAINER (frame)->border_width;
- y = GTK_CONTAINER (frame)->border_width;
-
- gtk_draw_shadow (widget->style, widget->window,
- GTK_STATE_NORMAL, frame->shadow_type,
- widget->allocation.x + x,
- widget->allocation.y + y + height_extra / 2,
- widget->allocation.width - x * 2,
- widget->allocation.height - y * 2 - height_extra / 2);
-
- if (frame->label)
- {
- label_area_width = (widget->allocation.width -
- GTK_CONTAINER (frame)->border_width * 2 -
- widget->style->klass->xthickness * 2);
-
- x = ((label_area_width - frame->label_width) * frame->label_xalign +
- GTK_CONTAINER (frame)->border_width + widget->style->klass->xthickness);
- y = (GTK_CONTAINER (frame)->border_width + widget->style->font->ascent);
-
- gdk_window_clear_area (widget->window,
- widget->allocation.x + x + 2,
- widget->allocation.y + GTK_CONTAINER (frame)->border_width,
- frame->label_width - 4,
- frame->label_height);
- gtk_draw_string (widget->style, widget->window, GTK_WIDGET_STATE (widget),
- widget->allocation.x + x + 3,
- widget->allocation.y + y,
- frame->label);
- }
- }
-}
-
-static void
-gtk_frame_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkBin *bin;
- GdkRectangle child_area;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_FRAME (widget));
- g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- bin = GTK_BIN (widget);
-
- gtk_frame_paint (widget, area);
-
- if (bin->child && gtk_widget_intersect (bin->child, area, &child_area))
- gtk_widget_draw (bin->child, &child_area);
- }
-}
-
-static gint
-gtk_frame_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkBin *bin;
- GdkEventExpose child_event;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_FRAME (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- bin = GTK_BIN (widget);
-
- gtk_frame_paint (widget, &event->area);
-
- child_event = *event;
- if (bin->child &&
- GTK_WIDGET_NO_WINDOW (bin->child) &&
- gtk_widget_intersect (bin->child, &event->area, &child_event.area))
- gtk_widget_event (bin->child, (GdkEvent*) &child_event);
- }
-
- return FALSE;
-}
-
-static void
-gtk_frame_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkFrame *frame;
- GtkBin *bin;
- gint tmp_height;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_FRAME (widget));
- g_return_if_fail (requisition != NULL);
-
- frame = GTK_FRAME (widget);
- bin = GTK_BIN (widget);
-
- requisition->width = (GTK_CONTAINER (widget)->border_width +
- GTK_WIDGET (widget)->style->klass->xthickness) * 2;
-
- tmp_height = frame->label_height - GTK_WIDGET (widget)->style->klass->ythickness;
- tmp_height = MAX (tmp_height, 0);
-
- requisition->height = tmp_height + (GTK_CONTAINER (widget)->border_width +
- GTK_WIDGET (widget)->style->klass->ythickness) * 2;
-
- if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
- {
- gtk_widget_size_request (bin->child, &bin->child->requisition);
-
- requisition->width += MAX (bin->child->requisition.width, frame->label_width);
- requisition->height += bin->child->requisition.height;
- }
- else
- {
- requisition->width += frame->label_width;
- }
-}
-
-static void
-gtk_frame_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkFrame *frame;
- GtkBin *bin;
- GtkAllocation child_allocation;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_FRAME (widget));
- g_return_if_fail (allocation != NULL);
-
- frame = GTK_FRAME (widget);
- bin = GTK_BIN (widget);
-
- if (GTK_WIDGET_MAPPED (widget) &&
- ((widget->allocation.x != allocation->x) ||
- (widget->allocation.y != allocation->y) ||
- (widget->allocation.width != allocation->width) ||
- (widget->allocation.height != allocation->height)) &&
- (widget->allocation.width != 0) &&
- (widget->allocation.height != 0))
- gdk_window_clear_area (widget->window,
- widget->allocation.x,
- widget->allocation.y,
- widget->allocation.width,
- widget->allocation.height);
-
- widget->allocation = *allocation;
-
- if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
- {
- child_allocation.x = (GTK_CONTAINER (frame)->border_width +
- GTK_WIDGET (frame)->style->klass->xthickness);
- child_allocation.width = MAX(0, allocation->width - child_allocation.x * 2);
-
- child_allocation.y = (GTK_CONTAINER (frame)->border_width +
- MAX (frame->label_height, GTK_WIDGET (frame)->style->klass->ythickness));
- child_allocation.height = MAX (0, (allocation->height - child_allocation.y -
- GTK_CONTAINER (frame)->border_width -
- GTK_WIDGET (frame)->style->klass->ythickness));
-
- child_allocation.x += allocation->x;
- child_allocation.y += allocation->y;
-
- gtk_widget_size_allocate (bin->child, &child_allocation);
- }
-}
diff --git a/gtk/gtkframe.h b/gtk/gtkframe.h
deleted file mode 100644
index 3fe17a3cbd..0000000000
--- a/gtk/gtkframe.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_FRAME_H__
-#define __GTK_FRAME_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkbin.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_FRAME(obj) GTK_CHECK_CAST (obj, gtk_frame_get_type (), GtkFrame)
-#define GTK_FRAME_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_frame_get_type (), GtkFrameClass)
-#define GTK_IS_FRAME(obj) GTK_CHECK_TYPE (obj, gtk_frame_get_type ())
-
-
-typedef struct _GtkFrame GtkFrame;
-typedef struct _GtkFrameClass GtkFrameClass;
-
-struct _GtkFrame
-{
- GtkBin bin;
-
- gchar *label;
- gint16 shadow_type;
- gint16 label_width;
- gint16 label_height;
- gfloat label_xalign;
- gfloat label_yalign;
-};
-
-struct _GtkFrameClass
-{
- GtkBinClass parent_class;
-};
-
-
-guint gtk_frame_get_type (void);
-GtkWidget* gtk_frame_new (const gchar *label);
-void gtk_frame_set_label (GtkFrame *frame,
- const gchar *label);
-void gtk_frame_set_label_align (GtkFrame *frame,
- gfloat xalign,
- gfloat yalign);
-void gtk_frame_set_shadow_type (GtkFrame *frame,
- GtkShadowType type);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_FRAME_H__ */
diff --git a/gtk/gtkgamma.c b/gtk/gtkgamma.c
deleted file mode 100644
index cfad6cc8b8..0000000000
--- a/gtk/gtkgamma.c
+++ /dev/null
@@ -1,466 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1997 David Mosberger
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "gtkgamma.h"
-#include "gtkcurve.h"
-#include "gtkdialog.h"
-#include "gtkdrawingarea.h"
-#include "gtkentry.h"
-#include "gtkhbox.h"
-#include "gtklabel.h"
-#include "gtkmain.h"
-#include "gtkpixmap.h"
-#include "gtkradiobutton.h"
-#include "gtksignal.h"
-#include "gtktable.h"
-#include "gtkvbox.h"
-#include "gtkwindow.h"
-
-static GtkVBoxClass *parent_class = NULL;
-
-
-/* forward declarations: */
-static void gtk_gamma_curve_class_init (GtkGammaCurveClass *class);
-static void gtk_gamma_curve_init (GtkGammaCurve *curve);
-static void gtk_gamma_curve_destroy (GtkObject *object);
-
-enum
- {
- LINEAR = 0,
- SPLINE,
- FREE,
- GAMMA,
- RESET,
- NUM_XPMS
- };
-
-static char *xpm[][27] =
- {
- /* spline: */
- {
- /* width height ncolors chars_per_pixel */
- "16 16 4 1",
- /* colors */
- ". c None",
- "B c #000000",
- "+ c #BC2D2D",
- "r c #FF0000",
- /* pixels */
- "..............BB",
- ".........rrrrrrB",
- ".......rr.......",
- ".....B+.........",
- "....BBB.........",
- "....+B..........",
- "....r...........",
- "...r............",
- "...r............",
- "..r.............",
- "..r.............",
- ".r..............",
- ".r..............",
- ".r..............",
- "B+..............",
- "BB.............."
- },
- /* linear: */
- {
- /* width height ncolors chars_per_pixel */
- "16 16 5 1",
- /* colors */
- ". c None", /* transparent */
- "B c #000000",
- "' c #7F7F7F",
- "+ c #824141",
- "r c #FF0000",
- /* pixels */
- "..............BB",
- "..............+B",
- "..............r.",
- ".............r..",
- ".............r..",
- "....'B'.....r...",
- "....BBB.....r...",
- "....+B+....r....",
- "....r.r....r....",
- "...r...r..r.....",
- "...r...r..r.....",
- "..r.....rB+.....",
- "..r.....BBB.....",
- ".r......'B'.....",
- "B+..............",
- "BB.............."
- },
- /* free: */
- {
- /* width height ncolors chars_per_pixel */
- "16 16 2 1",
- /* colors */
- ". c None",
- "r c #FF0000",
- /* pixels */
- "................",
- "................",
- "......r.........",
- "......r.........",
- ".......r........",
- ".......r........",
- ".......r........",
- "........r.......",
- "........r.......",
- "........r.......",
- ".....r...r.rrrrr",
- "....r....r......",
- "...r.....r......",
- "..r.......r.....",
- ".r........r.....",
- "r..............."
- },
- /* gamma: */
- {
- /* width height ncolors chars_per_pixel */
- "16 16 10 1",
- /* colors */
- ". c None",
- "B c #000000",
- "& c #171717",
- "# c #2F2F2F",
- "X c #464646",
- "= c #5E5E5E",
- "/ c #757575",
- "+ c #8C8C8C",
- "- c #A4A4A4",
- "` c #BBBBBB",
- /* pixels */
- "................",
- "................",
- "................",
- "....B=..+B+.....",
- "....X&`./&-.....",
- "...../+.XX......",
- "......B.B+......",
- "......X.X.......",
- "......X&+.......",
- "......-B........",
- "....../=........",
- "......#B........",
- "......BB........",
- "......B#........",
- "................",
- "................"
- },
- /* reset: */
- {
- /* width height ncolors chars_per_pixel */
- "16 16 4 1",
- /* colors */
- ". c None",
- "B c #000000",
- "+ c #824141",
- "r c #FF0000",
- /* pixels */
- "..............BB",
- "..............+B",
- ".............r..",
- "............r...",
- "...........r....",
- "..........r.....",
- ".........r......",
- "........r.......",
- ".......r........",
- "......r.........",
- ".....r..........",
- "....r...........",
- "...r............",
- "..r.............",
- "B+..............",
- "BB.............."
- }
- };
-
-guint
-gtk_gamma_curve_get_type (void)
-{
- static guint gamma_curve_type = 0;
-
- if (!gamma_curve_type)
- {
- GtkTypeInfo gamma_curve_info =
- {
- "GtkGammaCurve",
- sizeof (GtkGammaCurve),
- sizeof (GtkGammaCurveClass),
- (GtkClassInitFunc) gtk_gamma_curve_class_init,
- (GtkObjectInitFunc) gtk_gamma_curve_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- gamma_curve_type =
- gtk_type_unique (gtk_vbox_get_type (), &gamma_curve_info);
- }
- return gamma_curve_type;
-}
-
-static void
-gtk_gamma_curve_class_init (GtkGammaCurveClass *class)
-{
- GtkObjectClass *object_class;
-
- parent_class = gtk_type_class (gtk_vbox_get_type ());
-
- object_class = (GtkObjectClass *) class;
- object_class->destroy = gtk_gamma_curve_destroy;
-}
-
-static void
-gtk_gamma_curve_init (GtkGammaCurve *curve)
-{
- curve->gamma = 1.0;
-}
-
-static void
-button_realize_callback (GtkWidget *w)
-{
- GtkWidget *pixmap;
- GdkBitmap *mask;
- GdkPixmap *pm;
- int i;
-
- i = (long) gtk_object_get_data (GTK_OBJECT (w), "_GtkGammaCurveIndex");
- pm = gdk_pixmap_create_from_xpm_d (w->window, &mask,
- &w->style->bg[GTK_STATE_NORMAL], xpm[i]);
-
- pixmap = gtk_pixmap_new (pm, mask);
- gtk_container_add (GTK_CONTAINER (w), pixmap);
- gtk_widget_show (pixmap);
-
- gdk_pixmap_unref (pm);
- gdk_bitmap_unref (mask); /* a bitmap is really just a special pixmap */
-}
-
-static void
-button_toggled_callback (GtkWidget *w, gpointer data)
-{
- GtkGammaCurve *c = data;
- GtkCurveType type;
- int active, i;
-
- if (!GTK_TOGGLE_BUTTON (w)->active)
- return;
-
- active = (long) gtk_object_get_data (GTK_OBJECT (w), "_GtkGammaCurveIndex");
-
- for (i = 0; i < 3; ++i)
- if ((i != active) && GTK_TOGGLE_BUTTON (c->button[i])->active)
- break;
-
- if (i < 3)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (c->button[i]), FALSE);
-
- switch (active)
- {
- case 0: type = GTK_CURVE_TYPE_SPLINE; break;
- case 1: type = GTK_CURVE_TYPE_LINEAR; break;
- default: type = GTK_CURVE_TYPE_FREE; break;
- }
- gtk_curve_set_curve_type (GTK_CURVE (c->curve), type);
-}
-
-static void
-gamma_cancel_callback (GtkWidget *w, gpointer data)
-{
- GtkGammaCurve *c = data;
-
- gtk_widget_destroy (c->gamma_dialog);
- c->gamma_dialog = 0;
-}
-
-static void
-gamma_ok_callback (GtkWidget *w, gpointer data)
-{
- GtkGammaCurve *c = data;
- gchar *start, *end;
- gfloat v;
-
- start = gtk_entry_get_text (GTK_ENTRY (c->gamma_text));
- if (start)
- {
- v = strtod (start, &end);
- if (end > start && v > 0.0)
- c->gamma = v;
- }
- gtk_curve_set_gamma (GTK_CURVE (c->curve), c->gamma);
- gamma_cancel_callback (w, data);
-}
-
-static void
-button_clicked_callback (GtkWidget *w, gpointer data)
-{
- GtkGammaCurve *c = data;
- int active;
-
- active = (long) gtk_object_get_data (GTK_OBJECT (w), "_GtkGammaCurveIndex");
- if (active == 3)
- {
- /* set gamma */
- if (c->gamma_dialog)
- return;
- else
- {
- GtkWidget *vbox, *hbox, *label, *button;
- gchar buf[64];
-
- c->gamma_dialog = gtk_dialog_new ();
- gtk_window_set_title (GTK_WINDOW (c->gamma_dialog), "Gamma");
- vbox = GTK_DIALOG (c->gamma_dialog)->vbox;
-
- hbox = gtk_hbox_new (/* homogeneous */ FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 2);
- gtk_widget_show (hbox);
-
- label = gtk_label_new ("Gamma value");
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2);
- gtk_widget_show (label);
-
- sprintf (buf, "%g", c->gamma);
- c->gamma_text = gtk_entry_new ();
- gtk_entry_set_text (GTK_ENTRY (c->gamma_text), buf);
- gtk_box_pack_start (GTK_BOX (hbox), c->gamma_text, TRUE, TRUE, 2);
- gtk_widget_show (c->gamma_text);
-
- /* fill in action area: */
- hbox = GTK_DIALOG (c->gamma_dialog)->action_area;
-
- button = gtk_button_new_with_label ("OK");
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) gamma_ok_callback, c);
- gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Cancel");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) gamma_cancel_callback, c);
- gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- gtk_widget_show (c->gamma_dialog);
- }
- }
- else
- {
- /* reset */
- gtk_curve_reset (GTK_CURVE (c->curve));
- }
-}
-
-static void
-curve_type_changed_callback (GtkWidget *w, gpointer data)
-{
- GtkGammaCurve *c = data;
- GtkCurveType new_type;
- int active;
-
- new_type = GTK_CURVE (w)->curve_type;
- switch (new_type)
- {
- case GTK_CURVE_TYPE_SPLINE: active = 0; break;
- case GTK_CURVE_TYPE_LINEAR: active = 1; break;
- default: active = 2; break;
- }
- if (!GTK_TOGGLE_BUTTON (c->button[active])->active)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (c->button[active]), TRUE);
-}
-
-GtkWidget*
-gtk_gamma_curve_new (void)
-{
- GtkGammaCurve *c;
- GtkWidget *vbox;
- int i;
-
- c = gtk_type_new (gtk_gamma_curve_get_type ());
-
- c->table = gtk_table_new (1, 2, FALSE);
- gtk_table_set_col_spacings (GTK_TABLE (c->table), 3);
- gtk_container_add (GTK_CONTAINER (c), c->table);
-
- c->curve = gtk_curve_new ();
- gtk_signal_connect (GTK_OBJECT (c->curve), "curve_type_changed",
- (GtkSignalFunc) curve_type_changed_callback, c);
- gtk_table_attach_defaults (GTK_TABLE (c->table), c->curve, 0, 1, 0, 1);
-
- vbox = gtk_vbox_new (/* homogeneous */ FALSE, /* spacing */ 3);
- gtk_table_attach (GTK_TABLE (c->table), vbox, 1, 2, 0, 1, 0, 0, 0, 0);
-
- /* toggle buttons: */
- for (i = 0; i < 3; ++i)
- {
- c->button[i] = gtk_toggle_button_new ();
- gtk_object_set_data (GTK_OBJECT (c->button[i]), "_GtkGammaCurveIndex",
- (gpointer) (long) i);
- gtk_container_add (GTK_CONTAINER (vbox), c->button[i]);
- gtk_signal_connect (GTK_OBJECT (c->button[i]), "realize",
- (GtkSignalFunc) button_realize_callback, 0);
- gtk_signal_connect (GTK_OBJECT (c->button[i]), "toggled",
- (GtkSignalFunc) button_toggled_callback, c);
- gtk_widget_show (c->button[i]);
- }
-
- /* push buttons: */
- for (i = 3; i < 5; ++i)
- {
- c->button[i] = gtk_button_new ();
- gtk_object_set_data (GTK_OBJECT (c->button[i]), "_GtkGammaCurveIndex",
- (gpointer) (long) i);
- gtk_container_add (GTK_CONTAINER (vbox), c->button[i]);
- gtk_signal_connect (GTK_OBJECT (c->button[i]), "realize",
- (GtkSignalFunc) button_realize_callback, 0);
- gtk_signal_connect (GTK_OBJECT (c->button[i]), "clicked",
- (GtkSignalFunc) button_clicked_callback, c);
- gtk_widget_show (c->button[i]);
- }
-
- gtk_widget_show (vbox);
- gtk_widget_show (c->table);
- gtk_widget_show (c->curve);
-
- return GTK_WIDGET (c);
-}
-
-static void
-gtk_gamma_curve_destroy (GtkObject *object)
-{
- GtkGammaCurve *c;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_GAMMA_CURVE (object));
-
- c = GTK_GAMMA_CURVE (object);
-
- if (c->gamma_dialog)
- gtk_widget_destroy (c->gamma_dialog);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
diff --git a/gtk/gtkgamma.h b/gtk/gtkgamma.h
deleted file mode 100644
index 872a7bd438..0000000000
--- a/gtk/gtkgamma.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1997 David Mosberger
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_GAMMA_CURVE_H__
-#define __GTK_GAMMA_CURVE_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkvbox.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_GAMMA_CURVE(obj) \
- GTK_CHECK_CAST (obj, gtk_gamma_curve_get_type (), GtkGammaCurve)
-#define GTK_GAMMA_CURVE_CLASS(klass) \
- GTK_CHECK_CLASS_CAST (klass, gtk_gamma_curve_get_type, GtkGammaCurveClass)
-#define GTK_IS_GAMMA_CURVE(obj) \
- GTK_CHECK_TYPE (obj, gtk_gamma_curve_get_type ())
-
-
-typedef struct _GtkGammaCurve GtkGammaCurve;
-typedef struct _GtkGammaCurveClass GtkGammaCurveClass;
-
-
-struct _GtkGammaCurve
-{
- GtkVBox vbox;
-
- GtkWidget *table;
- GtkWidget *curve;
- GtkWidget *button[5]; /* spline, linear, free, gamma, reset */
-
- gfloat gamma;
- GtkWidget *gamma_dialog;
- GtkWidget *gamma_text;
-};
-
-struct _GtkGammaCurveClass
-{
- GtkVBoxClass parent_class;
-};
-
-
-guint gtk_gamma_curve_get_type (void);
-GtkWidget* gtk_gamma_curve_new (void);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_GAMMA_CURVE_H__ */
diff --git a/gtk/gtkgc.c b/gtk/gtkgc.c
deleted file mode 100644
index c9da069844..0000000000
--- a/gtk/gtkgc.c
+++ /dev/null
@@ -1,382 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkgc.h"
-
-
-typedef struct _GtkGCKey GtkGCKey;
-typedef struct _GtkGCDrawable GtkGCDrawable;
-
-struct _GtkGCKey
-{
- gint depth;
- GdkColormap *colormap;
- GdkGCValues values;
- GdkGCValuesMask mask;
-};
-
-struct _GtkGCDrawable
-{
- gint depth;
- GdkPixmap *drawable;
-};
-
-
-static void gtk_gc_init (void);
-static GtkGCKey* gtk_gc_key_dup (GtkGCKey *key);
-static void gtk_gc_key_destroy (GtkGCKey *key);
-static gpointer gtk_gc_new (gpointer key);
-static void gtk_gc_destroy (gpointer value);
-static guint gtk_gc_key_hash (gpointer key);
-static guint gtk_gc_value_hash (gpointer value);
-static gint gtk_gc_key_compare (gpointer a,
- gpointer b);
-static guint gtk_gc_drawable_hash (GtkGCDrawable *d);
-static gint gtk_gc_drawable_compare (GtkGCDrawable *a,
- GtkGCDrawable *b);
-
-
-static gint initialize = TRUE;
-static GCache *gc_cache = NULL;
-static GHashTable *gc_drawable_ht = NULL;
-
-static GMemChunk *key_mem_chunk = NULL;
-
-
-GdkGC*
-gtk_gc_get (gint depth,
- GdkColormap *colormap,
- GdkGCValues *values,
- GdkGCValuesMask values_mask)
-{
- GtkGCKey key;
- GdkGC *gc;
-
- if (initialize)
- gtk_gc_init ();
-
- key.depth = depth;
- key.colormap = colormap;
- key.values = *values;
- key.mask = values_mask;
-
- gc = g_cache_insert (gc_cache, &key);
-
- return gc;
-}
-
-void
-gtk_gc_release (GdkGC *gc)
-{
- if (initialize)
- gtk_gc_init ();
-
- g_cache_remove (gc_cache, gc);
-}
-
-
-static void
-gtk_gc_init ()
-{
- initialize = FALSE;
-
- gc_cache = g_cache_new ((GCacheNewFunc) gtk_gc_new,
- (GCacheDestroyFunc) gtk_gc_destroy,
- (GCacheDupFunc) gtk_gc_key_dup,
- (GCacheDestroyFunc) gtk_gc_key_destroy,
- (GHashFunc) gtk_gc_key_hash,
- (GHashFunc) gtk_gc_value_hash,
- (GCompareFunc) gtk_gc_key_compare);
-
- gc_drawable_ht = g_hash_table_new ((GHashFunc) gtk_gc_drawable_hash,
- (GCompareFunc) gtk_gc_drawable_compare);
-}
-
-static GtkGCKey*
-gtk_gc_key_dup (GtkGCKey *key)
-{
- GtkGCKey *new_key;
-
- if (!key_mem_chunk)
- key_mem_chunk = g_mem_chunk_new ("key mem chunk", sizeof (GtkGCKey),
- 1024, G_ALLOC_AND_FREE);
-
- new_key = g_chunk_new (GtkGCKey, key_mem_chunk);
-
- *new_key = *key;
-
- return new_key;
-}
-
-static void
-gtk_gc_key_destroy (GtkGCKey *key)
-{
- g_mem_chunk_free (key_mem_chunk, key);
-}
-
-static gpointer
-gtk_gc_new (gpointer key)
-{
- GtkGCKey *keyval;
- GtkGCDrawable *drawable;
- GdkGC *gc;
-
- keyval = key;
-
- drawable = g_hash_table_lookup (gc_drawable_ht, &keyval->depth);
- if (!drawable)
- {
- drawable = g_new (GtkGCDrawable, 1);
- drawable->depth = keyval->depth;
- drawable->drawable = gdk_pixmap_new (NULL, 1, 1, drawable->depth);
-
- g_hash_table_insert (gc_drawable_ht, &drawable->depth, drawable);
- }
-
- gc = gdk_gc_new_with_values (drawable->drawable, &keyval->values, keyval->mask);
-
- return (gpointer) gc;
-}
-
-static void
-gtk_gc_destroy (gpointer value)
-{
- gdk_gc_destroy ((GdkGC*) value);
-}
-
-static guint
-gtk_gc_key_hash (gpointer key)
-{
- GtkGCKey *keyval;
- guint hash_val;
-
- keyval = key;
- hash_val = 0;
-
- if (keyval->mask & GDK_GC_FOREGROUND)
- {
- hash_val += keyval->values.foreground.pixel;
- }
- if (keyval->mask & GDK_GC_BACKGROUND)
- {
- hash_val += keyval->values.background.pixel;
- }
- if (keyval->mask & GDK_GC_FONT)
- {
- hash_val += gdk_font_id (keyval->values.font);
- }
- if (keyval->mask & GDK_GC_FUNCTION)
- {
- hash_val += (gint) keyval->values.function;
- }
- if (keyval->mask & GDK_GC_FILL)
- {
- hash_val += (gint) keyval->values.fill;
- }
- if (keyval->mask & GDK_GC_TILE)
- {
- hash_val += (glong) keyval->values.tile;
- }
- if (keyval->mask & GDK_GC_STIPPLE)
- {
- hash_val += (glong) keyval->values.stipple;
- }
- if (keyval->mask & GDK_GC_CLIP_MASK)
- {
- hash_val += (glong) keyval->values.clip_mask;
- }
- if (keyval->mask & GDK_GC_SUBWINDOW)
- {
- hash_val += (gint) keyval->values.subwindow_mode;
- }
- if (keyval->mask & GDK_GC_TS_X_ORIGIN)
- {
- hash_val += (gint) keyval->values.ts_x_origin;
- }
- if (keyval->mask & GDK_GC_TS_Y_ORIGIN)
- {
- hash_val += (gint) keyval->values.ts_y_origin;
- }
- if (keyval->mask & GDK_GC_CLIP_X_ORIGIN)
- {
- hash_val += (gint) keyval->values.clip_x_origin;
- }
- if (keyval->mask & GDK_GC_CLIP_Y_ORIGIN)
- {
- hash_val += (gint) keyval->values.clip_y_origin;
- }
- if (keyval->mask & GDK_GC_EXPOSURES)
- {
- hash_val += (gint) keyval->values.graphics_exposures;
- }
- if (keyval->mask & GDK_GC_LINE_WIDTH)
- {
- hash_val += (gint) keyval->values.line_width;
- }
- if (keyval->mask & GDK_GC_LINE_STYLE)
- {
- hash_val += (gint) keyval->values.line_style;
- }
- if (keyval->mask & GDK_GC_CAP_STYLE)
- {
- hash_val += (gint) keyval->values.cap_style;
- }
- if (keyval->mask & GDK_GC_JOIN_STYLE)
- {
- hash_val += (gint) keyval->values.join_style;
- }
-
- return hash_val;
-}
-
-static guint
-gtk_gc_value_hash (gpointer value)
-{
- return (gulong) value;
-}
-
-static gint
-gtk_gc_key_compare (gpointer a,
- gpointer b)
-{
- GtkGCKey *akey;
- GtkGCKey *bkey;
- GdkGCValues *avalues;
- GdkGCValues *bvalues;
-
- akey = a;
- bkey = b;
-
- avalues = &akey->values;
- bvalues = &bkey->values;
-
- if (akey->mask != bkey->mask)
- return FALSE;
-
- if (akey->depth != bkey->depth)
- return FALSE;
-
- if (akey->colormap != bkey->colormap)
- return FALSE;
-
- if (akey->mask & GDK_GC_FOREGROUND)
- {
- if (avalues->foreground.pixel != bvalues->foreground.pixel)
- return FALSE;
- }
- if (akey->mask & GDK_GC_BACKGROUND)
- {
- if (avalues->background.pixel != bvalues->background.pixel)
- return FALSE;
- }
- if (akey->mask & GDK_GC_FONT)
- {
- if (!gdk_font_equal (avalues->font, bvalues->font))
- return FALSE;
- }
- if (akey->mask & GDK_GC_FUNCTION)
- {
- if (avalues->function != bvalues->function)
- return FALSE;
- }
- if (akey->mask & GDK_GC_FILL)
- {
- if (avalues->fill != bvalues->fill)
- return FALSE;
- }
- if (akey->mask & GDK_GC_TILE)
- {
- if (avalues->tile != bvalues->tile)
- return FALSE;
- }
- if (akey->mask & GDK_GC_STIPPLE)
- {
- if (avalues->stipple != bvalues->stipple)
- return FALSE;
- }
- if (akey->mask & GDK_GC_CLIP_MASK)
- {
- if (avalues->clip_mask != bvalues->clip_mask)
- return FALSE;
- }
- if (akey->mask & GDK_GC_SUBWINDOW)
- {
- if (avalues->subwindow_mode != bvalues->subwindow_mode)
- return FALSE;
- }
- if (akey->mask & GDK_GC_TS_X_ORIGIN)
- {
- if (avalues->ts_x_origin != bvalues->ts_x_origin)
- return FALSE;
- }
- if (akey->mask & GDK_GC_TS_Y_ORIGIN)
- {
- if (avalues->ts_y_origin != bvalues->ts_y_origin)
- return FALSE;
- }
- if (akey->mask & GDK_GC_CLIP_X_ORIGIN)
- {
- if (avalues->clip_x_origin != bvalues->clip_x_origin)
- return FALSE;
- }
- if (akey->mask & GDK_GC_CLIP_Y_ORIGIN)
- {
- if (avalues->clip_y_origin != bvalues->clip_y_origin)
- return FALSE;
- }
- if (akey->mask & GDK_GC_EXPOSURES)
- {
- if (avalues->graphics_exposures != bvalues->graphics_exposures)
- return FALSE;
- }
- if (akey->mask & GDK_GC_LINE_WIDTH)
- {
- if (avalues->line_width != bvalues->line_width)
- return FALSE;
- }
- if (akey->mask & GDK_GC_LINE_STYLE)
- {
- if (avalues->line_style != bvalues->line_style)
- return FALSE;
- }
- if (akey->mask & GDK_GC_CAP_STYLE)
- {
- if (avalues->cap_style != bvalues->cap_style)
- return FALSE;
- }
- if (akey->mask & GDK_GC_JOIN_STYLE)
- {
- if (avalues->join_style != bvalues->join_style)
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-static guint
-gtk_gc_drawable_hash (GtkGCDrawable *d)
-{
- return d->depth;
-}
-
-static gint
-gtk_gc_drawable_compare (GtkGCDrawable *a,
- GtkGCDrawable *b)
-{
- return (a->depth == b->depth);
-}
diff --git a/gtk/gtkgc.h b/gtk/gtkgc.h
deleted file mode 100644
index ff4ecc466c..0000000000
--- a/gtk/gtkgc.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_GC_H__
-#define __GTK_GC_H__
-
-
-#include <gdk/gdk.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-GdkGC* gtk_gc_get (gint depth,
- GdkColormap *colormap,
- GdkGCValues *values,
- GdkGCValuesMask values_mask);
-void gtk_gc_release (GdkGC *gc);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_GC_H__ */
diff --git a/gtk/gtkhandlebox.c b/gtk/gtkhandlebox.c
deleted file mode 100644
index ab4f8c2923..0000000000
--- a/gtk/gtkhandlebox.c
+++ /dev/null
@@ -1,720 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- * Copyright (C) 1998 Elliot Lee
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-#include <stdlib.h>
-#include "gdk/gdkx.h"
-#include "gtkhandlebox.h"
-#include "gtkmain.h"
-#include "gtksignal.h"
-#include "gtkwindow.h"
-
-
-#define DRAG_HANDLE_SIZE 10
-#define BORDER_SIZE 5
-#define GHOST_HEIGHT 3
-#define SNAP_TOLERANCE 10
-
-enum
-{
- SIGNAL_CHILD_ATTACHED,
- SIGNAL_CHILD_DETACHED,
- SIGNAL_LAST
-};
-
-typedef void (*SignalChildAttached) (GtkObject *object,
- GtkWidget *widget,
- gpointer func_data);
-
-static void gtk_handle_box_class_init (GtkHandleBoxClass *klass);
-static void gtk_handle_box_init (GtkHandleBox *handle_box);
-static void gtk_handle_box_destroy (GtkObject *object);
-static void gtk_handle_box_map (GtkWidget *widget);
-static void gtk_handle_box_unmap (GtkWidget *widget);
-static void gtk_handle_box_realize (GtkWidget *widget);
-static void gtk_handle_box_unrealize (GtkWidget *widget);
-static void gtk_handle_box_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_handle_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_handle_box_draw_ghost (GtkWidget *widget);
-static void gtk_handle_box_paint (GtkWidget *widget,
- GdkEventExpose *event,
- GdkRectangle *area);
-static void gtk_handle_box_draw (GtkWidget *widget,
- GdkRectangle *area);
-static gint gtk_handle_box_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static gint gtk_handle_box_button_changed (GtkWidget *widget,
- GdkEventButton *event);
-static gint gtk_handle_box_motion (GtkWidget *widget,
- GdkEventMotion *event);
-static gint gtk_handle_box_delete_float (GtkWidget *widget,
- GdkEvent *event,
- gpointer data);
-
-
-static GtkBinClass *parent_class;
-static guint handle_box_signals[SIGNAL_LAST] = { 0 };
-
-
-guint
-gtk_handle_box_get_type (void)
-{
- static guint handle_box_type = 0;
-
- if (!handle_box_type)
- {
- GtkTypeInfo handle_box_info =
- {
- "GtkHandleBox",
- sizeof (GtkHandleBox),
- sizeof (GtkHandleBoxClass),
- (GtkClassInitFunc) gtk_handle_box_class_init,
- (GtkObjectInitFunc) gtk_handle_box_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- handle_box_type = gtk_type_unique (gtk_bin_get_type (), &handle_box_info);
- }
-
- return handle_box_type;
-}
-
-static void
-gtk_handle_box_marshal_child_attached (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- SignalChildAttached sfunc = (SignalChildAttached) func;
-
- (* sfunc) (object,
- (GtkWidget*) GTK_VALUE_OBJECT (args[0]),
- func_data);
-}
-
-static void
-gtk_handle_box_class_init (GtkHandleBoxClass *class)
-{
- GtkWidgetClass *widget_class;
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
-
- parent_class = gtk_type_class (gtk_bin_get_type ());
-
- handle_box_signals[SIGNAL_CHILD_ATTACHED] =
- gtk_signal_new ("child_attached",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkHandleBoxClass, child_attached),
- gtk_handle_box_marshal_child_attached,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_WIDGET);
- handle_box_signals[SIGNAL_CHILD_DETACHED] =
- gtk_signal_new ("child_detached",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkHandleBoxClass, child_detached),
- gtk_handle_box_marshal_child_attached,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_WIDGET);
- gtk_object_class_add_signals (object_class, handle_box_signals, SIGNAL_LAST);
-
- object_class->destroy = gtk_handle_box_destroy;
-
- widget_class->map = gtk_handle_box_map;
- widget_class->unmap = gtk_handle_box_unmap;
- widget_class->realize = gtk_handle_box_realize;
- widget_class->unrealize = gtk_handle_box_unrealize;
- widget_class->size_request = gtk_handle_box_size_request;
- widget_class->size_allocate = gtk_handle_box_size_allocate;
- widget_class->draw = gtk_handle_box_draw;
- widget_class->expose_event = gtk_handle_box_expose;
- widget_class->button_press_event = gtk_handle_box_button_changed;
- widget_class->button_release_event = gtk_handle_box_button_changed;
- widget_class->motion_notify_event = gtk_handle_box_motion;
-
- class->child_attached = NULL;
- class->child_detached = NULL;
-}
-
-static void
-gtk_handle_box_init (GtkHandleBox *handle_box)
-{
- GTK_WIDGET_UNSET_FLAGS (handle_box, GTK_NO_WINDOW);
- GTK_WIDGET_SET_FLAGS (handle_box, GTK_BASIC); /* FIXME: are we really a basic widget? */
-
- handle_box->steady_window = NULL;
- handle_box->float_window = NULL;
- handle_box->is_being_dragged = FALSE;
- handle_box->is_onroot = FALSE;
- handle_box->overlap_attaches = FALSE;
- handle_box->fleur_cursor = gdk_cursor_new (GDK_FLEUR);
- handle_box->dragoff_x = 0;
- handle_box->dragoff_y = 0;
- handle_box->steady_x = 0;
- handle_box->steady_x = 0;
-}
-
-GtkWidget*
-gtk_handle_box_new (void)
-{
- return GTK_WIDGET (gtk_type_new (gtk_handle_box_get_type ()));
-}
-
-static void
-gtk_handle_box_destroy (GtkObject *object)
-{
- GtkHandleBox *hb;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_HANDLE_BOX (object));
-
- hb = GTK_HANDLE_BOX (object);
-
- gdk_cursor_destroy (hb->fleur_cursor);
- hb->fleur_cursor = NULL;
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-static void
-gtk_handle_box_map (GtkWidget *widget)
-{
- GtkBin *bin;
- GtkHandleBox *hb;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_HANDLE_BOX (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
-
- bin = GTK_BIN (widget);
- hb = GTK_HANDLE_BOX (widget);
-
- gdk_window_show (hb->steady_window);
- gdk_window_show (widget->window);
-
- if (bin->child
- && GTK_WIDGET_VISIBLE (bin->child)
- && !GTK_WIDGET_MAPPED (bin->child))
- gtk_widget_map (bin->child);
-}
-
-static void
-gtk_handle_box_unmap (GtkWidget *widget)
-{
- GtkHandleBox *hb;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_HANDLE_BOX (widget));
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
-
- hb = GTK_HANDLE_BOX (widget);
-
- gdk_window_hide (widget->window);
- gdk_window_hide (hb->steady_window);
-}
-
-static void
-gtk_handle_box_realize (GtkWidget *widget)
-{
- GdkWindowAttr attributes;
- gint attributes_mask;
- GtkHandleBox *hb;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_HANDLE_BOX (widget));
-
- hb = GTK_HANDLE_BOX (widget);
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- hb->float_window = gtk_window_new (GTK_WINDOW_DIALOG);
- gtk_window_set_policy (GTK_WINDOW (hb->float_window), FALSE, FALSE, TRUE);
- gtk_container_border_width (GTK_CONTAINER (hb->float_window), 0);
- gtk_signal_connect (GTK_OBJECT (hb->float_window), "delete_event",
- (GtkSignalFunc) gtk_handle_box_delete_float,
- hb);
- gtk_widget_realize (hb->float_window);
- gdk_window_set_decorations (hb->float_window->window, 0);
-
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = (gtk_widget_get_events (widget)
- | GDK_EXPOSURE_MASK);
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- hb->steady_window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
- gdk_window_set_user_data (hb->steady_window, widget);
-
- attributes.x = 0;
- attributes.y = 0;
- attributes.event_mask |= (GDK_BUTTON1_MOTION_MASK
- | GDK_POINTER_MOTION_HINT_MASK
- | GDK_BUTTON_PRESS_MASK
- | GDK_BUTTON_RELEASE_MASK);
-
- widget->window = gdk_window_new (hb->steady_window, &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
- gtk_style_set_background (widget->style, hb->steady_window, GTK_STATE_NORMAL);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
-}
-
-static void
-gtk_handle_box_unrealize (GtkWidget *widget)
-{
- GtkHandleBox *hb;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_HANDLE_BOX (widget));
-
- hb = GTK_HANDLE_BOX (widget);
-
- if (hb->steady_window)
- {
- gdk_window_set_user_data (hb->steady_window, NULL);
- gdk_window_destroy (hb->steady_window);
- hb->steady_window = NULL;
- }
-
- gtk_widget_destroy (hb->float_window);
- hb->float_window = NULL;
-
- if (GTK_WIDGET_CLASS (parent_class)->unrealize)
- (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
-}
-
-static void
-gtk_handle_box_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkBin *bin;
- GtkHandleBox *hb;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_HANDLE_BOX (widget));
- g_return_if_fail (requisition != NULL);
-
- bin = GTK_BIN (widget);
- hb = GTK_HANDLE_BOX (widget);
-
- requisition->width = DRAG_HANDLE_SIZE + GTK_CONTAINER (widget)->border_width * 2;
- requisition->height = GTK_CONTAINER (widget)->border_width * 2;
-
- if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
- {
- gtk_widget_size_request (bin->child, &bin->child->requisition);
-
- requisition->width += bin->child->requisition.width;
- requisition->height += bin->child->requisition.height;
- }
-
- hb->real_requisition = *requisition;
- if (hb->is_onroot)
- requisition->height = GHOST_HEIGHT;
- /* FIXME: Should also set requisition->width to a small value? */
-}
-
-static void
-gtk_handle_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkBin *bin;
- GtkAllocation child_allocation;
- GtkHandleBox *hb;
- gint border_width;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_HANDLE_BOX (widget));
- g_return_if_fail (allocation != NULL);
-
- widget->allocation = *allocation;
- bin = GTK_BIN (widget);
- hb = GTK_HANDLE_BOX (widget);
-
- border_width = GTK_CONTAINER (widget)->border_width;
-
- if (GTK_WIDGET_REALIZED (widget))
- {
- if (!hb->is_onroot)
- {
- gdk_window_move_resize (hb->steady_window,
- allocation->x + border_width,
- allocation->y + border_width,
- allocation->width - border_width * 2,
- allocation->height - border_width * 2);
- gdk_window_move_resize (widget->window,
- 0,
- 0,
- allocation->width - border_width * 2,
- allocation->height - border_width * 2);
- }
- else
- {
- gtk_widget_set_usize (hb->float_window,
- hb->real_requisition.width,
- hb->real_requisition.height);
- gdk_window_resize (widget->window,
- hb->real_requisition.width,
- hb->real_requisition.height);
- gdk_window_move_resize (hb->steady_window,
- allocation->x + border_width,
- allocation->y + border_width,
- allocation->width - border_width * 2,
- GHOST_HEIGHT);
- }
- }
-
- if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
- {
- child_allocation.x = DRAG_HANDLE_SIZE;
- child_allocation.y = 0;
-
- if (hb->is_onroot)
- {
- child_allocation.width = hb->real_requisition.width - DRAG_HANDLE_SIZE;
- child_allocation.height = hb->real_requisition.height;
- }
- else
- {
- child_allocation.width = allocation->width - DRAG_HANDLE_SIZE - border_width * 2;
- child_allocation.height = allocation->height - border_width * 2;
- }
-
- gtk_widget_size_allocate (bin->child, &child_allocation);
- }
-}
-
-static void
-gtk_handle_box_draw_ghost (GtkWidget *widget)
-{
- gtk_draw_hline (widget->style,
- GTK_HANDLE_BOX (widget)->steady_window,
- GTK_WIDGET_STATE (widget),
- 0,
- widget->allocation.width - GTK_CONTAINER (widget)->border_width * 2,
- 0);
-}
-
-static void
-gtk_handle_box_paint (GtkWidget *widget,
- GdkEventExpose *event,
- GdkRectangle *area)
-{
- GtkBin *bin;
- GtkHandleBox *hb;
- GdkRectangle child_area;
- GdkEventExpose child_event;
- gint x;
-
- bin = GTK_BIN (widget);
- hb = GTK_HANDLE_BOX (widget);
-
- if (event != NULL)
- area = &event->area;
-
- for (x = 1; x < DRAG_HANDLE_SIZE; x += 3)
- gtk_draw_vline (widget->style,
- widget->window,
- GTK_WIDGET_STATE (widget),
- 0, hb->is_onroot ? hb->real_requisition.height : widget->allocation.height,
- x);
-
- if (hb->is_onroot)
- gtk_draw_shadow (widget->style,
- widget->window,
- GTK_WIDGET_STATE (widget),
- GTK_SHADOW_OUT,
- 0, 0,
- hb->real_requisition.width,
- hb->real_requisition.height);
- else
- gtk_draw_shadow (widget->style,
- widget->window,
- GTK_WIDGET_STATE (widget),
- GTK_SHADOW_OUT,
- 0, 0,
- widget->allocation.width,
- widget->allocation.height);
-
- if (bin->child)
- {
- if (event == NULL) /* we were called from draw() */
- {
- if (gtk_widget_intersect (bin->child, area, &child_area))
- gtk_widget_draw (bin->child, &child_area);
- }
- else /* we were called from expose() */
- {
- child_event = *event;
-
- if (GTK_WIDGET_NO_WINDOW (bin->child)
- && gtk_widget_intersect (bin->child, &event->area, &child_event.area))
- gtk_widget_event (bin->child, (GdkEvent *) &child_event);
- }
- }
-}
-
-static void
-gtk_handle_box_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- GdkRectangle child_area;
- GtkHandleBox *hb;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_HANDLE_BOX (widget));
- g_return_if_fail (area != NULL);
-
- hb = GTK_HANDLE_BOX (widget);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- if (hb->is_onroot)
- {
- /* The area parameter does not make sense in this case, so we
- * repaint everything.
- */
-
- gtk_handle_box_draw_ghost (widget);
-
- child_area.x = 0;
- child_area.y = 0;
- child_area.width = hb->real_requisition.width;
- child_area.height = hb->real_requisition.height;
-
- gtk_handle_box_paint (widget, NULL, &child_area);
- }
- else
- gtk_handle_box_paint (widget, NULL, area);
- }
-}
-
-static gint
-gtk_handle_box_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkHandleBox *hb;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_HANDLE_BOX (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- hb = GTK_HANDLE_BOX (widget);
-
- if (event->window == hb->steady_window)
- gtk_handle_box_draw_ghost (widget);
- else if (event->window == widget->window)
- gtk_handle_box_paint (widget, event, NULL);
- }
-
- return FALSE;
-}
-
-static gint
-gtk_handle_box_button_changed (GtkWidget *widget,
- GdkEventButton *event)
-{
- GtkHandleBox *hb;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_HANDLE_BOX (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- hb = GTK_HANDLE_BOX (widget);
-
- if (event->button == 1)
- {
- if ((event->type == GDK_BUTTON_PRESS) && (event->x < DRAG_HANDLE_SIZE))
- {
- hb->dragoff_x = event->x;
- hb->dragoff_y = event->y;
-
- gdk_window_get_origin (hb->steady_window, &hb->steady_x, &hb->steady_y);
-
- hb->is_being_dragged = TRUE;
-
- gdk_flush();
- gtk_grab_add (widget);
- while (gdk_pointer_grab (widget->window,
- FALSE,
- (GDK_BUTTON1_MOTION_MASK
- | GDK_POINTER_MOTION_HINT_MASK
- | GDK_BUTTON_RELEASE_MASK),
- NULL,
- hb->fleur_cursor,
- GDK_CURRENT_TIME) != 0); /* wait for success */
- }
- else if ((event->type == GDK_BUTTON_RELEASE) && hb->is_being_dragged)
- {
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
- gtk_grab_remove (widget);
- hb->is_being_dragged = FALSE;
- }
- }
- return TRUE;
-}
-
-static gint
-gtk_handle_box_motion (GtkWidget *widget,
- GdkEventMotion *event)
-{
- GtkHandleBox *hb;
- gint newx, newy;
- gint ox, oy;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_HANDLE_BOX (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- hb = GTK_HANDLE_BOX (widget);
-
- if (event->is_hint)
- {
- gdk_window_get_origin (widget->window, &ox, &oy);
- gdk_window_get_pointer (widget->window, &newx, &newy, NULL);
- newx += ox;
- newy += oy;
- }
- else
- {
- newx = event->x_root;
- newy = event->y_root;
- }
-
- newx -= hb->dragoff_x;
- newy -= hb->dragoff_y;
-
- if (hb->is_being_dragged)
- {
- if ((abs (hb->steady_x - newx) < SNAP_TOLERANCE)
- && (abs (hb->steady_y - newy) < SNAP_TOLERANCE))
- {
- if (hb->is_onroot)
- {
- hb->is_onroot = FALSE;
-
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
-
- gdk_window_reparent (widget->window, hb->steady_window, 0, 0);
-
- gtk_widget_hide (hb->float_window);
-
- gtk_signal_emit (GTK_OBJECT (hb),
- handle_box_signals[SIGNAL_CHILD_ATTACHED],
- GTK_BIN (hb)->child);
-
- while (gdk_pointer_grab (widget->window,
- FALSE,
- (GDK_BUTTON1_MOTION_MASK
- | GDK_POINTER_MOTION_HINT_MASK
- | GDK_BUTTON_RELEASE_MASK),
- NULL,
- hb->fleur_cursor,
- GDK_CURRENT_TIME) != 0); /* wait for success */
-
- gtk_widget_queue_resize (widget);
- }
- }
- else
- {
- if (hb->is_onroot)
- {
- gtk_widget_set_uposition (hb->float_window, newx, newy);
- gdk_window_raise (hb->float_window->window);
- }
- else
- {
- hb->is_onroot = TRUE;
-
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
-
- if (!GTK_WIDGET_REALIZED (hb->float_window))
- gtk_widget_realize (hb->float_window);
-
- gtk_widget_set_uposition (hb->float_window, newx, newy);
- gdk_window_reparent (widget->window, hb->float_window->window, 0, 0);
- gtk_widget_show (hb->float_window);
-
- gtk_signal_emit (GTK_OBJECT (hb),
- handle_box_signals[SIGNAL_CHILD_DETACHED],
- GTK_BIN (hb)->child);
-
- while (gdk_pointer_grab (widget->window,
- FALSE,
- (GDK_BUTTON1_MOTION_MASK
- | GDK_POINTER_MOTION_HINT_MASK
- | GDK_BUTTON_RELEASE_MASK),
- NULL,
- hb->fleur_cursor,
- GDK_CURRENT_TIME) != 0); /* wait for success */
-
- gtk_widget_queue_resize (widget);
- }
- }
- }
-
- return TRUE;
-}
-
-static gint
-gtk_handle_box_delete_float (GtkWidget *widget,
- GdkEvent *event,
- gpointer data)
-{
- GtkHandleBox *hb;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
- g_return_val_if_fail (data != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_HANDLE_BOX (data), FALSE);
-
- hb = GTK_HANDLE_BOX (data);
-
- hb->is_onroot = FALSE;
-
- gdk_window_reparent (GTK_WIDGET (hb)->window, hb->steady_window, 0, 0);
- gtk_widget_hide (hb->float_window);
-
- gtk_signal_emit (GTK_OBJECT (hb),
- handle_box_signals[SIGNAL_CHILD_ATTACHED],
- GTK_BIN (hb)->child);
-
- gtk_widget_queue_resize (GTK_WIDGET (hb));
-
- return FALSE;
-}
diff --git a/gtk/gtkhandlebox.h b/gtk/gtkhandlebox.h
deleted file mode 100644
index 224f977d67..0000000000
--- a/gtk/gtkhandlebox.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- * Copyright (C) 1998 Elliot Lee
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/* The GtkHandleBox is to allow widgets to be dragged in and out of
- * their parents.
- */
-
-
-#ifndef __GTK_HANDLE_BOX_H__
-#define __GTK_HANDLE_BOX_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkbin.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_HANDLE_BOX(obj) GTK_CHECK_CAST (obj, gtk_handle_box_get_type (), GtkHandleBox)
-#define GTK_HANDLE_BOX_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_handle_box_get_type (), GtkHandleBoxClass)
-#define GTK_IS_HANDLE_BOX(obj) GTK_CHECK_TYPE (obj, gtk_handle_box_get_type ())
-
-
-typedef struct _GtkHandleBox GtkHandleBox;
-typedef struct _GtkHandleBoxClass GtkHandleBoxClass;
-
-struct _GtkHandleBox
-{
- GtkBin bin;
-
- GdkWindow *steady_window; /* the window that stays in the parent container */
- GtkWidget *float_window;
- GtkRequisition real_requisition;
- gint is_being_dragged : 1;
- gint is_onroot : 1;
- gint overlap_attaches : 1;
- GdkCursor *fleur_cursor;
-
- gint dragoff_x, dragoff_y; /* start drag position (wrt widget->window) */
- gint steady_x, steady_y; /* origin of stedy_window (wrt the root window) */
-};
-
-struct _GtkHandleBoxClass
-{
- GtkBinClass parent_class;
-
- void (*child_attached) (GtkHandleBox *handle_box,
- GtkWidget *child);
- void (*child_detached) (GtkHandleBox *handle_box,
- GtkWidget *child);
-};
-
-
-guint gtk_handle_box_get_type (void);
-GtkWidget* gtk_handle_box_new (void);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __GTK_HANDLE_BOX_H__ */
diff --git a/gtk/gtkhbbox.c b/gtk/gtkhbbox.c
deleted file mode 100644
index 4fde1b64d6..0000000000
--- a/gtk/gtkhbbox.c
+++ /dev/null
@@ -1,273 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "gtkhbbox.h"
-
-
-static void gtk_hbutton_box_class_init (GtkHButtonBoxClass *klass);
-static void gtk_hbutton_box_init (GtkHButtonBox *box);
-static void gtk_hbutton_box_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_hbutton_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-
-static gint default_spacing = 30;
-static gint default_layout_style = GTK_BUTTONBOX_EDGE;
-
-guint
-gtk_hbutton_box_get_type ()
-{
- static guint hbutton_box_type = 0;
-
- if (!hbutton_box_type)
- {
- GtkTypeInfo hbutton_box_info =
- {
- "GtkHButtonBox",
- sizeof (GtkHButtonBox),
- sizeof (GtkHButtonBoxClass),
- (GtkClassInitFunc) gtk_hbutton_box_class_init,
- (GtkObjectInitFunc) gtk_hbutton_box_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- hbutton_box_type = gtk_type_unique (gtk_button_box_get_type (), &hbutton_box_info);
- }
-
- return hbutton_box_type;
-}
-
-static void
-gtk_hbutton_box_class_init (GtkHButtonBoxClass *class)
-{
- GtkWidgetClass *widget_class;
-
- widget_class = (GtkWidgetClass*) class;
-
- widget_class->size_request = gtk_hbutton_box_size_request;
- widget_class->size_allocate = gtk_hbutton_box_size_allocate;
-}
-
-static void
-gtk_hbutton_box_init (GtkHButtonBox *hbutton_box)
-{
- /* button_box_init has done everything allready */
-}
-
-GtkWidget*
-gtk_hbutton_box_new ()
-{
- GtkHButtonBox *hbutton_box;
-
- hbutton_box = gtk_type_new (gtk_hbutton_box_get_type ());
-
- return GTK_WIDGET (hbutton_box);
-}
-
-
-/* set default value for spacing */
-
-void gtk_hbutton_box_set_spacing_default (gint spacing)
-{
- default_spacing = spacing;
-}
-
-
-/* set default value for layout style */
-
-void gtk_hbutton_box_set_layout_default (GtkButtonBoxStyle layout)
-{
- g_return_if_fail (layout >= GTK_BUTTONBOX_DEFAULT_STYLE &&
- layout <= GTK_BUTTONBOX_END);
-
- default_layout_style = layout;
-}
-
-/* get default value for spacing */
-
-gint gtk_hbutton_box_get_spacing_default (void)
-{
- return default_spacing;
-}
-
-
-/* get default value for layout style */
-
-GtkButtonBoxStyle gtk_hbutton_box_get_layout_default (void)
-{
- return default_layout_style;
-}
-
-
-
-static void
-gtk_hbutton_box_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkBox *box;
- GtkButtonBox *bbox;
- gint nvis_children;
- gint child_width;
- gint child_height;
- gint spacing;
- GtkButtonBoxStyle layout;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_HBUTTON_BOX (widget));
- g_return_if_fail (requisition != NULL);
-
- box = GTK_BOX (widget);
- bbox = GTK_BUTTON_BOX (widget);
-
- spacing = bbox->spacing != GTK_BUTTONBOX_DEFAULT
- ? bbox->spacing : default_spacing;
- layout = bbox->layout_style != GTK_BUTTONBOX_DEFAULT_STYLE
- ? bbox->layout_style : default_layout_style;
-
- gtk_button_box_child_requisition (widget,
- &nvis_children,
- &child_width,
- &child_height);
-
- if (nvis_children == 0)
- {
- requisition->width = 0;
- requisition->height = 0;
- }
- else
- {
- switch (layout)
- {
- case GTK_BUTTONBOX_SPREAD:
- requisition->width =
- nvis_children*child_width + ((nvis_children+1)*spacing);
- break;
- case GTK_BUTTONBOX_EDGE:
- case GTK_BUTTONBOX_START:
- case GTK_BUTTONBOX_END:
- requisition->width = nvis_children*child_width + ((nvis_children-1)*spacing);
- break;
- default:
- g_assert_not_reached();
- break;
- }
-
- requisition->height = child_height;
- }
-
- requisition->width += GTK_CONTAINER (box)->border_width * 2;
- requisition->height += GTK_CONTAINER (box)->border_width * 2;
-}
-
-
-
-static void
-gtk_hbutton_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkButtonBox *box;
- GtkHButtonBox *hbox;
- GtkBoxChild *child;
- GList *children;
- GtkAllocation child_allocation;
- gint nvis_children;
- gint child_width;
- gint child_height;
- gint x = 0;
- gint y = 0;
- gint width;
- gint childspace;
- gint childspacing = 0;
- GtkButtonBoxStyle layout;
- gint spacing;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_HBUTTON_BOX (widget));
- g_return_if_fail (allocation != NULL);
-
- box = GTK_BUTTON_BOX (widget);
- hbox = GTK_HBUTTON_BOX (widget);
- spacing = box->spacing != GTK_BUTTONBOX_DEFAULT
- ? box->spacing : default_spacing;
- layout = box->layout_style != GTK_BUTTONBOX_DEFAULT_STYLE
- ? box->layout_style : default_layout_style;
- gtk_button_box_child_requisition (widget,
- &nvis_children,
- &child_width,
- &child_height);
- widget->allocation = *allocation;
- width = allocation->width - GTK_CONTAINER (box)->border_width*2;
- switch (layout)
- {
- case GTK_BUTTONBOX_SPREAD:
- childspacing = (width - (nvis_children*child_width)) / (nvis_children+1);
- x = allocation->x + GTK_CONTAINER (box)->border_width + childspacing;
- break;
- case GTK_BUTTONBOX_EDGE:
- if (nvis_children >= 2)
- {
- childspacing =
- (width - (nvis_children*child_width)) / (nvis_children-1);
- x = allocation->x + GTK_CONTAINER (box)->border_width;
- }
- else
- {
- /* one or zero children, just center */
- childspacing = width;
- x = allocation->x + (allocation->width - child_width) / 2;
- }
- break;
- case GTK_BUTTONBOX_START:
- childspacing = spacing;
- x = allocation->x + GTK_CONTAINER (box)->border_width;
- break;
- case GTK_BUTTONBOX_END:
- childspacing = spacing;
- x = allocation->x + allocation->width - child_width * nvis_children
- - spacing *(nvis_children-1)
- - GTK_CONTAINER (box)->border_width;
- break;
- default:
- g_assert_not_reached();
- break;
- }
-
-
- y = allocation->y + (allocation->height - child_height) / 2;
- childspace = child_width + childspacing;
-
- children = GTK_BOX (box)->children;
-
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child->widget))
- {
- child_allocation.width = child_width;
- child_allocation.height = child_height;
- child_allocation.x = x;
- child_allocation.y = y;
- gtk_widget_size_allocate (child->widget, &child_allocation);
- x += childspace;
- }
- }
-}
-
diff --git a/gtk/gtkhbbox.h b/gtk/gtkhbbox.h
deleted file mode 100644
index 2cee40cad0..0000000000
--- a/gtk/gtkhbbox.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_HBUTTON_BOX_H__
-#define __GTK_HBUTTON_BOX_H__
-
-
-#include "gtk/gtkbbox.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_HBUTTON_BOX(obj) GTK_CHECK_CAST (obj, gtk_hbutton_box_get_type (), GtkHButtonBox)
-#define GTK_HBUTTON_BOX_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_hbutton_box_get_type (), GtkHButtonBoxClass)
-#define GTK_IS_HBUTTON_BOX(obj) GTK_CHECK_TYPE (obj, gtk_hbutton_box_get_type ())
-
-
-typedef struct _GtkHButtonBox GtkHButtonBox;
-typedef struct _GtkHButtonBoxClass GtkHButtonBoxClass;
-
-struct _GtkHButtonBox
-{
- GtkButtonBox button_box;
-};
-
-struct _GtkHButtonBoxClass
-{
- GtkButtonBoxClass parent_class;
-};
-
-
-guint gtk_hbutton_box_get_type (void);
-GtkWidget *gtk_hbutton_box_new (void);
-
-/* buttons can be added by gtk_container_add() */
-
-gint gtk_hbutton_box_get_spacing_default (void);
-GtkButtonBoxStyle gtk_hbutton_box_get_layout_default (void);
-
-void gtk_hbutton_box_set_spacing_default (gint spacing);
-void gtk_hbutton_box_set_layout_default (GtkButtonBoxStyle layout);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_HBUTTON_BOX_H__ */
diff --git a/gtk/gtkhbox.c b/gtk/gtkhbox.c
deleted file mode 100644
index f8f8848acf..0000000000
--- a/gtk/gtkhbox.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkhbox.h"
-
-
-static void gtk_hbox_class_init (GtkHBoxClass *klass);
-static void gtk_hbox_init (GtkHBox *box);
-static void gtk_hbox_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_hbox_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-
-
-guint
-gtk_hbox_get_type ()
-{
- static guint hbox_type = 0;
-
- if (!hbox_type)
- {
- GtkTypeInfo hbox_info =
- {
- "GtkHBox",
- sizeof (GtkHBox),
- sizeof (GtkHBoxClass),
- (GtkClassInitFunc) gtk_hbox_class_init,
- (GtkObjectInitFunc) gtk_hbox_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- hbox_type = gtk_type_unique (gtk_box_get_type (), &hbox_info);
- }
-
- return hbox_type;
-}
-
-static void
-gtk_hbox_class_init (GtkHBoxClass *class)
-{
- GtkWidgetClass *widget_class;
-
- widget_class = (GtkWidgetClass*) class;
-
- widget_class->size_request = gtk_hbox_size_request;
- widget_class->size_allocate = gtk_hbox_size_allocate;
-}
-
-static void
-gtk_hbox_init (GtkHBox *hbox)
-{
-}
-
-GtkWidget*
-gtk_hbox_new (gint homogeneous,
- gint spacing)
-{
- GtkHBox *hbox;
-
- hbox = gtk_type_new (gtk_hbox_get_type ());
-
- GTK_BOX (hbox)->spacing = spacing;
- GTK_BOX (hbox)->homogeneous = homogeneous ? TRUE : FALSE;
-
- return GTK_WIDGET (hbox);
-}
-
-
-static void
-gtk_hbox_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkBox *box;
- GtkBoxChild *child;
- GList *children;
- gint nvis_children;
- gint width;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_HBOX (widget));
- g_return_if_fail (requisition != NULL);
-
- box = GTK_BOX (widget);
- requisition->width = 0;
- requisition->height = 0;
- nvis_children = 0;
-
- children = box->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child->widget))
- {
- gtk_widget_size_request (child->widget, &child->widget->requisition);
-
- if (box->homogeneous)
- {
- width = child->widget->requisition.width + child->padding * 2;
- requisition->width = MAX (requisition->width, width);
- }
- else
- {
- requisition->width += child->widget->requisition.width + child->padding * 2;
- }
-
- requisition->height = MAX (requisition->height, child->widget->requisition.height);
-
- nvis_children += 1;
- }
- }
-
- if (nvis_children > 0)
- {
- if (box->homogeneous)
- requisition->width *= nvis_children;
- requisition->width += (nvis_children - 1) * box->spacing;
- }
-
- requisition->width += GTK_CONTAINER (box)->border_width * 2;
- requisition->height += GTK_CONTAINER (box)->border_width * 2;
-}
-
-static void
-gtk_hbox_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkBox *box;
- GtkBoxChild *child;
- GList *children;
- GtkAllocation child_allocation;
- gint nvis_children;
- gint nexpand_children;
- gint child_width;
- gint width;
- gint extra;
- gint x;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_HBOX (widget));
- g_return_if_fail (allocation != NULL);
-
- box = GTK_BOX (widget);
- widget->allocation = *allocation;
-
- nvis_children = 0;
- nexpand_children = 0;
- children = box->children;
-
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child->widget))
- {
- nvis_children += 1;
- if (child->expand)
- nexpand_children += 1;
- }
- }
-
- if (nvis_children > 0)
- {
- if (box->homogeneous)
- {
- width = (allocation->width -
- GTK_CONTAINER (box)->border_width * 2 -
- (nvis_children - 1) * box->spacing);
- extra = width / nvis_children;
- }
- else if (nexpand_children > 0)
- {
- width = allocation->width - widget->requisition.width;
- extra = width / nexpand_children;
- }
- else
- {
- width = 0;
- extra = 0;
- }
-
- x = allocation->x + GTK_CONTAINER (box)->border_width;
- child_allocation.y = allocation->y + GTK_CONTAINER (box)->border_width;
- child_allocation.height = allocation->height - GTK_CONTAINER (box)->border_width * 2;
-
- children = box->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if ((child->pack == GTK_PACK_START) && GTK_WIDGET_VISIBLE (child->widget))
- {
- if (box->homogeneous)
- {
- if (nvis_children == 1)
- child_width = width;
- else
- child_width = extra;
-
- nvis_children -= 1;
- width -= extra;
- }
- else
- {
- child_width = child->widget->requisition.width + child->padding * 2;
-
- if (child->expand)
- {
- if (nexpand_children == 1)
- child_width += width;
- else
- child_width += extra;
-
- nexpand_children -= 1;
- width -= extra;
- }
- }
-
- if (child->fill)
- {
- child_allocation.width = child_width - child->padding * 2;
- child_allocation.x = x + child->padding;
- }
- else
- {
- child_allocation.width = child->widget->requisition.width;
- child_allocation.x = x + (child_width - child_allocation.width) / 2;
- }
-
- gtk_widget_size_allocate (child->widget, &child_allocation);
-
- x += child_width + box->spacing;
- }
- }
-
- x = allocation->x + allocation->width - GTK_CONTAINER (box)->border_width;
-
- children = box->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if ((child->pack == GTK_PACK_END) && GTK_WIDGET_VISIBLE (child->widget))
- {
- if (box->homogeneous)
- {
- if (nvis_children == 1)
- child_width = width;
- else
- child_width = extra;
-
- nvis_children -= 1;
- width -= extra;
- }
- else
- {
- child_width = child->widget->requisition.width + child->padding * 2;
-
- if (child->expand)
- {
- if (nexpand_children == 1)
- child_width += width;
- else
- child_width += extra;
-
- nexpand_children -= 1;
- width -= extra;
- }
- }
-
- if (child->fill)
- {
- child_allocation.width = child_width - child->padding * 2;
- child_allocation.x = x + child->padding - child_width;
- }
- else
- {
- child_allocation.width = child->widget->requisition.width;
- child_allocation.x = x + (child_width - child_allocation.width) / 2 - child_width;
- }
-
- gtk_widget_size_allocate (child->widget, &child_allocation);
-
- x -= (child_width + box->spacing);
- }
- }
- }
-}
diff --git a/gtk/gtkhbox.h b/gtk/gtkhbox.h
deleted file mode 100644
index 7dfbb3dffb..0000000000
--- a/gtk/gtkhbox.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_HBOX_H__
-#define __GTK_HBOX_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkbox.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_HBOX(obj) GTK_CHECK_CAST (obj, gtk_hbox_get_type (), GtkHBox)
-#define GTK_HBOX_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_hbox_get_type (), GtkHBoxClass)
-#define GTK_IS_HBOX(obj) GTK_CHECK_TYPE (obj, gtk_hbox_get_type ())
-
-
-typedef struct _GtkHBox GtkHBox;
-typedef struct _GtkHBoxClass GtkHBoxClass;
-
-struct _GtkHBox
-{
- GtkBox box;
-};
-
-struct _GtkHBoxClass
-{
- GtkBoxClass parent_class;
-};
-
-
-guint gtk_hbox_get_type (void);
-GtkWidget* gtk_hbox_new (gint homogeneous,
- gint spacing);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_HBOX_H__ */
diff --git a/gtk/gtkhpaned.c b/gtk/gtkhpaned.c
deleted file mode 100644
index d89e00827b..0000000000
--- a/gtk/gtkhpaned.c
+++ /dev/null
@@ -1,359 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkhpaned.h"
-#include "gtkmain.h"
-#include "gtksignal.h"
-
-static void gtk_hpaned_class_init (GtkHPanedClass *klass);
-static void gtk_hpaned_init (GtkHPaned *hpaned);
-static void gtk_hpaned_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_hpaned_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_hpaned_draw (GtkWidget *widget,
- GdkRectangle *area);
-static void gtk_hpaned_xor_line (GtkPaned *paned);
-static gint gtk_hpaned_button_press (GtkWidget *widget,
- GdkEventButton *event);
-static gint gtk_hpaned_button_release (GtkWidget *widget,
- GdkEventButton *event);
-static gint gtk_hpaned_motion (GtkWidget *widget,
- GdkEventMotion *event);
-
-guint
-gtk_hpaned_get_type ()
-{
- static guint hpaned_type = 0;
-
- if (!hpaned_type)
- {
- GtkTypeInfo hpaned_info =
- {
- "GtkHPaned",
- sizeof (GtkHPaned),
- sizeof (GtkHPanedClass),
- (GtkClassInitFunc) gtk_hpaned_class_init,
- (GtkObjectInitFunc) gtk_hpaned_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- hpaned_type = gtk_type_unique (gtk_paned_get_type (), &hpaned_info);
- }
-
- return hpaned_type;
-}
-
-static void
-gtk_hpaned_class_init (GtkHPanedClass *class)
-{
- GtkWidgetClass *widget_class;
-
- widget_class = (GtkWidgetClass*) class;
-
- widget_class->size_request = gtk_hpaned_size_request;
- widget_class->size_allocate = gtk_hpaned_size_allocate;
- widget_class->draw = gtk_hpaned_draw;
- widget_class->button_press_event = gtk_hpaned_button_press;
- widget_class->button_release_event = gtk_hpaned_button_release;
- widget_class->motion_notify_event = gtk_hpaned_motion;
-}
-
-static void
-gtk_hpaned_init (GtkHPaned *hpaned)
-{
-}
-
-GtkWidget*
-gtk_hpaned_new ()
-{
- GtkHPaned *hpaned;
-
- hpaned = gtk_type_new (gtk_hpaned_get_type ());
-
- return GTK_WIDGET (hpaned);
-}
-
-static void
-gtk_hpaned_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkPaned *paned;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_HPANED (widget));
- g_return_if_fail (requisition != NULL);
-
- paned = GTK_PANED (widget);
- requisition->width = 0;
- requisition->height = 0;
-
- if (paned->child1 && GTK_WIDGET_VISIBLE (paned->child1))
- {
- gtk_widget_size_request (paned->child1, &paned->child1->requisition);
-
- requisition->height = paned->child1->requisition.height;
- requisition->width = paned->child1->requisition.width;
- }
-
- if (paned->child2 && GTK_WIDGET_VISIBLE (paned->child2))
- {
- gtk_widget_size_request (paned->child2, &paned->child2->requisition);
-
- requisition->height = MAX(requisition->height,
- paned->child2->requisition.height);
- requisition->width += paned->child2->requisition.width;
- }
-
- requisition->width += GTK_CONTAINER (paned)->border_width * 2 + paned->gutter_size;
- requisition->height += GTK_CONTAINER (paned)->border_width * 2;
-}
-
-static void
-gtk_hpaned_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkPaned *paned;
- GtkAllocation child1_allocation;
- GtkAllocation child2_allocation;
- guint16 border_width;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_HPANED (widget));
- g_return_if_fail (allocation != NULL);
-
- widget->allocation = *allocation;
-
- paned = GTK_PANED (widget);
- border_width = GTK_CONTAINER (paned)->border_width;
-
- if (!paned->position_set)
- {
- if (paned->child1 && GTK_WIDGET_VISIBLE (paned->child1))
- paned->child1_size = paned->child1->requisition.width;
- else
- paned->child1_size = 0;
- }
-
- /* Move the handle before the children so we don't get extra expose events */
-
- paned->handle_xpos = paned->child1_size + border_width + paned->gutter_size / 2 - paned->handle_size / 2;
- paned->handle_ypos = allocation->height - border_width - 2*paned->handle_size;
-
- if (GTK_WIDGET_REALIZED (widget))
- {
- gdk_window_move_resize (widget->window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
-
- gdk_window_move (paned->handle, paned->handle_xpos, paned->handle_ypos);
- }
-
- if (GTK_WIDGET_MAPPED (widget))
- {
- gdk_window_clear_area (widget->window,
- paned->groove_rectangle.x,
- paned->groove_rectangle.y,
- paned->groove_rectangle.width,
- paned->groove_rectangle.height);
- }
-
- child1_allocation.height = child2_allocation.height = allocation->height - border_width * 2;
- child1_allocation.width = paned->child1_size;
- child1_allocation.x = border_width;
- child1_allocation.y = child2_allocation.y = border_width;
-
- paned->groove_rectangle.x = child1_allocation.x
- + child1_allocation.width + paned->gutter_size / 2 - 1;
- paned->groove_rectangle.y = 0;
- paned->groove_rectangle.width = 2;
- paned->groove_rectangle.height = allocation->height;
-
- child2_allocation.x = paned->groove_rectangle.x + paned->gutter_size / 2 + 1;
- child2_allocation.width = allocation->width
- - child2_allocation.x - border_width;
-
- /* Now allocate the childen, making sure, when resizing not to
- * overlap the windows */
- if (GTK_WIDGET_MAPPED(widget) &&
- paned->child1 && GTK_WIDGET_VISIBLE (paned->child1) &&
- paned->child1->allocation.width < child1_allocation.width)
- {
- if (paned->child2 && GTK_WIDGET_VISIBLE (paned->child2))
- gtk_widget_size_allocate (paned->child2, &child2_allocation);
- gtk_widget_size_allocate (paned->child1, &child1_allocation);
- }
- else
- {
- if (paned->child1 && GTK_WIDGET_VISIBLE (paned->child1))
- gtk_widget_size_allocate (paned->child1, &child1_allocation);
- if (paned->child2 && GTK_WIDGET_VISIBLE (paned->child2))
- gtk_widget_size_allocate (paned->child2, &child2_allocation);
- }
-}
-
-static void
-gtk_hpaned_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkPaned *paned;
- GdkRectangle child_area;
- guint16 border_width;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_PANED (widget));
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget))
- {
- paned = GTK_PANED (widget);
- border_width = GTK_CONTAINER (paned)->border_width;
-
- if (paned->child1 &&
- gtk_widget_intersect (paned->child1, area, &child_area))
- gtk_widget_draw (paned->child1, &child_area);
- if (paned->child2 &&
- gtk_widget_intersect (paned->child2, area, &child_area))
- gtk_widget_draw (paned->child2, &child_area);
-
- gdk_draw_line (widget->window,
- widget->style->dark_gc[widget->state],
- border_width + paned->child1_size + paned->gutter_size / 2 - 1,
- 0,
- border_width + paned->child1_size + paned->gutter_size / 2 - 1,
- widget->allocation.height - 1);
- gdk_draw_line (widget->window,
- widget->style->light_gc[widget->state],
- border_width + paned->child1_size + paned->gutter_size / 2,
- 0,
- border_width + paned->child1_size + paned->gutter_size / 2,
- widget->allocation.height - 1);
- }
-}
-
-static void
-gtk_hpaned_xor_line (GtkPaned *paned)
-{
- GtkWidget *widget;
- GdkGCValues values;
- guint16 xpos;
-
- widget = GTK_WIDGET(paned);
-
- if (!paned->xor_gc)
- {
- values.foreground = widget->style->white;
- values.function = GDK_XOR;
- values.subwindow_mode = GDK_INCLUDE_INFERIORS;
- paned->xor_gc = gdk_gc_new_with_values (widget->window,
- &values,
- GDK_GC_FOREGROUND |
- GDK_GC_FUNCTION |
- GDK_GC_SUBWINDOW);
- }
-
- xpos = paned->child1_size
- + GTK_CONTAINER(paned)->border_width + paned->gutter_size / 2;
-
- gdk_draw_line (widget->window, paned->xor_gc,
- xpos,
- 0,
- xpos,
- widget->allocation.height - 1);
-}
-
-static gint
-gtk_hpaned_button_press (GtkWidget *widget, GdkEventButton *event)
-{
- GtkPaned *paned;
-
- g_return_val_if_fail (widget != NULL,FALSE);
- g_return_val_if_fail (GTK_IS_PANED (widget),FALSE);
-
- paned = GTK_PANED (widget);
-
- if (!paned->in_drag &&
- (event->window == paned->handle) && (event->button == 1))
- {
- paned->in_drag = TRUE;
- /* We need a server grab here, not gtk_grab_add(), since
- * we don't want to pass events on to the widget's children */
- gdk_pointer_grab (paned->handle, FALSE,
- GDK_POINTER_MOTION_HINT_MASK
- | GDK_BUTTON1_MOTION_MASK
- | GDK_BUTTON_RELEASE_MASK,
- NULL, NULL, event->time);
- paned->child1_size += event->x - paned->handle_size / 2;
- paned->child1_size = CLAMP (paned->child1_size, 0,
- widget->allocation.width - paned->gutter_size
- - 2 * GTK_CONTAINER (paned)->border_width);
- gtk_hpaned_xor_line (paned);
- }
-
- return TRUE;
-}
-
-static gint
-gtk_hpaned_button_release (GtkWidget *widget, GdkEventButton *event)
-{
- GtkPaned *paned;
-
- g_return_val_if_fail (widget != NULL,FALSE);
- g_return_val_if_fail (GTK_IS_PANED (widget),FALSE);
-
- paned = GTK_PANED (widget);
-
- if (paned->in_drag && (event->button == 1))
- {
- gtk_hpaned_xor_line (paned);
- paned->in_drag = FALSE;
- paned->position_set = TRUE;
- gdk_pointer_ungrab (event->time);
- gtk_widget_queue_resize (GTK_WIDGET (paned));
- }
-
- return TRUE;
-}
-
-static gint
-gtk_hpaned_motion (GtkWidget *widget, GdkEventMotion *event)
-{
- GtkPaned *paned;
- gint x;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_PANED (widget), FALSE);
-
- if (event->is_hint || event->window != widget->window)
- gtk_widget_get_pointer(widget, &x, NULL);
- else
- x = event->x;
-
- paned = GTK_PANED (widget);
-
- if (paned->in_drag)
- {
- gtk_hpaned_xor_line (paned);
- paned->child1_size = x - GTK_CONTAINER (paned)->border_width - paned->gutter_size / 2;
- paned->child1_size = CLAMP (paned->child1_size, 0,
- widget->allocation.width - paned->gutter_size
- - 2 * GTK_CONTAINER (paned)->border_width);
- gtk_hpaned_xor_line (paned);
- }
-
- return TRUE;
-}
diff --git a/gtk/gtkhpaned.h b/gtk/gtkhpaned.h
deleted file mode 100644
index 0903891fc1..0000000000
--- a/gtk/gtkhpaned.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_HPANED_H__
-#define __GTK_HPANED_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkpaned.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_HPANED(obj) GTK_CHECK_CAST (obj, gtk_hpaned_get_type (), GtkHPaned)
-#define GTK_HPANED_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_hpaned_get_type (), GtkHPanedClass)
-#define GTK_IS_HPANED(obj) GTK_CHECK_TYPE (obj, gtk_hpaned_get_type ())
-
-
-typedef struct _GtkHPaned GtkHPaned;
-typedef struct _GtkHPanedClass GtkHPanedClass;
-
-struct _GtkHPaned
-{
- GtkPaned paned;
-};
-
-struct _GtkHPanedClass
-{
- GtkPanedClass parent_class;
-};
-
-
-guint gtk_hpaned_get_type (void);
-GtkWidget* gtk_hpaned_new (void);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_HPANED_H__ */
diff --git a/gtk/gtkhruler.c b/gtk/gtkhruler.c
deleted file mode 100644
index 990627d6e0..0000000000
--- a/gtk/gtkhruler.c
+++ /dev/null
@@ -1,287 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-#include "gtkhruler.h"
-
-
-#define RULER_HEIGHT 14
-#define MINIMUM_INCR 5
-#define MAXIMUM_SUBDIVIDE 5
-#define MAXIMUM_SCALES 10
-
-#define ROUND(x) ((int) ((x) + 0.5))
-
-
-static void gtk_hruler_class_init (GtkHRulerClass *klass);
-static void gtk_hruler_init (GtkHRuler *hruler);
-static gint gtk_hruler_motion_notify (GtkWidget *widget,
- GdkEventMotion *event);
-static void gtk_hruler_draw_ticks (GtkRuler *ruler);
-static void gtk_hruler_draw_pos (GtkRuler *ruler);
-
-
-guint
-gtk_hruler_get_type ()
-{
- static guint hruler_type = 0;
-
- if (!hruler_type)
- {
- GtkTypeInfo hruler_info =
- {
- "GtkHRuler",
- sizeof (GtkHRuler),
- sizeof (GtkHRulerClass),
- (GtkClassInitFunc) gtk_hruler_class_init,
- (GtkObjectInitFunc) gtk_hruler_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- hruler_type = gtk_type_unique (gtk_ruler_get_type (), &hruler_info);
- }
-
- return hruler_type;
-}
-
-static void
-gtk_hruler_class_init (GtkHRulerClass *klass)
-{
- GtkWidgetClass *widget_class;
- GtkRulerClass *ruler_class;
-
- widget_class = (GtkWidgetClass*) klass;
- ruler_class = (GtkRulerClass*) klass;
-
- widget_class->motion_notify_event = gtk_hruler_motion_notify;
-
- ruler_class->draw_ticks = gtk_hruler_draw_ticks;
- ruler_class->draw_pos = gtk_hruler_draw_pos;
-}
-
-static void
-gtk_hruler_init (GtkHRuler *hruler)
-{
- GtkWidget *widget;
-
- widget = GTK_WIDGET (hruler);
- widget->requisition.width = widget->style->klass->xthickness * 2 + 1;
- widget->requisition.height = widget->style->klass->ythickness * 2 + RULER_HEIGHT;
-}
-
-
-GtkWidget*
-gtk_hruler_new ()
-{
- return GTK_WIDGET (gtk_type_new (gtk_hruler_get_type ()));
-}
-
-static gint
-gtk_hruler_motion_notify (GtkWidget *widget,
- GdkEventMotion *event)
-{
- GtkRuler *ruler;
- gint x;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_HRULER (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- ruler = GTK_RULER (widget);
-
- if (event->is_hint)
- gdk_window_get_pointer (widget->window, &x, NULL, NULL);
- else
- x = event->x;
-
- ruler->position = ruler->lower + ((ruler->upper - ruler->lower) * x) / widget->allocation.width;
-
- /* Make sure the ruler has been allocated already */
- if (ruler->backing_store != NULL)
- gtk_ruler_draw_pos (ruler);
-
- return FALSE;
-}
-
-static void
-gtk_hruler_draw_ticks (GtkRuler *ruler)
-{
- GtkWidget *widget;
- GdkGC *gc, *bg_gc;
- GdkFont *font;
- gint i;
- gint width, height;
- gint xthickness;
- gint ythickness;
- gint length, ideal_length;
- gfloat subd_incr;
- gfloat step_incr;
- gfloat increment;
- gfloat start, end, cur;
- gchar unit_str[12];
- gint text_height;
- gint digit_height;
- gint pos;
- gint scale;
-
- g_return_if_fail (ruler != NULL);
- g_return_if_fail (GTK_IS_HRULER (ruler));
-
- if (GTK_WIDGET_DRAWABLE (ruler))
- {
- widget = GTK_WIDGET (ruler);
-
- gc = widget->style->fg_gc[GTK_STATE_NORMAL];
- bg_gc = widget->style->bg_gc[GTK_STATE_NORMAL];
- font = widget->style->font;
-
- xthickness = widget->style->klass->xthickness;
- ythickness = widget->style->klass->ythickness;
- digit_height = font->ascent; /* assume descent == 0? */
-
- width = widget->allocation.width;
- height = widget->allocation.height - ythickness * 2;
- gdk_draw_line (ruler->backing_store, gc,
- xthickness,
- height + ythickness,
- widget->allocation.width - xthickness,
- height + ythickness);
-
- if ((ruler->upper - ruler->lower) == 0)
- return;
-
- increment = (gfloat) width * ruler->metric->pixels_per_unit / (ruler->upper - ruler->lower);
-
- /* determine the scale
- * use the maximum extents of the ruler to determine the largest possible
- * number to be displayed. calculate the height in pixels of this displayed
- * text as for the vertical ruler case. use this height to find a scale
- * which leaves sufficient room for drawing the ruler.
- */
- scale = ceil (ruler->max_size / ruler->metric->pixels_per_unit);
- sprintf (unit_str, "%d", scale);
- text_height = strlen (unit_str) * digit_height + 1;
-
- for (scale = 0; scale < MAXIMUM_SCALES; scale++)
- if (ruler->metric->ruler_scale[scale] * increment > 2 * text_height)
- break;
-
- if (scale == MAXIMUM_SCALES)
- scale = MAXIMUM_SCALES - 1;
-
- length = 0;
- for (i = MAXIMUM_SUBDIVIDE - 1; i >= 0; i--)
- {
- subd_incr = (gfloat) ruler->metric->ruler_scale[scale] / (gfloat) ruler->metric->subdivide[i];
- step_incr = subd_incr * increment;
- if (step_incr <= MINIMUM_INCR)
- continue;
-
- start = floor ((ruler->lower / ruler->metric->pixels_per_unit) / subd_incr) * subd_incr;
- end = ceil ((ruler->upper / ruler->metric->pixels_per_unit) / subd_incr) * subd_incr;
-
- ideal_length = height / (i + 1) - 1;
- if (ideal_length > ++length)
- length = ideal_length;
-
- cur = start;
- while (cur <= end)
- {
- pos = ROUND ((cur - (ruler->lower / ruler->metric->pixels_per_unit)) * increment);
-
- gdk_draw_line (ruler->backing_store, gc,
- pos, height + ythickness, pos,
- height - length + ythickness);
- if (i == 0)
- {
- sprintf (unit_str, "%d", (int) cur);
- gdk_draw_rectangle (ruler->backing_store,
- bg_gc, TRUE,
- pos + 1, ythickness,
- gdk_string_width(font, unit_str) + 1,
- digit_height);
- gdk_draw_string (ruler->backing_store, font, gc,
- pos + 2, ythickness + font->ascent - 1,
- unit_str);
- }
-
- cur += subd_incr;
- }
- }
- }
-}
-
-static void
-gtk_hruler_draw_pos (GtkRuler *ruler)
-{
- GtkWidget *widget;
- GdkGC *gc;
- int i;
- gint x, y;
- gint width, height;
- gint bs_width, bs_height;
- gint xthickness;
- gint ythickness;
- gfloat increment;
-
- g_return_if_fail (ruler != NULL);
- g_return_if_fail (GTK_IS_HRULER (ruler));
-
- if (GTK_WIDGET_DRAWABLE (ruler))
- {
- widget = GTK_WIDGET (ruler);
-
- gc = widget->style->fg_gc[GTK_STATE_NORMAL];
- xthickness = widget->style->klass->xthickness;
- ythickness = widget->style->klass->ythickness;
- width = widget->allocation.width;
- height = widget->allocation.height - ythickness * 2;
-
- bs_width = height / 2;
- bs_width |= 1; /* make sure it's odd */
- bs_height = bs_width / 2 + 1;
-
- if ((bs_width > 0) && (bs_height > 0))
- {
- /* If a backing store exists, restore the ruler */
- if (ruler->backing_store && ruler->non_gr_exp_gc)
- gdk_draw_pixmap (ruler->widget.window,
- ruler->non_gr_exp_gc,
- ruler->backing_store,
- ruler->xsrc, ruler->ysrc,
- ruler->xsrc, ruler->ysrc,
- bs_width, bs_height);
-
- increment = (gfloat) width / (ruler->upper - ruler->lower);
-
- x = ROUND ((ruler->position - ruler->lower) * increment) + (xthickness - bs_width) / 2 - 1;
- y = (height + bs_height) / 2 + ythickness;
-
- for (i = 0; i < bs_height; i++)
- gdk_draw_line (widget->window, gc,
- x + i, y + i,
- x + bs_width - 1 - i, y + i);
-
-
- ruler->xsrc = x;
- ruler->ysrc = y;
- }
- }
-}
diff --git a/gtk/gtkhruler.h b/gtk/gtkhruler.h
deleted file mode 100644
index c4bc744364..0000000000
--- a/gtk/gtkhruler.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_HRULER_H__
-#define __GTK_HRULER_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkruler.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_HRULER(obj) GTK_CHECK_CAST (obj, gtk_hruler_get_type (), GtkHRuler)
-#define GTK_HRULER_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_hruler_get_type (), GtkHRulerClass)
-#define GTK_IS_HRULER(obj) GTK_CHECK_TYPE (obj, gtk_hruler_get_type ())
-
-
-typedef struct _GtkHRuler GtkHRuler;
-typedef struct _GtkHRulerClass GtkHRulerClass;
-
-struct _GtkHRuler
-{
- GtkRuler ruler;
-};
-
-struct _GtkHRulerClass
-{
- GtkRulerClass parent_class;
-};
-
-
-guint gtk_hruler_get_type (void);
-GtkWidget* gtk_hruler_new (void);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_HRULER_H__ */
diff --git a/gtk/gtkhscale.c b/gtk/gtkhscale.c
deleted file mode 100644
index 3c1e42dbc1..0000000000
--- a/gtk/gtkhscale.c
+++ /dev/null
@@ -1,437 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <stdio.h>
-#include "gtkhscale.h"
-#include "gtksignal.h"
-#include "gdk/gdkkeysyms.h"
-
-
-#define SCALE_CLASS(w) GTK_SCALE_CLASS (GTK_OBJECT (w)->klass)
-#define RANGE_CLASS(w) GTK_RANGE_CLASS (GTK_OBJECT (w)->klass)
-
-
-static void gtk_hscale_class_init (GtkHScaleClass *klass);
-static void gtk_hscale_init (GtkHScale *hscale);
-static void gtk_hscale_realize (GtkWidget *widget);
-static void gtk_hscale_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_hscale_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_hscale_pos_trough (GtkHScale *hscale,
- gint *x,
- gint *y,
- gint *w,
- gint *h);
-static void gtk_hscale_draw_slider (GtkRange *range);
-static void gtk_hscale_draw_value (GtkScale *scale);
-static gint gtk_hscale_trough_keys (GtkRange *range,
- GdkEventKey *key,
- GtkScrollType *scroll,
- GtkTroughType *pos);
-
-guint
-gtk_hscale_get_type ()
-{
- static guint hscale_type = 0;
-
- if (!hscale_type)
- {
- GtkTypeInfo hscale_info =
- {
- "GtkHScale",
- sizeof (GtkHScale),
- sizeof (GtkHScaleClass),
- (GtkClassInitFunc) gtk_hscale_class_init,
- (GtkObjectInitFunc) gtk_hscale_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- hscale_type = gtk_type_unique (gtk_scale_get_type (), &hscale_info);
- }
-
- return hscale_type;
-}
-
-static void
-gtk_hscale_class_init (GtkHScaleClass *class)
-{
- GtkWidgetClass *widget_class;
- GtkRangeClass *range_class;
- GtkScaleClass *scale_class;
-
- widget_class = (GtkWidgetClass*) class;
- range_class = (GtkRangeClass*) class;
- scale_class = (GtkScaleClass*) class;
-
- widget_class->realize = gtk_hscale_realize;
- widget_class->size_request = gtk_hscale_size_request;
- widget_class->size_allocate = gtk_hscale_size_allocate;
-
- range_class->slider_update = gtk_range_default_hslider_update;
- range_class->trough_click = gtk_range_default_htrough_click;
- range_class->motion = gtk_range_default_hmotion;
- range_class->draw_slider = gtk_hscale_draw_slider;
- range_class->trough_keys = gtk_hscale_trough_keys;
-
- scale_class->draw_value = gtk_hscale_draw_value;
-}
-
-static void
-gtk_hscale_init (GtkHScale *hscale)
-{
-}
-
-GtkWidget*
-gtk_hscale_new (GtkAdjustment *adjustment)
-{
- GtkHScale *hscale;
-
- hscale = gtk_type_new (gtk_hscale_get_type ());
-
- if (!adjustment)
- adjustment = (GtkAdjustment*) gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
-
- gtk_range_set_adjustment (GTK_RANGE (hscale), adjustment);
-
- return GTK_WIDGET (hscale);
-}
-
-
-static void
-gtk_hscale_realize (GtkWidget *widget)
-{
- GtkRange *range;
- GdkWindowAttr attributes;
- gint attributes_mask;
- gint x, y, w, h;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_HSCALE (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
- range = GTK_RANGE (widget);
-
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
-
- gtk_hscale_pos_trough (GTK_HSCALE (widget), &x, &y, &w, &h);
- attributes.x = x;
- attributes.y = y;
- attributes.width = w;
- attributes.height = h;
- attributes.event_mask |= (GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_ENTER_NOTIFY_MASK |
- GDK_LEAVE_NOTIFY_MASK);
-
- range->trough = gdk_window_new (widget->window, &attributes, attributes_mask);
-
- attributes.width = SCALE_CLASS (range)->slider_length;
- attributes.height = RANGE_CLASS (range)->slider_width;
- attributes.event_mask |= (GDK_BUTTON_MOTION_MASK |
- GDK_POINTER_MOTION_HINT_MASK);
-
- range->slider = gdk_window_new (range->trough, &attributes, attributes_mask);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
-
- gdk_window_set_user_data (widget->window, widget);
- gdk_window_set_user_data (range->trough, widget);
- gdk_window_set_user_data (range->slider, widget);
-
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
- gtk_style_set_background (widget->style, range->trough, GTK_STATE_ACTIVE);
- gtk_style_set_background (widget->style, range->slider, GTK_STATE_NORMAL);
-
- gtk_range_slider_update (GTK_RANGE (widget));
-
- gdk_window_show (range->slider);
- gdk_window_show (range->trough);
-}
-
-static void
-gtk_hscale_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkScale *scale;
- gint value_width;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_HSCALE (widget));
- g_return_if_fail (requisition != NULL);
-
- scale = GTK_SCALE (widget);
-
- requisition->width = (SCALE_CLASS (scale)->slider_length +
- widget->style->klass->xthickness) * 2;
- requisition->height = (RANGE_CLASS (scale)->slider_width +
- widget->style->klass->ythickness * 2);
-
- if (scale->draw_value)
- {
- value_width = gtk_scale_value_width (scale);
-
- if ((scale->value_pos == GTK_POS_LEFT) ||
- (scale->value_pos == GTK_POS_RIGHT))
- {
- requisition->width += value_width + SCALE_CLASS (scale)->value_spacing;
- if (requisition->height < (widget->style->font->ascent + widget->style->font->descent))
- requisition->height = widget->style->font->ascent + widget->style->font->descent;
- }
- else if ((scale->value_pos == GTK_POS_TOP) ||
- (scale->value_pos == GTK_POS_BOTTOM))
- {
- if (requisition->width < value_width)
- requisition->width = value_width;
- requisition->height += widget->style->font->ascent + widget->style->font->descent;
- }
- }
-}
-
-static void
-gtk_hscale_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkRange *range;
- GtkScale *scale;
- gint width, height;
- gint x, y;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_HSCALE (widget));
- g_return_if_fail (allocation != NULL);
-
- widget->allocation = *allocation;
- if (GTK_WIDGET_REALIZED (widget))
- {
- range = GTK_RANGE (widget);
- scale = GTK_SCALE (widget);
-
- gdk_window_move_resize (widget->window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
-
- gtk_hscale_pos_trough (GTK_HSCALE (widget), &x, &y, &width, &height);
-
- gdk_window_move_resize (range->trough, x, y, width, height);
- gtk_range_slider_update (GTK_RANGE (widget));
- }
-}
-
-static void
-gtk_hscale_pos_trough (GtkHScale *hscale,
- gint *x,
- gint *y,
- gint *w,
- gint *h)
-{
- GtkWidget *widget;
- GtkScale *scale;
-
- g_return_if_fail (hscale != NULL);
- g_return_if_fail (GTK_IS_HSCALE (hscale));
- g_return_if_fail ((x != NULL) && (y != NULL) && (w != NULL) && (h != NULL));
-
- widget = GTK_WIDGET (hscale);
- scale = GTK_SCALE (hscale);
-
- *w = widget->allocation.width;
- *h = (RANGE_CLASS (scale)->slider_width +
- widget->style->klass->ythickness * 2);
-
- if (scale->draw_value)
- {
- *x = 0;
- *y = 0;
-
- switch (scale->value_pos)
- {
- case GTK_POS_LEFT:
- *x += gtk_scale_value_width (scale) + SCALE_CLASS (scale)->value_spacing;
- *y = (widget->allocation.height - *h) / 2;
- *w -= *x;
- break;
- case GTK_POS_RIGHT:
- *w -= gtk_scale_value_width (scale) + SCALE_CLASS (scale)->value_spacing;
- *y = (widget->allocation.height - *h) / 2;
- break;
- case GTK_POS_TOP:
- *y = (widget->style->font->ascent + widget->style->font->descent +
- (widget->allocation.height - widget->requisition.height) / 2);
- break;
- case GTK_POS_BOTTOM:
- *y = (widget->allocation.height - widget->requisition.height) / 2;
- break;
- }
- }
- else
- {
- *x = 0;
- *y = (widget->allocation.height - *h) / 2;
- }
- *x += 1;
- *w -= 2;
-}
-
-static void
-gtk_hscale_draw_slider (GtkRange *range)
-{
- GtkStateType state_type;
- gint width, height;
-
- g_return_if_fail (range != NULL);
- g_return_if_fail (GTK_IS_HSCALE (range));
-
- if (range->slider)
- {
- if ((range->in_child == RANGE_CLASS (range)->slider) ||
- (range->click_child == RANGE_CLASS (range)->slider))
- state_type = GTK_STATE_PRELIGHT;
- else
- state_type = GTK_STATE_NORMAL;
-
- gtk_style_set_background (GTK_WIDGET (range)->style, range->slider, state_type);
- gdk_window_clear (range->slider);
-
- gdk_window_get_size (range->slider, &width, &height);
- gtk_draw_vline (GTK_WIDGET (range)->style, range->slider,
- state_type, 1, height - 2, width / 2);
-
- gtk_draw_shadow (GTK_WIDGET (range)->style, range->slider,
- state_type, GTK_SHADOW_OUT,
- 0, 0, -1, -1);
- }
-}
-
-static void
-gtk_hscale_draw_value (GtkScale *scale)
-{
- GtkStateType state_type;
- gchar buffer[16];
- gint text_width;
- gint width, height;
- gint x, y;
-
- g_return_if_fail (scale != NULL);
- g_return_if_fail (GTK_IS_HSCALE (scale));
-
- if (scale->draw_value)
- {
- gdk_window_get_size (GTK_WIDGET (scale)->window, &width, &height);
- gdk_window_clear_area (GTK_WIDGET (scale)->window, 1, 1, width - 2, height - 2);
-
- sprintf (buffer, "%0.*f", GTK_RANGE (scale)->digits, GTK_RANGE (scale)->adjustment->value);
- text_width = gdk_string_measure (GTK_WIDGET (scale)->style->font, buffer);
-
- switch (scale->value_pos)
- {
- case GTK_POS_LEFT:
- gdk_window_get_position (GTK_RANGE (scale)->trough, &x, &y);
- gdk_window_get_size (GTK_RANGE (scale)->trough, &width, &height);
-
- x -= SCALE_CLASS (scale)->value_spacing + text_width;
- y += ((height -
- (GTK_WIDGET (scale)->style->font->ascent +
- GTK_WIDGET (scale)->style->font->descent)) / 2 +
- GTK_WIDGET (scale)->style->font->ascent);
- break;
- case GTK_POS_RIGHT:
- gdk_window_get_position (GTK_RANGE (scale)->trough, &x, &y);
- gdk_window_get_size (GTK_RANGE (scale)->trough, &width, &height);
-
- x += width + SCALE_CLASS (scale)->value_spacing;
- y += ((height -
- (GTK_WIDGET (scale)->style->font->ascent +
- GTK_WIDGET (scale)->style->font->descent)) / 2 +
- GTK_WIDGET (scale)->style->font->ascent);
- break;
- case GTK_POS_TOP:
- gdk_window_get_position (GTK_RANGE (scale)->slider, &x, NULL);
- gdk_window_get_position (GTK_RANGE (scale)->trough, NULL, &y);
- gdk_window_get_size (GTK_RANGE (scale)->slider, &width, NULL);
- gdk_window_get_size (GTK_RANGE (scale)->trough, NULL, &height);
-
- x += (width - text_width) / 2;
- y -= GTK_WIDGET (scale)->style->font->descent;
- break;
- case GTK_POS_BOTTOM:
- gdk_window_get_position (GTK_RANGE (scale)->slider, &x, NULL);
- gdk_window_get_position (GTK_RANGE (scale)->trough, NULL, &y);
- gdk_window_get_size (GTK_RANGE (scale)->slider, &width, NULL);
- gdk_window_get_size (GTK_RANGE (scale)->trough, NULL, &height);
-
- x += (width - text_width) / 2;
- y += height + GTK_WIDGET (scale)->style->font->ascent;
- break;
- }
-
- state_type = GTK_STATE_NORMAL;
- if (!GTK_WIDGET_IS_SENSITIVE (scale))
- state_type = GTK_STATE_INSENSITIVE;
-
- gtk_draw_string (GTK_WIDGET (scale)->style,
- GTK_WIDGET (scale)->window,
- state_type, x, y, buffer);
- }
-}
-
-static gint
-gtk_hscale_trough_keys(GtkRange *range,
- GdkEventKey *key,
- GtkScrollType *scroll,
- GtkTroughType *pos)
-{
- gint return_val = FALSE;
- switch (key->keyval)
- {
- case GDK_Left:
- return_val = TRUE;
- if (key->state & GDK_CONTROL_MASK)
- *scroll = GTK_SCROLL_PAGE_BACKWARD;
- else
- *scroll = GTK_SCROLL_STEP_BACKWARD;
- break;
- case GDK_Right:
- return_val = TRUE;
- if (key->state & GDK_CONTROL_MASK)
- *scroll = GTK_SCROLL_PAGE_FORWARD;
- else
- *scroll = GTK_SCROLL_STEP_FORWARD;
- break;
- case GDK_Home:
- return_val = TRUE;
- *pos = GTK_TROUGH_START;
- break;
- case GDK_End:
- return_val = TRUE;
- *pos = GTK_TROUGH_END;
- break;
- }
- return return_val;
-}
diff --git a/gtk/gtkhscale.h b/gtk/gtkhscale.h
deleted file mode 100644
index 61ae4fdb31..0000000000
--- a/gtk/gtkhscale.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_HSCALE_H__
-#define __GTK_HSCALE_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkscale.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_HSCALE(obj) GTK_CHECK_CAST (obj, gtk_hscale_get_type (), GtkHScale)
-#define GTK_HSCALE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_hscale_get_type (), GtkHScaleClass)
-#define GTK_IS_HSCALE(obj) GTK_CHECK_TYPE (obj, gtk_hscale_get_type ())
-
-
-typedef struct _GtkHScale GtkHScale;
-typedef struct _GtkHScaleClass GtkHScaleClass;
-
-struct _GtkHScale
-{
- GtkScale scale;
-};
-
-struct _GtkHScaleClass
-{
- GtkScaleClass parent_class;
-};
-
-
-guint gtk_hscale_get_type (void);
-GtkWidget* gtk_hscale_new (GtkAdjustment *adjustment);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_HSCALE_H__ */
diff --git a/gtk/gtkhscrollbar.c b/gtk/gtkhscrollbar.c
deleted file mode 100644
index faa519a52b..0000000000
--- a/gtk/gtkhscrollbar.c
+++ /dev/null
@@ -1,392 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkhscrollbar.h"
-#include "gtksignal.h"
-#include "gdk/gdkkeysyms.h"
-
-
-#define EPSILON 0.01
-
-#define RANGE_CLASS(w) GTK_RANGE_CLASS (GTK_OBJECT (w)->klass)
-
-
-static void gtk_hscrollbar_class_init (GtkHScrollbarClass *klass);
-static void gtk_hscrollbar_init (GtkHScrollbar *hscrollbar);
-static void gtk_hscrollbar_realize (GtkWidget *widget);
-static void gtk_hscrollbar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_hscrollbar_draw_step_forw (GtkRange *range);
-static void gtk_hscrollbar_draw_step_back (GtkRange *range);
-static void gtk_hscrollbar_slider_update (GtkRange *range);
-static void gtk_hscrollbar_calc_slider_size (GtkHScrollbar *hscrollbar);
-static gint gtk_hscrollbar_trough_keys (GtkRange *range,
- GdkEventKey *key,
- GtkScrollType *scroll,
- GtkTroughType *pos);
-
-
-guint
-gtk_hscrollbar_get_type ()
-{
- static guint hscrollbar_type = 0;
-
- if (!hscrollbar_type)
- {
- GtkTypeInfo hscrollbar_info =
- {
- "GtkHScrollbar",
- sizeof (GtkHScrollbar),
- sizeof (GtkHScrollbarClass),
- (GtkClassInitFunc) gtk_hscrollbar_class_init,
- (GtkObjectInitFunc) gtk_hscrollbar_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- hscrollbar_type = gtk_type_unique (gtk_scrollbar_get_type (), &hscrollbar_info);
- }
-
- return hscrollbar_type;
-}
-
-static void
-gtk_hscrollbar_class_init (GtkHScrollbarClass *class)
-{
- GtkWidgetClass *widget_class;
- GtkRangeClass *range_class;
-
- widget_class = (GtkWidgetClass*) class;
- range_class = (GtkRangeClass*) class;
-
- widget_class->realize = gtk_hscrollbar_realize;
- widget_class->size_allocate = gtk_hscrollbar_size_allocate;
-
- range_class->draw_step_forw = gtk_hscrollbar_draw_step_forw;
- range_class->draw_step_back = gtk_hscrollbar_draw_step_back;
- range_class->slider_update = gtk_hscrollbar_slider_update;
- range_class->trough_click = gtk_range_default_htrough_click;
- range_class->trough_keys = gtk_hscrollbar_trough_keys;
- range_class->motion = gtk_range_default_hmotion;
-}
-
-static void
-gtk_hscrollbar_init (GtkHScrollbar *hscrollbar)
-{
- GtkWidget *widget;
- GtkRequisition *requisition;
-
- widget = GTK_WIDGET (hscrollbar);
- GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
- requisition = &widget->requisition;
-
- requisition->width = (RANGE_CLASS (widget)->min_slider_size +
- RANGE_CLASS (widget)->stepper_size +
- RANGE_CLASS (widget)->stepper_slider_spacing +
- widget->style->klass->xthickness) * 2;
- requisition->height = (RANGE_CLASS (widget)->slider_width +
- widget->style->klass->ythickness * 2);
-}
-
-GtkWidget*
-gtk_hscrollbar_new (GtkAdjustment *adjustment)
-{
- GtkHScrollbar *hscrollbar;
-
- hscrollbar = gtk_type_new (gtk_hscrollbar_get_type ());
-
- if (!adjustment)
- adjustment = (GtkAdjustment*) gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
-
- gtk_range_set_adjustment (GTK_RANGE (hscrollbar), adjustment);
-
- return GTK_WIDGET (hscrollbar);
-}
-
-
-static void
-gtk_hscrollbar_realize (GtkWidget *widget)
-{
- GtkRange *range;
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_HSCROLLBAR (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
- range = GTK_RANGE (widget);
-
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y + (widget->allocation.height - widget->requisition.height) / 2;
- attributes.width = widget->allocation.width;
- attributes.height = widget->requisition.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget);
- attributes.event_mask |= (GDK_EXPOSURE_MASK |
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_ENTER_NOTIFY_MASK |
- GDK_LEAVE_NOTIFY_MASK);
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
-
- range->trough = widget->window;
- gdk_window_ref (range->trough);
-
- attributes.x = widget->style->klass->xthickness;
- attributes.y = widget->style->klass->ythickness;
- attributes.width = RANGE_CLASS (widget)->stepper_size;
- attributes.height = RANGE_CLASS (widget)->stepper_size;
-
- range->step_back = gdk_window_new (range->trough, &attributes, attributes_mask);
-
- attributes.x = (widget->allocation.width -
- widget->style->klass->xthickness -
- RANGE_CLASS (widget)->stepper_size);
-
- range->step_forw = gdk_window_new (range->trough, &attributes, attributes_mask);
-
- attributes.x = 0;
- attributes.y = widget->style->klass->ythickness;
- attributes.width = RANGE_CLASS (widget)->min_slider_size;
- attributes.height = RANGE_CLASS (widget)->slider_width;
- attributes.event_mask |= (GDK_BUTTON_MOTION_MASK |
- GDK_POINTER_MOTION_HINT_MASK);
-
- range->slider = gdk_window_new (range->trough, &attributes, attributes_mask);
-
- gtk_hscrollbar_calc_slider_size (GTK_HSCROLLBAR (widget));
- gtk_range_slider_update (GTK_RANGE (widget));
-
- widget->style = gtk_style_attach (widget->style, widget->window);
-
- gdk_window_set_user_data (range->trough, widget);
- gdk_window_set_user_data (range->slider, widget);
- gdk_window_set_user_data (range->step_forw, widget);
- gdk_window_set_user_data (range->step_back, widget);
-
- gtk_style_set_background (widget->style, range->trough, GTK_STATE_ACTIVE);
- gtk_style_set_background (widget->style, range->slider, GTK_STATE_NORMAL);
- gtk_style_set_background (widget->style, range->step_forw, GTK_STATE_ACTIVE);
- gtk_style_set_background (widget->style, range->step_back, GTK_STATE_ACTIVE);
-
- gdk_window_show (range->slider);
- gdk_window_show (range->step_forw);
- gdk_window_show (range->step_back);
-}
-
-static void
-gtk_hscrollbar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkRange *range;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_HSCROLLBAR (widget));
- g_return_if_fail (allocation != NULL);
-
- widget->allocation = *allocation;
- if (GTK_WIDGET_REALIZED (widget))
- {
- range = GTK_RANGE (widget);
-
- gdk_window_move_resize (range->trough,
- allocation->x,
- allocation->y + (allocation->height - widget->requisition.height) / 2,
- allocation->width, widget->requisition.height);
- gdk_window_move_resize (range->step_back,
- widget->style->klass->xthickness,
- widget->style->klass->ythickness,
- RANGE_CLASS (widget)->stepper_size,
- widget->requisition.height - widget->style->klass->ythickness * 2);
- gdk_window_move_resize (range->step_forw,
- allocation->width - widget->style->klass->xthickness -
- RANGE_CLASS (widget)->stepper_size,
- widget->style->klass->ythickness,
- RANGE_CLASS (widget)->stepper_size,
- widget->requisition.height - widget->style->klass->ythickness * 2);
- gdk_window_resize (range->slider,
- RANGE_CLASS (widget)->min_slider_size,
- widget->requisition.height - widget->style->klass->ythickness * 2);
-
- gtk_range_slider_update (GTK_RANGE (widget));
- }
-}
-
-static void
-gtk_hscrollbar_draw_step_forw (GtkRange *range)
-{
- GtkStateType state_type;
- GtkShadowType shadow_type;
-
- g_return_if_fail (range != NULL);
- g_return_if_fail (GTK_IS_HSCROLLBAR (range));
-
- if (GTK_WIDGET_DRAWABLE (range))
- {
- if (range->in_child == RANGE_CLASS (range)->step_forw)
- {
- if (range->click_child == RANGE_CLASS (range)->step_forw)
- state_type = GTK_STATE_ACTIVE;
- else
- state_type = GTK_STATE_PRELIGHT;
- }
- else
- state_type = GTK_STATE_NORMAL;
-
- if (range->click_child == RANGE_CLASS (range)->step_forw)
- shadow_type = GTK_SHADOW_IN;
- else
- shadow_type = GTK_SHADOW_OUT;
-
- gtk_draw_arrow (GTK_WIDGET (range)->style, range->step_forw,
- state_type, shadow_type, GTK_ARROW_RIGHT,
- TRUE, 0, 0, -1, -1);
- }
-}
-
-static void
-gtk_hscrollbar_draw_step_back (GtkRange *range)
-{
- GtkStateType state_type;
- GtkShadowType shadow_type;
-
- g_return_if_fail (range != NULL);
- g_return_if_fail (GTK_IS_HSCROLLBAR (range));
-
- if (GTK_WIDGET_DRAWABLE (range))
- {
- if (range->in_child == RANGE_CLASS (range)->step_back)
- {
- if (range->click_child == RANGE_CLASS (range)->step_back)
- state_type = GTK_STATE_ACTIVE;
- else
- state_type = GTK_STATE_PRELIGHT;
- }
- else
- state_type = GTK_STATE_NORMAL;
-
- if (range->click_child == RANGE_CLASS (range)->step_back)
- shadow_type = GTK_SHADOW_IN;
- else
- shadow_type = GTK_SHADOW_OUT;
-
- gtk_draw_arrow (GTK_WIDGET (range)->style, range->step_back,
- state_type, shadow_type, GTK_ARROW_LEFT,
- TRUE, 0, 0, -1, -1);
- }
-}
-
-static void
-gtk_hscrollbar_slider_update (GtkRange *range)
-{
- g_return_if_fail (range != NULL);
- g_return_if_fail (GTK_IS_HSCROLLBAR (range));
-
- gtk_hscrollbar_calc_slider_size (GTK_HSCROLLBAR (range));
- gtk_range_default_hslider_update (range);
-}
-
-static void
-gtk_hscrollbar_calc_slider_size (GtkHScrollbar *hscrollbar)
-{
- GtkRange *range;
- gint step_back_x;
- gint step_back_width;
- gint step_forw_x;
- gint slider_width;
- gint slider_height;
- gint left, right;
- gint width;
-
- g_return_if_fail (hscrollbar != NULL);
- g_return_if_fail (GTK_IS_HSCROLLBAR (hscrollbar));
-
- if (GTK_WIDGET_REALIZED (hscrollbar))
- {
- range = GTK_RANGE (hscrollbar);
-
- gdk_window_get_size (range->step_back, &step_back_width, NULL);
- gdk_window_get_position (range->step_back, &step_back_x, NULL);
- gdk_window_get_position (range->step_forw, &step_forw_x, NULL);
-
- left = (step_back_x +
- step_back_width +
- RANGE_CLASS (hscrollbar)->stepper_slider_spacing);
- right = step_forw_x - RANGE_CLASS (hscrollbar)->stepper_slider_spacing;
- width = right - left;
-
- if ((range->adjustment->page_size > 0) &&
- (range->adjustment->lower != range->adjustment->upper))
- {
- if (range->adjustment->page_size >
- (range->adjustment->upper - range->adjustment->lower))
- range->adjustment->page_size = range->adjustment->upper - range->adjustment->lower;
-
- width = (width * range->adjustment->page_size /
- (range->adjustment->upper - range->adjustment->lower));
-
- if (width < RANGE_CLASS (hscrollbar)->min_slider_size)
- width = RANGE_CLASS (hscrollbar)->min_slider_size;
- }
-
- gdk_window_get_size (range->slider, &slider_width, &slider_height);
-
- if (slider_width != width)
- gdk_window_resize (range->slider, width, slider_height);
- }
-}
-
-static gint
-gtk_hscrollbar_trough_keys(GtkRange *range,
- GdkEventKey *key,
- GtkScrollType *scroll,
- GtkTroughType *pos)
-{
- gint return_val = FALSE;
- switch (key->keyval)
- {
- case GDK_Left:
- return_val = TRUE;
- *scroll = GTK_SCROLL_STEP_BACKWARD;
- break;
- case GDK_Right:
- return_val = TRUE;
- *scroll = GTK_SCROLL_STEP_FORWARD;
- break;
- case GDK_Home:
- return_val = TRUE;
- if (key->state & GDK_CONTROL_MASK)
- *scroll = GTK_SCROLL_PAGE_BACKWARD;
- else
- *pos = GTK_TROUGH_START;
- break;
- case GDK_End:
- return_val = TRUE;
- if (key->state & GDK_CONTROL_MASK)
- *scroll = GTK_SCROLL_PAGE_FORWARD;
- else
- *pos = GTK_TROUGH_END;
- break;
- }
- return return_val;
-}
diff --git a/gtk/gtkhscrollbar.h b/gtk/gtkhscrollbar.h
deleted file mode 100644
index 7d69512592..0000000000
--- a/gtk/gtkhscrollbar.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_HSCROLLBAR_H__
-#define __GTK_HSCROLLBAR_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkscrollbar.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_HSCROLLBAR(obj) GTK_CHECK_CAST (obj, gtk_hscrollbar_get_type (), GtkHScrollbar)
-#define GTK_HSCROLLBAR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_hscrollbar_get_type (), GtkHScrollbarClass)
-#define GTK_IS_HSCROLLBAR(obj) GTK_CHECK_TYPE (obj, gtk_hscrollbar_get_type ())
-
-
-typedef struct _GtkHScrollbar GtkHScrollbar;
-typedef struct _GtkHScrollbarClass GtkHScrollbarClass;
-
-struct _GtkHScrollbar
-{
- GtkScrollbar scrollbar;
-};
-
-struct _GtkHScrollbarClass
-{
- GtkScrollbarClass parent_class;
-};
-
-
-guint gtk_hscrollbar_get_type (void);
-GtkWidget* gtk_hscrollbar_new (GtkAdjustment *adjustment);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_HSCROLLBAR_H__ */
diff --git a/gtk/gtkhseparator.c b/gtk/gtkhseparator.c
deleted file mode 100644
index d0de76e47e..0000000000
--- a/gtk/gtkhseparator.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkhseparator.h"
-
-
-static void gtk_hseparator_class_init (GtkHSeparatorClass *klass);
-static void gtk_hseparator_init (GtkHSeparator *hseparator);
-static gint gtk_hseparator_expose (GtkWidget *widget,
- GdkEventExpose *event);
-
-
-guint
-gtk_hseparator_get_type ()
-{
- static guint hseparator_type = 0;
-
- if (!hseparator_type)
- {
- GtkTypeInfo hseparator_info =
- {
- "GtkHSeparator",
- sizeof (GtkHSeparator),
- sizeof (GtkHSeparatorClass),
- (GtkClassInitFunc) gtk_hseparator_class_init,
- (GtkObjectInitFunc) gtk_hseparator_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- hseparator_type = gtk_type_unique (gtk_separator_get_type (), &hseparator_info);
- }
-
- return hseparator_type;
-}
-
-static void
-gtk_hseparator_class_init (GtkHSeparatorClass *class)
-{
- GtkWidgetClass *widget_class;
-
- widget_class = (GtkWidgetClass*) class;
-
- widget_class->expose_event = gtk_hseparator_expose;
-}
-
-static void
-gtk_hseparator_init (GtkHSeparator *hseparator)
-{
- GTK_WIDGET (hseparator)->requisition.width = 1;
- GTK_WIDGET (hseparator)->requisition.height = GTK_WIDGET (hseparator)->style->klass->ythickness;
-}
-
-GtkWidget*
-gtk_hseparator_new ()
-{
- return GTK_WIDGET (gtk_type_new (gtk_hseparator_get_type ()));
-}
-
-
-static gint
-gtk_hseparator_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_HSEPARATOR (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- gtk_draw_hline (widget->style, widget->window, GTK_STATE_NORMAL,
- widget->allocation.x,
- widget->allocation.x + widget->allocation.width,
- widget->allocation.y + (widget->allocation.height -
- widget->style->klass->ythickness) / 2);
-
- return FALSE;
-}
diff --git a/gtk/gtkhseparator.h b/gtk/gtkhseparator.h
deleted file mode 100644
index 9902631516..0000000000
--- a/gtk/gtkhseparator.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_HSEPARATOR_H__
-#define __GTK_HSEPARATOR_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkseparator.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_HSEPARATOR(obj) GTK_CHECK_CAST (obj, gtk_hseparator_get_type (), GtkHSeparator)
-#define GTK_HSEPARATOR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_hseparator_get_type (), GtkHSeparatorClass)
-#define GTK_IS_HSEPARATOR(obj) GTK_CHECK_TYPE (obj, gtk_hseparator_get_type ())
-
-
-typedef struct _GtkHSeparator GtkHSeparator;
-typedef struct _GtkHSeparatorClass GtkHSeparatorClass;
-
-struct _GtkHSeparator
-{
- GtkSeparator separator;
-};
-
-struct _GtkHSeparatorClass
-{
- GtkSeparatorClass parent_class;
-};
-
-
-guint gtk_hseparator_get_type (void);
-GtkWidget* gtk_hseparator_new (void);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_HSEPARATOR_H__ */
diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c
deleted file mode 100644
index caa5a188c2..0000000000
--- a/gtk/gtkimage.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkcontainer.h"
-#include "gtkimage.h"
-
-
-static void gtk_image_class_init (GtkImageClass *klass);
-static void gtk_image_init (GtkImage *image);
-static gint gtk_image_expose (GtkWidget *widget,
- GdkEventExpose *event);
-
-
-guint
-gtk_image_get_type ()
-{
- static guint image_type = 0;
-
- if (!image_type)
- {
- GtkTypeInfo image_info =
- {
- "GtkImage",
- sizeof (GtkImage),
- sizeof (GtkImageClass),
- (GtkClassInitFunc) gtk_image_class_init,
- (GtkObjectInitFunc) gtk_image_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- image_type = gtk_type_unique (gtk_misc_get_type (), &image_info);
- }
-
- return image_type;
-}
-
-static void
-gtk_image_class_init (GtkImageClass *class)
-{
- GtkWidgetClass *widget_class;
-
- widget_class = (GtkWidgetClass*) class;
-
- widget_class->expose_event = gtk_image_expose;
-}
-
-static void
-gtk_image_init (GtkImage *image)
-{
- GTK_WIDGET_SET_FLAGS (image, GTK_NO_WINDOW);
-
- image->image = NULL;
- image->mask = NULL;
-}
-
-GtkWidget*
-gtk_image_new (GdkImage *val,
- GdkBitmap *mask)
-{
- GtkImage *image;
-
- g_return_val_if_fail (val != NULL, NULL);
-
- image = gtk_type_new (gtk_image_get_type ());
-
- gtk_image_set (image, val, mask);
-
- return GTK_WIDGET (image);
-}
-
-void
-gtk_image_set (GtkImage *image,
- GdkImage *val,
- GdkBitmap *mask)
-{
- g_return_if_fail (image != NULL);
- g_return_if_fail (GTK_IS_IMAGE (image));
-
- image->image = val;
- image->mask = mask;
-
- if (image->image)
- {
- GTK_WIDGET (image)->requisition.width = image->image->width + GTK_MISC (image)->xpad * 2;
- GTK_WIDGET (image)->requisition.height = image->image->height + GTK_MISC (image)->ypad * 2;
- }
- else
- {
- GTK_WIDGET (image)->requisition.width = 0;
- GTK_WIDGET (image)->requisition.height = 0;
- }
-
- if (GTK_WIDGET_VISIBLE (image))
- gtk_widget_queue_resize (GTK_WIDGET (image));
-}
-
-void
-gtk_image_get (GtkImage *image,
- GdkImage **val,
- GdkBitmap **mask)
-{
- g_return_if_fail (image != NULL);
- g_return_if_fail (GTK_IS_IMAGE (image));
-
- if (val)
- *val = image->image;
- if (mask)
- *mask = image->mask;
-}
-
-
-static gint
-gtk_image_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_IMAGE (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget))
- {
- GtkImage *image;
- GtkMisc *misc;
- GdkRectangle area, image_bound, intersection;
- gint x, y;
-
- image = GTK_IMAGE (widget);
- misc = GTK_MISC (widget);
-
- x = (widget->allocation.x * (1.0 - misc->xalign) +
- (widget->allocation.x + widget->allocation.width
- - (widget->requisition.width - misc->xpad * 2)) *
- misc->xalign) + 0.5;
- y = (widget->allocation.y * (1.0 - misc->yalign) +
- (widget->allocation.y + widget->allocation.height
- - (widget->requisition.height - misc->ypad * 2)) *
- misc->yalign) + 0.5;
-
- if (image->mask)
- {
- gdk_gc_set_clip_mask (widget->style->black_gc, image->mask);
- gdk_gc_set_clip_origin (widget->style->black_gc, x, y);
- }
-
- image_bound.x = x;
- image_bound.y = y;
- image_bound.width = image->image->width;
- image_bound.height = image->image->height;
-
- area = event->area;
-
- if(gdk_rectangle_intersect(&image_bound, &area, &intersection))
- {
- gdk_draw_image (widget->window,
- widget->style->black_gc,
- image->image,
- image_bound.x - x, image_bound.y - y,
- image_bound.x, image_bound.y,
- image_bound.width, image_bound.height);
- }
-
- if (image->mask)
- {
- gdk_gc_set_clip_mask (widget->style->black_gc, NULL);
- gdk_gc_set_clip_origin (widget->style->black_gc, 0, 0);
- }
- }
-
- return FALSE;
-}
diff --git a/gtk/gtkimage.h b/gtk/gtkimage.h
deleted file mode 100644
index d3481d51dd..0000000000
--- a/gtk/gtkimage.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_IMAGE_H__
-#define __GTK_IMAGE_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkmisc.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_IMAGE(obj) GTK_CHECK_CAST (obj, gtk_image_get_type (), GtkImage)
-#define GTK_IMAGE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_image_get_type (), GtkImageClass)
-#define GTK_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, gtk_image_get_type ())
-
-
-typedef struct _GtkImage GtkImage;
-typedef struct _GtkImageClass GtkImageClass;
-
-struct _GtkImage
-{
- GtkMisc misc;
-
- GdkImage *image;
- GdkBitmap *mask;
-};
-
-struct _GtkImageClass
-{
- GtkMiscClass parent_class;
-};
-
-
-guint gtk_image_get_type (void);
-GtkWidget* gtk_image_new (GdkImage *val,
- GdkBitmap *mask);
-void gtk_image_set (GtkImage *image,
- GdkImage *val,
- GdkBitmap *mask);
-void gtk_image_get (GtkImage *image,
- GdkImage **val,
- GdkBitmap **mask);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_IMAGE_H__ */
diff --git a/gtk/gtkinputdialog.c b/gtk/gtkinputdialog.c
deleted file mode 100644
index 27865e84c9..0000000000
--- a/gtk/gtkinputdialog.c
+++ /dev/null
@@ -1,709 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/*
- * gtkinputdialog.c
- *
- * Copyright 1997 Owen Taylor <owt1@cornell.edu>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include "gdk/gdkkeysyms.h"
-#include "gtkbutton.h"
-#include "gtkentry.h"
-#include "gtkhbox.h"
-#include "gtkhseparator.h"
-#include "gtkinputdialog.h"
-#include "gtklabel.h"
-#include "gtklistitem.h"
-#include "gtkmain.h"
-#include "gtkmenu.h"
-#include "gtkmenuitem.h"
-#include "gtknotebook.h"
-#include "gtkoptionmenu.h"
-#include "gtkscrolledwindow.h"
-#include "gtksignal.h"
-#include "gtktable.h"
-#include "gtkvbox.h"
-
-typedef void (*GtkInputDialogSignal1) (GtkObject *object,
- int arg1,
- gpointer data);
-
-typedef struct {
- gint index;
- GtkWidget *entry;
- GtkInputDialog *inputd;
-} GtkInputKeyInfo;
-
-enum
-{
- ENABLE_DEVICE,
- DISABLE_DEVICE,
- LAST_SIGNAL
-};
-
-
-#define AXIS_LIST_WIDTH 160
-#define AXIS_LIST_HEIGHT 175
-
-#define KEYS_LIST_WIDTH 200
-#define KEYS_LIST_HEIGHT 175
-
-/* Forward declarations */
-
-static void gtk_input_dialog_marshal_signal1 (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-static void gtk_input_dialog_class_init (GtkInputDialogClass *klass);
-static void gtk_input_dialog_init (GtkInputDialog *inputd);
-static GdkDeviceInfo *gtk_input_dialog_get_device_info(guint32 deviceid);
-static void gtk_input_dialog_set_device(GtkWidget *widget, gpointer data);
-static void gtk_input_dialog_finalize (GtkObject *object);
-static void gtk_input_dialog_set_mapping_mode(GtkWidget *w,
- gpointer data);
-static void gtk_input_dialog_set_axis(GtkWidget *widget, gpointer data);
-static void gtk_input_dialog_fill_axes (GtkInputDialog *inputd,
- GdkDeviceInfo *info);
-static void gtk_input_dialog_set_key (GtkInputKeyInfo *key,
- guint keyval,
- GdkModifierType modifiers);
-static gint gtk_input_dialog_key_press (GtkWidget *widget,
- GdkEventKey *event,
- GtkInputKeyInfo *key);
-static void gtk_input_dialog_clear_key (GtkWidget *widget,
- GtkInputKeyInfo *key);
-static void gtk_input_dialog_destroy_key (GtkWidget *widget,
- GtkInputKeyInfo *key);
-static void gtk_input_dialog_fill_keys (GtkInputDialog *inputd,
- GdkDeviceInfo *info);
-
-static GtkObjectClass *parent_class = NULL;
-static guint input_dialog_signals[LAST_SIGNAL] = { 0 };
-
-static void
-gtk_input_dialog_marshal_signal1 (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkInputDialogSignal1 rfunc;
-
- rfunc = (GtkInputDialogSignal1) func;
- (* rfunc) (object, GTK_VALUE_INT(args[0]), func_data);
-}
-
-static GdkDeviceInfo *
-gtk_input_dialog_get_device_info(guint32 deviceid)
-{
- GList *tmp_list = gdk_input_list_devices();
- while (tmp_list)
- {
- if (((GdkDeviceInfo *)tmp_list->data)->deviceid == deviceid)
- return (GdkDeviceInfo *)tmp_list->data;
- tmp_list = tmp_list->next;
- }
-
- return NULL;
-}
-
-guint
-gtk_input_dialog_get_type ()
-{
- static guint input_dialog_type = 0;
-
- if (!input_dialog_type)
- {
- GtkTypeInfo input_dialog_info =
- {
- "GtkInputDialog",
- sizeof (GtkInputDialog),
- sizeof (GtkInputDialogClass),
- (GtkClassInitFunc) gtk_input_dialog_class_init,
- (GtkObjectInitFunc) gtk_input_dialog_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- input_dialog_type = gtk_type_unique (gtk_dialog_get_type (),
- &input_dialog_info);
- }
-
- return input_dialog_type;
-}
-
-static void
-gtk_input_dialog_class_init (GtkInputDialogClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass*) klass;
-
- parent_class = gtk_type_class (gtk_dialog_get_type ());
-
- input_dialog_signals[ENABLE_DEVICE] =
- gtk_signal_new ("enable_device",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkInputDialogClass, enable_device),
- gtk_input_dialog_marshal_signal1,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
- input_dialog_signals[DISABLE_DEVICE] =
- gtk_signal_new ("disable_device",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkInputDialogClass, disable_device),
- gtk_input_dialog_marshal_signal1,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
- gtk_object_class_add_signals (object_class, input_dialog_signals,
- LAST_SIGNAL);
-
-
- object_class->finalize = gtk_input_dialog_finalize;
- klass->enable_device = NULL;
- klass->disable_device = NULL;
-}
-
-static void
-gtk_input_dialog_init (GtkInputDialog *inputd)
-{
- GtkWidget *vbox;
- GtkWidget *util_box;
- GtkWidget *label;
- GtkWidget *device_menu;
- GtkWidget *mapping_menu;
- GtkWidget *menuitem;
- GtkWidget *optionmenu;
- GtkWidget *separator;
- GtkWidget *notebook;
-
- GList *tmp_list;
- GList *device_info;
-
- device_info = gdk_input_list_devices();
-
- /* shell and main vbox */
-
- gtk_window_set_title (GTK_WINDOW (inputd), "Input");
-
- vbox = gtk_vbox_new (FALSE, 4);
- gtk_container_border_width(GTK_CONTAINER (vbox), 5);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (inputd)->vbox), vbox, TRUE, TRUE, 0);
-
- if (g_list_length(device_info) <= 1) /* only core device */
- {
- label = gtk_label_new ("No input devices");
- gtk_container_add (GTK_CONTAINER (vbox), label);
-
- gtk_widget_show (label);
- }
- else
- {
- /* menu for selecting device */
-
- device_menu = gtk_menu_new ();
-
- for (tmp_list = device_info; tmp_list; tmp_list = tmp_list->next) {
- GdkDeviceInfo *info = (GdkDeviceInfo *)(tmp_list->data);
- if (info->deviceid != GDK_CORE_POINTER)
- {
- menuitem = gtk_menu_item_new_with_label(info->name);
-
- gtk_menu_append(GTK_MENU(device_menu),menuitem);
- gtk_widget_show(menuitem);
- gtk_object_set_user_data (GTK_OBJECT (menuitem), inputd);
- gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
- (GtkSignalFunc) gtk_input_dialog_set_device,
- (gpointer)((long)info->deviceid));
- }
- }
-
- util_box = gtk_hbox_new (FALSE, 2);
- gtk_box_pack_start (GTK_BOX (vbox), util_box, FALSE, FALSE, 0);
-
- label = gtk_label_new("Device:");
- gtk_box_pack_start (GTK_BOX (util_box), label, FALSE, FALSE, 2);
-
- optionmenu = gtk_option_menu_new ();
- gtk_box_pack_start (GTK_BOX (util_box), optionmenu, TRUE, TRUE, 2);
- gtk_widget_show (optionmenu);
- gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), device_menu);
-
- gtk_widget_show (label);
-
- /* Device options */
-
- /* mapping mode option menu */
-
- mapping_menu = gtk_menu_new ();
-
- menuitem = gtk_menu_item_new_with_label("Disabled");
- gtk_menu_append(GTK_MENU(mapping_menu),menuitem);
- gtk_object_set_user_data (GTK_OBJECT (menuitem), inputd);
- gtk_widget_show(menuitem);
- gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
- (GtkSignalFunc) gtk_input_dialog_set_mapping_mode,
- (gpointer)((long)GDK_MODE_DISABLED));
-
- menuitem = gtk_menu_item_new_with_label("Screen");
- gtk_menu_append(GTK_MENU(mapping_menu),menuitem);
- gtk_object_set_user_data (GTK_OBJECT (menuitem), inputd);
- gtk_widget_show(menuitem);
- gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
- (GtkSignalFunc) gtk_input_dialog_set_mapping_mode,
- (gpointer)((long)GDK_MODE_SCREEN));
-
- menuitem = gtk_menu_item_new_with_label("Window");
- gtk_menu_append(GTK_MENU(mapping_menu),menuitem);
- gtk_object_set_user_data (GTK_OBJECT (menuitem), inputd);
- gtk_widget_show(menuitem);
- gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
- (GtkSignalFunc) gtk_input_dialog_set_mapping_mode,
- (gpointer)((long)GDK_MODE_WINDOW));
-
- label = gtk_label_new("Mode: ");
- gtk_box_pack_start (GTK_BOX (util_box), label, FALSE, FALSE, 2);
-
- inputd->mode_optionmenu = gtk_option_menu_new ();
- gtk_box_pack_start (GTK_BOX (util_box), inputd->mode_optionmenu, FALSE, FALSE, 2);
- gtk_widget_show (inputd->mode_optionmenu);
- gtk_option_menu_set_menu (GTK_OPTION_MENU (inputd->mode_optionmenu), mapping_menu);
-
- gtk_widget_show(label);
-
- gtk_widget_show (util_box);
-
- util_box = gtk_hbox_new (FALSE, 2);
- gtk_box_pack_start (GTK_BOX(vbox), util_box, FALSE, FALSE, 0);
-
- gtk_widget_show (label);
- gtk_widget_show (util_box);
-
- separator = gtk_hseparator_new();
- gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
- /* Notebook */
-
- notebook = gtk_notebook_new ();
- gtk_box_pack_start (GTK_BOX (vbox), notebook, TRUE, TRUE, 0);
- gtk_widget_show (notebook);
-
- /* The axis listbox */
-
- label = gtk_label_new ("Axes");
-
- inputd->axis_listbox = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(inputd->axis_listbox),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-
- gtk_widget_set_usize (inputd->axis_listbox, AXIS_LIST_WIDTH, AXIS_LIST_HEIGHT);
- gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
- inputd->axis_listbox, label);
-
- gtk_widget_show (inputd->axis_listbox);
-
- inputd->axis_list = 0;
-
- /* Keys listbox */
-
- label = gtk_label_new ("Keys");
-
- inputd->keys_listbox = gtk_scrolled_window_new (NULL, NULL);
- gtk_widget_set_usize (inputd->keys_listbox, KEYS_LIST_WIDTH, KEYS_LIST_HEIGHT);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(inputd->keys_listbox),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
- inputd->keys_listbox, label);
-
- gtk_widget_show (inputd->keys_listbox);
-
- inputd->keys_list = 0;
-
- /* ...set_device expects to get input dialog from widget user data */
- gtk_object_set_user_data (GTK_OBJECT (inputd), inputd);
- gtk_input_dialog_set_device(GTK_WIDGET(inputd), (gpointer)((long)
- ((GdkDeviceInfo *)device_info->data)->deviceid));
-
- }
-
- /* We create the save button in any case, so that clients can
- connect to it, without paying attention to whether it exits */
- inputd->save_button = gtk_button_new_with_label ("Save");
- GTK_WIDGET_SET_FLAGS (inputd->save_button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG(inputd)->action_area),
- inputd->save_button, TRUE, TRUE, 0);
- gtk_widget_show (inputd->save_button);
-
- if (g_list_length(device_info) <= 1) /* only core device */
- gtk_widget_set_sensitive(inputd->save_button, FALSE);
-
- inputd->close_button = gtk_button_new_with_label ("Close");
- GTK_WIDGET_SET_FLAGS (inputd->close_button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG(inputd)->action_area),
- inputd->close_button, TRUE, TRUE, 0);
-
- gtk_widget_show (inputd->close_button);
- gtk_widget_grab_default (inputd->close_button);
-
- gtk_widget_show (vbox);
-}
-
-
-GtkWidget*
-gtk_input_dialog_new (void)
-{
- GtkInputDialog *inputd;
-
- inputd = gtk_type_new (gtk_input_dialog_get_type ());
-
- return GTK_WIDGET (inputd);
-}
-
-static void
-gtk_input_dialog_set_device(GtkWidget *widget, gpointer data)
-{
- guint32 deviceid = (guint32)data;
- GdkDeviceInfo *info;
-
- GtkInputDialog *inputd = GTK_INPUT_DIALOG(
- gtk_object_get_user_data(GTK_OBJECT(widget)));
-
- inputd->current_device = deviceid;
- info = gtk_input_dialog_get_device_info((guint32)data);
-
- gtk_input_dialog_fill_axes(inputd, info);
- gtk_input_dialog_fill_keys(inputd, info);
-
- gtk_option_menu_set_history(GTK_OPTION_MENU(inputd->mode_optionmenu),
- info->mode);
-}
-
-static void
-gtk_input_dialog_finalize (GtkObject *object)
-{
- /* GtkInputDialog *inputd = GTK_INPUT_DIALOG (object); */
-
- /* Clean up ? */
-
- (* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-static void
-gtk_input_dialog_set_mapping_mode(GtkWidget *w,
- gpointer data)
-{
- GtkInputDialog *inputd = GTK_INPUT_DIALOG(
- gtk_object_get_user_data(GTK_OBJECT(w)));
- GdkDeviceInfo *info = gtk_input_dialog_get_device_info (inputd->current_device);
- GdkInputMode old_mode = info->mode;
- GdkInputMode mode = (GdkInputMode)data;
-
- if (mode != old_mode)
- {
- if (gdk_input_set_mode(inputd->current_device, mode))
- {
- if (mode == GDK_MODE_DISABLED)
- gtk_signal_emit (GTK_OBJECT (inputd),
- input_dialog_signals[DISABLE_DEVICE],
- info->deviceid);
- else
- gtk_signal_emit (GTK_OBJECT (inputd),
- input_dialog_signals[ENABLE_DEVICE],
- info->deviceid);
- }
- else
- gtk_option_menu_set_history (GTK_OPTION_MENU (inputd->mode_optionmenu),
- old_mode);
-
- /* FIXME: error dialog ? */
- }
-}
-
-static void
-gtk_input_dialog_set_axis(GtkWidget *widget, gpointer data)
-{
- GdkAxisUse use = (GdkAxisUse)data & 0xFFFF;
- GdkAxisUse old_use;
- GdkAxisUse *new_axes;
- GtkInputDialog *inputd = GTK_INPUT_DIALOG (gtk_object_get_user_data (GTK_OBJECT (widget)));
- GdkDeviceInfo *info = gtk_input_dialog_get_device_info (inputd->current_device);
-
- gint axis = ((gint)data >> 16) - 1;
- gint old_axis;
- int i;
-
- new_axes = g_new (GdkAxisUse, info->num_axes);
- old_axis = -1;
- for (i=0;i<info->num_axes;i++)
- {
- new_axes[i] = info->axes[i];
- if (info->axes[i] == use)
- old_axis = i;
- }
-
- if (axis != -1)
- old_use = info->axes[axis];
- else
- old_use = GDK_AXIS_IGNORE;
-
- if (axis == old_axis)
- return;
-
- /* we must always have an x and a y axis */
- if ((axis == -1 && (use == GDK_AXIS_X || use == GDK_AXIS_Y)) ||
- (old_axis == -1 && (old_use == GDK_AXIS_X || old_use == GDK_AXIS_Y)))
- {
- gtk_option_menu_set_history (
- GTK_OPTION_MENU (inputd->axis_items[use]),
- old_axis + 1);
- }
- else
- {
- if (axis != -1)
- new_axes[axis] = use;
-
- if (old_axis != -1)
- new_axes[old_axis] = old_use;
-
- if (old_use != GDK_AXIS_IGNORE)
- {
- gtk_option_menu_set_history (
- GTK_OPTION_MENU (inputd->axis_items[old_use]),
- old_axis + 1);
- }
- gdk_input_set_axes (info->deviceid, new_axes);
- }
-
- g_free (new_axes);
-}
-
-static void
-gtk_input_dialog_fill_axes(GtkInputDialog *inputd, GdkDeviceInfo *info)
-{
- static char *axis_use_strings[GDK_AXIS_LAST] =
- {
- "",
- "X",
- "Y",
- "Pressure",
- "X Tilt",
- "Y Tilt"
- };
-
- int i,j;
- GtkWidget *menu;
- GtkWidget *option_menu;
- GtkWidget *label;
-
- /* remove all the old items */
- if (inputd->axis_list)
- {
- gtk_widget_hide (inputd->axis_list); /* suppress resizes (or get warnings) */
- gtk_widget_destroy (inputd->axis_list);
- }
- inputd->axis_list = gtk_table_new (GDK_AXIS_LAST, 2, 0);
- gtk_container_add (GTK_CONTAINER (inputd->axis_listbox), inputd->axis_list);
- gtk_widget_show (inputd->axis_list);
-
- gtk_widget_realize (inputd->axis_list);
- gdk_window_set_background (inputd->axis_list->window,
- &inputd->axis_list->style->base[GTK_STATE_NORMAL]);
-
- for (i=GDK_AXIS_X;i<GDK_AXIS_LAST;i++)
- {
- /* create the label */
-
- label = gtk_label_new(axis_use_strings[i]);
- gtk_table_attach (GTK_TABLE (inputd->axis_list), label, 0, 1, i, i+1,
- 0, 0, 2, 2);
-
- /* and the use option menu */
- menu = gtk_menu_new();
-
- for (j = -1; j < info->num_axes; j++)
- {
- char buffer[16];
- GtkWidget *menu_item;
-
- if (j == -1)
- menu_item = gtk_menu_item_new_with_label ("none");
- else
- {
- sprintf (buffer,"%d",j+1);
- menu_item = gtk_menu_item_new_with_label (buffer);
- }
- gtk_object_set_user_data (GTK_OBJECT (menu_item), inputd);
- gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
- (GtkSignalFunc) gtk_input_dialog_set_axis,
- (gpointer) ((long) (0x10000 * (j + 1) + i)));
- gtk_widget_show (menu_item);
- gtk_menu_append (GTK_MENU (menu), menu_item);
- }
-
- inputd->axis_items[i] = option_menu = gtk_option_menu_new ();
- gtk_table_attach (GTK_TABLE (inputd->axis_list), option_menu,
- 1, 2, i, i+1, 0, 0, 2, 2);
-
- gtk_widget_show (option_menu);
- gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
- for (j = 0; j < info->num_axes; j++)
- if (info->axes[j] == (GdkAxisUse) i)
- {
- gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), j+1);
- break;
- }
-
- gtk_widget_show (label);
- }
-}
-
-static void
-gtk_input_dialog_clear_key (GtkWidget *widget, GtkInputKeyInfo *key)
-{
- gtk_entry_set_text (GTK_ENTRY(key->entry), "(disabled)");
- gdk_input_set_key (key->inputd->current_device, key->index, 0, 0);
-}
-
-static void
-gtk_input_dialog_set_key (GtkInputKeyInfo *key,
- guint keyval, GdkModifierType modifiers)
-{
- GString *str;
- gchar chars[2];
-
- if (keyval)
- {
- str = g_string_new("");
-
- if (modifiers & GDK_SHIFT_MASK)
- g_string_append (str, "Shft+");
- if (modifiers & GDK_CONTROL_MASK)
- g_string_append (str, "Ctl+");
- if (modifiers & GDK_MOD1_MASK)
- g_string_append (str, "Alt+");
-
- if ((keyval >= 0x20) && (keyval <= 0xFF))
- {
- chars[0] = keyval;
- chars[1] = 0;
- g_string_append (str, chars);
- }
- else
- g_string_append (str, "(unknown)");
- gtk_entry_set_text (GTK_ENTRY(key->entry), str->str);
-
- g_string_free (str, TRUE);
- }
- else
- {
- gtk_entry_set_text (GTK_ENTRY(key->entry), "(disabled)");
- }
-}
-
-static gint
-gtk_input_dialog_key_press (GtkWidget *widget,
- GdkEventKey *event,
- GtkInputKeyInfo *key)
-{
- gtk_input_dialog_set_key (key, event->keyval, event->state & 0xFF);
- gdk_input_set_key (key->inputd->current_device, key->index,
- event->keyval, event->state & 0xFF);
-
- gtk_signal_emit_stop_by_name (GTK_OBJECT(widget), "key_press_event");
-
- return TRUE;
-}
-
-static void
-gtk_input_dialog_destroy_key (GtkWidget *widget, GtkInputKeyInfo *key)
-{
- g_free (key);
-}
-
-static void
-gtk_input_dialog_fill_keys(GtkInputDialog *inputd, GdkDeviceInfo *info)
-{
- int i;
- GtkWidget *label;
- GtkWidget *button;
-
- char buffer[16];
-
- /* remove all the old items */
- if (inputd->keys_list)
- {
- gtk_widget_hide (inputd->keys_list); /* suppress resizes (or get warnings) */
- gtk_widget_destroy (inputd->keys_list);
- }
-
- inputd->keys_list = gtk_table_new (info->num_keys, 3, FALSE);
- gtk_container_add (GTK_CONTAINER (inputd->keys_listbox), inputd->keys_list);
- gtk_widget_show (inputd->keys_list);
-
- gtk_widget_realize (inputd->keys_list);
- gdk_window_set_background (inputd->keys_list->window,
- &inputd->keys_list->style->base[GTK_STATE_NORMAL]);
-
- for (i=0;i<info->num_keys;i++)
- {
- GtkInputKeyInfo *key = g_new (GtkInputKeyInfo, 1);
- key->index = i;
- key->inputd = inputd;
-
- /* create the label */
-
- sprintf(buffer, "%d", i+1);
- label = gtk_label_new(buffer);
- gtk_table_attach (GTK_TABLE (inputd->keys_list), label, 0, 1, i, i+1,
- 0, 0, 2, 2);
- gtk_widget_show (label);
-
- /* the entry */
-
- key->entry = gtk_entry_new ();
- gtk_table_attach (GTK_TABLE (inputd->keys_list), key->entry, 1, 2, i, i+1,
- GTK_EXPAND | GTK_FILL , 0, 2, 2);
- gtk_widget_show (key->entry);
-
- gtk_signal_connect (GTK_OBJECT(key->entry), "key_press_event",
- GTK_SIGNAL_FUNC (gtk_input_dialog_key_press), key);
- gtk_signal_connect (GTK_OBJECT(key->entry), "destroy",
- GTK_SIGNAL_FUNC (gtk_input_dialog_destroy_key),
- key);
-
- /* and clear button */
-
- button = gtk_button_new_with_label ("clear");
- gtk_table_attach (GTK_TABLE (inputd->keys_list), button, 2, 3, i, i+1,
- 0, 0, 2, 2);
- gtk_widget_show (button);
-
- gtk_signal_connect (GTK_OBJECT(button), "clicked",
- GTK_SIGNAL_FUNC (gtk_input_dialog_clear_key), key);
-
- gtk_input_dialog_set_key (key, info->keys[i].keyval,
- info->keys[i].modifiers);
- }
-}
diff --git a/gtk/gtkinputdialog.h b/gtk/gtkinputdialog.h
deleted file mode 100644
index ab082b5827..0000000000
--- a/gtk/gtkinputdialog.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_INPUTDIALOG_H__
-#define __GTK_INPUTDIALOG_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkdialog.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_INPUT_DIALOG(obj) GTK_CHECK_CAST (obj, gtk_input_dialog_get_type (), GtkInputDialog)
-#define GTK_INPUT_DIALOG_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_input_dialog_get_type (), GtkInputDialogClass)
-#define GTK_IS_INPUT_DIALOG(obj) GTK_CHECK_TYPE (obj, gtk_input_dialog_get_type ())
-
-
-typedef struct _GtkInputDialog GtkInputDialog;
-typedef struct _GtkInputDialogClass GtkInputDialogClass;
-
-struct _GtkInputDialog
-{
- GtkDialog dialog;
-
- GtkWidget *axis_list;
- GtkWidget *axis_listbox;
- GtkWidget *mode_optionmenu;
-
- GtkWidget *close_button;
- GtkWidget *save_button;
-
- GtkWidget *axis_items[GDK_AXIS_LAST];
- guint32 current_device;
-
- GtkWidget *keys_list;
- GtkWidget *keys_listbox;
-};
-
-struct _GtkInputDialogClass
-{
- GtkWindowClass parent_class;
-
- void (* enable_device) (GtkInputDialog *inputd,
- guint32 devid);
- void (* disable_device) (GtkInputDialog *inputd,
- guint32 devid);
-};
-
-
-guint gtk_input_dialog_get_type (void);
-GtkWidget* gtk_input_dialog_new (void);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_INPUTDIALOG_H__ */
diff --git a/gtk/gtkitem.c b/gtk/gtkitem.c
deleted file mode 100644
index 6705f37219..0000000000
--- a/gtk/gtkitem.c
+++ /dev/null
@@ -1,192 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkitem.h"
-#include "gtksignal.h"
-
-
-enum {
- SELECT,
- DESELECT,
- TOGGLE,
- LAST_SIGNAL
-};
-
-
-static void gtk_item_class_init (GtkItemClass *klass);
-static void gtk_item_init (GtkItem *item);
-static void gtk_item_map (GtkWidget *widget);
-static void gtk_item_unmap (GtkWidget *widget);
-static void gtk_item_realize (GtkWidget *widget);
-
-
-static guint item_signals[LAST_SIGNAL] = { 0 };
-
-
-guint
-gtk_item_get_type ()
-{
- static guint item_type = 0;
-
- if (!item_type)
- {
- GtkTypeInfo item_info =
- {
- "GtkItem",
- sizeof (GtkItem),
- sizeof (GtkItemClass),
- (GtkClassInitFunc) gtk_item_class_init,
- (GtkObjectInitFunc) gtk_item_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- item_type = gtk_type_unique (gtk_bin_get_type (), &item_info);
- }
-
- return item_type;
-}
-
-static void
-gtk_item_class_init (GtkItemClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- object_class = (GtkObjectClass*) class;
- widget_class = (GtkWidgetClass*) class;
-
- item_signals[SELECT] =
- gtk_signal_new ("select",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkItemClass, select),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
- item_signals[DESELECT] =
- gtk_signal_new ("deselect",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkItemClass, deselect),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
- item_signals[TOGGLE] =
- gtk_signal_new ("toggle",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkItemClass, toggle),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, item_signals, LAST_SIGNAL);
-
- widget_class->activate_signal = item_signals[TOGGLE];
- widget_class->map = gtk_item_map;
- widget_class->unmap = gtk_item_unmap;
- widget_class->realize = gtk_item_realize;
-
- class->select = NULL;
- class->deselect = NULL;
- class->toggle = NULL;
-}
-
-static void
-gtk_item_init (GtkItem *item)
-{
- GTK_WIDGET_UNSET_FLAGS (item, GTK_NO_WINDOW);
-}
-
-void
-gtk_item_select (GtkItem *item)
-{
- gtk_signal_emit (GTK_OBJECT (item), item_signals[SELECT]);
-}
-
-void
-gtk_item_deselect (GtkItem *item)
-{
- gtk_signal_emit (GTK_OBJECT (item), item_signals[DESELECT]);
-}
-
-void
-gtk_item_toggle (GtkItem *item)
-{
- gtk_signal_emit (GTK_OBJECT (item), item_signals[TOGGLE]);
-}
-
-
-static void
-gtk_item_map (GtkWidget *widget)
-{
- GtkBin *bin;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_ITEM (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
- gdk_window_show (widget->window);
-
- bin = GTK_BIN (widget);
-
- if (bin->child &&
- GTK_WIDGET_VISIBLE (bin->child) &&
- !GTK_WIDGET_MAPPED (bin->child))
- gtk_widget_map (bin->child);
-}
-
-static void
-gtk_item_unmap (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_ITEM (widget));
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
- gdk_window_hide (widget->window);
-}
-
-static void
-gtk_item_realize (GtkWidget *widget)
-{
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_ITEM (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = (GDK_EXPOSURE_MASK |
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_ENTER_NOTIFY_MASK |
- GDK_LEAVE_NOTIFY_MASK);
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
-}
diff --git a/gtk/gtkitem.h b/gtk/gtkitem.h
deleted file mode 100644
index 36cf1ab451..0000000000
--- a/gtk/gtkitem.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_ITEM_H__
-#define __GTK_ITEM_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkbin.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_ITEM(obj) GTK_CHECK_CAST (obj, gtk_item_get_type (), GtkItem)
-#define GTK_ITEM_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_item_get_type (), GtkItemClass)
-#define GTK_IS_ITEM(obj) GTK_CHECK_TYPE (obj, gtk_item_get_type ())
-
-
-typedef struct _GtkItem GtkItem;
-typedef struct _GtkItemClass GtkItemClass;
-
-struct _GtkItem
-{
- GtkBin bin;
-};
-
-struct _GtkItemClass
-{
- GtkBinClass parent_class;
-
- void (* select) (GtkItem *item);
- void (* deselect) (GtkItem *item);
- void (* toggle) (GtkItem *item);
-};
-
-
-guint gtk_item_get_type (void);
-void gtk_item_select (GtkItem *item);
-void gtk_item_deselect (GtkItem *item);
-void gtk_item_toggle (GtkItem *item);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_ITEM_H__ */
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
deleted file mode 100644
index 694f9620a8..0000000000
--- a/gtk/gtklabel.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <string.h>
-#include "gtklabel.h"
-
-
-enum {
- ARG_0,
- ARG_LABEL,
- ARG_JUSTIFY
-};
-
-static void gtk_label_class_init (GtkLabelClass *klass);
-static void gtk_label_init (GtkLabel *label);
-static void gtk_label_set_arg (GtkLabel *label,
- GtkArg *arg,
- guint arg_id);
-static void gtk_label_get_arg (GtkLabel *label,
- GtkArg *arg,
- guint arg_id);
-static void gtk_label_finalize (GtkObject *object);
-static void gtk_label_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static gint gtk_label_expose (GtkWidget *widget,
- GdkEventExpose *event);
-
-
-static GtkMiscClass *parent_class = NULL;
-
-
-guint
-gtk_label_get_type ()
-{
- static guint label_type = 0;
-
- if (!label_type)
- {
- GtkTypeInfo label_info =
- {
- "GtkLabel",
- sizeof (GtkLabel),
- sizeof (GtkLabelClass),
- (GtkClassInitFunc) gtk_label_class_init,
- (GtkObjectInitFunc) gtk_label_init,
- (GtkArgSetFunc) gtk_label_set_arg,
- (GtkArgGetFunc) gtk_label_get_arg,
- };
-
- label_type = gtk_type_unique (gtk_misc_get_type (), &label_info);
- }
-
- return label_type;
-}
-
-static void
-gtk_label_class_init (GtkLabelClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- object_class = (GtkObjectClass*) class;
- widget_class = (GtkWidgetClass*) class;
-
- parent_class = gtk_type_class (gtk_misc_get_type ());
-
- gtk_object_add_arg_type ("GtkLabel::label", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_LABEL);
- gtk_object_add_arg_type ("GtkLabel::justify", GTK_TYPE_ENUM, GTK_ARG_READWRITE, ARG_JUSTIFY);
-
- object_class->finalize = gtk_label_finalize;
-
- widget_class->size_request = gtk_label_size_request;
- widget_class->expose_event = gtk_label_expose;
-}
-
-static void
-gtk_label_set_arg (GtkLabel *label,
- GtkArg *arg,
- guint arg_id)
-{
- switch (arg_id)
- {
- case ARG_LABEL:
- gtk_label_set (label, GTK_VALUE_STRING (*arg));
- break;
- case ARG_JUSTIFY:
- gtk_label_set_justify (label, GTK_VALUE_ENUM (*arg));
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void gtk_label_get_arg (GtkLabel *label,
- GtkArg *arg,
- guint arg_id)
-{
- switch (arg_id)
- {
- case ARG_LABEL:
- GTK_VALUE_STRING (*arg) = g_strdup (label->label);
- break;
- case ARG_JUSTIFY:
- GTK_VALUE_ENUM (*arg) = label->jtype;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-gtk_label_init (GtkLabel *label)
-{
- GTK_WIDGET_SET_FLAGS (label, GTK_NO_WINDOW);
-
- label->label = NULL;
- label->row = NULL;
- label->jtype = GTK_JUSTIFY_CENTER;
-
- gtk_label_set (label, "");
-}
-
-GtkWidget*
-gtk_label_new (const char *str)
-{
- GtkLabel *label;
-
- g_return_val_if_fail (str != NULL, NULL);
-
- label = gtk_type_new (gtk_label_get_type ());
-
- gtk_label_set (label, str);
-
- return GTK_WIDGET (label);
-}
-
-void
-gtk_label_set (GtkLabel *label,
- const char *str)
-{
- char* p;
-
- g_return_if_fail (label != NULL);
- g_return_if_fail (GTK_IS_LABEL (label));
- g_return_if_fail (str != NULL);
-
- if (label->label)
- g_free (label->label);
- label->label = g_strdup (str);
-
- if (label->row)
- g_slist_free (label->row);
- label->row = NULL;
- label->row = g_slist_append (label->row, label->label);
- p = label->label;
- while ((p = strchr(p, '\n')))
- label->row = g_slist_append (label->row, ++p);
-
- if (GTK_WIDGET_VISIBLE (label))
- {
- if (GTK_WIDGET_MAPPED (label))
- gdk_window_clear_area (GTK_WIDGET (label)->window,
- GTK_WIDGET (label)->allocation.x,
- GTK_WIDGET (label)->allocation.y,
- GTK_WIDGET (label)->allocation.width,
- GTK_WIDGET (label)->allocation.height);
-
- gtk_widget_queue_resize (GTK_WIDGET (label));
- }
-}
-
-void
-gtk_label_set_justify (GtkLabel *label, GtkJustification jtype)
-{
- g_return_if_fail (label != NULL);
- g_return_if_fail (GTK_IS_LABEL (label));
-
- if ((GtkJustification) label->jtype != jtype)
- {
- label->jtype = jtype;
-
- if (GTK_WIDGET_VISIBLE (label))
- {
- if (GTK_WIDGET_MAPPED (label))
- gdk_window_clear_area (GTK_WIDGET (label)->window,
- GTK_WIDGET (label)->allocation.x,
- GTK_WIDGET (label)->allocation.y,
- GTK_WIDGET (label)->allocation.width,
- GTK_WIDGET (label)->allocation.height);
-
- gtk_widget_queue_resize (GTK_WIDGET (label));
- }
- }
-}
-
-void
-gtk_label_get (GtkLabel *label,
- char **str)
-{
- g_return_if_fail (label != NULL);
- g_return_if_fail (GTK_IS_LABEL (label));
- g_return_if_fail (str != NULL);
-
- *str = label->label;
-}
-
-
-static void
-gtk_label_finalize (GtkObject *object)
-{
- GtkLabel *label;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_LABEL (object));
-
- label = GTK_LABEL (object);
-
- g_free (label->label);
- g_slist_free (label->row);
-
- (* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-static void
-gtk_label_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkLabel *label;
- GSList *row;
- gint width;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_LABEL (widget));
- g_return_if_fail (requisition != NULL);
-
- label = GTK_LABEL (widget);
-
- row = label->row;
- width = 0;
- while (row)
- {
- if (row->next)
- width = MAX (width,
- gdk_text_width (GTK_WIDGET (label)->style->font, row->data,
- (gchar*) row->next->data - (gchar*) row->data));
- else
- width = MAX (width, gdk_string_width (GTK_WIDGET (label)->style->font, row->data));
- row = row->next;
- }
-
- requisition->width = width + label->misc.xpad * 2;
- requisition->height = ((GTK_WIDGET (label)->style->font->ascent +
- GTK_WIDGET (label)->style->font->descent + 2) *
- g_slist_length(label->row) +
- label->misc.ypad * 2);
-}
-
-static gint
-gtk_label_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkLabel *label;
- GtkMisc *misc;
- GSList *row;
- gint state;
- gint offset;
- gint len;
- gint maxl;
- gint x, y;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_LABEL (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget))
- {
- label = GTK_LABEL (widget);
- misc = GTK_MISC (widget);
-
- state = widget->state;
-
- maxl = widget->requisition.width - misc->xpad * 2;
-
- /*
- * GC Clipping
- */
- gdk_gc_set_clip_rectangle (widget->style->white_gc, &event->area);
- gdk_gc_set_clip_rectangle (widget->style->fg_gc[state], &event->area);
-
- x = widget->allocation.x + misc->xpad +
- (widget->allocation.width - widget->requisition.width)
- * misc->xalign + 0.5;
-
- y = (widget->allocation.y * (1.0 - misc->yalign) +
- (widget->allocation.y + widget->allocation.height -
- (widget->requisition.height - misc->ypad * 2)) *
- misc->yalign + widget->style->font->ascent) + 1.5;
-
- row = label->row;
- while (row && row->next)
- {
- len = (gchar*) row->next->data - (gchar*) row->data;
- offset = 0;
-
- if (label->jtype == GTK_JUSTIFY_CENTER)
- offset = (maxl - gdk_text_width (widget->style->font, row->data, len)) / 2;
-
- else if (label->jtype == GTK_JUSTIFY_RIGHT)
- offset = (maxl - gdk_text_width (widget->style->font, row->data, len));
-
- if (state == GTK_STATE_INSENSITIVE)
- gdk_draw_text (widget->window, widget->style->font,
- widget->style->white_gc,
- offset + x + 1, y + 1, row->data, len);
-
- gdk_draw_text (widget->window, widget->style->font,
- widget->style->fg_gc[state],
- offset + x, y, row->data, len);
- row = row->next;
- y += widget->style->font->ascent + widget->style->font->descent + 2;
- }
-
- /*
- * COMMENT: we can avoid gdk_text_width() calls here storing in label->row
- * the widths of the rows calculated in gtk_label_set.
- * Once we have a wrapping interface we can support GTK_JUSTIFY_FILL.
- */
- offset = 0;
-
- if (label->jtype == GTK_JUSTIFY_CENTER)
- offset = (maxl - gdk_string_width (widget->style->font, row->data)) / 2;
-
- else if (label->jtype == GTK_JUSTIFY_RIGHT)
- offset = (maxl - gdk_string_width (widget->style->font, row->data));
-
- if (state == GTK_STATE_INSENSITIVE)
- gdk_draw_string (widget->window, widget->style->font,
- widget->style->white_gc,
- offset + x + 1, y + 1, row->data);
-
- gdk_draw_string (widget->window, widget->style->font,
- widget->style->fg_gc[state],
- offset + x, y, row->data);
-
- gdk_gc_set_clip_mask (widget->style->white_gc, NULL);
- gdk_gc_set_clip_mask (widget->style->fg_gc[state], NULL);
-
- }
- return TRUE;
-}
-
-
-
-
-
diff --git a/gtk/gtklabel.h b/gtk/gtklabel.h
deleted file mode 100644
index 81eca4afe7..0000000000
--- a/gtk/gtklabel.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_LABEL_H__
-#define __GTK_LABEL_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkmisc.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_LABEL(obj) GTK_CHECK_CAST (obj, gtk_label_get_type (), GtkLabel)
-#define GTK_LABEL_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_label_get_type (), GtkLabelClass)
-#define GTK_IS_LABEL(obj) GTK_CHECK_TYPE (obj, gtk_label_get_type ())
-
-
-typedef struct _GtkLabel GtkLabel;
-typedef struct _GtkLabelClass GtkLabelClass;
-
-struct _GtkLabel
-{
- GtkMisc misc;
-
- char *label;
- GSList *row;
- guint jtype : 2;
-};
-
-struct _GtkLabelClass
-{
- GtkMiscClass parent_class;
-};
-
-
-guint gtk_label_get_type (void);
-GtkWidget* gtk_label_new (const char *str);
-void gtk_label_set (GtkLabel *label,
- const char *str);
-void gtk_label_set_justify (GtkLabel *label,
- GtkJustification jtype);
-void gtk_label_get (GtkLabel *label,
- char **str);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_LABEL_H__ */
diff --git a/gtk/gtklist.c b/gtk/gtklist.c
deleted file mode 100644
index 67fc1fa568..0000000000
--- a/gtk/gtklist.c
+++ /dev/null
@@ -1,1040 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtklist.h"
-#include "gtklistitem.h"
-#include "gtkmain.h"
-#include "gtksignal.h"
-
-
-enum {
- SELECTION_CHANGED,
- SELECT_CHILD,
- UNSELECT_CHILD,
- LAST_SIGNAL
-};
-
-
-typedef void (*GtkListSignal) (GtkObject *object,
- gpointer arg1,
- gpointer data);
-
-
-static void gtk_list_class_init (GtkListClass *klass);
-static void gtk_list_init (GtkList *list);
-static void gtk_list_destroy (GtkObject *object);
-static void gtk_list_map (GtkWidget *widget);
-static void gtk_list_unmap (GtkWidget *widget);
-static void gtk_list_realize (GtkWidget *widget);
-static void gtk_list_draw (GtkWidget *widget,
- GdkRectangle *area);
-static gint gtk_list_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static gint gtk_list_motion_notify (GtkWidget *widget,
- GdkEventMotion *event);
-static gint gtk_list_button_press (GtkWidget *widget,
- GdkEventButton *event);
-static gint gtk_list_button_release (GtkWidget *widget,
- GdkEventButton *event);
-static void gtk_list_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_list_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_list_add (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_list_remove (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_list_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data);
-
-static void gtk_real_list_select_child (GtkList *list,
- GtkWidget *child);
-static void gtk_real_list_unselect_child (GtkList *list,
- GtkWidget *child);
-
-static void gtk_list_marshal_signal (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-
-static GtkContainerClass *parent_class = NULL;
-static guint list_signals[LAST_SIGNAL] = { 0 };
-
-
-guint
-gtk_list_get_type ()
-{
- static guint list_type = 0;
-
- if (!list_type)
- {
- GtkTypeInfo list_info =
- {
- "GtkList",
- sizeof (GtkList),
- sizeof (GtkListClass),
- (GtkClassInitFunc) gtk_list_class_init,
- (GtkObjectInitFunc) gtk_list_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- list_type = gtk_type_unique (gtk_container_get_type (), &list_info);
- }
-
- return list_type;
-}
-
-static void
-gtk_list_class_init (GtkListClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GtkObjectClass*) class;
- widget_class = (GtkWidgetClass*) class;
- container_class = (GtkContainerClass*) class;
-
- parent_class = gtk_type_class (gtk_container_get_type ());
-
- list_signals[SELECTION_CHANGED] =
- gtk_signal_new ("selection_changed",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkListClass, selection_changed),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
- list_signals[SELECT_CHILD] =
- gtk_signal_new ("select_child",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkListClass, select_child),
- gtk_list_marshal_signal,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_WIDGET);
- list_signals[UNSELECT_CHILD] =
- gtk_signal_new ("unselect_child",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkListClass, unselect_child),
- gtk_list_marshal_signal,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_WIDGET);
-
- gtk_object_class_add_signals (object_class, list_signals, LAST_SIGNAL);
-
- object_class->destroy = gtk_list_destroy;
-
- widget_class->map = gtk_list_map;
- widget_class->unmap = gtk_list_unmap;
- widget_class->realize = gtk_list_realize;
- widget_class->draw = gtk_list_draw;
- widget_class->expose_event = gtk_list_expose;
- widget_class->motion_notify_event = gtk_list_motion_notify;
- widget_class->button_press_event = gtk_list_button_press;
- widget_class->button_release_event = gtk_list_button_release;
- widget_class->size_request = gtk_list_size_request;
- widget_class->size_allocate = gtk_list_size_allocate;
-
- container_class->add = gtk_list_add;
- container_class->remove = gtk_list_remove;
- container_class->foreach = gtk_list_foreach;
-
- class->selection_changed = NULL;
- class->select_child = gtk_real_list_select_child;
- class->unselect_child = gtk_real_list_unselect_child;
-}
-
-static void
-gtk_list_init (GtkList *list)
-{
- list->children = NULL;
- list->selection = NULL;
- list->timer = 0;
- list->selection_start_pos = 0;
- list->selection_end_pos = 0;
- list->selection_mode = GTK_SELECTION_SINGLE;
- list->scroll_direction = 0;
- list->have_grab = FALSE;
-}
-
-GtkWidget*
-gtk_list_new ()
-{
- return GTK_WIDGET (gtk_type_new (gtk_list_get_type ()));
-}
-
-static void
-gtk_list_destroy (GtkObject *object)
-{
- GList *node;
-
- GtkList *list = GTK_LIST (object);
-
- for (node = list->children; node; node = node->next)
- {
- GtkWidget *child;
-
- child = (GtkWidget *)node->data;
- gtk_widget_ref (child);
- gtk_widget_unparent (child);
- gtk_widget_destroy (child);
- gtk_widget_unref (child);
- }
- g_list_free (list->children);
- list->children = NULL;
-
- for (node = list->selection; node; node = node->next)
- {
- GtkWidget *child;
-
- child = (GtkWidget *)node->data;
- gtk_widget_unref (child);
- }
- g_list_free (list->selection);
- list->selection = NULL;
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (*GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-void
-gtk_list_insert_items (GtkList *list,
- GList *items,
- gint position)
-{
- GtkWidget *widget;
- GList *tmp_list;
- GList *last;
- gint nchildren;
-
- g_return_if_fail (list != NULL);
- g_return_if_fail (GTK_IS_LIST (list));
-
- if (!items)
- return;
-
- tmp_list = items;
- while (tmp_list)
- {
- widget = tmp_list->data;
- tmp_list = tmp_list->next;
-
- gtk_widget_set_parent (widget, GTK_WIDGET (list));
-
- if (GTK_WIDGET_VISIBLE (widget->parent))
- {
- if (GTK_WIDGET_REALIZED (widget->parent) &&
- !GTK_WIDGET_REALIZED (widget))
- gtk_widget_realize (widget);
-
- if (GTK_WIDGET_MAPPED (widget->parent) &&
- !GTK_WIDGET_MAPPED (widget))
- gtk_widget_map (widget);
- }
- }
-
- nchildren = g_list_length (list->children);
- if ((position < 0) || (position > nchildren))
- position = nchildren;
-
- if (position == nchildren)
- {
- if (list->children)
- {
- tmp_list = g_list_last (list->children);
- tmp_list->next = items;
- items->prev = tmp_list;
- }
- else
- {
- list->children = items;
- }
- }
- else
- {
- tmp_list = g_list_nth (list->children, position);
- last = g_list_last (items);
-
- if (tmp_list->prev)
- tmp_list->prev->next = items;
- last->next = tmp_list;
- items->prev = tmp_list->prev;
- tmp_list->prev = last;
-
- if (tmp_list == list->children)
- list->children = items;
- }
-
- if (list->children && !list->selection &&
- (list->selection_mode == GTK_SELECTION_BROWSE))
- {
- widget = list->children->data;
- gtk_list_select_child (list, widget);
- }
-
- if (GTK_WIDGET_VISIBLE (list))
- gtk_widget_queue_resize (GTK_WIDGET (list));
-}
-
-void
-gtk_list_append_items (GtkList *list,
- GList *items)
-{
- g_return_if_fail (list != NULL);
- g_return_if_fail (GTK_IS_LIST (list));
-
- gtk_list_insert_items (list, items, -1);
-}
-
-void
-gtk_list_prepend_items (GtkList *list,
- GList *items)
-{
- g_return_if_fail (list != NULL);
- g_return_if_fail (GTK_IS_LIST (list));
-
- gtk_list_insert_items (list, items, 0);
-}
-
-static void
-gtk_list_remove_items_internal (GtkList *list,
- GList *items,
- gboolean no_unref)
-{
- GtkWidget *widget;
- GList *selected_widgets;
- GList *tmp_list;
-
- g_return_if_fail (list != NULL);
- g_return_if_fail (GTK_IS_LIST (list));
-
- tmp_list = items;
- selected_widgets = NULL;
- widget = NULL;
-
- while (tmp_list)
- {
- widget = tmp_list->data;
- tmp_list = tmp_list->next;
-
- if (widget->state == GTK_STATE_SELECTED)
- selected_widgets = g_list_prepend (selected_widgets, widget);
-
- list->children = g_list_remove (list->children, widget);
-
- if (GTK_WIDGET_MAPPED (widget))
- gtk_widget_unmap (widget);
-
- if (no_unref)
- gtk_widget_ref (widget);
- gtk_widget_unparent (widget);
- }
-
- if (selected_widgets)
- {
- tmp_list = selected_widgets;
- while (tmp_list)
- {
- widget = tmp_list->data;
- tmp_list = tmp_list->next;
-
- gtk_list_unselect_child (list, widget);
- }
-
- gtk_signal_emit (GTK_OBJECT (list), list_signals[SELECTION_CHANGED]);
- }
-
- g_list_free (selected_widgets);
-
- if (list->children && !list->selection &&
- (list->selection_mode == GTK_SELECTION_BROWSE))
- {
- widget = list->children->data;
- gtk_list_select_child (list, widget);
- }
-
- if (GTK_WIDGET_VISIBLE (list))
- gtk_widget_queue_resize (GTK_WIDGET (list));
-}
-
-void
-gtk_list_remove_items (GtkList *list,
- GList *items)
-{
- gtk_list_remove_items_internal (list, items, FALSE);
-}
-
-void
-gtk_list_remove_items_no_unref (GtkList *list,
- GList *items)
-{
- gtk_list_remove_items_internal (list, items, TRUE);
-}
-
-void
-gtk_list_clear_items (GtkList *list,
- gint start,
- gint end)
-{
- GtkWidget *widget;
- GList *start_list;
- GList *end_list;
- GList *tmp_list;
- gint nchildren;
- gint selection_changed;
-
- g_return_if_fail (list != NULL);
- g_return_if_fail (GTK_IS_LIST (list));
-
- nchildren = g_list_length (list->children);
-
- if (nchildren > 0)
- {
- if ((end < 0) || (end > nchildren))
- end = nchildren;
-
- if (start >= end)
- return;
-
- start_list = g_list_nth (list->children, start);
- end_list = g_list_nth (list->children, end);
-
- if (start_list->prev)
- start_list->prev->next = end_list;
- if (end_list && end_list->prev)
- end_list->prev->next = NULL;
- if (end_list)
- end_list->prev = start_list->prev;
- if (start_list == list->children)
- list->children = end_list;
-
- selection_changed = FALSE;
- widget = NULL;
- tmp_list = start_list;
-
- while (tmp_list)
- {
- widget = tmp_list->data;
- tmp_list = tmp_list->next;
-
- if (widget->state == GTK_STATE_SELECTED)
- {
- selection_changed = TRUE;
- list->selection = g_list_remove (list->selection, widget);
- gtk_widget_unref (widget);
- }
-
- gtk_widget_unparent (widget);
- }
-
- g_list_free (start_list);
-
- if (list->children && !list->selection &&
- (list->selection_mode == GTK_SELECTION_BROWSE))
- {
- widget = list->children->data;
- gtk_list_select_child (list, widget);
- }
-
- if (selection_changed)
- gtk_signal_emit (GTK_OBJECT (list), list_signals[SELECTION_CHANGED]);
-
- gtk_widget_queue_resize (GTK_WIDGET (list));
- }
-}
-
-void
-gtk_list_select_item (GtkList *list,
- gint item)
-{
- GList *tmp_list;
-
- g_return_if_fail (list != NULL);
- g_return_if_fail (GTK_IS_LIST (list));
-
- tmp_list = g_list_nth (list->children, item);
- if (tmp_list)
- gtk_list_select_child (list, GTK_WIDGET (tmp_list->data));
-}
-
-void
-gtk_list_unselect_item (GtkList *list,
- gint item)
-{
- GList *tmp_list;
-
- g_return_if_fail (list != NULL);
- g_return_if_fail (GTK_IS_LIST (list));
-
- tmp_list = g_list_nth (list->children, item);
- if (tmp_list)
- gtk_list_unselect_child (list, GTK_WIDGET (tmp_list->data));
-}
-
-void
-gtk_list_select_child (GtkList *list,
- GtkWidget *child)
-{
- gtk_signal_emit (GTK_OBJECT (list), list_signals[SELECT_CHILD], child);
-}
-
-void
-gtk_list_unselect_child (GtkList *list,
- GtkWidget *child)
-{
- gtk_signal_emit (GTK_OBJECT (list), list_signals[UNSELECT_CHILD], child);
-}
-
-gint
-gtk_list_child_position (GtkList *list,
- GtkWidget *child)
-{
- GList *children;
- gint pos;
-
- g_return_val_if_fail (list != NULL, -1);
- g_return_val_if_fail (GTK_IS_LIST (list), -1);
- g_return_val_if_fail (child != NULL, -1);
-
- pos = 0;
- children = list->children;
-
- while (children)
- {
- if (child == GTK_WIDGET (children->data))
- return pos;
-
- pos += 1;
- children = children->next;
- }
-
- return -1;
-}
-
-void
-gtk_list_set_selection_mode (GtkList *list,
- GtkSelectionMode mode)
-{
- g_return_if_fail (list != NULL);
- g_return_if_fail (GTK_IS_LIST (list));
-
- list->selection_mode = mode;
-}
-
-
-static void
-gtk_list_map (GtkWidget *widget)
-{
- GtkList *list;
- GtkWidget *child;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_LIST (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
- list = GTK_LIST (widget);
-
- gdk_window_show (widget->window);
-
- children = list->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child) &&
- !GTK_WIDGET_MAPPED (child))
- gtk_widget_map (child);
- }
-}
-
-static void
-gtk_list_unmap (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_LIST (widget));
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
- gdk_window_hide (widget->window);
-}
-
-static void
-gtk_list_realize (GtkWidget *widget)
-{
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_LIST (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = GDK_EXPOSURE_MASK;
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
- gdk_window_set_background (widget->window,
- &widget->style->base[GTK_STATE_NORMAL]);
-}
-
-static void
-gtk_list_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkList *list;
- GtkWidget *child;
- GdkRectangle child_area;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_LIST (widget));
- g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- list = GTK_LIST (widget);
-
- children = list->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (gtk_widget_intersect (child, area, &child_area))
- gtk_widget_draw (child, &child_area);
- }
- }
-}
-
-static gint
-gtk_list_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkList *list;
- GtkWidget *child;
- GdkEventExpose child_event;
- GList *children;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_LIST (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- list = GTK_LIST (widget);
-
- child_event = *event;
-
- children = list->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_NO_WINDOW (child) &&
- gtk_widget_intersect (child, &event->area, &child_event.area))
- gtk_widget_event (child, (GdkEvent*) &child_event);
- }
- }
-
- return FALSE;
-}
-
-static gint
-gtk_list_motion_notify (GtkWidget *widget,
- GdkEventMotion *event)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_LIST (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- g_print ("gtk_list_motion_notify\n");
-
- return FALSE;
-}
-
-static gint
-gtk_list_button_press (GtkWidget *widget,
- GdkEventButton *event)
-{
- GtkList *list;
- GtkWidget *item;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_LIST (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- list = GTK_LIST (widget);
- item = gtk_get_event_widget ((GdkEvent*) event);
-
- if (!item)
- return FALSE;
-
- while (!gtk_type_is_a (GTK_WIDGET_TYPE (item), gtk_list_item_get_type ()))
- item = item->parent;
-
- gtk_list_select_child (list, item);
-
- return FALSE;
-}
-
-static gint
-gtk_list_button_release (GtkWidget *widget,
- GdkEventButton *event)
-{
- GtkList *list;
- GtkWidget *item;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_LIST (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- list = GTK_LIST (widget);
- item = gtk_get_event_widget ((GdkEvent*) event);
-
- return FALSE;
-}
-
-static void
-gtk_list_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkList *list;
- GtkWidget *child;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_LIST (widget));
- g_return_if_fail (requisition != NULL);
-
- list = GTK_LIST (widget);
- requisition->width = 0;
- requisition->height = 0;
-
- children = list->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child))
- {
- gtk_widget_size_request (child, &child->requisition);
-
- requisition->width = MAX (requisition->width, child->requisition.width);
- requisition->height += child->requisition.height;
- }
- }
-
- requisition->width += GTK_CONTAINER (list)->border_width * 2;
- requisition->height += GTK_CONTAINER (list)->border_width * 2;
-
- requisition->width = MAX (requisition->width, 1);
- requisition->height = MAX (requisition->height, 1);
-}
-
-static void
-gtk_list_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkList *list;
- GtkWidget *child;
- GtkAllocation child_allocation;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_LIST (widget));
- g_return_if_fail (allocation != NULL);
-
- list = GTK_LIST (widget);
-
- widget->allocation = *allocation;
- if (GTK_WIDGET_REALIZED (widget))
- gdk_window_move_resize (widget->window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
-
- if (list->children)
- {
- child_allocation.x = GTK_CONTAINER (list)->border_width;
- child_allocation.y = GTK_CONTAINER (list)->border_width;
- child_allocation.width = allocation->width - child_allocation.x * 2;
-
- children = list->children;
-
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child))
- {
- child_allocation.height = child->requisition.height;
-
- gtk_widget_size_allocate (child, &child_allocation);
-
- child_allocation.y += child_allocation.height;
- }
- }
- }
-}
-
-static void
-gtk_list_add (GtkContainer *container,
- GtkWidget *widget)
-{
- GtkList *list;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_LIST (container));
- g_return_if_fail (widget != NULL);
-
- list = GTK_LIST (container);
-
- gtk_widget_set_parent (widget, GTK_WIDGET (container));
- if (GTK_WIDGET_VISIBLE (widget->parent))
- {
- if (GTK_WIDGET_REALIZED (widget->parent) &&
- !GTK_WIDGET_REALIZED (widget))
- gtk_widget_realize (widget);
-
- if (GTK_WIDGET_MAPPED (widget->parent) &&
- !GTK_WIDGET_MAPPED (widget))
- gtk_widget_map (widget);
- }
-
- list->children = g_list_append (list->children, widget);
-
- if (!list->selection && (list->selection_mode == GTK_SELECTION_BROWSE))
- gtk_list_select_child (list, widget);
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (container))
- gtk_widget_queue_resize (widget);
-}
-
-static void
-gtk_list_remove (GtkContainer *container,
- GtkWidget *widget)
-{
- GList *item_list;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_LIST (container));
- g_return_if_fail (widget != NULL);
- g_return_if_fail (container == GTK_CONTAINER (widget->parent));
-
-
- item_list = g_list_alloc ();
- item_list->data = widget;
-
- gtk_list_remove_items (GTK_LIST (container), item_list);
-
- g_list_free (item_list);
-}
-
-static void
-gtk_list_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
-{
- GtkList *list;
- GtkWidget *child;
- GList *children;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_LIST (container));
- g_return_if_fail (callback != NULL);
-
- list = GTK_LIST (container);
- children = list->children;
-
- while (children)
- {
- child = children->data;
- children = children->next;
-
- (* callback) (child, callback_data);
- }
-}
-
-
-static void
-gtk_real_list_select_child (GtkList *list,
- GtkWidget *child)
-{
- GList *selection;
- GList *tmp_list;
- GtkWidget *tmp_item;
-
- g_return_if_fail (list != NULL);
- g_return_if_fail (GTK_IS_LIST (list));
- g_return_if_fail (child != NULL);
- g_return_if_fail (GTK_IS_LIST_ITEM (child));
-
- switch (list->selection_mode)
- {
- case GTK_SELECTION_SINGLE:
- selection = list->selection;
-
- while (selection)
- {
- tmp_item = selection->data;
-
- if (tmp_item != child)
- {
- gtk_list_item_deselect (GTK_LIST_ITEM (tmp_item));
-
- tmp_list = selection;
- selection = selection->next;
-
- list->selection = g_list_remove_link (list->selection, tmp_list);
- gtk_widget_unref (GTK_WIDGET (tmp_item));
-
- g_list_free (tmp_list);
- }
- else
- selection = selection->next;
- }
-
- if (child->state == GTK_STATE_NORMAL)
- {
- gtk_list_item_select (GTK_LIST_ITEM (child));
- list->selection = g_list_prepend (list->selection, child);
- gtk_widget_ref (child);
- }
- else if (child->state == GTK_STATE_SELECTED)
- {
- gtk_list_item_deselect (GTK_LIST_ITEM (child));
- list->selection = g_list_remove (list->selection, child);
- gtk_widget_unref (child);
- }
-
- gtk_signal_emit (GTK_OBJECT (list), list_signals[SELECTION_CHANGED]);
- break;
-
- case GTK_SELECTION_BROWSE:
- selection = list->selection;
-
- while (selection)
- {
- tmp_item = selection->data;
-
- if (tmp_item != child)
- {
- gtk_list_item_deselect (GTK_LIST_ITEM (tmp_item));
-
- tmp_list = selection;
- selection = selection->next;
-
- list->selection = g_list_remove_link (list->selection, tmp_list);
- gtk_widget_unref (GTK_WIDGET (tmp_item));
-
- g_list_free (tmp_list);
- }
- else
- selection = selection->next;
- }
-
- if (child->state == GTK_STATE_NORMAL)
- {
- gtk_list_item_select (GTK_LIST_ITEM (child));
- list->selection = g_list_prepend (list->selection, child);
- gtk_widget_ref (child);
- gtk_signal_emit (GTK_OBJECT (list), list_signals[SELECTION_CHANGED]);
- }
- break;
-
- case GTK_SELECTION_MULTIPLE:
- if (child->state == GTK_STATE_NORMAL)
- {
- gtk_list_item_select (GTK_LIST_ITEM (child));
- list->selection = g_list_prepend (list->selection, child);
- gtk_widget_ref (child);
- gtk_signal_emit (GTK_OBJECT (list), list_signals[SELECTION_CHANGED]);
- }
- else if (child->state == GTK_STATE_SELECTED)
- {
- gtk_list_item_deselect (GTK_LIST_ITEM (child));
- list->selection = g_list_remove (list->selection, child);
- gtk_widget_unref (child);
- gtk_signal_emit (GTK_OBJECT (list), list_signals[SELECTION_CHANGED]);
- }
- break;
-
- case GTK_SELECTION_EXTENDED:
- break;
- }
-}
-
-static void
-gtk_real_list_unselect_child (GtkList *list,
- GtkWidget *child)
-{
- g_return_if_fail (list != NULL);
- g_return_if_fail (GTK_IS_LIST (list));
- g_return_if_fail (child != NULL);
- g_return_if_fail (GTK_IS_LIST_ITEM (child));
-
- switch (list->selection_mode)
- {
- case GTK_SELECTION_SINGLE:
- case GTK_SELECTION_MULTIPLE:
- case GTK_SELECTION_BROWSE:
- if (child->state == GTK_STATE_SELECTED)
- {
- gtk_list_item_deselect (GTK_LIST_ITEM (child));
- list->selection = g_list_remove (list->selection, child);
- gtk_widget_unref (child);
- gtk_signal_emit (GTK_OBJECT (list), list_signals[SELECTION_CHANGED]);
- }
- break;
-
- case GTK_SELECTION_EXTENDED:
- break;
- }
-}
-
-
-static void
-gtk_list_marshal_signal (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkListSignal rfunc;
-
- rfunc = (GtkListSignal) func;
-
- (* rfunc) (object, GTK_VALUE_OBJECT (args[0]), func_data);
-}
diff --git a/gtk/gtklist.h b/gtk/gtklist.h
deleted file mode 100644
index 99a0908036..0000000000
--- a/gtk/gtklist.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_LIST_H__
-#define __GTK_LIST_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkenums.h>
-#include <gtk/gtkcontainer.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_LIST(obj) GTK_CHECK_CAST (obj, gtk_list_get_type (), GtkList)
-#define GTK_LIST_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_list_get_type (), GtkListClass)
-#define GTK_IS_LIST(obj) GTK_CHECK_TYPE (obj, gtk_list_get_type ())
-
-
-typedef struct _GtkList GtkList;
-typedef struct _GtkListClass GtkListClass;
-
-struct _GtkList
-{
- GtkContainer container;
-
- GList *children;
- GList *selection;
-
- guint32 timer;
- guint16 selection_start_pos;
- guint16 selection_end_pos;
- guint selection_mode : 2;
- guint scroll_direction : 1;
- guint have_grab : 1;
-};
-
-struct _GtkListClass
-{
- GtkContainerClass parent_class;
-
- void (* selection_changed) (GtkList *list);
- void (* select_child) (GtkList *list,
- GtkWidget *child);
- void (* unselect_child) (GtkList *list,
- GtkWidget *child);
-};
-
-
-guint gtk_list_get_type (void);
-GtkWidget* gtk_list_new (void);
-void gtk_list_insert_items (GtkList *list,
- GList *items,
- gint position);
-void gtk_list_append_items (GtkList *list,
- GList *items);
-void gtk_list_prepend_items (GtkList *list,
- GList *items);
-void gtk_list_remove_items (GtkList *list,
- GList *items);
-void gtk_list_remove_items_no_unref (GtkList *list,
- GList *items);
-void gtk_list_clear_items (GtkList *list,
- gint start,
- gint end);
-void gtk_list_select_item (GtkList *list,
- gint item);
-void gtk_list_unselect_item (GtkList *list,
- gint item);
-void gtk_list_select_child (GtkList *list,
- GtkWidget *child);
-void gtk_list_unselect_child (GtkList *list,
- GtkWidget *child);
-gint gtk_list_child_position (GtkList *list,
- GtkWidget *child);
-void gtk_list_set_selection_mode (GtkList *list,
- GtkSelectionMode mode);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_LIST_H__ */
diff --git a/gtk/gtklistitem.c b/gtk/gtklistitem.c
deleted file mode 100644
index cae416eb8a..0000000000
--- a/gtk/gtklistitem.c
+++ /dev/null
@@ -1,397 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtklabel.h"
-#include "gtklistitem.h"
-#include "gtklist.h"
-
-static void gtk_list_item_class_init (GtkListItemClass *klass);
-static void gtk_list_item_init (GtkListItem *list_item);
-static void gtk_list_item_realize (GtkWidget *widget);
-static void gtk_list_item_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_list_item_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_list_item_draw (GtkWidget *widget,
- GdkRectangle *area);
-static void gtk_list_item_draw_focus (GtkWidget *widget);
-static gint gtk_list_item_button_press (GtkWidget *widget,
- GdkEventButton *event);
-static gint gtk_list_item_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static gint gtk_list_item_focus_in (GtkWidget *widget,
- GdkEventFocus *event);
-static gint gtk_list_item_focus_out (GtkWidget *widget,
- GdkEventFocus *event);
-static void gtk_real_list_item_select (GtkItem *item);
-static void gtk_real_list_item_deselect (GtkItem *item);
-static void gtk_real_list_item_toggle (GtkItem *item);
-
-
-static GtkItemClass *parent_class = NULL;
-
-
-guint
-gtk_list_item_get_type ()
-{
- static guint list_item_type = 0;
-
- if (!list_item_type)
- {
- GtkTypeInfo list_item_info =
- {
- "GtkListItem",
- sizeof (GtkListItem),
- sizeof (GtkListItemClass),
- (GtkClassInitFunc) gtk_list_item_class_init,
- (GtkObjectInitFunc) gtk_list_item_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- list_item_type = gtk_type_unique (gtk_item_get_type (), &list_item_info);
- }
-
- return list_item_type;
-}
-
-static void
-gtk_list_item_class_init (GtkListItemClass *class)
-{
- GtkWidgetClass *widget_class;
- GtkItemClass *item_class;
-
- widget_class = (GtkWidgetClass*) class;
- item_class = (GtkItemClass*) class;
-
- parent_class = gtk_type_class (gtk_item_get_type ());
-
- widget_class->realize = gtk_list_item_realize;
- widget_class->size_request = gtk_list_item_size_request;
- widget_class->size_allocate = gtk_list_item_size_allocate;
- widget_class->draw = gtk_list_item_draw;
- widget_class->draw_focus = gtk_list_item_draw_focus;
- widget_class->button_press_event = gtk_list_item_button_press;
- widget_class->expose_event = gtk_list_item_expose;
- widget_class->focus_in_event = gtk_list_item_focus_in;
- widget_class->focus_out_event = gtk_list_item_focus_out;
-
- item_class->select = gtk_real_list_item_select;
- item_class->deselect = gtk_real_list_item_deselect;
- item_class->toggle = gtk_real_list_item_toggle;
-}
-
-static void
-gtk_list_item_init (GtkListItem *list_item)
-{
- GTK_WIDGET_SET_FLAGS (list_item, GTK_CAN_FOCUS);
-}
-
-GtkWidget*
-gtk_list_item_new ()
-{
- return GTK_WIDGET (gtk_type_new (gtk_list_item_get_type ()));
-}
-
-GtkWidget*
-gtk_list_item_new_with_label (const gchar *label)
-{
- GtkWidget *list_item;
- GtkWidget *label_widget;
-
- list_item = gtk_list_item_new ();
- label_widget = gtk_label_new (label);
- gtk_misc_set_alignment (GTK_MISC (label_widget), 0.0, 0.5);
-
- gtk_container_add (GTK_CONTAINER (list_item), label_widget);
- gtk_widget_show (label_widget);
-
- return list_item;
-}
-
-void
-gtk_list_item_select (GtkListItem *list_item)
-{
- gtk_item_select (GTK_ITEM (list_item));
-}
-
-void
-gtk_list_item_deselect (GtkListItem *list_item)
-{
- gtk_item_deselect (GTK_ITEM (list_item));
-}
-
-
-static void
-gtk_list_item_realize (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_LIST_ITEM (widget));
-
- if (GTK_WIDGET_CLASS (parent_class)->realize)
- (* GTK_WIDGET_CLASS (parent_class)->realize) (widget);
-
- gdk_window_set_background (widget->window,
- &widget->style->base[GTK_STATE_NORMAL]);
-}
-
-static void
-gtk_list_item_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkBin *bin;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_LIST_ITEM (widget));
- g_return_if_fail (requisition != NULL);
-
- bin = GTK_BIN (widget);
-
- requisition->width = (GTK_CONTAINER (widget)->border_width +
- widget->style->klass->xthickness) * 2;
- requisition->height = GTK_CONTAINER (widget)->border_width * 2;
-
- if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
- {
- gtk_widget_size_request (bin->child, &bin->child->requisition);
-
- requisition->width += bin->child->requisition.width;
- requisition->height += bin->child->requisition.height;
- }
-}
-
-static void
-gtk_list_item_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkBin *bin;
- GtkAllocation child_allocation;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_LIST_ITEM (widget));
- g_return_if_fail (allocation != NULL);
-
- widget->allocation = *allocation;
- if (GTK_WIDGET_REALIZED (widget))
- gdk_window_move_resize (widget->window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
-
- bin = GTK_BIN (widget);
-
- if (bin->child)
- {
- child_allocation.x = (GTK_CONTAINER (widget)->border_width +
- widget->style->klass->xthickness);
- child_allocation.y = GTK_CONTAINER (widget)->border_width;
- child_allocation.width = allocation->width - child_allocation.x * 2;
- child_allocation.height = allocation->height - child_allocation.y * 2;
-
- gtk_widget_size_allocate (bin->child, &child_allocation);
- }
-}
-
-static void
-gtk_list_item_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkBin *bin;
- GdkRectangle child_area;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_LIST_ITEM (widget));
- g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- bin = GTK_BIN (widget);
-
- if (!GTK_WIDGET_IS_SENSITIVE (widget))
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_INSENSITIVE);
- else if (widget->state == GTK_STATE_NORMAL)
- gdk_window_set_background (widget->window,
- &widget->style->base[GTK_STATE_NORMAL]);
- else
- gtk_style_set_background (widget->style, widget->window, widget->state);
-
- gdk_window_clear_area (widget->window, area->x, area->y,
- area->width, area->height);
-
- if (bin->child && gtk_widget_intersect (bin->child, area, &child_area))
- gtk_widget_draw (bin->child, &child_area);
-
- gtk_widget_draw_focus (widget);
- }
-}
-
-static void
-gtk_list_item_draw_focus (GtkWidget *widget)
-{
- GdkGC *gc;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_LIST_ITEM (widget));
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- if (GTK_WIDGET_HAS_FOCUS (widget))
- gc = widget->style->black_gc;
- else if (!GTK_WIDGET_IS_SENSITIVE (widget))
- gc = widget->style->bg_gc[GTK_STATE_INSENSITIVE];
- else if (widget->state == GTK_STATE_NORMAL)
- gc = widget->style->base_gc[GTK_STATE_NORMAL];
- else
- gc = widget->style->bg_gc[widget->state];
-
- gdk_draw_rectangle (widget->window, gc, FALSE, 0, 0,
- widget->allocation.width - 1,
- widget->allocation.height - 1);
- }
-}
-
-static gint
-gtk_list_item_button_press (GtkWidget *widget,
- GdkEventButton *event)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_LIST_ITEM (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (event->type == GDK_BUTTON_PRESS)
- if (!GTK_WIDGET_HAS_FOCUS (widget))
- gtk_widget_grab_focus (widget);
-
- return FALSE;
-}
-
-static gint
-gtk_list_item_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkBin *bin;
- GdkEventExpose child_event;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_LIST_ITEM (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- bin = GTK_BIN (widget);
-
- if (!GTK_WIDGET_IS_SENSITIVE (widget))
- gdk_window_set_background (widget->window, &widget->style->bg[GTK_STATE_INSENSITIVE]);
- else if (widget->state == GTK_STATE_NORMAL)
- gdk_window_set_background (widget->window, &widget->style->base[GTK_STATE_NORMAL]);
- else
- gdk_window_set_background (widget->window, &widget->style->bg[widget->state]);
-
- gdk_window_clear_area (widget->window, event->area.x, event->area.y,
- event->area.width, event->area.height);
-
- if (bin->child)
- {
- child_event = *event;
-
- if (GTK_WIDGET_NO_WINDOW (bin->child) &&
- gtk_widget_intersect (bin->child, &event->area, &child_event.area))
- gtk_widget_event (bin->child, (GdkEvent*) &child_event);
- }
-
- gtk_widget_draw_focus (widget);
- }
-
- return FALSE;
-}
-
-static gint
-gtk_list_item_focus_in (GtkWidget *widget,
- GdkEventFocus *event)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_LIST_ITEM (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
- gtk_widget_draw_focus (widget);
-
- return FALSE;
-}
-
-static gint
-gtk_list_item_focus_out (GtkWidget *widget,
- GdkEventFocus *event)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_LIST_ITEM (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
- gtk_widget_draw_focus (widget);
-
- return FALSE;
-}
-
-static void
-gtk_real_list_item_select (GtkItem *item)
-{
- g_return_if_fail (item != NULL);
- g_return_if_fail (GTK_IS_LIST_ITEM (item));
-
- if (GTK_WIDGET (item)->state == GTK_STATE_SELECTED)
- return;
-
- gtk_widget_set_state (GTK_WIDGET (item), GTK_STATE_SELECTED);
- gtk_widget_queue_draw (GTK_WIDGET (item));
-}
-
-static void
-gtk_real_list_item_deselect (GtkItem *item)
-{
- g_return_if_fail (item != NULL);
- g_return_if_fail (GTK_IS_LIST_ITEM (item));
-
- if (GTK_WIDGET (item)->state == GTK_STATE_NORMAL)
- return;
-
- gtk_widget_set_state (GTK_WIDGET (item), GTK_STATE_NORMAL);
- gtk_widget_queue_draw (GTK_WIDGET (item));
-}
-
-static void
-gtk_real_list_item_toggle (GtkItem *item)
-{
- g_return_if_fail (item != NULL);
- g_return_if_fail (GTK_IS_LIST_ITEM (item));
-
- if (GTK_WIDGET (item)->parent && GTK_IS_LIST (GTK_WIDGET (item)->parent))
- gtk_list_select_child (GTK_LIST (GTK_WIDGET (item)->parent),
- GTK_WIDGET (item));
- else
- {
- /* Should we really bother with this bit? A listitem not in a list?
- * -Johannes Keukelaar
- * yes, always be on the save side!
- * -timj
- */
- if (GTK_WIDGET (item)->state == GTK_STATE_SELECTED)
- gtk_widget_set_state (GTK_WIDGET (item), GTK_STATE_NORMAL);
- else
- gtk_widget_set_state (GTK_WIDGET (item), GTK_STATE_SELECTED);
- gtk_widget_queue_draw (GTK_WIDGET (item));
- }
-}
diff --git a/gtk/gtklistitem.h b/gtk/gtklistitem.h
deleted file mode 100644
index 4220ae73f8..0000000000
--- a/gtk/gtklistitem.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_LIST_ITEM_H__
-#define __GTK_LIST_ITEM_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkitem.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_LIST_ITEM(obj) GTK_CHECK_CAST (obj, gtk_list_item_get_type (), GtkListItem)
-#define GTK_LIST_ITEM_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_list_item_get_type (), GtkListItemClass)
-#define GTK_IS_LIST_ITEM(obj) GTK_CHECK_TYPE (obj, gtk_list_item_get_type ())
-
-
-typedef struct _GtkListItem GtkListItem;
-typedef struct _GtkListItemClass GtkListItemClass;
-
-struct _GtkListItem
-{
- GtkItem item;
-};
-
-struct _GtkListItemClass
-{
- GtkItemClass parent_class;
-};
-
-
-guint gtk_list_item_get_type (void);
-GtkWidget* gtk_list_item_new (void);
-GtkWidget* gtk_list_item_new_with_label (const gchar *label);
-void gtk_list_item_select (GtkListItem *list_item);
-void gtk_list_item_deselect (GtkListItem *list_item);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_LIST_ITEM_H__ */
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
deleted file mode 100644
index cf695a5740..0000000000
--- a/gtk/gtkmain.c
+++ /dev/null
@@ -1,1603 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include "gtkbutton.h"
-#include "gtkhscrollbar.h"
-#include "gtkhseparator.h"
-#include "gtkmain.h"
-#include "gtkpreview.h"
-#include "gtkrc.h"
-#include "gtkselection.h"
-#include "gtksignal.h"
-#include "gtktable.h"
-#include "gtktext.h"
-#include "gtkvbox.h"
-#include "gtkvscrollbar.h"
-#include "gtkwidget.h"
-#include "gtkwindow.h"
-#include "gtkprivate.h"
-#include "../config.h"
-
-
-/* Private type definitions
- */
-typedef struct _GtkInitFunction GtkInitFunction;
-typedef struct _GtkQuitFunction GtkQuitFunction;
-typedef struct _GtkTimeoutFunction GtkTimeoutFunction;
-typedef struct _GtkIdleFunction GtkIdleFunction;
-typedef struct _GtkInputFunction GtkInputFunction;
-typedef struct _GtkKeySnooperData GtkKeySnooperData;
-
-struct _GtkInitFunction
-{
- GtkFunction function;
- gpointer data;
-};
-
-struct _GtkQuitFunction
-{
- gint tag;
- guint main_level;
- GtkCallbackMarshal marshal;
- GtkFunction function;
- gpointer data;
- GtkDestroyNotify destroy;
-};
-
-struct _GtkTimeoutFunction
-{
- gint tag;
- guint32 start;
- guint32 interval;
- guint32 originterval;
- GtkFunction function;
- GtkCallbackMarshal marshal;
- gpointer data;
- GtkDestroyNotify destroy;
-};
-
-struct _GtkIdleFunction
-{
- gint tag;
- gint priority;
- GtkCallbackMarshal marshal;
- GtkFunction function;
- gpointer data;
- GtkDestroyNotify destroy;
-};
-
-struct _GtkInputFunction
-{
- GtkCallbackMarshal callback;
- gpointer data;
- GtkDestroyNotify destroy;
-};
-
-struct _GtkKeySnooperData
-{
- GtkKeySnoopFunc func;
- gpointer func_data;
- gint id;
-};
-
-static void gtk_exit_func (void);
-static gint gtk_quit_invoke_function (GtkQuitFunction *quitf);
-static void gtk_quit_destroy (GtkQuitFunction *quitf);
-static void gtk_timeout_insert (GtkTimeoutFunction *timeoutf);
-static void gtk_handle_current_timeouts (guint32 the_time);
-static void gtk_handle_current_idles (void);
-static gint gtk_invoke_key_snoopers (GtkWidget *grab_widget,
- GdkEvent *event);
-static void gtk_handle_timeouts (void);
-static void gtk_handle_idle (void);
-static void gtk_handle_timer (void);
-static void gtk_propagate_event (GtkWidget *widget,
- GdkEvent *event);
-static void gtk_error (gchar *str);
-static void gtk_warning (gchar *str);
-static void gtk_message (gchar *str);
-static void gtk_print (gchar *str);
-
-static gint gtk_idle_compare (gpointer a,
- gpointer b);
-
-static gint gtk_timeout_compare (gpointer a,
- gpointer b);
-
-const guint gtk_major_version = GTK_MAJOR_VERSION;
-const guint gtk_minor_version = GTK_MINOR_VERSION;
-const guint gtk_micro_version = GTK_MICRO_VERSION;
-
-static gboolean iteration_done = FALSE;
-static guint main_level = 0;
-static gint initialized = FALSE;
-static GdkEvent *next_event = NULL;
-static GList *current_events = NULL;
-
-static GSList *grabs = NULL; /* A stack of unique grabs. The grabbing
- * widget is the first one on the list.
- */
-static GList *init_functions = NULL; /* A list of init functions.
- */
-static GList *quit_functions = NULL; /* A list of quit functions.
- */
-static GList *timeout_functions = NULL; /* A list of timeout functions sorted by
- * when the length of the time interval
- * remaining. Therefore, the first timeout
- * function to expire is at the head of
- * the list and the last to expire is at
- * the tail of the list.
- */
-static GList *idle_functions = NULL; /* A list of idle functions.
- */
-
-static GList *current_idles = NULL;
-static GList *current_timeouts = NULL;
-static GMemChunk *timeout_mem_chunk = NULL;
-static GMemChunk *idle_mem_chunk = NULL;
-static GMemChunk *quit_mem_chunk = NULL;
-
-static GSList *key_snoopers = NULL;
-
-static GdkVisual *gtk_visual; /* The visual to be used in creating new
- * widgets.
- */
-static GdkColormap *gtk_colormap; /* The colormap to be used in creating new
- * widgets.
- */
-
-guint gtk_debug_flags = 0; /* Global GTK debug flag */
-
-#ifdef G_ENABLE_DEBUG
-static GDebugKey gtk_debug_keys[] = {
- {"objects", GTK_DEBUG_OBJECTS}
-};
-
-static const guint gtk_ndebug_keys = sizeof (gtk_debug_keys) / sizeof (GDebugKey);
-
-#endif /* G_ENABLE_DEBUG */
-
-
-
-
-void
-gtk_init (int *argc,
- char ***argv)
-{
- if (0)
- {
- g_set_error_handler (gtk_error);
- g_set_warning_handler (gtk_warning);
- g_set_message_handler (gtk_message);
- g_set_print_handler (gtk_print);
- }
-
- /* Initialize "gdk". We pass along the 'argc' and 'argv'
- * parameters as they contain information that GDK uses
- */
- gdk_init (argc, argv);
-
-#ifdef G_ENABLE_DEBUG
- {
- gchar *debug_string = getenv("GTK_DEBUG");
- if (debug_string != NULL)
- gtk_debug_flags = g_parse_debug_string (debug_string,
- gtk_debug_keys,
- gtk_ndebug_keys);
- }
-
- if (argc && argv)
- {
- gint i;
-
- for (i = 1; i < *argc;)
- {
- if ((*argv)[i] == NULL)
- {
- i += 1;
- continue;
- }
-
- if (strcmp ("--gtk-debug", (*argv)[i]) == 0)
- {
- (*argv)[i] = NULL;
-
- if ((i + 1) < *argc && (*argv)[i + 1])
- {
- gtk_debug_flags |= g_parse_debug_string ((*argv)[i+1],
- gtk_debug_keys,
- gtk_ndebug_keys);
- (*argv)[i + 1] = NULL;
- i += 1;
- }
- }
- else if (strcmp ("--gtk-no-debug", (*argv)[i]) == 0)
- {
- (*argv)[i] = NULL;
-
- if ((i + 1) < *argc && (*argv)[i + 1])
- {
- gtk_debug_flags &= ~g_parse_debug_string ((*argv)[i+1],
- gtk_debug_keys,
- gtk_ndebug_keys);
- (*argv)[i + 1] = NULL;
- i += 1;
- }
- }
- i += 1;
- }
- }
-
-#endif /* G_ENABLE_DEBUG */
-
- /* Initialize the default visual and colormap to be
- * used in creating widgets. (We want to use the system
- * defaults so as to be nice to the colormap).
- */
- gtk_visual = gdk_visual_get_system ();
- gtk_colormap = gdk_colormap_get_system ();
- gtk_rc_init ();
-
- gtk_type_init ();
-
- /* Register an exit function to make sure we are able to cleanup.
- */
- if (ATEXIT (gtk_exit_func))
- g_warning ("unable to register exit function");
-
- /* Set the 'initialized' flag.
- */
- initialized = TRUE;
-}
-
-void
-gtk_exit (int errorcode)
-{
- /* Only if "gtk" has been initialized should we de-initialize.
- */
- /* de-initialisation is done by the gtk_exit_funct(),
- * no need to do this here (Alex J.)
- */
- gdk_exit(errorcode);
-}
-
-gchar*
-gtk_set_locale ()
-{
- return gdk_set_locale ();
-}
-
-void
-gtk_main ()
-{
- GList *tmp_list;
- GList *functions;
- GtkInitFunction *init;
- int old_done;
-
- main_level++;
-
- tmp_list = functions = init_functions;
- init_functions = NULL;
-
- while (tmp_list)
- {
- init = tmp_list->data;
- tmp_list = tmp_list->next;
-
- (* init->function) (init->data);
- g_free (init);
- }
- g_list_free (functions);
-
- old_done = iteration_done;
- while (!gtk_main_iteration ())
- ;
- iteration_done = old_done;
-
- if (quit_functions)
- {
- GList *reinvoke_list = NULL;
- GtkQuitFunction *quitf;
-
- while (quit_functions)
- {
- quitf = quit_functions->data;
-
- quit_functions = g_list_remove_link (quit_functions, quit_functions);
-
- if ((quitf->main_level &&
- quitf->main_level != main_level) ||
- gtk_quit_invoke_function (quitf) == FALSE)
- {
- g_list_free (tmp_list);
- gtk_quit_destroy (quitf);
- }
- else
- {
- reinvoke_list = g_list_prepend (reinvoke_list, quitf);
- }
- }
- if (reinvoke_list)
- {
- GList *tmp_list;
-
- tmp_list = g_list_last (reinvoke_list);
- if (quit_functions)
- quit_functions->prev = tmp_list;
- tmp_list->next = quit_functions;
- quit_functions = tmp_list;
- }
- }
-
- main_level--;
-}
-
-guint
-gtk_main_level (void)
-{
- return main_level;
-}
-
-void
-gtk_main_quit ()
-{
- iteration_done = TRUE;
-}
-
-gint
-gtk_events_pending (void)
-{
- gint result = gdk_events_pending() + ((next_event != NULL) ? 1 : 0);
-
- if (idle_functions &&
- (((GtkIdleFunction *)idle_functions->data)->priority >=
- GTK_PRIORITY_INTERNAL))
- result += 1;
-
- return result;
-}
-
-gint
-gtk_main_iteration ()
-{
- return gtk_main_iteration_do (TRUE);
-}
-
-gint
-gtk_main_iteration_do (gboolean blocking)
-{
- GtkWidget *event_widget;
- GtkWidget *grab_widget;
- GdkEvent *event = NULL;
- GList *tmp_list;
-
- iteration_done = FALSE;
-
- /* If this is a recursive call, and there are pending timeouts or
- * idles, finish them, then return immediately to avoid blocking
- * in gdk_event_get()
- */
- if (current_timeouts)
- {
- gtk_handle_current_timeouts( gdk_time_get());
- return iteration_done;
- }
- if (current_idles)
- {
- gtk_handle_current_idles();
- return iteration_done;
- }
-
- /* If there is a valid event in 'next_event' then move it to 'event'
- */
- if (next_event)
- {
- event = next_event;
- next_event = NULL;
- }
-
- /* If we don't have an event then get one.
- */
- if (!event)
- {
- /* Handle setting of the "gdk" timer. If there are no
- * timeout functions, then the timer is turned off.
- * If there are timeout functions, then the timer is
- * set to the shortest timeout interval (which is
- * the first timeout function).
- */
- gtk_handle_timer ();
-
- if (blocking) event = gdk_event_get ();
- }
-
- /* "gdk_event_get" can return FALSE if the timer goes off
- * and no events are pending. Therefore, we should make
- * sure that we got an event before continuing.
- */
- if (event)
- {
- /* If there are any events pending then get the next one.
- */
- if (gdk_events_pending () > 0)
- next_event = gdk_event_get ();
-
- /* Try to compress enter/leave notify events. These event
- * pairs occur when the mouse is dragged quickly across
- * a window with many buttons (or through a menu). Instead
- * of highlighting and de-highlighting each widget that
- * is crossed it is better to simply de-highlight the widget
- * which contained the mouse initially and highlight the
- * widget which ends up containing the mouse.
- */
- if (next_event)
- if (((event->type == GDK_ENTER_NOTIFY) ||
- (event->type == GDK_LEAVE_NOTIFY)) &&
- ((next_event->type == GDK_ENTER_NOTIFY) ||
- (next_event->type == GDK_LEAVE_NOTIFY)) &&
- (next_event->type != event->type) &&
- (next_event->any.window == event->any.window))
- {
- gdk_event_free (event);
- gdk_event_free (next_event);
- next_event = NULL;
-
- goto event_handling_done;
- }
-
- /* Find the widget which got the event. We store the widget
- * in the user_data field of GdkWindow's.
- * Ignore the event if we don't have a widget for it, except
- * for GDK_PROPERTY_NOTIFY events which are handled specialy.
- * Though this happens rarely, bogus events can occour
- * for e.g. destroyed GdkWindows.
- */
- event_widget = gtk_get_event_widget (event);
- if (!event_widget)
- {
- /* To handle selection INCR transactions, we select
- * PropertyNotify events on the requestor window and create
- * a corresponding (fake) GdkWindow so that events get
- * here. There won't be a widget though, so we have to handle
- * them specially
- */
- if (event->type == GDK_PROPERTY_NOTIFY)
- gtk_selection_incr_event (event->any.window,
- &event->property);
-
- gdk_event_free (event);
-
- goto event_handling_done;
- }
-
- /* Push the event onto a stack of current events for
- * gtk_current_event_get().
- */
- current_events = g_list_prepend (current_events, event);
-
- /* If there is a grab in effect...
- */
- if (grabs)
- {
- grab_widget = grabs->data;
-
- /* If the grab widget is an ancestor of the event widget
- * then we send the event to the original event widget.
- * This is the key to implementing modality.
- */
- if (gtk_widget_is_ancestor (event_widget, grab_widget))
- grab_widget = event_widget;
- }
- else
- {
- grab_widget = event_widget;
- }
-
- /* Not all events get sent to the grabbing widget.
- * The delete, destroy, expose, focus change and resize
- * events still get sent to the event widget because
- * 1) these events have no meaning for the grabbing widget
- * and 2) redirecting these events to the grabbing widget
- * could cause the display to be messed up.
- */
- switch (event->type)
- {
- case GDK_NOTHING:
- break;
-
- case GDK_DELETE:
- gtk_widget_ref (event_widget);
- if (gtk_widget_event (event_widget, event))
- gtk_widget_destroy (event_widget);
- gtk_widget_unref (event_widget);
- break;
-
- case GDK_DESTROY:
- gtk_widget_ref (event_widget);
- gtk_widget_event (event_widget, event);
- gtk_widget_destroy (event_widget);
- gtk_widget_unref (event_widget);
- break;
-
- case GDK_PROPERTY_NOTIFY:
- case GDK_EXPOSE:
- case GDK_NO_EXPOSE:
- case GDK_FOCUS_CHANGE:
- case GDK_CONFIGURE:
- case GDK_MAP:
- case GDK_UNMAP:
- case GDK_SELECTION_CLEAR:
- case GDK_SELECTION_REQUEST:
- case GDK_SELECTION_NOTIFY:
- case GDK_CLIENT_EVENT:
- case GDK_DRAG_BEGIN:
- case GDK_DRAG_REQUEST:
- case GDK_DROP_ENTER:
- case GDK_DROP_LEAVE:
- case GDK_DROP_DATA_AVAIL:
- case GDK_VISIBILITY_NOTIFY:
- gtk_widget_event (event_widget, event);
- break;
-
- case GDK_KEY_PRESS:
- case GDK_KEY_RELEASE:
- if (key_snoopers)
- {
- if (gtk_invoke_key_snoopers (grab_widget, event))
- break;
- }
- /* else fall through */
- case GDK_MOTION_NOTIFY:
- case GDK_BUTTON_PRESS:
- case GDK_2BUTTON_PRESS:
- case GDK_3BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- case GDK_PROXIMITY_IN:
- case GDK_PROXIMITY_OUT:
- case GDK_OTHER_EVENT:
- gtk_propagate_event (grab_widget, event);
- break;
-
- case GDK_ENTER_NOTIFY:
- if (GTK_WIDGET_IS_SENSITIVE (grab_widget))
- {
- gtk_widget_event (grab_widget, event);
- if (event_widget == grab_widget)
- GTK_PRIVATE_SET_FLAG (event_widget, GTK_LEAVE_PENDING);
- }
- break;
-
- case GDK_LEAVE_NOTIFY:
- if (GTK_WIDGET_LEAVE_PENDING (event_widget))
- {
- GTK_PRIVATE_UNSET_FLAG (event_widget, GTK_LEAVE_PENDING);
- gtk_widget_event (event_widget, event);
- }
- else if (GTK_WIDGET_IS_SENSITIVE (grab_widget))
- gtk_widget_event (grab_widget, event);
- break;
- }
-
- tmp_list = current_events;
- current_events = g_list_remove_link (current_events, tmp_list);
- g_list_free_1 (tmp_list);
-
- gdk_event_free (event);
- }
- else
- {
- if (gdk_events_pending() == 0)
- gtk_handle_idle ();
- }
-
-event_handling_done:
-
- /* Handle timeout functions that may have expired.
- */
- gtk_handle_timeouts ();
-
- return iteration_done;
-}
-
-gint
-gtk_true (void)
-{
- return TRUE;
-}
-
-gint
-gtk_false (void)
-{
- return FALSE;
-}
-
-void
-gtk_grab_add (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
-
- if (!GTK_WIDGET_HAS_GRAB (widget))
- {
- GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_GRAB);
-
- grabs = g_slist_prepend (grabs, widget);
- gtk_widget_ref (widget);
- }
-}
-
-GtkWidget*
-gtk_grab_get_current (void)
-{
- if (grabs)
- return GTK_WIDGET (grabs->data);
- return NULL;
-}
-
-void
-gtk_grab_remove (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
-
- if (GTK_WIDGET_HAS_GRAB (widget))
- {
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_GRAB);
-
- grabs = g_slist_remove (grabs, widget);
- gtk_widget_unref (widget);
- }
-}
-
-void
-gtk_init_add (GtkFunction function,
- gpointer data)
-{
- GtkInitFunction *init;
-
- init = g_new (GtkInitFunction, 1);
- init->function = function;
- init->data = data;
-
- init_functions = g_list_prepend (init_functions, init);
-}
-
-gint
-gtk_key_snooper_install (GtkKeySnoopFunc snooper,
- gpointer func_data)
-{
- GtkKeySnooperData *data;
- static guint snooper_id = 1;
-
- g_return_val_if_fail (snooper != NULL, 0);
-
- data = g_new (GtkKeySnooperData, 1);
- data->func = snooper;
- data->func_data = func_data;
- data->id = snooper_id++;
- key_snoopers = g_slist_prepend (key_snoopers, data);
-
- return data->id;
-}
-
-void
-gtk_key_snooper_remove (gint snooper_id)
-{
- GtkKeySnooperData *data = NULL;
- GSList *slist;
-
- slist = key_snoopers;
- while (slist)
- {
- data = slist->data;
- if (data->id == snooper_id)
- break;
-
- slist = slist->next;
- data = NULL;
- }
- if (data)
- key_snoopers = g_slist_remove (key_snoopers, data);
-}
-
-static gint
-gtk_invoke_key_snoopers (GtkWidget *grab_widget,
- GdkEvent *event)
-{
- GSList *slist;
- gint return_val = FALSE;
-
- slist = key_snoopers;
- while (slist && !return_val)
- {
- GtkKeySnooperData *data;
-
- data = slist->data;
- slist = slist->next;
- return_val = (*data->func) (grab_widget, (GdkEventKey*) event, data->func_data);
- }
-
- return return_val;
-}
-
-gint
-gtk_timeout_add_full (guint32 interval,
- GtkFunction function,
- GtkCallbackMarshal marshal,
- gpointer data,
- GtkDestroyNotify destroy)
-{
- static gint timeout_tag = 1;
- GtkTimeoutFunction *timeoutf;
-
- g_return_val_if_fail ((function != NULL) || (marshal != NULL), 0);
-
- /* Create a new timeout function structure.
- * The start time is the current time.
- */
- if (!timeout_mem_chunk)
- timeout_mem_chunk = g_mem_chunk_new ("timeout mem chunk", sizeof (GtkTimeoutFunction),
- 1024, G_ALLOC_AND_FREE);
-
- timeoutf = g_chunk_new (GtkTimeoutFunction, timeout_mem_chunk);
-
- timeoutf->tag = timeout_tag++;
- timeoutf->start = gdk_time_get ();
- timeoutf->interval = interval;
- timeoutf->originterval = interval;
- timeoutf->function = function;
- timeoutf->marshal = marshal;
- timeoutf->data = data;
- timeoutf->destroy = destroy;
-
- gtk_timeout_insert (timeoutf);
-
- return timeoutf->tag;
-}
-
-static void
-gtk_timeout_destroy (GtkTimeoutFunction *timeoutf)
-{
- if (timeoutf->destroy)
- (timeoutf->destroy) (timeoutf->data);
- g_mem_chunk_free (timeout_mem_chunk, timeoutf);
-}
-
-gint
-gtk_timeout_add (guint32 interval,
- GtkFunction function,
- gpointer data)
-{
- return gtk_timeout_add_full (interval, function, FALSE, data, NULL);
-}
-
-gint
-gtk_timeout_add_interp (guint32 interval,
- GtkCallbackMarshal function,
- gpointer data,
- GtkDestroyNotify destroy)
-{
- return gtk_timeout_add_full (interval, NULL, function, data, destroy);
-}
-
-void
-gtk_timeout_remove (gint tag)
-{
- GtkTimeoutFunction *timeoutf;
- GList *tmp_list;
-
- /* Remove a timeout function.
- * (Which, basically, involves searching the
- * list for the tag).
- */
- tmp_list = timeout_functions;
- while (tmp_list)
- {
- timeoutf = tmp_list->data;
-
- if (timeoutf->tag == tag)
- {
- timeout_functions = g_list_remove_link (timeout_functions, tmp_list);
- g_list_free (tmp_list);
- gtk_timeout_destroy (timeoutf);
-
- return;
- }
-
- tmp_list = tmp_list->next;
- }
-
- tmp_list = current_timeouts;
- while (tmp_list)
- {
- timeoutf = tmp_list->data;
-
- if (timeoutf->tag == tag)
- {
- current_timeouts = g_list_remove_link (current_timeouts, tmp_list);
- g_list_free (tmp_list);
- gtk_timeout_destroy (timeoutf);
-
- return;
- }
-
- tmp_list = tmp_list->next;
- }
-}
-
-/* We rely on some knowledge of how g_list_insert_sorted works to make
- * sure that we insert at the _end_ of the idles of this priority
- */
-static gint
-gtk_idle_compare (gpointer a, gpointer b)
-{
- return (((GtkIdleFunction *)a)->priority < ((GtkIdleFunction *)b)->priority)
- ? -1 : 1;
-}
-
-gint
-gtk_quit_add_full (guint main_level,
- GtkFunction function,
- GtkCallbackMarshal marshal,
- gpointer data,
- GtkDestroyNotify destroy)
-{
- static gint quit_tag = 1;
- GtkQuitFunction *quitf;
-
- g_return_val_if_fail ((function != NULL) || (marshal != NULL), 0);
-
- if (!quit_mem_chunk)
- quit_mem_chunk = g_mem_chunk_new ("quit mem chunk", sizeof (GtkQuitFunction),
- 512, G_ALLOC_AND_FREE);
-
- quitf = g_chunk_new (GtkQuitFunction, quit_mem_chunk);
-
- quitf->tag = quit_tag++;
- quitf->main_level = main_level;
- quitf->function = function;
- quitf->marshal = marshal;
- quitf->data = data;
- quitf->destroy = destroy;
-
- quit_functions = g_list_prepend (quit_functions, quitf);
-
- return quitf->tag;
-}
-
-gint
-gtk_idle_add_full (gint priority,
- GtkFunction function,
- GtkCallbackMarshal marshal,
- gpointer data,
- GtkDestroyNotify destroy)
-{
- static gint idle_tag = 1;
- GtkIdleFunction *idlef;
-
- g_return_val_if_fail ((function != NULL) || (marshal != NULL), 0);
-
- if (!idle_mem_chunk)
- idle_mem_chunk = g_mem_chunk_new ("idle mem chunk", sizeof (GtkIdleFunction),
- 1024, G_ALLOC_AND_FREE);
-
- idlef = g_chunk_new (GtkIdleFunction, idle_mem_chunk);
-
- idlef->tag = idle_tag++;
- idlef->priority = priority;
- idlef->function = function;
- idlef->marshal = marshal;
- idlef->data = data;
- idlef->destroy = destroy;
-
- idle_functions = g_list_insert_sorted (idle_functions, idlef, gtk_idle_compare);
-
- return idlef->tag;
-}
-
-gint
-gtk_idle_add_interp (GtkCallbackMarshal marshal,
- gpointer data,
- GtkDestroyNotify destroy)
-{
- return gtk_idle_add_full (GTK_PRIORITY_DEFAULT, NULL, marshal, data, destroy);
-}
-
-static void
-gtk_idle_destroy (GtkIdleFunction *idlef)
-{
- if (idlef->destroy)
- idlef->destroy (idlef->data);
- g_mem_chunk_free (idle_mem_chunk, idlef);
-}
-
-static void
-gtk_quit_destroy (GtkQuitFunction *quitf)
-{
- if (quitf->destroy)
- quitf->destroy (quitf->data);
- g_mem_chunk_free (quit_mem_chunk, quitf);
-}
-
-gint
-gtk_quit_add (guint main_level,
- GtkFunction function,
- gpointer data)
-{
- return gtk_quit_add_full (main_level, function, NULL, data, NULL);
-}
-
-gint
-gtk_idle_add (GtkFunction function,
- gpointer data)
-{
- return gtk_idle_add_full (GTK_PRIORITY_DEFAULT, function, NULL, data, NULL);
-}
-
-gint
-gtk_idle_add_priority (gint priority,
- GtkFunction function,
- gpointer data)
-{
- return gtk_idle_add_full (priority, function, NULL, data, NULL);
-}
-
-void
-gtk_quit_remove (gint tag)
-{
- GtkQuitFunction *quitf;
- GList *tmp_list;
-
- tmp_list = quit_functions;
- while (tmp_list)
- {
- quitf = tmp_list->data;
-
- if (quitf->tag == tag)
- {
- quit_functions = g_list_remove_link (quit_functions, tmp_list);
- g_list_free (tmp_list);
- gtk_quit_destroy (quitf);
-
- return;
- }
-
- tmp_list = tmp_list->next;
- }
-}
-
-void
-gtk_quit_remove_by_data (gpointer data)
-{
- GtkQuitFunction *quitf;
- GList *tmp_list;
-
- tmp_list = quit_functions;
- while (tmp_list)
- {
- quitf = tmp_list->data;
-
- if (quitf->data == data)
- {
- quit_functions = g_list_remove_link (quit_functions, tmp_list);
- g_list_free (tmp_list);
- gtk_quit_destroy (quitf);
-
- return;
- }
-
- tmp_list = tmp_list->next;
- }
-}
-
-void
-gtk_idle_remove (gint tag)
-{
- GtkIdleFunction *idlef;
- GList *tmp_list;
-
- tmp_list = idle_functions;
- while (tmp_list)
- {
- idlef = tmp_list->data;
-
- if (idlef->tag == tag)
- {
- idle_functions = g_list_remove_link (idle_functions, tmp_list);
- g_list_free (tmp_list);
- gtk_idle_destroy (idlef);
-
- return;
- }
-
- tmp_list = tmp_list->next;
- }
-
- tmp_list = current_idles;
- while (tmp_list)
- {
- idlef = tmp_list->data;
-
- if (idlef->tag == tag)
- {
- current_idles = g_list_remove_link (current_idles, tmp_list);
- g_list_free (tmp_list);
- gtk_idle_destroy (idlef);
-
- return;
- }
-
- tmp_list = tmp_list->next;
- }
-}
-
-void
-gtk_idle_remove_by_data (gpointer data)
-{
- GtkIdleFunction *idlef;
- GList *tmp_list;
-
- tmp_list = idle_functions;
- while (tmp_list)
- {
- idlef = tmp_list->data;
-
- if (idlef->data == data)
- {
- idle_functions = g_list_remove_link (idle_functions, tmp_list);
- g_list_free (tmp_list);
- gtk_idle_destroy (idlef);
-
- return;
- }
-
- tmp_list = tmp_list->next;
- }
-
- tmp_list = current_idles;
- while (tmp_list)
- {
- idlef = tmp_list->data;
-
- if (idlef->data == data)
- {
- current_idles = g_list_remove_link (current_idles, tmp_list);
- g_list_free (tmp_list);
- gtk_idle_destroy (idlef);
-
- return;
- }
-
- tmp_list = tmp_list->next;
- }
-}
-
-static void
-gtk_invoke_input_function (GtkInputFunction *input,
- gint source,
- GdkInputCondition condition)
-{
- GtkArg args[3];
- args[0].type = GTK_TYPE_INT;
- args[0].name = NULL;
- GTK_VALUE_INT(args[0]) = source;
- args[1].type = GTK_TYPE_GDK_INPUT_CONDITION;
- args[1].name = NULL;
- GTK_VALUE_FLAGS(args[1]) = condition;
- args[2].type = GTK_TYPE_NONE;
- args[2].name = NULL;
-
- input->callback (NULL, input->data, 2, args);
-}
-
-static void
-gtk_destroy_input_function (GtkInputFunction *input)
-{
- if (input->destroy)
- (input->destroy) (input->data);
- g_free (input);
-}
-
-gint
-gtk_input_add_full (gint source,
- GdkInputCondition condition,
- GdkInputFunction function,
- GtkCallbackMarshal marshal,
- gpointer data,
- GtkDestroyNotify destroy)
-{
- if (marshal)
- {
- GtkInputFunction *input = g_new (GtkInputFunction, 1);
- input->callback = marshal;
- input->data = data;
- input->destroy = destroy;
-
- return gdk_input_add_full (source,
- condition,
- (GdkInputFunction) gtk_invoke_input_function,
- input,
- (GdkDestroyNotify) gtk_destroy_input_function);
- }
- else
- return gdk_input_add_full (source, condition, function, data, destroy);
-}
-
-gint
-gtk_input_add_interp (gint source,
- GdkInputCondition condition,
- GtkCallbackMarshal callback,
- gpointer data,
- GtkDestroyNotify destroy)
-{
- return gtk_input_add_full (source, condition, NULL, callback, data, destroy);
-}
-
-void
-gtk_input_remove (gint tag)
-{
- gdk_input_remove (tag);
-}
-
-GdkEvent *
-gtk_get_current_event ()
-{
- if (current_events)
- return gdk_event_copy ((GdkEvent *) current_events->data);
- else
- return NULL;
-}
-
-GtkWidget*
-gtk_get_event_widget (GdkEvent *event)
-{
- GtkWidget *widget;
-
- widget = NULL;
- if (event->any.window)
- gdk_window_get_user_data (event->any.window, (void**) &widget);
-
- return widget;
-}
-
-static void
-gtk_exit_func ()
-{
- if (initialized)
- {
- initialized = FALSE;
- gtk_preview_uninit ();
- }
-}
-
-
-/* We rely on some knowledge of how g_list_insert_sorted works to make
- * sure that we insert after timeouts of equal interval
- */
-static gint
-gtk_timeout_compare (gpointer a, gpointer b)
-{
- return (((GtkTimeoutFunction *)a)->interval <
- ((GtkTimeoutFunction *)b)->interval)
- ? -1 : 1;
-}
-
-static void
-gtk_timeout_insert (GtkTimeoutFunction *timeoutf)
-{
- g_assert (timeoutf != NULL);
-
- /* Insert the timeout function appropriately.
- * Appropriately meaning sort it into the list
- * of timeout functions.
- */
- timeout_functions = g_list_insert_sorted (timeout_functions, timeoutf,
- gtk_timeout_compare);
-}
-
-static gint
-gtk_invoke_timeout_function (GtkTimeoutFunction *timeoutf)
-{
- if (!timeoutf->marshal)
- return timeoutf->function (timeoutf->data);
- else
- {
- GtkArg args[1];
- gint ret_val = FALSE;
- args[0].name = NULL;
- args[0].type = GTK_TYPE_BOOL;
- args[0].d.pointer_data = &ret_val;
- ((GtkCallbackMarshal)timeoutf->function) (NULL,
- timeoutf->data,
- 0, args);
- return ret_val;
- }
-}
-
-static void
-gtk_handle_current_timeouts (guint32 the_time)
-{
- GList *tmp_list;
- GtkTimeoutFunction *timeoutf;
-
- while (current_timeouts)
- {
- tmp_list = current_timeouts;
- timeoutf = tmp_list->data;
-
- current_timeouts = g_list_remove_link (current_timeouts, tmp_list);
- g_list_free (tmp_list);
-
- if (gtk_invoke_timeout_function (timeoutf) == FALSE)
- {
- gtk_timeout_destroy (timeoutf);
- }
- else
- {
- timeoutf->interval = timeoutf->originterval;
- timeoutf->start = the_time;
- gtk_timeout_insert (timeoutf);
- }
- }
-}
-
-static void
-gtk_handle_timeouts ()
-{
- guint32 the_time;
- GList *tmp_list;
- GList *tmp_list2;
- GtkTimeoutFunction *timeoutf;
-
- /* Caller must already have called gtk_handle_current_timeouts if
- * necessary */
- g_assert (current_timeouts == NULL);
-
- if (timeout_functions)
- {
- the_time = gdk_time_get ();
-
- tmp_list = timeout_functions;
- while (tmp_list)
- {
- timeoutf = tmp_list->data;
-
- if (timeoutf->interval <= (the_time - timeoutf->start))
- {
- tmp_list2 = tmp_list;
- tmp_list = tmp_list->next;
-
- timeout_functions = g_list_remove_link (timeout_functions, tmp_list2);
- current_timeouts = g_list_concat (current_timeouts, tmp_list2);
- }
- else
- {
- timeoutf->interval -= (the_time - timeoutf->start);
- timeoutf->start = the_time;
- tmp_list = tmp_list->next;
- }
- }
-
- if (current_timeouts)
- gtk_handle_current_timeouts(the_time);
- }
-}
-
-static gint
-gtk_quit_invoke_function (GtkQuitFunction *quitf)
-{
- if (!quitf->marshal)
- return quitf->function (quitf->data);
- else
- {
- GtkArg args[1];
- gint ret_val = FALSE;
-
- args[0].name = NULL;
- args[0].type = GTK_TYPE_BOOL;
- args[0].d.pointer_data = &ret_val;
- ((GtkCallbackMarshal) quitf->marshal) (NULL,
- quitf->data,
- 0, args);
- return ret_val;
- }
-}
-
-static gint
-gtk_idle_invoke_function (GtkIdleFunction *idlef)
-{
- if (!idlef->marshal)
- return idlef->function (idlef->data);
- else
- {
- GtkArg args[1];
- gint ret_val = FALSE;
-
- args[0].name = NULL;
- args[0].type = GTK_TYPE_BOOL;
- args[0].d.pointer_data = &ret_val;
- ((GtkCallbackMarshal) idlef->marshal) (NULL,
- idlef->data,
- 0, args);
- return ret_val;
- }
-}
-
-static void
-gtk_handle_current_idles ()
-{
- GList *tmp_list;
- GList *tmp_list2;
- GtkIdleFunction *idlef;
-
- while (current_idles)
- {
- tmp_list = current_idles;
- idlef = tmp_list->data;
-
- current_idles = g_list_remove_link (current_idles, tmp_list);
-
- if (gtk_idle_invoke_function (idlef) == FALSE)
- {
- g_list_free (tmp_list);
- gtk_idle_destroy (idlef);
- }
- else
- {
- /* Insert the idle function back into the list of idle
- * functions at the end of the idles of this priority
- */
- tmp_list2 = idle_functions;
- while (tmp_list2 &&
- (((GtkIdleFunction *)tmp_list2->data)->priority <= idlef->priority))
- tmp_list2 = tmp_list2->next;
-
- if (!tmp_list2)
- idle_functions = g_list_concat (idle_functions, tmp_list);
- else if (tmp_list2 == idle_functions)
- {
- tmp_list->next = idle_functions;
- if (idle_functions)
- idle_functions->prev = tmp_list;
- idle_functions = tmp_list;
- }
- else
- {
- tmp_list->prev = tmp_list2->prev;
- tmp_list->next = tmp_list2;
- tmp_list2->prev->next = tmp_list;
- tmp_list2->prev = tmp_list;
- }
- }
- }
-}
-
-static void
-gtk_handle_idle ()
-{
- /* Caller must already have called gtk_handle_current_idles if
- * necessary
- */
- g_assert (current_idles == NULL);
-
- /* Handle only the idle functions that have the highest priority */
- if (idle_functions)
- {
- GList *tmp_list;
- gint top_priority;
-
- tmp_list = idle_functions;
- top_priority = ((GtkIdleFunction *)tmp_list->data)->priority;
-
- while (tmp_list &&
- (((GtkIdleFunction *)tmp_list->data)->priority == top_priority))
- tmp_list = tmp_list->next;
-
- current_idles = idle_functions;
- idle_functions = tmp_list;
-
- if (tmp_list)
- {
- tmp_list->prev->next = NULL;
- tmp_list->prev = NULL;
- }
-
- gtk_handle_current_idles();
- }
-}
-
-static void
-gtk_handle_timer ()
-{
- GtkTimeoutFunction *timeoutf;
-
- if (idle_functions)
- {
- gdk_timer_set (0);
- gdk_timer_enable ();
- }
- else if (timeout_functions)
- {
- timeoutf = timeout_functions->data;
- gdk_timer_set (timeoutf->interval);
- gdk_timer_enable ();
- }
- else
- {
- gdk_timer_set (0);
- gdk_timer_disable ();
- }
-}
-
-static void
-gtk_propagate_event (GtkWidget *widget,
- GdkEvent *event)
-{
- GtkWidget *parent;
- GtkWidget *tmp;
- gint handled_event;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (event != NULL);
-
- handled_event = FALSE;
- gtk_widget_ref (widget);
-
- if ((event->type == GDK_KEY_PRESS) ||
- (event->type == GDK_KEY_RELEASE))
- {
-
- /* Only send key events to window widgets.
- * The window widget will in turn pass the
- * key event on to the currently focused widget
- * for that window.
- */
- parent = gtk_widget_get_ancestor (widget, gtk_window_get_type ());
- handled_event = (parent &&
- GTK_WIDGET_IS_SENSITIVE (parent) &&
- gtk_widget_event (parent, event));
- }
-
- /* Other events get propagated up the widget tree
- * so that parents can see the button and motion
- * events of the children.
- */
- tmp = widget;
- while (!handled_event && tmp)
- {
- gtk_widget_ref (tmp);
- handled_event = !GTK_WIDGET_IS_SENSITIVE (tmp) || gtk_widget_event (tmp, event);
- parent = tmp->parent;
- gtk_widget_unref (tmp);
- tmp = parent;
- }
-
- gtk_widget_unref (widget);
-}
-
-
-static void
-gtk_error (gchar *str)
-{
- gtk_print (str);
-}
-
-static void
-gtk_warning (gchar *str)
-{
- gtk_print (str);
-}
-
-static void
-gtk_message (gchar *str)
-{
- gtk_print (str);
-}
-
-static void
-gtk_print (gchar *str)
-{
- static GtkWidget *window = NULL;
- static GtkWidget *text;
- static int level = 0;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *table;
- GtkWidget *hscrollbar;
- GtkWidget *vscrollbar;
- GtkWidget *separator;
- GtkWidget *button;
-
- if (level > 0)
- {
- fputs (str, stdout);
- fflush (stdout);
- return;
- }
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- (GtkSignalFunc) gtk_widget_destroyed,
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "Messages");
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- table = gtk_table_new (2, 2, FALSE);
- gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
- gtk_table_set_col_spacing (GTK_TABLE (table), 0, 2);
- gtk_box_pack_start (GTK_BOX (box2), table, TRUE, TRUE, 0);
- gtk_widget_show (table);
-
- text = gtk_text_new (NULL, NULL);
- gtk_text_set_editable (GTK_TEXT (text), FALSE);
- gtk_table_attach_defaults (GTK_TABLE (table), text, 0, 1, 0, 1);
- gtk_widget_show (text);
- gtk_widget_realize (text);
-
- hscrollbar = gtk_hscrollbar_new (GTK_TEXT (text)->hadj);
- gtk_table_attach (GTK_TABLE (table), hscrollbar, 0, 1, 1, 2,
- GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
- gtk_widget_show (hscrollbar);
-
- vscrollbar = gtk_vscrollbar_new (GTK_TEXT (text)->vadj);
- gtk_table_attach (GTK_TABLE (table), vscrollbar, 1, 2, 0, 1,
- GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (vscrollbar);
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) gtk_widget_hide,
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- level += 1;
- gtk_text_insert (GTK_TEXT (text), NULL, NULL, NULL, str, -1);
- level -= 1;
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
-}
diff --git a/gtk/gtkmain.h b/gtk/gtkmain.h
deleted file mode 100644
index d87ff8030c..0000000000
--- a/gtk/gtkmain.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_MAIN_H__
-#define __GTK_MAIN_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkwidget.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define GTK_PRIORITY_HIGH -20
-#define GTK_PRIORITY_INTERNAL -10
-#define GTK_PRIORITY_DEFAULT 0
-#define GTK_PRIORITY_LOW 10
-
-typedef gint (*GtkKeySnoopFunc) (GtkWidget *grab_widget,
- GdkEventKey *event,
- gpointer func_data);
-
-/* Gtk version.
- */
-extern const guint gtk_major_version;
-extern const guint gtk_minor_version;
-extern const guint gtk_micro_version;
-
-/* Initialization, exit, mainloop and miscellaneous routines
- */
-void gtk_init (int *argc,
- char ***argv);
-void gtk_exit (gint error_code);
-gchar* gtk_set_locale (void);
-gint gtk_events_pending (void);
-void gtk_main (void);
-guint gtk_main_level (void);
-void gtk_main_quit (void);
-gint gtk_main_iteration (void);
-/* gtk_main_iteration() calls gtk_main_iteration_do(TRUE) */
-gint gtk_main_iteration_do (gboolean blocking);
-
-gint gtk_true (void);
-gint gtk_false (void);
-
-void gtk_grab_add (GtkWidget *widget);
-GtkWidget* gtk_grab_get_current (void);
-void gtk_grab_remove (GtkWidget *widget);
-
-void gtk_init_add (GtkFunction function,
- gpointer data);
-gint gtk_quit_add (guint main_level,
- GtkFunction function,
- gpointer data);
-gint gtk_quit_add_full (guint main_level,
- GtkFunction function,
- GtkCallbackMarshal marshal,
- gpointer data,
- GtkDestroyNotify destroy);
-void gtk_quit_remove (gint tag);
-void gtk_quit_remove_by_data (gpointer data);
-gint gtk_timeout_add_full (guint32 interval,
- GtkFunction function,
- GtkCallbackMarshal marshal,
- gpointer data,
- GtkDestroyNotify destroy);
-gint gtk_timeout_add (guint32 interval,
- GtkFunction function,
- gpointer data);
-gint gtk_timeout_add_interp (guint32 interval,
- GtkCallbackMarshal function,
- gpointer data,
- GtkDestroyNotify notify);
-void gtk_timeout_remove (gint tag);
-
-gint gtk_idle_add (GtkFunction function,
- gpointer data);
-gint gtk_idle_add_priority (gint priority,
- GtkFunction function,
- gpointer data);
-gint gtk_idle_add_full (gint priority,
- GtkFunction function,
- GtkCallbackMarshal marshal,
- gpointer data,
- GtkDestroyNotify destroy);
-gint gtk_idle_add_interp (GtkCallbackMarshal marshal,
- gpointer data,
- GtkDestroyNotify destroy);
-void gtk_idle_remove (gint tag);
-void gtk_idle_remove_by_data (gpointer data);
-gint gtk_input_add_full (gint source,
- GdkInputCondition condition,
- GdkInputFunction function,
- GtkCallbackMarshal marshal,
- gpointer data,
- GtkDestroyNotify destroy);
-void gtk_input_remove (gint tag);
-
-
-gint gtk_key_snooper_install (GtkKeySnoopFunc snooper,
- gpointer func_data);
-void gtk_key_snooper_remove (gint snooper_id);
-
-GdkEvent* gtk_get_current_event (void);
-GtkWidget* gtk_get_event_widget (GdkEvent *event);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_MAIN_H__ */
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
deleted file mode 100644
index b861312694..0000000000
--- a/gtk/gtkmenu.c
+++ /dev/null
@@ -1,891 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <ctype.h>
-#include "gdk/gdkkeysyms.h"
-#include "gtkmain.h"
-#include "gtkmenu.h"
-#include "gtkmenuitem.h"
-#include "gtksignal.h"
-
-
-#define MENU_ITEM_CLASS(w) GTK_MENU_ITEM_CLASS (GTK_OBJECT (w)->klass)
-
-
-typedef struct _GtkMenuAttachData GtkMenuAttachData;
-
-struct _GtkMenuAttachData
-{
- GtkWidget *attach_widget;
- GtkMenuDetachFunc detacher;
-};
-
-
-static void gtk_menu_class_init (GtkMenuClass *klass);
-static void gtk_menu_init (GtkMenu *menu);
-static void gtk_menu_destroy (GtkObject *object);
-static void gtk_menu_show (GtkWidget *widget);
-static void gtk_menu_map (GtkWidget *widget);
-static void gtk_menu_unmap (GtkWidget *widget);
-static void gtk_menu_realize (GtkWidget *widget);
-static void gtk_menu_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_menu_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_menu_paint (GtkWidget *widget);
-static void gtk_menu_draw (GtkWidget *widget,
- GdkRectangle *area);
-static gint gtk_menu_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static gint gtk_menu_configure (GtkWidget *widget,
- GdkEventConfigure *event);
-static gint gtk_menu_key_press (GtkWidget *widget,
- GdkEventKey *event);
-static gint gtk_menu_need_resize (GtkContainer *container);
-static void gtk_menu_deactivate (GtkMenuShell *menu_shell);
-static void gtk_menu_show_all (GtkWidget *widget);
-static void gtk_menu_hide_all (GtkWidget *widget);
-
-static GtkMenuShellClass *parent_class = NULL;
-static const gchar *attach_data_key = "gtk-menu-attach-data";
-
-
-guint
-gtk_menu_get_type ()
-{
- static guint menu_type = 0;
-
- if (!menu_type)
- {
- GtkTypeInfo menu_info =
- {
- "GtkMenu",
- sizeof (GtkMenu),
- sizeof (GtkMenuClass),
- (GtkClassInitFunc) gtk_menu_class_init,
- (GtkObjectInitFunc) gtk_menu_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- menu_type = gtk_type_unique (gtk_menu_shell_get_type (), &menu_info);
- }
-
- return menu_type;
-}
-
-static void
-gtk_menu_class_init (GtkMenuClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
- GtkMenuShellClass *menu_shell_class;
-
- object_class = (GtkObjectClass*) class;
- widget_class = (GtkWidgetClass*) class;
- container_class = (GtkContainerClass*) class;
- menu_shell_class = (GtkMenuShellClass*) class;
- parent_class = gtk_type_class (gtk_menu_shell_get_type ());
-
- object_class->destroy = gtk_menu_destroy;
-
- widget_class->show = gtk_menu_show;
- widget_class->map = gtk_menu_map;
- widget_class->unmap = gtk_menu_unmap;
- widget_class->realize = gtk_menu_realize;
- widget_class->draw = gtk_menu_draw;
- widget_class->size_request = gtk_menu_size_request;
- widget_class->size_allocate = gtk_menu_size_allocate;
- widget_class->expose_event = gtk_menu_expose;
- widget_class->configure_event = gtk_menu_configure;
- widget_class->key_press_event = gtk_menu_key_press;
- widget_class->show_all = gtk_menu_show_all;
- widget_class->hide_all = gtk_menu_hide_all;
-
- container_class->need_resize = gtk_menu_need_resize;
-
- menu_shell_class->submenu_placement = GTK_LEFT_RIGHT;
- menu_shell_class->deactivate = gtk_menu_deactivate;
-}
-
-static void
-gtk_menu_init (GtkMenu *menu)
-{
- GTK_WIDGET_SET_FLAGS (menu, GTK_TOPLEVEL);
-
- menu->parent_menu_item = NULL;
- menu->old_active_menu_item = NULL;
- menu->accelerator_table = NULL;
- menu->position_func = NULL;
- menu->position_func_data = NULL;
-
- GTK_MENU_SHELL (menu)->menu_flag = TRUE;
-}
-
-static void
-gtk_menu_destroy (GtkObject *object)
-{
- GtkMenuAttachData *data;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_MENU (object));
-
- gtk_widget_ref (GTK_WIDGET (object));
-
- data = gtk_object_get_data (object, attach_data_key);
- if (data)
- gtk_menu_detach (GTK_MENU (object));
-
- gtk_menu_set_accelerator_table (GTK_MENU (object), NULL);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-
- gtk_widget_unref (GTK_WIDGET (object));
-}
-
-
-void
-gtk_menu_attach_to_widget (GtkMenu *menu,
- GtkWidget *attach_widget,
- GtkMenuDetachFunc detacher)
-{
- GtkMenuAttachData *data;
-
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
- g_return_if_fail (attach_widget != NULL);
- g_return_if_fail (GTK_IS_WIDGET (attach_widget));
- g_return_if_fail (detacher != NULL);
-
- /* keep this function in sync with gtk_widget_set_parent()
- */
-
- data = gtk_object_get_data (GTK_OBJECT (menu), attach_data_key);
- if (data)
- {
- g_warning ("gtk_menu_attach_to_widget(): menu already attached to %s",
- gtk_type_name (GTK_OBJECT_TYPE (data->attach_widget)));
- return;
- }
-
- gtk_widget_ref (GTK_WIDGET (menu));
- gtk_object_sink (GTK_OBJECT (menu));
-
- data = g_new (GtkMenuAttachData, 1);
- data->attach_widget = attach_widget;
- data->detacher = detacher;
- gtk_object_set_data (GTK_OBJECT (menu), attach_data_key, data);
-
- if (GTK_WIDGET_STATE (menu) != GTK_STATE_NORMAL)
- gtk_widget_set_state (GTK_WIDGET (menu), GTK_STATE_NORMAL);
-
- /* we don't need to set the style here, since
- * we are a toplevel widget.
- */
-}
-
-GtkWidget*
-gtk_menu_get_attach_widget (GtkMenu *menu)
-{
- GtkMenuAttachData *data;
-
- g_return_val_if_fail (menu != NULL, NULL);
- g_return_val_if_fail (GTK_IS_MENU (menu), NULL);
-
- data = gtk_object_get_data (GTK_OBJECT (menu), attach_data_key);
- if (data)
- return data->attach_widget;
- return NULL;
-}
-
-void
-gtk_menu_detach (GtkMenu *menu)
-{
- GtkMenuAttachData *data;
-
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
-
- /* keep this function in sync with gtk_widget_unparent()
- */
- data = gtk_object_get_data (GTK_OBJECT (menu), attach_data_key);
- if (!data)
- {
- g_warning ("gtk_menu_detach(): menu is not attached");
- return;
- }
- gtk_object_remove_data (GTK_OBJECT (menu), attach_data_key);
-
- data->detacher (data->attach_widget, menu);
-
- if (GTK_WIDGET_REALIZED (menu))
- gtk_widget_unrealize (GTK_WIDGET (menu));
-
- g_free (data);
-
- gtk_widget_unref (GTK_WIDGET (menu));
-}
-
-GtkWidget*
-gtk_menu_new ()
-{
- return GTK_WIDGET (gtk_type_new (gtk_menu_get_type ()));
-}
-
-void
-gtk_menu_append (GtkMenu *menu,
- GtkWidget *child)
-{
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), child);
-}
-
-void
-gtk_menu_prepend (GtkMenu *menu,
- GtkWidget *child)
-{
- gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), child);
-}
-
-void
-gtk_menu_insert (GtkMenu *menu,
- GtkWidget *child,
- gint position)
-{
- gtk_menu_shell_insert (GTK_MENU_SHELL (menu), child, position);
-}
-
-void
-gtk_menu_popup (GtkMenu *menu,
- GtkWidget *parent_menu_shell,
- GtkWidget *parent_menu_item,
- GtkMenuPositionFunc func,
- gpointer data,
- guint button,
- guint32 activate_time)
-{
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
-
- GTK_MENU_SHELL (menu)->parent_menu_shell = parent_menu_shell;
- GTK_MENU_SHELL (menu)->active = TRUE;
- GTK_MENU_SHELL (menu)->button = button;
-
- menu->parent_menu_item = parent_menu_item;
- menu->position_func = func;
- menu->position_func_data = data;
- GTK_MENU_SHELL (menu)->activate_time = activate_time;
-
- gtk_widget_show (GTK_WIDGET (menu));
- gtk_grab_add (GTK_WIDGET (menu));
-}
-
-void
-gtk_menu_popdown (GtkMenu *menu)
-{
- GtkMenuShell *menu_shell;
-
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
-
- menu_shell = GTK_MENU_SHELL (menu);
-
- menu_shell->parent_menu_shell = NULL;
- menu_shell->active = FALSE;
-
- if (menu_shell->active_menu_item)
- {
- menu->old_active_menu_item = menu_shell->active_menu_item;
- gtk_menu_item_deselect (GTK_MENU_ITEM (menu_shell->active_menu_item));
- menu_shell->active_menu_item = NULL;
- }
-
- gtk_widget_hide (GTK_WIDGET (menu));
- gtk_grab_remove (GTK_WIDGET (menu));
-}
-
-GtkWidget*
-gtk_menu_get_active (GtkMenu *menu)
-{
- GtkWidget *child;
- GList *children;
-
- g_return_val_if_fail (menu != NULL, NULL);
- g_return_val_if_fail (GTK_IS_MENU (menu), NULL);
-
- if (!menu->old_active_menu_item)
- {
- child = NULL;
- children = GTK_MENU_SHELL (menu)->children;
-
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_BIN (child)->child)
- break;
- child = NULL;
- }
-
- menu->old_active_menu_item = child;
- }
-
- return menu->old_active_menu_item;
-}
-
-void
-gtk_menu_set_active (GtkMenu *menu,
- guint index)
-{
- GtkWidget *child;
- GList *tmp_list;
-
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
-
- tmp_list = g_list_nth (GTK_MENU_SHELL (menu)->children, index);
- if (tmp_list)
- {
- child = tmp_list->data;
- if (GTK_BIN (child)->child)
- menu->old_active_menu_item = child;
- }
-}
-
-void
-gtk_menu_set_accelerator_table (GtkMenu *menu,
- GtkAcceleratorTable *table)
-{
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
-
- if (menu->accelerator_table != table)
- {
- if (menu->accelerator_table)
- gtk_accelerator_table_unref (menu->accelerator_table);
- menu->accelerator_table = table;
- if (menu->accelerator_table)
- gtk_accelerator_table_ref (menu->accelerator_table);
- }
-}
-
-
-static void
-gtk_menu_show (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
- gtk_widget_map (widget);
-}
-
-static void
-gtk_menu_map (GtkWidget *widget)
-{
- GtkMenu *menu;
- GtkMenuShell *menu_shell;
- GtkWidget *child;
- GList *children;
- GtkAllocation allocation;
- gint x, y;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU (widget));
-
- menu = GTK_MENU (widget);
- menu_shell = GTK_MENU_SHELL (widget);
- GTK_WIDGET_SET_FLAGS (menu_shell, GTK_MAPPED);
-
- gtk_widget_size_request (widget, &widget->requisition);
-
- if (menu_shell->menu_flag)
- {
- menu_shell->menu_flag = FALSE;
-
- allocation.x = widget->allocation.x;
- allocation.y = widget->allocation.y;
- allocation.width = widget->requisition.width;
- allocation.height = widget->requisition.height;
-
- gtk_widget_size_allocate (widget, &allocation);
- }
-
- gdk_window_get_pointer (NULL, &x, &y, NULL);
-
- if (menu->position_func)
- (* menu->position_func) (menu, &x, &y, menu->position_func_data);
- else
- {
- gint screen_width;
- gint screen_height;
-
- screen_width = gdk_screen_width ();
- screen_height = gdk_screen_height ();
-
- x -= 2;
- y -= 2;
-
- if ((x + widget->requisition.width) > screen_width)
- x -= ((x + widget->requisition.width) - screen_width);
- if (x < 0)
- x = 0;
- if ((y + widget->requisition.height) > screen_height)
- y -= ((y + widget->requisition.height) - screen_height);
- if (y < 0)
- y = 0;
- }
-
- gdk_window_move_resize (widget->window, x, y,
- widget->requisition.width,
- widget->requisition.height);
-
- children = menu_shell->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child) && !GTK_WIDGET_MAPPED (child))
- gtk_widget_map (child);
- }
-
- gdk_window_show (widget->window);
-}
-
-static void
-gtk_menu_unmap (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU (widget));
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
- gdk_window_hide (widget->window);
-}
-
-static void
-gtk_menu_realize (GtkWidget *widget)
-{
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.window_type = GDK_WINDOW_TEMP;
- attributes.event_mask = gtk_widget_get_events (widget);
- attributes.event_mask |= (GDK_EXPOSURE_MASK |
- GDK_KEY_PRESS_MASK |
- GDK_STRUCTURE_MASK);
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- widget->window = gdk_window_new (NULL, &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
-}
-
-static void
-gtk_menu_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkMenu *menu;
- GtkMenuShell *menu_shell;
- GtkWidget *child;
- GList *children;
- gint max_accelerator_size;
- gint max_toggle_size;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU (widget));
- g_return_if_fail (requisition != NULL);
-
- menu = GTK_MENU (widget);
- menu_shell = GTK_MENU_SHELL (widget);
-
- requisition->width = 0;
- requisition->height = 0;
-
- max_accelerator_size = 0;
- max_toggle_size = 0;
-
- children = menu_shell->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child))
- {
- GTK_MENU_ITEM (child)->show_submenu_indicator = TRUE;
- gtk_widget_size_request (child, &child->requisition);
-
- requisition->width = MAX (requisition->width, child->requisition.width);
- requisition->height += child->requisition.height;
-
- max_accelerator_size = MAX (max_accelerator_size, GTK_MENU_ITEM (child)->accelerator_size);
- max_toggle_size = MAX (max_toggle_size, MENU_ITEM_CLASS (child)->toggle_size);
- }
- }
-
- requisition->width += max_toggle_size + max_accelerator_size;
- requisition->width += (GTK_CONTAINER (menu)->border_width +
- widget->style->klass->xthickness) * 2;
- requisition->height += (GTK_CONTAINER (menu)->border_width +
- widget->style->klass->ythickness) * 2;
-
- children = menu_shell->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- GTK_MENU_ITEM (child)->accelerator_size = max_accelerator_size;
- GTK_MENU_ITEM (child)->toggle_size = max_toggle_size;
- }
-}
-
-static void
-gtk_menu_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkMenu *menu;
- GtkMenuShell *menu_shell;
- GtkWidget *child;
- GtkAllocation child_allocation;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU (widget));
- g_return_if_fail (allocation != NULL);
-
- menu = GTK_MENU (widget);
- menu_shell = GTK_MENU_SHELL (widget);
-
- widget->allocation = *allocation;
-
- if (menu_shell->children)
- {
- child_allocation.x = (GTK_CONTAINER (menu)->border_width +
- widget->style->klass->xthickness);
- child_allocation.y = (GTK_CONTAINER (menu)->border_width +
- widget->style->klass->ythickness);
- child_allocation.width = allocation->width - child_allocation.x * 2;
-
- children = menu_shell->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child))
- {
- child_allocation.height = child->requisition.height;
-
- gtk_widget_size_allocate (child, &child_allocation);
-
- child_allocation.y += child_allocation.height;
- }
- }
- }
-}
-
-static void
-gtk_menu_paint (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU (widget));
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- gtk_draw_shadow (widget->style,
- widget->window,
- GTK_STATE_NORMAL,
- GTK_SHADOW_OUT,
- 0, 0,
- widget->allocation.width,
- widget->allocation.height);
- }
-}
-
-static void
-gtk_menu_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkMenuShell *menu_shell;
- GtkWidget *child;
- GdkRectangle child_area;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU (widget));
- g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- gtk_menu_paint (widget);
-
- menu_shell = GTK_MENU_SHELL (widget);
-
- children = menu_shell->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (gtk_widget_intersect (child, area, &child_area))
- gtk_widget_draw (child, &child_area);
- }
- }
-}
-
-static gint
-gtk_menu_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkMenuShell *menu_shell;
- GtkWidget *child;
- GdkEventExpose child_event;
- GList *children;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_MENU (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- gtk_menu_paint (widget);
-
- menu_shell = GTK_MENU_SHELL (widget);
- child_event = *event;
-
- children = menu_shell->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_NO_WINDOW (child) &&
- gtk_widget_intersect (child, &event->area, &child_event.area))
- gtk_widget_event (child, (GdkEvent*) &child_event);
- }
- }
-
- return FALSE;
-}
-
-static gint
-gtk_menu_configure (GtkWidget *widget,
- GdkEventConfigure *event)
-{
- GtkAllocation allocation;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_MENU (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- /* If the window was merely moved, do nothing */
- if ((widget->allocation.width == event->width) &&
- (widget->allocation.height == event->height))
- return FALSE;
-
- if (GTK_MENU_SHELL (widget)->menu_flag)
- {
- GTK_MENU_SHELL (widget)->menu_flag = FALSE;
-
- allocation.x = 0;
- allocation.y = 0;
- allocation.width = event->width;
- allocation.height = event->height;
-
- gtk_widget_size_allocate (widget, &allocation);
- }
-
- return FALSE;
-}
-
-static gint
-gtk_menu_key_press (GtkWidget *widget,
- GdkEventKey *event)
-{
- GtkAllocation allocation;
- GtkAcceleratorTable *table;
- GtkMenuShell *menu_shell;
- GtkMenuItem *menu_item;
- gchar *signame;
- int delete;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_MENU (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- delete = ((event->keyval == GDK_Delete) ||
- (event->keyval == GDK_BackSpace));
-
- if (delete || ((event->keyval >= 0x20) && (event->keyval <= 0xFF)))
- {
- menu_shell = GTK_MENU_SHELL (widget);
- menu_item = GTK_MENU_ITEM (menu_shell->active_menu_item);
-
- if (menu_item && GTK_BIN (menu_item)->child)
- {
- /* block resizes */
- gtk_container_block_resize (GTK_CONTAINER (widget));
-
- table = NULL;
- /* if the menu item currently has an accelerator then we'll
- * remove it before we do anything else.
- */
- if (menu_item->accelerator_signal)
- {
- signame = gtk_signal_name (menu_item->accelerator_signal);
- table = gtk_accelerator_table_find (GTK_OBJECT (widget),
- signame,
- menu_item->accelerator_key,
- menu_item->accelerator_mods);
- if (!table)
- table = GTK_MENU (widget)->accelerator_table;
- gtk_widget_remove_accelerator (GTK_WIDGET (menu_item),
- table, signame);
- }
-
- if (!table)
- table = GTK_MENU (widget)->accelerator_table;
-
- /* if we aren't simply deleting the accelerator, then we'll install
- * the new one now.
- */
- if (!delete)
- gtk_widget_install_accelerator (GTK_WIDGET (menu_item),
- table, "activate",
- toupper (event->keyval),
- event->state);
-
- /* check and see if the menu has changed size. */
- gtk_widget_size_request (widget, &widget->requisition);
-
- allocation.x = widget->allocation.x;
- allocation.y = widget->allocation.y;
- allocation.width = widget->requisition.width;
- allocation.height = widget->requisition.height;
-
- if ((allocation.width == widget->allocation.width) &&
- (allocation.height == widget->allocation.height))
- {
- gtk_widget_queue_draw (widget);
- }
- else
- {
- gtk_widget_size_allocate (GTK_WIDGET (widget), &allocation);
- gtk_menu_map (widget);
- }
-
- /* unblock resizes */
- gtk_container_unblock_resize (GTK_CONTAINER (widget));
- }
- }
-
- return FALSE;
-}
-
-static gint
-gtk_menu_need_resize (GtkContainer *container)
-{
- GtkAllocation allocation;
-
- g_return_val_if_fail (container != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_MENU (container), FALSE);
-
- if (GTK_WIDGET_VISIBLE (container))
- {
- GTK_MENU_SHELL (container)->menu_flag = FALSE;
-
- gtk_widget_size_request (GTK_WIDGET (container),
- &GTK_WIDGET (container)->requisition);
-
- allocation.x = GTK_WIDGET (container)->allocation.x;
- allocation.y = GTK_WIDGET (container)->allocation.y;
- allocation.width = GTK_WIDGET (container)->requisition.width;
- allocation.height = GTK_WIDGET (container)->requisition.height;
-
- gtk_widget_size_allocate (GTK_WIDGET (container), &allocation);
- }
- else
- {
- GTK_MENU_SHELL (container)->menu_flag = TRUE;
- }
-
- return FALSE;
-}
-
-static void
-gtk_menu_deactivate (GtkMenuShell *menu_shell)
-{
- GtkWidget *parent;
-
- g_return_if_fail (menu_shell != NULL);
- g_return_if_fail (GTK_IS_MENU (menu_shell));
-
- parent = menu_shell->parent_menu_shell;
-
- menu_shell->activate_time = 0;
- gtk_menu_popdown (GTK_MENU (menu_shell));
-
- if (parent)
- gtk_menu_shell_deactivate (GTK_MENU_SHELL (parent));
-}
-
-
-static void
-gtk_menu_show_all (GtkWidget *widget)
-{
- GtkContainer *container;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU (widget));
- container = GTK_CONTAINER (widget);
-
- /* Show children, but not self. */
- gtk_container_foreach (container, (GtkCallback) gtk_widget_show_all, NULL);
-}
-
-
-static void
-gtk_menu_hide_all (GtkWidget *widget)
-{
- GtkContainer *container;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU (widget));
- container = GTK_CONTAINER (widget);
-
- /* Hide children, but not self. */
- gtk_container_foreach (container, (GtkCallback) gtk_widget_hide_all, NULL);
-}
-
diff --git a/gtk/gtkmenu.h b/gtk/gtkmenu.h
deleted file mode 100644
index 4723db3173..0000000000
--- a/gtk/gtkmenu.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_MENU_H__
-#define __GTK_MENU_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkaccelerator.h>
-#include <gtk/gtkmenushell.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_MENU(obj) GTK_CHECK_CAST (obj, gtk_menu_get_type (), GtkMenu)
-#define GTK_MENU_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_menu_get_type (), GtkMenuClass)
-#define GTK_IS_MENU(obj) GTK_CHECK_TYPE (obj, gtk_menu_get_type ())
-
-
-typedef struct _GtkMenu GtkMenu;
-typedef struct _GtkMenuClass GtkMenuClass;
-
-typedef void (*GtkMenuPositionFunc) (GtkMenu *menu,
- gint *x,
- gint *y,
- gpointer user_data);
-typedef void (*GtkMenuDetachFunc) (GtkWidget *attach_widget,
- GtkMenu *menu);
-
-struct _GtkMenu
-{
- GtkMenuShell menu_shell;
-
- GList *children;
-
- GtkWidget *parent_menu_item;
- GtkWidget *old_active_menu_item;
-
- GtkAcceleratorTable *accelerator_table;
- GtkMenuPositionFunc position_func;
- gpointer position_func_data;
-};
-
-struct _GtkMenuClass
-{
- GtkMenuShellClass parent_class;
-};
-
-
-guint gtk_menu_get_type (void);
-GtkWidget* gtk_menu_new (void);
-void gtk_menu_append (GtkMenu *menu,
- GtkWidget *child);
-void gtk_menu_prepend (GtkMenu *menu,
- GtkWidget *child);
-void gtk_menu_insert (GtkMenu *menu,
- GtkWidget *child,
- gint position);
-void gtk_menu_popup (GtkMenu *menu,
- GtkWidget *parent_menu_shell,
- GtkWidget *parent_menu_item,
- GtkMenuPositionFunc func,
- gpointer data,
- guint button,
- guint32 activate_time);
-void gtk_menu_popdown (GtkMenu *menu);
-GtkWidget* gtk_menu_get_active (GtkMenu *menu);
-void gtk_menu_set_active (GtkMenu *menu,
- guint index);
-void gtk_menu_set_accelerator_table (GtkMenu *menu,
- GtkAcceleratorTable *table);
-void gtk_menu_attach_to_widget (GtkMenu *menu,
- GtkWidget *attach_widget,
- GtkMenuDetachFunc detacher);
-GtkWidget* gtk_menu_get_attach_widget (GtkMenu *menu);
-void gtk_menu_detach (GtkMenu *menu);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_MENU_H__ */
diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c
deleted file mode 100644
index 49c7ec6284..0000000000
--- a/gtk/gtkmenubar.c
+++ /dev/null
@@ -1,311 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkmain.h"
-#include "gtkmenubar.h"
-#include "gtkmenuitem.h"
-
-
-#define BORDER_SPACING 2
-#define CHILD_SPACING 3
-
-
-static void gtk_menu_bar_class_init (GtkMenuBarClass *klass);
-static void gtk_menu_bar_init (GtkMenuBar *menu_bar);
-static void gtk_menu_bar_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_menu_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_menu_bar_paint (GtkWidget *widget);
-static void gtk_menu_bar_draw (GtkWidget *widget,
- GdkRectangle *area);
-static gint gtk_menu_bar_expose (GtkWidget *widget,
- GdkEventExpose *event);
-
-
-guint
-gtk_menu_bar_get_type ()
-{
- static guint menu_bar_type = 0;
-
- if (!menu_bar_type)
- {
- GtkTypeInfo menu_bar_info =
- {
- "GtkMenuBar",
- sizeof (GtkMenuBar),
- sizeof (GtkMenuBarClass),
- (GtkClassInitFunc) gtk_menu_bar_class_init,
- (GtkObjectInitFunc) gtk_menu_bar_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- menu_bar_type = gtk_type_unique (gtk_menu_shell_get_type (), &menu_bar_info);
- }
-
- return menu_bar_type;
-}
-
-static void
-gtk_menu_bar_class_init (GtkMenuBarClass *class)
-{
- GtkWidgetClass *widget_class;
- GtkMenuShellClass *menu_shell_class;
-
- widget_class = (GtkWidgetClass*) class;
- menu_shell_class = (GtkMenuShellClass*) class;
-
- widget_class->draw = gtk_menu_bar_draw;
- widget_class->size_request = gtk_menu_bar_size_request;
- widget_class->size_allocate = gtk_menu_bar_size_allocate;
- widget_class->expose_event = gtk_menu_bar_expose;
-
- menu_shell_class->submenu_placement = GTK_TOP_BOTTOM;
-}
-
-static void
-gtk_menu_bar_init (GtkMenuBar *menu_bar)
-{
-}
-
-GtkWidget*
-gtk_menu_bar_new ()
-{
- return GTK_WIDGET (gtk_type_new (gtk_menu_bar_get_type ()));
-}
-
-void
-gtk_menu_bar_append (GtkMenuBar *menu_bar,
- GtkWidget *child)
-{
- gtk_menu_shell_append (GTK_MENU_SHELL (menu_bar), child);
-}
-
-void
-gtk_menu_bar_prepend (GtkMenuBar *menu_bar,
- GtkWidget *child)
-{
- gtk_menu_shell_prepend (GTK_MENU_SHELL (menu_bar), child);
-}
-
-void
-gtk_menu_bar_insert (GtkMenuBar *menu_bar,
- GtkWidget *child,
- gint position)
-{
- gtk_menu_shell_insert (GTK_MENU_SHELL (menu_bar), child, position);
-}
-
-
-static void
-gtk_menu_bar_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkMenuBar *menu_bar;
- GtkMenuShell *menu_shell;
- GtkWidget *child;
- GList *children;
- gint nchildren;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU_BAR (widget));
- g_return_if_fail (requisition != NULL);
-
- requisition->width = 0;
- requisition->height = 0;
-
- if (GTK_WIDGET_VISIBLE (widget))
- {
- menu_bar = GTK_MENU_BAR (widget);
- menu_shell = GTK_MENU_SHELL (widget);
-
- nchildren = 0;
- children = menu_shell->children;
-
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child))
- {
- GTK_MENU_ITEM (child)->show_submenu_indicator = FALSE;
- gtk_widget_size_request (child, &child->requisition);
-
- requisition->width += child->requisition.width;
- requisition->height = MAX (requisition->height, child->requisition.height);
-
- nchildren += 1;
- }
- }
-
- requisition->width += (GTK_CONTAINER (menu_bar)->border_width +
- widget->style->klass->xthickness +
- BORDER_SPACING) * 2;
- requisition->height += (GTK_CONTAINER (menu_bar)->border_width +
- widget->style->klass->ythickness +
- BORDER_SPACING) * 2;
-
- if (nchildren > 0)
- requisition->width += 2 * CHILD_SPACING * (nchildren - 1);
- }
-}
-
-static void
-gtk_menu_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkMenuBar *menu_bar;
- GtkMenuShell *menu_shell;
- GtkWidget *child;
- GList *children;
- GtkAllocation child_allocation;
- guint offset;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU_BAR (widget));
- g_return_if_fail (allocation != NULL);
-
- menu_bar = GTK_MENU_BAR (widget);
- menu_shell = GTK_MENU_SHELL (widget);
-
- widget->allocation = *allocation;
- if (GTK_WIDGET_REALIZED (widget))
- gdk_window_move_resize (widget->window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
-
- if (menu_shell->children)
- {
- child_allocation.x = (GTK_CONTAINER (menu_bar)->border_width +
- widget->style->klass->xthickness +
- BORDER_SPACING);
- offset = child_allocation.x; /* Window edge to menubar start */
-
- child_allocation.y = (GTK_CONTAINER (menu_bar)->border_width +
- widget->style->klass->ythickness +
- BORDER_SPACING);
- child_allocation.height = allocation->height - child_allocation.y * 2;
-
- children = menu_shell->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- /* Support for the right justified help menu */
- if ( (children == NULL) && (GTK_IS_MENU_ITEM(child))
- && (GTK_MENU_ITEM(child)->right_justify)) {
- child_allocation.x = allocation->width -
- child_allocation.width - CHILD_SPACING - offset;
- }
- if (GTK_WIDGET_VISIBLE (child))
- {
- child_allocation.width = child->requisition.width;
-
- gtk_widget_size_allocate (child, &child_allocation);
-
- child_allocation.x += child_allocation.width + CHILD_SPACING * 2;
- }
- }
- }
-}
-
-static void
-gtk_menu_bar_paint (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU_BAR (widget));
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- gtk_draw_shadow (widget->style,
- widget->window,
- GTK_STATE_NORMAL,
- GTK_SHADOW_OUT,
- 0, 0,
- widget->allocation.width,
- widget->allocation.height);
- }
-}
-
-static void
-gtk_menu_bar_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkMenuShell *menu_shell;
- GtkWidget *child;
- GdkRectangle child_area;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU_BAR (widget));
- g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- gtk_menu_bar_paint (widget);
-
- menu_shell = GTK_MENU_SHELL (widget);
-
- children = menu_shell->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (gtk_widget_intersect (child, area, &child_area))
- gtk_widget_draw (child, &child_area);
- }
- }
-}
-
-static gint
-gtk_menu_bar_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkMenuShell *menu_shell;
- GtkWidget *child;
- GdkEventExpose child_event;
- GList *children;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_MENU_BAR (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- gtk_menu_bar_paint (widget);
-
- menu_shell = GTK_MENU_SHELL (widget);
- child_event = *event;
-
- children = menu_shell->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_NO_WINDOW (child) &&
- gtk_widget_intersect (child, &event->area, &child_event.area))
- gtk_widget_event (child, (GdkEvent*) &child_event);
- }
- }
-
- return FALSE;
-}
diff --git a/gtk/gtkmenubar.h b/gtk/gtkmenubar.h
deleted file mode 100644
index 691e8f36f3..0000000000
--- a/gtk/gtkmenubar.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_MENU_BAR_H__
-#define __GTK_MENU_BAR_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkmenushell.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_MENU_BAR(obj) GTK_CHECK_CAST (obj, gtk_menu_bar_get_type (), GtkMenuBar)
-#define GTK_MENU_BAR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_menu_bar_get_type (), GtkMenuBarClass)
-#define GTK_IS_MENU_BAR(obj) GTK_CHECK_TYPE (obj, gtk_menu_bar_get_type ())
-
-
-typedef struct _GtkMenuBar GtkMenuBar;
-typedef struct _GtkMenuBarClass GtkMenuBarClass;
-
-struct _GtkMenuBar
-{
- GtkMenuShell menu_shell;
-};
-
-struct _GtkMenuBarClass
-{
- GtkMenuShellClass parent_class;
-};
-
-
-guint gtk_menu_bar_get_type (void);
-GtkWidget* gtk_menu_bar_new (void);
-void gtk_menu_bar_append (GtkMenuBar *menu_bar,
- GtkWidget *child);
-void gtk_menu_bar_prepend (GtkMenuBar *menu_bar,
- GtkWidget *child);
-void gtk_menu_bar_insert (GtkMenuBar *menu_bar,
- GtkWidget *child,
- gint position);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_MENU_BAR_H__ */
diff --git a/gtk/gtkmenufactory.c b/gtk/gtkmenufactory.c
deleted file mode 100644
index 7e0f5b7a38..0000000000
--- a/gtk/gtkmenufactory.c
+++ /dev/null
@@ -1,550 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <string.h>
-#include "gtkcheckmenuitem.h"
-#include "gtkmenu.h"
-#include "gtkmenubar.h"
-#include "gtkmenufactory.h"
-#include "gtkmenuitem.h"
-#include "gtksignal.h"
-
-
-enum
-{
- CREATE = 1 << 0,
- DESTROY = 1 << 1,
- CHECK = 1 << 2
-};
-
-
-static void gtk_menu_factory_create (GtkMenuFactory *factory,
- GtkMenuEntry *entry,
- GtkWidget *parent,
- const char *path);
-static void gtk_menu_factory_remove (GtkMenuFactory *factory,
- GtkWidget *parent,
- const char *path);
-static GtkWidget* gtk_menu_factory_make_widget (GtkMenuFactory *factory);
-static GtkMenuPath* gtk_menu_factory_get (GtkWidget *parent,
- const char *path,
- int flags);
-static GtkMenuPath* gtk_menu_factory_find_recurse (GtkMenuFactory *factory,
- GtkWidget *parent,
- const char *path);
-static void gtk_menu_factory_parse_accelerator (const char *accelerator,
- char *accelerator_key,
- guint8 *accelerator_mods);
-
-
-GtkMenuFactory*
-gtk_menu_factory_new (GtkMenuFactoryType type)
-{
- GtkMenuFactory *factory;
-
- factory = g_new (GtkMenuFactory, 1);
- factory->path = NULL;
- factory->type = type;
- factory->table = NULL;
- factory->widget = NULL;
- factory->subfactories = NULL;
-
- return factory;
-}
-
-void
-gtk_menu_factory_destroy (GtkMenuFactory *factory)
-{
- GtkMenuFactory *subfactory;
- GList *tmp_list;
-
- g_return_if_fail (factory != NULL);
-
- if (factory->path)
- g_free (factory->path);
-
- tmp_list = factory->subfactories;
- while (tmp_list)
- {
- subfactory = tmp_list->data;
- tmp_list = tmp_list->next;
-
- gtk_menu_factory_destroy (subfactory);
- }
-
- if (factory->table)
- {
- gtk_accelerator_table_unref (factory->table);
- factory->table = NULL;
- }
-
- if (factory->widget)
- gtk_widget_unref (factory->widget);
-}
-
-void
-gtk_menu_factory_add_entries (GtkMenuFactory *factory,
- GtkMenuEntry *entries,
- int nentries)
-{
- int i;
-
- g_return_if_fail (factory != NULL);
- g_return_if_fail (entries != NULL);
- g_return_if_fail (nentries > 0);
-
- if (!factory->widget)
- {
- factory->widget = gtk_menu_factory_make_widget (factory);
- gtk_widget_ref (factory->widget);
- gtk_object_sink (GTK_OBJECT (factory->widget));
- }
-
- for (i = 0; i < nentries; i++)
- gtk_menu_factory_create (factory, &entries[i], factory->widget, entries[i].path);
-}
-
-void
-gtk_menu_factory_add_subfactory (GtkMenuFactory *factory,
- GtkMenuFactory *subfactory,
- const char *path)
-{
- g_return_if_fail (factory != NULL);
- g_return_if_fail (subfactory != NULL);
- g_return_if_fail (path != NULL);
-
- if (subfactory->path)
- g_free (subfactory->path);
- subfactory->path = g_strdup (path);
-
- factory->subfactories = g_list_append (factory->subfactories, subfactory);
-}
-
-void
-gtk_menu_factory_remove_paths (GtkMenuFactory *factory,
- char **paths,
- int npaths)
-{
- int i;
-
- g_return_if_fail (factory != NULL);
- g_return_if_fail (paths != NULL);
- g_return_if_fail (npaths > 0);
-
- if (factory->widget)
- {
- for (i = 0; i < npaths; i++)
- gtk_menu_factory_remove (factory, factory->widget, paths[i]);
- }
-}
-
-void
-gtk_menu_factory_remove_entries (GtkMenuFactory *factory,
- GtkMenuEntry *entries,
- int nentries)
-{
- int i;
-
- g_return_if_fail (factory != NULL);
- g_return_if_fail (entries != NULL);
- g_return_if_fail (nentries > 0);
-
- if (factory->widget)
- {
- for (i = 0; i < nentries; i++)
- gtk_menu_factory_remove (factory, factory->widget, entries[i].path);
- }
-}
-
-void
-gtk_menu_factory_remove_subfactory (GtkMenuFactory *factory,
- GtkMenuFactory *subfactory,
- const char *path)
-{
- g_return_if_fail (factory != NULL);
- g_return_if_fail (subfactory != NULL);
- g_return_if_fail (path != NULL);
-
- g_warning ("FIXME: gtk_menu_factory_remove_subfactory");
-}
-
-GtkMenuPath*
-gtk_menu_factory_find (GtkMenuFactory *factory,
- const char *path)
-{
- g_return_val_if_fail (factory != NULL, NULL);
- g_return_val_if_fail (path != NULL, NULL);
-
- return gtk_menu_factory_find_recurse (factory, factory->widget, path);
-}
-
-
-static void
-gtk_menu_factory_create (GtkMenuFactory *factory,
- GtkMenuEntry *entry,
- GtkWidget *parent,
- const char *path)
-{
- GtkMenuFactory *subfactory;
- GtkMenuPath *menu_path;
- GtkWidget *menu;
- GList *tmp_list;
- char tmp_path[256];
- char accelerator_key;
- guint8 accelerator_mods;
- char *p;
-
- g_return_if_fail (factory != NULL);
- g_return_if_fail (entry != NULL);
-
- /* If 'path' is empty, then simply return.
- */
- if (!path || path[0] == '\0')
- return;
-
- /* Strip off the next part of the path.
- */
- p = strchr (path, '/');
-
- /* If this is the last part of the path ('p' is
- * NULL), then we create an item.
- */
- if (!p)
- {
- /* Check to see if this item is a separator.
- */
- if (strcmp (path, "<separator>") == 0)
- {
- entry->widget = gtk_menu_item_new ();
- gtk_container_add (GTK_CONTAINER (parent), entry->widget);
- gtk_widget_show (entry->widget);
- }
- else
- {
- if (strncmp (path, "<check>", 7) == 0)
- menu_path = gtk_menu_factory_get (parent, path + 7, CREATE | CHECK);
- else
- menu_path = gtk_menu_factory_get (parent, path, CREATE);
- entry->widget = menu_path->widget;
-
- if (strcmp (path, "<nothing>") == 0)
- gtk_widget_hide (entry->widget);
-
- if (entry->accelerator)
- {
- gtk_menu_factory_parse_accelerator (entry->accelerator,
- &accelerator_key,
- &accelerator_mods);
- if (!factory->table)
- factory->table = gtk_accelerator_table_new ();
-
- gtk_widget_install_accelerator (menu_path->widget,
- factory->table,
- "activate",
- accelerator_key,
- accelerator_mods);
- }
-
- if (entry->callback)
- gtk_signal_connect (GTK_OBJECT (menu_path->widget), "activate",
- (GtkSignalFunc) entry->callback,
- entry->callback_data);
- }
- }
- else
- {
- strncpy (tmp_path, path, (unsigned int) ((long) p - (long) path));
- tmp_path[(long) p - (long) path] = '\0';
-
- menu_path = gtk_menu_factory_get (parent, tmp_path, 0);
- if (!menu_path)
- {
- tmp_list = factory->subfactories;
- while (tmp_list)
- {
- subfactory = tmp_list->data;
- tmp_list = tmp_list->next;
-
- if (subfactory->path &&
- (strcmp (subfactory->path, tmp_path) == 0))
- {
- if (!subfactory->widget)
- {
- subfactory->widget = gtk_menu_factory_make_widget (subfactory);
- gtk_widget_ref (subfactory->widget);
- gtk_object_sink (GTK_OBJECT (subfactory->widget));
- }
-
- gtk_menu_factory_create (subfactory, entry, subfactory->widget, p + 1);
- return;
- }
- }
-
- menu_path = gtk_menu_factory_get (parent, tmp_path, CREATE);
- }
-
- entry->widget = menu_path->widget;
- menu = GTK_MENU_ITEM (menu_path->widget)->submenu;
-
- if (!menu)
- {
- menu = gtk_menu_new ();
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_path->widget), menu);
-
- if (!factory->table)
- factory->table = gtk_accelerator_table_new ();
- gtk_menu_set_accelerator_table (GTK_MENU (menu), factory->table);
- }
-
- gtk_menu_factory_create (factory, entry, menu, p + 1);
- }
-}
-
-static void
-gtk_menu_factory_remove (GtkMenuFactory *factory,
- GtkWidget *parent,
- const char *path)
-{
- GtkMenuFactory *subfactory;
- GtkMenuPath *menu_path;
- GtkWidget *menu;
- GList *tmp_list;
- char tmp_path[256];
- char *p;
-
- if (!path || path[0] == '\0')
- return;
-
- p = strchr (path, '/');
-
- if (!p)
- {
- if (parent)
- gtk_menu_factory_get (parent, path, DESTROY);
- }
- else
- {
- strncpy (tmp_path, path, (unsigned int) ((long) p - (long) path));
- tmp_path[(long) p - (long) path] = '\0';
-
- menu_path = gtk_menu_factory_get (parent, tmp_path, 0);
- if (!menu_path)
- {
- tmp_list = factory->subfactories;
- while (tmp_list)
- {
- subfactory = tmp_list->data;
- tmp_list = tmp_list->next;
-
- if (subfactory->path &&
- (strcmp (subfactory->path, tmp_path) == 0))
- {
- if (!subfactory->widget)
- return;
- gtk_menu_factory_remove (subfactory, subfactory->widget, p + 1);
- }
- }
- }
- else
- {
- menu = GTK_MENU_ITEM (menu_path->widget)->submenu;
- if (menu)
- gtk_menu_factory_remove (factory, menu, p + 1);
- }
- }
-}
-
-static GtkWidget*
-gtk_menu_factory_make_widget (GtkMenuFactory *factory)
-{
- GtkWidget *widget;
-
- g_return_val_if_fail (factory != NULL, NULL);
-
- switch (factory->type)
- {
- case GTK_MENU_FACTORY_MENU:
- widget = gtk_menu_new ();
-
- if (!factory->table)
- factory->table = gtk_accelerator_table_new ();
- gtk_menu_set_accelerator_table (GTK_MENU (widget), factory->table);
- return widget;
- case GTK_MENU_FACTORY_MENU_BAR:
- return gtk_menu_bar_new ();
- case GTK_MENU_FACTORY_OPTION_MENU:
- g_error ("not implemented");
- break;
- }
-
- return NULL;
-}
-
-static GtkMenuPath*
-gtk_menu_factory_get (GtkWidget *parent,
- const char *path,
- int flags)
-{
- GtkMenuPath *menu_path;
- GList *tmp_list;
-
- tmp_list = gtk_object_get_user_data (GTK_OBJECT (parent));
- while (tmp_list)
- {
- menu_path = tmp_list->data;
- tmp_list = tmp_list->next;
-
- if (strcmp (menu_path->path, path) == 0)
- {
- if (flags & DESTROY)
- {
- tmp_list = gtk_object_get_user_data (GTK_OBJECT (parent));
- tmp_list = g_list_remove (tmp_list, menu_path);
- gtk_object_set_user_data (GTK_OBJECT (parent), tmp_list);
-
- gtk_widget_destroy (menu_path->widget);
- g_free (menu_path->path);
- g_free (menu_path);
-
- return NULL;
- }
- else
- {
- return menu_path;
- }
- }
- }
-
- if (flags & CREATE)
- {
- menu_path = g_new (GtkMenuPath, 1);
- menu_path->path = g_strdup (path);
-
- if (flags & CHECK)
- menu_path->widget = gtk_check_menu_item_new_with_label (path);
- else
- menu_path->widget = gtk_menu_item_new_with_label (path);
-
- gtk_container_add (GTK_CONTAINER (parent), menu_path->widget);
- gtk_object_set_user_data (GTK_OBJECT (menu_path->widget), NULL);
- gtk_widget_show (menu_path->widget);
-
- tmp_list = gtk_object_get_user_data (GTK_OBJECT (parent));
- tmp_list = g_list_prepend (tmp_list, menu_path);
- gtk_object_set_user_data (GTK_OBJECT (parent), tmp_list);
-
- return menu_path;
- }
-
- return NULL;
-}
-
-static GtkMenuPath*
-gtk_menu_factory_find_recurse (GtkMenuFactory *factory,
- GtkWidget *parent,
- const char *path)
-{
- GtkMenuFactory *subfactory;
- GtkMenuPath *menu_path;
- GtkWidget *menu;
- GList *tmp_list;
- char tmp_path[256];
- char *p;
-
- if (!path || path[0] == '\0')
- return NULL;
-
- p = strchr (path, '/');
-
- if (!p)
- {
- if (parent)
- return gtk_menu_factory_get (parent, path, 0);
- }
- else
- {
- strncpy (tmp_path, path, (unsigned int) ((long) p - (long) path));
- tmp_path[(long) p - (long) path] = '\0';
-
- menu_path = gtk_menu_factory_get (parent, tmp_path, 0);
- if (!menu_path)
- {
- tmp_list = factory->subfactories;
- while (tmp_list)
- {
- subfactory = tmp_list->data;
- tmp_list = tmp_list->next;
-
- if (subfactory->path &&
- (strcmp (subfactory->path, tmp_path) == 0))
- {
- if (!subfactory->widget)
- return NULL;
- return gtk_menu_factory_find_recurse (subfactory, subfactory->widget, p + 1);
- }
- }
-
- return NULL;
- }
-
- menu = GTK_MENU_ITEM (menu_path->widget)->submenu;
- if (menu)
- return gtk_menu_factory_find_recurse (factory, menu, p + 1);
- }
-
- return NULL;
-}
-
-static void
-gtk_menu_factory_parse_accelerator (const char *accelerator,
- char *accelerator_key,
- guint8 *accelerator_mods)
-{
- int done;
-
- g_return_if_fail (accelerator != NULL);
- g_return_if_fail (accelerator_key != NULL);
- g_return_if_fail (accelerator_mods != NULL);
-
- *accelerator_key = 0;
- *accelerator_mods = 0;
-
- done = FALSE;
- while (!done)
- {
- if (strncmp (accelerator, "<shift>", 7) == 0)
- {
- accelerator += 7;
- *accelerator_mods |= GDK_SHIFT_MASK;
- }
- else if (strncmp (accelerator, "<alt>", 5) == 0)
- {
- accelerator += 5;
- *accelerator_mods |= GDK_MOD1_MASK;
- }
- else if (strncmp (accelerator, "<control>", 9) == 0)
- {
- accelerator += 9;
- *accelerator_mods |= GDK_CONTROL_MASK;
- }
- else
- {
- done = TRUE;
- *accelerator_key = accelerator[0];
- }
- }
-}
diff --git a/gtk/gtkmenufactory.h b/gtk/gtkmenufactory.h
deleted file mode 100644
index d95fdb7751..0000000000
--- a/gtk/gtkmenufactory.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_MENU_FACTORY_H__
-#define __GTK_MENU_FACTORY_H__
-
-
-#include <gtk/gtkwidget.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-typedef struct _GtkMenuEntry GtkMenuEntry;
-typedef struct _GtkMenuPath GtkMenuPath;
-typedef struct _GtkMenuFactory GtkMenuFactory;
-
-typedef void (*GtkMenuCallback) (GtkWidget *widget,
- gpointer user_data);
-
-struct _GtkMenuEntry
-{
- char *path;
- char *accelerator;
- GtkMenuCallback callback;
- gpointer callback_data;
- GtkWidget *widget;
-};
-
-struct _GtkMenuPath
-{
- char *path;
- GtkWidget *widget;
-};
-
-struct _GtkMenuFactory
-{
- char *path;
- GtkMenuFactoryType type;
- GtkAcceleratorTable *table;
- GtkWidget *widget;
- GList *subfactories;
-};
-
-
-GtkMenuFactory* gtk_menu_factory_new (GtkMenuFactoryType type);
-void gtk_menu_factory_destroy (GtkMenuFactory *factory);
-void gtk_menu_factory_add_entries (GtkMenuFactory *factory,
- GtkMenuEntry *entries,
- int nentries);
-void gtk_menu_factory_add_subfactory (GtkMenuFactory *factory,
- GtkMenuFactory *subfactory,
- const char *path);
-void gtk_menu_factory_remove_paths (GtkMenuFactory *factory,
- char **paths,
- int npaths);
-void gtk_menu_factory_remove_entries (GtkMenuFactory *factory,
- GtkMenuEntry *entries,
- int nentries);
-void gtk_menu_factory_remove_subfactory (GtkMenuFactory *factory,
- GtkMenuFactory *subfactory,
- const char *path);
-GtkMenuPath* gtk_menu_factory_find (GtkMenuFactory *factory,
- const char *path);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_MENU_FACTORY_H__ */
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
deleted file mode 100644
index 3d228d8648..0000000000
--- a/gtk/gtkmenuitem.c
+++ /dev/null
@@ -1,813 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <string.h>
-#include "gtklabel.h"
-#include "gtkmain.h"
-#include "gtkmenu.h"
-#include "gtkmenuitem.h"
-#include "gtksignal.h"
-
-
-#define BORDER_SPACING 3
-#define SELECT_TIMEOUT 20
-
-#define MENU_ITEM_CLASS(w) GTK_MENU_ITEM_CLASS (GTK_OBJECT (w)->klass)
-
-
-enum {
- ACTIVATE,
- LAST_SIGNAL
-};
-
-
-static void gtk_menu_item_class_init (GtkMenuItemClass *klass);
-static void gtk_menu_item_init (GtkMenuItem *menu_item);
-static void gtk_menu_item_destroy (GtkObject *object);
-static void gtk_menu_item_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_menu_item_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static gint gtk_menu_item_install_accel (GtkWidget *widget,
- const gchar *signal_name,
- gchar key,
- guint8 modifiers);
-static void gtk_menu_item_remove_accel (GtkWidget *widget,
- const gchar *signal_name);
-static void gtk_menu_item_paint (GtkWidget *widget,
- GdkRectangle *area);
-static void gtk_menu_item_draw (GtkWidget *widget,
- GdkRectangle *area);
-static gint gtk_menu_item_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static gint gtk_menu_item_enter (GtkWidget *widget,
- GdkEventCrossing *event);
-static gint gtk_menu_item_leave (GtkWidget *widget,
- GdkEventCrossing *event);
-static void gtk_real_menu_item_select (GtkItem *item);
-static void gtk_real_menu_item_deselect (GtkItem *item);
-static gint gtk_menu_item_select_timeout (gpointer data);
-static void gtk_menu_item_position_menu (GtkMenu *menu,
- gint *x,
- gint *y,
- gpointer user_data);
-static void gtk_menu_item_show_all (GtkWidget *widget);
-static void gtk_menu_item_hide_all (GtkWidget *widget);
-
-static GtkItemClass *parent_class;
-static guint menu_item_signals[LAST_SIGNAL] = { 0 };
-
-
-guint
-gtk_menu_item_get_type ()
-{
- static guint menu_item_type = 0;
-
- if (!menu_item_type)
- {
- GtkTypeInfo menu_item_info =
- {
- "GtkMenuItem",
- sizeof (GtkMenuItem),
- sizeof (GtkMenuItemClass),
- (GtkClassInitFunc) gtk_menu_item_class_init,
- (GtkObjectInitFunc) gtk_menu_item_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- menu_item_type = gtk_type_unique (gtk_item_get_type (), &menu_item_info);
- }
-
- return menu_item_type;
-}
-
-static void
-gtk_menu_item_class_init (GtkMenuItemClass *klass)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkItemClass *item_class;
-
- object_class = (GtkObjectClass*) klass;
- widget_class = (GtkWidgetClass*) klass;
- item_class = (GtkItemClass*) klass;
-
- parent_class = gtk_type_class (gtk_item_get_type ());
-
- menu_item_signals[ACTIVATE] =
- gtk_signal_new ("activate",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkMenuItemClass, activate),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, menu_item_signals, LAST_SIGNAL);
-
- object_class->destroy = gtk_menu_item_destroy;
-
- widget_class->activate_signal = menu_item_signals[ACTIVATE];
- widget_class->size_request = gtk_menu_item_size_request;
- widget_class->size_allocate = gtk_menu_item_size_allocate;
- widget_class->install_accelerator = gtk_menu_item_install_accel;
- widget_class->remove_accelerator = gtk_menu_item_remove_accel;
- widget_class->draw = gtk_menu_item_draw;
- widget_class->expose_event = gtk_menu_item_expose;
- widget_class->enter_notify_event = gtk_menu_item_enter;
- widget_class->leave_notify_event = gtk_menu_item_leave;
- widget_class->show_all = gtk_menu_item_show_all;
- widget_class->hide_all = gtk_menu_item_hide_all;
-
- item_class->select = gtk_real_menu_item_select;
- item_class->deselect = gtk_real_menu_item_deselect;
-
- klass->activate = NULL;
-
- klass->toggle_size = 0;
- klass->shift_text = "Shft";
- klass->control_text = "Ctl";
- klass->alt_text = "Alt";
- klass->separator_text = "+";
-}
-
-static void
-gtk_menu_item_init (GtkMenuItem *menu_item)
-{
- menu_item->submenu = NULL;
- menu_item->accelerator_key = 0;
- menu_item->accelerator_mods = 0;
- menu_item->accelerator_size = 0;
- menu_item->accelerator_signal = 0;
- menu_item->toggle_size = 0;
- menu_item->show_toggle_indicator = FALSE;
- menu_item->show_submenu_indicator = FALSE;
- menu_item->submenu_direction = GTK_DIRECTION_RIGHT;
- menu_item->submenu_placement = GTK_TOP_BOTTOM;
- menu_item->right_justify = FALSE;
-
- menu_item->timer = 0;
-}
-
-GtkWidget*
-gtk_menu_item_new ()
-{
- return GTK_WIDGET (gtk_type_new (gtk_menu_item_get_type ()));
-}
-
-GtkWidget*
-gtk_menu_item_new_with_label (const gchar *label)
-{
- GtkWidget *menu_item;
- GtkWidget *label_widget;
-
- menu_item = gtk_menu_item_new ();
- label_widget = gtk_label_new (label);
- gtk_misc_set_alignment (GTK_MISC (label_widget), 0.0, 0.5);
-
- gtk_container_add (GTK_CONTAINER (menu_item), label_widget);
- gtk_widget_show (label_widget);
-
- return menu_item;
-}
-
-static void
-gtk_menu_item_destroy (GtkObject *object)
-{
- GtkMenuItem *menu_item;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_MENU_ITEM (object));
-
- menu_item = GTK_MENU_ITEM (object);
-
- if (menu_item->submenu)
- gtk_widget_destroy (menu_item->submenu);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-static void
-gtk_menu_item_detacher (GtkWidget *widget,
- GtkMenu *menu)
-{
- GtkMenuItem *menu_item;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU_ITEM (widget));
-
- menu_item = GTK_MENU_ITEM (widget);
- g_return_if_fail (menu_item->submenu == (GtkWidget*) menu);
-
- menu_item->submenu = NULL;
-}
-
-void
-gtk_menu_item_set_submenu (GtkMenuItem *menu_item,
- GtkWidget *submenu)
-{
- g_return_if_fail (menu_item != NULL);
- g_return_if_fail (GTK_IS_MENU_ITEM (menu_item));
-
- if (menu_item->submenu != submenu)
- {
- gtk_menu_item_remove_submenu (menu_item);
-
- menu_item->submenu = submenu;
- gtk_menu_attach_to_widget (GTK_MENU (submenu),
- GTK_WIDGET (menu_item),
- gtk_menu_item_detacher);
-
- if (GTK_WIDGET (menu_item)->parent)
- gtk_widget_queue_resize (GTK_WIDGET (menu_item));
- }
-}
-
-void
-gtk_menu_item_remove_submenu (GtkMenuItem *menu_item)
-{
- g_return_if_fail (menu_item != NULL);
- g_return_if_fail (GTK_IS_MENU_ITEM (menu_item));
-
- if (menu_item->submenu)
- gtk_menu_detach (GTK_MENU (menu_item->submenu));
-}
-
-void
-gtk_menu_item_set_placement (GtkMenuItem *menu_item,
- GtkSubmenuPlacement placement)
-{
- g_return_if_fail (menu_item != NULL);
- g_return_if_fail (GTK_IS_MENU_ITEM (menu_item));
-
- menu_item->submenu_placement = placement;
-}
-
-void
-gtk_menu_item_accelerator_size (GtkMenuItem *menu_item)
-{
- char buf[32];
-
- g_return_if_fail (menu_item != NULL);
- g_return_if_fail (GTK_IS_MENU_ITEM (menu_item));
-
- if (menu_item->accelerator_key)
- {
- gtk_menu_item_accelerator_text (menu_item, buf);
- menu_item->accelerator_size = gdk_string_width (GTK_WIDGET (menu_item)->style->font, buf) + 13;
- }
- else if (menu_item->submenu && menu_item->show_submenu_indicator)
- {
- menu_item->accelerator_size = 21;
- }
- else
- {
- menu_item->accelerator_size = 0;
- }
-}
-
-void
-gtk_menu_item_accelerator_text (GtkMenuItem *menu_item,
- gchar *buffer)
-{
- g_return_if_fail (menu_item != NULL);
- g_return_if_fail (GTK_IS_MENU_ITEM (menu_item));
-
- if (menu_item->accelerator_key)
- {
- buffer[0] = '\0';
- if (menu_item->accelerator_mods & GDK_SHIFT_MASK)
- {
- strcat (buffer, MENU_ITEM_CLASS (menu_item)->shift_text);
- strcat (buffer, MENU_ITEM_CLASS (menu_item)->separator_text);
- }
- if (menu_item->accelerator_mods & GDK_CONTROL_MASK)
- {
- strcat (buffer, MENU_ITEM_CLASS (menu_item)->control_text);
- strcat (buffer, MENU_ITEM_CLASS (menu_item)->separator_text);
- }
- if (menu_item->accelerator_mods & GDK_MOD1_MASK)
- {
- strcat (buffer, MENU_ITEM_CLASS (menu_item)->alt_text);
- strcat (buffer, MENU_ITEM_CLASS (menu_item)->separator_text);
- }
- strncat (buffer, &menu_item->accelerator_key, 1);
- }
-}
-
-void
-gtk_menu_item_configure (GtkMenuItem *menu_item,
- gint show_toggle_indicator,
- gint show_submenu_indicator)
-{
- g_return_if_fail (menu_item != NULL);
- g_return_if_fail (GTK_IS_MENU_ITEM (menu_item));
-
- menu_item->show_toggle_indicator = (show_toggle_indicator == TRUE);
- menu_item->show_submenu_indicator = (show_submenu_indicator == TRUE);
-}
-
-void
-gtk_menu_item_select (GtkMenuItem *menu_item)
-{
- gtk_item_select (GTK_ITEM (menu_item));
-}
-
-void
-gtk_menu_item_deselect (GtkMenuItem *menu_item)
-{
- gtk_item_deselect (GTK_ITEM (menu_item));
-}
-
-void
-gtk_menu_item_activate (GtkMenuItem *menu_item)
-{
- gtk_signal_emit (GTK_OBJECT (menu_item), menu_item_signals[ACTIVATE]);
-}
-
-
-static void
-gtk_menu_item_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkBin *bin;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU_ITEM (widget));
- g_return_if_fail (requisition != NULL);
-
- bin = GTK_BIN (widget);
-
- gtk_menu_item_accelerator_size (GTK_MENU_ITEM (widget));
-
- requisition->width = (GTK_CONTAINER (widget)->border_width +
- widget->style->klass->xthickness +
- BORDER_SPACING) * 2;
- requisition->height = (GTK_CONTAINER (widget)->border_width +
- widget->style->klass->ythickness) * 2;
-
- if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
- {
- gtk_widget_size_request (bin->child, &bin->child->requisition);
-
- requisition->width += bin->child->requisition.width;
- requisition->height += bin->child->requisition.height;
- }
-}
-
-static void
-gtk_menu_item_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkBin *bin;
- GtkAllocation child_allocation;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU_ITEM (widget));
- g_return_if_fail (allocation != NULL);
-
- widget->allocation = *allocation;
- if (GTK_WIDGET_REALIZED (widget))
- gdk_window_move_resize (widget->window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
-
- bin = GTK_BIN (widget);
-
- if (bin->child)
- {
- child_allocation.x = (GTK_CONTAINER (widget)->border_width +
- widget->style->klass->xthickness +
- BORDER_SPACING);
- child_allocation.y = GTK_CONTAINER (widget)->border_width;
- child_allocation.width = allocation->width - child_allocation.x * 2;
- child_allocation.height = allocation->height - child_allocation.y * 2;
- child_allocation.x += GTK_MENU_ITEM (widget)->toggle_size;
- child_allocation.width -= (GTK_MENU_ITEM (widget)->toggle_size +
- GTK_MENU_ITEM (widget)->accelerator_size);
-
- gtk_widget_size_allocate (bin->child, &child_allocation);
- }
-}
-
-static gint
-gtk_menu_item_install_accel (GtkWidget *widget,
- const gchar *signal_name,
- gchar key,
- guint8 modifiers)
-{
- GtkMenuItem *menu_item;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_MENU_ITEM (widget), FALSE);
- g_return_val_if_fail (signal_name != NULL, FALSE);
-
- menu_item = GTK_MENU_ITEM (widget);
-
- menu_item->accelerator_signal = gtk_signal_lookup (signal_name, GTK_OBJECT_TYPE (widget));
- if (menu_item->accelerator_signal > 0)
- {
- menu_item->accelerator_key = key;
- menu_item->accelerator_mods = modifiers;
-
- if (widget->parent)
- gtk_widget_queue_resize (widget);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void
-gtk_menu_item_remove_accel (GtkWidget *widget,
- const gchar *signal_name)
-{
- GtkMenuItem *menu_item;
- guint signal_num;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU_ITEM (widget));
- g_return_if_fail (signal_name != NULL);
-
- menu_item = GTK_MENU_ITEM (widget);
-
- signal_num = gtk_signal_lookup (signal_name, GTK_OBJECT_TYPE (widget));
- if (menu_item->accelerator_signal == signal_num)
- {
- menu_item->accelerator_key = 0;
- menu_item->accelerator_mods = 0;
- menu_item->accelerator_signal = 0;
-
- if (GTK_WIDGET_VISIBLE (widget))
- {
- gtk_widget_queue_draw (widget);
- GTK_MENU_SHELL (widget->parent)->menu_flag = TRUE;
- }
- else
- gtk_container_need_resize (GTK_CONTAINER (widget->parent));
- }
-}
-
-static void
-gtk_menu_item_paint (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkMenuItem *menu_item;
- GtkStateType state_type;
- GtkShadowType shadow_type;
- GdkFont *font;
- gint width, height;
- gint x, y;
- char buf[32];
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU_ITEM (widget));
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- menu_item = GTK_MENU_ITEM (widget);
-
- state_type = widget->state;
- if (!GTK_WIDGET_IS_SENSITIVE (widget))
- state_type = GTK_STATE_INSENSITIVE;
-
- gtk_style_set_background (widget->style, widget->window, state_type);
- gdk_window_clear_area (widget->window, area->x, area->y, area->width, area->height);
-
- x = GTK_CONTAINER (menu_item)->border_width;
- y = GTK_CONTAINER (menu_item)->border_width;
- width = widget->allocation.width - x * 2;
- height = widget->allocation.height - y * 2;
-
- if ((state_type == GTK_STATE_PRELIGHT) &&
- (GTK_BIN (menu_item)->child))
- gtk_draw_shadow (widget->style,
- widget->window,
- GTK_STATE_PRELIGHT,
- GTK_SHADOW_OUT,
- x, y, width, height);
-
- if (menu_item->accelerator_key)
- {
- gtk_menu_item_accelerator_text (menu_item, buf);
-
- font = widget->style->font;
- x = x + width - menu_item->accelerator_size + 13 - 4;
- y = y + ((height - (font->ascent + font->descent)) / 2) + font->ascent;
-
- if (state_type == GTK_STATE_INSENSITIVE)
- gdk_draw_string (widget->window, widget->style->font,
- widget->style->white_gc,
- x + 1, y + 1, buf);
-
- gdk_draw_string (widget->window, widget->style->font,
- widget->style->fg_gc[state_type],
- x, y, buf);
- }
- else if (menu_item->submenu && menu_item->show_submenu_indicator)
- {
- shadow_type = GTK_SHADOW_OUT;
- if (state_type == GTK_STATE_PRELIGHT)
- shadow_type = GTK_SHADOW_IN;
-
- gtk_draw_arrow (widget->style, widget->window,
- state_type, shadow_type, GTK_ARROW_RIGHT, FALSE,
- x + width - 15, y + height / 2 - 5, 10, 10);
- }
- else if (!GTK_BIN (menu_item)->child)
- {
- gtk_draw_hline (widget->style, widget->window, GTK_STATE_NORMAL,
- 0, widget->allocation.width, 0);
- }
- }
-}
-
-static void
-gtk_menu_item_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkBin *bin;
- GdkRectangle child_area;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU_ITEM (widget));
- g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- gtk_menu_item_paint (widget, area);
-
- bin = GTK_BIN (widget);
-
- if (bin->child)
- {
- if (gtk_widget_intersect (bin->child, area, &child_area))
- gtk_widget_draw (bin->child, &child_area);
- }
- }
-}
-
-static gint
-gtk_menu_item_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkBin *bin;
- GdkEventExpose child_event;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_MENU_ITEM (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- gtk_menu_item_paint (widget, &event->area);
-
- bin = GTK_BIN (widget);
-
- if (bin->child)
- {
- child_event = *event;
-
- if (GTK_WIDGET_NO_WINDOW (bin->child) &&
- gtk_widget_intersect (bin->child, &event->area, &child_event.area))
- gtk_widget_event (bin->child, (GdkEvent*) &child_event);
- }
- }
-
- return FALSE;
-}
-
-static gint
-gtk_menu_item_enter (GtkWidget *widget,
- GdkEventCrossing *event)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_MENU_ITEM (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- return gtk_widget_event (widget->parent, (GdkEvent*) event);
-}
-
-static gint
-gtk_menu_item_leave (GtkWidget *widget,
- GdkEventCrossing *event)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_MENU_ITEM (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- return gtk_widget_event (widget->parent, (GdkEvent*) event);
-}
-
-static void
-gtk_real_menu_item_select (GtkItem *item)
-{
- GtkMenuItem *menu_item;
-
- g_return_if_fail (item != NULL);
- g_return_if_fail (GTK_IS_MENU_ITEM (item));
-
- menu_item = GTK_MENU_ITEM (item);
-
- if (menu_item->submenu && !GTK_WIDGET_VISIBLE (menu_item->submenu))
- menu_item->timer = gtk_timeout_add (SELECT_TIMEOUT, gtk_menu_item_select_timeout, menu_item);
-
- gtk_widget_set_state (GTK_WIDGET (menu_item), GTK_STATE_PRELIGHT);
- gtk_widget_draw (GTK_WIDGET (menu_item), NULL);
-}
-
-static void
-gtk_real_menu_item_deselect (GtkItem *item)
-{
- GtkMenuItem *menu_item;
-
- g_return_if_fail (item != NULL);
- g_return_if_fail (GTK_IS_MENU_ITEM (item));
-
- menu_item = GTK_MENU_ITEM (item);
-
- if (menu_item->submenu)
- {
- if (menu_item->timer)
- gtk_timeout_remove (menu_item->timer);
- else
- gtk_menu_popdown (GTK_MENU (menu_item->submenu));
- }
-
- gtk_widget_set_state (GTK_WIDGET (menu_item), GTK_STATE_NORMAL);
- gtk_widget_draw (GTK_WIDGET (menu_item), NULL);
-}
-
-static gint
-gtk_menu_item_select_timeout (gpointer data)
-{
- GtkMenuItem *menu_item;
-
- menu_item = GTK_MENU_ITEM (data);
- menu_item->timer = 0;
-
- gtk_menu_popup (GTK_MENU (menu_item->submenu),
- GTK_WIDGET (menu_item)->parent,
- GTK_WIDGET (menu_item),
- gtk_menu_item_position_menu,
- menu_item,
- GTK_MENU_SHELL (GTK_WIDGET (menu_item)->parent)->button,
- 0);
-
- return FALSE;
-}
-
-static void
-gtk_menu_item_position_menu (GtkMenu *menu,
- gint *x,
- gint *y,
- gpointer user_data)
-{
- GtkMenuItem *menu_item;
- GtkWidget *parent_menu_item;
- gint screen_width;
- gint screen_height;
- gint twidth, theight;
- gint tx, ty;
-
- g_return_if_fail (menu != NULL);
- g_return_if_fail (x != NULL);
- g_return_if_fail (y != NULL);
-
- menu_item = GTK_MENU_ITEM (user_data);
-
- twidth = GTK_WIDGET (menu)->requisition.width;
- theight = GTK_WIDGET (menu)->requisition.height;
-
- screen_width = gdk_screen_width ();
- screen_height = gdk_screen_height ();
-
- if (!gdk_window_get_origin (GTK_WIDGET (menu_item)->window, &tx, &ty))
- {
- g_warning ("Menu not on screen");
- return;
- }
-
- switch (menu_item->submenu_placement)
- {
- case GTK_TOP_BOTTOM:
- if ((ty + GTK_WIDGET (menu_item)->allocation.height + theight) <= screen_height)
- ty += GTK_WIDGET (menu_item)->allocation.height;
- else if ((ty - theight) >= 0)
- ty -= theight;
- else
- ty += GTK_WIDGET (menu_item)->allocation.height;
-
- if ((tx + twidth) > screen_width)
- {
- tx -= ((tx + twidth) - screen_width);
- if (tx < 0)
- tx = 0;
- }
- break;
-
- case GTK_LEFT_RIGHT:
- menu_item->submenu_direction = GTK_DIRECTION_RIGHT;
- parent_menu_item = GTK_MENU (GTK_WIDGET (menu_item)->parent)->parent_menu_item;
- if (parent_menu_item)
- menu_item->submenu_direction = GTK_MENU_ITEM (parent_menu_item)->submenu_direction;
-
- switch (menu_item->submenu_direction)
- {
- case GTK_DIRECTION_LEFT:
- if ((tx - twidth) >= 0)
- tx -= twidth;
- else
- {
- menu_item->submenu_direction = GTK_DIRECTION_RIGHT;
- tx += GTK_WIDGET (menu_item)->allocation.width - 5;
- }
- break;
-
- case GTK_DIRECTION_RIGHT:
- if ((tx + GTK_WIDGET (menu_item)->allocation.width + twidth - 5) <= screen_width)
- tx += GTK_WIDGET (menu_item)->allocation.width - 5;
- else
- {
- menu_item->submenu_direction = GTK_DIRECTION_LEFT;
- tx -= twidth;
- }
- break;
- }
-
- if ((ty + GTK_WIDGET (menu_item)->allocation.height / 4 + theight) <= screen_height)
- ty += GTK_WIDGET (menu_item)->allocation.height / 4;
- else
- {
- ty -= ((ty + theight) - screen_height);
- if (ty < 0)
- ty = 0;
- }
- break;
- }
-
- *x = tx;
- *y = ty;
-}
-
-void
-gtk_menu_item_right_justify(GtkMenuItem *menuitem)
-{
- g_return_if_fail (menuitem != NULL);
- g_return_if_fail (GTK_IS_MENU_ITEM (menuitem));
-
- menuitem->right_justify = 1;
-}
-
-static void
-gtk_menu_item_show_all (GtkWidget *widget)
-{
- GtkContainer *container;
- GtkMenuItem *menu_item;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU_ITEM (widget));
- container = GTK_CONTAINER (widget);
- menu_item = GTK_MENU_ITEM (widget);
-
- /* Show children, traverse to submenu, show self. */
- gtk_container_foreach (container, (GtkCallback) gtk_widget_show_all, NULL);
- if (menu_item->submenu)
- gtk_widget_show_all (menu_item->submenu);
- gtk_widget_show (widget);
-}
-
-
-static void
-gtk_menu_item_hide_all (GtkWidget *widget)
-{
- GtkContainer *container;
- GtkMenuItem *menu_item;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU_ITEM (widget));
- container = GTK_CONTAINER (widget);
- menu_item = GTK_MENU_ITEM (widget);
-
- /* Reverse order of gtk_menu_item_show_all */
- gtk_widget_hide (widget);
- if (menu_item->submenu)
- gtk_widget_hide_all (menu_item->submenu);
- gtk_container_foreach (container, (GtkCallback) gtk_widget_hide_all, NULL);
-}
diff --git a/gtk/gtkmenuitem.h b/gtk/gtkmenuitem.h
deleted file mode 100644
index 4a8ad8f112..0000000000
--- a/gtk/gtkmenuitem.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_MENU_ITEM_H__
-#define __GTK_MENU_ITEM_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkitem.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_MENU_ITEM(obj) GTK_CHECK_CAST (obj, gtk_menu_item_get_type (), GtkMenuItem)
-#define GTK_MENU_ITEM_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_menu_item_get_type (), GtkMenuItemClass)
-#define GTK_IS_MENU_ITEM(obj) GTK_CHECK_TYPE (obj, gtk_menu_item_get_type ())
-
-
-typedef struct _GtkMenuItem GtkMenuItem;
-typedef struct _GtkMenuItemClass GtkMenuItemClass;
-
-struct _GtkMenuItem
-{
- GtkItem item;
-
- GtkWidget *submenu;
-
- guint accelerator_signal;
- gchar accelerator_key;
- guint8 accelerator_mods;
- guint16 accelerator_size;
- guint16 toggle_size;
-
- guint show_toggle_indicator : 1;
- guint show_submenu_indicator : 1;
- guint submenu_placement : 1;
- guint submenu_direction : 1;
- guint right_justify: 1;
- gint timer;
-};
-
-struct _GtkMenuItemClass
-{
- GtkItemClass parent_class;
-
- gint toggle_size;
-
- gchar *shift_text;
- gchar *control_text;
- gchar *alt_text;
- gchar *separator_text;
-
- void (* activate) (GtkMenuItem *menu_item);
-};
-
-
-guint gtk_menu_item_get_type (void);
-GtkWidget* gtk_menu_item_new (void);
-GtkWidget* gtk_menu_item_new_with_label (const gchar *label);
-void gtk_menu_item_set_submenu (GtkMenuItem *menu_item,
- GtkWidget *submenu);
-void gtk_menu_item_remove_submenu (GtkMenuItem *menu_item);
-void gtk_menu_item_set_placement (GtkMenuItem *menu_item,
- GtkSubmenuPlacement placement);
-void gtk_menu_item_accelerator_size (GtkMenuItem *menu_item);
-void gtk_menu_item_accelerator_text (GtkMenuItem *menu_item,
- gchar *buffer);
-void gtk_menu_item_configure (GtkMenuItem *menu_item,
- gint show_toggle_indicator,
- gint show_submenu_indicator);
-void gtk_menu_item_select (GtkMenuItem *menu_item);
-void gtk_menu_item_deselect (GtkMenuItem *menu_item);
-void gtk_menu_item_activate (GtkMenuItem *menu_item);
-void gtk_menu_item_right_justify (GtkMenuItem *menu_item);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_MENU_ITEM_H__ */
diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c
deleted file mode 100644
index d063d0e92d..0000000000
--- a/gtk/gtkmenushell.c
+++ /dev/null
@@ -1,605 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkmain.h"
-#include "gtkmenuitem.h"
-#include "gtkmenushell.h"
-#include "gtksignal.h"
-
-
-#define MENU_SHELL_TIMEOUT 500
-#define MENU_SHELL_CLASS(w) GTK_MENU_SHELL_CLASS (GTK_OBJECT (w)->klass)
-
-
-enum {
- DEACTIVATE,
- LAST_SIGNAL
-};
-
-
-static void gtk_menu_shell_class_init (GtkMenuShellClass *klass);
-static void gtk_menu_shell_init (GtkMenuShell *menu_shell);
-static void gtk_menu_shell_map (GtkWidget *widget);
-static void gtk_menu_shell_realize (GtkWidget *widget);
-static gint gtk_menu_shell_button_press (GtkWidget *widget,
- GdkEventButton *event);
-static gint gtk_menu_shell_button_release (GtkWidget *widget,
- GdkEventButton *event);
-static gint gtk_menu_shell_enter_notify (GtkWidget *widget,
- GdkEventCrossing *event);
-static gint gtk_menu_shell_leave_notify (GtkWidget *widget,
- GdkEventCrossing *event);
-static void gtk_menu_shell_add (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_menu_shell_remove (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_menu_shell_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data);
-static void gtk_real_menu_shell_deactivate (GtkMenuShell *menu_shell);
-static gint gtk_menu_shell_is_item (GtkMenuShell *menu_shell,
- GtkWidget *child);
-
-
-static GtkContainerClass *parent_class = NULL;
-static guint menu_shell_signals[LAST_SIGNAL] = { 0 };
-
-
-guint
-gtk_menu_shell_get_type ()
-{
- static guint menu_shell_type = 0;
-
- if (!menu_shell_type)
- {
- GtkTypeInfo menu_shell_info =
- {
- "GtkMenuShell",
- sizeof (GtkMenuShell),
- sizeof (GtkMenuShellClass),
- (GtkClassInitFunc) gtk_menu_shell_class_init,
- (GtkObjectInitFunc) gtk_menu_shell_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- menu_shell_type = gtk_type_unique (gtk_container_get_type (), &menu_shell_info);
- }
-
- return menu_shell_type;
-}
-
-static void
-gtk_menu_shell_class_init (GtkMenuShellClass *klass)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GtkObjectClass*) klass;
- widget_class = (GtkWidgetClass*) klass;
- container_class = (GtkContainerClass*) klass;
-
- parent_class = gtk_type_class (gtk_container_get_type ());
-
- menu_shell_signals[DEACTIVATE] =
- gtk_signal_new ("deactivate",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkMenuShellClass, deactivate),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, menu_shell_signals, LAST_SIGNAL);
-
- widget_class->map = gtk_menu_shell_map;
- widget_class->realize = gtk_menu_shell_realize;
- widget_class->button_press_event = gtk_menu_shell_button_press;
- widget_class->button_release_event = gtk_menu_shell_button_release;
- widget_class->enter_notify_event = gtk_menu_shell_enter_notify;
- widget_class->leave_notify_event = gtk_menu_shell_leave_notify;
-
- container_class->add = gtk_menu_shell_add;
- container_class->remove = gtk_menu_shell_remove;
- container_class->foreach = gtk_menu_shell_foreach;
-
- klass->submenu_placement = GTK_TOP_BOTTOM;
- klass->deactivate = gtk_real_menu_shell_deactivate;
-}
-
-static void
-gtk_menu_shell_init (GtkMenuShell *menu_shell)
-{
- menu_shell->children = NULL;
- menu_shell->active_menu_item = NULL;
- menu_shell->parent_menu_shell = NULL;
- menu_shell->active = FALSE;
- menu_shell->have_grab = FALSE;
- menu_shell->have_xgrab = FALSE;
- menu_shell->ignore_leave = FALSE;
- menu_shell->button = 0;
- menu_shell->menu_flag = 0;
- menu_shell->activate_time = 0;
-}
-
-void
-gtk_menu_shell_append (GtkMenuShell *menu_shell,
- GtkWidget *child)
-{
- gtk_menu_shell_insert (menu_shell, child, -1);
-}
-
-void
-gtk_menu_shell_prepend (GtkMenuShell *menu_shell,
- GtkWidget *child)
-{
- gtk_menu_shell_insert (menu_shell, child, 0);
-}
-
-void
-gtk_menu_shell_insert (GtkMenuShell *menu_shell,
- GtkWidget *child,
- gint position)
-{
- GList *tmp_list;
- GList *new_list;
- gint nchildren;
-
- g_return_if_fail (menu_shell != NULL);
- g_return_if_fail (GTK_IS_MENU_SHELL (menu_shell));
- g_return_if_fail (child != NULL);
- g_return_if_fail (GTK_IS_MENU_ITEM (child));
-
- gtk_widget_set_parent (child, GTK_WIDGET (menu_shell));
-
- if (GTK_WIDGET_VISIBLE (child->parent))
- {
- if (GTK_WIDGET_REALIZED (child->parent) &&
- !GTK_WIDGET_REALIZED (child))
- gtk_widget_realize (child);
-
- if (GTK_WIDGET_MAPPED (child->parent) &&
- !GTK_WIDGET_MAPPED (child))
- gtk_widget_map (child);
- }
-
- nchildren = g_list_length (menu_shell->children);
- if ((position < 0) || (position > nchildren))
- position = nchildren;
-
- if (position == nchildren)
- {
- menu_shell->children = g_list_append (menu_shell->children, child);
- }
- else
- {
- tmp_list = g_list_nth (menu_shell->children, position);
- new_list = g_list_alloc ();
- new_list->data = child;
-
- if (tmp_list->prev)
- tmp_list->prev->next = new_list;
- new_list->next = tmp_list;
- new_list->prev = tmp_list->prev;
- tmp_list->prev = new_list;
-
- if (tmp_list == menu_shell->children)
- menu_shell->children = new_list;
- }
-
- if (GTK_WIDGET_VISIBLE (menu_shell))
- gtk_widget_queue_resize (GTK_WIDGET (menu_shell));
-}
-
-void
-gtk_menu_shell_deactivate (GtkMenuShell *menu_shell)
-{
- g_return_if_fail (menu_shell != NULL);
- g_return_if_fail (GTK_IS_MENU_SHELL (menu_shell));
-
- gtk_signal_emit (GTK_OBJECT (menu_shell), menu_shell_signals[DEACTIVATE]);
-}
-
-static void
-gtk_menu_shell_map (GtkWidget *widget)
-{
- GtkMenuShell *menu_shell;
- GtkWidget *child;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU_SHELL (widget));
-
- menu_shell = GTK_MENU_SHELL (widget);
- GTK_WIDGET_SET_FLAGS (menu_shell, GTK_MAPPED);
- gdk_window_show (widget->window);
-
- children = menu_shell->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child) && !GTK_WIDGET_MAPPED (child))
- gtk_widget_map (child);
- }
-}
-
-static void
-gtk_menu_shell_realize (GtkWidget *widget)
-{
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU_SHELL (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget);
- attributes.event_mask |= (GDK_EXPOSURE_MASK |
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_ENTER_NOTIFY_MASK |
- GDK_LEAVE_NOTIFY_MASK);
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
-}
-
-static gint
-gtk_menu_shell_button_press (GtkWidget *widget,
- GdkEventButton *event)
-{
- GtkMenuShell *menu_shell;
- GtkWidget *menu_item;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_MENU_SHELL (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (event->type != GDK_BUTTON_PRESS)
- return FALSE;
-
- menu_shell = GTK_MENU_SHELL (widget);
-
- if (menu_shell->parent_menu_shell)
- {
- gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent*) event);
- }
- else if (!menu_shell->active || !menu_shell->button)
- {
- if (!menu_shell->active)
- {
- gtk_grab_add (GTK_WIDGET (widget));
- menu_shell->have_grab = TRUE;
- }
- menu_shell->active = TRUE;
-
- menu_item = gtk_get_event_widget ((GdkEvent*) event);
- if (menu_item && GTK_IS_MENU_ITEM (menu_item) &&
- gtk_menu_shell_is_item (menu_shell, menu_item))
- {
- if ((menu_item->parent == widget) &&
- (menu_item != menu_shell->active_menu_item))
- {
- if (menu_shell->active_menu_item)
- gtk_menu_item_deselect (GTK_MENU_ITEM (menu_shell->active_menu_item));
-
- menu_shell->active_menu_item = menu_item;
- gtk_menu_item_set_placement (GTK_MENU_ITEM (menu_shell->active_menu_item),
- MENU_SHELL_CLASS (menu_shell)->submenu_placement);
- gtk_menu_item_select (GTK_MENU_ITEM (menu_shell->active_menu_item));
- }
- }
- else if (!menu_shell->button)
- {
- gtk_menu_shell_deactivate (menu_shell);
- }
-
- if (menu_shell->active)
- menu_shell->button = event->button;
- }
- else
- {
- widget = gtk_get_event_widget ((GdkEvent*) event);
- if (widget == GTK_WIDGET (menu_shell))
- gtk_menu_shell_deactivate (menu_shell);
- }
-
- return TRUE;
-}
-
-static gint
-gtk_menu_shell_button_release (GtkWidget *widget,
- GdkEventButton *event)
-{
- GtkMenuShell *menu_shell;
- GtkWidget *menu_item;
- gint deactivate;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_MENU_SHELL (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- menu_shell = GTK_MENU_SHELL (widget);
- if (menu_shell->active)
- {
- if (menu_shell->button && (event->button != menu_shell->button))
- {
- menu_shell->button = 0;
- if (menu_shell->parent_menu_shell)
- gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent*) event);
- return TRUE;
- }
-
- menu_shell->button = 0;
- menu_item = gtk_get_event_widget ((GdkEvent*) event);
- deactivate = TRUE;
-
- if ((event->time - menu_shell->activate_time) > MENU_SHELL_TIMEOUT)
- {
- if (menu_shell->active_menu_item == menu_item)
- {
- if (GTK_MENU_ITEM (menu_item)->submenu == NULL)
- {
- gtk_menu_shell_deactivate (menu_shell);
- gtk_widget_activate (menu_item);
- return TRUE;
- }
- }
- else if (menu_shell->parent_menu_shell)
- {
- menu_shell->active = TRUE;
- gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent*) event);
- return TRUE;
- }
- }
- else
- deactivate = FALSE;
-
- if ((!deactivate || (menu_shell->active_menu_item == menu_item)) &&
- (gdk_pointer_grab (widget->window, TRUE,
- GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
- GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK,
- NULL, NULL, event->time) == 0))
- {
- deactivate = FALSE;
- menu_shell->have_xgrab = TRUE;
- menu_shell->ignore_leave = TRUE;
- }
- else
- deactivate = TRUE;
-
- if (deactivate)
- gtk_menu_shell_deactivate (menu_shell);
- }
-
- return TRUE;
-}
-
-static gint
-gtk_menu_shell_enter_notify (GtkWidget *widget,
- GdkEventCrossing *event)
-{
- GtkMenuShell *menu_shell;
- GtkWidget *menu_item;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_MENU_SHELL (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- menu_shell = GTK_MENU_SHELL (widget);
- if (menu_shell->active)
- {
- menu_item = gtk_get_event_widget ((GdkEvent*) event);
-
- if (!menu_item || !GTK_WIDGET_IS_SENSITIVE (menu_item))
- return TRUE;
-
- if ((menu_item->parent == widget) &&
- (menu_shell->active_menu_item != menu_item) &&
- GTK_IS_MENU_ITEM (menu_item))
- {
- if ((event->detail != GDK_NOTIFY_INFERIOR) &&
- (GTK_WIDGET_STATE (menu_item) != GTK_STATE_PRELIGHT))
- {
- if (menu_shell->active_menu_item)
- gtk_menu_item_deselect (GTK_MENU_ITEM (menu_shell->active_menu_item));
-
- menu_shell->active_menu_item = menu_item;
- gtk_menu_item_set_placement (GTK_MENU_ITEM (menu_shell->active_menu_item),
- MENU_SHELL_CLASS (menu_shell)->submenu_placement);
- gtk_menu_item_select (GTK_MENU_ITEM (menu_shell->active_menu_item));
- }
- }
- else if (menu_shell->parent_menu_shell)
- {
- gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent*) event);
- }
- }
-
- return TRUE;
-}
-
-static gint
-gtk_menu_shell_leave_notify (GtkWidget *widget,
- GdkEventCrossing *event)
-{
- GtkMenuShell *menu_shell;
- GtkMenuItem *menu_item;
- GtkWidget *event_widget;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_MENU_SHELL (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_VISIBLE (widget))
- {
- menu_shell = GTK_MENU_SHELL (widget);
- event_widget = gtk_get_event_widget ((GdkEvent*) event);
-
- if (!event_widget || !GTK_IS_MENU_ITEM (event_widget))
- return TRUE;
-
- menu_item = GTK_MENU_ITEM (event_widget);
-
- if (!GTK_WIDGET_IS_SENSITIVE (menu_item))
- return TRUE;
-
- if (menu_shell->ignore_leave)
- {
- menu_shell->ignore_leave = FALSE;
- return TRUE;
- }
-
- if ((menu_shell->active_menu_item == event_widget) &&
- (menu_item->submenu == NULL))
- {
- if ((event->detail != GDK_NOTIFY_INFERIOR) &&
- (GTK_WIDGET_STATE (menu_item) != GTK_STATE_NORMAL))
- {
- gtk_menu_item_deselect (GTK_MENU_ITEM (menu_shell->active_menu_item));
- menu_shell->active_menu_item = NULL;
- }
- }
- else if (menu_shell->parent_menu_shell)
- {
- gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent*) event);
- }
- }
-
- return TRUE;
-}
-
-static void
-gtk_menu_shell_add (GtkContainer *container,
- GtkWidget *widget)
-{
- gtk_menu_shell_append (GTK_MENU_SHELL (container), widget);
-}
-
-static void
-gtk_menu_shell_remove (GtkContainer *container,
- GtkWidget *widget)
-{
- GtkMenuShell *menu_shell;
- gint was_visible;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_MENU_SHELL (container));
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU_ITEM (widget));
-
- was_visible = GTK_WIDGET_VISIBLE (widget);
- menu_shell = GTK_MENU_SHELL (container);
- menu_shell->children = g_list_remove (menu_shell->children, widget);
-
- gtk_widget_unparent (widget);
-
- if (was_visible && GTK_WIDGET_VISIBLE (container))
- gtk_widget_queue_resize (GTK_WIDGET (container));
-}
-
-static void
-gtk_menu_shell_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
-{
- GtkMenuShell *menu_shell;
- GtkWidget *child;
- GList *children;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_MENU_SHELL (container));
- g_return_if_fail (callback != NULL);
-
- menu_shell = GTK_MENU_SHELL (container);
-
- children = menu_shell->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- (* callback) (child, callback_data);
- }
-}
-
-
-static void
-gtk_real_menu_shell_deactivate (GtkMenuShell *menu_shell)
-{
- g_return_if_fail (menu_shell != NULL);
- g_return_if_fail (GTK_IS_MENU_SHELL (menu_shell));
-
- if (menu_shell->active)
- {
- menu_shell->button = 0;
- menu_shell->active = FALSE;
-
- if (menu_shell->active_menu_item)
- {
- gtk_menu_item_deselect (GTK_MENU_ITEM (menu_shell->active_menu_item));
- menu_shell->active_menu_item = NULL;
- }
-
- if (menu_shell->have_grab)
- {
- menu_shell->have_grab = FALSE;
- gtk_grab_remove (GTK_WIDGET (menu_shell));
- }
- if (menu_shell->have_xgrab)
- {
- menu_shell->have_xgrab = FALSE;
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
- }
- }
-}
-
-static gint
-gtk_menu_shell_is_item (GtkMenuShell *menu_shell,
- GtkWidget *child)
-{
- GtkMenuShell *parent;
-
- g_return_val_if_fail (menu_shell != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_MENU_SHELL (menu_shell), FALSE);
- g_return_val_if_fail (child != NULL, FALSE);
-
- parent = GTK_MENU_SHELL (child->parent);
- while (parent && GTK_IS_MENU_SHELL (parent))
- {
- if (parent == menu_shell)
- return TRUE;
- parent = GTK_MENU_SHELL (parent->parent_menu_shell);
- }
-
- return FALSE;
-}
diff --git a/gtk/gtkmenushell.h b/gtk/gtkmenushell.h
deleted file mode 100644
index a468631ed2..0000000000
--- a/gtk/gtkmenushell.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_MENU_SHELL_H__
-#define __GTK_MENU_SHELL_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkcontainer.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_MENU_SHELL(obj) GTK_CHECK_CAST (obj, gtk_menu_shell_get_type (), GtkMenuShell)
-#define GTK_MENU_SHELL_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_menu_shell_get_type (), GtkMenuShellClass)
-#define GTK_IS_MENU_SHELL(obj) GTK_CHECK_TYPE (obj, gtk_menu_shell_get_type ())
-
-
-typedef struct _GtkMenuShell GtkMenuShell;
-typedef struct _GtkMenuShellClass GtkMenuShellClass;
-
-struct _GtkMenuShell
-{
- GtkContainer container;
-
- GList *children;
- GtkWidget *active_menu_item;
- GtkWidget *parent_menu_shell;
-
- guint active : 1;
- guint have_grab : 1;
- guint have_xgrab : 1;
- guint button : 2;
- guint ignore_leave : 1;
- guint menu_flag : 1;
-
- guint32 activate_time;
-};
-
-struct _GtkMenuShellClass
-{
- GtkContainerClass parent_class;
-
- guint submenu_placement : 1;
-
- void (*deactivate) (GtkMenuShell *menu_shell);
-};
-
-
-guint gtk_menu_shell_get_type (void);
-void gtk_menu_shell_append (GtkMenuShell *menu_shell,
- GtkWidget *child);
-void gtk_menu_shell_prepend (GtkMenuShell *menu_shell,
- GtkWidget *child);
-void gtk_menu_shell_insert (GtkMenuShell *menu_shell,
- GtkWidget *child,
- gint position);
-void gtk_menu_shell_deactivate (GtkMenuShell *menu_shell);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_MENU_SHELL_H__ */
diff --git a/gtk/gtkmisc.c b/gtk/gtkmisc.c
deleted file mode 100644
index 2791e69904..0000000000
--- a/gtk/gtkmisc.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkcontainer.h"
-#include "gtkmisc.h"
-
-
-static void gtk_misc_class_init (GtkMiscClass *klass);
-static void gtk_misc_init (GtkMisc *misc);
-static void gtk_misc_realize (GtkWidget *widget);
-
-
-guint
-gtk_misc_get_type ()
-{
- static guint misc_type = 0;
-
- if (!misc_type)
- {
- GtkTypeInfo misc_info =
- {
- "GtkMisc",
- sizeof (GtkMisc),
- sizeof (GtkMiscClass),
- (GtkClassInitFunc) gtk_misc_class_init,
- (GtkObjectInitFunc) gtk_misc_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- misc_type = gtk_type_unique (gtk_widget_get_type (), &misc_info);
- }
-
- return misc_type;
-}
-
-static void
-gtk_misc_class_init (GtkMiscClass *class)
-{
- GtkWidgetClass *widget_class;
-
- widget_class = (GtkWidgetClass*) class;
-
- widget_class->realize = gtk_misc_realize;
-}
-
-static void
-gtk_misc_init (GtkMisc *misc)
-{
- GTK_WIDGET_SET_FLAGS (misc, GTK_BASIC);
-
- misc->xalign = 0.5;
- misc->yalign = 0.5;
- misc->xpad = 0;
- misc->ypad = 0;
-}
-
-void
-gtk_misc_set_alignment (GtkMisc *misc,
- gfloat xalign,
- gfloat yalign)
-{
- g_return_if_fail (misc != NULL);
- g_return_if_fail (GTK_IS_MISC (misc));
-
- if (xalign < 0.0)
- xalign = 0.0;
- else if (xalign > 1.0)
- xalign = 1.0;
-
- if (yalign < 0.0)
- yalign = 0.0;
- else if (yalign > 1.0)
- yalign = 1.0;
-
- if ((xalign != misc->xalign) || (yalign != misc->yalign))
- {
- misc->xalign = xalign;
- misc->yalign = yalign;
-
- /* clear the area that was allocated before the change
- */
- if (GTK_WIDGET_VISIBLE (misc))
- {
- GtkWidget *widget;
-
- widget = GTK_WIDGET (misc);
- gdk_window_clear_area (widget->window,
- widget->allocation.x,
- widget->allocation.y,
- widget->allocation.width,
- widget->allocation.height);
- }
-
- gtk_widget_queue_draw (GTK_WIDGET (misc));
- }
-}
-
-void
-gtk_misc_set_padding (GtkMisc *misc,
- gint xpad,
- gint ypad)
-{
- GtkRequisition *requisition;
-
- g_return_if_fail (misc != NULL);
- g_return_if_fail (GTK_IS_MISC (misc));
-
- if (xpad < 0)
- xpad = 0;
- if (ypad < 0)
- ypad = 0;
-
- if ((xpad != misc->xpad) || (ypad != misc->ypad))
- {
- requisition = &(GTK_WIDGET (misc)->requisition);
- requisition->width -= misc->xpad * 2;
- requisition->height -= misc->ypad * 2;
-
- misc->xpad = xpad;
- misc->ypad = ypad;
-
- requisition->width += misc->xpad * 2;
- requisition->height += misc->ypad * 2;
-
- if (GTK_WIDGET (misc)->parent && GTK_WIDGET_VISIBLE (misc))
- gtk_widget_queue_resize (GTK_WIDGET (misc));
- }
-}
-
-static void
-gtk_misc_realize (GtkWidget *widget)
-{
- GtkMisc *misc;
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MISC (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
- misc = GTK_MISC (widget);
-
- if (GTK_WIDGET_NO_WINDOW (widget))
- {
- widget->window = gtk_widget_get_parent_window (widget);
- gdk_window_ref (widget->window);
- widget->style = gtk_style_attach (widget->style, widget->window);
- }
- else
- {
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
- gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
- }
-}
diff --git a/gtk/gtkmisc.h b/gtk/gtkmisc.h
deleted file mode 100644
index 1bc9cbb93e..0000000000
--- a/gtk/gtkmisc.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_MISC_H__
-#define __GTK_MISC_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkwidget.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_MISC(obj) GTK_CHECK_CAST (obj, gtk_misc_get_type (), GtkMisc)
-#define GTK_MISC_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_misc_get_type (), GtkMiscClass)
-#define GTK_IS_MISC(obj) GTK_CHECK_TYPE (obj, gtk_misc_get_type ())
-
-
-typedef struct _GtkMisc GtkMisc;
-typedef struct _GtkMiscClass GtkMiscClass;
-
-struct _GtkMisc
-{
- GtkWidget widget;
-
- gfloat xalign;
- gfloat yalign;
-
- guint16 xpad;
- guint16 ypad;
-};
-
-struct _GtkMiscClass
-{
- GtkWidgetClass parent_class;
-};
-
-
-guint gtk_misc_get_type (void);
-void gtk_misc_set_alignment (GtkMisc *misc,
- gfloat xalign,
- gfloat yalign);
-void gtk_misc_set_padding (GtkMisc *misc,
- gint xpad,
- gint ypad);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_LABEL_H__ */
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
deleted file mode 100644
index e622069553..0000000000
--- a/gtk/gtknotebook.c
+++ /dev/null
@@ -1,2952 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtknotebook.h"
-#include "gtksignal.h"
-#include "gtkmain.h"
-#include "gtkmenu.h"
-#include "gtkmenuitem.h"
-#include "gtklabel.h"
-#include <gdk/gdkkeysyms.h>
-#include <stdio.h>
-
-
-#define TAB_OVERLAP 2
-#define TAB_CURVATURE 1
-#define ARROW_SIZE 11
-#define ARROW_SPACING 3
-#define NOTEBOOK_INIT_SCROLL_DELAY (200)
-#define NOTEBOOK_SCROLL_DELAY (100)
-
-
-enum {
- SWITCH_PAGE,
- LAST_SIGNAL
-};
-
-enum {
- STEP_PREV,
- STEP_NEXT
-};
-
-typedef void (*GtkNotebookSignal) (GtkObject *object,
- GtkNotebookPage *arg1,
- gint arg2,
- gpointer data);
-
-static void gtk_notebook_class_init (GtkNotebookClass *klass);
-static void gtk_notebook_init (GtkNotebook *notebook);
-static void gtk_notebook_destroy (GtkObject *object);
-static void gtk_notebook_map (GtkWidget *widget);
-static void gtk_notebook_unmap (GtkWidget *widget);
-static void gtk_notebook_realize (GtkWidget *widget);
-static void gtk_notebook_panel_realize (GtkNotebook *notebook);
-static void gtk_notebook_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_notebook_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_notebook_paint (GtkWidget *widget,
- GdkRectangle *area);
-static void gtk_notebook_draw (GtkWidget *widget,
- GdkRectangle *area);
-static gint gtk_notebook_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static gint gtk_notebook_button_press (GtkWidget *widget,
- GdkEventButton *event);
-static gint gtk_notebook_button_release (GtkWidget *widget,
- GdkEventButton *event);
-static gint gtk_notebook_enter_notify (GtkWidget *widget,
- GdkEventCrossing *event);
-static gint gtk_notebook_leave_notify (GtkWidget *widget,
- GdkEventCrossing *event);
-static gint gtk_notebook_motion_notify (GtkWidget *widget,
- GdkEventMotion *event);
-static gint gtk_notebook_key_press (GtkWidget *widget,
- GdkEventKey *event);
-static void gtk_notebook_add (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_notebook_remove (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_notebook_real_remove (GtkNotebook *notebook,
- GList *list,
- gint page_num);
-static void gtk_notebook_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data);
-static void gtk_notebook_switch_page (GtkNotebook *notebook,
- GtkNotebookPage *page,
- gint page_num);
-static void gtk_notebook_draw_tab (GtkNotebook *notebook,
- GtkNotebookPage *page,
- GdkRectangle *area);
-static gint gtk_notebook_focus_in (GtkWidget *widget,
- GdkEventFocus *event);
-static gint gtk_notebook_focus_out (GtkWidget *widget,
- GdkEventFocus *event);
-static void gtk_notebook_draw_focus (GtkWidget *widget);
-static void gtk_notebook_focus_changed (GtkNotebook *notebook,
- GtkNotebookPage *old_page);
-static void gtk_notebook_pages_allocate (GtkNotebook *notebook,
- GtkAllocation *allocation);
-static void gtk_notebook_page_allocate (GtkNotebook *notebook,
- GtkNotebookPage *page,
- GtkAllocation *allocation);
-static void gtk_notebook_draw_arrow (GtkNotebook *notebook,
- guint arrow);
-static gint gtk_notebook_timer (GtkNotebook *notebook);
-static gint gtk_notebook_focus (GtkContainer *container,
- GtkDirectionType direction);
-static gint gtk_notebook_page_select (GtkNotebook *notebook);
-static void gtk_notebook_calc_tabs (GtkNotebook *notebook,
- GList *start,
- GList **end,
- gint *tab_space,
- guint direction);
-static void gtk_notebook_expose_tabs (GtkNotebook *notebook);
-static void gtk_notebook_switch_focus_tab (GtkNotebook *notebook,
- GList *new_child);
-static void gtk_real_notebook_switch_page (GtkNotebook *notebook,
- GtkNotebookPage *page);
-static void gtk_notebook_marshal_signal (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-static void gtk_notebook_menu_switch_page (GtkWidget *widget,
- GtkNotebookPage *page);
-static void gtk_notebook_update_labels (GtkNotebook *notebook,
- GList *list,
- gint page_num);
-static void gtk_notebook_menu_detacher (GtkWidget *widget,
- GtkMenu *menu);
-static void gtk_notebook_menu_label_unparent (GtkWidget *widget,
- gpointer data);
-static void gtk_notebook_menu_item_create (GtkNotebook *notebook,
- GtkNotebookPage *page,
- gint position);
-
-
-static GtkContainerClass *parent_class = NULL;
-static guint notebook_signals[LAST_SIGNAL] = { 0 };
-
-guint
-gtk_notebook_get_type ()
-{
- static guint notebook_type = 0;
-
- if (!notebook_type)
- {
- GtkTypeInfo notebook_info =
- {
- "GtkNotebook",
- sizeof (GtkNotebook),
- sizeof (GtkNotebookClass),
- (GtkClassInitFunc) gtk_notebook_class_init,
- (GtkObjectInitFunc) gtk_notebook_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- notebook_type = gtk_type_unique (gtk_container_get_type (), &notebook_info);
- }
-
- return notebook_type;
-}
-
-static void
-gtk_notebook_class_init (GtkNotebookClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GtkObjectClass*) class;
- widget_class = (GtkWidgetClass*) class;
- container_class = (GtkContainerClass*) class;
-
- parent_class = gtk_type_class (gtk_container_get_type ());
-
- notebook_signals[SWITCH_PAGE] =
- gtk_signal_new ("switch_page",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkNotebookClass, switch_page),
- gtk_notebook_marshal_signal,
- GTK_TYPE_NONE, 2,
- GTK_TYPE_POINTER,
- GTK_TYPE_INT);
-
- gtk_object_class_add_signals (object_class, notebook_signals, LAST_SIGNAL);
-
- object_class->destroy = gtk_notebook_destroy;
-
- widget_class->map = gtk_notebook_map;
- widget_class->unmap = gtk_notebook_unmap;
- widget_class->realize = gtk_notebook_realize;
- widget_class->size_request = gtk_notebook_size_request;
- widget_class->size_allocate = gtk_notebook_size_allocate;
- widget_class->draw = gtk_notebook_draw;
- widget_class->expose_event = gtk_notebook_expose;
- widget_class->button_press_event = gtk_notebook_button_press;
- widget_class->button_release_event = gtk_notebook_button_release;
- widget_class->enter_notify_event = gtk_notebook_enter_notify;
- widget_class->leave_notify_event = gtk_notebook_leave_notify;
- widget_class->motion_notify_event = gtk_notebook_motion_notify;
- widget_class->key_press_event = gtk_notebook_key_press;
- widget_class->focus_in_event = gtk_notebook_focus_in;
- widget_class->focus_out_event = gtk_notebook_focus_out;
- widget_class->draw_focus = gtk_notebook_draw_focus;
-
- container_class->add = gtk_notebook_add;
- container_class->remove = gtk_notebook_remove;
- container_class->foreach = gtk_notebook_foreach;
- container_class->focus = gtk_notebook_focus;
-
- class->switch_page = gtk_real_notebook_switch_page;
-}
-
-static void
-gtk_notebook_init (GtkNotebook *notebook)
-{
- GTK_WIDGET_SET_FLAGS (notebook, GTK_CAN_FOCUS);
-
- notebook->cur_page = NULL;
- notebook->children = NULL;
- notebook->first_tab = NULL;
- notebook->focus_tab = NULL;
- notebook->panel = NULL;
- notebook->menu = NULL;
-
- notebook->tab_border = 3;
- notebook->show_tabs = TRUE;
- notebook->show_border = TRUE;
- notebook->tab_pos = GTK_POS_TOP;
- notebook->scrollable = FALSE;
- notebook->in_child = 0;
- notebook->click_child = 0;
- notebook->button = 0;
- notebook->need_timer = 0;
-}
-
-GtkWidget*
-gtk_notebook_new ()
-{
- return GTK_WIDGET (gtk_type_new (gtk_notebook_get_type ()));
-}
-
-static void
-gtk_notebook_destroy (GtkObject *object)
-{
- GtkNotebook *notebook;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (object));
-
- notebook = GTK_NOTEBOOK (object);
-
- if (notebook->menu)
- gtk_notebook_popup_disable (notebook);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-void
-gtk_notebook_append_page (GtkNotebook *notebook,
- GtkWidget *child,
- GtkWidget *tab_label)
-{
- g_return_if_fail (notebook != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
- g_return_if_fail (child != NULL);
-
- gtk_notebook_insert_page_menu (notebook, child, tab_label, NULL, -1);
-}
-
-void
-gtk_notebook_append_page_menu (GtkNotebook *notebook,
- GtkWidget *child,
- GtkWidget *tab_label,
- GtkWidget *menu_label)
-{
- g_return_if_fail (notebook != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
- g_return_if_fail (child != NULL);
-
- gtk_notebook_insert_page_menu (notebook, child, tab_label, menu_label, -1);
-}
-
-void
-gtk_notebook_prepend_page (GtkNotebook *notebook,
- GtkWidget *child,
- GtkWidget *tab_label)
-{
- g_return_if_fail (notebook != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
- g_return_if_fail (child != NULL);
-
- gtk_notebook_insert_page_menu (notebook, child, tab_label, NULL, 0);
-}
-
-void
-gtk_notebook_prepend_page_menu (GtkNotebook *notebook,
- GtkWidget *child,
- GtkWidget *tab_label,
- GtkWidget *menu_label)
-{
- g_return_if_fail (notebook != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
- g_return_if_fail (child != NULL);
-
- gtk_notebook_insert_page_menu (notebook, child, tab_label, menu_label, 0);
-}
-
-void
-gtk_notebook_insert_page (GtkNotebook *notebook,
- GtkWidget *child,
- GtkWidget *tab_label,
- gint position)
-{
- g_return_if_fail (notebook != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
- g_return_if_fail (child != NULL);
-
- gtk_notebook_insert_page_menu (notebook, child, tab_label, NULL, position);
-}
-
-void
-gtk_notebook_insert_page_menu (GtkNotebook *notebook,
- GtkWidget *child,
- GtkWidget *tab_label,
- GtkWidget *menu_label,
- gint position)
-{
- GtkNotebookPage *page;
- gint nchildren;
-
- g_return_if_fail (notebook != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
- g_return_if_fail (child != NULL);
-
- page = g_new (GtkNotebookPage, 1);
- page->child = child;
- page->requisition.width = 0;
- page->requisition.height = 0;
- page->allocation.x = 0;
- page->allocation.y = 0;
- page->allocation.width = 0;
- page->allocation.height = 0;
- page->default_menu = FALSE;
- page->default_tab = FALSE;
-
- nchildren = g_list_length (notebook->children);
- if ((position < 0) || (position > nchildren))
- position = nchildren;
-
- notebook->children = g_list_insert (notebook->children, page, position);
-
- if (!tab_label)
- {
- tab_label = gtk_label_new ("");
- page->default_tab = TRUE;
- }
- page->tab_label = tab_label;
- page->menu_label = menu_label;
-
- if (!menu_label)
- page->default_menu = TRUE;
- else
- {
- gtk_widget_ref (page->menu_label);
- gtk_object_sink (GTK_OBJECT(page->menu_label));
- }
-
- if (notebook->menu)
- gtk_notebook_menu_item_create (notebook, page, position);
-
- gtk_notebook_update_labels
- (notebook, g_list_nth (notebook->children, position), position + 1);
-
- if (!notebook->first_tab)
- notebook->first_tab = notebook->children;
-
- if (!notebook->focus_tab)
- notebook->focus_tab = notebook->children;
-
- gtk_widget_set_parent (child, GTK_WIDGET (notebook));
- gtk_widget_set_parent (tab_label, GTK_WIDGET (notebook));
- gtk_widget_show (tab_label);
-
- if (!notebook->cur_page)
- gtk_notebook_switch_page (notebook, page, 0);
-
- if (GTK_WIDGET_VISIBLE (notebook))
- {
- if (GTK_WIDGET_REALIZED (notebook) &&
- !GTK_WIDGET_REALIZED (child))
- gtk_widget_realize (child);
-
- if (GTK_WIDGET_MAPPED (notebook) &&
- !GTK_WIDGET_MAPPED (child) && notebook->cur_page == page)
- gtk_widget_map (child);
-
- if (GTK_WIDGET_REALIZED (notebook) &&
- !GTK_WIDGET_REALIZED (tab_label))
- gtk_widget_realize (tab_label);
-
- if (GTK_WIDGET_MAPPED (notebook) &&
- !GTK_WIDGET_MAPPED (tab_label))
- gtk_widget_map (tab_label);
- }
-
- if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (notebook))
- gtk_widget_queue_resize (child);
-}
-
-void
-gtk_notebook_remove_page (GtkNotebook *notebook,
- gint page_num)
-{
- GList *list;
-
- g_return_if_fail (notebook != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
-
- if ((list = g_list_nth (notebook->children, page_num)))
- gtk_notebook_real_remove (notebook, list, page_num);
-}
-
-static void
-gtk_notebook_add (GtkContainer *container,
- GtkWidget *widget)
-{
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (container));
- g_return_if_fail (widget != NULL);
-
- gtk_notebook_insert_page_menu (GTK_NOTEBOOK (container), widget,
- NULL, NULL, -1);
-}
-
-static void
-gtk_notebook_remove (GtkContainer *container,
- GtkWidget *widget)
-{
- GtkNotebook *notebook;
- GtkNotebookPage *page;
- GList *children;
- gint page_num;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (container));
- g_return_if_fail (widget != NULL);
-
- notebook = GTK_NOTEBOOK (container);
-
- children = notebook->children;
- page_num = 0;
- while (children)
- {
- page = children->data;
- if (page->child == widget)
- {
- gtk_notebook_real_remove (notebook, children, page_num);
- break;
- }
- page_num++;
- children = children->next;
- }
-}
-
-static void
-gtk_notebook_real_remove (GtkNotebook *notebook,
- GList *list,
- gint page_num)
-{
- GtkNotebookPage *page;
- GList * next_list;
- gint need_resize = FALSE;
-
- if (list->prev)
- {
- next_list = list->prev;
- page_num--;
- }
- else if (list->next)
- {
- next_list = list->next;
- page_num++;
- }
- else
- next_list = NULL;
-
- if (notebook->cur_page == list->data)
- {
- notebook->cur_page = NULL;
- if (next_list)
- {
- page = next_list->data;
- gtk_notebook_switch_page (notebook, page, page_num);
- }
- }
-
- if (list == notebook->first_tab)
- notebook->first_tab = next_list;
- if (list == notebook->focus_tab)
- notebook->focus_tab = next_list;
-
- page = list->data;
-
- if ((GTK_WIDGET_VISIBLE (page->child) ||
- GTK_WIDGET_VISIBLE (page->tab_label)) && GTK_WIDGET_VISIBLE (notebook))
- need_resize = TRUE;
-
- gtk_widget_unparent (page->child);
- gtk_widget_unparent (page->tab_label);
-
- if (notebook->menu)
- {
- gtk_container_remove (GTK_CONTAINER (notebook->menu),
- page->menu_label->parent);
- gtk_widget_queue_resize (notebook->menu);
- }
- if (!page->default_menu)
- gtk_widget_unref (page->menu_label);
-
- gtk_notebook_update_labels (notebook, list->next, page_num + 1);
-
- notebook->children = g_list_remove_link (notebook->children, list);
- g_list_free (list);
- g_free (page);
-
- if (need_resize)
- gtk_widget_queue_resize (GTK_WIDGET (notebook));
-
-}
-
-gint
-gtk_notebook_current_page (GtkNotebook *notebook)
-{
- GList *children;
- gint cur_page;
-
- g_return_val_if_fail (notebook != NULL, -1);
- g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), -1);
-
- if (notebook->cur_page)
- {
- cur_page = 0;
- children = notebook->children;
-
- while (children)
- {
- if (children->data == notebook->cur_page)
- break;
- children = children->next;
- cur_page += 1;
- }
-
- if (!children)
- cur_page = -1;
- }
- else
- {
- cur_page = -1;
- }
-
- return cur_page;
-}
-
-void
-gtk_notebook_set_page (GtkNotebook *notebook,
- gint page_num)
-{
- GList *list;
-
- g_return_if_fail (notebook != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
-
- if ((list = g_list_nth (notebook->children, page_num)))
- gtk_notebook_switch_page (notebook,
- ((GtkNotebookPage *)(list->data)), page_num);
-}
-
-void
-gtk_notebook_next_page (GtkNotebook *notebook)
-{
- GtkNotebookPage *page;
- GList *children;
- gint num;
-
- g_return_if_fail (notebook != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
-
- children = notebook->children;
- num = 0;
- while (children)
- {
- if (notebook->cur_page == children->data)
- break;
- children = children->next;
- num++;
- }
-
- if (!children)
- return;
-
- if (children->next)
- {
- children = children->next;
- num++;
- }
- else
- {
- children = notebook->children;
- num = 0;
- }
-
- page = children->data;
- gtk_notebook_switch_page (notebook, page, num);
-}
-
-void
-gtk_notebook_prev_page (GtkNotebook *notebook)
-{
- GtkNotebookPage *page;
- GList *children;
- gint num;
-
- g_return_if_fail (notebook != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
-
- children = notebook->children;
- num = 0;
- while (children)
- {
- if (notebook->cur_page == children->data)
- break;
- children = children->next;
- num++;
- }
-
- if (!children)
- return;
-
- if (children->prev)
- {
- children = children->prev;
- num--;
- }
- else
- {
- while (children->next)
- {
- children = children->next;
- num++;
- }
- }
-
- page = children->data;
- gtk_notebook_switch_page (notebook, page, num);
-}
-
-static void
-gtk_notebook_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
-{
- GtkNotebook *notebook;
- GtkNotebookPage *page;
- GList *children;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (container));
- g_return_if_fail (callback != NULL);
-
- notebook = GTK_NOTEBOOK (container);
-
- children = notebook->children;
- while (children)
- {
- page = children->data;
- children = children->next;
- (* callback) (page->child, callback_data);
- }
-}
-
-static void
-gtk_notebook_expose_tabs (GtkNotebook *notebook)
-{
- GtkWidget *widget;
- GtkNotebookPage *page;
- GdkEventExpose event;
- gint border;
-
- widget = GTK_WIDGET (notebook);
- border = GTK_CONTAINER (notebook)->border_width;
-
- page = notebook->first_tab->data;
-
- event.type = GDK_EXPOSE;
- event.window = widget->window;
- event.count = 0;
- event.area.x = border;
- event.area.y = border;
-
- switch (notebook->tab_pos)
- {
- case GTK_POS_BOTTOM:
- event.area.y = widget->allocation.height - border
- - page->allocation.height - widget->style->klass->ythickness;
- if (notebook->first_tab->data != notebook->cur_page)
- event.area.y -= widget->style->klass->ythickness;
- case GTK_POS_TOP:
- event.area.width = widget->allocation.width - 2 * border;
- event.area.height = page->allocation.height
- + widget->style->klass->ythickness;
- if (notebook->first_tab->data != notebook->cur_page)
- event.area.height += widget->style->klass->ythickness;
- break;
- case GTK_POS_RIGHT:
- event.area.x = widget->allocation.width - border
- - page->allocation.width - widget->style->klass->xthickness;
- if (notebook->first_tab->data != notebook->cur_page)
- event.area.x -= widget->style->klass->xthickness;
- case GTK_POS_LEFT:
- event.area.width = page->allocation.width
- + widget->style->klass->xthickness;
- event.area.height = widget->allocation.height - 2 * border;
- if (notebook->first_tab->data != notebook->cur_page)
- event.area.width += widget->style->klass->xthickness;
- break;
- }
- gtk_widget_event (widget, (GdkEvent *) &event);
-}
-
-void
-gtk_notebook_set_tab_pos (GtkNotebook *notebook,
- GtkPositionType pos)
-{
- g_return_if_fail (notebook != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
-
- if (notebook->tab_pos != pos)
- {
- notebook->tab_pos = pos;
-
- if (GTK_WIDGET_VISIBLE (notebook))
- {
- gtk_widget_queue_resize (GTK_WIDGET (notebook));
- if (notebook->panel)
- gdk_window_clear (notebook->panel);
- }
- }
-}
-
-void
-gtk_notebook_set_show_tabs (GtkNotebook *notebook,
- gint show_tabs)
-{
- GtkNotebookPage *page;
- GList *children;
-
- g_return_if_fail (notebook != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
-
- if (notebook->show_tabs == show_tabs || !GTK_WIDGET_VISIBLE (notebook))
- return;
-
- notebook->show_tabs = show_tabs;
- children = notebook->children;
-
- if (!show_tabs)
- {
- GTK_WIDGET_UNSET_FLAGS (notebook, GTK_CAN_FOCUS);
-
- while (children)
- {
- page = children->data;
- children = children->next;
- gtk_widget_hide (page->tab_label);
- }
-
- if (notebook->panel)
- gdk_window_hide (notebook->panel);
- }
- else
- {
- GTK_WIDGET_SET_FLAGS (notebook, GTK_CAN_FOCUS);
-
- while (children)
- {
- page = children->data;
- children = children->next;
- gtk_widget_show (page->tab_label);
- }
- }
- gtk_widget_queue_resize (GTK_WIDGET (notebook));
-}
-
-void
-gtk_notebook_set_show_border (GtkNotebook *notebook,
- gint show_border)
-{
- g_return_if_fail (notebook != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
-
- if (notebook->show_border != show_border)
- {
- notebook->show_border = show_border;
-
- if (GTK_WIDGET_VISIBLE (notebook))
- gtk_widget_queue_resize (GTK_WIDGET (notebook));
- }
-}
-
-void
-gtk_notebook_set_scrollable (GtkNotebook *notebook,
- gint scrollable)
-{
- g_return_if_fail (notebook != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
-
- if (scrollable != notebook->scrollable)
- {
- if ( (notebook->scrollable = (scrollable != 0)) )
- gtk_notebook_panel_realize (notebook);
- else if (notebook->panel)
- {
- gdk_window_destroy (notebook->panel);
- notebook->panel = NULL;
- }
- gtk_widget_queue_resize (GTK_WIDGET(notebook));
- }
-}
-
-static void
-gtk_notebook_map (GtkWidget *widget)
-{
- GtkNotebook *notebook;
- GtkNotebookPage *page;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
- gdk_window_show (widget->window);
-
- notebook = GTK_NOTEBOOK (widget);
-
- if (notebook->cur_page &&
- GTK_WIDGET_VISIBLE (notebook->cur_page->child) &&
- !GTK_WIDGET_MAPPED (notebook->cur_page->child))
- gtk_widget_map (notebook->cur_page->child);
-
- if (notebook->scrollable)
- gtk_notebook_pages_allocate (notebook, &(widget->allocation));
- else
- {
- children = notebook->children;
-
- while (children)
- {
- page = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (page->child) &&
- !GTK_WIDGET_MAPPED (page->tab_label))
- gtk_widget_map (page->tab_label);
- }
- }
-}
-
-static void
-gtk_notebook_unmap (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (widget));
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
- gdk_window_hide (widget->window);
- if (GTK_NOTEBOOK(widget)->panel)
- gdk_window_hide (GTK_NOTEBOOK(widget)->panel);
-}
-
-static void
-gtk_notebook_realize (GtkWidget *widget)
-{
- GtkNotebook *notebook;
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (widget));
-
- notebook = GTK_NOTEBOOK (widget);
- GTK_WIDGET_SET_FLAGS (notebook, GTK_REALIZED);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget);
- attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK
- | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK;
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, notebook);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
-
- if (notebook->scrollable)
- gtk_notebook_panel_realize (notebook);
-}
-
-static void
-gtk_notebook_panel_realize (GtkNotebook *notebook)
-{
- GtkWidget *widget;
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- g_return_if_fail (notebook != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
-
- widget = GTK_WIDGET (notebook);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget);
- attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK
- | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_ENTER_NOTIFY_MASK
- | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK;
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- attributes.width = 2 * ARROW_SIZE + ARROW_SPACING;
- attributes.height = ARROW_SIZE;
-
- attributes.x = widget->allocation.width - attributes.width -
- GTK_CONTAINER (notebook)->border_width;
- attributes.y = widget->allocation.height - ARROW_SIZE -
- GTK_CONTAINER (notebook)->border_width;
- if (notebook->tab_pos == GTK_POS_TOP)
- attributes.y = GTK_CONTAINER (notebook)->border_width;
- else if (notebook->tab_pos == GTK_POS_LEFT)
- attributes.x = widget->allocation.x
- + GTK_CONTAINER (notebook)->border_width;
-
-
- notebook->panel = gdk_window_new (widget->window, &attributes,
- attributes_mask);
- gtk_style_set_background (widget->style, notebook->panel,
- GTK_STATE_NORMAL);
- gdk_window_set_user_data (notebook->panel, widget);
-}
-
-static void
-gtk_notebook_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkNotebook *notebook;
- GtkNotebookPage *page;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (widget));
- g_return_if_fail (requisition != NULL);
-
- notebook = GTK_NOTEBOOK (widget);
- widget->requisition.width = 0;
- widget->requisition.height = 0;
-
- children = notebook->children;
- while (children)
- {
- page = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (page->child))
- {
- gtk_widget_size_request (page->child, &page->child->requisition);
-
- widget->requisition.width = MAX (widget->requisition.width,
- page->child->requisition.width);
- widget->requisition.height = MAX (widget->requisition.height,
- page->child->requisition.height);
- }
- }
-
- if (notebook->show_border || notebook->show_tabs)
- {
- widget->requisition.width += widget->style->klass->xthickness * 2;
- widget->requisition.height += widget->style->klass->ythickness * 2;
-
- if (notebook->show_tabs)
- {
- gint tab_width = 0;
- gint tab_height = 0;
- gint tab_max = 0;
-
- children = notebook->children;
- while (children)
- {
- page = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (page->child))
- {
- gtk_widget_size_request (page->tab_label,
- &page->tab_label->requisition);
-
- page->requisition.width =
- (page->tab_label->requisition.width +
- (widget->style->klass->xthickness + notebook->tab_border)
- * 2);
- page->requisition.height =
- (page->tab_label->requisition.height +
- (widget->style->klass->ythickness + notebook->tab_border)
- * 2);
-
- switch (notebook->tab_pos)
- {
- case GTK_POS_TOP:
- case GTK_POS_BOTTOM:
- page->requisition.width -= TAB_OVERLAP;
-
- tab_width += page->requisition.width;
- tab_height = MAX (tab_height, page->requisition.height);
- tab_max = MAX (tab_max, page->requisition.width);
- break;
- case GTK_POS_LEFT:
- case GTK_POS_RIGHT:
- page->requisition.height -= TAB_OVERLAP;
-
- tab_width = MAX (tab_width, page->requisition.width);
- tab_height += page->requisition.height;
- tab_max = MAX (tab_max, page->requisition.height);
- break;
- }
- }
- }
-
- children = notebook->children;
-
- if (children && children->next && notebook->scrollable)
- {
- if ((notebook->tab_pos == GTK_POS_TOP) ||
- (notebook->tab_pos == GTK_POS_BOTTOM))
- {
- if (widget->requisition.width < tab_width)
- {
- tab_width = tab_max + 2 * (ARROW_SIZE + ARROW_SPACING);
- tab_height = MAX (tab_height, ARROW_SIZE);
- }
- }
- else
- {
- if (widget->requisition.height < tab_height)
- {
- tab_height = tab_max + ARROW_SIZE + ARROW_SPACING;
- tab_width = MAX (tab_width,
- ARROW_SPACING + 2 * ARROW_SIZE);
- }
- }
- }
-
- while (children)
- {
- page = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (page->child))
- {
- if ((notebook->tab_pos == GTK_POS_TOP) ||
- (notebook->tab_pos == GTK_POS_BOTTOM))
- page->requisition.height = tab_height;
- else
- page->requisition.width = tab_width;
- }
- }
-
- switch (notebook->tab_pos)
- {
- case GTK_POS_TOP:
- case GTK_POS_BOTTOM:
- tab_width += widget->style->klass->xthickness;
- widget->requisition.width = MAX (widget->requisition.width,
- tab_width);
- widget->requisition.height += tab_height;
- break;
- case GTK_POS_LEFT:
- case GTK_POS_RIGHT:
- tab_height += widget->style->klass->ythickness;
- widget->requisition.width += tab_width;
- widget->requisition.height = MAX (widget->requisition.height,
- tab_height);
- break;
- }
- }
- }
- widget->requisition.width += GTK_CONTAINER (widget)->border_width * 2;
- widget->requisition.height += GTK_CONTAINER (widget)->border_width * 2;
-}
-
-static void
-gtk_notebook_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkNotebook *notebook;
- GtkNotebookPage *page;
- GtkAllocation child_allocation;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (widget));
- g_return_if_fail (allocation != NULL);
-
- widget->allocation = *allocation;
- if (GTK_WIDGET_REALIZED (widget))
- gdk_window_move_resize (widget->window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
-
- notebook = GTK_NOTEBOOK (widget);
- if (notebook->children)
- {
- child_allocation.x = GTK_CONTAINER (widget)->border_width;
- child_allocation.y = GTK_CONTAINER (widget)->border_width;
- child_allocation.width = allocation->width - child_allocation.x * 2;
- child_allocation.height = allocation->height - child_allocation.y * 2;
-
- if (notebook->show_tabs || notebook->show_border)
- {
- child_allocation.x += widget->style->klass->xthickness;
- child_allocation.y += widget->style->klass->ythickness;
- child_allocation.width -= widget->style->klass->xthickness * 2;
- child_allocation.height -= widget->style->klass->ythickness * 2;
-
- if (notebook->show_tabs && notebook->children)
- {
- switch (notebook->tab_pos)
- {
- case GTK_POS_TOP:
- child_allocation.y += notebook->cur_page->requisition.height;
- case GTK_POS_BOTTOM:
- child_allocation.height -= notebook->cur_page->requisition.height;
- break;
- case GTK_POS_LEFT:
- child_allocation.x += notebook->cur_page->requisition.width;
- case GTK_POS_RIGHT:
- child_allocation.width -= notebook->cur_page->requisition.width;
- break;
- }
- }
- }
-
- children = notebook->children;
- while (children)
- {
- page = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (page->child))
- gtk_widget_size_allocate (page->child, &child_allocation);
- }
-
- gtk_notebook_pages_allocate (notebook, allocation);
- }
-}
-
-static void
-gtk_notebook_paint (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkNotebook *notebook;
- GtkNotebookPage *page;
- GList *children;
- GdkPoint points[6];
- gint width, height;
- gint x, y;
- gint showarrow;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (widget));
- g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- notebook = GTK_NOTEBOOK (widget);
-
- gdk_window_clear_area (widget->window,
- area->x, area->y,
- area->width, area->height);
-
- if (notebook->show_tabs || notebook->show_border)
- {
- x = GTK_CONTAINER (widget)->border_width;
- y = GTK_CONTAINER (widget)->border_width;
- width = widget->allocation.width - x * 2;
- height = widget->allocation.height - y * 2;
-
- if (notebook->show_tabs && notebook->children)
- {
-
- if (!GTK_WIDGET_MAPPED (notebook->cur_page->tab_label))
- {
- GtkNotebookPage *page;
-
- page = notebook->first_tab->data;
-
- switch (notebook->tab_pos)
- {
- case GTK_POS_TOP:
- y += page->allocation.height +
- widget->style->klass->ythickness;
- case GTK_POS_BOTTOM:
- height -= page->allocation.height +
- widget->style->klass->ythickness;
- break;
- case GTK_POS_LEFT:
- x += page->allocation.width +
- widget->style->klass->xthickness;
- case GTK_POS_RIGHT:
- width -= page->allocation.width +
- widget->style->klass->xthickness;
- break;
- }
- gtk_draw_shadow (widget->style, widget->window,
- GTK_STATE_NORMAL, GTK_SHADOW_OUT,
- x, y, width, height);
- }
- else
- {
- switch (notebook->tab_pos)
- {
- case GTK_POS_TOP:
- y += notebook->cur_page->allocation.height;
- case GTK_POS_BOTTOM:
- height -= notebook->cur_page->allocation.height;
- break;
- case GTK_POS_LEFT:
- x += notebook->cur_page->allocation.width;
- case GTK_POS_RIGHT:
- width -= notebook->cur_page->allocation.width;
- break;
- }
-
- switch (notebook->tab_pos)
- {
- case GTK_POS_TOP:
- points[0].x = notebook->cur_page->allocation.x;
- points[0].y = y;
- points[1].x = x;
- points[1].y = y;
- points[2].x = x;
- points[2].y = y + height - 1;
- points[3].x = x + width - 1;
- points[3].y = y + height - 1;
- points[4].x = x + width - 1;
- points[4].y = y;
- points[5].x = (notebook->cur_page->allocation.x +
- notebook->cur_page->allocation.width -
- widget->style->klass->xthickness);
- points[5].y = y;
-
- if (points[5].x == (x + width))
- points[5].x -= 1;
- break;
- case GTK_POS_BOTTOM:
- points[0].x = (notebook->cur_page->allocation.x +
- notebook->cur_page->allocation.width -
- widget->style->klass->xthickness);
- points[0].y = y + height - 1;
- points[1].x = x + width - 1;
- points[1].y = y + height - 1;
- points[2].x = x + width - 1;
- points[2].y = y;
- points[3].x = x;
- points[3].y = y;
- points[4].x = x;
- points[4].y = y + height - 1;
- points[5].x = notebook->cur_page->allocation.x;
- points[5].y = y + height - 1;
-
- if (points[0].x == (x + width))
- points[0].x -= 1;
- break;
- case GTK_POS_LEFT:
- points[0].x = x;
- points[0].y = (notebook->cur_page->allocation.y +
- notebook->cur_page->allocation.height -
- widget->style->klass->ythickness);
- points[1].x = x;
- points[1].y = y + height - 1;
- points[2].x = x + width - 1;
- points[2].y = y + height - 1;
- points[3].x = x + width - 1;
- points[3].y = y;
- points[4].x = x;
- points[4].y = y;
- points[5].x = x;
- points[5].y = notebook->cur_page->allocation.y;
-
- if (points[0].y == (y + height))
- points[0].y -= 1;
- break;
- case GTK_POS_RIGHT:
- points[0].x = x + width - 1;
- points[0].y = notebook->cur_page->allocation.y;
- points[1].x = x + width - 1;
- points[1].y = y;
- points[2].x = x;
- points[2].y = y;
- points[3].x = x;
- points[3].y = y + height - 1;
- points[4].x = x + width - 1;
- points[4].y = y + height - 1;
- points[5].x = x + width - 1;
- points[5].y = (notebook->cur_page->allocation.y +
- notebook->cur_page->allocation.height -
- widget->style->klass->ythickness);
-
- if (points[5].y == (y + height))
- points[5].y -= 1;
- break;
- }
-
- gtk_draw_polygon (widget->style, widget->window,
- GTK_STATE_NORMAL, GTK_SHADOW_OUT,
- points, 6, FALSE);
- }
- children = g_list_last (notebook->children);
- showarrow = FALSE;
-
- while (children)
- {
- page = children->data;
- children = children->prev;
-
- if (!GTK_WIDGET_MAPPED (page->tab_label))
- showarrow = TRUE;
- else if (notebook->cur_page != page)
- gtk_notebook_draw_tab (notebook, page, area);
- }
-
- if (showarrow && notebook->scrollable && notebook->show_tabs)
- {
- gtk_notebook_draw_arrow (notebook, GTK_ARROW_LEFT);
- gtk_notebook_draw_arrow (notebook, GTK_ARROW_RIGHT);
- }
- if (notebook->cur_page &&
- GTK_WIDGET_MAPPED(((GtkNotebookPage *)
- (notebook->cur_page))->tab_label))
- gtk_notebook_draw_tab (notebook, notebook->cur_page, area);
- }
- else if (notebook->show_border)
- {
- gtk_draw_shadow (widget->style, widget->window,
- GTK_STATE_NORMAL, GTK_SHADOW_OUT,
- x, y, width, height);
- }
- }
- }
-}
-
-static void
-gtk_notebook_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkNotebook *notebook;
- GdkRectangle child_area;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (widget));
- g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- notebook = GTK_NOTEBOOK (widget);
-
- gtk_notebook_paint (widget, area);
- gtk_widget_draw_focus (widget);
-
- if (notebook->cur_page &&
- gtk_widget_intersect (notebook->cur_page->child, area, &child_area))
- gtk_widget_draw (notebook->cur_page->child, &child_area);
- }
-}
-
-static gint
-gtk_notebook_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkNotebook *notebook;
- GdkEventExpose child_event;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_NOTEBOOK (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- notebook = GTK_NOTEBOOK (widget);
-
- gtk_notebook_paint (widget, &event->area);
- gtk_widget_draw_focus (widget);
-
- child_event = *event;
- if (notebook->cur_page &&
- GTK_WIDGET_NO_WINDOW (notebook->cur_page->child) &&
- gtk_widget_intersect (notebook->cur_page->child, &event->area,
- &child_event.area))
- gtk_widget_event (notebook->cur_page->child, (GdkEvent*) &child_event);
- }
-
- return FALSE;
-}
-
-static gint
-gtk_notebook_button_press (GtkWidget *widget,
- GdkEventButton *event)
-{
- GtkNotebook *notebook;
- GtkNotebookPage *page;
- GList *children;
- gint num;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_NOTEBOOK (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- notebook = GTK_NOTEBOOK (widget);
-
- if (event->type != GDK_BUTTON_PRESS || !notebook->children
- || notebook->button)
- return FALSE;
-
- if (!GTK_WIDGET_HAS_FOCUS (widget) && !(GTK_CONTAINER (widget)->focus_child))
- gtk_widget_grab_focus (widget);
-
- if (event->window == notebook->panel)
- {
- if (!GTK_WIDGET_HAS_FOCUS (widget))
- {
- GTK_CONTAINER (widget)->focus_child = NULL;
- gtk_widget_grab_focus (widget);
- }
-
- gtk_grab_add (widget);
- notebook->button = event->button;
-
- if (event->x <= ARROW_SIZE + ARROW_SPACING / 2)
- {
- notebook->click_child = GTK_ARROW_LEFT;
- if (event->button == 1)
- {
- gtk_container_focus (GTK_CONTAINER (notebook), GTK_DIR_LEFT);
- if (!notebook->timer)
- {
- notebook->timer = gtk_timeout_add
- (NOTEBOOK_INIT_SCROLL_DELAY,
- (GtkFunction) gtk_notebook_timer, (gpointer) notebook);
- notebook->need_timer = TRUE;
- }
- }
- else if (event->button == 2)
- gtk_notebook_page_select (GTK_NOTEBOOK(widget));
- else if (event->button == 3)
- gtk_notebook_switch_focus_tab (notebook, notebook->children);
- gtk_notebook_draw_arrow (notebook, GTK_ARROW_LEFT);
- }
- else
- {
- notebook->click_child = GTK_ARROW_RIGHT;
- if (event->button == 1)
- {
- gtk_container_focus (GTK_CONTAINER (notebook), GTK_DIR_RIGHT);
- if (!notebook->timer)
- {
- notebook->timer = gtk_timeout_add
- (NOTEBOOK_INIT_SCROLL_DELAY,
- (GtkFunction) gtk_notebook_timer, (gpointer) notebook);
- notebook->need_timer = TRUE;
- }
- }
- else if (event->button == 2)
- gtk_notebook_page_select (GTK_NOTEBOOK(widget));
- else if (event->button == 3)
- gtk_notebook_switch_focus_tab (notebook,
- g_list_last (notebook->children));
- gtk_notebook_draw_arrow (notebook, GTK_ARROW_RIGHT);
- }
- }
- else if (event->window == widget->window)
- {
- if (event->button == 3 && notebook->menu)
- {
- gtk_menu_popup (GTK_MENU (notebook->menu), NULL, NULL,
- NULL, NULL, 3, event->time);
- return FALSE;
- }
-
- num = 0;
- children = notebook->children;
- while (children)
- {
- page = children->data;
-
- if (GTK_WIDGET_VISIBLE (page->child) &&
- GTK_WIDGET_MAPPED (page->tab_label) &&
- (event->x >= page->allocation.x) &&
- (event->y >= page->allocation.y) &&
- (event->x <= (page->allocation.x + page->allocation.width)) &&
- (event->y <= (page->allocation.y + page->allocation.height)))
- {
- GTK_CONTAINER (notebook)->focus_child = NULL;
-
- if (page == notebook->cur_page &&
- notebook->focus_tab != children &&
- GTK_WIDGET_HAS_FOCUS (notebook))
- {
- GtkNotebookPage *old_page;
-
- old_page = (GtkNotebookPage *)
- (notebook->focus_tab->data);
- notebook->focus_tab = children;
- gtk_notebook_focus_changed (notebook, old_page);
- }
- else
- {
- notebook->focus_tab = children;
- gtk_notebook_switch_page (notebook, page, num);
- gtk_widget_grab_focus (widget);
- }
- break;
- }
- children = children->next;
- num++;
- }
- }
- return FALSE;
-}
-
-static gint
-gtk_notebook_button_release (GtkWidget *widget,
- GdkEventButton *event)
-{
- GtkNotebook *notebook;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_NOTEBOOK (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (event->type != GDK_BUTTON_RELEASE)
- return FALSE;
-
- notebook = GTK_NOTEBOOK (widget);
-
- if (event->button == notebook->button)
- {
- guint click_child;
-
- if (notebook->timer)
- {
- gtk_timeout_remove (notebook->timer);
- notebook->timer = 0;
- notebook->need_timer = FALSE;
- }
- gtk_grab_remove (widget);
- click_child = notebook->click_child;
- notebook->click_child = 0;
- notebook->button = 0;
- gtk_notebook_draw_arrow (notebook, click_child);
-
- }
- return FALSE;
-}
-
-static gint
-gtk_notebook_enter_notify (GtkWidget *widget,
- GdkEventCrossing *event)
-{
- GtkNotebook *notebook;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_NOTEBOOK (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- notebook = GTK_NOTEBOOK (widget);
-
- if (event->window == notebook->panel)
- {
- gint x;
- gint y;
-
- gdk_window_get_pointer (notebook->panel, &x, &y, NULL);
-
- if (x <= ARROW_SIZE + ARROW_SPACING / 2)
- {
- notebook->in_child = GTK_ARROW_LEFT;
-
- if (notebook->click_child == 0)
- gtk_notebook_draw_arrow (notebook, GTK_ARROW_LEFT);
- }
- else
- {
- notebook->in_child = GTK_ARROW_RIGHT;
-
- if (notebook->click_child == 0)
- gtk_notebook_draw_arrow (notebook, GTK_ARROW_RIGHT);
- }
- }
-
- return FALSE;
-}
-
-static gint
-gtk_notebook_leave_notify (GtkWidget *widget,
- GdkEventCrossing *event)
-{
- GtkNotebook *notebook;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_NOTEBOOK (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- notebook = GTK_NOTEBOOK (widget);
-
- if (event->window == notebook->panel && !notebook->click_child)
- {
- if (notebook->in_child == GTK_ARROW_LEFT)
- {
- notebook->in_child = 0;
- gtk_notebook_draw_arrow (notebook,GTK_ARROW_LEFT);
- }
- else
- {
- notebook->in_child = 0;
- gtk_notebook_draw_arrow (notebook,GTK_ARROW_RIGHT);
- }
- }
- return FALSE;
-}
-
-static gint
-gtk_notebook_motion_notify (GtkWidget *widget,
- GdkEventMotion *event)
-{
- GtkNotebook *notebook;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_NOTEBOOK (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- notebook = GTK_NOTEBOOK (widget);
-
- if (notebook->button)
- return FALSE;
-
- if (event->window == notebook->panel)
- {
- gint x;
-
- x = event->x;
- if (event->is_hint)
- gdk_window_get_pointer (notebook->panel, &x, NULL, NULL);
-
- if (x <= ARROW_SIZE + ARROW_SPACING / 2 &&
- notebook->in_child == GTK_ARROW_RIGHT)
- {
- notebook->in_child = GTK_ARROW_LEFT;
- gtk_notebook_draw_arrow (notebook, GTK_ARROW_LEFT);
- gtk_notebook_draw_arrow (notebook, GTK_ARROW_RIGHT);
- }
- else if (x > ARROW_SIZE + ARROW_SPACING / 2 &&
- notebook->in_child == GTK_ARROW_LEFT)
- {
- notebook->in_child = GTK_ARROW_RIGHT;
- gtk_notebook_draw_arrow (notebook, GTK_ARROW_RIGHT);
- gtk_notebook_draw_arrow (notebook, GTK_ARROW_LEFT);
- }
- return FALSE;
- }
- return FALSE;
-}
-
-static gint
-gtk_notebook_timer (GtkNotebook *notebook)
-{
- g_return_val_if_fail (notebook != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), FALSE);
-
- if (notebook->timer)
- {
- if (notebook->click_child == GTK_ARROW_LEFT)
- gtk_container_focus (GTK_CONTAINER (notebook), GTK_DIR_LEFT);
- else if (notebook->click_child == GTK_ARROW_RIGHT)
- gtk_container_focus (GTK_CONTAINER (notebook), GTK_DIR_RIGHT);
-
- if (notebook->need_timer)
- {
- notebook->need_timer = FALSE;
- notebook->timer = gtk_timeout_add
- (NOTEBOOK_SCROLL_DELAY, (GtkFunction) gtk_notebook_timer,
- (gpointer) notebook);
- return FALSE;
- }
- return TRUE;
- }
- return FALSE;
-}
-
-static void
-gtk_notebook_draw_arrow (GtkNotebook *notebook, guint arrow)
-{
- GtkStateType state_type;
- GtkShadowType shadow_type;
- GtkWidget *widget;
-
- g_return_if_fail (notebook != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
-
- widget = GTK_WIDGET(notebook);
-
- if (GTK_WIDGET_DRAWABLE (notebook))
- {
- if (notebook->in_child == arrow)
- {
- if (notebook->click_child == arrow)
- state_type = GTK_STATE_ACTIVE;
- else
- state_type = GTK_STATE_PRELIGHT;
- }
- else
- state_type = GTK_STATE_NORMAL;
-
- if (notebook->click_child == arrow)
- shadow_type = GTK_SHADOW_IN;
- else
- shadow_type = GTK_SHADOW_OUT;
-
- if (arrow == GTK_ARROW_LEFT)
- {
- if (notebook->tab_pos == GTK_POS_LEFT ||
- notebook->tab_pos == GTK_POS_RIGHT)
- arrow = GTK_ARROW_UP;
- gtk_draw_arrow (widget->style, notebook->panel, state_type,
- shadow_type, arrow, TRUE,
- 0, 0, ARROW_SIZE, ARROW_SIZE);
- }
- else
- {
- if (notebook->tab_pos == GTK_POS_LEFT ||
- notebook->tab_pos == GTK_POS_RIGHT)
- arrow = GTK_ARROW_DOWN;
- gtk_draw_arrow (widget->style, notebook->panel, state_type,
- shadow_type, arrow, TRUE, ARROW_SIZE + ARROW_SPACING,
- 0, ARROW_SIZE, ARROW_SIZE);
- }
- }
-}
-
-static void
-gtk_real_notebook_switch_page (GtkNotebook *notebook,
- GtkNotebookPage *page)
-{
- g_return_if_fail (notebook != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
- g_return_if_fail (page != NULL);
-
- if (notebook->cur_page == page)
- return;
-
- if (notebook->cur_page && GTK_WIDGET_MAPPED (notebook->cur_page->child))
- gtk_widget_unmap (notebook->cur_page->child);
-
- notebook->cur_page = page;
-
- if (notebook->focus_tab->data != (gpointer) notebook->cur_page)
- notebook->focus_tab =
- g_list_find (notebook->children, notebook->cur_page);
-
- gtk_notebook_pages_allocate (notebook, &GTK_WIDGET (notebook)->allocation);
-
- if (GTK_WIDGET_MAPPED (notebook))
- {
- if (GTK_WIDGET_REALIZED (notebook->cur_page->child))
- gtk_widget_map (notebook->cur_page->child);
- else
- {
- gtk_widget_map (notebook->cur_page->child);
- gtk_widget_size_allocate (GTK_WIDGET (notebook),
- &GTK_WIDGET (notebook)->allocation);
- }
- }
-
- if (GTK_WIDGET_DRAWABLE (notebook))
- gtk_widget_queue_draw (GTK_WIDGET (notebook));
-}
-
-static void
-gtk_notebook_draw_tab (GtkNotebook *notebook,
- GtkNotebookPage *page,
- GdkRectangle *area)
-{
- GdkRectangle child_area;
- GdkRectangle page_area;
- GtkStateType state_type;
- GdkPoint points[6];
- gint n = 0;
-
- g_return_if_fail (notebook != NULL);
- g_return_if_fail (page != NULL);
- g_return_if_fail (area != NULL);
-
- if (!GTK_WIDGET_MAPPED (page->tab_label))
- return;
-
- page_area.x = page->allocation.x;
- page_area.y = page->allocation.y;
- page_area.width = page->allocation.width;
- page_area.height = page->allocation.height;
-
- if (gdk_rectangle_intersect (&page_area, area, &child_area))
- {
- GtkWidget *widget;
-
- switch (notebook->tab_pos)
- {
- case GTK_POS_TOP:
- if (child_area.x + child_area.width >
- page->allocation.x + page->allocation.width - TAB_OVERLAP)
- {
- points[0].x = page->allocation.x + page->allocation.width - 1;
- points[0].y = page->allocation.y + page->allocation.height - 1;
-
- points[1].x = page->allocation.x + page->allocation.width - 1;
- points[1].y = page->allocation.y + TAB_CURVATURE;
-
- points[2].x = page->allocation.x + page->allocation.width
- - TAB_CURVATURE - 1;
- points[2].y = page->allocation.y;
- n = 3;
- }
- else
- {
- points[0].x = page->allocation.x + page->allocation.width
- - TAB_OVERLAP - 1;
- points[0].y = page->allocation.y;
- n = 1;
- }
-
- if ( (child_area.x < page->allocation.x + TAB_OVERLAP) &&
- (page == notebook->cur_page ||
- page == (GtkNotebookPage *)(notebook->children->data) ||
- (notebook->scrollable &&
- page == (GtkNotebookPage *)(notebook->first_tab->data))) )
- {
- points[n].x = page->allocation.x + TAB_CURVATURE;
- points[n++].y = page->allocation.y;
-
- points[n].x = page->allocation.x;
- points[n++].y = page->allocation.y + TAB_CURVATURE;
-
- points[n].x = page->allocation.x;
- points[n++].y = page->allocation.y + page->allocation.height - 1;
- }
- else
- {
- points[n].x = page->allocation.x + TAB_OVERLAP;
- points[n++].y = page->allocation.y;
- }
- break;
- case GTK_POS_BOTTOM:
- if ( (child_area.x < page->allocation.x + TAB_OVERLAP) &&
- (page == notebook->cur_page ||
- page == (GtkNotebookPage *)(notebook->children->data) ||
- (notebook->scrollable &&
- page == (GtkNotebookPage *)(notebook->first_tab->data))) )
- {
- points[0].x = page->allocation.x;
- points[0].y = page->allocation.y;
-
- points[1].x = page->allocation.x;
- points[1].y = page->allocation.y + page->allocation.height
- - TAB_CURVATURE - 1;
-
- points[2].x = page->allocation.x + TAB_CURVATURE;
- points[2].y = page->allocation.y + page->allocation.height - 1;
- n = 3;
- }
- else
- {
- points[0].x = page->allocation.x + TAB_OVERLAP;
- points[0].y = page->allocation.y + page->allocation.height - 1;
- n = 1;
- }
-
- if (child_area.x + child_area.width >
- page->allocation.x + page->allocation.width - TAB_OVERLAP)
- {
- points[n].x = page->allocation.x + page->allocation.width
- - TAB_CURVATURE - 1;
- points[n++].y = page->allocation.y + page->allocation.height - 1;
-
- points[n].x = page->allocation.x + page->allocation.width - 1;
- points[n++].y = page->allocation.y + page->allocation.height
- - TAB_CURVATURE - 1;
-
- points[n].x = page->allocation.x + page->allocation.width - 1;
- points[n++].y = page->allocation.y;
- }
- else
- {
- points[n].x = page->allocation.x + page->allocation.width
- - TAB_OVERLAP - 1;
- points[n++].y = page->allocation.y + page->allocation.height - 1;
- }
- break;
- case GTK_POS_LEFT:
- if ( (child_area.y < page->allocation.y + TAB_OVERLAP) &&
- (page == notebook->cur_page ||
- page == (GtkNotebookPage *)(notebook->children->data) ||
- (notebook->scrollable &&
- page == (GtkNotebookPage *)(notebook->first_tab->data))) )
- {
- points[0].x = page->allocation.x + page->allocation.width - 1;
- points[0].y = page->allocation.y;
-
- points[1].x = page->allocation.x + TAB_CURVATURE;
- points[1].y = page->allocation.y;
-
- points[2].x = page->allocation.x;
- points[2].y = page->allocation.y + TAB_CURVATURE;
- n = 3;
- }
- else
- {
- points[0].x = page->allocation.x;
- points[0].y = page->allocation.y + TAB_OVERLAP;
- n = 1;
- }
-
- if (child_area.y + child_area.height >
- page->allocation.y + page->allocation.height - TAB_OVERLAP)
- {
- points[n].x = page->allocation.x;
- points[n++].y = page->allocation.y + page->allocation.height
- - TAB_CURVATURE - 1;
-
- points[n].x = page->allocation.x + TAB_CURVATURE;
- points[n++].y = page->allocation.y + page->allocation.height - 1;
-
- points[n].x = page->allocation.x + page->allocation.width - 1;
- points[n++].y = page->allocation.y + page->allocation.height - 1;
- }
- else
- {
- points[n].x = page->allocation.x;
- points[n++].y = page->allocation.y + page->allocation.height
- - TAB_OVERLAP - 1;
- }
- break;
- case GTK_POS_RIGHT:
- if (child_area.y + child_area.height >
- page->allocation.y + page->allocation.height - TAB_OVERLAP)
- {
- points[0].x = page->allocation.x;
- points[0].y = page->allocation.y + page->allocation.height - 1;
-
- points[1].x = page->allocation.x + page->allocation.width
- - TAB_CURVATURE - 1;
- points[1].y = page->allocation.y + page->allocation.height - 1;
-
- points[2].x = page->allocation.x + page->allocation.width - 1;
- points[2].y = page->allocation.y + page->allocation.height
- - TAB_CURVATURE - 1;
- n = 3;
- }
- else
- {
- points[0].x = page->allocation.x + page->allocation.width - 1;
- points[0].y = page->allocation.y + page->allocation.height
- - TAB_OVERLAP - 1;
- n = 1;
- }
-
- if ( (child_area.y < page->allocation.y + TAB_OVERLAP) &&
- (page == notebook->cur_page ||
- page == (GtkNotebookPage *)(notebook->children->data) ||
- (notebook->scrollable &&
- page == (GtkNotebookPage *)(notebook->first_tab->data))) )
- {
- points[n].x = page->allocation.x + page->allocation.width - 1;
- points[n++].y = page->allocation.y + TAB_CURVATURE;
-
- points[n].x = page->allocation.x + page->allocation.width
- - TAB_CURVATURE - 1;
- points[n++].y = page->allocation.y;
-
- points[n].x = page->allocation.x;
- points[n++].y = page->allocation.y;
- }
- else
- {
- points[n].x = page->allocation.x + page->allocation.width - 1;
- points[n++].y = page->allocation.y + TAB_OVERLAP;
- }
- break;
- }
-
- widget = GTK_WIDGET(notebook);
-
- if (notebook->cur_page == page)
- {
- state_type = GTK_STATE_NORMAL;
- }
- else
- {
- state_type = GTK_STATE_ACTIVE;
- gdk_draw_rectangle (widget->window, widget->style->bg_gc[state_type],
- TRUE, child_area.x, child_area.y,
- child_area.width, child_area.height);
- }
-
- gtk_draw_polygon (widget->style, widget->window, state_type,
- GTK_SHADOW_OUT, points, n, FALSE);
-
- if (gtk_widget_intersect (page->tab_label, area, &child_area))
- gtk_widget_draw (page->tab_label, &child_area);
- }
-}
-
-static gint
-gtk_notebook_focus_in (GtkWidget *widget,
- GdkEventFocus *event)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_NOTEBOOK (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_CONTAINER (widget)->focus_child)
- {
- if (gtk_notebook_page_select (GTK_NOTEBOOK (widget)))
- return FALSE;
- else
- GTK_CONTAINER (widget)->focus_child = NULL;
- }
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
- gtk_widget_draw_focus (widget);
-
- return FALSE;
-}
-
-static gint
-gtk_notebook_focus_out (GtkWidget *widget,
- GdkEventFocus *event)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_NOTEBOOK (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
- gtk_widget_draw_focus (widget);
-
- return FALSE;
-}
-
-static void
-gtk_notebook_draw_focus (GtkWidget *widget)
-{
- GtkNotebook *notebook;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (widget));
-
- notebook = GTK_NOTEBOOK (widget);
-
- if (GTK_WIDGET_DRAWABLE (widget) && notebook->show_tabs &&
- notebook->focus_tab)
- {
- GtkNotebookPage *page;
- GdkGC *gc;
-
- page = notebook->focus_tab->data;
-
- if (GTK_WIDGET_HAS_FOCUS (widget))
- gc = widget->style->black_gc;
- else if (page == notebook->cur_page)
- gc = widget->style->bg_gc[GTK_STATE_NORMAL];
- else
- gc = widget->style->bg_gc[GTK_STATE_ACTIVE];
-
- gdk_draw_rectangle (widget->window,
- gc, FALSE,
- page->tab_label->allocation.x - 1,
- page->tab_label->allocation.y - 1,
- page->tab_label->allocation.width + 1,
- page->tab_label->allocation.height + 1);
- }
-}
-
-static void
-gtk_notebook_focus_changed (GtkNotebook *notebook, GtkNotebookPage *old_page)
-{
- GtkWidget *widget;
-
- g_return_if_fail (notebook != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
- g_return_if_fail (old_page != NULL);
-
- widget = GTK_WIDGET (notebook);
-
- if (GTK_WIDGET_DRAWABLE (widget) && notebook->show_tabs &&
- notebook->focus_tab)
- {
- GtkNotebookPage *page;
- GdkGC *gc;
-
- page = notebook->focus_tab->data;
-
- if (GTK_WIDGET_HAS_FOCUS (widget))
- gc = widget->style->black_gc;
- else if (page == notebook->cur_page)
- gc = widget->style->bg_gc[GTK_STATE_NORMAL];
- else
- gc = widget->style->bg_gc[GTK_STATE_ACTIVE];
-
- gdk_draw_rectangle (widget->window,
- gc, FALSE,
- page->tab_label->allocation.x - 1,
- page->tab_label->allocation.y - 1,
- page->tab_label->allocation.width + 1,
- page->tab_label->allocation.height + 1);
-
- if (old_page == notebook->cur_page)
- gc = widget->style->bg_gc[GTK_STATE_NORMAL];
- else
- gc = widget->style->bg_gc[GTK_STATE_ACTIVE];
-
- gdk_draw_rectangle (widget->window,
- gc, FALSE,
- old_page->tab_label->allocation.x - 1,
- old_page->tab_label->allocation.y - 1,
- old_page->tab_label->allocation.width + 1,
- old_page->tab_label->allocation.height + 1);
- }
-}
-
-static void
-gtk_notebook_calc_tabs (GtkNotebook *notebook,
- GList *start,
- GList **end,
- gint *tab_space,
- guint direction)
-{
- GtkNotebookPage *page = NULL;
- GList *children;
-
- children = start;
- switch (notebook->tab_pos)
- {
- case GTK_POS_TOP:
- case GTK_POS_BOTTOM:
- while (children)
- {
- page = children->data;
- *tab_space -= page->requisition.width;
- if (*tab_space < 0 || children == *end)
- {
- if (*tab_space < 0)
- {
- *tab_space = - (*tab_space + page->requisition.width);
- *end = children;
- }
- break;
- }
- if (direction == STEP_NEXT)
- children = children->next;
- else
- children = children->prev;
- }
- break;
- case GTK_POS_LEFT:
- case GTK_POS_RIGHT:
- while (children)
- {
- page = children->data;
- *tab_space -= page->requisition.height;
- if (*tab_space < 0 || children == *end)
- {
- if (*tab_space < 0)
- {
- *tab_space = - (*tab_space + page->requisition.height);
- *end = children;
- }
- break;
- }
- if (direction == STEP_NEXT)
- children = children->next;
- else
- children = children->prev;
- }
- break;
- }
-}
-
-static void
-gtk_notebook_pages_allocate (GtkNotebook *notebook,
- GtkAllocation *allocation)
-{
- GtkWidget *widget;
- GtkContainer *container;
- GtkNotebookPage *page = NULL;
- GtkAllocation child_allocation;
- GList *children;
- GList *last_child = NULL;
- gint showarrow = FALSE;
- gint tab_space = 0;
- gint x = 0;
- gint y = 0;
- gint i;
- gint n = 1;
- gint old_fill = 0;
- gint new_fill = 0;
-
- if (!notebook->show_tabs || !notebook->children)
- return;
-
- widget = GTK_WIDGET (notebook);
- container = GTK_CONTAINER (notebook);
-
- child_allocation.x = container->border_width;
- child_allocation.y = container->border_width;
-
- switch (notebook->tab_pos)
- {
- case GTK_POS_BOTTOM:
- child_allocation.y = (allocation->height -
- notebook->cur_page->requisition.height -
- container->border_width);
- case GTK_POS_TOP:
- child_allocation.height = notebook->cur_page->requisition.height;
- break;
- case GTK_POS_RIGHT:
- child_allocation.x = (allocation->width -
- notebook->cur_page->requisition.width -
- container->border_width);
- case GTK_POS_LEFT:
- child_allocation.width = notebook->cur_page->requisition.width;
- break;
- }
-
- if (notebook->scrollable)
- {
- children = notebook->children;
- switch (notebook->tab_pos)
- {
- case GTK_POS_TOP:
- case GTK_POS_BOTTOM:
- while (children)
- {
- page = children->data;
- children = children->next;
- tab_space += page->requisition.width;
- }
- if (tab_space > allocation->width - 2 * container->border_width - TAB_OVERLAP)
- {
- showarrow = TRUE;
- page = notebook->focus_tab->data;
-
- tab_space = (allocation->width - TAB_OVERLAP - page->requisition.width -
- 2 * (container->border_width + ARROW_SPACING + ARROW_SIZE));
- x = allocation->width - 2 * ARROW_SIZE - ARROW_SPACING - container->border_width;
-
- page = notebook->children->data;
- if (notebook->tab_pos == GTK_POS_TOP)
- y = container->border_width + (page->requisition.height - ARROW_SIZE) / 2;
- else
- y = (allocation->height - container->border_width -
- ARROW_SIZE - (page->requisition.height - ARROW_SIZE) / 2);
- }
- break;
- case GTK_POS_LEFT:
- case GTK_POS_RIGHT:
- while (children)
- {
- page = children->data;
- children = children->next;
- tab_space += page->requisition.height;
- }
- if (tab_space > (allocation->height - 2 * container->border_width - TAB_OVERLAP))
- {
- showarrow = TRUE;
- page = notebook->focus_tab->data;
- tab_space = (allocation->height -
- ARROW_SIZE - ARROW_SPACING - TAB_OVERLAP -
- 2 * container->border_width - page->requisition.height);
- y = allocation->height - container->border_width - ARROW_SIZE;
-
- page = notebook->children->data;
- if (notebook->tab_pos == GTK_POS_LEFT)
- x = (container->border_width +
- (page->requisition.width - (2 * ARROW_SIZE - ARROW_SPACING)) / 2);
- else
- x = (allocation->width - container->border_width -
- (2 * ARROW_SIZE - ARROW_SPACING) -
- (page->requisition.width - (2 * ARROW_SIZE - ARROW_SPACING)) / 2);
- }
- break;
- }
- if (showarrow) /* first_tab <- focus_tab */
- {
- children = notebook->focus_tab->prev;
- while (children)
- {
- if (notebook->first_tab == children)
- break;
- children = children->prev;
- }
-
- if (!children)
- notebook->first_tab = notebook->focus_tab;
- else
- gtk_notebook_calc_tabs (notebook, notebook->focus_tab->prev,
- &(notebook->first_tab), &tab_space,
- STEP_PREV);
- if (tab_space <= 0)
- {
- notebook->first_tab = notebook->first_tab->next;
- if (!notebook->first_tab)
- notebook->first_tab = notebook->focus_tab;
- last_child = notebook->focus_tab->next;
- }
- else /* focus_tab -> end */
- {
- if (!notebook->first_tab)
- notebook->first_tab = notebook->children;
-
- children = NULL;
- gtk_notebook_calc_tabs (notebook, notebook->focus_tab->next,
- &children, &tab_space, STEP_NEXT);
-
- if (tab_space <= 0)
- last_child = children;
- else /* start <- first_tab */
- {
- last_child = NULL;
- children = NULL;
- gtk_notebook_calc_tabs (notebook,notebook->first_tab->prev,
- &children, &tab_space, STEP_PREV);
- notebook->first_tab = children->next;
- }
- }
-
- if (GTK_WIDGET_REALIZED (notebook))
- {
- gdk_window_move (notebook->panel, x, y);
- gdk_window_show (notebook->panel);
- }
-
- if (tab_space < 0)
- {
- tab_space = -tab_space;
- n = 0;
- children = notebook->first_tab;
- while (children != last_child)
- {
- children = children->next;
- n++;
- }
- }
- else
- tab_space = 0;
-
- children = notebook->children;
- while (children != notebook->first_tab)
- {
- page = children->data;
- children = children->next;
-
- if (GTK_WIDGET_MAPPED (page->tab_label))
- gtk_widget_unmap (page->tab_label);
-
- }
- children = last_child;
- while (children)
- {
- page = children->data;
- children = children->next;
-
- if (GTK_WIDGET_MAPPED (page->tab_label))
- gtk_widget_unmap (page->tab_label);
- }
- }
- else /* !showarrow */
- {
- notebook->first_tab = notebook->children;
- tab_space = 0;
- if (GTK_WIDGET_REALIZED (notebook))
- gdk_window_hide (notebook->panel);
- }
- children = notebook->first_tab;
- }
- else
- children = notebook->children;
-
- i = 1;
- while (children != last_child)
- {
- page = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (page->child))
- {
- new_fill = (tab_space * i++) / n;
- switch (notebook->tab_pos)
- {
- case GTK_POS_TOP:
- case GTK_POS_BOTTOM:
- child_allocation.width = page->requisition.width + TAB_OVERLAP + new_fill - old_fill;
- break;
- case GTK_POS_LEFT:
- case GTK_POS_RIGHT:
- child_allocation.height = page->requisition.height + TAB_OVERLAP + new_fill - old_fill;
- break;
- }
- old_fill = new_fill;
- gtk_notebook_page_allocate (notebook, page, &child_allocation);
-
- switch (notebook->tab_pos)
- {
- case GTK_POS_TOP:
- case GTK_POS_BOTTOM:
- child_allocation.x += child_allocation.width - TAB_OVERLAP;
- break;
- case GTK_POS_LEFT:
- case GTK_POS_RIGHT:
- child_allocation.y += child_allocation.height - TAB_OVERLAP;
- break;
- }
-
- if (GTK_WIDGET_REALIZED (notebook) &&
- !GTK_WIDGET_MAPPED (page->tab_label))
- gtk_widget_map (page->tab_label);
- }
- }
-}
-
-static void
-gtk_notebook_page_allocate (GtkNotebook *notebook,
- GtkNotebookPage *page,
- GtkAllocation *allocation)
-{
- GtkAllocation child_allocation;
- gint xthickness, ythickness;
-
- g_return_if_fail (notebook != NULL);
- g_return_if_fail (page != NULL);
- g_return_if_fail (allocation != NULL);
-
- page->allocation = *allocation;
-
- xthickness = GTK_WIDGET (notebook)->style->klass->xthickness;
- ythickness = GTK_WIDGET (notebook)->style->klass->ythickness;
-
- if (notebook->cur_page != page)
- {
- switch (notebook->tab_pos)
- {
- case GTK_POS_TOP:
- page->allocation.y += ythickness;
- case GTK_POS_BOTTOM:
- page->allocation.height -= ythickness;
- break;
- case GTK_POS_LEFT:
- page->allocation.x += xthickness;
- case GTK_POS_RIGHT:
- page->allocation.width -= xthickness;
- break;
- }
- }
-
- switch (notebook->tab_pos)
- {
- case GTK_POS_TOP:
- child_allocation.x = xthickness + notebook->tab_border;
- child_allocation.y = ythickness + notebook->tab_border + page->allocation.y;
- child_allocation.width = page->allocation.width - child_allocation.x * 2;
- child_allocation.height = page->allocation.height - ythickness - 2 * notebook->tab_border;
- child_allocation.x += page->allocation.x;
- break;
- case GTK_POS_BOTTOM:
- child_allocation.x = xthickness + notebook->tab_border;
- child_allocation.width = page->allocation.width - child_allocation.x * 2;
- child_allocation.height = page->allocation.height - ythickness - 2 * notebook->tab_border;
- child_allocation.x += page->allocation.x;
- child_allocation.y = page->allocation.y + notebook->tab_border;
- break;
- case GTK_POS_LEFT:
- child_allocation.x = xthickness + notebook->tab_border + page->allocation.x;
- child_allocation.y = ythickness + notebook->tab_border;
- child_allocation.width = page->allocation.width - xthickness - 2 * notebook->tab_border;
- child_allocation.height = page->allocation.height - child_allocation.y * 2;
- child_allocation.y += page->allocation.y;
- break;
- case GTK_POS_RIGHT:
- child_allocation.y = ythickness + notebook->tab_border;
- child_allocation.width = page->allocation.width - xthickness - 2 * notebook->tab_border;
- child_allocation.height = page->allocation.height - child_allocation.y * 2;
- child_allocation.x = page->allocation.x + notebook->tab_border;
- child_allocation.y += page->allocation.y;
- break;
- }
-
- gtk_widget_size_allocate (page->tab_label, &child_allocation);
-}
-
-static void
-gtk_notebook_menu_switch_page (GtkWidget *widget,
- GtkNotebookPage *page)
-{
- GtkNotebook *notebook;
- GList *children;
- gint page_num;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (page != NULL);
-
- notebook = GTK_NOTEBOOK (gtk_menu_get_attach_widget
- (GTK_MENU (widget->parent)));
-
- if (notebook->cur_page == page)
- return;
-
- page_num = 0;
- children = notebook->children;
- while (children && children->data != page)
- {
- children = children->next;
- page_num++;
- }
-
- gtk_signal_emit (GTK_OBJECT (notebook),
- notebook_signals[SWITCH_PAGE],
- page,
- page_num);
-}
-
-static void
-gtk_notebook_switch_page (GtkNotebook *notebook,
- GtkNotebookPage *page,
- gint page_num)
-{
- g_return_if_fail (notebook != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
- g_return_if_fail (page != NULL);
-
- if (notebook->cur_page == page)
- return;
-
- gtk_signal_emit (GTK_OBJECT (notebook),
- notebook_signals[SWITCH_PAGE],
- page,
- page_num);
-}
-
-static void
-gtk_notebook_marshal_signal (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkNotebookSignal rfunc;
-
- rfunc = (GtkNotebookSignal) func;
-
- (* rfunc) (object, GTK_VALUE_POINTER (args[0]), GTK_VALUE_INT (args[1]),
- func_data);
-}
-
-static gint
-gtk_notebook_focus (GtkContainer *container,
- GtkDirectionType direction)
-{
- GtkNotebook *notebook;
- GtkWidget *focus_child;
- GtkNotebookPage *page = NULL;
- GtkNotebookPage *old_page;
- gint return_val;
-
- g_return_val_if_fail (container != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_NOTEBOOK (container), FALSE);
-
- notebook = GTK_NOTEBOOK(container);
-
- if (!GTK_WIDGET_SENSITIVE (container) || !notebook->children)
- return FALSE;
-
- focus_child = container->focus_child;
- container->focus_child = NULL;
-
- if (!notebook->show_tabs)
- {
- if (GTK_WIDGET_VISIBLE (notebook->cur_page->child))
- {
- if (GTK_WIDGET_CAN_FOCUS (notebook->cur_page->child))
- {
- if (!focus_child)
- {
- gtk_widget_grab_focus (notebook->cur_page->child);
- return TRUE;
- }
- }
- else if (GTK_IS_CONTAINER (notebook->cur_page->child))
- {
- if (gtk_container_focus
- (GTK_CONTAINER (notebook->cur_page->child), direction))
- return TRUE;
- }
- }
- return FALSE;
- }
-
- old_page = notebook->focus_tab->data;
- return_val = FALSE;
-
- if (!GTK_WIDGET_HAS_FOCUS (container) && !focus_child)
- {
- gtk_widget_grab_focus (GTK_WIDGET (container));
- return TRUE;
- }
-
- if (focus_child && focus_child == old_page->child)
- {
- if (GTK_WIDGET_VISIBLE (old_page->child))
- {
- if (GTK_IS_CONTAINER (old_page->child) &&
- !GTK_WIDGET_HAS_FOCUS (old_page->child))
- {
- if (gtk_container_focus (GTK_CONTAINER (old_page->child),
- direction))
- return TRUE;
- }
- gtk_widget_grab_focus (GTK_WIDGET(notebook));
- return TRUE;
- }
- return FALSE;
- }
-
- switch (direction)
- {
- case GTK_DIR_TAB_FORWARD:
- case GTK_DIR_RIGHT:
- case GTK_DIR_DOWN:
- if (!notebook->focus_tab->next)
- return FALSE;
-
- notebook->focus_tab = notebook->focus_tab->next;
- page = notebook->focus_tab->data;
- return_val = TRUE;
- break;
- case GTK_DIR_TAB_BACKWARD:
- case GTK_DIR_LEFT:
- case GTK_DIR_UP:
- if (!notebook->focus_tab->prev)
- return FALSE;
-
- notebook->focus_tab = notebook->focus_tab->prev;
- page = notebook->focus_tab->data;
- return_val = TRUE;
- break;
- }
-
- if (return_val)
- {
- if (GTK_WIDGET_MAPPED (page->tab_label))
- gtk_notebook_focus_changed (notebook, old_page);
- else
- {
- gtk_notebook_pages_allocate (notebook,
- &(GTK_WIDGET (notebook)->allocation));
- gtk_notebook_expose_tabs (notebook);
- }
- }
-
- return return_val;
-}
-
-static gint
-gtk_notebook_page_select (GtkNotebook *notebook)
-{
- g_return_val_if_fail (notebook != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), FALSE);
-
- if (notebook->focus_tab)
- {
- GtkNotebookPage *page;
- GList *children;
- gint num;
-
- page = notebook->focus_tab->data;
-
- children = notebook->children;
- num = 0;
- while (children != notebook->focus_tab)
- {
- children = children->next;
- num++;
- }
-
- gtk_notebook_switch_page (notebook, page, num);
-
- if (GTK_WIDGET_VISIBLE (page->child))
- {
- if (GTK_WIDGET_CAN_FOCUS (page->child))
- {
- gtk_widget_grab_focus (page->child);
- return TRUE;
- }
- else if (GTK_IS_CONTAINER (page->child))
- {
- if (gtk_container_focus (GTK_CONTAINER (page->child),
- GTK_DIR_TAB_FORWARD))
- return TRUE;
- }
- }
- }
- return FALSE;
-}
-
-static void
-gtk_notebook_switch_focus_tab (GtkNotebook *notebook,
- GList *new_child)
-{
- GtkNotebookPage *old_page;
- GtkNotebookPage *page;
-
- g_return_if_fail (notebook != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
-
- if (notebook->focus_tab != new_child)
- {
- old_page = notebook->focus_tab->data;
- notebook->focus_tab = new_child;
- page = notebook->focus_tab->data;
- if (GTK_WIDGET_MAPPED (page->tab_label))
- gtk_notebook_focus_changed (notebook, old_page);
- else
- {
- gtk_notebook_pages_allocate (notebook,
- &(GTK_WIDGET (notebook)->allocation));
- gtk_notebook_expose_tabs (notebook);
- }
- }
-}
-
-static gint
-gtk_notebook_key_press (GtkWidget *widget,
- GdkEventKey *event)
-{
- GtkNotebook *notebook;
- GtkDirectionType direction = 0;
- gint return_val;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_NOTEBOOK (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- notebook = GTK_NOTEBOOK (widget);
- return_val = TRUE;
-
- if (!notebook->children || !notebook->show_tabs)
- return FALSE;
-
- switch (event->keyval)
- {
- case GDK_Up:
- direction = GTK_DIR_UP;
- break;
- case GDK_Left:
- direction = GTK_DIR_LEFT;
- break;
- case GDK_Down:
- direction = GTK_DIR_DOWN;
- break;
- case GDK_Right:
- direction = GTK_DIR_RIGHT;
- break;
- case GDK_Tab:
- if (event->state & GDK_SHIFT_MASK)
- direction = GTK_DIR_TAB_BACKWARD;
- else
- direction = GTK_DIR_TAB_FORWARD;
- break;
- case GDK_Home:
- gtk_notebook_switch_focus_tab (notebook, notebook->children);
- return TRUE;
- case GDK_End:
- gtk_notebook_switch_focus_tab (notebook,
- g_list_last (notebook->children));
- return TRUE;
- case GDK_Return:
- case GDK_space:
- gtk_notebook_page_select (GTK_NOTEBOOK(widget));
- return TRUE;
- default:
- return_val = FALSE;
- }
- if (return_val)
- return gtk_container_focus (GTK_CONTAINER (widget), direction);
- return return_val;
-}
-
-void
-gtk_notebook_set_tab_border (GtkNotebook *notebook,
- gint tab_border)
-{
- g_return_if_fail (notebook != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
-
- if (notebook->tab_border != tab_border && tab_border > 0)
- {
- notebook->tab_border = tab_border;
-
- if (GTK_WIDGET_VISIBLE (notebook) && notebook->show_tabs)
- gtk_widget_queue_resize (GTK_WIDGET (notebook));
- }
-}
-
-static void
-gtk_notebook_update_labels (GtkNotebook *notebook,
- GList *list,
- gint page_num)
-{
- GtkNotebookPage *page;
- gchar string[32];
-
- while (list)
- {
- page = list->data;
- list = list->next;
- sprintf (string, "Page %d", page_num);
- if (page->default_tab)
- gtk_label_set (GTK_LABEL (page->tab_label), string);
- if (notebook->menu && page->default_menu)
- gtk_label_set (GTK_LABEL (page->menu_label), string);
- page_num++;
- }
-}
-
-static void
-gtk_notebook_menu_item_create (GtkNotebook *notebook,
- GtkNotebookPage *page,
- gint position)
-{
- GtkWidget *menu_item;
-
- if (page->default_menu)
- {
- if (GTK_IS_LABEL (page->tab_label))
- page->menu_label = gtk_label_new (GTK_LABEL (page->tab_label)->label);
- else
- page->menu_label = gtk_label_new ("");
- gtk_widget_show (page->menu_label);
- }
- menu_item = gtk_menu_item_new ();
- gtk_container_add (GTK_CONTAINER (menu_item), page->menu_label);
- gtk_menu_insert (GTK_MENU (notebook->menu), menu_item, position);
- gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
- GTK_SIGNAL_FUNC (gtk_notebook_menu_switch_page),
- page);
- gtk_widget_show (menu_item);
-}
-
-void
-gtk_notebook_popup_enable (GtkNotebook *notebook)
-{
- GtkNotebookPage *page;
- GList *children;
-
- g_return_if_fail (notebook != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
-
- if (notebook->menu)
- return;
-
- notebook->menu = gtk_menu_new ();
-
- children = notebook->children;
- while (children)
- {
- page = children->data;
- children = children->next;
- gtk_notebook_menu_item_create (notebook, page, -1);
- }
- gtk_notebook_update_labels (notebook, notebook->children,1);
-
- gtk_menu_attach_to_widget (GTK_MENU (notebook->menu), GTK_WIDGET (notebook),
- gtk_notebook_menu_detacher);
-}
-
-static void
-gtk_notebook_menu_label_unparent (GtkWidget *widget,
- gpointer data)
-{
- gtk_widget_unparent (GTK_BIN(widget)->child);
- GTK_BIN(widget)->child = NULL;
-}
-
-void
-gtk_notebook_popup_disable (GtkNotebook *notebook)
-{
- g_return_if_fail (notebook != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
-
- if (!notebook->menu)
- return;
-
- gtk_container_foreach (GTK_CONTAINER (notebook->menu),
- (GtkCallback) gtk_notebook_menu_label_unparent, NULL);
- gtk_widget_destroy (notebook->menu);
-}
-
-static void
-gtk_notebook_menu_detacher (GtkWidget *widget,
- GtkMenu *menu)
-{
- GtkNotebook *notebook;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_NOTEBOOK (widget));
-
- notebook = GTK_NOTEBOOK (widget);
- g_return_if_fail (notebook->menu == (GtkWidget*) menu);
-
- notebook->menu = NULL;
-}
diff --git a/gtk/gtknotebook.h b/gtk/gtknotebook.h
deleted file mode 100644
index 0605092457..0000000000
--- a/gtk/gtknotebook.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_NOTEBOOK_H__
-#define __GTK_NOTEBOOK_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkcontainer.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_NOTEBOOK(obj) GTK_CHECK_CAST (obj, gtk_notebook_get_type (), GtkNotebook)
-#define GTK_NOTEBOOK_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_notebook_get_type (), GtkNotebookClass)
-#define GTK_IS_NOTEBOOK(obj) GTK_CHECK_TYPE (obj, gtk_notebook_get_type ())
-
-
-typedef struct _GtkNotebook GtkNotebook;
-typedef struct _GtkNotebookClass GtkNotebookClass;
-typedef struct _GtkNotebookPage GtkNotebookPage;
-
-struct _GtkNotebook
-{
- GtkContainer container;
-
- GtkNotebookPage *cur_page;
- GList *children;
- GList *first_tab;
- GList *focus_tab;
-
- GtkWidget *menu;
- GdkWindow *panel;
-
- guint32 timer;
-
- gint16 tab_border;
-
- guint show_tabs : 1;
- guint show_border : 1;
- guint tab_pos : 2;
- guint scrollable : 1;
- guint in_child : 2;
- guint click_child : 2;
- guint button : 2;
- guint need_timer : 1;
-};
-
-struct _GtkNotebookClass
-{
- GtkContainerClass parent_class;
-
- void (* switch_page) (GtkNotebook *notebook,
- GtkNotebookPage *page);
-};
-
-struct _GtkNotebookPage
-{
- GtkWidget *child;
- GtkWidget *tab_label;
- GtkWidget *menu_label;
- guint default_menu : 1;
- guint default_tab : 1;
- GtkRequisition requisition;
- GtkAllocation allocation;
-};
-
-
-guint gtk_notebook_get_type (void);
-GtkWidget* gtk_notebook_new (void);
-void gtk_notebook_append_page (GtkNotebook *notebook,
- GtkWidget *child,
- GtkWidget *tab_label);
-void gtk_notebook_append_page_menu (GtkNotebook *notebook,
- GtkWidget *child,
- GtkWidget *tab_label,
- GtkWidget *menu_label);
-void gtk_notebook_prepend_page (GtkNotebook *notebook,
- GtkWidget *child,
- GtkWidget *tab_label);
-void gtk_notebook_prepend_page_menu (GtkNotebook *notebook,
- GtkWidget *child,
- GtkWidget *tab_label,
- GtkWidget *menu_label);
-void gtk_notebook_insert_page (GtkNotebook *notebook,
- GtkWidget *child,
- GtkWidget *tab_label,
- gint position);
-void gtk_notebook_insert_page_menu (GtkNotebook *notebook,
- GtkWidget *child,
- GtkWidget *tab_label,
- GtkWidget *menu_label,
- gint position);
-void gtk_notebook_remove_page (GtkNotebook *notebook,
- gint page_num);
-gint gtk_notebook_current_page (GtkNotebook *notebook);
-void gtk_notebook_set_page (GtkNotebook *notebook,
- gint page_num);
-void gtk_notebook_next_page (GtkNotebook *notebook);
-void gtk_notebook_prev_page (GtkNotebook *notebook);
-void gtk_notebook_set_tab_pos (GtkNotebook *notebook,
- GtkPositionType pos);
-void gtk_notebook_set_show_tabs (GtkNotebook *notebook,
- gint show_tabs);
-void gtk_notebook_set_show_border (GtkNotebook *notebook,
- gint show_border);
-void gtk_notebook_set_scrollable (GtkNotebook *notebook,
- gint scrollable);
-void gtk_notebook_set_tab_border (GtkNotebook *notebook,
- gint border_width);
-void gtk_notebook_popup_enable (GtkNotebook *notebook);
-void gtk_notebook_popup_disable (GtkNotebook *notebook);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_NOTEBOOK_H__ */
diff --git a/gtk/gtkobject.c b/gtk/gtkobject.c
deleted file mode 100644
index 4eeeb922a6..0000000000
--- a/gtk/gtkobject.c
+++ /dev/null
@@ -1,1653 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <stdarg.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "gtkobject.h"
-#include "gtksignal.h"
-
-
-#define OBJECT_DATA_ID_CHUNK 1024
-
-
-enum {
- DESTROY,
- LAST_SIGNAL
-};
-enum {
- ARG_0,
- ARG_USER_DATA,
- ARG_SIGNAL,
- ARG_OBJECT_SIGNAL
-};
-
-
-typedef struct _GtkObjectData GtkObjectData;
-typedef struct _GtkArgInfo GtkArgInfo;
-
-struct _GtkObjectData
-{
- guint id;
- gpointer data;
- GtkDestroyNotify destroy;
- GtkObjectData *next;
-};
-
-struct _GtkArgInfo
-{
- char *name;
- GtkType type;
- GtkType class_type;
- guint arg_flags;
- guint arg_id;
- guint seq_id;
-};
-
-
-static void gtk_object_class_init (GtkObjectClass *klass);
-static void gtk_object_init (GtkObject *object);
-static void gtk_object_set_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id);
-static void gtk_object_get_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id);
-static void gtk_object_real_destroy (GtkObject *object);
-static void gtk_object_finalize (GtkObject *object);
-static void gtk_object_notify_weaks (gpointer data);
-static void gtk_object_data_init (void);
-static GtkObjectData* gtk_object_data_new (void);
-static void gtk_object_data_destroy (GtkObjectData *odata);
-static guint* gtk_object_data_id_alloc (void);
-
-GtkArg* gtk_object_collect_args (guint *nargs,
- va_list args1,
- va_list args2);
-
-static guint object_signals[LAST_SIGNAL] = { 0 };
-
-static gint object_data_init = TRUE;
-static GHashTable *object_data_ht = NULL;
-static GMemChunk *object_data_mem_chunk = NULL;
-static GSList *object_data_id_list = NULL;
-static guint object_data_id_index = 0;
-
-static GHashTable *arg_info_ht = NULL;
-
-static const gchar *user_data_key = "user_data";
-
-
-#ifdef G_ENABLE_DEBUG
-static guint obj_count = 0;
-static GHashTable *living_objs_ht = NULL;
-static void
-gtk_object_debug_foreach (gpointer key, gpointer value, gpointer user_data)
-{
- GtkObject *object;
-
- object = (GtkObject*) value;
- g_print ("%p: %s ref_count=%d%s%s\n",
- object,
- gtk_type_name (GTK_OBJECT_TYPE (object)),
- object->ref_count,
- GTK_OBJECT_FLOATING (object) ? " (floating)" : "",
- GTK_OBJECT_DESTROYED (object) ? " (destroyed)" : "");
-}
-static void
-gtk_object_debug (void)
-{
- g_hash_table_foreach (living_objs_ht, gtk_object_debug_foreach, NULL);
-
- g_print ("living objects count = %d\n", obj_count);
-}
-static guint
-gtk_object_pointer_hash (const gpointer v)
-{
- gint i;
-
- i = (gint) v;
-
- return i;
-}
-#endif /* G_ENABLE_DEBUG */
-
-/*****************************************
- * gtk_object_init_type:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_object_init_type ()
-{
- GtkType object_type = 0;
- GtkTypeInfo object_info =
- {
- "GtkObject",
- sizeof (GtkObject),
- sizeof (GtkObjectClass),
- (GtkClassInitFunc) gtk_object_class_init,
- (GtkObjectInitFunc) gtk_object_init,
- gtk_object_set_arg,
- gtk_object_get_arg,
- };
-
- object_type = gtk_type_unique (0, &object_info);
- g_assert (object_type == GTK_TYPE_OBJECT);
-
-#ifdef G_ENABLE_DEBUG
- if (gtk_debug_flags & GTK_DEBUG_OBJECTS)
- ATEXIT (gtk_object_debug);
-#endif /* G_ENABLE_DEBUG */
-}
-
-GtkType
-gtk_object_get_type ()
-{
- return GTK_TYPE_OBJECT;
-}
-
-/*****************************************
- * gtk_object_class_init:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_object_class_init (GtkObjectClass *class)
-{
- class->signals = NULL;
- class->nsignals = 0;
- class->n_args = 0;
-
- gtk_object_add_arg_type ("GtkObject::user_data",
- GTK_TYPE_POINTER,
- GTK_ARG_READWRITE,
- ARG_USER_DATA);
- gtk_object_add_arg_type ("GtkObject::signal",
- GTK_TYPE_SIGNAL,
- GTK_ARG_WRITABLE,
- ARG_SIGNAL);
- gtk_object_add_arg_type ("GtkObject::object_signal",
- GTK_TYPE_SIGNAL,
- GTK_ARG_WRITABLE,
- ARG_OBJECT_SIGNAL);
-
- object_signals[DESTROY] =
- gtk_signal_new ("destroy",
- GTK_RUN_LAST,
- class->type,
- GTK_SIGNAL_OFFSET (GtkObjectClass, destroy),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (class, object_signals, LAST_SIGNAL);
-
- class->destroy = gtk_object_real_destroy;
- class->finalize = gtk_object_finalize;
-}
-
-/*****************************************
- * gtk_object_real_destroy:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_object_real_destroy (GtkObject *object)
-{
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_OBJECT (object));
-
- gtk_signal_handlers_destroy (object);
-}
-
-/*****************************************
- * gtk_object_init:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_object_init (GtkObject *object)
-{
- GTK_OBJECT_FLAGS (object) = GTK_FLOATING;
-
- object->ref_count = 1;
- object->object_data = NULL;
-
-#ifdef G_ENABLE_DEBUG
- if (gtk_debug_flags & GTK_DEBUG_OBJECTS)
- {
- obj_count++;
-
- if (!living_objs_ht)
- living_objs_ht = g_hash_table_new (gtk_object_pointer_hash, NULL);
-
- g_hash_table_insert (living_objs_ht, object, object);
- }
-#endif /* G_ENABLE_DEBUG */
-}
-
-/*****************************************
- * gtk_object_set_arg:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_object_set_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id)
-{
- switch (arg_id)
- {
- case ARG_USER_DATA:
- gtk_object_set_user_data (object, GTK_VALUE_POINTER (*arg));
- break;
- case ARG_SIGNAL:
- if ((arg->name[9 + 2 + 6] != ':') || (arg->name[9 + 2 + 7] != ':'))
- {
- g_warning ("invalid signal argument: \"%s\"\n", arg->name);
- arg->type = GTK_TYPE_INVALID;
- return;
- }
- gtk_signal_connect (object, arg->name + 9 + 2 + 6 + 2,
- (GtkSignalFunc) GTK_VALUE_SIGNAL (*arg).f,
- GTK_VALUE_SIGNAL (*arg).d);
- break;
- case ARG_OBJECT_SIGNAL:
- if ((arg->name[9 + 2 + 13] != ':') || (arg->name[9 + 2 + 14] != ':'))
- {
- g_warning ("invalid signal argument: \"%s\"\n", arg->name);
- arg->type = GTK_TYPE_INVALID;
- return;
- }
- gtk_signal_connect_object (object, arg->name + 9 + 2 + 13 + 2,
- (GtkSignalFunc) GTK_VALUE_SIGNAL (*arg).f,
- (GtkObject*) GTK_VALUE_SIGNAL (*arg).d);
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-/*****************************************
- * gtk_object_get_arg:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_object_get_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id)
-{
- switch (arg_id)
- {
- case ARG_USER_DATA:
- GTK_VALUE_POINTER (*arg) = gtk_object_get_user_data (object);
- break;
- case ARG_SIGNAL:
- case ARG_OBJECT_SIGNAL:
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-/*****************************************
- * gtk_object_class_add_signals:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_object_class_add_signals (GtkObjectClass *class,
- guint *signals,
- guint nsignals)
-{
- guint *new_signals;
- guint i;
-
- g_return_if_fail (class != NULL);
-
- new_signals = g_new (gint, class->nsignals + nsignals);
- for (i = 0; i < class->nsignals; i++)
- new_signals[i] = class->signals[i];
- for (i = 0; i < nsignals; i++)
- new_signals[class->nsignals + i] = signals[i];
-
- g_free (class->signals);
- class->signals = new_signals;
- class->nsignals += nsignals;
-}
-
-/*****************************************
- * gtk_object_class_add_user_signal:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-guint
-gtk_object_class_add_user_signal (GtkObjectClass *class,
- const gchar *name,
- GtkSignalMarshaller marshaller,
- GtkType return_val,
- guint nparams,
- ...)
-{
- GtkType *params;
- guint i;
- va_list args;
- guint signal_id;
-
- g_return_val_if_fail (class != NULL, 0);
-
- if (nparams > 0)
- {
- params = g_new (GtkType, nparams);
-
- va_start (args, nparams);
-
- for (i = 0; i < nparams; i++)
- params[i] = va_arg (args, GtkType);
-
- va_end (args);
- }
- else
- params = NULL;
-
- signal_id = gtk_signal_newv (name,
- 0,
- class->type,
- 0,
- marshaller,
- return_val,
- nparams,
- params);
-
- g_free (params);
-
- if (signal_id)
- gtk_object_class_add_signals (class, &signal_id, 1);
-
- return signal_id;
-}
-
-/*****************************************
- * gtk_object_finalize:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_object_finalize (GtkObject *object)
-{
- GtkObjectData *odata, *next;
-
- odata = object->object_data;
- while (odata)
- {
- next = odata->next;
- gtk_object_data_destroy (odata);
- odata = next;
- }
-
- g_free (object);
-}
-
-/*****************************************
- * gtk_object_sink:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_object_sink (GtkObject *object)
-{
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_OBJECT (object));
-
- if (GTK_OBJECT_FLOATING (object))
- {
- GTK_OBJECT_UNSET_FLAGS (object, GTK_FLOATING);
- gtk_object_unref (object);
- }
-}
-
-/*****************************************
- * gtk_object_destroy:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_object_destroy (GtkObject *object)
-{
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_OBJECT (object));
-
- if (!GTK_OBJECT_DESTROYED (object))
- {
- GTK_OBJECT_SET_FLAGS (object, GTK_DESTROYED);
- gtk_signal_emit (object, object_signals[DESTROY]);
- }
-}
-
-/*****************************************
- * Weak references.
- *
- * Weak refs are very similar to the old "destroy" signal. They allow
- * one to register a callback that is called when the weakly
- * referenced object is finalized.
- *
- * They are not implemented as a signal because they really are
- * special and need to be used with great care. Unlike signals, who
- * should be able to execute any code whatsoever.
- *
- * A weakref callback is not allowed to retain a reference to the
- * object. In fact, the object is no longer there at all when it is
- * called.
- *
- * A weakref callback is called atmost once.
- *
- *****************************************/
-
-typedef struct _GtkWeakRef GtkWeakRef;
-
-struct _GtkWeakRef
-{
- GtkWeakRef *next;
- GtkDestroyNotify notify;
- gpointer data;
-};
-
-static const gchar *weakrefs_key = "gtk-weakrefs";
-
-void
-gtk_object_weakref (GtkObject *object,
- GtkDestroyNotify notify,
- gpointer data)
-{
- GtkWeakRef *weak;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (notify != NULL);
- g_return_if_fail (GTK_IS_OBJECT (object));
-
- weak = g_new (GtkWeakRef, 1);
- weak->next = gtk_object_get_data (object, weakrefs_key);
- weak->notify = notify;
- weak->data = data;
- gtk_object_set_data_full (object, weakrefs_key, weak,
- gtk_object_notify_weaks);
-}
-
-void
-gtk_object_weakunref (GtkObject *object,
- GtkDestroyNotify notify,
- gpointer data)
-{
- GtkWeakRef *weaks, *w, **wp;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_OBJECT (object));
-
- weaks = gtk_object_get_data (object, weakrefs_key);
- for (wp = &weaks; *wp; wp = &(*wp)->next)
- {
- w = *wp;
- if (w->notify == notify && w->data == data)
- {
- if (w == weaks)
- gtk_object_set_data_full (object, weakrefs_key, w->next,
- gtk_object_notify_weaks);
- else
- *wp = w->next;
- g_free (w);
- return;
- }
- }
-}
-
-static void
-gtk_object_notify_weaks (gpointer data)
-{
- GtkWeakRef *w1, *w2;
-
- w1 = (GtkWeakRef *)data;
-
- while (w1)
- {
- w1->notify (w1->data);
- w2 = w1->next;
- g_free (w1);
- w1 = w2;
- }
-}
-
-/*****************************************
- * gtk_object_new:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-GtkObject*
-gtk_object_new (GtkType type,
- ...)
-{
- GtkObject *obj;
- GtkArg *args;
- guint nargs;
- va_list args1;
- va_list args2;
-
- obj = gtk_type_new (type);
-
- va_start (args1, type);
- va_start (args2, type);
-
- args = gtk_object_collect_args (&nargs, args1, args2);
- gtk_object_setv (obj, nargs, args);
- g_free (args);
-
- va_end (args1);
- va_end (args2);
-
- return obj;
-}
-
-/*****************************************
- * gtk_object_newv:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-GtkObject*
-gtk_object_newv (GtkType type,
- guint nargs,
- GtkArg *args)
-{
- gpointer obj;
-
- obj = gtk_type_new (type);
- gtk_object_setv (obj, nargs, args);
-
- return obj;
-}
-
-/*****************************************
- * gtk_object_getv:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_object_getv (GtkObject *object,
- guint nargs,
- GtkArg *args)
-{
- int i;
-
- g_return_if_fail (object != NULL);
-
- if (!arg_info_ht)
- return;
-
- for (i = 0; i < nargs; i++)
- {
- GtkArgInfo *info;
- gchar *lookup_name;
- gchar *d;
-
-
- /* hm, the name cutting shouldn't be needed on gets, but what the heck...
- */
- lookup_name = g_strdup (args[i].name);
- d = strchr (lookup_name, ':');
- if (d && d[1] == ':')
- {
- d = strchr (d + 2, ':');
- if (d)
- *d = 0;
-
- info = g_hash_table_lookup (arg_info_ht, lookup_name);
- }
- else
- info = NULL;
-
- if (!info)
- {
- g_warning ("invalid arg name: \"%s\"\n", lookup_name);
- args[i].type = GTK_TYPE_INVALID;
- g_free (lookup_name);
- continue;
- }
- else if (!gtk_type_is_a (object->klass->type, info->class_type))
- {
- g_warning ("invalid arg for %s: \"%s\"\n", gtk_type_name (object->klass->type), lookup_name);
- args[i].type = GTK_TYPE_INVALID;
- g_free (lookup_name);
- continue;
- }
- else if (!info->arg_flags & GTK_ARG_READABLE)
- {
- g_warning ("arg is not supplied for read-access: \"%s\"\n", lookup_name);
- args[i].type = GTK_TYPE_INVALID;
- g_free (lookup_name);
- continue;
- }
- else
- g_free (lookup_name);
-
- args[i].type = info->type;
- gtk_type_get_arg (object, info->class_type, &args[i], info->arg_id);
- }
-}
-
-/*****************************************
- * gtk_object_query_args:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-struct _GtkQueryArgData
-{
- GList *arg_list;
- GtkType class_type;
-};
-typedef struct _GtkQueryArgData GtkQueryArgData;
-
-static void
-gtk_query_arg_foreach (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- register GtkArgInfo *info;
- register GtkQueryArgData *data;
-
- info = value;
- data = user_data;
-
- if (info->class_type == data->class_type)
- data->arg_list = g_list_prepend (data->arg_list, info);
-}
-
-GtkArg*
-gtk_object_query_args (GtkType class_type,
- guint32 **arg_flags,
- guint *nargs)
-{
- GtkArg *args;
- GtkQueryArgData query_data;
-
- if (arg_flags)
- *arg_flags = NULL;
- g_return_val_if_fail (nargs != NULL, NULL);
- *nargs = 0;
- g_return_val_if_fail (gtk_type_is_a (class_type, gtk_object_get_type ()), NULL);
-
- if (!arg_info_ht)
- return NULL;
-
- /* make sure the types class has been initialized, because
- * the argument setup happens in the gtk_*_class_init() functions.
- */
- gtk_type_class (class_type);
-
- query_data.arg_list = NULL;
- query_data.class_type = class_type;
- g_hash_table_foreach (arg_info_ht, gtk_query_arg_foreach, &query_data);
-
- if (query_data.arg_list)
- {
- register GList *list;
- register guint len;
-
- list = query_data.arg_list;
- len = 1;
- while (list->next)
- {
- len++;
- list = list->next;
- }
- g_assert (len == ((GtkObjectClass*) gtk_type_class (class_type))->n_args); /* paranoid */
-
- args = g_new0 (GtkArg, len);
- *nargs = len;
- if (arg_flags)
- *arg_flags = g_new (guint32, len);
-
- do
- {
- GtkArgInfo *info;
-
- info = list->data;
- list = list->prev;
-
- g_assert (info->seq_id > 0 && info->seq_id <= len); /* paranoid */
-
- args[info->seq_id - 1].type = info->type;
- args[info->seq_id - 1].name = info->name;
- if (arg_flags)
- (*arg_flags)[info->seq_id - 1] = info->arg_flags;
- }
- while (list);
-
- g_list_free (query_data.arg_list);
- }
- else
- args = NULL;
-
- return args;
-}
-
-/*****************************************
- * gtk_object_set:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_object_set (GtkObject *object,
- ...)
-{
- GtkArg *args;
- guint nargs;
- va_list args1;
- va_list args2;
-
- g_return_if_fail (object != NULL);
-
- va_start (args1, object);
- va_start (args2, object);
-
- args = gtk_object_collect_args (&nargs, args1, args2);
- gtk_object_setv (object, nargs, args);
- g_free (args);
-
- va_end (args1);
- va_end (args2);
-}
-
-/*****************************************
- * gtk_object_setv:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_object_setv (GtkObject *object,
- guint nargs,
- GtkArg *args)
-{
- int i;
-
- g_return_if_fail (object != NULL);
-
- if (!arg_info_ht)
- return;
-
- for (i = 0; i < nargs; i++)
- {
- GtkArgInfo *info;
- gchar *lookup_name;
- gchar *d;
- gboolean arg_ok;
-
- lookup_name = g_strdup (args[i].name);
- d = strchr (lookup_name, ':');
- if (d && d[1] == ':')
- {
- d = strchr (d + 2, ':');
- if (d)
- *d = 0;
-
- info = g_hash_table_lookup (arg_info_ht, lookup_name);
- }
- else
- info = NULL;
-
- arg_ok = TRUE;
-
- if (!info)
- {
- g_warning ("invalid arg name: \"%s\"\n", lookup_name);
- arg_ok = FALSE;
- }
- else if (info->type != args[i].type)
- {
- g_warning ("invalid arg type for: \"%s\"\n", lookup_name);
- arg_ok = FALSE;
- }
- else if (!gtk_type_is_a (object->klass->type, info->class_type))
- {
- g_warning ("invalid arg for %s: \"%s\"\n", gtk_type_name (object->klass->type), lookup_name);
- arg_ok = FALSE;
- }
- else if (!info->arg_flags & GTK_ARG_WRITABLE)
- {
- g_warning ("arg is not supplied for write-access: \"%s\"\n", lookup_name);
- arg_ok = FALSE;
- }
-
- g_free (lookup_name);
-
- if (!arg_ok)
- continue;
-
- gtk_type_set_arg (object, info->class_type, &args[i], info->arg_id);
- }
-}
-
-/*****************************************
- * gtk_object_add_arg_type:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_object_add_arg_type (const char *arg_name,
- GtkType arg_type,
- guint arg_flags,
- guint arg_id)
-{
- GtkArgInfo *info;
- gchar class_part[1024];
- gchar *arg_part;
- GtkType class_type;
-
- g_return_if_fail (arg_name != NULL);
- g_return_if_fail (arg_type > GTK_TYPE_NONE);
- g_return_if_fail (arg_id > 0);
- g_return_if_fail ((arg_flags & GTK_ARG_READWRITE) != 0);
-
- arg_part = strchr (arg_name, ':');
- if (!arg_part || (arg_part[0] != ':') || (arg_part[1] != ':'))
- {
- g_warning ("invalid arg name: \"%s\"\n", arg_name);
- return;
- }
-
- strncpy (class_part, arg_name, (glong) (arg_part - arg_name));
- class_part[(glong) (arg_part - arg_name)] = '\0';
-
- class_type = gtk_type_from_name (class_part);
- if (!class_type)
- {
- g_warning ("invalid class name in arg: \"%s\"\n", arg_name);
- return;
- }
-
- info = g_new (GtkArgInfo, 1);
- info->name = g_strdup (arg_name);
- info->type = arg_type;
- info->class_type = class_type;
- info->arg_flags = arg_flags & (GTK_ARG_READABLE | GTK_ARG_WRITABLE);
- info->arg_id = arg_id;
- info->seq_id = ++((GtkObjectClass*) gtk_type_class (class_type))->n_args;
-
- if (!arg_info_ht)
- arg_info_ht = g_hash_table_new (g_str_hash, g_str_equal);
-
- g_hash_table_insert (arg_info_ht, info->name, info);
-}
-
-/*****************************************
- * gtk_object_get_arg_type:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-GtkType
-gtk_object_get_arg_type (const gchar *arg_name)
-{
- GtkArgInfo *info;
- gchar buffer[1024];
- gchar *t;
-
- if (!arg_info_ht)
- return GTK_TYPE_INVALID;
-
- t = strchr (arg_name, ':');
- if (!t || (t[0] != ':') || (t[1] != ':'))
- {
- g_warning ("invalid arg name: \"%s\"\n", arg_name);
- return GTK_TYPE_INVALID;
- }
-
- t = strchr (t + 2, ':');
- if (t)
- {
- strncpy (buffer, arg_name, (long) (t - arg_name));
- buffer[(long) (t - arg_name)] = '\0';
- arg_name = buffer;
- }
-
- info = g_hash_table_lookup (arg_info_ht, (gpointer) arg_name);
- if (info)
- return info->type;
-
- return GTK_TYPE_INVALID;
-}
-
-/*****************************************
- * gtk_object_set_data:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_object_set_data (GtkObject *object,
- const gchar *key,
- gpointer data)
-{
- gtk_object_set_data_full (object, key, data, NULL);
-}
-
-/*****************************************
- * gtk_object_set_data_full:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_object_set_data_full (GtkObject *object,
- const gchar *key,
- gpointer data,
- GtkDestroyNotify destroy)
-{
- GtkObjectData *odata;
- GtkObjectData *prev;
- guint *id;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_OBJECT (object));
- g_return_if_fail (key != NULL);
-
- if (object_data_init)
- gtk_object_data_init ();
-
- id = g_hash_table_lookup (object_data_ht, (gpointer) key);
-
- if (!data)
- {
- if (id)
- {
- prev = NULL;
- odata = object->object_data;
-
- while (odata)
- {
- if (odata->id == *id)
- {
- if (prev)
- prev->next = odata->next;
- if (odata == object->object_data)
- object->object_data = odata->next;
-
- gtk_object_data_destroy (odata);
- break;
- }
-
- prev = odata;
- odata = odata->next;
- }
- }
- }
- else
- {
- if (!id)
- {
- id = gtk_object_data_id_alloc ();
- g_hash_table_insert (object_data_ht, (gpointer) key, id);
- }
-
- odata = object->object_data;
- while (odata)
- {
- if (odata->id == *id)
- {
- odata->data = data;
- odata->destroy = destroy;
- return;
- }
-
- odata = odata->next;
- }
-
- odata = gtk_object_data_new ();
- odata->id = *id;
- odata->data = data;
- odata->destroy = destroy;
-
- odata->next = object->object_data;
- object->object_data = odata;
- }
-}
-
-/*****************************************
- * gtk_object_get_data:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-gpointer
-gtk_object_get_data (GtkObject *object,
- const gchar *key)
-{
- GtkObjectData *odata;
- guint *id;
-
- g_return_val_if_fail (object != NULL, NULL);
- g_return_val_if_fail (GTK_IS_OBJECT (object), NULL);
- g_return_val_if_fail (key != NULL, NULL);
-
- if (object_data_init)
- gtk_object_data_init ();
-
- id = g_hash_table_lookup (object_data_ht, (gpointer) key);
- if (id)
- {
- odata = object->object_data;
- while (odata)
- {
- if (odata->id == *id)
- return odata->data;
- odata = odata->next;
- }
- }
-
- return NULL;
-}
-
-/*****************************************
- * gtk_object_remove_data:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_object_remove_data (GtkObject *object,
- const gchar *key)
-{
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_OBJECT (object));
- g_return_if_fail (key != NULL);
-
- gtk_object_set_data_full (object, key, NULL, NULL);
-}
-
-/*****************************************
- * gtk_object_set_user_data:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_object_set_user_data (GtkObject *object,
- gpointer data)
-{
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_OBJECT (object));
-
- gtk_object_set_data_full (object, user_data_key, data, NULL);
-}
-
-/*****************************************
- * gtk_object_get_user_data:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-gpointer
-gtk_object_get_user_data (GtkObject *object)
-{
- g_return_val_if_fail (object != NULL, NULL);
- g_return_val_if_fail (GTK_IS_OBJECT (object), NULL);
-
- return gtk_object_get_data (object, user_data_key);
-}
-
-/*****************************************
- * gtk_object_check_cast:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static gchar*
-gtk_object_descriptive_type_name (GtkType type)
-{
- gchar *name;
-
- name = gtk_type_name (type);
- if (!name)
- name = "(unknown)";
-
- return name;
-}
-
-GtkObject*
-gtk_object_check_cast (GtkObject *obj,
- GtkType cast_type)
-{
- if (!obj)
- {
- g_warning ("invalid cast from (NULL) pointer to `%s'",
- gtk_object_descriptive_type_name (cast_type));
- return obj;
- }
- if (!obj->klass)
- {
- g_warning ("invalid unclassed pointer in cast to `%s'",
- gtk_object_descriptive_type_name (cast_type));
- return obj;
- }
- if (obj->klass->type < GTK_TYPE_OBJECT)
- {
- g_warning ("invalid class type `%s' in cast to `%s'",
- gtk_object_descriptive_type_name (obj->klass->type),
- gtk_object_descriptive_type_name (cast_type));
- return obj;
- }
- if (!gtk_type_is_a (obj->klass->type, cast_type))
- {
- g_warning ("invalid cast from `%s' to `%s'",
- gtk_object_descriptive_type_name (obj->klass->type),
- gtk_object_descriptive_type_name (cast_type));
- return obj;
- }
-
- return obj;
-}
-
-/*****************************************
- * gtk_object_check_class_cast:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-GtkObjectClass*
-gtk_object_check_class_cast (GtkObjectClass *klass,
- GtkType cast_type)
-{
- if (!klass)
- {
- g_warning ("invalid class cast from (NULL) pointer to `%s'",
- gtk_object_descriptive_type_name (cast_type));
- return klass;
- }
- if (klass->type < GTK_TYPE_OBJECT)
- {
- g_warning ("invalid class type `%s' in class cast to `%s'",
- gtk_object_descriptive_type_name (klass->type),
- gtk_object_descriptive_type_name (cast_type));
- return klass;
- }
- if (!gtk_type_is_a (klass->type, cast_type))
- {
- g_warning ("invalid class cast from `%s' to `%s'",
- gtk_object_descriptive_type_name (klass->type),
- gtk_object_descriptive_type_name (cast_type));
- return klass;
- }
-
- return klass;
-}
-
-/*****************************************
- * gtk_object_data_init:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_object_data_init ()
-{
- if (object_data_init)
- {
- object_data_init = FALSE;
-
- object_data_ht = g_hash_table_new (g_str_hash, g_str_equal);
- }
-}
-
-/*****************************************
- * gtk_object_data_new:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static GtkObjectData*
-gtk_object_data_new ()
-{
- GtkObjectData *odata;
-
- if (!object_data_mem_chunk)
- object_data_mem_chunk = g_mem_chunk_new ("object data mem chunk",
- sizeof (GtkObjectData),
- 1024, G_ALLOC_AND_FREE);
-
- odata = g_chunk_new (GtkObjectData, object_data_mem_chunk);
-
- odata->id = 0;
- odata->data = NULL;
- odata->destroy = NULL;
- odata->next = NULL;
-
- return odata;
-}
-
-/*****************************************
- * gtk_object_data_destroy:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_object_data_destroy (GtkObjectData *odata)
-{
- g_return_if_fail (odata != NULL);
-
- if (odata->destroy)
- odata->destroy (odata->data);
-
- g_mem_chunk_free (object_data_mem_chunk, odata);
-}
-
-/*****************************************
- * gtk_object_data_id_alloc:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static guint*
-gtk_object_data_id_alloc ()
-{
- static guint next_id = 1;
- guint *ids;
-
- if (!object_data_id_list ||
- (object_data_id_index == OBJECT_DATA_ID_CHUNK))
- {
- ids = g_new (guint, OBJECT_DATA_ID_CHUNK);
- object_data_id_index = 0;
- object_data_id_list = g_slist_prepend (object_data_id_list, ids);
- }
- else
- {
- ids = object_data_id_list->data;
- }
-
- ids[object_data_id_index] = next_id++;
- return &ids[object_data_id_index++];
-}
-
-/*****************************************
- * gtk_object_collect_args:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-GtkArg*
-gtk_object_collect_args (guint *nargs,
- va_list args1,
- va_list args2)
-{
- GtkArg *args;
- GtkType type;
- gchar *name;
- gint done;
- gint i, n;
-
- n = 0;
- done = FALSE;
-
- while (!done)
- {
- name = va_arg (args1, char *);
- if (!name)
- {
- done = TRUE;
- continue;
- }
-
- type = gtk_object_get_arg_type (name);
-
- switch (GTK_FUNDAMENTAL_TYPE (type))
- {
- case GTK_TYPE_INVALID:
- g_warning ("invalid arg name: \"%s\" %x\n", name, type);
- (void) va_arg (args1, long);
- continue;
- case GTK_TYPE_NONE:
- break;
- case GTK_TYPE_CHAR:
- case GTK_TYPE_BOOL:
- case GTK_TYPE_INT:
- case GTK_TYPE_UINT:
- case GTK_TYPE_ENUM:
- case GTK_TYPE_FLAGS:
- (void) va_arg (args1, gint);
- break;
- case GTK_TYPE_LONG:
- case GTK_TYPE_ULONG:
- (void) va_arg (args1, glong);
- break;
- case GTK_TYPE_FLOAT:
- (void) va_arg (args1, gfloat);
- break;
- case GTK_TYPE_DOUBLE:
- (void) va_arg (args1, gdouble);
- break;
- case GTK_TYPE_STRING:
- (void) va_arg (args1, gchar*);
- break;
- case GTK_TYPE_POINTER:
- case GTK_TYPE_BOXED:
- (void) va_arg (args1, gpointer);
- break;
- case GTK_TYPE_SIGNAL:
- (void) va_arg (args1, GtkFunction);
- (void) va_arg (args1, gpointer);
- break;
- case GTK_TYPE_FOREIGN:
- (void) va_arg (args1, gpointer);
- (void) va_arg (args1, GtkDestroyNotify);
- break;
- case GTK_TYPE_CALLBACK:
- (void) va_arg (args1, GtkCallbackMarshal);
- (void) va_arg (args1, gpointer);
- (void) va_arg (args1, GtkDestroyNotify);
- break;
- case GTK_TYPE_C_CALLBACK:
- (void) va_arg (args1, GtkFunction);
- (void) va_arg (args1, gpointer);
- break;
- case GTK_TYPE_ARGS:
- (void) va_arg (args1, gint);
- (void) va_arg (args1, GtkArg*);
- break;
- case GTK_TYPE_OBJECT:
- (void) va_arg (args1, GtkObject*);
- break;
- default:
- g_error ("unsupported type %s in args", gtk_type_name (type));
- break;
- }
-
- n += 1;
- }
-
- *nargs = n;
- args = NULL;
-
- if (n > 0)
- {
- args = g_new0 (GtkArg, n);
-
- for (i = 0; i < n; i++)
- {
- args[i].name = va_arg (args2, char *);
- args[i].type = gtk_object_get_arg_type (args[i].name);
-
- switch (GTK_FUNDAMENTAL_TYPE (args[i].type))
- {
- case GTK_TYPE_INVALID:
- (void) va_arg (args2, long);
- i -= 1;
- continue;
- case GTK_TYPE_NONE:
- break;
- case GTK_TYPE_CHAR:
- GTK_VALUE_CHAR(args[i]) = va_arg (args2, gint);
- break;
- case GTK_TYPE_BOOL:
- GTK_VALUE_BOOL(args[i]) = va_arg (args2, gint);
- break;
- case GTK_TYPE_INT:
- GTK_VALUE_INT(args[i]) = va_arg (args2, gint);
- break;
- case GTK_TYPE_UINT:
- GTK_VALUE_UINT(args[i]) = va_arg (args2, guint);
- break;
- case GTK_TYPE_ENUM:
- GTK_VALUE_ENUM(args[i]) = va_arg (args2, gint);
- break;
- case GTK_TYPE_FLAGS:
- GTK_VALUE_FLAGS(args[i]) = va_arg (args2, gint);
- break;
- case GTK_TYPE_LONG:
- GTK_VALUE_LONG(args[i]) = va_arg (args2, glong);
- break;
- case GTK_TYPE_ULONG:
- GTK_VALUE_ULONG(args[i]) = va_arg (args2, gulong);
- break;
- case GTK_TYPE_FLOAT:
- GTK_VALUE_FLOAT(args[i]) = va_arg (args2, gfloat);
- break;
- case GTK_TYPE_DOUBLE:
- GTK_VALUE_DOUBLE(args[i]) = va_arg (args2, gdouble);
- break;
- case GTK_TYPE_STRING:
- GTK_VALUE_STRING(args[i]) = va_arg (args2, gchar*);
- break;
- case GTK_TYPE_POINTER:
- GTK_VALUE_POINTER(args[i]) = va_arg (args2, gpointer);
- break;
- case GTK_TYPE_BOXED:
- GTK_VALUE_BOXED(args[i]) = va_arg (args2, gpointer);
- break;
- case GTK_TYPE_SIGNAL:
- GTK_VALUE_SIGNAL(args[i]).f = va_arg (args2, GtkFunction);
- GTK_VALUE_SIGNAL(args[i]).d = va_arg (args2, gpointer);
- break;
- case GTK_TYPE_FOREIGN:
- GTK_VALUE_FOREIGN(args[i]).data = va_arg (args2, gpointer);
- GTK_VALUE_FOREIGN(args[i]).notify =
- va_arg (args2, GtkDestroyNotify);
- break;
- case GTK_TYPE_CALLBACK:
- GTK_VALUE_CALLBACK(args[i]).marshal =
- va_arg (args2, GtkCallbackMarshal);
- GTK_VALUE_CALLBACK(args[i]).data = va_arg (args2, gpointer);
- GTK_VALUE_CALLBACK(args[i]).notify =
- va_arg (args2, GtkDestroyNotify);
- break;
- case GTK_TYPE_C_CALLBACK:
- GTK_VALUE_C_CALLBACK(args[i]).func = va_arg (args2, GtkFunction);
- GTK_VALUE_C_CALLBACK(args[i]).func_data =
- va_arg (args2, gpointer);
- break;
- case GTK_TYPE_ARGS:
- GTK_VALUE_ARGS(args[i]).n_args = va_arg (args2, gint);
- GTK_VALUE_ARGS(args[i]).args = va_arg (args2, GtkArg*);
- break;
- case GTK_TYPE_OBJECT:
- GTK_VALUE_OBJECT(args[i]) = va_arg (args2, GtkObject*);
- g_assert (GTK_VALUE_OBJECT(args[i]) == NULL ||
- GTK_CHECK_TYPE (GTK_VALUE_OBJECT(args[i]),
- args[i].type));
- break;
- default:
- g_error ("unsupported type %s in args",
- gtk_type_name (args[i].type));
- break;
- }
- }
- }
-
- return args;
-}
-
-
-
-#undef gtk_object_ref
-#undef gtk_object_unref
-
-void
-gtk_object_ref (GtkObject *object)
-{
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_OBJECT (object));
-
- object->ref_count += 1;
-}
-
-void
-gtk_object_unref (GtkObject *object)
-{
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_OBJECT (object));
-
- if (object->ref_count == 1)
- gtk_object_destroy (object);
-
- if (object->ref_count > 0)
- object->ref_count -= 1;
-
- if (object->ref_count == 0)
- {
-#ifdef G_ENABLE_DEBUG
- if (gtk_debug_flags & GTK_DEBUG_OBJECTS)
- {
- g_assert (g_hash_table_lookup (living_objs_ht, object) == object);
- g_hash_table_remove (living_objs_ht, object);
- obj_count--;
- }
-#endif /* G_ENABLE_DEBUG */
- object->klass->finalize (object);
- }
-}
-
-
-#ifdef G_ENABLE_DEBUG
-static GtkObject *gtk_trace_object = NULL;
-void
-gtk_trace_referencing (gpointer *o,
- const gchar *func,
- guint local_frame,
- guint line,
- gboolean do_ref)
-{
- gboolean exists;
- GtkObject *object = (GtkObject*) o;
-
- if (gtk_debug_flags & GTK_DEBUG_OBJECTS)
- {
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_OBJECT (object));
-
- exists = g_hash_table_lookup (living_objs_ht, object) != NULL;
-
- if (exists &&
- (object == gtk_trace_object ||
- gtk_trace_object == (void*)42))
- printf ("trace: object_%s: (%s:%p)->ref_count=%d%s (%s_f%02d:%d)\n",
- do_ref ? "ref" : "unref",
- gtk_type_name (GTK_OBJECT_TYPE (object)),
- object,
- object->ref_count,
- do_ref ? " + 1" : " - 1 ",
- func,
- local_frame,
- line);
-
- if (!exists)
- printf ("trace: object_%s(%p): no such object! (%s_f%02d:%d)\n",
- do_ref ? "ref" : "unref",
- object,
- func,
- local_frame,
- line);
- }
-
- if (do_ref)
- gtk_object_ref (object);
- else
- gtk_object_unref (object);
-}
-#endif /* G_ENABLE_DEBUG */
-
diff --git a/gtk/gtkobject.h b/gtk/gtkobject.h
deleted file mode 100644
index 44d218f84d..0000000000
--- a/gtk/gtkobject.h
+++ /dev/null
@@ -1,333 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_OBJECT_H__
-#define __GTK_OBJECT_H__
-
-
-#include <gtk/gtkenums.h>
-#include <gtk/gtktypeutils.h>
-#include <gtk/gtkdebug.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-
-/* The debugging versions of the casting macros make sure the cast is "ok"
- * before proceeding, but they are definately slower than their less
- * careful counterparts as they involve no less than 3 function calls.
- */
-#ifdef GTK_NO_CHECK_CASTS
-
-#define GTK_CHECK_CAST(obj,cast_type,cast) ((cast*) (obj))
-#define GTK_CHECK_CLASS_CAST(klass,cast_type,cast) ((cast*) (klass))
-
-#else /* !GTK_NO_CHECK_CASTS */
-
-#define GTK_CHECK_CAST(obj,cast_type,cast) \
- ((cast*) gtk_object_check_cast ((GtkObject*) (obj), (cast_type)))
-
-#define GTK_CHECK_CLASS_CAST(klass,cast_type,cast) \
- ((cast*) gtk_object_check_class_cast ((GtkObjectClass*) (klass), (cast_type)))
-
-#endif /* GTK_NO_CHECK_CASTS */
-
-
-/* Determines whether 'obj' is a type of 'otype'.
- */
-#define GTK_CHECK_TYPE(obj,otype) (gtk_type_is_a (((GtkObject*) (obj))->klass->type, (otype)))
-
-
-/* Macro for casting a pointer to a GtkObject pointer.
- */
-#define GTK_OBJECT(obj) GTK_CHECK_CAST ((obj), gtk_object_get_type (), GtkObject)
-
-/* Macros for extracting various fields from GtkObject and GtkObjectClass.
- */
-#define GTK_OBJECT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), gtk_object_get_type (), GtkObjectClass))
-#define GTK_OBJECT_TYPE(obj) (GTK_OBJECT (obj)->klass->type)
-#define GTK_OBJECT_SIGNALS(obj) (GTK_OBJECT (obj)->klass->signals)
-#define GTK_OBJECT_NSIGNALS(obj) (GTK_OBJECT (obj)->klass->nsignals)
-
-/* GtkObject only uses the first 4 bits of the flags field.
- * GtkWidget uses the remaining bits. Though this is a kinda nasty
- * break up, it does make the size of GtkWidget smaller.
- */
-enum
-{
- GTK_DESTROYED = 1 << 0,
- GTK_FLOATING = 1 << 1,
- GTK_RESERVED_1 = 1 << 2,
- GTK_RESERVED_2 = 1 << 3
-};
-
-/* GtkArg flag bits for gtk_object_add_arg_type
- */
-enum
-{
- GTK_ARG_READABLE = 1 << 0,
- GTK_ARG_WRITABLE = 1 << 1,
- GTK_ARG_CONSTRUCT = 1 << 2
-};
-#define GTK_ARG_READWRITE (GTK_ARG_READABLE | GTK_ARG_WRITABLE)
-
-
-/* Macros for extracting the object_flags from GtkObject.
- */
-#define GTK_OBJECT_FLAGS(obj) (GTK_OBJECT (obj)->flags)
-#define GTK_OBJECT_DESTROYED(obj) (GTK_OBJECT_FLAGS (obj) & GTK_DESTROYED)
-#define GTK_OBJECT_FLOATING(obj) (GTK_OBJECT_FLAGS (obj) & GTK_FLOATING)
-
-/* Macros for setting and clearing bits in the object_flags field of GtkObject.
- */
-#define GTK_OBJECT_SET_FLAGS(obj,flag) G_STMT_START{ (GTK_OBJECT_FLAGS (obj) |= (flag)); }G_STMT_END
-#define GTK_OBJECT_UNSET_FLAGS(obj,flag) G_STMT_START{ (GTK_OBJECT_FLAGS (obj) &= ~(flag)); }G_STMT_END
-
-/* Macro for testing whether "obj" is of type GtkObject.
- */
-#define GTK_IS_OBJECT(obj) (GTK_CHECK_TYPE ((obj), gtk_object_get_type ()))
-
-
-typedef struct _GtkObjectClass GtkObjectClass;
-
-
-/* GtkObject is the base of the object hierarchy. It defines
- * the few basic items that all derived classes contain.
- */
-struct _GtkObject
-{
- /* A pointer to the objects class. This will actually point to
- * the derived objects class struct (which will be derived from
- * GtkObjectClass).
- */
- GtkObjectClass *klass;
-
- /* 32 bits of flags. GtkObject only uses 4 of these bits and
- * GtkWidget uses the rest. This is done because structs are
- * aligned on 4 or 8 byte boundaries. If a new bitfield were
- * used in GtkWidget much space would be wasted.
- */
- guint32 flags;
-
- /* reference count.
- * refer to the file REFCOUNTING on this issue.
- */
- guint ref_count;
-
- /* The list of signal handlers and other data
- * fields for this object.
- */
- gpointer object_data;
-};
-
-/* GtkObjectClass is the base of the class hierarchy. It defines
- * the basic necessities for the class mechanism to work. Namely,
- * the "type", "signals" and "nsignals" fields.
- */
-struct _GtkObjectClass
-{
- /* The type identifier for the objects class. There is
- * one unique identifier per class.
- */
- GtkType type;
-
- /* The signals this object class handles. "signals" is an
- * array of signal ID's.
- */
- guint *signals;
-
- /* The number of signals listed in "signals".
- */
- guint nsignals;
-
- /* The number of arguments per class.
- */
- guint n_args;
-
- /* The destroy function for objects. In one way ore another
- * this is defined for all objects. If an object class overrides
- * this method in order to perform class specific destruction
- * then it should still call it after it is finished with its
- * own cleanup. (See the destroy function for GtkWidget for
- * an example of how to do this).
- */
- void (* destroy) (GtkObject *object);
-
- void (* finalize) (GtkObject *object);
-};
-
-
-/* For the purpose of user signals we need the signal function
- * and signal marshaller signatures already in this place.
- */
-#define GTK_SIGNAL_FUNC(f) ((GtkSignalFunc) f)
-
-typedef void (*GtkSignalFunc) (void);
-typedef void (*GtkSignalMarshaller) (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-
-/* Get the type identifier for GtkObject's.
- */
-guint gtk_object_get_type (void);
-
-/* Append "signals" to those already defined in "class".
- */
-void gtk_object_class_add_signals (GtkObjectClass *klass,
- guint *signals,
- guint nsignals);
-
-/* Append a user defined signal without default handler to a class.
- */
-guint gtk_object_class_add_user_signal (GtkObjectClass *klass,
- const gchar *name,
- GtkSignalMarshaller marshaller,
- GtkType return_val,
- guint nparams,
- ...);
-
-GtkObject* gtk_object_new (GtkType type,
- ...);
-
-GtkObject* gtk_object_newv (GtkType type,
- guint nargs,
- GtkArg *args);
-void gtk_object_sink (GtkObject *object);
-void gtk_object_ref (GtkObject *object);
-void gtk_object_unref (GtkObject *object);
-
-void gtk_object_weakref (GtkObject *object,
- GtkDestroyNotify notify,
- gpointer data);
-void gtk_object_weakunref (GtkObject *object,
- GtkDestroyNotify notify,
- gpointer data);
-
-void gtk_object_destroy (GtkObject *object);
-
-/* gtk_object_getv() sets an arguments type and value, or just
- * its type to GTK_TYPE_INVALID.
- * if arg->type == GTK_TYPE_STRING, it's the callers response to
- * do a g_free (GTK_VALUE_STRING (arg));
- */
-void gtk_object_getv (GtkObject *object,
- guint nargs,
- GtkArg *args);
-
-/* gtk_object_set() takes a variable argument list of the form:
- * (..., gchar *arg_name, ARG_VALUES, [repeatedly name/value pairs,] NULL)
- * where ARG_VALUES type depend on the argument and can consist of
- * more than one c-function argument.
- */
-void gtk_object_set (GtkObject *object,
- ...);
-
-void gtk_object_setv (GtkObject *object,
- guint nargs,
- GtkArg *args);
-
-/* Allocate a GtkArg array of size nargs that hold the
- * names and types of the args that can be used with
- * gtk_object_set/gtk_object_get. if (arg_flags!=NULL),
- * (*arg_flags) will be set to point to a newly allocated
- * guint array that holds the flags of the args.
- * It is the callers response to do a
- * g_free (returned_args); g_free (*acess_masks).
- */
-GtkArg* gtk_object_query_args (GtkType class_type,
- guint32 **arg_flags,
- guint *nargs);
-
-void gtk_object_add_arg_type (const gchar *arg_name,
- GtkType arg_type,
- guint arg_flags,
- guint arg_id);
-
-GtkType gtk_object_get_arg_type (const gchar *arg_name);
-
-/* Set 'data' to the "object_data" field of the object. The
- * data is indexed by the "key". If there is already data
- * associated with "key" then the new data will replace it.
- * If 'data' is NULL then this call is equivalent to
- * 'gtk_object_remove_data'.
- */
-void gtk_object_set_data (GtkObject *object,
- const gchar *key,
- gpointer data);
-
-/* Like gtk_object_set_data, but takes an additional argument
- * which is a function to be called when the data is removed
- */
-void gtk_object_set_data_full (GtkObject *object,
- const gchar *key,
- gpointer data,
- GtkDestroyNotify destroy);
-
-/* Get the data associated with "key".
- */
-gpointer gtk_object_get_data (GtkObject *object,
- const gchar *key);
-
-/* Remove the data associated with "key". This call is
- * equivalent to 'gtk_object_set_data' where 'data' is NULL.
- */
-void gtk_object_remove_data (GtkObject *object,
- const gchar *key);
-
-/* Set the "user_data" object data field of "object". It should
- * be noted that this is no different than calling 'gtk_object_set_data'
- * with a key of "user_data". It is merely provided as a convenience.
- */
-void gtk_object_set_user_data (GtkObject *object,
- gpointer data);
-
-/* Get the "user_data" object data field of "object". It should
- * be noted that this is no different than calling 'gtk_object_get_data'
- * with a key of "user_data". It is merely provided as a convenience.
- */
-gpointer gtk_object_get_user_data (GtkObject *object);
-
-GtkObject* gtk_object_check_cast (GtkObject *obj,
- GtkType cast_type);
-
-GtkObjectClass* gtk_object_check_class_cast (GtkObjectClass *klass,
- GtkType cast_type);
-
-void gtk_trace_referencing (gpointer *object,
- const gchar *func,
- guint local_frame,
- guint line,
- gboolean do_ref);
-
-#if G_ENABLE_DEBUG && defined (__GNUC__)
-# define gtk_object_ref(o) G_STMT_START{static guint f=0;gtk_trace_referencing((gpointer)o,__PRETTY_FUNCTION__,++f,__LINE__, 1);f--;}G_STMT_END
-# define gtk_object_unref(o) G_STMT_START{static guint f=0;gtk_trace_referencing((gpointer)o,__PRETTY_FUNCTION__,++f,__LINE__, 0);f--;}G_STMT_END
-#endif /* G_ENABLE_DEBUG && __GNUC__ */
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_OBJECT_H__ */
diff --git a/gtk/gtkoptionmenu.c b/gtk/gtkoptionmenu.c
deleted file mode 100644
index 0cadce7d5f..0000000000
--- a/gtk/gtkoptionmenu.c
+++ /dev/null
@@ -1,643 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkmenu.h"
-#include "gtkmenuitem.h"
-#include "gtkoptionmenu.h"
-#include "gtksignal.h"
-
-
-#define CHILD_LEFT_SPACING 5
-#define CHILD_RIGHT_SPACING 1
-#define CHILD_TOP_SPACING 1
-#define CHILD_BOTTOM_SPACING 1
-#define OPTION_INDICATOR_WIDTH 12
-#define OPTION_INDICATOR_HEIGHT 8
-#define OPTION_INDICATOR_SPACING 2
-
-
-static void gtk_option_menu_class_init (GtkOptionMenuClass *klass);
-static void gtk_option_menu_init (GtkOptionMenu *option_menu);
-static void gtk_option_menu_destroy (GtkObject *object);
-static void gtk_option_menu_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_option_menu_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_option_menu_paint (GtkWidget *widget,
- GdkRectangle *area);
-static void gtk_option_menu_draw (GtkWidget *widget,
- GdkRectangle *area);
-static gint gtk_option_menu_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static gint gtk_option_menu_button_press (GtkWidget *widget,
- GdkEventButton *event);
-static void gtk_option_menu_deactivate (GtkMenuShell *menu_shell,
- GtkOptionMenu *option_menu);
-static void gtk_option_menu_update_contents (GtkOptionMenu *option_menu);
-static void gtk_option_menu_remove_contents (GtkOptionMenu *option_menu);
-static void gtk_option_menu_calc_size (GtkOptionMenu *option_menu);
-static void gtk_option_menu_position (GtkMenu *menu,
- gint *x,
- gint *y,
- gpointer user_data);
-static void gtk_option_menu_show_all (GtkWidget *widget);
-static void gtk_option_menu_hide_all (GtkWidget *widget);
-
-
-static GtkButtonClass *parent_class = NULL;
-
-
-guint
-gtk_option_menu_get_type ()
-{
- static guint option_menu_type = 0;
-
- if (!option_menu_type)
- {
- GtkTypeInfo option_menu_info =
- {
- "GtkOptionMenu",
- sizeof (GtkOptionMenu),
- sizeof (GtkOptionMenuClass),
- (GtkClassInitFunc) gtk_option_menu_class_init,
- (GtkObjectInitFunc) gtk_option_menu_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- option_menu_type = gtk_type_unique (gtk_button_get_type (), &option_menu_info);
- }
-
- return option_menu_type;
-}
-
-static void
-gtk_option_menu_class_init (GtkOptionMenuClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkButtonClass *button_class;
-
- object_class = (GtkObjectClass*) class;
- widget_class = (GtkWidgetClass*) class;
- button_class = (GtkButtonClass*) class;
-
- parent_class = gtk_type_class (gtk_button_get_type ());
-
- object_class->destroy = gtk_option_menu_destroy;
-
- widget_class->draw = gtk_option_menu_draw;
- widget_class->draw_focus = NULL;
- widget_class->size_request = gtk_option_menu_size_request;
- widget_class->size_allocate = gtk_option_menu_size_allocate;
- widget_class->expose_event = gtk_option_menu_expose;
- widget_class->button_press_event = gtk_option_menu_button_press;
- widget_class->show_all = gtk_option_menu_show_all;
- widget_class->hide_all = gtk_option_menu_hide_all;
-}
-
-static void
-gtk_option_menu_init (GtkOptionMenu *option_menu)
-{
- GTK_WIDGET_UNSET_FLAGS (option_menu, GTK_CAN_FOCUS);
-
- option_menu->menu = NULL;
- option_menu->menu_item = NULL;
- option_menu->width = 0;
- option_menu->height = 0;
-}
-
-GtkWidget*
-gtk_option_menu_new ()
-{
- return GTK_WIDGET (gtk_type_new (gtk_option_menu_get_type ()));
-}
-
-GtkWidget*
-gtk_option_menu_get_menu (GtkOptionMenu *option_menu)
-{
- g_return_val_if_fail (option_menu != NULL, NULL);
- g_return_val_if_fail (GTK_IS_OPTION_MENU (option_menu), NULL);
-
- return option_menu->menu;
-}
-
-static void
-gtk_option_menu_detacher (GtkWidget *widget,
- GtkMenu *menu)
-{
- GtkOptionMenu *option_menu;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_OPTION_MENU (widget));
-
- option_menu = GTK_OPTION_MENU (widget);
- g_return_if_fail (option_menu->menu == (GtkWidget*) menu);
-
- gtk_option_menu_remove_contents (option_menu);
- gtk_signal_disconnect_by_data (GTK_OBJECT (option_menu->menu),
- option_menu);
-
- option_menu->menu = NULL;
-}
-
-void
-gtk_option_menu_set_menu (GtkOptionMenu *option_menu,
- GtkWidget *menu)
-{
- g_return_if_fail (option_menu != NULL);
- g_return_if_fail (GTK_IS_OPTION_MENU (option_menu));
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
-
- if (option_menu->menu != menu)
- {
- gtk_option_menu_remove_menu (option_menu);
-
- option_menu->menu = menu;
- gtk_menu_attach_to_widget (GTK_MENU (menu),
- GTK_WIDGET (option_menu),
- gtk_option_menu_detacher);
-
- gtk_option_menu_calc_size (option_menu);
-
- gtk_signal_connect (GTK_OBJECT (option_menu->menu), "deactivate",
- (GtkSignalFunc) gtk_option_menu_deactivate,
- option_menu);
-
- if (GTK_WIDGET (option_menu)->parent)
- gtk_widget_queue_resize (GTK_WIDGET (option_menu));
-
- gtk_option_menu_update_contents (option_menu);
- }
-}
-
-void
-gtk_option_menu_remove_menu (GtkOptionMenu *option_menu)
-{
- g_return_if_fail (option_menu != NULL);
- g_return_if_fail (GTK_IS_OPTION_MENU (option_menu));
-
- if (option_menu->menu)
- gtk_menu_detach (GTK_MENU (option_menu->menu));
-}
-
-void
-gtk_option_menu_set_history (GtkOptionMenu *option_menu,
- guint index)
-{
- GtkWidget *menu_item;
-
- g_return_if_fail (option_menu != NULL);
- g_return_if_fail (GTK_IS_OPTION_MENU (option_menu));
-
- if (option_menu->menu)
- {
- gtk_menu_set_active (GTK_MENU (option_menu->menu), index);
- menu_item = gtk_menu_get_active (GTK_MENU (option_menu->menu));
-
- if (menu_item != option_menu->menu_item)
- {
- gtk_option_menu_remove_contents (option_menu);
- gtk_option_menu_update_contents (option_menu);
- }
- }
-}
-
-
-static void
-gtk_option_menu_destroy (GtkObject *object)
-{
- GtkOptionMenu *option_menu;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_OPTION_MENU (object));
-
- option_menu = GTK_OPTION_MENU (object);
-
- if (option_menu->menu)
- gtk_widget_destroy (option_menu->menu);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-static void
-gtk_option_menu_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkOptionMenu *option_menu;
- gint tmp;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_OPTION_MENU (widget));
- g_return_if_fail (requisition != NULL);
-
- option_menu = GTK_OPTION_MENU (widget);
-
- requisition->width = ((GTK_CONTAINER (widget)->border_width +
- GTK_WIDGET (widget)->style->klass->xthickness) * 2 +
- option_menu->width +
- OPTION_INDICATOR_WIDTH +
- OPTION_INDICATOR_SPACING * 5 +
- CHILD_LEFT_SPACING + CHILD_RIGHT_SPACING);
- requisition->height = ((GTK_CONTAINER (widget)->border_width +
- GTK_WIDGET (widget)->style->klass->ythickness) * 2 +
- option_menu->height +
- CHILD_TOP_SPACING + CHILD_BOTTOM_SPACING);
-
- tmp = (requisition->height - option_menu->height +
- OPTION_INDICATOR_HEIGHT + OPTION_INDICATOR_SPACING * 2);
- requisition->height = MAX (requisition->height, tmp);
-}
-
-static void
-gtk_option_menu_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkWidget *child;
- GtkAllocation child_allocation;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_OPTION_MENU (widget));
- g_return_if_fail (allocation != NULL);
-
- widget->allocation = *allocation;
- if (GTK_WIDGET_REALIZED (widget))
- gdk_window_move_resize (widget->window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
-
- child = GTK_BUTTON (widget)->child;
- if (child && GTK_WIDGET_VISIBLE (child))
- {
- child_allocation.x = (GTK_CONTAINER (widget)->border_width +
- GTK_WIDGET (widget)->style->klass->xthickness);
- child_allocation.y = (GTK_CONTAINER (widget)->border_width +
- GTK_WIDGET (widget)->style->klass->ythickness);
- child_allocation.width = (allocation->width - child_allocation.x * 2 -
- OPTION_INDICATOR_WIDTH - OPTION_INDICATOR_SPACING * 5 -
- CHILD_LEFT_SPACING - CHILD_RIGHT_SPACING);
- child_allocation.height = (allocation->height - child_allocation.y * 2 -
- CHILD_TOP_SPACING - CHILD_BOTTOM_SPACING);
- child_allocation.x += CHILD_LEFT_SPACING;
- child_allocation.y += CHILD_RIGHT_SPACING;
-
- gtk_widget_size_allocate (child, &child_allocation);
- }
-}
-
-static void
-gtk_option_menu_paint (GtkWidget *widget,
- GdkRectangle *area)
-{
- GdkRectangle restrict_area;
- GdkRectangle new_area;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_OPTION_MENU (widget));
- g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- restrict_area.x = GTK_CONTAINER (widget)->border_width;
- restrict_area.y = GTK_CONTAINER (widget)->border_width;
- restrict_area.width = widget->allocation.width - restrict_area.x * 2;
- restrict_area.height = widget->allocation.height - restrict_area.y * 2;
-
- if (gdk_rectangle_intersect (area, &restrict_area, &new_area))
- {
- gtk_style_set_background (widget->style, widget->window, GTK_WIDGET_STATE (widget));
- gdk_window_clear_area (widget->window,
- new_area.x, new_area.y,
- new_area.width, new_area.height);
-
- gtk_draw_shadow (widget->style, widget->window,
- GTK_WIDGET_STATE (widget), GTK_SHADOW_OUT,
- restrict_area.x, restrict_area.y,
- restrict_area.width, restrict_area.height);
-
- gtk_draw_shadow (widget->style, widget->window,
- GTK_WIDGET_STATE (widget), GTK_SHADOW_OUT,
- restrict_area.x + restrict_area.width - restrict_area.x -
- OPTION_INDICATOR_WIDTH - OPTION_INDICATOR_SPACING * 4,
- restrict_area.y + (restrict_area.height - OPTION_INDICATOR_HEIGHT) / 2,
- OPTION_INDICATOR_WIDTH, OPTION_INDICATOR_HEIGHT);
- }
- }
-}
-
-static void
-gtk_option_menu_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkWidget *child;
- GdkRectangle child_area;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_OPTION_MENU (widget));
- g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- gtk_option_menu_paint (widget, area);
-
- child = GTK_BUTTON (widget)->child;
- if (child && gtk_widget_intersect (child, area, &child_area))
- gtk_widget_draw (child, &child_area);
- }
-}
-
-static gint
-gtk_option_menu_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkWidget *child;
- GdkEventExpose child_event;
- gint remove_child;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_OPTION_MENU (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- gtk_option_menu_paint (widget, &event->area);
-
- remove_child = FALSE;
- child = GTK_BUTTON (widget)->child;
-
- if (!child)
- {
- if (!GTK_OPTION_MENU (widget)->menu)
- return FALSE;
- gtk_option_menu_update_contents (GTK_OPTION_MENU (widget));
- child = GTK_BUTTON (widget)->child;
- if (!child)
- return FALSE;
- remove_child = TRUE;
- }
-
- child_event = *event;
-
- if (GTK_WIDGET_NO_WINDOW (child) &&
- gtk_widget_intersect (child, &event->area, &child_event.area))
- gtk_widget_event (child, (GdkEvent*) &child_event);
-
- if (remove_child)
- gtk_option_menu_remove_contents (GTK_OPTION_MENU (widget));
- }
-
- return FALSE;
-}
-
-static gint
-gtk_option_menu_button_press (GtkWidget *widget,
- GdkEventButton *event)
-{
- GtkOptionMenu *option_menu;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_OPTION_MENU (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if ((event->type == GDK_BUTTON_PRESS) &&
- (event->button == 1))
- {
- option_menu = GTK_OPTION_MENU (widget);
- gtk_option_menu_remove_contents (option_menu);
- gtk_menu_popup (GTK_MENU (option_menu->menu), NULL, NULL,
- gtk_option_menu_position, option_menu,
- event->button, event->time);
- }
-
- return FALSE;
-}
-
-static void
-gtk_option_menu_deactivate (GtkMenuShell *menu_shell,
- GtkOptionMenu *option_menu)
-{
- g_return_if_fail (menu_shell != NULL);
- g_return_if_fail (option_menu != NULL);
- g_return_if_fail (GTK_IS_OPTION_MENU (option_menu));
-
- gtk_option_menu_update_contents (option_menu);
-}
-
-static void
-gtk_option_menu_update_contents (GtkOptionMenu *option_menu)
-{
- GtkWidget *child;
-
- g_return_if_fail (option_menu != NULL);
- g_return_if_fail (GTK_IS_OPTION_MENU (option_menu));
-
- if (option_menu->menu)
- {
- gtk_option_menu_remove_contents (option_menu);
-
- option_menu->menu_item = gtk_menu_get_active (GTK_MENU (option_menu->menu));
- if (option_menu->menu_item)
- {
- gtk_widget_ref (option_menu->menu_item);
- child = GTK_BIN (option_menu->menu_item)->child;
- if (child)
- {
- gtk_container_block_resize (GTK_CONTAINER (option_menu));
- if (GTK_BUTTON (option_menu)->child)
- gtk_container_remove (GTK_CONTAINER (option_menu),
- GTK_BUTTON (option_menu)->child);
- if (GTK_WIDGET (option_menu)->state != child->state)
- gtk_widget_set_state (child, GTK_WIDGET (option_menu)->state);
- gtk_widget_reparent (child, GTK_WIDGET (option_menu));
- gtk_container_unblock_resize (GTK_CONTAINER (option_menu));
- }
-
- gtk_widget_size_request (child, &child->requisition);
- gtk_widget_size_allocate (GTK_WIDGET (option_menu),
- &(GTK_WIDGET (option_menu)->allocation));
-
- if (GTK_WIDGET_DRAWABLE (option_menu))
- gtk_widget_queue_draw (GTK_WIDGET (option_menu));
- }
- }
-}
-
-static void
-gtk_option_menu_remove_contents (GtkOptionMenu *option_menu)
-{
- g_return_if_fail (option_menu != NULL);
- g_return_if_fail (GTK_IS_OPTION_MENU (option_menu));
-
- if (GTK_BUTTON (option_menu)->child)
- {
- gtk_container_block_resize (GTK_CONTAINER (option_menu));
- if (GTK_WIDGET (option_menu->menu_item)->state != GTK_BUTTON (option_menu)->child->state)
- gtk_widget_set_state (GTK_BUTTON (option_menu)->child,
- GTK_WIDGET (option_menu->menu_item)->state);
- gtk_widget_unrealize (GTK_BUTTON (option_menu)->child);
- gtk_widget_reparent (GTK_BUTTON (option_menu)->child, option_menu->menu_item);
- gtk_widget_unref (option_menu->menu_item);
- option_menu->menu_item = NULL;
- gtk_container_unblock_resize (GTK_CONTAINER (option_menu));
- }
-}
-
-static void
-gtk_option_menu_calc_size (GtkOptionMenu *option_menu)
-{
- GtkWidget *child;
- GList *children;
-
- g_return_if_fail (option_menu != NULL);
- g_return_if_fail (GTK_IS_OPTION_MENU (option_menu));
-
- option_menu->width = 0;
- option_menu->height = 0;
-
- if (option_menu->menu)
- {
- children = GTK_MENU_SHELL (option_menu->menu)->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child))
- {
- gtk_widget_size_request (child, &child->requisition);
-
- option_menu->width = MAX (option_menu->width, child->requisition.width);
- option_menu->height = MAX (option_menu->height, child->requisition.height);
- }
- }
- }
-}
-
-static void
-gtk_option_menu_position (GtkMenu *menu,
- gint *x,
- gint *y,
- gpointer user_data)
-{
- GtkOptionMenu *option_menu;
- GtkWidget *active;
- GtkWidget *child;
- GList *children;
- gint shift_menu;
- gint screen_width;
- gint screen_height;
- gint menu_xpos;
- gint menu_ypos;
- gint width;
- gint height;
-
- g_return_if_fail (user_data != NULL);
- g_return_if_fail (GTK_IS_OPTION_MENU (user_data));
-
- option_menu = GTK_OPTION_MENU (user_data);
-
- width = GTK_WIDGET (menu)->allocation.width;
- height = GTK_WIDGET (menu)->allocation.height;
-
- active = gtk_menu_get_active (GTK_MENU (option_menu->menu));
- children = GTK_MENU_SHELL (option_menu->menu)->children;
- gdk_window_get_origin (GTK_WIDGET (option_menu)->window, &menu_xpos, &menu_ypos);
-
- menu_ypos += GTK_WIDGET (option_menu)->allocation.height / 2 - 2;
-
- if (active != NULL)
- menu_ypos -= active->requisition.height / 2;
-
- while (children)
- {
- child = children->data;
-
- if (active == child)
- break;
-
- menu_ypos -= child->allocation.height;
- children = children->next;
- }
-
- screen_width = gdk_screen_width ();
- screen_height = gdk_screen_height ();
-
- shift_menu = FALSE;
- if (menu_ypos < 0)
- {
- menu_ypos = 0;
- shift_menu = TRUE;
- }
- else if ((menu_ypos + height) > screen_height)
- {
- menu_ypos -= ((menu_ypos + height) - screen_height);
- shift_menu = TRUE;
- }
-
- if (shift_menu)
- {
- if ((menu_xpos + GTK_WIDGET (option_menu)->allocation.width + width) <= screen_width)
- menu_xpos += GTK_WIDGET (option_menu)->allocation.width;
- else
- menu_xpos -= width;
- }
-
- if (menu_xpos < 0)
- menu_xpos = 0;
- else if ((menu_xpos + width) > screen_width)
- menu_xpos -= ((menu_xpos + width) - screen_width);
-
- *x = menu_xpos;
- *y = menu_ypos;
-}
-
-
-static void
-gtk_option_menu_show_all (GtkWidget *widget)
-{
- GtkContainer *container;
- GtkOptionMenu *option_menu;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_OPTION_MENU (widget));
- container = GTK_CONTAINER (widget);
- option_menu = GTK_OPTION_MENU (widget);
-
- gtk_widget_show (widget);
- gtk_container_foreach (container, (GtkCallback) gtk_widget_show_all, NULL);
- if (option_menu->menu)
- gtk_widget_show_all (option_menu->menu);
- if (option_menu->menu_item)
- gtk_widget_show_all (option_menu->menu_item);
-}
-
-
-static void
-gtk_option_menu_hide_all (GtkWidget *widget)
-{
- GtkContainer *container;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_OPTION_MENU (widget));
- container = GTK_CONTAINER (widget);
-
- gtk_widget_hide (widget);
- gtk_container_foreach (container, (GtkCallback) gtk_widget_hide_all, NULL);
-}
-
diff --git a/gtk/gtkoptionmenu.h b/gtk/gtkoptionmenu.h
deleted file mode 100644
index f8e9e5b6db..0000000000
--- a/gtk/gtkoptionmenu.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_OPTION_MENU_H__
-#define __GTK_OPTION_MENU_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkbutton.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_OPTION_MENU(obj) GTK_CHECK_CAST (obj, gtk_option_menu_get_type (), GtkOptionMenu)
-#define GTK_OPTION_MENU_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_option_menu_get_type (), GtkOptionMenuClass)
-#define GTK_IS_OPTION_MENU(obj) GTK_CHECK_TYPE (obj, gtk_option_menu_get_type ())
-
-
-typedef struct _GtkOptionMenu GtkOptionMenu;
-typedef struct _GtkOptionMenuClass GtkOptionMenuClass;
-
-struct _GtkOptionMenu
-{
- GtkButton button;
-
- GtkWidget *menu;
- GtkWidget *menu_item;
-
- guint16 width;
- guint16 height;
-};
-
-struct _GtkOptionMenuClass
-{
- GtkButtonClass parent_class;
-};
-
-
-guint gtk_option_menu_get_type (void);
-GtkWidget* gtk_option_menu_new (void);
-GtkWidget* gtk_option_menu_get_menu (GtkOptionMenu *option_menu);
-void gtk_option_menu_set_menu (GtkOptionMenu *option_menu,
- GtkWidget *menu);
-void gtk_option_menu_remove_menu (GtkOptionMenu *option_menu);
-void gtk_option_menu_set_history (GtkOptionMenu *option_menu,
- guint index);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_OPTION_MENU_H__ */
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
deleted file mode 100644
index b9b32ae9d6..0000000000
--- a/gtk/gtkpaned.c
+++ /dev/null
@@ -1,420 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkpaned.h"
-
-
-static void gtk_paned_class_init (GtkPanedClass *klass);
-static void gtk_paned_init (GtkPaned *paned);
-static void gtk_paned_realize (GtkWidget *widget);
-static void gtk_paned_map (GtkWidget *widget);
-static void gtk_paned_unmap (GtkWidget *widget);
-static void gtk_paned_unrealize (GtkWidget *widget);
-static gint gtk_paned_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static void gtk_paned_add (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_paned_remove (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_paned_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data);
-
-
-static GtkContainerClass *parent_class = NULL;
-
-
-guint
-gtk_paned_get_type ()
-{
- static guint paned_type = 0;
-
- if (!paned_type)
- {
- GtkTypeInfo paned_info =
- {
- "GtkPaned",
- sizeof (GtkPaned),
- sizeof (GtkPanedClass),
- (GtkClassInitFunc) gtk_paned_class_init,
- (GtkObjectInitFunc) gtk_paned_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- paned_type = gtk_type_unique (gtk_container_get_type (), &paned_info);
- }
-
- return paned_type;
-}
-
-static void
-gtk_paned_class_init (GtkPanedClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GtkObjectClass*) class;
- widget_class = (GtkWidgetClass*) class;
- container_class = (GtkContainerClass*) class;
-
- parent_class = gtk_type_class (gtk_container_get_type ());
-
- widget_class->realize = gtk_paned_realize;
- widget_class->map = gtk_paned_map;
- widget_class->unmap = gtk_paned_unmap;
- widget_class->unrealize = gtk_paned_unrealize;
- widget_class->expose_event = gtk_paned_expose;
-
- container_class->add = gtk_paned_add;
- container_class->remove = gtk_paned_remove;
- container_class->foreach = gtk_paned_foreach;
-}
-
-static void
-gtk_paned_init (GtkPaned *paned)
-{
- GTK_WIDGET_UNSET_FLAGS (paned, GTK_NO_WINDOW);
-
- paned->child1 = NULL;
- paned->child2 = NULL;
- paned->handle = NULL;
- paned->xor_gc = NULL;
-
- paned->handle_size = 10;
- paned->gutter_size = 6;
- paned->position_set = FALSE;
- paned->in_drag = FALSE;
-
- paned->handle_xpos = -1;
- paned->handle_ypos = -1;
-}
-
-
-static void
-gtk_paned_realize (GtkWidget *widget)
-{
- GtkPaned *paned;
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_PANED (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
- paned = GTK_PANED (widget);
-
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
- &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, paned);
-
- attributes.x = paned->handle_xpos;
- attributes.y = paned->handle_ypos;
- attributes.width = paned->handle_size;
- attributes.height = paned->handle_size;
- attributes.cursor = paned->cursor = gdk_cursor_new (GDK_CROSS);
- attributes.event_mask |= (GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_POINTER_MOTION_MASK |
- GDK_POINTER_MOTION_HINT_MASK);
- attributes_mask |= GDK_WA_CURSOR;
-
- paned->handle = gdk_window_new (widget->window,
- &attributes, attributes_mask);
- gdk_window_set_user_data (paned->handle, paned);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
-
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
- gtk_style_set_background (widget->style, paned->handle, GTK_STATE_NORMAL);
-
- gdk_window_show (paned->handle);
-}
-
-static void
-gtk_paned_map (GtkWidget *widget)
-{
- GtkPaned *paned;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_PANED (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
- paned = GTK_PANED (widget);
-
- gdk_window_show (widget->window);
-
- if (paned->child1 &&
- GTK_WIDGET_VISIBLE (paned->child1) &&
- !GTK_WIDGET_MAPPED (paned->child1))
- gtk_widget_map (paned->child1);
- if (paned->child2 &&
- GTK_WIDGET_VISIBLE (paned->child2) &&
- !GTK_WIDGET_MAPPED (paned->child2))
- gtk_widget_map (paned->child2);
-}
-
-static void
-gtk_paned_unmap (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_PANED (widget));
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
-
- gdk_window_hide (widget->window);
-}
-
-static void
-gtk_paned_unrealize (GtkWidget *widget)
-{
- GtkPaned *paned;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_PANED (widget));
-
- paned = GTK_PANED (widget);
-
- if (paned->xor_gc)
- {
- gdk_gc_destroy (paned->xor_gc);
- paned->xor_gc = NULL;
- }
-
- if (paned->handle)
- {
- gdk_window_set_user_data (paned->handle, NULL);
- gdk_window_destroy (paned->handle);
- paned->handle = NULL;
- gdk_cursor_destroy (paned->cursor);
- paned->cursor = NULL;
- }
-
- if (GTK_WIDGET_CLASS (parent_class)->unrealize)
- (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
-}
-
-static gint
-gtk_paned_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkPaned *paned;
- GdkEventExpose child_event;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_PANED (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- paned = GTK_PANED (widget);
-
- /* An expose event for the handle */
- if (event->window == paned->handle)
- {
- gdk_window_set_background (paned->handle,
- &widget->style->bg[widget->state]);
- gdk_window_clear (paned->handle);
- gtk_draw_shadow (widget->style, paned->handle,
- GTK_WIDGET_STATE(widget),
- GTK_SHADOW_OUT, 0, 0,
- paned->handle_size, paned->handle_size);
- }
- else
- {
- child_event = *event;
- if (paned->child1 &&
- GTK_WIDGET_NO_WINDOW (paned->child1) &&
- gtk_widget_intersect (paned->child1, &event->area, &child_event.area))
- gtk_widget_event (paned->child1, (GdkEvent*) &child_event);
-
- if (paned->child2 &&
- GTK_WIDGET_NO_WINDOW (paned->child2) &&
- gtk_widget_intersect (paned->child2, &event->area, &child_event.area))
- gtk_widget_event (paned->child2, (GdkEvent*) &child_event);
-
- /* redraw the groove if necessary */
- child_event.area = paned->groove_rectangle;
- if (gtk_widget_intersect (widget, &event->area, &child_event.area))
- gtk_widget_draw (widget, &child_event.area);
- }
- }
- return FALSE;
-}
-
-void
-gtk_paned_add1 (GtkPaned *paned,
- GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
-
- if (!paned->child1)
- {
- gtk_widget_set_parent (widget, GTK_WIDGET (paned));
-
- if (GTK_WIDGET_VISIBLE (widget->parent))
- {
- if (GTK_WIDGET_REALIZED (widget->parent) &&
- !GTK_WIDGET_REALIZED (widget))
- gtk_widget_realize (widget);
-
- if (GTK_WIDGET_MAPPED (widget->parent) &&
- !GTK_WIDGET_MAPPED (widget))
- gtk_widget_map (widget);
- }
-
- paned->child1 = widget;
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (paned))
- gtk_widget_queue_resize (widget);
- }
-}
-
-void
-gtk_paned_add2 (GtkPaned *paned,
- GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
-
- if (!paned->child2)
- {
- gtk_widget_set_parent (widget, GTK_WIDGET (paned));
-
- if (GTK_WIDGET_VISIBLE (widget->parent))
- {
- if (GTK_WIDGET_REALIZED (widget->parent) &&
- !GTK_WIDGET_REALIZED (widget))
- gtk_widget_realize (widget);
-
- if (GTK_WIDGET_MAPPED (widget->parent) &&
- !GTK_WIDGET_MAPPED (widget))
- gtk_widget_map (widget);
- }
-
- paned->child2 = widget;
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (paned))
- gtk_widget_queue_resize (widget);
- }
-}
-
-static void
-gtk_paned_add (GtkContainer *container,
- GtkWidget *widget)
-{
- GtkPaned *paned;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_PANED (container));
- g_return_if_fail (widget != NULL);
-
- paned = GTK_PANED (container);
-
- if (!paned->child1)
- gtk_paned_add1 (GTK_PANED (container),widget);
- else if (!paned->child2)
- gtk_paned_add2 (GTK_PANED (container),widget);
-}
-
-static void
-gtk_paned_remove (GtkContainer *container,
- GtkWidget *widget)
-{
- GtkPaned *paned;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_PANED (container));
- g_return_if_fail (widget != NULL);
-
- paned = GTK_PANED (container);
-
- if (paned->child1 == widget)
- {
- gtk_widget_unparent (widget);
-
- paned->child1 = NULL;
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (container))
- gtk_widget_queue_resize (GTK_WIDGET (container));
- }
- else if (paned->child2 == widget)
- {
- gtk_widget_unparent (widget);
-
- paned->child2 = NULL;
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (container))
- gtk_widget_queue_resize (GTK_WIDGET (container));
- }
-}
-
-static void
-gtk_paned_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
-{
- GtkPaned *paned;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_PANED (container));
- g_return_if_fail (callback != NULL);
-
- paned = GTK_PANED (container);
-
- if (paned->child1)
- (* callback) (paned->child1, callback_data);
- if (paned->child2)
- (* callback) (paned->child2, callback_data);
-}
-
-void
-gtk_paned_handle_size (GtkPaned *paned, guint16 size)
-{
- gint x,y;
-
- if (paned->handle)
- {
- gdk_window_get_geometry (paned->handle, &x, &y, NULL, NULL, NULL);
- gdk_window_move_resize (paned->handle,
- x + paned->handle_size / 2 - size / 2,
- y + paned->handle_size / 2 - size / 2,
- size, size);
- }
-
- paned->handle_size = size;
-}
-
-void
-gtk_paned_gutter_size (GtkPaned *paned, guint16 size)
-{
- paned->gutter_size = size;
-
- if (GTK_WIDGET_VISIBLE (GTK_WIDGET (paned)))
- gtk_widget_queue_resize (GTK_WIDGET (paned));
-}
diff --git a/gtk/gtkpaned.h b/gtk/gtkpaned.h
deleted file mode 100644
index db9376e0a5..0000000000
--- a/gtk/gtkpaned.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_PANED_H__
-#define __GTK_PANED_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkcontainer.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_PANED(obj) GTK_CHECK_CAST (obj, gtk_paned_get_type (), GtkPaned)
-#define GTK_PANED_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_paned_get_type (), GtkPanedClass)
-#define GTK_IS_PANED(obj) GTK_CHECK_TYPE (obj, gtk_paned_get_type ())
-
-
-typedef struct _GtkPaned GtkPaned;
-typedef struct _GtkPanedClass GtkPanedClass;
-
-struct _GtkPaned
-{
- GtkContainer container;
-
- GtkWidget *child1;
- GtkWidget *child2;
-
- GdkWindow *handle;
- GdkCursor *cursor;
- GdkRectangle groove_rectangle;
- GdkGC *xor_gc;
-
- guint16 handle_size;
- guint16 gutter_size;
-
- gint child1_size;
- guint position_set : 1;
- guint in_drag : 1;
-
- gint16 handle_xpos;
- gint16 handle_ypos;
-};
-
-struct _GtkPanedClass
-{
- GtkContainerClass parent_class;
-};
-
-
-guint gtk_paned_get_type (void);
-void gtk_paned_add1 (GtkPaned *paned, GtkWidget *child);
-void gtk_paned_add2 (GtkPaned *paned, GtkWidget *child);
-void gtk_paned_handle_size (GtkPaned *paned, guint16 size);
-void gtk_paned_gutter_size (GtkPaned *paned, guint16 size);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_PANED_H__ */
diff --git a/gtk/gtkpixmap.c b/gtk/gtkpixmap.c
deleted file mode 100644
index b6136c9698..0000000000
--- a/gtk/gtkpixmap.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkcontainer.h"
-#include "gtkpixmap.h"
-
-
-static void gtk_pixmap_class_init (GtkPixmapClass *klass);
-static void gtk_pixmap_init (GtkPixmap *pixmap);
-static gint gtk_pixmap_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static void gtk_pixmap_finalize (GtkObject *object);
-
-static GtkWidgetClass *parent_class;
-
-guint
-gtk_pixmap_get_type ()
-{
- static guint pixmap_type = 0;
-
- if (!pixmap_type)
- {
- GtkTypeInfo pixmap_info =
- {
- "GtkPixmap",
- sizeof (GtkPixmap),
- sizeof (GtkPixmapClass),
- (GtkClassInitFunc) gtk_pixmap_class_init,
- (GtkObjectInitFunc) gtk_pixmap_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- pixmap_type = gtk_type_unique (gtk_misc_get_type (), &pixmap_info);
- }
-
- return pixmap_type;
-}
-
-static void
-gtk_pixmap_class_init (GtkPixmapClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- object_class = (GtkObjectClass*) class;
- widget_class = (GtkWidgetClass*) class;
- parent_class = gtk_type_class (gtk_widget_get_type ());
-
- object_class->finalize = gtk_pixmap_finalize;
- widget_class->expose_event = gtk_pixmap_expose;
-}
-
-static void
-gtk_pixmap_init (GtkPixmap *pixmap)
-{
- GTK_WIDGET_SET_FLAGS (pixmap, GTK_NO_WINDOW);
-
- pixmap->pixmap = NULL;
- pixmap->mask = NULL;
-}
-
-GtkWidget*
-gtk_pixmap_new (GdkPixmap *val,
- GdkBitmap *mask)
-{
- GtkPixmap *pixmap;
-
- g_return_val_if_fail (val != NULL, NULL);
-
- pixmap = gtk_type_new (gtk_pixmap_get_type ());
-
- gtk_pixmap_set (pixmap, val, mask);
-
- return GTK_WIDGET (pixmap);
-}
-
-static void
-gtk_pixmap_finalize (GtkObject *object)
-{
- gtk_pixmap_set (GTK_PIXMAP (object), NULL, NULL);
- (* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-void
-gtk_pixmap_set (GtkPixmap *pixmap,
- GdkPixmap *val,
- GdkBitmap *mask)
-{
- gint width;
- gint height;
-
- g_return_if_fail (pixmap != NULL);
- g_return_if_fail (GTK_IS_PIXMAP (pixmap));
-
- if (pixmap->pixmap != val)
- {
- if (pixmap->pixmap)
- gdk_pixmap_unref (pixmap->pixmap);
- pixmap->pixmap = val;
- if (pixmap->pixmap)
- {
- gdk_pixmap_ref (pixmap->pixmap);
- gdk_window_get_size (pixmap->pixmap, &width, &height);
- GTK_WIDGET (pixmap)->requisition.width =
- width + GTK_MISC (pixmap)->xpad * 2;
- GTK_WIDGET (pixmap)->requisition.height =
- height + GTK_MISC (pixmap)->ypad * 2;
- }
- else
- {
- GTK_WIDGET (pixmap)->requisition.width = 0;
- GTK_WIDGET (pixmap)->requisition.height = 0;
- }
- if (GTK_WIDGET_VISIBLE (pixmap))
- gtk_widget_queue_resize (GTK_WIDGET (pixmap));
- }
-
- if (pixmap->mask != mask)
- {
- if (pixmap->mask)
- gdk_bitmap_unref (pixmap->mask);
- pixmap->mask = mask;
- if (pixmap->mask)
- gdk_bitmap_ref (pixmap->mask);
- }
-}
-
-void
-gtk_pixmap_get (GtkPixmap *pixmap,
- GdkPixmap **val,
- GdkBitmap **mask)
-{
- g_return_if_fail (pixmap != NULL);
- g_return_if_fail (GTK_IS_PIXMAP (pixmap));
-
- if (val)
- *val = pixmap->pixmap;
- if (mask)
- *mask = pixmap->mask;
-}
-
-
-static gint
-gtk_pixmap_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkPixmap *pixmap;
- GtkMisc *misc;
- gint x, y;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_PIXMAP (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- pixmap = GTK_PIXMAP (widget);
- misc = GTK_MISC (widget);
-
- x = (widget->allocation.x * (1.0 - misc->xalign) +
- (widget->allocation.x + widget->allocation.width
- - (widget->requisition.width - misc->xpad * 2)) *
- misc->xalign) + 0.5;
- y = (widget->allocation.y * (1.0 - misc->yalign) +
- (widget->allocation.y + widget->allocation.height
- - (widget->requisition.height - misc->ypad * 2)) *
- misc->yalign) + 0.5;
-
- if (pixmap->mask)
- {
- gdk_gc_set_clip_mask (widget->style->black_gc, pixmap->mask);
- gdk_gc_set_clip_origin (widget->style->black_gc, x, y);
- }
-
- gdk_draw_pixmap (widget->window,
- widget->style->black_gc,
- pixmap->pixmap,
- 0, 0, x, y, -1, -1);
-
- if (pixmap->mask)
- {
- gdk_gc_set_clip_mask (widget->style->black_gc, NULL);
- gdk_gc_set_clip_origin (widget->style->black_gc, 0, 0);
- }
- }
-
- return FALSE;
-}
diff --git a/gtk/gtkpixmap.h b/gtk/gtkpixmap.h
deleted file mode 100644
index 970d4f40fc..0000000000
--- a/gtk/gtkpixmap.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_PIXMAP_H__
-#define __GTK_PIXMAP_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkmisc.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_PIXMAP(obj) GTK_CHECK_CAST (obj, gtk_pixmap_get_type (), GtkPixmap)
-#define GTK_PIXMAP_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_pixmap_get_type (), GtkPixmapClass)
-#define GTK_IS_PIXMAP(obj) GTK_CHECK_TYPE (obj, gtk_pixmap_get_type ())
-
-
-typedef struct _GtkPixmap GtkPixmap;
-typedef struct _GtkPixmapClass GtkPixmapClass;
-
-struct _GtkPixmap
-{
- GtkMisc misc;
-
- GdkPixmap *pixmap;
- GdkBitmap *mask;
-};
-
-struct _GtkPixmapClass
-{
- GtkMiscClass parent_class;
-};
-
-
-guint gtk_pixmap_get_type (void);
-GtkWidget* gtk_pixmap_new (GdkPixmap *pixmap,
- GdkBitmap *mask);
-void gtk_pixmap_set (GtkPixmap *pixmap,
- GdkPixmap *val,
- GdkBitmap *mask);
-void gtk_pixmap_get (GtkPixmap *pixmap,
- GdkPixmap **val,
- GdkBitmap **mask);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_PIXMAP_H__ */
diff --git a/gtk/gtkpreview.c b/gtk/gtkpreview.c
deleted file mode 100644
index 5c89808b31..0000000000
--- a/gtk/gtkpreview.c
+++ /dev/null
@@ -1,1631 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <math.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/param.h>
-#include <netinet/in.h>
-#include "gdk/gdkx.h"
-#include "gtkpreview.h"
-#include "gtksignal.h"
-
-
-#define IMAGE_SIZE 256
-#define PREVIEW_CLASS(w) GTK_PREVIEW_CLASS (GTK_OBJECT (w)->klass)
-#define COLOR_COMPOSE(r,g,b) (lookup_red[r] | lookup_green[g] | lookup_blue[b])
-
-
-typedef struct _GtkPreviewProp GtkPreviewProp;
-typedef void (*GtkTransferFunc) (guchar *dest, guchar *src, gint count);
-
-struct _GtkPreviewProp
-{
- guint16 ref_count;
- guint16 nred_shades;
- guint16 ngreen_shades;
- guint16 nblue_shades;
- guint16 ngray_shades;
-};
-
-
-static void gtk_preview_class_init (GtkPreviewClass *klass);
-static void gtk_preview_init (GtkPreview *preview);
-static void gtk_preview_finalize (GtkObject *object);
-static void gtk_preview_realize (GtkWidget *widget);
-static gint gtk_preview_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static void gtk_preview_make_buffer (GtkPreview *preview);
-static void gtk_preview_get_visuals (GtkPreviewClass *klass);
-static void gtk_preview_get_cmaps (GtkPreviewClass *klass);
-static void gtk_preview_dither_init (GtkPreviewClass *klass);
-static void gtk_fill_lookup_array (gulong *array,
- int depth,
- int shift,
- int prec);
-static void gtk_trim_cmap (GtkPreviewClass *klass);
-static void gtk_create_8_bit (GtkPreviewClass *klass);
-
-static void gtk_color_8 (guchar *src,
- guchar *data,
- gint x,
- gint y,
- gulong width);
-static void gtk_color_16 (guchar *src,
- guchar *data,
- gulong width);
-static void gtk_color_24 (guchar *src,
- guchar *data,
- gulong width);
-static void gtk_grayscale_8 (guchar *src,
- guchar *data,
- gint x,
- gint y,
- gulong width);
-static void gtk_grayscale_16 (guchar *src,
- guchar *data,
- gulong width);
-static void gtk_grayscale_24 (guchar *src,
- guchar *data,
- gulong width);
-
-static gint gtk_get_preview_prop (guint *nred,
- guint *nblue,
- guint *ngreen,
- guint *ngray);
-static void gtk_set_preview_prop (guint nred,
- guint ngreen,
- guint nblue,
- guint ngray);
-
-/* transfer functions:
- * destination byte order/source bpp/destination bpp
- */
-static void gtk_lsbmsb_1_1 (guchar *dest,
- guchar *src,
- gint count);
-static void gtk_lsb_2_2 (guchar *dest,
- guchar *src,
- gint count);
-static void gtk_msb_2_2 (guchar *dest,
- guchar *src,
- gint count);
-static void gtk_lsb_3_3 (guchar *dest,
- guchar *src,
- gint count);
-static void gtk_msb_3_3 (guchar *dest,
- guchar *src,
- gint count);
-static void gtk_lsb_3_4 (guchar *dest,
- guchar *src,
- gint count);
-static void gtk_msb_3_4 (guchar *dest,
- guchar *src,
- gint count);
-
-
-static GtkWidgetClass *parent_class = NULL;
-static GtkPreviewClass *preview_class = NULL;
-static GtkPreviewInfo *preview_info = NULL;
-static gint install_cmap = FALSE;
-
-
-guint
-gtk_preview_get_type ()
-{
- static guint preview_type = 0;
-
- if (!preview_type)
- {
- GtkTypeInfo preview_info =
- {
- "GtkPreview",
- sizeof (GtkPreview),
- sizeof (GtkPreviewClass),
- (GtkClassInitFunc) gtk_preview_class_init,
- (GtkObjectInitFunc) gtk_preview_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- preview_type = gtk_type_unique (gtk_widget_get_type (), &preview_info);
- }
-
- return preview_type;
-}
-
-static void
-gtk_preview_class_init (GtkPreviewClass *klass)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- object_class = (GtkObjectClass*) klass;
- widget_class = (GtkWidgetClass*) klass;
-
- parent_class = gtk_type_class (gtk_widget_get_type ());
- preview_class = klass;
-
- object_class->finalize = gtk_preview_finalize;
-
- widget_class->realize = gtk_preview_realize;
- widget_class->expose_event = gtk_preview_expose;
-
- if (preview_info)
- klass->info = *preview_info;
- else
- {
- klass->info.visual = NULL;
- klass->info.cmap = NULL;
-
- klass->info.color_pixels = NULL;
- klass->info.gray_pixels = NULL;
- klass->info.reserved_pixels = NULL;
-
- klass->info.lookup_red = NULL;
- klass->info.lookup_green = NULL;
- klass->info.lookup_blue = NULL;
-
- klass->info.dither_red = NULL;
- klass->info.dither_green = NULL;
- klass->info.dither_blue = NULL;
- klass->info.dither_gray = NULL;
- klass->info.dither_matrix = NULL;
-
- klass->info.nred_shades = 6;
- klass->info.ngreen_shades = 6;
- klass->info.nblue_shades = 4;
- klass->info.ngray_shades = 24;
- klass->info.nreserved = 0;
-
- klass->info.bpp = 0;
- klass->info.cmap_alloced = FALSE;
- klass->info.gamma = 1.0;
- }
-
- klass->image = NULL;
-
- gtk_preview_get_visuals (klass);
- gtk_preview_get_cmaps (klass);
- gtk_preview_dither_init (klass);
-}
-
-void
-gtk_preview_reset (void)
-{
- GtkPreviewInfo *info;
-
- if (!preview_class || !preview_info)
- return;
-
- info = &preview_class->info;
-
- gtk_preview_uninit();
-
- if (info->color_pixels)
- {
- gdk_colors_free (info->cmap,
- info->color_pixels,
- info->nred_shades *
- info->ngreen_shades *
- info->nblue_shades,
- 0);
-
- gdk_colors_free (info->cmap,
- info->gray_pixels,
- info->ngray_shades, 0);
-
- g_free (info->color_pixels);
- g_free (info->gray_pixels);
- }
-
- if (info->reserved_pixels)
- {
- gdk_colors_free (info->cmap,
- info->reserved_pixels,
- info->nreserved, 0);
- g_free (info->reserved_pixels);
- }
-
- if (info->cmap && info->cmap_alloced)
- gdk_colormap_unref (info->cmap);
-
- if (info->lookup_red)
- {
- g_free (info->lookup_red);
- g_free (info->lookup_green);
- g_free (info->lookup_blue);
- }
-
- if (info->dither_matrix)
- {
- int i, j;
-
- for (i= 0 ; i < 8 ; i++)
- {
- for (j = 0; j < 8 ; j++)
- g_free (info->dither_matrix[i][j]);
- g_free (info->dither_matrix[i]);
- }
- g_free (info->dither_matrix);
- g_free (info->dither_red);
- g_free (info->dither_green);
- g_free (info->dither_blue);
- }
-
- preview_class->info = *preview_info;
-
- gtk_preview_get_visuals (preview_class);
- gtk_preview_get_cmaps (preview_class);
- gtk_preview_dither_init (preview_class);
-}
-
-static void
-gtk_preview_init (GtkPreview *preview)
-{
- GTK_WIDGET_SET_FLAGS (preview, GTK_BASIC);
-
- preview->buffer = NULL;
- preview->buffer_width = 0;
- preview->buffer_height = 0;
- preview->expand = FALSE;
-}
-
-void
-gtk_preview_uninit ()
-{
- GtkPreviewProp *prop;
- GdkAtom property;
-
- /* FIXME: need to grab the server here to prevent a race condition */
-
- if (preview_class && !install_cmap && preview_class->info.visual &&
- (preview_class->info.visual->type != GDK_VISUAL_TRUE_COLOR) &&
- (preview_class->info.visual->type != GDK_VISUAL_DIRECT_COLOR))
- {
- property = gdk_atom_intern ("GTK_PREVIEW_INFO", FALSE);
-
- if (gdk_property_get (NULL, property, property,
- 0, sizeof (GtkPreviewProp), FALSE,
- NULL, NULL, NULL, (guchar**) &prop))
- {
- prop->ref_count = ntohs (prop->ref_count) - 1;
- if (prop->ref_count == 0)
- {
- gdk_property_delete (NULL, property);
- }
- else
- {
- prop->ref_count = htons (prop->ref_count);
- gdk_property_change (NULL, property, property, 16,
- GDK_PROP_MODE_REPLACE,
- (guchar*) prop, 5);
- }
- }
- }
-}
-
-GtkWidget*
-gtk_preview_new (GtkPreviewType type)
-{
- GtkPreview *preview;
-
- preview = gtk_type_new (gtk_preview_get_type ());
- preview->type = type;
-
- return GTK_WIDGET (preview);
-}
-
-void
-gtk_preview_size (GtkPreview *preview,
- gint width,
- gint height)
-{
- g_return_if_fail (preview != NULL);
- g_return_if_fail (GTK_IS_PREVIEW (preview));
-
- if ((width != GTK_WIDGET (preview)->requisition.width) ||
- (height != GTK_WIDGET (preview)->requisition.height))
- {
- GTK_WIDGET (preview)->requisition.width = width;
- GTK_WIDGET (preview)->requisition.height = height;
-
- if (preview->buffer)
- g_free (preview->buffer);
- preview->buffer = NULL;
- }
-}
-
-void
-gtk_preview_put (GtkPreview *preview,
- GdkWindow *window,
- GdkGC *gc,
- gint srcx,
- gint srcy,
- gint destx,
- gint desty,
- gint width,
- gint height)
-{
- GtkWidget *widget;
- GdkImage *image;
- GdkRectangle r1, r2, r3;
- GtkTransferFunc transfer_func;
- guchar *image_mem;
- guchar *src, *dest;
- gint x, xe, x2;
- gint y, ye, y2;
- guint dest_rowstride;
- guint src_bpp;
- guint dest_bpp;
- gint i;
-
- g_return_if_fail (preview != NULL);
- g_return_if_fail (GTK_IS_PREVIEW (preview));
- g_return_if_fail (window != NULL);
-
- if (!preview->buffer)
- return;
-
- widget = GTK_WIDGET (preview);
-
- r1.x = 0;
- r1.y = 0;
- r1.width = preview->buffer_width;
- r1.height = preview->buffer_height;
-
- r2.x = srcx;
- r2.y = srcy;
- r2.width = width;
- r2.height = height;
-
- if (!gdk_rectangle_intersect (&r1, &r2, &r3))
- return;
-
- x2 = r3.x + r3.width;
- y2 = r3.y + r3.height;
-
- if (!preview_class->image)
- preview_class->image = gdk_image_new (GDK_IMAGE_FASTEST,
- preview_class->info.visual,
- IMAGE_SIZE, IMAGE_SIZE);
- image = preview_class->image;
- src_bpp = preview_class->info.bpp;
-
- image_mem = image->mem;
- dest_bpp = image->bpp;
- dest_rowstride = image->bpl;
-
- transfer_func = NULL;
-
- switch (dest_bpp)
- {
- case 1:
- switch (src_bpp)
- {
- case 1:
- transfer_func = gtk_lsbmsb_1_1;
- break;
- }
- break;
- case 2:
- switch (src_bpp)
- {
- case 2:
- if (image->byte_order == GDK_MSB_FIRST)
- transfer_func = gtk_msb_2_2;
- else
- transfer_func = gtk_lsb_2_2;
- break;
- case 3:
- break;
- }
- break;
- case 3:
- switch (src_bpp)
- {
- case 3:
- if (image->byte_order == GDK_MSB_FIRST)
- transfer_func = gtk_msb_3_3;
- else
- transfer_func = gtk_lsb_3_3;
- break;
- }
- break;
- case 4:
- switch (src_bpp)
- {
- case 3:
- if (image->byte_order == GDK_MSB_FIRST)
- transfer_func = gtk_msb_3_4;
- else
- transfer_func = gtk_lsb_3_4;
- break;
- }
- break;
- }
-
- if (!transfer_func)
- {
- g_warning ("unsupported byte order/src bpp/dest bpp combination: %s:%d:%d",
- (image->byte_order == GDK_MSB_FIRST) ? "msb" : "lsb", src_bpp, dest_bpp);
- return;
- }
-
- for (y = r3.y; y < y2; y += IMAGE_SIZE)
- {
- for (x = r3.x; x < x2; x += IMAGE_SIZE)
- {
- xe = x + IMAGE_SIZE;
- if (xe > x2)
- xe = x2;
-
- ye = y + IMAGE_SIZE;
- if (ye > y2)
- ye = y2;
-
- for (i = y; i < ye; i++)
- {
- src = preview->buffer + (((gulong) (i - r1.y) * (gulong) preview->buffer_width) +
- (x - r1.x)) * (gulong) src_bpp;
- dest = image_mem + ((gulong) (i - y) * dest_rowstride);
-
- if (xe > x)
- (* transfer_func) (dest, src, xe - x);
- }
-
- gdk_draw_image (window, gc,
- image, 0, 0,
- destx + (r3.x - srcx) + (x - r3.x),
- desty + (r3.y - srcy) + (y - r3.y),
- xe - x, ye - y);
- gdk_flush ();
- }
- }
-}
-
-void
-gtk_preview_put_row (GtkPreview *preview,
- guchar *src,
- guchar *dest,
- gint x,
- gint y,
- gint w)
-{
- g_return_if_fail (preview != NULL);
- g_return_if_fail (GTK_IS_PREVIEW (preview));
- g_return_if_fail (src != NULL);
- g_return_if_fail (dest != NULL);
-
- switch (preview->type)
- {
- case GTK_PREVIEW_COLOR:
- switch (preview_class->info.visual->depth)
- {
- case 8:
- gtk_color_8 (src, dest, x, y, w);
- break;
- case 15:
- case 16:
- gtk_color_16 (src, dest, w);
- break;
- case 24:
- case 32:
- gtk_color_24 (src, dest, w);
- break;
- }
- break;
- case GTK_PREVIEW_GRAYSCALE:
- switch (preview_class->info.visual->depth)
- {
- case 8:
- gtk_grayscale_8 (src, dest, x, y, w);
- break;
- case 15:
- case 16:
- gtk_grayscale_16 (src, dest, w);
- break;
- case 24:
- case 32:
- gtk_grayscale_24 (src, dest, w);
- break;
- }
- break;
- }
-}
-
-void
-gtk_preview_draw_row (GtkPreview *preview,
- guchar *data,
- gint x,
- gint y,
- gint w)
-{
- guchar *dest;
-
- g_return_if_fail (preview != NULL);
- g_return_if_fail (GTK_IS_PREVIEW (preview));
- g_return_if_fail (data != NULL);
- g_return_if_fail (preview_class->info.visual != NULL);
-
- if ((w <= 0) || (y < 0))
- return;
-
- g_return_if_fail (data != NULL);
-
- gtk_preview_make_buffer (preview);
-
- if (y >= preview->buffer_height)
- return;
-
- switch (preview->type)
- {
- case GTK_PREVIEW_COLOR:
- switch (preview_class->info.visual->depth)
- {
- case 8:
- dest = preview->buffer + ((gulong) y * (gulong) preview->buffer_width + (gulong) x);
- gtk_color_8 (data, dest, x, y, w);
- break;
- case 15:
- case 16:
- dest = preview->buffer + ((gulong) y * (gulong) preview->buffer_width + (gulong) x) * 2;
- gtk_color_16 (data, dest, w);
- break;
- case 24:
- case 32:
- dest = preview->buffer + ((gulong) y * (gulong) preview->buffer_width + (gulong) x) * 3;
- gtk_color_24 (data, dest, w);
- break;
- }
- break;
- case GTK_PREVIEW_GRAYSCALE:
- switch (preview_class->info.visual->depth)
- {
- case 8:
- dest = preview->buffer + ((gulong) y * (gulong) preview->buffer_width + (gulong) x);
- gtk_grayscale_8 (data, dest, x, y, w);
- break;
- case 15:
- case 16:
- dest = preview->buffer + ((gulong) y * (gulong) preview->buffer_width + (gulong) x) * 2;
- gtk_grayscale_16 (data, dest, w);
- break;
- case 24:
- case 32:
- dest = preview->buffer + ((gulong) y * (gulong) preview->buffer_width + (gulong) x) * 3;
- gtk_grayscale_24 (data, dest, w);
- break;
- }
- break;
- }
-}
-
-void
-gtk_preview_set_expand (GtkPreview *preview,
- gint expand)
-{
- g_return_if_fail (preview != NULL);
- g_return_if_fail (GTK_IS_PREVIEW (preview));
-
- preview->expand = (expand != FALSE);
-}
-
-void
-gtk_preview_set_gamma (double _gamma)
-{
- if (!preview_info)
- {
- preview_info = g_new0 (GtkPreviewInfo, 1);
- preview_info->nred_shades = 6;
- preview_info->ngreen_shades = 6;
- preview_info->nblue_shades = 4;
- preview_info->ngray_shades = 24;
- }
-
- preview_info->gamma = _gamma;
-}
-
-void
-gtk_preview_set_color_cube (guint nred_shades,
- guint ngreen_shades,
- guint nblue_shades,
- guint ngray_shades)
-{
- if (!preview_info)
- {
- preview_info = g_new0 (GtkPreviewInfo, 1);
- preview_info->gamma = 1.0;
- }
-
- preview_info->nred_shades = nred_shades;
- preview_info->ngreen_shades = ngreen_shades;
- preview_info->nblue_shades = nblue_shades;
- preview_info->ngray_shades = ngray_shades;
-}
-
-void
-gtk_preview_set_install_cmap (gint _install_cmap)
-{
- install_cmap = _install_cmap;
-}
-
-void
-gtk_preview_set_reserved (gint nreserved)
-{
- if (!preview_info)
- preview_info = g_new0 (GtkPreviewInfo, 1);
-
- preview_info->nreserved = nreserved;
-}
-
-GdkVisual*
-gtk_preview_get_visual ()
-{
- if (!preview_class)
- preview_class = gtk_type_class (gtk_preview_get_type ());
-
- return preview_class->info.visual;
-}
-
-GdkColormap*
-gtk_preview_get_cmap ()
-{
- if (!preview_class)
- preview_class = gtk_type_class (gtk_preview_get_type ());
-
- return preview_class->info.cmap;
-}
-
-GtkPreviewInfo*
-gtk_preview_get_info ()
-{
- if (!preview_class)
- preview_class = gtk_type_class (gtk_preview_get_type ());
-
- return &preview_class->info;
-}
-
-
-static void
-gtk_preview_finalize (GtkObject *object)
-{
- GtkPreview *preview;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_PREVIEW (object));
-
- preview = GTK_PREVIEW (object);
- if (preview->buffer)
- g_free (preview->buffer);
- preview->type = (GtkPreviewType) -1;
-
- (* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-static void
-gtk_preview_realize (GtkWidget *widget)
-{
- GtkPreview *preview;
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_PREVIEW (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
- preview = GTK_PREVIEW (widget);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
-}
-
-static gint
-gtk_preview_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkPreview *preview;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_PREVIEW (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- preview = GTK_PREVIEW (widget);
-
- gtk_preview_put (GTK_PREVIEW (widget),
- widget->window, widget->style->black_gc,
- event->area.x -
- (widget->allocation.width - preview->buffer_width)/2,
- event->area.y -
- (widget->allocation.height - preview->buffer_height)/2,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
- }
-
- return FALSE;
-}
-
-static void
-gtk_preview_make_buffer (GtkPreview *preview)
-{
- GtkWidget *widget;
- gint width;
- gint height;
-
- g_return_if_fail (preview != NULL);
- g_return_if_fail (GTK_IS_PREVIEW (preview));
-
- widget = GTK_WIDGET (preview);
-
- if (preview->expand &&
- (widget->allocation.width != 0) &&
- (widget->allocation.height != 0))
- {
- width = widget->allocation.width;
- height = widget->allocation.height;
- }
- else
- {
- width = widget->requisition.width;
- height = widget->requisition.height;
- }
-
- if (!preview->buffer ||
- (preview->buffer_width != width) ||
- (preview->buffer_height != height))
- {
- if (preview->buffer)
- g_free (preview->buffer);
-
- preview->buffer_width = width;
- preview->buffer_height = height;
-
- preview->buffer = g_new0 (guchar,
- preview->buffer_width *
- preview->buffer_height *
- preview_class->info.bpp);
- }
-}
-
-static void
-gtk_preview_get_visuals (GtkPreviewClass *klass)
-{
- static GdkVisualType types[] =
- {
- GDK_VISUAL_TRUE_COLOR,
- GDK_VISUAL_DIRECT_COLOR,
- GDK_VISUAL_TRUE_COLOR,
- GDK_VISUAL_DIRECT_COLOR,
- GDK_VISUAL_TRUE_COLOR,
- GDK_VISUAL_DIRECT_COLOR,
- GDK_VISUAL_TRUE_COLOR,
- GDK_VISUAL_DIRECT_COLOR,
- GDK_VISUAL_PSEUDO_COLOR
- };
- static gint depths[] = { 24, 24, 32, 32, 16, 16, 15, 15, 8 };
- static gint nvisual_types = sizeof (types) / sizeof (types[0]);
-
- int i;
-
- g_return_if_fail (klass != NULL);
-
- if (!klass->info.visual)
- for (i = 0; i < nvisual_types; i++)
- if ((klass->info.visual = gdk_visual_get_best_with_both (depths[i], types[i])))
- {
- if ((klass->info.visual->type == GDK_VISUAL_TRUE_COLOR) ||
- (klass->info.visual->type == GDK_VISUAL_DIRECT_COLOR))
- {
- klass->info.lookup_red = g_new (gulong, 256);
- klass->info.lookup_green = g_new (gulong, 256);
- klass->info.lookup_blue = g_new (gulong, 256);
-
- gtk_fill_lookup_array (klass->info.lookup_red,
- klass->info.visual->depth,
- klass->info.visual->red_shift,
- 8 - klass->info.visual->red_prec);
- gtk_fill_lookup_array (klass->info.lookup_green,
- klass->info.visual->depth,
- klass->info.visual->green_shift,
- 8 - klass->info.visual->green_prec);
- gtk_fill_lookup_array (klass->info.lookup_blue,
- klass->info.visual->depth,
- klass->info.visual->blue_shift,
- 8 - klass->info.visual->blue_prec);
- }
- break;
- }
-
- if (!klass->info.visual)
- {
- g_warning ("unable to find a suitable visual for color image display.\n");
- return;
- }
-
- switch (klass->info.visual->depth)
- {
- case 8:
- klass->info.bpp = 1;
- break;
- case 15:
- case 16:
- klass->info.bpp = 2;
- break;
- case 24:
- case 32:
- klass->info.bpp = 3;
- break;
- }
-}
-
-static void
-gtk_preview_get_cmaps (GtkPreviewClass *klass)
-{
- g_return_if_fail (klass != NULL);
- g_return_if_fail (klass->info.visual != NULL);
-
- if ((klass->info.visual->type != GDK_VISUAL_TRUE_COLOR) &&
- (klass->info.visual->type != GDK_VISUAL_DIRECT_COLOR))
- {
- if (install_cmap)
- {
- klass->info.cmap = gdk_colormap_new (klass->info.visual, FALSE);
- klass->info.cmap_alloced = install_cmap;
-
- gtk_trim_cmap (klass);
- gtk_create_8_bit (klass);
- }
- else
- {
- guint nred;
- guint ngreen;
- guint nblue;
- guint ngray;
- gint set_prop;
-
- klass->info.cmap = gdk_colormap_get_system ();
-
- set_prop = TRUE;
- if (gtk_get_preview_prop (&nred, &ngreen, &nblue, &ngray))
- {
- set_prop = FALSE;
-
- klass->info.nred_shades = nred;
- klass->info.ngreen_shades = ngreen;
- klass->info.nblue_shades = nblue;
- klass->info.ngray_shades = ngray;
-
- if (klass->info.nreserved)
- {
- klass->info.reserved_pixels = g_new (gulong, klass->info.nreserved);
- if (!gdk_colors_alloc (klass->info.cmap, 0, NULL, 0,
- klass->info.reserved_pixels,
- klass->info.nreserved))
- {
- g_free (klass->info.reserved_pixels);
- klass->info.reserved_pixels = NULL;
- }
- }
- }
- else
- {
- gtk_trim_cmap (klass);
- }
-
- gtk_create_8_bit (klass);
-
- if (set_prop)
- gtk_set_preview_prop (klass->info.nred_shades,
- klass->info.ngreen_shades,
- klass->info.nblue_shades,
- klass->info.ngray_shades);
- }
- }
- else
- {
- if (klass->info.visual == gdk_visual_get_system ())
- klass->info.cmap = gdk_colormap_get_system ();
- else
- {
- klass->info.cmap = gdk_colormap_new (klass->info.visual, FALSE);
- klass->info.cmap_alloced = TRUE;
- }
-
- klass->info.nred_shades = 0;
- klass->info.ngreen_shades = 0;
- klass->info.nblue_shades = 0;
- klass->info.ngray_shades = 0;
- }
-}
-
-static void
-gtk_preview_dither_init (GtkPreviewClass *klass)
-{
- int i, j, k;
- unsigned char low_shade, high_shade;
- unsigned short index;
- long red_mult, green_mult;
- double red_matrix_width;
- double green_matrix_width;
- double blue_matrix_width;
- double gray_matrix_width;
- double red_colors_per_shade;
- double green_colors_per_shade;
- double blue_colors_per_shade;
- double gray_colors_per_shade;
- gulong *gray_pixels;
- gint shades_r, shades_g, shades_b, shades_gray;
- GtkDitherInfo *red_ordered_dither;
- GtkDitherInfo *green_ordered_dither;
- GtkDitherInfo *blue_ordered_dither;
- GtkDitherInfo *gray_ordered_dither;
- guchar ***dither_matrix;
- guchar DM[8][8] =
- {
- { 0, 32, 8, 40, 2, 34, 10, 42 },
- { 48, 16, 56, 24, 50, 18, 58, 26 },
- { 12, 44, 4, 36, 14, 46, 6, 38 },
- { 60, 28, 52, 20, 62, 30, 54, 22 },
- { 3, 35, 11, 43, 1, 33, 9, 41 },
- { 51, 19, 59, 27, 49, 17, 57, 25 },
- { 15, 47, 7, 39, 13, 45, 5, 37 },
- { 63, 31, 55, 23, 61, 29, 53, 21 }
- };
-
- if (!klass->info.visual || klass->info.visual->type != GDK_VISUAL_PSEUDO_COLOR)
- return;
-
- shades_r = klass->info.nred_shades;
- shades_g = klass->info.ngreen_shades;
- shades_b = klass->info.nblue_shades;
- shades_gray = klass->info.ngray_shades;
-
- red_mult = shades_g * shades_b;
- green_mult = shades_b;
-
- red_colors_per_shade = 255.0 / (shades_r - 1);
- red_matrix_width = red_colors_per_shade / 64;
-
- green_colors_per_shade = 255.0 / (shades_g - 1);
- green_matrix_width = green_colors_per_shade / 64;
-
- blue_colors_per_shade = 255.0 / (shades_b - 1);
- blue_matrix_width = blue_colors_per_shade / 64;
-
- gray_colors_per_shade = 255.0 / (shades_gray - 1);
- gray_matrix_width = gray_colors_per_shade / 64;
-
- /* alloc the ordered dither arrays for accelerated dithering */
-
- klass->info.dither_red = g_new (GtkDitherInfo, 256);
- klass->info.dither_green = g_new (GtkDitherInfo, 256);
- klass->info.dither_blue = g_new (GtkDitherInfo, 256);
- klass->info.dither_gray = g_new (GtkDitherInfo, 256);
-
- red_ordered_dither = klass->info.dither_red;
- green_ordered_dither = klass->info.dither_green;
- blue_ordered_dither = klass->info.dither_blue;
- gray_ordered_dither = klass->info.dither_gray;
-
- dither_matrix = g_new (guchar**, 8);
- for (i = 0; i < 8; i++)
- {
- dither_matrix[i] = g_new (guchar*, 8);
- for (j = 0; j < 8; j++)
- dither_matrix[i][j] = g_new (guchar, 65);
- }
-
- klass->info.dither_matrix = dither_matrix;
-
- /* setup the ordered_dither_matrices */
-
- for (i = 0; i < 8; i++)
- for (j = 0; j < 8; j++)
- for (k = 0; k <= 64; k++)
- dither_matrix[i][j][k] = (DM[i][j] < k) ? 1 : 0;
-
- /* setup arrays containing three bytes of information for red, green, & blue */
- /* the arrays contain :
- * 1st byte: low end shade value
- * 2nd byte: high end shade value
- * 3rd & 4th bytes: ordered dither matrix index
- */
-
- gray_pixels = klass->info.gray_pixels;
-
- for (i = 0; i < 256; i++)
- {
-
- /* setup the red information */
- {
- low_shade = (unsigned char) (i / red_colors_per_shade);
- if (low_shade == (shades_r - 1))
- low_shade--;
- high_shade = low_shade + 1;
-
- index = (unsigned short)
- (((double) i - low_shade * red_colors_per_shade) /
- red_matrix_width);
-
- low_shade *= red_mult;
- high_shade *= red_mult;
-
- red_ordered_dither[i].s[1] = index;
- red_ordered_dither[i].c[0] = low_shade;
- red_ordered_dither[i].c[1] = high_shade;
- }
-
-
- /* setup the green information */
- {
- low_shade = (unsigned char) (i / green_colors_per_shade);
- if (low_shade == (shades_g - 1))
- low_shade--;
- high_shade = low_shade + 1;
-
- index = (unsigned short)
- (((double) i - low_shade * green_colors_per_shade) /
- green_matrix_width);
-
- low_shade *= green_mult;
- high_shade *= green_mult;
-
- green_ordered_dither[i].s[1] = index;
- green_ordered_dither[i].c[0] = low_shade;
- green_ordered_dither[i].c[1] = high_shade;
- }
-
-
- /* setup the blue information */
- {
- low_shade = (unsigned char) (i / blue_colors_per_shade);
- if (low_shade == (shades_b - 1))
- low_shade--;
- high_shade = low_shade + 1;
-
- index = (unsigned short)
- (((double) i - low_shade * blue_colors_per_shade) /
- blue_matrix_width);
-
- blue_ordered_dither[i].s[1] = index;
- blue_ordered_dither[i].c[0] = low_shade;
- blue_ordered_dither[i].c[1] = high_shade;
- }
-
-
- /* setup the gray information */
- {
- low_shade = (unsigned char) (i / gray_colors_per_shade);
- if (low_shade == (shades_gray - 1))
- low_shade--;
- high_shade = low_shade + 1;
-
- index = (unsigned short)
- (((double) i - low_shade * gray_colors_per_shade) /
- gray_matrix_width);
-
- gray_ordered_dither[i].s[1] = index;
- gray_ordered_dither[i].c[0] = gray_pixels[low_shade];
- gray_ordered_dither[i].c[1] = gray_pixels[high_shade];
- }
- }
-}
-
-static void
-gtk_fill_lookup_array (gulong *array,
- int depth,
- int shift,
- int prec)
-{
- double one_over_gamma;
- double ind;
- int val;
- int i;
-
- if (preview_class->info.gamma != 0.0)
- one_over_gamma = 1.0 / preview_class->info.gamma;
- else
- one_over_gamma = 1.0;
-
- for (i = 0; i < 256; i++)
- {
- if (one_over_gamma == 1.0)
- array[i] = ((i >> prec) << shift);
- else
- {
- ind = (double) i / 255.0;
- val = (int) (255 * pow (ind, one_over_gamma));
- array[i] = ((val >> prec) << shift);
- }
- }
-}
-
-static void
-gtk_trim_cmap (GtkPreviewClass *klass)
-{
- gulong pixels[256];
- guint nred;
- guint ngreen;
- guint nblue;
- guint ngray;
- guint nreserved;
- guint total;
- guint tmp;
- gint success;
-
- nred = klass->info.nred_shades;
- ngreen = klass->info.ngreen_shades;
- nblue = klass->info.nblue_shades;
- ngray = klass->info.ngray_shades;
- nreserved = klass->info.nreserved;
-
- success = FALSE;
- while (!success)
- {
- total = nred * ngreen * nblue + ngray + nreserved;
-
- if (total <= 256)
- {
- if ((nred < 2) || (ngreen < 2) || (nblue < 2) || (ngray < 2))
- success = TRUE;
- else
- {
- success = gdk_colors_alloc (klass->info.cmap, 0, NULL, 0, pixels, total);
- if (success)
- {
- if (nreserved > 0)
- {
- klass->info.reserved_pixels = g_new (gulong, nreserved);
- memcpy (klass->info.reserved_pixels, pixels, sizeof (gulong) * nreserved);
- gdk_colors_free (klass->info.cmap, &pixels[nreserved],
- total - nreserved, 0);
- }
- else
- {
- gdk_colors_free (klass->info.cmap, pixels, total, 0);
- }
- }
- }
- }
-
- if (!success)
- {
- if ((nblue >= nred) && (nblue >= ngreen))
- nblue = nblue - 1;
- else if ((nred >= ngreen) && (nred >= nblue))
- nred = nred - 1;
- else
- {
- tmp = log (ngray) / log (2);
-
- if (ngreen >= tmp)
- ngreen = ngreen - 1;
- else
- ngray -= 1;
- }
- }
- }
-
- if ((nred < 2) || (ngreen < 2) || (nblue < 2) || (ngray < 2))
- {
- g_print ("Unable to allocate sufficient colormap entries.\n");
- g_print ("Try exiting other color intensive applications.\n");
- return;
- }
-
- /* If any of the shade values has changed, issue a warning */
- if ((nred != klass->info.nred_shades) ||
- (ngreen != klass->info.ngreen_shades) ||
- (nblue != klass->info.nblue_shades) ||
- (ngray != klass->info.ngray_shades))
- {
- g_print ("Not enough colors to satisfy requested color cube.\n");
- g_print ("Reduced color cube shades from\n");
- g_print ("[%d of Red, %d of Green, %d of Blue, %d of Gray] ==> [%d of Red, %d of Green, %d of Blue, %d of Gray]\n",
- klass->info.nred_shades, klass->info.ngreen_shades,
- klass->info.nblue_shades, klass->info.ngray_shades,
- nred, ngreen, nblue, ngray);
- }
-
- klass->info.nred_shades = nred;
- klass->info.ngreen_shades = ngreen;
- klass->info.nblue_shades = nblue;
- klass->info.ngray_shades = ngray;
-}
-
-static void
-gtk_create_8_bit (GtkPreviewClass *klass)
-{
- unsigned int r, g, b;
- unsigned int rv, gv, bv;
- unsigned int dr, dg, db, dgray;
- GdkColor color;
- gulong *pixels;
- double one_over_gamma;
- int i;
-
- if (!klass->info.color_pixels)
- klass->info.color_pixels = g_new (gulong, 256);
-
- if (!klass->info.gray_pixels)
- klass->info.gray_pixels = g_new (gulong, 256);
-
- if (klass->info.gamma != 0.0)
- one_over_gamma = 1.0 / klass->info.gamma;
- else
- one_over_gamma = 1.0;
-
- dr = klass->info.nred_shades - 1;
- dg = klass->info.ngreen_shades - 1;
- db = klass->info.nblue_shades - 1;
- dgray = klass->info.ngray_shades - 1;
-
- pixels = klass->info.color_pixels;
-
- for (r = 0, i = 0; r <= dr; r++)
- for (g = 0; g <= dg; g++)
- for (b = 0; b <= db; b++, i++)
- {
- rv = (unsigned int) ((r * klass->info.visual->colormap_size) / dr);
- gv = (unsigned int) ((g * klass->info.visual->colormap_size) / dg);
- bv = (unsigned int) ((b * klass->info.visual->colormap_size) / db);
- color.red = ((int) (255 * pow ((double) rv / 256.0, one_over_gamma))) * 257;
- color.green = ((int) (255 * pow ((double) gv / 256.0, one_over_gamma))) * 257;
- color.blue = ((int) (255 * pow ((double) bv / 256.0, one_over_gamma))) * 257;
-
- if (!gdk_color_alloc (klass->info.cmap, &color))
- {
- g_error ("could not initialize 8-bit combined colormap");
- return;
- }
-
- pixels[i] = color.pixel;
- }
-
-
- pixels = klass->info.gray_pixels;
-
- for (i = 0; i < (int) klass->info.ngray_shades; i++)
- {
- color.red = (i * klass->info.visual->colormap_size) / dgray;
- color.red = ((int) (255 * pow ((double) color.red / 256.0, one_over_gamma))) * 257;
- color.green = color.red;
- color.blue = color.red;
-
- if (!gdk_color_alloc (klass->info.cmap, &color))
- {
- g_error ("could not initialize 8-bit combined colormap");
- return;
- }
-
- pixels[i] = color.pixel;
- }
-}
-
-
-static void
-gtk_color_8 (guchar *src,
- guchar *dest,
- gint x,
- gint y,
- gulong width)
-{
- gulong *colors;
- GtkDitherInfo *dither_red;
- GtkDitherInfo *dither_green;
- GtkDitherInfo *dither_blue;
- GtkDitherInfo r, g, b;
- guchar **dither_matrix;
- guchar *matrix;
-
- colors = preview_class->info.color_pixels;
- dither_red = preview_class->info.dither_red;
- dither_green = preview_class->info.dither_green;
- dither_blue = preview_class->info.dither_blue;
- dither_matrix = preview_class->info.dither_matrix[y & 0x7];
-
- while (width--)
- {
- r = dither_red[src[0]];
- g = dither_green[src[1]];
- b = dither_blue[src[2]];
- src += 3;
-
- matrix = dither_matrix[x++ & 0x7];
- *dest++ = colors[(r.c[matrix[r.s[1]]] +
- g.c[matrix[g.s[1]]] +
- b.c[matrix[b.s[1]]])];
- }
-}
-
-static void
-gtk_color_16 (guchar *src,
- guchar *dest,
- gulong width)
-{
- gulong *lookup_red;
- gulong *lookup_green;
- gulong *lookup_blue;
- gulong val;
-
- lookup_red = preview_class->info.lookup_red;
- lookup_green = preview_class->info.lookup_green;
- lookup_blue = preview_class->info.lookup_blue;
-
- while (width--)
- {
- val = COLOR_COMPOSE (src[0], src[1], src[2]);
- dest[0] = val;
- dest[1] = val >> 8;
- dest += 2;
- src += 3;
- }
-}
-
-static void
-gtk_color_24 (guchar *src,
- guchar *dest,
- gulong width)
-{
- gulong *lookup_red;
- gulong *lookup_green;
- gulong *lookup_blue;
- gulong val;
-
- lookup_red = preview_class->info.lookup_red;
- lookup_green = preview_class->info.lookup_green;
- lookup_blue = preview_class->info.lookup_blue;
-
- while (width--)
- {
- val = COLOR_COMPOSE (src[0], src[1], src[2]);
- dest[0] = val;
- dest[1] = val >> 8;
- dest[2] = val >> 16;
- dest += 3;
- src += 3;
- }
-}
-
-static void
-gtk_grayscale_8 (guchar *src,
- guchar *dest,
- gint x,
- gint y,
- gulong width)
-{
- GtkDitherInfo *dither_gray;
- GtkDitherInfo gray;
- guchar **dither_matrix;
- guchar *matrix;
-
- dither_gray = preview_class->info.dither_gray;
- dither_matrix = preview_class->info.dither_matrix[y & 0x7];
-
- while (width--)
- {
- gray = dither_gray[*src++];
- matrix = dither_matrix[x++ & 0x7];
- *dest++ = gray.c[matrix[gray.s[1]]];
- }
-}
-
-static void
-gtk_grayscale_16 (guchar *src,
- guchar *dest,
- gulong width)
-{
- gulong *lookup_red;
- gulong *lookup_green;
- gulong *lookup_blue;
- gulong val;
-
- lookup_red = preview_class->info.lookup_red;
- lookup_green = preview_class->info.lookup_green;
- lookup_blue = preview_class->info.lookup_blue;
-
- while (width--)
- {
- val = COLOR_COMPOSE (*src, *src, *src);
- dest[0] = val;
- dest[1] = val >> 8;
- dest += 2;
- src += 1;
- }
-}
-
-static void
-gtk_grayscale_24 (guchar *src,
- guchar *dest,
- gulong width)
-{
- gulong *lookup_red;
- gulong *lookup_green;
- gulong *lookup_blue;
- gulong val;
-
- lookup_red = preview_class->info.lookup_red;
- lookup_green = preview_class->info.lookup_green;
- lookup_blue = preview_class->info.lookup_blue;
-
- while (width--)
- {
- val = COLOR_COMPOSE (*src, *src, *src);
- dest[0] = val;
- dest[1] = val >> 8;
- dest[2] = val >> 16;
- dest += 3;
- src += 1;
- }
-}
-
-
-static gint
-gtk_get_preview_prop (guint *nred,
- guint *ngreen,
- guint *nblue,
- guint *ngray)
-{
- GtkPreviewProp *prop;
- GdkAtom property;
-
- /* FIXME: need to grab the server here to prevent a race condition */
-
- property = gdk_atom_intern ("GTK_PREVIEW_INFO", FALSE);
-
- if (gdk_property_get (NULL, property, property,
- 0, sizeof (GtkPreviewProp), FALSE,
- NULL, NULL, NULL, (guchar**) &prop))
- {
- *nred = ntohs (prop->nred_shades);
- *ngreen = ntohs (prop->ngreen_shades);
- *nblue = ntohs (prop->nblue_shades);
- *ngray = ntohs (prop->ngray_shades);
-
- prop->ref_count = htons (ntohs (prop->ref_count) + 1);
- gdk_property_change (NULL, property, property, 16,
- GDK_PROP_MODE_REPLACE,
- (guchar*) prop, 5);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void
-gtk_set_preview_prop (guint nred,
- guint ngreen,
- guint nblue,
- guint ngray)
-{
- GtkPreviewProp prop;
- GdkAtom property;
-
- property = gdk_atom_intern ("GTK_PREVIEW_INFO", FALSE);
-
- prop.ref_count = htons (1);
- prop.nred_shades = htons (nred);
- prop.ngreen_shades = htons (ngreen);
- prop.nblue_shades = htons (nblue);
- prop.ngray_shades = htons (ngray);
-
- gdk_property_change (NULL, property, property, 16,
- GDK_PROP_MODE_REPLACE,
- (guchar*) &prop, 5);
-}
-
-
-static void
-gtk_lsbmsb_1_1 (guchar *dest,
- guchar *src,
- gint count)
-{
- memcpy (dest, src, count);
-}
-
-static void
-gtk_lsb_2_2 (guchar *dest,
- guchar *src,
- gint count)
-{
- memcpy (dest, src, count * 2);
-}
-
-static void
-gtk_msb_2_2 (guchar *dest,
- guchar *src,
- gint count)
-{
- while (count--)
- {
- dest[0] = src[1];
- dest[1] = src[0];
- dest += 2;
- src += 2;
- }
-}
-
-static void
-gtk_lsb_3_3 (guchar *dest,
- guchar *src,
- gint count)
-{
- memcpy (dest, src, count * 3);
-}
-
-static void
-gtk_msb_3_3 (guchar *dest,
- guchar *src,
- gint count)
-{
- while (count--)
- {
- dest[0] = src[2];
- dest[1] = src[1];
- dest[2] = src[0];
- dest += 3;
- src += 3;
- }
-}
-
-static void
-gtk_lsb_3_4 (guchar *dest,
- guchar *src,
- gint count)
-{
- while (count--)
- {
- dest[0] = src[0];
- dest[1] = src[1];
- dest[2] = src[2];
- dest += 4;
- src += 3;
- }
-}
-
-static void
-gtk_msb_3_4 (guchar *dest,
- guchar *src,
- gint count)
-{
- while (count--)
- {
- dest[1] = src[2];
- dest[2] = src[1];
- dest[3] = src[0];
- dest += 4;
- src += 3;
- }
-}
diff --git a/gtk/gtkpreview.h b/gtk/gtkpreview.h
deleted file mode 100644
index ab6c981f9f..0000000000
--- a/gtk/gtkpreview.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_PREVIEW_H__
-#define __GTK_PREVIEW_H__
-
-
-#include <gtk/gtkwidget.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_PREVIEW(obj) GTK_CHECK_CAST (obj, gtk_preview_get_type (), GtkPreview)
-#define GTK_PREVIEW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_preview_get_type (), GtkPreviewClass)
-#define GTK_IS_PREVIEW(obj) GTK_CHECK_TYPE (obj, gtk_preview_get_type ())
-
-
-typedef struct _GtkPreview GtkPreview;
-typedef struct _GtkPreviewInfo GtkPreviewInfo;
-typedef union _GtkDitherInfo GtkDitherInfo;
-typedef struct _GtkPreviewClass GtkPreviewClass;
-
-struct _GtkPreview
-{
- GtkWidget widget;
-
- guchar *buffer;
- guint16 buffer_width;
- guint16 buffer_height;
-
- guint type : 1;
- guint expand : 1;
-};
-
-struct _GtkPreviewInfo
-{
- GdkVisual *visual;
- GdkColormap *cmap;
-
- gulong *color_pixels;
- gulong *gray_pixels;
- gulong *reserved_pixels;
-
- gulong *lookup_red;
- gulong *lookup_green;
- gulong *lookup_blue;
-
- GtkDitherInfo *dither_red;
- GtkDitherInfo *dither_green;
- GtkDitherInfo *dither_blue;
- GtkDitherInfo *dither_gray;
- guchar ***dither_matrix;
-
- guint nred_shades;
- guint ngreen_shades;
- guint nblue_shades;
- guint ngray_shades;
- guint nreserved;
-
- guint bpp;
- gint cmap_alloced;
- gdouble gamma;
-};
-
-union _GtkDitherInfo
-{
- gushort s[2];
- guchar c[4];
-};
-
-struct _GtkPreviewClass
-{
- GtkWidgetClass parent_class;
-
- GtkPreviewInfo info;
-
- GdkImage *image;
-};
-
-
-guint gtk_preview_get_type (void);
-void gtk_preview_uninit (void);
-GtkWidget* gtk_preview_new (GtkPreviewType type);
-void gtk_preview_size (GtkPreview *preview,
- gint width,
- gint height);
-void gtk_preview_put (GtkPreview *preview,
- GdkWindow *window,
- GdkGC *gc,
- gint srcx,
- gint srcy,
- gint destx,
- gint desty,
- gint width,
- gint height);
-void gtk_preview_put_row (GtkPreview *preview,
- guchar *src,
- guchar *dest,
- gint x,
- gint y,
- gint w);
-void gtk_preview_draw_row (GtkPreview *preview,
- guchar *data,
- gint x,
- gint y,
- gint w);
-void gtk_preview_set_expand (GtkPreview *preview,
- gint expand);
-
-void gtk_preview_set_gamma (double gamma);
-void gtk_preview_set_color_cube (guint nred_shades,
- guint ngreen_shades,
- guint nblue_shades,
- guint ngray_shades);
-void gtk_preview_set_install_cmap (gint install_cmap);
-void gtk_preview_set_reserved (gint nreserved);
-GdkVisual* gtk_preview_get_visual (void);
-GdkColormap* gtk_preview_get_cmap (void);
-GtkPreviewInfo* gtk_preview_get_info (void);
-
-/* This function reinitializes the preview colormap and visual from
- * the current gamma/color_cube/install_cmap settings. It must only
- * be called if there are no previews or users's of the preview
- * colormap in existence.
- */
-void gtk_preview_reset (void);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_PREVIEW_H__ */
diff --git a/gtk/gtkprivate.h b/gtk/gtkprivate.h
deleted file mode 100644
index ec4bd4d0c0..0000000000
--- a/gtk/gtkprivate.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_PRIVATE_H__
-#define __GTK_PRIVATE_H__
-
-
-#include <gtk/gtkobject.h>
-#include <gtk/gtkwidget.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-
-/* The private flags that are used in the private_flags member of GtkWidget.
- */
-enum
-{
- PRIVATE_GTK_USER_STYLE = 1 << 0,
- PRIVATE_GTK_REDRAW_PENDING = 1 << 1,
- PRIVATE_GTK_RESIZE_PENDING = 1 << 2,
- PRIVATE_GTK_RESIZE_NEEDED = 1 << 3,
- PRIVATE_GTK_LEAVE_PENDING = 1 << 4,
- PRIVATE_GTK_HAS_SHAPE_MASK = 1 << 5,
- PRIVATE_GTK_IN_REPARENT = 1 << 6
-};
-
-/* Macros for extracting a widgets private_flags from GtkWidget.
- */
-#define GTK_PRIVATE_FLAGS(wid) (GTK_WIDGET (wid)->private_flags)
-#define GTK_WIDGET_USER_STYLE(obj) (GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_USER_STYLE)
-#define GTK_WIDGET_REDRAW_PENDING(obj) (GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_REDRAW_PENDING)
-#define GTK_CONTAINER_RESIZE_PENDING(obj) (GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_RESIZE_PENDING)
-#define GTK_WIDGET_RESIZE_NEEDED(obj) (GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_RESIZE_NEEDED)
-#define GTK_WIDGET_LEAVE_PENDING(obj) (GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_LEAVE_PENDING)
-#define GTK_WIDGET_HAS_SHAPE_MASK(obj) (GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_HAS_SHAPE_MASK)
-#define GTK_WIDGET_IN_REPARENT(obj) (GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_IN_REPARENT)
-
-/* Macros for setting and clearing private widget flags.
- * we use a preprocessor string concatenation here for a clear
- * flags/private_flags distinction at the cost of single flag operations.
- */
-#define GTK_PRIVATE_SET_FLAG(wid,flag) G_STMT_START{ (GTK_PRIVATE_FLAGS (wid) |= (PRIVATE_ ## flag)); }G_STMT_END
-#define GTK_PRIVATE_UNSET_FLAG(wid,flag) G_STMT_START{ (GTK_PRIVATE_FLAGS (wid) &= ~(PRIVATE_ ## flag)); }G_STMT_END
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_PRIVATE_H__ */
diff --git a/gtk/gtkprogressbar.c b/gtk/gtkprogressbar.c
deleted file mode 100644
index 9bcd28f427..0000000000
--- a/gtk/gtkprogressbar.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkprogressbar.h"
-
-
-#define MIN_WIDTH 200
-#define MIN_HEIGHT 20
-
-
-static void gtk_progress_bar_class_init (GtkProgressBarClass *klass);
-static void gtk_progress_bar_init (GtkProgressBar *pbar);
-static void gtk_progress_bar_realize (GtkWidget *widget);
-static void gtk_progress_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static gint gtk_progress_bar_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static void gtk_progress_bar_make_pixmap (GtkProgressBar *pbar);
-static void gtk_progress_bar_paint (GtkProgressBar *pbar);
-
-
-guint
-gtk_progress_bar_get_type ()
-{
- static guint progress_bar_type = 0;
-
- if (!progress_bar_type)
- {
- GtkTypeInfo progress_bar_info =
- {
- "GtkProgressBar",
- sizeof (GtkProgressBar),
- sizeof (GtkProgressBarClass),
- (GtkClassInitFunc) gtk_progress_bar_class_init,
- (GtkObjectInitFunc) gtk_progress_bar_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- progress_bar_type = gtk_type_unique (gtk_widget_get_type (), &progress_bar_info);
- }
-
- return progress_bar_type;
-}
-
-static void
-gtk_progress_bar_class_init (GtkProgressBarClass *class)
-{
- GtkWidgetClass *widget_class;
-
- widget_class = (GtkWidgetClass*) class;
-
- widget_class->realize = gtk_progress_bar_realize;
- widget_class->size_allocate = gtk_progress_bar_size_allocate;
- widget_class->expose_event = gtk_progress_bar_expose;
-}
-
-static void
-gtk_progress_bar_init (GtkProgressBar *pbar)
-{
- GTK_WIDGET_SET_FLAGS (pbar, GTK_BASIC);
-
- GTK_WIDGET (pbar)->requisition.width = MIN_WIDTH;
- GTK_WIDGET (pbar)->requisition.height = MIN_HEIGHT;
- pbar->offscreen_pixmap = NULL;
- pbar->percentage = 0;
-}
-
-
-GtkWidget*
-gtk_progress_bar_new ()
-{
- return GTK_WIDGET (gtk_type_new (gtk_progress_bar_get_type ()));
-}
-
-void
-gtk_progress_bar_update (GtkProgressBar *pbar,
- gfloat percentage)
-{
- g_return_if_fail (pbar != NULL);
- g_return_if_fail (GTK_IS_PROGRESS_BAR (pbar));
-
- if (percentage < 0.0)
- percentage = 0.0;
- else if (percentage > 1.0)
- percentage = 1.0;
-
- if (pbar->percentage != percentage)
- {
- pbar->percentage = percentage;
- gtk_progress_bar_paint (pbar);
- gtk_widget_queue_draw (GTK_WIDGET (pbar));
- }
-}
-
-static void
-gtk_progress_bar_realize (GtkWidget *widget)
-{
- GtkProgressBar *pbar;
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_PROGRESS_BAR (widget));
-
- pbar = GTK_PROGRESS_BAR (widget);
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget);
- attributes.event_mask |= GDK_EXPOSURE_MASK;
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, pbar);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_ACTIVE);
-
- gtk_progress_bar_make_pixmap (pbar);
-}
-
-static void
-gtk_progress_bar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_PROGRESS_BAR (widget));
- g_return_if_fail (allocation != NULL);
-
- widget->allocation = *allocation;
-
- if (GTK_WIDGET_REALIZED (widget))
- {
- gdk_window_move_resize (widget->window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
-
- gtk_progress_bar_make_pixmap (GTK_PROGRESS_BAR (widget));
- }
-}
-
-static gint
-gtk_progress_bar_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkProgressBar *pbar;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_PROGRESS_BAR (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- pbar = GTK_PROGRESS_BAR (widget);
-
- gdk_draw_pixmap (widget->window,
- widget->style->black_gc,
- pbar->offscreen_pixmap,
- 0, 0, 0, 0,
- widget->allocation.width,
- widget->allocation.height);
- }
-
- return FALSE;
-}
-
-static void
-gtk_progress_bar_make_pixmap (GtkProgressBar *pbar)
-{
- GtkWidget *widget;
-
- g_return_if_fail (pbar != NULL);
- g_return_if_fail (GTK_IS_PROGRESS_BAR (pbar));
-
- if (GTK_WIDGET_REALIZED (pbar))
- {
- widget = GTK_WIDGET (pbar);
-
- if (pbar->offscreen_pixmap)
- gdk_pixmap_unref (pbar->offscreen_pixmap);
-
- pbar->offscreen_pixmap = gdk_pixmap_new (widget->window,
- widget->allocation.width,
- widget->allocation.height,
- -1);
-
- gtk_progress_bar_paint (pbar);
- }
-}
-
-static void
-gtk_progress_bar_paint (GtkProgressBar *pbar)
-{
- GtkWidget *widget;
- int amount;
-
- g_return_if_fail (pbar != NULL);
- g_return_if_fail (GTK_IS_PROGRESS_BAR (pbar));
-
- if (pbar->offscreen_pixmap)
- {
- widget = GTK_WIDGET (pbar);
-
- gtk_draw_shadow (widget->style,
- pbar->offscreen_pixmap,
- GTK_STATE_NORMAL, GTK_SHADOW_IN, 0, 0,
- widget->allocation.width,
- widget->allocation.height);
-
- gdk_draw_rectangle (pbar->offscreen_pixmap,
- widget->style->bg_gc[GTK_STATE_ACTIVE], TRUE,
- widget->style->klass->xthickness,
- widget->style->klass->ythickness,
- widget->allocation.width - widget->style->klass->xthickness * 2,
- widget->allocation.height - widget->style->klass->ythickness * 2);
-
-
- amount = pbar->percentage * (widget->allocation.width - widget->style->klass->xthickness * 2);
- if (amount > 0)
- {
- gdk_draw_rectangle (pbar->offscreen_pixmap,
- widget->style->bg_gc[GTK_STATE_PRELIGHT], TRUE,
- widget->style->klass->xthickness,
- widget->style->klass->ythickness,
- amount,
- widget->allocation.height - widget->style->klass->ythickness * 2);
-
- gtk_draw_shadow (widget->style,
- pbar->offscreen_pixmap,
- GTK_STATE_PRELIGHT, GTK_SHADOW_OUT,
- widget->style->klass->xthickness,
- widget->style->klass->ythickness,
- amount,
- widget->allocation.height - widget->style->klass->ythickness * 2);
- }
- }
-}
diff --git a/gtk/gtkprogressbar.h b/gtk/gtkprogressbar.h
deleted file mode 100644
index e831dfb97a..0000000000
--- a/gtk/gtkprogressbar.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_PROGRESS_BAR_H__
-#define __GTK_PROGRESS_BAR_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkwidget.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_PROGRESS_BAR(obj) GTK_CHECK_CAST (obj, gtk_progress_bar_get_type (), GtkProgressBar)
-#define GTK_PROGRESS_BAR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_progress_bar_get_type (), GtkProgressBarClass)
-#define GTK_IS_PROGRESS_BAR(obj) GTK_CHECK_TYPE (obj, gtk_progress_bar_get_type ())
-
-
-typedef struct _GtkProgressBar GtkProgressBar;
-typedef struct _GtkProgressBarClass GtkProgressBarClass;
-
-struct _GtkProgressBar
-{
- GtkWidget widget;
-
- GdkPixmap *offscreen_pixmap;
- gfloat percentage;
-};
-
-struct _GtkProgressBarClass
-{
- GtkWidgetClass parent_class;
-};
-
-
-guint gtk_progress_bar_get_type (void);
-GtkWidget* gtk_progress_bar_new (void);
-void gtk_progress_bar_update (GtkProgressBar *pbar,
- gfloat percentage);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_PROGRESS_BAR_H__ */
diff --git a/gtk/gtkradiobutton.c b/gtk/gtkradiobutton.c
deleted file mode 100644
index 17b9800277..0000000000
--- a/gtk/gtkradiobutton.c
+++ /dev/null
@@ -1,333 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtklabel.h"
-#include "gtkradiobutton.h"
-#include "gtksignal.h"
-
-
-#define CHECK_BUTTON_CLASS(w) GTK_CHECK_BUTTON_CLASS (GTK_OBJECT (w)->klass)
-
-
-static void gtk_radio_button_class_init (GtkRadioButtonClass *klass);
-static void gtk_radio_button_init (GtkRadioButton *radio_button);
-static void gtk_radio_button_destroy (GtkObject *object);
-static void gtk_radio_button_clicked (GtkButton *button);
-static void gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
- GdkRectangle *area);
-
-
-static GtkCheckButtonClass *parent_class = NULL;
-
-
-guint
-gtk_radio_button_get_type ()
-{
- static guint radio_button_type = 0;
-
- if (!radio_button_type)
- {
- GtkTypeInfo radio_button_info =
- {
- "GtkRadioButton",
- sizeof (GtkRadioButton),
- sizeof (GtkRadioButtonClass),
- (GtkClassInitFunc) gtk_radio_button_class_init,
- (GtkObjectInitFunc) gtk_radio_button_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- radio_button_type = gtk_type_unique (gtk_check_button_get_type (), &radio_button_info);
- }
-
- return radio_button_type;
-}
-
-static void
-gtk_radio_button_class_init (GtkRadioButtonClass *class)
-{
- GtkObjectClass *object_class;
- GtkButtonClass *button_class;
- GtkCheckButtonClass *check_button_class;
-
- object_class = (GtkObjectClass*) class;
- button_class = (GtkButtonClass*) class;
- check_button_class = (GtkCheckButtonClass*) class;
-
- parent_class = gtk_type_class (gtk_check_button_get_type ());
-
- object_class->destroy = gtk_radio_button_destroy;
-
- button_class->clicked = gtk_radio_button_clicked;
-
- check_button_class->draw_indicator = gtk_radio_button_draw_indicator;
-}
-
-static void
-gtk_radio_button_init (GtkRadioButton *radio_button)
-{
- radio_button->group = NULL;
-}
-
-GtkWidget*
-gtk_radio_button_new (GSList *group)
-{
- GtkRadioButton *radio_button;
- GtkRadioButton *tmp_button;
- GSList *tmp_list;
-
- radio_button = gtk_type_new (gtk_radio_button_get_type ());
-
- tmp_list = group;
- radio_button->group = g_slist_prepend (group, radio_button);
-
- if (tmp_list)
- {
- while (tmp_list)
- {
- tmp_button = tmp_list->data;
- tmp_list = tmp_list->next;
-
- tmp_button->group = radio_button->group;
- }
- }
- else
- {
- GTK_TOGGLE_BUTTON (radio_button)->active = TRUE;
- gtk_widget_set_state (GTK_WIDGET (radio_button), GTK_STATE_ACTIVE);
- }
-
- return GTK_WIDGET (radio_button);
-}
-
-GtkWidget*
-gtk_radio_button_new_with_label (GSList *group,
- const gchar *label)
-{
- GtkWidget *radio_button;
- GtkWidget *label_widget;
-
- radio_button = gtk_radio_button_new (group);
- label_widget = gtk_label_new (label);
- gtk_misc_set_alignment (GTK_MISC (label_widget), 0.0, 0.5);
-
- gtk_container_add (GTK_CONTAINER (radio_button), label_widget);
- gtk_widget_show (label_widget);
-
- return radio_button;
-}
-
-GtkWidget*
-gtk_radio_button_new_from_widget (GtkRadioButton *group)
-{
- GSList *l = NULL;
- if (group)
- l = gtk_radio_button_group (group);
- return gtk_radio_button_new (l);
-}
-
-
-GtkWidget*
-gtk_radio_button_new_with_label_from_widget (GtkRadioButton *group,
- const gchar *label)
-{
- GSList *l = NULL;
- if (group)
- l = gtk_radio_button_group (group);
- return gtk_radio_button_new_with_label (l, label);
-}
-
-GSList*
-gtk_radio_button_group (GtkRadioButton *radio_button)
-{
- g_return_val_if_fail (radio_button != NULL, NULL);
- g_return_val_if_fail (GTK_IS_RADIO_BUTTON (radio_button), NULL);
-
- return radio_button->group;
-}
-
-
-static void
-gtk_radio_button_destroy (GtkObject *object)
-{
- GtkRadioButton *radio_button;
- GtkRadioButton *tmp_button;
- GSList *tmp_list;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_RADIO_BUTTON (object));
-
- radio_button = GTK_RADIO_BUTTON (object);
-
- radio_button->group = g_slist_remove (radio_button->group, radio_button);
- tmp_list = radio_button->group;
-
- while (tmp_list)
- {
- tmp_button = tmp_list->data;
- tmp_list = tmp_list->next;
-
- tmp_button->group = radio_button->group;
- }
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-static void
-gtk_radio_button_clicked (GtkButton *button)
-{
- GtkToggleButton *toggle_button;
- GtkRadioButton *radio_button;
- GtkToggleButton *tmp_button;
- GtkStateType new_state;
- GSList *tmp_list;
- gint toggled;
-
- g_return_if_fail (button != NULL);
- g_return_if_fail (GTK_IS_RADIO_BUTTON (button));
-
- radio_button = GTK_RADIO_BUTTON (button);
- toggle_button = GTK_TOGGLE_BUTTON (button);
- toggled = FALSE;
-
- if (toggle_button->active)
- {
- tmp_button = NULL;
- tmp_list = radio_button->group;
-
- while (tmp_list)
- {
- tmp_button = tmp_list->data;
- tmp_list = tmp_list->next;
-
- if (tmp_button->active && (tmp_button != toggle_button))
- break;
-
- tmp_button = NULL;
- }
-
- if (!tmp_button)
- {
- new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_ACTIVE);
- }
- else
- {
- toggled = TRUE;
- toggle_button->active = !toggle_button->active;
- new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL);
- }
- }
- else
- {
- toggled = TRUE;
- toggle_button->active = !toggle_button->active;
-
- tmp_list = radio_button->group;
- while (tmp_list)
- {
- tmp_button = tmp_list->data;
- tmp_list = tmp_list->next;
-
- if (tmp_button->active && (tmp_button != toggle_button))
- {
- gtk_button_clicked (GTK_BUTTON (tmp_button));
- break;
- }
- }
-
- new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_ACTIVE);
- }
-
- if (GTK_WIDGET_STATE (button) != new_state)
- gtk_widget_set_state (GTK_WIDGET (button), new_state);
- if (toggled)
- gtk_toggle_button_toggled (toggle_button);
- gtk_widget_queue_draw (GTK_WIDGET (button));
-}
-
-static void
-gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
- GdkRectangle *area)
-{
- GtkWidget *widget;
- GtkButton *button;
- GtkToggleButton *toggle_button;
- GtkStateType state_type;
- GtkShadowType shadow_type;
- GdkRectangle restrict_area;
- GdkRectangle new_area;
- GdkPoint pts[4];
- gint width, height;
- gint x, y;
-
- g_return_if_fail (check_button != NULL);
- g_return_if_fail (GTK_IS_RADIO_BUTTON (check_button));
-
- if (GTK_WIDGET_VISIBLE (check_button) && GTK_WIDGET_MAPPED (check_button))
- {
- widget = GTK_WIDGET (check_button);
- button = GTK_BUTTON (check_button);
- toggle_button = GTK_TOGGLE_BUTTON (check_button);
-
- state_type = GTK_WIDGET_STATE (widget);
- if ((state_type != GTK_STATE_NORMAL) &&
- (state_type != GTK_STATE_PRELIGHT))
- state_type = GTK_STATE_NORMAL;
-
- restrict_area.x = GTK_CONTAINER (widget)->border_width;
- restrict_area.y = restrict_area.x;
- restrict_area.width = widget->allocation.width - restrict_area.x * 2;
- restrict_area.height = widget->allocation.height - restrict_area.x * 2;
-
- if (gdk_rectangle_intersect (area, &restrict_area, &new_area))
- {
- gtk_style_set_background (widget->style, widget->window, state_type);
- gdk_window_clear_area (widget->window, new_area.x, new_area.y,
- new_area.width, new_area.height);
- }
-
- x = CHECK_BUTTON_CLASS (widget)->indicator_spacing + GTK_CONTAINER (widget)->border_width;
- y = (widget->allocation.height - CHECK_BUTTON_CLASS (widget)->indicator_size) / 2;
- width = CHECK_BUTTON_CLASS (widget)->indicator_size;
- height = CHECK_BUTTON_CLASS (widget)->indicator_size;
-
- if (GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE)
- shadow_type = GTK_SHADOW_IN;
- else if ((GTK_WIDGET_STATE (widget) == GTK_STATE_PRELIGHT) && toggle_button->active)
- shadow_type = GTK_SHADOW_IN;
- else
- shadow_type = GTK_SHADOW_OUT;
-
- pts[0].x = x + width / 2;
- pts[0].y = y;
- pts[1].x = x + width;
- pts[1].y = y + height / 2;
- pts[2].x = pts[0].x;
- pts[2].y = y + height;
- pts[3].x = x;
- pts[3].y = pts[1].y;
-
- gdk_draw_polygon (widget->window,
- widget->style->bg_gc[GTK_WIDGET_STATE (widget)],
- TRUE, pts, 4);
- gtk_draw_diamond (widget->style, widget->window,
- GTK_WIDGET_STATE (widget), shadow_type,
- x, y, width, height);
- }
-}
diff --git a/gtk/gtkradiobutton.h b/gtk/gtkradiobutton.h
deleted file mode 100644
index 468e5b7eba..0000000000
--- a/gtk/gtkradiobutton.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_RADIO_BUTTON_H__
-#define __GTK_RADIO_BUTTON_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkcheckbutton.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_RADIO_BUTTON(obj) GTK_CHECK_CAST (obj, gtk_radio_button_get_type (), GtkRadioButton)
-#define GTK_RADIO_BUTTON_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_radio_button_get_type (), GtkRadioButtonClass)
-#define GTK_IS_RADIO_BUTTON(obj) GTK_CHECK_TYPE (obj, gtk_radio_button_get_type ())
-
-
-typedef struct _GtkRadioButton GtkRadioButton;
-typedef struct _GtkRadioButtonClass GtkRadioButtonClass;
-
-struct _GtkRadioButton
-{
- GtkCheckButton check_button;
-
- GSList *group;
-};
-
-struct _GtkRadioButtonClass
-{
- GtkCheckButtonClass parent_class;
-};
-
-
-guint gtk_radio_button_get_type (void);
-GtkWidget* gtk_radio_button_new (GSList *group);
-GtkWidget* gtk_radio_button_new_from_widget (GtkRadioButton *group);
-GtkWidget* gtk_radio_button_new_with_label (GSList *group,
- const gchar *label);
-GSList* gtk_radio_button_group (GtkRadioButton *radio_button);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_RADIO_BUTTON_H__ */
diff --git a/gtk/gtkradiomenuitem.c b/gtk/gtkradiomenuitem.c
deleted file mode 100644
index eb9c0c976d..0000000000
--- a/gtk/gtkradiomenuitem.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtklabel.h"
-#include "gtkradiomenuitem.h"
-
-
-static void gtk_radio_menu_item_class_init (GtkRadioMenuItemClass *klass);
-static void gtk_radio_menu_item_init (GtkRadioMenuItem *radio_menu_item);
-static void gtk_radio_menu_item_activate (GtkMenuItem *menu_item);
-static void gtk_radio_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
- GdkRectangle *area);
-
-
-guint
-gtk_radio_menu_item_get_type ()
-{
- static guint radio_menu_item_type = 0;
-
- if (!radio_menu_item_type)
- {
- GtkTypeInfo radio_menu_item_info =
- {
- "GtkRadioMenuItem",
- sizeof (GtkRadioMenuItem),
- sizeof (GtkRadioMenuItemClass),
- (GtkClassInitFunc) gtk_radio_menu_item_class_init,
- (GtkObjectInitFunc) gtk_radio_menu_item_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- radio_menu_item_type = gtk_type_unique (gtk_check_menu_item_get_type (), &radio_menu_item_info);
- }
-
- return radio_menu_item_type;
-}
-
-GtkWidget*
-gtk_radio_menu_item_new (GSList *group)
-{
- GtkRadioMenuItem *radio_menu_item;
- GtkRadioMenuItem *tmp_menu_item;
- GSList *tmp_list;
-
- radio_menu_item = gtk_type_new (gtk_radio_menu_item_get_type ());
-
- tmp_list = group;
- radio_menu_item->group = g_slist_prepend (group, radio_menu_item);
-
- if (tmp_list)
- {
- while (tmp_list)
- {
- tmp_menu_item = tmp_list->data;
- tmp_list = tmp_list->next;
-
- tmp_menu_item->group = radio_menu_item->group;
- }
- }
- else
- {
- GTK_CHECK_MENU_ITEM (radio_menu_item)->active = TRUE;
- }
-
- return GTK_WIDGET (radio_menu_item);
-}
-
-GtkWidget*
-gtk_radio_menu_item_new_with_label (GSList *group,
- const gchar *label)
-{
- GtkWidget *radio_menu_item;
- GtkWidget *label_widget;
-
- radio_menu_item = gtk_radio_menu_item_new (group);
- label_widget = gtk_label_new (label);
- gtk_misc_set_alignment (GTK_MISC (label_widget), 0.0, 0.5);
-
- gtk_container_add (GTK_CONTAINER (radio_menu_item), label_widget);
- gtk_widget_show (label_widget);
-
- return radio_menu_item;
-}
-
-GSList*
-gtk_radio_menu_item_group (GtkRadioMenuItem *radio_menu_item)
-{
- g_return_val_if_fail (radio_menu_item != NULL, NULL);
- g_return_val_if_fail (GTK_IS_RADIO_MENU_ITEM (radio_menu_item), NULL);
-
- return radio_menu_item->group;
-}
-
-
-static void
-gtk_radio_menu_item_class_init (GtkRadioMenuItemClass *klass)
-{
- GtkMenuItemClass *menu_item_class;
- GtkCheckMenuItemClass *check_menu_item_class;
-
- menu_item_class = (GtkMenuItemClass*) klass;
- check_menu_item_class = (GtkCheckMenuItemClass*) klass;
-
- menu_item_class->activate = gtk_radio_menu_item_activate;
-
- check_menu_item_class->draw_indicator = gtk_radio_menu_item_draw_indicator;
-}
-
-static void
-gtk_radio_menu_item_init (GtkRadioMenuItem *radio_menu_item)
-{
- radio_menu_item->group = NULL;
-}
-
-static void
-gtk_radio_menu_item_activate (GtkMenuItem *menu_item)
-{
- GtkRadioMenuItem *radio_menu_item;
- GtkCheckMenuItem *check_menu_item;
- GtkCheckMenuItem *tmp_menu_item;
- GSList *tmp_list;
- gint toggled;
-
- g_return_if_fail (menu_item != NULL);
- g_return_if_fail (GTK_IS_RADIO_MENU_ITEM (menu_item));
-
- radio_menu_item = GTK_RADIO_MENU_ITEM (menu_item);
- check_menu_item = GTK_CHECK_MENU_ITEM (menu_item);
- toggled = FALSE;
-
- if (check_menu_item->active)
- {
- tmp_menu_item = NULL;
- tmp_list = radio_menu_item->group;
-
- while (tmp_list)
- {
- tmp_menu_item = tmp_list->data;
- tmp_list = tmp_list->next;
-
- if (tmp_menu_item->active && (tmp_menu_item != check_menu_item))
- break;
-
- tmp_menu_item = NULL;
- }
-
- if (tmp_menu_item)
- {
- toggled = TRUE;
- check_menu_item->active = !check_menu_item->active;
- }
- }
- else
- {
- toggled = TRUE;
- check_menu_item->active = !check_menu_item->active;
-
- tmp_list = radio_menu_item->group;
- while (tmp_list)
- {
- tmp_menu_item = tmp_list->data;
- tmp_list = tmp_list->next;
-
- if (tmp_menu_item->active && (tmp_menu_item != check_menu_item))
- {
- gtk_menu_item_activate (GTK_MENU_ITEM (tmp_menu_item));
- break;
- }
- }
- }
-
- if (toggled)
- gtk_check_menu_item_toggled (check_menu_item);
- gtk_widget_queue_draw (GTK_WIDGET (radio_menu_item));
-}
-
-static void
-gtk_radio_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
- GdkRectangle *area)
-{
- GtkWidget *widget;
- GtkStateType state_type;
- GtkShadowType shadow_type;
- GdkPoint pts[4];
- gint width, height;
- gint x, y;
-
- g_return_if_fail (check_menu_item != NULL);
- g_return_if_fail (GTK_IS_RADIO_MENU_ITEM (check_menu_item));
-
- if (GTK_WIDGET_DRAWABLE (check_menu_item))
- {
- widget = GTK_WIDGET (check_menu_item);
-
- width = 8;
- height = 8;
- x = (GTK_CONTAINER (check_menu_item)->border_width +
- widget->style->klass->xthickness + 2);
- y = (widget->allocation.height - height) / 2;
-
- gdk_window_clear_area (widget->window, x, y, width, height);
-
- if (check_menu_item->active ||
- check_menu_item->always_show_toggle ||
- (GTK_WIDGET_STATE (check_menu_item) == GTK_STATE_PRELIGHT))
- {
- state_type = GTK_WIDGET_STATE (widget);
- if (check_menu_item->active ||
- !check_menu_item->always_show_toggle)
- shadow_type = GTK_SHADOW_IN;
- else
- shadow_type = GTK_SHADOW_OUT;
-
- pts[0].x = x + width / 2;
- pts[0].y = y;
- pts[1].x = x + width;
- pts[1].y = y + height / 2;
- pts[2].x = pts[0].x;
- pts[2].y = y + height;
- pts[3].x = x;
- pts[3].y = pts[1].y;
-
- gdk_draw_polygon (widget->window,
- widget->style->bg_gc[state_type],
- TRUE, pts, 4);
- gtk_draw_diamond (widget->style, widget->window,
- state_type, shadow_type,
- x, y, width, height);
- }
- }
-}
diff --git a/gtk/gtkradiomenuitem.h b/gtk/gtkradiomenuitem.h
deleted file mode 100644
index 28abafc6b5..0000000000
--- a/gtk/gtkradiomenuitem.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_RADIO_MENU_ITEM_H__
-#define __GTK_RADIO_MENU_ITEM_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkcheckmenuitem.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_RADIO_MENU_ITEM(obj) GTK_CHECK_CAST (obj, gtk_radio_menu_item_get_type (), GtkRadioMenuItem)
-#define GTK_RADIO_MENU_ITEM_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_radio_menu_item_get_type (), GtkRadioMenuItemClass)
-#define GTK_IS_RADIO_MENU_ITEM(obj) GTK_CHECK_TYPE (obj, gtk_radio_menu_item_get_type ())
-
-
-typedef struct _GtkRadioMenuItem GtkRadioMenuItem;
-typedef struct _GtkRadioMenuItemClass GtkRadioMenuItemClass;
-
-struct _GtkRadioMenuItem
-{
- GtkCheckMenuItem check_menu_item;
-
- GSList *group;
-};
-
-struct _GtkRadioMenuItemClass
-{
- GtkCheckMenuItemClass parent_class;
-};
-
-
-guint gtk_radio_menu_item_get_type (void);
-GtkWidget* gtk_radio_menu_item_new (GSList *group);
-GtkWidget* gtk_radio_menu_item_new_with_label (GSList *group,
- const gchar *label);
-GSList* gtk_radio_menu_item_group (GtkRadioMenuItem *radio_menu_item);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_RADIO_MENU_ITEM_H__ */
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 0e939b7dc8..eebc00c083 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -387,33 +387,36 @@ gtk_range_default_htrough_click (GtkRange *range,
gint y,
gfloat *jump_perc)
{
- gint xthickness;
gint ythickness;
gint trough_width;
gint trough_height;
gint slider_x;
+ gint slider_length;
+ gint left, right;
g_return_val_if_fail (range != NULL, GTK_TROUGH_NONE);
g_return_val_if_fail (GTK_IS_RANGE (range), GTK_TROUGH_NONE);
- xthickness = GTK_WIDGET (range)->style->klass->xthickness;
ythickness = GTK_WIDGET (range)->style->klass->ythickness;
- if ((x > xthickness) && (y > ythickness))
+ gtk_range_trough_hdims (range, &left, &right);
+ gdk_window_get_size (range->slider, &slider_length, NULL);
+ right += slider_length;
+
+ if ((x > left) && (y > ythickness))
{
gdk_window_get_size (range->trough, &trough_width, &trough_height);
- if ((x < (trough_width - xthickness) && (y < (trough_height - ythickness))))
+ if ((x < right) && (y < (trough_height - ythickness)))
{
- gdk_window_get_position (range->slider, &slider_x, NULL);
-
if (jump_perc)
{
- *jump_perc = ((double) x) / ((double) trough_width);
-
+ *jump_perc = ((gdouble) (x - left)) / ((gdouble) (right - left));
return GTK_TROUGH_JUMP;
}
+ gdk_window_get_position (range->slider, &slider_x, NULL);
+
if (x < slider_x)
return GTK_TROUGH_START;
else
@@ -431,32 +434,36 @@ gtk_range_default_vtrough_click (GtkRange *range,
gfloat *jump_perc)
{
gint xthickness;
- gint ythickness;
gint trough_width;
gint trough_height;
gint slider_y;
+ gint top, bottom;
+ gint slider_length;
g_return_val_if_fail (range != NULL, GTK_TROUGH_NONE);
g_return_val_if_fail (GTK_IS_RANGE (range), GTK_TROUGH_NONE);
xthickness = GTK_WIDGET (range)->style->klass->xthickness;
- ythickness = GTK_WIDGET (range)->style->klass->ythickness;
- if ((x > xthickness) && (y > ythickness))
+ gtk_range_trough_vdims (range, &top, &bottom);
+ gdk_window_get_size (range->slider, NULL, &slider_length);
+ bottom += slider_length;
+
+ if ((x > xthickness) && (y > top))
{
gdk_window_get_size (range->trough, &trough_width, &trough_height);
- if ((x < (trough_width - xthickness) && (y < (trough_height - ythickness))))
+ if ((x < (trough_width - xthickness) && (y < bottom)))
{
- gdk_window_get_position (range->slider, NULL, &slider_y);
-
if (jump_perc)
{
- *jump_perc = ((double) y) / ((double) trough_height);
+ *jump_perc = ((gdouble) (y - top)) / ((gdouble) (bottom - top));
return GTK_TROUGH_JUMP;
}
+ gdk_window_get_position (range->slider, NULL, &slider_y);
+
if (y < slider_y)
return GTK_TROUGH_START;
else
diff --git a/gtk/gtkrange.h b/gtk/gtkrange.h
deleted file mode 100644
index ad68af94ac..0000000000
--- a/gtk/gtkrange.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_RANGE_H__
-#define __GTK_RANGE_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkadjustment.h>
-#include <gtk/gtkwidget.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_RANGE(obj) GTK_CHECK_CAST (obj, gtk_range_get_type (), GtkRange)
-#define GTK_RANGE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_range_get_type (), GtkRangeClass)
-#define GTK_IS_RANGE(obj) GTK_CHECK_TYPE (obj, gtk_range_get_type ())
-
-
-typedef struct _GtkRange GtkRange;
-typedef struct _GtkRangeClass GtkRangeClass;
-
-struct _GtkRange
-{
- GtkWidget widget;
-
- GdkWindow *trough;
- GdkWindow *slider;
- GdkWindow *step_forw;
- GdkWindow *step_back;
-
- gint16 x_click_point;
- gint16 y_click_point;
-
- guint8 button;
- gint8 digits;
- guint policy : 2;
- guint scroll_type : 3;
- guint in_child : 3;
- guint click_child : 3;
- guint need_timer : 1;
-
- guint32 timer;
-
- gfloat old_value;
- gfloat old_lower;
- gfloat old_upper;
- gfloat old_page_size;
-
- GtkAdjustment *adjustment;
-};
-
-struct _GtkRangeClass
-{
- GtkWidgetClass parent_class;
-
- gint slider_width;
- gint stepper_size;
- gint stepper_slider_spacing;
- gint min_slider_size;
-
- guint8 trough;
- guint8 slider;
- guint8 step_forw;
- guint8 step_back;
-
- void (* draw_background) (GtkRange *range);
- void (* draw_trough) (GtkRange *range);
- void (* draw_slider) (GtkRange *range);
- void (* draw_step_forw) (GtkRange *range);
- void (* draw_step_back) (GtkRange *range);
- void (* slider_update) (GtkRange *range);
- gint (* trough_click) (GtkRange *range,
- gint x,
- gint y,
- gfloat *jump_perc);
- gint (* trough_keys) (GtkRange *range,
- GdkEventKey *key,
- GtkScrollType *scroll,
- GtkTroughType *trough);
- void (* motion) (GtkRange *range,
- gint xdelta,
- gint ydelta);
- gint (* timer) (GtkRange *range);
-};
-
-
-guint gtk_range_get_type (void);
-GtkAdjustment* gtk_range_get_adjustment (GtkRange *range);
-void gtk_range_set_update_policy (GtkRange *range,
- GtkUpdateType policy);
-void gtk_range_set_adjustment (GtkRange *range,
- GtkAdjustment *adjustment);
-
-void gtk_range_draw_background (GtkRange *range);
-void gtk_range_draw_trough (GtkRange *range);
-void gtk_range_draw_slider (GtkRange *range);
-void gtk_range_draw_step_forw (GtkRange *range);
-void gtk_range_draw_step_back (GtkRange *range);
-void gtk_range_slider_update (GtkRange *range);
-gint gtk_range_trough_click (GtkRange *range,
- gint x,
- gint y,
- gfloat *jump_perc);
-
-void gtk_range_default_hslider_update (GtkRange *range);
-void gtk_range_default_vslider_update (GtkRange *range);
-gint gtk_range_default_htrough_click (GtkRange *range,
- gint x,
- gint y,
- gfloat *jump_perc);
-gint gtk_range_default_vtrough_click (GtkRange *range,
- gint x,
- gint y,
- gfloat *jump_perc);
-void gtk_range_default_hmotion (GtkRange *range,
- gint xdelta,
- gint ydelta);
-void gtk_range_default_vmotion (GtkRange *range,
- gint xdelta,
- gint ydelta);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_RANGE_H__ */
diff --git a/gtk/gtkrc.c b/gtk/gtkrc.c
deleted file mode 100644
index 21cb92eb37..0000000000
--- a/gtk/gtkrc.c
+++ /dev/null
@@ -1,1425 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <ctype.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdio.h>
-#include "gtkrc.h"
-
-
-enum {
- TOKEN_INVALID = G_TOKEN_LAST,
- TOKEN_ACTIVE,
- TOKEN_BASE,
- TOKEN_BG,
- TOKEN_BG_PIXMAP,
- TOKEN_FG,
- TOKEN_FONT,
- TOKEN_FONTSET,
- TOKEN_INSENSITIVE,
- TOKEN_NORMAL,
- TOKEN_PIXMAP_PATH,
- TOKEN_PRELIGHT,
- TOKEN_SELECTED,
- TOKEN_STYLE,
- TOKEN_TEXT,
- TOKEN_WIDGET,
- TOKEN_WIDGET_CLASS
-};
-
-enum {
- PARSE_OK,
- PARSE_ERROR,
- PARSE_SYNTAX
-};
-
-enum {
- PARSE_START,
- PARSE_COMMENT,
- PARSE_STRING,
- PARSE_SYMBOL,
- PARSE_NUMBER
-};
-
-
-typedef struct _GtkRcStyle GtkRcStyle;
-typedef struct _GtkRcSet GtkRcSet;
-typedef struct _GtkRcNode GtkRcNode;
-
-struct _GtkRcNode
-{
- GdkColormap *cmap;
- GtkStyle *style;
-};
-
-struct _GtkRcStyle
-{
- char *name;
- char *font_name;
- char *fontset_name;
- char *bg_pixmap_name[5];
- GtkStyle *proto_style;
- GList *styles;
-};
-
-struct _GtkRcSet
-{
- char *set;
- GtkRcStyle *rc_style;
-};
-
-
-static guint gtk_rc_style_hash (const char *name);
-static gint gtk_rc_style_compare (const char *a,
- const char *b);
-static GtkRcStyle* gtk_rc_style_find (const char *name);
-static GtkRcStyle* gtk_rc_styles_match (GSList *sets,
- const char *path);
-static gint gtk_rc_style_match (const char *set,
- const char *path);
-static GtkStyle* gtk_rc_style_init (GtkRcStyle *rc_style,
- GdkColormap *cmap);
-static void gtk_rc_parse_any (const gchar *input_name,
- gint input_fd,
- const gchar *input_string);
-static gint gtk_rc_parse_statement (GScanner *scanner);
-static gint gtk_rc_parse_style (GScanner *scanner);
-static gint gtk_rc_parse_style_option (GScanner *scanner,
- GtkRcStyle *rc_style);
-static gint gtk_rc_parse_base (GScanner *scanner,
- GtkStyle *style);
-static gint gtk_rc_parse_bg (GScanner *scanner,
- GtkStyle *style);
-static gint gtk_rc_parse_fg (GScanner *scanner,
- GtkStyle *style);
-static gint gtk_rc_parse_text (GScanner *scanner,
- GtkStyle *style);
-static gint gtk_rc_parse_bg_pixmap (GScanner *scanner,
- GtkRcStyle *rc_style);
-static gint gtk_rc_parse_font (GScanner *scanner,
- GtkRcStyle *rc_style);
-static gint gtk_rc_parse_fontset (GScanner *scanner,
- GtkRcStyle *rc_style);
-static gint gtk_rc_parse_state (GScanner *scanner,
- GtkStateType *state);
-static gint gtk_rc_parse_color (GScanner *scanner,
- GdkColor *color);
-static gint gtk_rc_parse_pixmap_path (GScanner *scanner);
-static void gtk_rc_parse_pixmap_path_string (gchar *pix_path);
-static char* gtk_rc_find_pixmap_in_path (GScanner *scanner,
- gchar *pixmap_file);
-static gint gtk_rc_parse_widget_style (GScanner *scanner);
-static gint gtk_rc_parse_widget_class_style (GScanner *scanner);
-static char* gtk_rc_widget_path (GtkWidget *widget);
-static char* gtk_rc_widget_class_path (GtkWidget *widget);
-
-
-static GScannerConfig gtk_rc_scanner_config =
-{
- (
- " \t\n"
- ) /* cset_skip_characters */,
- (
- G_CSET_a_2_z
- "_"
- G_CSET_A_2_Z
- ) /* cset_identifier_first */,
- (
- G_CSET_a_2_z
- "_0123456789"
- G_CSET_A_2_Z
- G_CSET_LATINS
- G_CSET_LATINC
- ) /* cset_identifier_nth */,
- ( "#\n" ) /* cpair_comment_single */,
-
- TRUE /* case_sensitive */,
-
- TRUE /* skip_comment_multi */,
- TRUE /* skip_comment_single */,
- TRUE /* scan_comment_multi */,
- TRUE /* scan_identifier */,
- FALSE /* scan_identifier_1char */,
- FALSE /* scan_identifier_NULL */,
- TRUE /* scan_symbols */,
- TRUE /* scan_binary */,
- TRUE /* scan_octal */,
- TRUE /* scan_float */,
- TRUE /* scan_hex */,
- TRUE /* scan_hex_dollar */,
- TRUE /* scan_string_sq */,
- TRUE /* scan_string_dq */,
- TRUE /* numbers_2_int */,
- FALSE /* int_2_float */,
- TRUE /* identifier_2_string */,
- TRUE /* char_2_token */,
- TRUE /* symbol_2_token */,
-};
-
-static struct
-{
- char *name;
- int token;
-} symbols[] =
- {
- { "ACTIVE", TOKEN_ACTIVE },
- { "base", TOKEN_BASE },
- { "bg", TOKEN_BG },
- { "bg_pixmap", TOKEN_BG_PIXMAP },
- { "fg", TOKEN_FG },
- { "font", TOKEN_FONT },
- { "fontset", TOKEN_FONTSET },
- { "INSENSITIVE", TOKEN_INSENSITIVE },
- { "NORMAL", TOKEN_NORMAL },
- { "pixmap_path", TOKEN_PIXMAP_PATH },
- { "PRELIGHT", TOKEN_PRELIGHT },
- { "SELECTED", TOKEN_SELECTED },
- { "style", TOKEN_STYLE },
- { "text", TOKEN_TEXT },
- { "widget", TOKEN_WIDGET },
- { "widget_class", TOKEN_WIDGET_CLASS },
- };
-static int nsymbols = sizeof (symbols) / sizeof (symbols[0]);
-
-static int done;
-
-static GHashTable *rc_style_ht = NULL;
-static GSList *widget_sets = NULL;
-static GSList *widget_class_sets = NULL;
-
-#define GTK_RC_MAX_PIXMAP_PATHS 128
-static gchar *pixmap_path[GTK_RC_MAX_PIXMAP_PATHS];
-
-
-void
-gtk_rc_init ()
-{
- rc_style_ht = g_hash_table_new ((GHashFunc) gtk_rc_style_hash,
- (GCompareFunc) gtk_rc_style_compare);
-}
-
-void
-gtk_rc_parse_string (const gchar *rc_string)
-{
- g_return_if_fail (rc_string != NULL);
-
- gtk_rc_parse_any ("-", -1, rc_string);
-}
-
-void
-gtk_rc_parse (const gchar *filename)
-{
- gint fd;
-
- g_return_if_fail (filename != NULL);
-
- fd = open (filename, O_RDONLY);
- if (fd < 0)
- return;
-
- gtk_rc_parse_any (filename, fd, NULL);
-
- close (fd);
-}
-
-GtkStyle*
-gtk_rc_get_style (GtkWidget *widget)
-{
- GtkRcStyle *rc_style;
- char *path;
-
- if (widget_sets)
- {
- path = gtk_rc_widget_path (widget);
- if (path)
- {
- rc_style = gtk_rc_styles_match (widget_sets, path);
- g_free (path);
-
- if (rc_style)
- {
- return gtk_rc_style_init (rc_style,
- gtk_widget_get_colormap (widget));
- }
- }
- }
-
- if (widget_class_sets)
- {
- path = gtk_rc_widget_class_path (widget);
- if (path)
- {
- rc_style = gtk_rc_styles_match (widget_class_sets, path);
- g_free (path);
-
- if (rc_style)
- {
- return gtk_rc_style_init (rc_style,
- gtk_widget_get_colormap (widget));
- }
- }
- }
-
- return NULL;
-}
-
-void
-gtk_rc_add_widget_name_style (GtkStyle *style,
- const char *pattern)
-{
- GtkRcStyle *rc_style;
- GtkRcSet *rc_set;
- int i;
-
- gtk_style_ref (style);
-
- rc_style = g_new (GtkRcStyle, 1);
- rc_style->name = NULL;
- rc_style->font_name = NULL;
- rc_style->fontset_name = NULL;
-
- for (i = 0; i < 5; i++)
- rc_style->bg_pixmap_name[i] = NULL;
-
- rc_style->styles = g_list_append (NULL, style);
-
- rc_set = g_new (GtkRcSet, 1);
- rc_set->set = g_strdup (pattern);
- rc_set->rc_style = rc_style;
-
- widget_sets = g_slist_append (widget_sets, rc_set);
-}
-
-void
-gtk_rc_add_widget_class_style (GtkStyle *style,
- const char *pattern)
-{
- GtkRcStyle *rc_style;
- GtkRcSet *rc_set;
- int i;
-
- gtk_style_ref (style);
-
- rc_style = g_new (GtkRcStyle, 1);
- rc_style->name = NULL;
- rc_style->font_name = NULL;
- rc_style->fontset_name = NULL;
-
- for (i = 0; i < 5; i++)
- rc_style->bg_pixmap_name[i] = NULL;
-
- rc_style->styles = g_list_append (NULL, style);
-
- rc_set = g_new (GtkRcSet, 1);
- rc_set->set = g_strdup (pattern);
- rc_set->rc_style = rc_style;
-
- widget_class_sets = g_slist_append (widget_class_sets, rc_set);
-}
-
-static void
-gtk_rc_parse_any (const gchar *input_name,
- gint input_fd,
- const gchar *input_string)
-{
- GScanner *scanner;
- guint i;
-
- scanner = g_scanner_new (&gtk_rc_scanner_config);
-
- if (input_fd >= 0)
- {
- g_assert (input_string == NULL);
-
- g_scanner_input_file (scanner, input_fd);
- }
- else
- {
- g_assert (input_string != NULL);
-
- g_scanner_input_text (scanner, input_string, strlen (input_string));
- }
-
- for (i = 0; i < nsymbols; i++)
- g_scanner_add_symbol (scanner, symbols[i].name, (gpointer) symbols[i].token);
-
- done = FALSE;
- while (!done)
- {
- if (gtk_rc_parse_statement (scanner) != PARSE_OK)
- {
- if (scanner->next_token != G_TOKEN_NONE)
- g_scanner_get_next_token (scanner);
-
- if (input_string)
- g_warning ("rc string parse error: line %d",
- scanner->line);
- else
- g_warning ("rc file parse error: \"%s\" line %d",
- input_name,
- scanner->line);
-
- done = TRUE;
- }
- }
- g_scanner_destroy (scanner);
-}
-
-static guint
-gtk_rc_style_hash (const char *name)
-{
- guint result;
-
- result = 0;
- while (*name)
- result += (result << 3) + *name++;
-
- return result;
-}
-
-static gint
-gtk_rc_style_compare (const char *a,
- const char *b)
-{
- return (strcmp (a, b) == 0);
-}
-
-static GtkRcStyle*
-gtk_rc_style_find (const char *name)
-{
- GtkRcStyle *rc_style;
-
- rc_style = g_hash_table_lookup (rc_style_ht, (gpointer) name);
-
- return rc_style;
-}
-
-static GtkRcStyle*
-gtk_rc_styles_match (GSList *sets,
- const char *path)
-{
- GtkRcSet *rc_set;
-
- while (sets)
- {
- rc_set = sets->data;
- sets = sets->next;
-
- if (gtk_rc_style_match (rc_set->set, path))
- return rc_set->rc_style;
- }
-
- return NULL;
-}
-
-static gint
-gtk_rc_style_match (const char *set,
- const char *path)
-{
- char ch;
-
- while (1)
- {
- ch = *set++;
- if (ch == '\0')
- return (*path == '\0');
-
- switch (ch)
- {
- case '*':
- while (*set == '*')
- set++;
-
- ch = *set++;
- if (ch == '\0')
- return TRUE;
-
- while (*path)
- {
- while (*path && (ch != *path))
- path++;
-
- if (!(*path))
- return FALSE;
-
- path++;
- if (gtk_rc_style_match (set, path))
- return TRUE;
- }
- break;
-
- case '?':
- break;
-
- default:
- if (ch == *path)
- path++;
- else
- return FALSE;
- break;
- }
- }
-
- return TRUE;
-}
-
-static GtkStyle *
-gtk_rc_style_init (GtkRcStyle *rc_style, GdkColormap *cmap)
-{
- GdkFont *old_font;
- gboolean match_cmap = FALSE;
- gint i;
-
- GList *tmp_list;
- GtkStyle *style = NULL;
- GtkRcNode *node;
-
- tmp_list = rc_style->styles;
-
- for (i=0; i<5; i++)
- if (rc_style->bg_pixmap_name[i])
- match_cmap = TRUE;
-
- while (tmp_list)
- {
- node = (GtkRcNode *)tmp_list->data;
-
- if (!match_cmap || (node->cmap == cmap))
- {
- style = node->style;
- break;
- }
-
- tmp_list = tmp_list->next;
- }
-
- if (!style)
- {
- node = g_new (GtkRcNode, 1);
- style = gtk_style_copy (rc_style->proto_style);
-
- /* FIXME, this leaks colormaps, but if we don't do this, then we'll
- * be screwed, because we identify colormaps by address equality
- */
- gdk_colormap_ref (cmap);
-
- node->style = style;
- node->cmap = cmap;
-
- if (rc_style->fontset_name)
- {
- old_font = style->font;
- style->font = gdk_fontset_load (rc_style->fontset_name);
- if (style->font)
- gdk_font_unref (old_font);
- else
- style->font = old_font;
- }
- else if (rc_style->font_name)
- {
- old_font = style->font;
- style->font = gdk_font_load (rc_style->font_name);
- if (style->font)
- gdk_font_unref (old_font);
- else
- style->font = old_font;
- }
-
- for (i = 0; i < 5; i++)
- if (rc_style->bg_pixmap_name[i])
- {
- if (strcmp (rc_style->bg_pixmap_name[i], "<parent>") == 0)
- style->bg_pixmap[i] = (GdkPixmap*) GDK_PARENT_RELATIVE;
- else
- style->bg_pixmap[i] =
- gdk_pixmap_colormap_create_from_xpm (NULL, cmap,
- NULL,
- &style->bg[i],
- rc_style->bg_pixmap_name[i]);
- }
-
- rc_style->styles = g_list_append (rc_style->styles, node);
- }
-
- return style;
-}
-
-static gint
-gtk_rc_parse_statement (GScanner *scanner)
-{
- gint token;
- gint error;
-
- token = g_scanner_peek_next_token (scanner);
- if (token == G_TOKEN_EOF)
- {
- done = TRUE;
- return PARSE_OK;
- }
-
- error = gtk_rc_parse_style (scanner);
- if (error != PARSE_SYNTAX)
- return error;
-
- error = gtk_rc_parse_pixmap_path (scanner);
- if (error != PARSE_SYNTAX)
- return error;
-
- error = gtk_rc_parse_widget_style (scanner);
- if (error != PARSE_SYNTAX)
- return error;
-
- error = gtk_rc_parse_widget_class_style (scanner);
-
- return error;
-}
-
-static gint
-gtk_rc_parse_style (GScanner *scanner)
-{
- GtkRcStyle *rc_style;
- GtkRcStyle *parent_style;
- gint token;
- gint error;
- gint insert;
- gint i;
-
- token = g_scanner_peek_next_token (scanner);
- if (token == G_TOKEN_EOF || token == G_TOKEN_ERROR)
- return PARSE_ERROR;
- if (token != TOKEN_STYLE)
- return PARSE_SYNTAX;
- token = g_scanner_get_next_token (scanner);
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_STRING)
- return PARSE_ERROR;
-
- insert = FALSE;
- rc_style = g_hash_table_lookup (rc_style_ht, scanner->value.v_string);
-
- if (!rc_style)
- {
- insert = TRUE;
- rc_style = g_new (GtkRcStyle, 1);
- rc_style->name = g_strdup (scanner->value.v_string);
- rc_style->font_name = NULL;
- rc_style->fontset_name = NULL;
-
- for (i = 0; i < 5; i++)
- rc_style->bg_pixmap_name[i] = NULL;
-
- rc_style->proto_style = gtk_style_new();
- rc_style->styles = NULL;
- }
-
- token = g_scanner_peek_next_token (scanner);
- if (token == G_TOKEN_EQUAL_SIGN)
- {
- token = g_scanner_get_next_token (scanner);
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_STRING)
- {
- if (insert)
- {
- gtk_style_unref (rc_style->proto_style);
- g_free (rc_style);
- }
- return PARSE_ERROR;
- }
-
- parent_style = g_hash_table_lookup (rc_style_ht, scanner->value.v_string);
- if (parent_style)
- {
- for (i = 0; i < 5; i++)
- {
- rc_style->proto_style->fg[i] = parent_style->proto_style->fg[i];
- rc_style->proto_style->bg[i] = parent_style->proto_style->bg[i];
- rc_style->proto_style->light[i] = parent_style->proto_style->light[i];
- rc_style->proto_style->dark[i] = parent_style->proto_style->dark[i];
- rc_style->proto_style->mid[i] = parent_style->proto_style->mid[i];
- rc_style->proto_style->text[i] = parent_style->proto_style->text[i];
- rc_style->proto_style->base[i] = parent_style->proto_style->base[i];
- }
-
- rc_style->proto_style->black = parent_style->proto_style->black;
- rc_style->proto_style->white = parent_style->proto_style->white;
-
- if (rc_style->fontset_name)
- {
- g_free (rc_style->fontset_name);
- rc_style->fontset_name = g_strdup (parent_style->fontset_name);
- }
- else if (rc_style->font_name)
- {
- g_free (rc_style->font_name);
- rc_style->font_name = g_strdup (parent_style->font_name);
- }
-
- for (i = 0; i < 5; i++)
- {
- if (rc_style->bg_pixmap_name[i])
- g_free (rc_style->bg_pixmap_name[i]);
- rc_style->bg_pixmap_name[i] = g_strdup (parent_style->bg_pixmap_name[i]);
- }
- }
- }
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_LEFT_CURLY)
- {
- if (insert)
- {
- gtk_style_unref (rc_style->proto_style);
- g_free (rc_style);
- }
- return PARSE_ERROR;
- }
-
- while (1)
- {
- error = gtk_rc_parse_style_option (scanner, rc_style);
- if (error == PARSE_SYNTAX)
- break;
- if (error == PARSE_ERROR)
- {
- if (insert)
- {
- gtk_style_unref (rc_style->proto_style);
- g_free (rc_style);
- }
- return error;
- }
- }
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_RIGHT_CURLY)
- {
- if (insert)
- {
- if (rc_style->fontset_name)
- g_free (rc_style->fontset_name);
- else if (rc_style->font_name)
- g_free (rc_style->font_name);
-
- for (i = 0; i < 5; i++)
- if (rc_style->bg_pixmap_name[i])
- g_free (rc_style->bg_pixmap_name[i]);
-
- gtk_style_unref (rc_style->proto_style);
- g_free (rc_style);
- }
- return PARSE_ERROR;
- }
-
- if (insert)
- g_hash_table_insert (rc_style_ht, rc_style->name, rc_style);
-
- return PARSE_OK;
-}
-
-static gint
-gtk_rc_parse_style_option (GScanner *scanner,
- GtkRcStyle *rc_style)
-{
- gint token;
- gint error;
-
- token = g_scanner_peek_next_token (scanner);
- if (token == G_TOKEN_EOF || token == G_TOKEN_ERROR)
- return PARSE_ERROR;
-
- error = gtk_rc_parse_base (scanner, rc_style->proto_style);
- if (error != PARSE_SYNTAX)
- return error;
-
- error = gtk_rc_parse_bg (scanner, rc_style->proto_style);
- if (error != PARSE_SYNTAX)
- return error;
-
- error = gtk_rc_parse_fg (scanner, rc_style->proto_style);
- if (error != PARSE_SYNTAX)
- return error;
-
- error = gtk_rc_parse_text (scanner, rc_style->proto_style);
- if (error != PARSE_SYNTAX)
- return error;
-
- error = gtk_rc_parse_bg_pixmap (scanner, rc_style);
- if (error != PARSE_SYNTAX)
- return error;
-
- error = gtk_rc_parse_font (scanner, rc_style);
- if (error != PARSE_SYNTAX)
- return error;
-
- error = gtk_rc_parse_fontset (scanner, rc_style);
-
- return error;
-}
-
-static gint
-gtk_rc_parse_base (GScanner *scanner,
- GtkStyle *style)
-{
- GtkStateType state;
- gint token;
- gint error;
-
- token = g_scanner_peek_next_token (scanner);
- if (token == G_TOKEN_EOF || token == G_TOKEN_ERROR)
- return PARSE_ERROR;
- if (token != TOKEN_BASE)
- return PARSE_SYNTAX;
- token = g_scanner_get_next_token (scanner);
-
- error = gtk_rc_parse_state (scanner, &state);
- if (error != PARSE_OK)
- return error;
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_EQUAL_SIGN)
- return PARSE_ERROR;
-
- error = gtk_rc_parse_color (scanner, &style->base[state]);
-
- return error;
-}
-
-static gint
-gtk_rc_parse_bg (GScanner *scanner,
- GtkStyle *style)
-{
- GtkStateType state;
- gint token;
- gint error;
-
- token = g_scanner_peek_next_token (scanner);
- if (token == G_TOKEN_EOF || token == G_TOKEN_ERROR)
- return PARSE_ERROR;
- if (token != TOKEN_BG)
- return PARSE_SYNTAX;
- token = g_scanner_get_next_token (scanner);
-
- error = gtk_rc_parse_state (scanner, &state);
- if (error != PARSE_OK)
- return error;
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_EQUAL_SIGN)
- return PARSE_ERROR;
-
- error = gtk_rc_parse_color (scanner, &style->bg[state]);
-
- return error;
-}
-
-static gint
-gtk_rc_parse_fg (GScanner *scanner,
- GtkStyle *style)
-{
- GtkStateType state;
- gint token;
- gint error;
-
- token = g_scanner_peek_next_token (scanner);
- if (token == G_TOKEN_EOF || token == G_TOKEN_ERROR)
- return PARSE_ERROR;
- if (token != TOKEN_FG)
- return PARSE_SYNTAX;
- token = g_scanner_get_next_token (scanner);
-
- error = gtk_rc_parse_state (scanner, &state);
- if (error != PARSE_OK)
- return error;
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_EQUAL_SIGN)
- return PARSE_ERROR;
-
- error = gtk_rc_parse_color (scanner, &style->fg[state]);
-
- return error;
-}
-
-static gint
-gtk_rc_parse_text (GScanner *scanner,
- GtkStyle *style)
-{
- GtkStateType state;
- gint token;
- gint error;
-
- token = g_scanner_peek_next_token (scanner);
- if (token == G_TOKEN_EOF || token == G_TOKEN_ERROR)
- return PARSE_ERROR;
- if (token != TOKEN_TEXT)
- return PARSE_SYNTAX;
- token = g_scanner_get_next_token (scanner);
-
- error = gtk_rc_parse_state (scanner, &state);
- if (error != PARSE_OK)
- return error;
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_EQUAL_SIGN)
- return PARSE_ERROR;
-
- error = gtk_rc_parse_color (scanner, &style->text[state]);
-
- return error;
-}
-
-static gint
-gtk_rc_parse_bg_pixmap (GScanner *scanner,
- GtkRcStyle *rc_style)
-{
- GtkStateType state;
- gint token;
- gint error;
- gchar *pixmap_file;
-
- token = g_scanner_peek_next_token (scanner);
- if (token == G_TOKEN_EOF || token == G_TOKEN_ERROR)
- return PARSE_ERROR;
- if (token != TOKEN_BG_PIXMAP)
- return PARSE_SYNTAX;
- token = g_scanner_get_next_token (scanner);
-
- error = gtk_rc_parse_state (scanner, &state);
- if (error != PARSE_OK)
- return error;
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_EQUAL_SIGN)
- return PARSE_ERROR;
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_STRING)
- return PARSE_ERROR;
-
- if (strcmp (scanner->value.v_string, "<parent>"))
- pixmap_file = gtk_rc_find_pixmap_in_path (scanner, scanner->value.v_string);
- else
- pixmap_file = g_strdup (scanner->value.v_string);
-
- if (pixmap_file)
- {
- if (rc_style->bg_pixmap_name[state])
- g_free (rc_style->bg_pixmap_name[state]);
- rc_style->bg_pixmap_name[state] = pixmap_file;
- }
-
- return PARSE_OK;
-}
-
-static char*
-gtk_rc_find_pixmap_in_path (GScanner *scanner,
- gchar *pixmap_file)
-{
- gint i;
- gint fd;
- gchar *buf;
-
- for (i = 0; (i < GTK_RC_MAX_PIXMAP_PATHS) && (pixmap_path[i] != NULL); i++)
- {
- buf = g_malloc (strlen (pixmap_path[i]) + strlen (pixmap_file) + 2);
- sprintf (buf, "%s%c%s", pixmap_path[i], '/', pixmap_file);
-
- fd = open (buf, O_RDONLY);
- if (fd >= 0)
- {
- close (fd);
- return buf;
- }
-
- g_free (buf);
- }
-
- g_warning ("Unable to locate image file in pixmap_path: \"%s\" line %d",
- pixmap_file, scanner->line);
-
- return NULL;
-}
-
-static gint
-gtk_rc_parse_font (GScanner *scanner,
- GtkRcStyle *rc_style)
-{
- gint token;
-
- token = g_scanner_peek_next_token (scanner);
- if (token == G_TOKEN_EOF || token == G_TOKEN_ERROR)
- return PARSE_ERROR;
- if (token != TOKEN_FONT)
- return PARSE_SYNTAX;
- token = g_scanner_get_next_token (scanner);
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_EQUAL_SIGN)
- return PARSE_ERROR;
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_STRING)
- return PARSE_ERROR;
-
- if (rc_style->font_name)
- g_free (rc_style->font_name);
- rc_style->font_name = g_strdup (scanner->value.v_string);
-
- return PARSE_OK;
-}
-
-static gint
-gtk_rc_parse_fontset (GScanner *scanner,
- GtkRcStyle *rc_style)
-{
- gint token;
-
- token = g_scanner_peek_next_token (scanner);
- if (token == G_TOKEN_EOF || token == G_TOKEN_ERROR)
- return PARSE_ERROR;
- if (token != TOKEN_FONTSET)
- return PARSE_SYNTAX;
- token = g_scanner_get_next_token (scanner);
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_EQUAL_SIGN)
- return PARSE_ERROR;
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_STRING)
- return PARSE_ERROR;
-
- if (rc_style->fontset_name)
- g_free (rc_style->fontset_name);
- rc_style->fontset_name = g_strdup (scanner->value.v_string);
-
- return PARSE_OK;
-}
-
-static gint
-gtk_rc_parse_state (GScanner *scanner,
- GtkStateType *state)
-{
- gint token;
-
- token = g_scanner_peek_next_token (scanner);
- if (token == G_TOKEN_EOF || token == G_TOKEN_ERROR)
- return PARSE_ERROR;
- if (token != G_TOKEN_LEFT_BRACE)
- return PARSE_SYNTAX;
- token = g_scanner_get_next_token (scanner);
-
- token = g_scanner_get_next_token (scanner);
- if (token == TOKEN_ACTIVE)
- *state = GTK_STATE_ACTIVE;
- else if (token == TOKEN_INSENSITIVE)
- *state = GTK_STATE_INSENSITIVE;
- else if (token == TOKEN_NORMAL)
- *state = GTK_STATE_NORMAL;
- else if (token == TOKEN_PRELIGHT)
- *state = GTK_STATE_PRELIGHT;
- else if (token == TOKEN_SELECTED)
- *state = GTK_STATE_SELECTED;
- else
- return PARSE_ERROR;
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_RIGHT_BRACE)
- return PARSE_ERROR;
-
- return PARSE_OK;
-}
-
-static gint
-gtk_rc_parse_color (GScanner *scanner,
- GdkColor *color)
-{
- gint token;
- gint token_int;
- gint length;
- gint temp;
- gchar buf[9];
- gint i, j;
-
- token = g_scanner_peek_next_token (scanner);
- if (token == G_TOKEN_EOF || token == G_TOKEN_ERROR)
- return PARSE_ERROR;
-
- switch (token)
- {
- case G_TOKEN_LEFT_CURLY:
- token = g_scanner_get_next_token (scanner);
-
- token = g_scanner_get_next_token (scanner);
- if (token == G_TOKEN_INT)
- token_int = scanner->value.v_int;
- else if (token == G_TOKEN_FLOAT)
- token_int = scanner->value.v_float * 65535.0;
- else
- return PARSE_ERROR;
- color->red = CLAMP (token_int, 0, 65535);
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_COMMA)
- return PARSE_ERROR;
-
- token = g_scanner_get_next_token (scanner);
- if (token == G_TOKEN_INT)
- token_int = scanner->value.v_int;
- else if (token == G_TOKEN_FLOAT)
- token_int = scanner->value.v_float * 65535.0;
- else
- return PARSE_ERROR;
- color->green = CLAMP (token_int, 0, 65535);
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_COMMA)
- return PARSE_ERROR;
-
- token = g_scanner_get_next_token (scanner);
- if (token == G_TOKEN_INT)
- token_int = scanner->value.v_int;
- else if (token == G_TOKEN_FLOAT)
- token_int = scanner->value.v_float * 65535.0;
- else
- return PARSE_ERROR;
- color->blue = CLAMP (token_int, 0, 65535);
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_RIGHT_CURLY)
- return PARSE_ERROR;
- break;
-
- case G_TOKEN_STRING:
- token = g_scanner_get_next_token (scanner);
-
- if (scanner->value.v_string[0] != '#')
- return PARSE_ERROR;
-
- length = strlen (scanner->value.v_string) - 1;
- if (((length % 3) != 0) || (length > 12))
- return PARSE_ERROR;
- length /= 3;
-
- for (i = 0, j = 1; i < length; i++, j++)
- buf[i] = scanner->value.v_string[j];
- buf[i] = '\0';
-
- sscanf (buf, "%x", &temp);
- color->red = temp;
-
- for (i = 0; i < length; i++, j++)
- buf[i] = scanner->value.v_string[j];
- buf[i] = '\0';
-
- sscanf (buf, "%x", &temp);
- color->green = temp;
-
- for (i = 0; i < length; i++, j++)
- buf[i] = scanner->value.v_string[j];
- buf[i] = '\0';
-
- sscanf (buf, "%x", &temp);
- color->blue = temp;
-
- if (length == 1)
- {
- color->red *= 4369;
- color->green *= 4369;
- color->blue *= 4369;
- }
- else if (length == 2)
- {
- color->red *= 257;
- color->green *= 257;
- color->blue *= 257;
- }
- else if (length == 3)
- {
- color->red *= 16;
- color->green *= 16;
- color->blue *= 16;
- }
- break;
-
- case G_TOKEN_ERROR:
- return PARSE_ERROR;
-
- default:
- return PARSE_SYNTAX;
- }
-
- return PARSE_OK;
-}
-
-static gint
-gtk_rc_parse_pixmap_path (GScanner *scanner)
-{
- gint token;
-
- token = g_scanner_peek_next_token (scanner);
- if (token == G_TOKEN_EOF || token == G_TOKEN_ERROR)
- return PARSE_ERROR;
- if (token != TOKEN_PIXMAP_PATH)
- return PARSE_SYNTAX;
- token = g_scanner_get_next_token (scanner);
-
- token = g_scanner_get_next_token (scanner);
-
- if (token != G_TOKEN_STRING)
- return PARSE_ERROR;
-
- gtk_rc_parse_pixmap_path_string (scanner->value.v_string);
-
- return PARSE_OK;
-}
-
-static void
-gtk_rc_parse_pixmap_path_string (gchar *pix_path)
-{
- gchar *buf;
- gint end_offset;
- gint start_offset = 0;
- gint path_len;
- gint path_num;
-
- /* free the old one, or just add to the old one ? */
- for (path_num=0; pixmap_path[path_num]; path_num++)
- {
- g_free (pixmap_path[path_num]);
- pixmap_path[path_num] = NULL;
- }
-
- path_num = 0;
-
- path_len = strlen (pix_path);
-
- buf = g_strdup (pix_path);
-
- for (end_offset = 0; end_offset <= path_len; end_offset++)
- {
- if ((buf[end_offset] == ':') ||
- (end_offset == path_len))
- {
- buf[end_offset] = '\0';
- pixmap_path[path_num] = g_strdup (buf + start_offset);
- path_num++;
- pixmap_path[path_num] = NULL;
- start_offset = end_offset + 1;
- }
- }
- g_free (buf);
-}
-
-static gint
-gtk_rc_parse_widget_style (GScanner *scanner)
-{
- GtkRcSet *rc_set;
- gint token;
-
- token = g_scanner_peek_next_token (scanner);
- if (token == G_TOKEN_EOF || token == G_TOKEN_ERROR)
- return PARSE_ERROR;
- if (token != TOKEN_WIDGET)
- return PARSE_SYNTAX;
- token = g_scanner_get_next_token (scanner);
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_STRING)
- return PARSE_ERROR;
-
- rc_set = g_new (GtkRcSet, 1);
- rc_set->set = g_strdup (scanner->value.v_string);
-
- token = g_scanner_get_next_token (scanner);
- if (token != TOKEN_STYLE)
- {
- g_free (rc_set->set);
- g_free (rc_set);
- return PARSE_ERROR;
- }
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_STRING)
- {
- g_free (rc_set->set);
- g_free (rc_set);
- return PARSE_ERROR;
- }
-
- rc_set->rc_style = gtk_rc_style_find (scanner->value.v_string);
- if (!rc_set->rc_style)
- {
- g_free (rc_set->set);
- g_free (rc_set);
- return PARSE_ERROR;
- }
-
- widget_sets = g_slist_append (widget_sets, rc_set);
-
- return PARSE_OK;
-}
-
-static gint
-gtk_rc_parse_widget_class_style (GScanner *scanner)
-{
- GtkRcSet *rc_set;
- gint token;
-
- token = g_scanner_peek_next_token (scanner);
- if (token == G_TOKEN_EOF || token == G_TOKEN_ERROR)
- return PARSE_ERROR;
- if (token != TOKEN_WIDGET_CLASS)
- return PARSE_SYNTAX;
- token = g_scanner_get_next_token (scanner);
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_STRING)
- return PARSE_ERROR;
-
- rc_set = g_new (GtkRcSet, 1);
- rc_set->set = g_strdup (scanner->value.v_string);
-
- token = g_scanner_get_next_token (scanner);
- if (token != TOKEN_STYLE)
- {
- g_free (rc_set->set);
- g_free (rc_set);
- return PARSE_ERROR;
- }
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_STRING)
- {
- g_free (rc_set->set);
- g_free (rc_set);
- return PARSE_ERROR;
- }
-
- rc_set->rc_style = gtk_rc_style_find (scanner->value.v_string);
- if (!rc_set->rc_style)
- {
- g_free (rc_set->set);
- g_free (rc_set);
- return PARSE_ERROR;
- }
-
- widget_class_sets = g_slist_append (widget_class_sets, rc_set);
-
- return PARSE_OK;
-}
-
-static char*
-gtk_rc_widget_path (GtkWidget *widget)
-{
- GtkWidget *tmp_widget;
- char *path;
- char *name;
- int pathlength;
- int namelength;
-
- path = NULL;
- pathlength = 0;
-
- tmp_widget = widget;
- while (tmp_widget)
- {
- name = gtk_widget_get_name (tmp_widget);
- pathlength += strlen (name);
-
- tmp_widget = tmp_widget->parent;
-
- if (tmp_widget)
- pathlength += 1;
- }
-
- path = g_new (char, pathlength + 1);
- path[pathlength] = '\0';
-
- tmp_widget = widget;
- while (tmp_widget)
- {
- name = gtk_widget_get_name (tmp_widget);
- namelength = strlen (name);
-
- strncpy (&path[pathlength - namelength], name, namelength);
- pathlength -= namelength;
-
- tmp_widget = tmp_widget->parent;
-
- if (tmp_widget)
- {
- pathlength -= 1;
- path[pathlength] = '.';
- }
- }
-
- return path;
-}
-
-static char*
-gtk_rc_widget_class_path (GtkWidget *widget)
-{
- GtkWidget *tmp_widget;
- char *path;
- char *name;
- int pathlength;
- int namelength;
-
- path = NULL;
- pathlength = 0;
-
- tmp_widget = widget;
- while (tmp_widget)
- {
- name = gtk_type_name (GTK_WIDGET_TYPE (tmp_widget));
- pathlength += strlen (name);
-
- tmp_widget = tmp_widget->parent;
-
- if (tmp_widget)
- pathlength += 1;
- }
-
- path = g_new (char, pathlength + 1);
- path[pathlength] = '\0';
-
- tmp_widget = widget;
- while (tmp_widget)
- {
- name = gtk_type_name (GTK_WIDGET_TYPE (tmp_widget));
- namelength = strlen (name);
-
- strncpy (&path[pathlength - namelength], name, namelength);
- pathlength -= namelength;
-
- tmp_widget = tmp_widget->parent;
-
- if (tmp_widget)
- {
- pathlength -= 1;
- path[pathlength] = '.';
- }
- }
-
- return path;
-}
diff --git a/gtk/gtkrc.h b/gtk/gtkrc.h
deleted file mode 100644
index c89858a4fb..0000000000
--- a/gtk/gtkrc.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_RC_H__
-#define __GTK_RC_H__
-
-
-#include <gtk/gtkstyle.h>
-#include <gtk/gtkwidget.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-void gtk_rc_init (void);
-void gtk_rc_parse (const gchar *filename);
-void gtk_rc_parse_string (const gchar *rc_string);
-GtkStyle* gtk_rc_get_style (GtkWidget *widget);
-void gtk_rc_add_widget_name_style (GtkStyle *style,
- const gchar *pattern);
-void gtk_rc_add_widget_class_style (GtkStyle *style,
- const gchar *pattern);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_RC_H__ */
diff --git a/gtk/gtkruler.c b/gtk/gtkruler.c
deleted file mode 100644
index 009d1e6419..0000000000
--- a/gtk/gtkruler.c
+++ /dev/null
@@ -1,308 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkruler.h"
-
-
-static void gtk_ruler_class_init (GtkRulerClass *klass);
-static void gtk_ruler_init (GtkRuler *ruler);
-static void gtk_ruler_realize (GtkWidget *widget);
-static void gtk_ruler_unrealize (GtkWidget *widget);
-static void gtk_ruler_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static gint gtk_ruler_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static void gtk_ruler_make_pixmap (GtkRuler *ruler);
-
-
-static GtkWidgetClass *parent_class;
-
-static GtkRulerMetric ruler_metrics[] =
-{
- {"Pixels", "Pi", 1.0, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }},
- {"Inches", "In", 72.0, { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 }, { 1, 2, 4, 8, 16 }},
- {"Centimeters", "Cn", 28.35, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }},
-};
-
-
-guint
-gtk_ruler_get_type ()
-{
- static guint ruler_type = 0;
-
- if (!ruler_type)
- {
- GtkTypeInfo ruler_info =
- {
- "GtkRuler",
- sizeof (GtkRuler),
- sizeof (GtkRulerClass),
- (GtkClassInitFunc) gtk_ruler_class_init,
- (GtkObjectInitFunc) gtk_ruler_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- ruler_type = gtk_type_unique (gtk_widget_get_type (), &ruler_info);
- }
-
- return ruler_type;
-}
-
-static void
-gtk_ruler_class_init (GtkRulerClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- object_class = (GtkObjectClass*) class;
- widget_class = (GtkWidgetClass*) class;
-
- parent_class = gtk_type_class (gtk_widget_get_type ());
-
- widget_class->realize = gtk_ruler_realize;
- widget_class->unrealize = gtk_ruler_unrealize;
- widget_class->size_allocate = gtk_ruler_size_allocate;
- widget_class->expose_event = gtk_ruler_expose;
-
- class->draw_ticks = NULL;
- class->draw_pos = NULL;
-}
-
-static void
-gtk_ruler_init (GtkRuler *ruler)
-{
- ruler->backing_store = NULL;
- ruler->non_gr_exp_gc = NULL;
- ruler->xsrc = 0;
- ruler->ysrc = 0;
- ruler->slider_size = 0;
- ruler->lower = 0;
- ruler->upper = 0;
- ruler->position = 0;
- ruler->max_size = 0;
-
- gtk_ruler_set_metric (ruler, GTK_PIXELS);
-}
-
-void
-gtk_ruler_set_metric (GtkRuler *ruler,
- GtkMetricType metric)
-{
- g_return_if_fail (ruler != NULL);
- g_return_if_fail (GTK_IS_RULER (ruler));
-
- ruler->metric = &ruler_metrics[metric];
-
- if (GTK_WIDGET_DRAWABLE (ruler))
- gtk_widget_queue_draw (GTK_WIDGET (ruler));
-}
-
-void
-gtk_ruler_set_range (GtkRuler *ruler,
- gfloat lower,
- gfloat upper,
- gfloat position,
- gfloat max_size)
-{
- g_return_if_fail (ruler != NULL);
- g_return_if_fail (GTK_IS_RULER (ruler));
-
- ruler->lower = lower;
- ruler->upper = upper;
- ruler->position = position;
- ruler->max_size = max_size;
-
- if (GTK_WIDGET_DRAWABLE (ruler))
- gtk_widget_queue_draw (GTK_WIDGET (ruler));
-}
-
-void
-gtk_ruler_draw_ticks (GtkRuler *ruler)
-{
- g_return_if_fail (ruler != NULL);
- g_return_if_fail (GTK_IS_RULER (ruler));
-
- if (GTK_RULER_CLASS (GTK_OBJECT (ruler)->klass)->draw_ticks)
- (* GTK_RULER_CLASS (GTK_OBJECT (ruler)->klass)->draw_ticks) (ruler);
-}
-
-void
-gtk_ruler_draw_pos (GtkRuler *ruler)
-{
- g_return_if_fail (ruler != NULL);
- g_return_if_fail (GTK_IS_RULER (ruler));
-
- if (GTK_RULER_CLASS (GTK_OBJECT (ruler)->klass)->draw_pos)
- (* GTK_RULER_CLASS (GTK_OBJECT (ruler)->klass)->draw_pos) (ruler);
-}
-
-
-static void
-gtk_ruler_realize (GtkWidget *widget)
-{
- GtkRuler *ruler;
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_RULER (widget));
-
- ruler = GTK_RULER (widget);
- GTK_WIDGET_SET_FLAGS (ruler, GTK_REALIZED);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget);
- attributes.event_mask |= (GDK_EXPOSURE_MASK |
- GDK_POINTER_MOTION_MASK |
- GDK_POINTER_MOTION_HINT_MASK);
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, ruler);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_ACTIVE);
-
- gtk_ruler_make_pixmap (ruler);
-}
-
-static void
-gtk_ruler_unrealize (GtkWidget *widget)
-{
- GtkRuler *ruler;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_RULER (widget));
-
- ruler = GTK_RULER (widget);
-
- if (ruler->backing_store)
- gdk_pixmap_unref (ruler->backing_store);
- if (ruler->non_gr_exp_gc)
- gdk_gc_destroy (ruler->non_gr_exp_gc);
-
- ruler->backing_store = NULL;
- ruler->non_gr_exp_gc = NULL;
-
- if (GTK_WIDGET_CLASS (parent_class)->unrealize)
- (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
-}
-
-static void
-gtk_ruler_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkRuler *ruler;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_RULER (widget));
-
- ruler = GTK_RULER (widget);
- widget->allocation = *allocation;
-
- if (GTK_WIDGET_REALIZED (widget))
- {
- gdk_window_move_resize (widget->window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
-
- gtk_ruler_make_pixmap (ruler);
- }
-}
-
-static gint
-gtk_ruler_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkRuler *ruler;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_RULER (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- ruler = GTK_RULER (widget);
-
- gdk_draw_rectangle (ruler->backing_store,
- widget->style->bg_gc[GTK_STATE_NORMAL],
- TRUE, 0, 0,
- widget->allocation.width,
- widget->allocation.height);
-
- gtk_ruler_draw_ticks (ruler);
-
- gtk_draw_shadow (widget->style, ruler->backing_store,
- GTK_STATE_NORMAL, GTK_SHADOW_OUT, 0, 0,
- widget->allocation.width,
- widget->allocation.height);
-
- gdk_draw_pixmap (widget->window,
- ruler->non_gr_exp_gc,
- ruler->backing_store,
- 0, 0, 0, 0,
- widget->allocation.width,
- widget->allocation.height);
-
- gtk_ruler_draw_pos (ruler);
- }
-
- return FALSE;
-}
-
-static void
-gtk_ruler_make_pixmap (GtkRuler *ruler)
-{
- GtkWidget *widget;
- gint width;
- gint height;
-
- widget = GTK_WIDGET (ruler);
-
- if (ruler->backing_store)
- {
- gdk_window_get_size (ruler->backing_store, &width, &height);
- if ((width == widget->allocation.width) &&
- (height == widget->allocation.height))
- return;
-
- gdk_pixmap_unref (ruler->backing_store);
- }
-
- ruler->backing_store = gdk_pixmap_new (widget->window,
- widget->allocation.width,
- widget->allocation.height,
- -1);
-
- ruler->xsrc = 0;
- ruler->ysrc = 0;
-
- if (!ruler->non_gr_exp_gc)
- {
- ruler->non_gr_exp_gc = gdk_gc_new (widget->window);
- gdk_gc_set_exposures (ruler->non_gr_exp_gc, FALSE);
- }
-}
diff --git a/gtk/gtkruler.h b/gtk/gtkruler.h
deleted file mode 100644
index c74b203212..0000000000
--- a/gtk/gtkruler.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_RULER_H__
-#define __GTK_RULER_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkwidget.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_RULER(obj) GTK_CHECK_CAST (obj, gtk_ruler_get_type (), GtkRuler)
-#define GTK_RULER_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_ruler_get_type (), GtkRulerClass)
-#define GTK_IS_RULER(obj) GTK_CHECK_TYPE (obj, gtk_ruler_get_type ())
-
-
-typedef struct _GtkRuler GtkRuler;
-typedef struct _GtkRulerClass GtkRulerClass;
-typedef struct _GtkRulerMetric GtkRulerMetric;
-
-struct _GtkRuler
-{
- GtkWidget widget;
-
- GdkPixmap *backing_store;
- GdkGC *non_gr_exp_gc;
- GtkRulerMetric *metric;
- gint xsrc, ysrc;
- gint slider_size;
-
- gfloat lower;
- gfloat upper;
- gfloat position;
- gfloat max_size;
-};
-
-struct _GtkRulerClass
-{
- GtkWidgetClass parent_class;
-
- void (* draw_ticks) (GtkRuler *ruler);
- void (* draw_pos) (GtkRuler *ruler);
-};
-
-struct _GtkRulerMetric
-{
- gchar *metric_name;
- gchar *abbrev;
- gfloat pixels_per_unit;
- gfloat ruler_scale[10];
- gint subdivide[5]; /* five possible modes of subdivision */
-};
-
-
-guint gtk_ruler_get_type (void);
-void gtk_ruler_set_metric (GtkRuler *ruler,
- GtkMetricType metric);
-void gtk_ruler_set_range (GtkRuler *ruler,
- gfloat lower,
- gfloat upper,
- gfloat position,
- gfloat max_size);
-void gtk_ruler_draw_ticks (GtkRuler *ruler);
-void gtk_ruler_draw_pos (GtkRuler *ruler);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_RULER_H__ */
diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c
deleted file mode 100644
index b7f902ba61..0000000000
--- a/gtk/gtkscale.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <math.h>
-#include "gtkcontainer.h"
-#include "gtkscale.h"
-
-
-#define SCALE_CLASS(w) GTK_SCALE_CLASS (GTK_OBJECT (w)->klass)
-
-
-static void gtk_scale_class_init (GtkScaleClass *klass);
-static void gtk_scale_init (GtkScale *scale);
-static void gtk_scale_draw_background (GtkRange *range);
-
-
-static GtkRangeClass *parent_class = NULL;
-
-
-guint
-gtk_scale_get_type ()
-{
- static guint scale_type = 0;
-
- if (!scale_type)
- {
- GtkTypeInfo scale_info =
- {
- "GtkScale",
- sizeof (GtkScale),
- sizeof (GtkScaleClass),
- (GtkClassInitFunc) gtk_scale_class_init,
- (GtkObjectInitFunc) gtk_scale_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- scale_type = gtk_type_unique (gtk_range_get_type (), &scale_info);
- }
-
- return scale_type;
-}
-
-static void
-gtk_scale_class_init (GtkScaleClass *class)
-{
- GtkObjectClass *object_class;
- GtkRangeClass *range_class;
-
- object_class = (GtkObjectClass*) class;
- range_class = (GtkRangeClass*) class;
-
- parent_class = gtk_type_class (gtk_range_get_type ());
-
- range_class->draw_background = gtk_scale_draw_background;
-
- class->slider_length = 31;
- class->value_spacing = 2;
- class->draw_value = NULL;
-}
-
-static void
-gtk_scale_init (GtkScale *scale)
-{
- GTK_WIDGET_SET_FLAGS (scale, GTK_CAN_FOCUS);
- GTK_RANGE (scale)->digits = 1;
- scale->draw_value = TRUE;
- scale->value_pos = GTK_POS_TOP;
-}
-
-void
-gtk_scale_set_digits (GtkScale *scale,
- gint digits)
-{
- g_return_if_fail (scale != NULL);
- g_return_if_fail (GTK_IS_SCALE (scale));
-
- if (GTK_RANGE (scale)->digits != digits)
- {
- GTK_RANGE (scale)->digits = digits;
-
- if (GTK_WIDGET_VISIBLE (scale) && GTK_WIDGET_MAPPED (scale))
- gtk_widget_queue_resize (GTK_WIDGET (scale));
- }
-}
-
-void
-gtk_scale_set_draw_value (GtkScale *scale,
- gint draw_value)
-{
- g_return_if_fail (scale != NULL);
- g_return_if_fail (GTK_IS_SCALE (scale));
-
- if (scale->draw_value != draw_value)
- {
- scale->draw_value = (draw_value != 0);
-
- if (GTK_WIDGET_VISIBLE (scale) && GTK_WIDGET_MAPPED (scale))
- gtk_widget_queue_resize (GTK_WIDGET (scale));
- }
-}
-
-void
-gtk_scale_set_value_pos (GtkScale *scale,
- GtkPositionType pos)
-{
- g_return_if_fail (scale != NULL);
- g_return_if_fail (GTK_IS_SCALE (scale));
-
- if (scale->value_pos != pos)
- {
- scale->value_pos = pos;
-
- if (GTK_WIDGET_VISIBLE (scale) && GTK_WIDGET_MAPPED (scale))
- gtk_widget_queue_resize (GTK_WIDGET (scale));
- }
-}
-
-gint
-gtk_scale_value_width (GtkScale *scale)
-{
- GtkRange *range;
- gchar buffer[128];
- gfloat value;
- gint temp;
- gint return_val;
- gint digits;
- gint i, j;
-
- g_return_val_if_fail (scale != NULL, 0);
- g_return_val_if_fail (GTK_IS_SCALE (scale), 0);
-
- return_val = 0;
- if (scale->draw_value)
- {
- range = GTK_RANGE (scale);
-
- value = ABS (range->adjustment->lower);
- if (value == 0) value = 1;
- digits = log10 (value) + 1;
- if (digits > 13)
- digits = 13;
-
- i = 0;
- if (range->adjustment->lower < 0)
- buffer[i++] = '-';
- for (j = 0; j < digits; j++)
- buffer[i++] = '0';
- if (GTK_RANGE (scale)->digits)
- buffer[i++] = '.';
- for (j = 0; j < GTK_RANGE (scale)->digits; j++)
- buffer[i++] = '0';
- buffer[i] = '\0';
-
- return_val = gdk_string_measure (GTK_WIDGET (scale)->style->font, buffer);
-
- value = ABS (range->adjustment->upper);
- if (value == 0) value = 1;
- digits = log10 (value) + 1;
- if (digits > 13)
- digits = 13;
-
- i = 0;
- if (range->adjustment->lower < 0)
- buffer[i++] = '-';
- for (j = 0; j < digits; j++)
- buffer[i++] = '0';
- if (GTK_RANGE (scale)->digits)
- buffer[i++] = '.';
- for (j = 0; j < GTK_RANGE (scale)->digits; j++)
- buffer[i++] = '0';
- buffer[i] = '\0';
-
- temp = gdk_string_measure (GTK_WIDGET (scale)->style->font, buffer);
- return_val = MAX (return_val, temp);
- }
-
- return return_val;
-}
-
-void
-gtk_scale_draw_value (GtkScale *scale)
-{
- g_return_if_fail (scale != NULL);
- g_return_if_fail (GTK_IS_SCALE (scale));
-
- if (SCALE_CLASS (scale)->draw_value)
- (* SCALE_CLASS (scale)->draw_value) (scale);
-}
-
-
-static void
-gtk_scale_draw_background (GtkRange *range)
-{
- g_return_if_fail (range != NULL);
- g_return_if_fail (GTK_IS_SCALE (range));
-
- gtk_scale_draw_value (GTK_SCALE (range));
-}
diff --git a/gtk/gtkscale.h b/gtk/gtkscale.h
deleted file mode 100644
index 6fe2e4925e..0000000000
--- a/gtk/gtkscale.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_SCALE_H__
-#define __GTK_SCALE_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkrange.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_SCALE(obj) GTK_CHECK_CAST (obj, gtk_scale_get_type (), GtkScale)
-#define GTK_SCALE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_scale_get_type (), GtkScaleClass)
-#define GTK_IS_SCALE(obj) GTK_CHECK_TYPE (obj, gtk_scale_get_type ())
-
-
-typedef struct _GtkScale GtkScale;
-typedef struct _GtkScaleClass GtkScaleClass;
-
-struct _GtkScale
-{
- GtkRange range;
-
- guint draw_value : 1;
- guint value_pos : 2;
-};
-
-struct _GtkScaleClass
-{
- GtkRangeClass parent_class;
-
- gint slider_length;
- gint value_spacing;
-
- void (* draw_value) (GtkScale *scale);
-};
-
-
-guint gtk_scale_get_type (void);
-void gtk_scale_set_digits (GtkScale *scale,
- gint digits);
-void gtk_scale_set_draw_value (GtkScale *scale,
- gint draw_value);
-void gtk_scale_set_value_pos (GtkScale *scale,
- GtkPositionType pos);
-gint gtk_scale_value_width (GtkScale *scale);
-
-void gtk_scale_draw_value (GtkScale *scale);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_SCALE_H__ */
diff --git a/gtk/gtkscrollbar.c b/gtk/gtkscrollbar.c
deleted file mode 100644
index 4c0d4b204f..0000000000
--- a/gtk/gtkscrollbar.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkscrollbar.h"
-
-static void gtk_scrollbar_class_init (GtkScrollbarClass *klass);
-static void gtk_scrollbar_init (GtkScrollbar *scrollbar);
-
-guint
-gtk_scrollbar_get_type ()
-{
- static guint scrollbar_type = 0;
-
- if (!scrollbar_type)
- {
- GtkTypeInfo scrollbar_info =
- {
- "GtkScrollbar",
- sizeof (GtkScrollbar),
- sizeof (GtkScrollbarClass),
- (GtkClassInitFunc) gtk_scrollbar_class_init,
- (GtkObjectInitFunc) gtk_scrollbar_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- scrollbar_type = gtk_type_unique (gtk_range_get_type (), &scrollbar_info);
- }
-
- return scrollbar_type;
-}
-
-static void
-gtk_scrollbar_class_init (GtkScrollbarClass *class)
-{
-}
-
-static void
-gtk_scrollbar_init (GtkScrollbar *scrollbar)
-{
-}
diff --git a/gtk/gtkscrollbar.h b/gtk/gtkscrollbar.h
deleted file mode 100644
index 14aadad1ae..0000000000
--- a/gtk/gtkscrollbar.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_SCROLLBAR_H__
-#define __GTK_SCROLLBAR_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkrange.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_SCROLLBAR(obj) GTK_CHECK_CAST (obj, gtk_scrollbar_get_type (), GtkScrollbar)
-#define GTK_SCROLLBAR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_scrollbar_get_type (), GtkScrollbarClass)
-#define GTK_IS_SCROLLBAR(obj) GTK_CHECK_TYPE (obj, gtk_scrollbar_get_type ())
-
-
-typedef struct _GtkScrollbar GtkScrollbar;
-typedef struct _GtkScrollbarClass GtkScrollbarClass;
-
-struct _GtkScrollbar
-{
- GtkRange range;
-};
-
-struct _GtkScrollbarClass
-{
- GtkRangeClass parent_class;
-};
-
-
-guint gtk_scrollbar_get_type (void);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_SCROLLBAR_H__ */
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
deleted file mode 100644
index 2c5b841ae6..0000000000
--- a/gtk/gtkscrolledwindow.c
+++ /dev/null
@@ -1,539 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkscrolledwindow.h"
-#include "gtksignal.h"
-
-
-#define SCROLLBAR_SPACING(w) (GTK_SCROLLED_WINDOW_CLASS (GTK_OBJECT (w)->klass)->scrollbar_spacing)
-
-
-static void gtk_scrolled_window_class_init (GtkScrolledWindowClass *klass);
-static void gtk_scrolled_window_init (GtkScrolledWindow *scrolled_window);
-static void gtk_scrolled_window_destroy (GtkObject *object);
-static void gtk_scrolled_window_finalize (GtkObject *object);
-static void gtk_scrolled_window_map (GtkWidget *widget);
-static void gtk_scrolled_window_unmap (GtkWidget *widget);
-static void gtk_scrolled_window_draw (GtkWidget *widget,
- GdkRectangle *area);
-static void gtk_scrolled_window_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_scrolled_window_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_scrolled_window_add (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_scrolled_window_remove (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_scrolled_window_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data);
-static void gtk_scrolled_window_viewport_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_scrolled_window_adjustment_changed (GtkAdjustment *adjustment,
- gpointer data);
-
-
-static GtkContainerClass *parent_class = NULL;
-
-
-guint
-gtk_scrolled_window_get_type ()
-{
- static guint scrolled_window_type = 0;
-
- if (!scrolled_window_type)
- {
- GtkTypeInfo scrolled_window_info =
- {
- "GtkScrolledWindow",
- sizeof (GtkScrolledWindow),
- sizeof (GtkScrolledWindowClass),
- (GtkClassInitFunc) gtk_scrolled_window_class_init,
- (GtkObjectInitFunc) gtk_scrolled_window_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- scrolled_window_type = gtk_type_unique (gtk_container_get_type (), &scrolled_window_info);
- }
-
- return scrolled_window_type;
-}
-
-static void
-gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GtkObjectClass*) class;
- widget_class = (GtkWidgetClass*) class;
- container_class = (GtkContainerClass*) class;
-
- parent_class = gtk_type_class (gtk_container_get_type ());
-
- object_class->destroy = gtk_scrolled_window_destroy;
- object_class->finalize = gtk_scrolled_window_finalize;
-
- widget_class->map = gtk_scrolled_window_map;
- widget_class->unmap = gtk_scrolled_window_unmap;
- widget_class->draw = gtk_scrolled_window_draw;
- widget_class->size_request = gtk_scrolled_window_size_request;
- widget_class->size_allocate = gtk_scrolled_window_size_allocate;
-
- container_class->add = gtk_scrolled_window_add;
- container_class->remove = gtk_scrolled_window_remove;
- container_class->foreach = gtk_scrolled_window_foreach;
-
- class->scrollbar_spacing = 5;
-}
-
-static void
-gtk_scrolled_window_init (GtkScrolledWindow *scrolled_window)
-{
- GTK_WIDGET_SET_FLAGS (scrolled_window, GTK_NO_WINDOW);
-
- scrolled_window->hscrollbar = NULL;
- scrolled_window->vscrollbar = NULL;
- scrolled_window->hscrollbar_policy = GTK_POLICY_ALWAYS;
- scrolled_window->vscrollbar_policy = GTK_POLICY_ALWAYS;
-}
-
-GtkWidget*
-gtk_scrolled_window_new (GtkAdjustment *hadjustment,
- GtkAdjustment *vadjustment)
-{
- GtkScrolledWindow *scrolled_window;
-
- scrolled_window = gtk_type_new (gtk_scrolled_window_get_type ());
-
- scrolled_window->viewport = gtk_viewport_new (hadjustment, vadjustment);
- hadjustment = gtk_viewport_get_hadjustment (GTK_VIEWPORT (scrolled_window->viewport));
- vadjustment = gtk_viewport_get_vadjustment (GTK_VIEWPORT (scrolled_window->viewport));
-
- gtk_signal_connect (GTK_OBJECT (hadjustment), "changed",
- (GtkSignalFunc) gtk_scrolled_window_adjustment_changed,
- (gpointer) scrolled_window);
- gtk_signal_connect (GTK_OBJECT (vadjustment), "changed",
- (GtkSignalFunc) gtk_scrolled_window_adjustment_changed,
- (gpointer) scrolled_window);
-
- scrolled_window->hscrollbar = gtk_hscrollbar_new (hadjustment);
- scrolled_window->vscrollbar = gtk_vscrollbar_new (vadjustment);
-
- gtk_widget_set_parent (scrolled_window->viewport, GTK_WIDGET (scrolled_window));
- gtk_widget_set_parent (scrolled_window->hscrollbar, GTK_WIDGET (scrolled_window));
- gtk_widget_set_parent (scrolled_window->vscrollbar, GTK_WIDGET (scrolled_window));
-
- gtk_widget_show (scrolled_window->viewport);
- gtk_widget_show (scrolled_window->hscrollbar);
- gtk_widget_show (scrolled_window->vscrollbar);
-
- gtk_widget_ref (scrolled_window->viewport);
- gtk_widget_ref (scrolled_window->hscrollbar);
- gtk_widget_ref (scrolled_window->vscrollbar);
-
- return GTK_WIDGET (scrolled_window);
-}
-
-GtkAdjustment*
-gtk_scrolled_window_get_hadjustment (GtkScrolledWindow *scrolled_window)
-{
- g_return_val_if_fail (scrolled_window != NULL, NULL);
- g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), NULL);
-
- return gtk_range_get_adjustment (GTK_RANGE (scrolled_window->hscrollbar));
-}
-
-GtkAdjustment*
-gtk_scrolled_window_get_vadjustment (GtkScrolledWindow *scrolled_window)
-{
- g_return_val_if_fail (scrolled_window != NULL, NULL);
- g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), NULL);
-
- return gtk_range_get_adjustment (GTK_RANGE (scrolled_window->vscrollbar));
-}
-
-void
-gtk_scrolled_window_set_policy (GtkScrolledWindow *scrolled_window,
- GtkPolicyType hscrollbar_policy,
- GtkPolicyType vscrollbar_policy)
-{
- g_return_if_fail (scrolled_window != NULL);
- g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
-
- if ((scrolled_window->hscrollbar_policy != hscrollbar_policy) ||
- (scrolled_window->vscrollbar_policy != vscrollbar_policy))
- {
- scrolled_window->hscrollbar_policy = hscrollbar_policy;
- scrolled_window->vscrollbar_policy = vscrollbar_policy;
-
- if (GTK_WIDGET (scrolled_window)->parent)
- gtk_widget_queue_resize (GTK_WIDGET (scrolled_window));
- }
-}
-
-
-static void
-gtk_scrolled_window_destroy (GtkObject *object)
-{
- GtkScrolledWindow *scrolled_window;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_SCROLLED_WINDOW (object));
-
- scrolled_window = GTK_SCROLLED_WINDOW (object);
-
- gtk_widget_destroy (scrolled_window->viewport);
- gtk_widget_destroy (scrolled_window->hscrollbar);
- gtk_widget_destroy (scrolled_window->vscrollbar);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-static void
-gtk_scrolled_window_finalize (GtkObject *object)
-{
- GtkScrolledWindow *scrolled_window;
-
- scrolled_window = GTK_SCROLLED_WINDOW (object);
- gtk_widget_unref (scrolled_window->viewport);
- gtk_widget_unref (scrolled_window->hscrollbar);
- gtk_widget_unref (scrolled_window->vscrollbar);
-}
-
-static void
-gtk_scrolled_window_map (GtkWidget *widget)
-{
- GtkScrolledWindow *scrolled_window;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_SCROLLED_WINDOW (widget));
-
- if (!GTK_WIDGET_MAPPED (widget))
- {
- GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
- scrolled_window = GTK_SCROLLED_WINDOW (widget);
-
- if (GTK_WIDGET_VISIBLE (scrolled_window->viewport) &&
- !GTK_WIDGET_MAPPED (scrolled_window->viewport))
- gtk_widget_map (scrolled_window->viewport);
-
- if (GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar) &&
- !GTK_WIDGET_MAPPED (scrolled_window->hscrollbar))
- gtk_widget_map (scrolled_window->hscrollbar);
-
- if (GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar) &&
- !GTK_WIDGET_MAPPED (scrolled_window->vscrollbar))
- gtk_widget_map (scrolled_window->vscrollbar);
- }
-}
-
-static void
-gtk_scrolled_window_unmap (GtkWidget *widget)
-{
- GtkScrolledWindow *scrolled_window;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_SCROLLED_WINDOW (widget));
-
- if (GTK_WIDGET_MAPPED (widget))
- {
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
- scrolled_window = GTK_SCROLLED_WINDOW (widget);
-
- if (GTK_WIDGET_MAPPED (scrolled_window->viewport))
- gtk_widget_unmap (scrolled_window->viewport);
-
- if (GTK_WIDGET_MAPPED (scrolled_window->hscrollbar))
- gtk_widget_unmap (scrolled_window->hscrollbar);
-
- if (GTK_WIDGET_MAPPED (scrolled_window->vscrollbar))
- gtk_widget_unmap (scrolled_window->vscrollbar);
- }
-}
-
-static void
-gtk_scrolled_window_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkScrolledWindow *scrolled_window;
- GdkRectangle child_area;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_SCROLLED_WINDOW (widget));
- g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- scrolled_window = GTK_SCROLLED_WINDOW (widget);
-
- if (gtk_widget_intersect (scrolled_window->viewport, area, &child_area))
- gtk_widget_draw (scrolled_window->viewport, &child_area);
-
- if (gtk_widget_intersect (scrolled_window->hscrollbar, area, &child_area))
- gtk_widget_draw (scrolled_window->hscrollbar, &child_area);
-
- if (gtk_widget_intersect (scrolled_window->vscrollbar, area, &child_area))
- gtk_widget_draw (scrolled_window->vscrollbar, &child_area);
- }
-}
-
-static void
-gtk_scrolled_window_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkScrolledWindow *scrolled_window;
- gint extra_height;
- gint extra_width;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_SCROLLED_WINDOW (widget));
- g_return_if_fail (requisition != NULL);
-
- scrolled_window = GTK_SCROLLED_WINDOW (widget);
-
- requisition->width = 0;
- requisition->height = 0;
-
- if (GTK_WIDGET_VISIBLE (scrolled_window->viewport))
- {
- gtk_widget_size_request (scrolled_window->viewport, &scrolled_window->viewport->requisition);
-
- requisition->width += scrolled_window->viewport->requisition.width;
- requisition->height += scrolled_window->viewport->requisition.height;
- }
-
- extra_width = 0;
- extra_height = 0;
-
- if ((scrolled_window->hscrollbar_policy == GTK_POLICY_AUTOMATIC) ||
- GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar))
- {
- gtk_widget_size_request (scrolled_window->hscrollbar,
- &scrolled_window->hscrollbar->requisition);
-
- requisition->width = MAX (requisition->width, scrolled_window->hscrollbar->requisition.width);
- extra_height = SCROLLBAR_SPACING (scrolled_window) + scrolled_window->hscrollbar->requisition.height;
- }
-
- if ((scrolled_window->vscrollbar_policy == GTK_POLICY_AUTOMATIC) ||
- GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar))
- {
- gtk_widget_size_request (scrolled_window->vscrollbar,
- &scrolled_window->vscrollbar->requisition);
-
- requisition->height = MAX (requisition->height, scrolled_window->vscrollbar->requisition.height);
- extra_width = SCROLLBAR_SPACING (scrolled_window) + scrolled_window->vscrollbar->requisition.width;
- }
-
- requisition->width += GTK_CONTAINER (widget)->border_width * 2 + extra_width;
- requisition->height += GTK_CONTAINER (widget)->border_width * 2 + extra_height;
-}
-
-static void
-gtk_scrolled_window_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkScrolledWindow *scrolled_window;
- GtkAllocation viewport_allocation;
- GtkAllocation child_allocation;
- guint previous_hvis;
- guint previous_vvis;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_SCROLLED_WINDOW (widget));
- g_return_if_fail (allocation != NULL);
-
- scrolled_window = GTK_SCROLLED_WINDOW (widget);
- widget->allocation = *allocation;
-
- gtk_scrolled_window_viewport_allocate (widget, &viewport_allocation);
-
- gtk_container_disable_resize (GTK_CONTAINER (scrolled_window));
-
- if (GTK_WIDGET_VISIBLE (scrolled_window->viewport))
- {
- do {
- gtk_scrolled_window_viewport_allocate (widget, &viewport_allocation);
-
- child_allocation.x = viewport_allocation.x + allocation->x;
- child_allocation.y = viewport_allocation.y + allocation->y;
- child_allocation.width = viewport_allocation.width;
- child_allocation.height = viewport_allocation.height;
-
- previous_hvis = GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar);
- previous_vvis = GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar);
-
- gtk_widget_size_allocate (scrolled_window->viewport, &child_allocation);
- } while ((previous_hvis != GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar)) ||
- (previous_vvis != GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar)));
- }
-
- if (GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar))
- {
- child_allocation.x = viewport_allocation.x;
- child_allocation.y = viewport_allocation.y + viewport_allocation.height + SCROLLBAR_SPACING (scrolled_window);
- child_allocation.width = viewport_allocation.width;
- child_allocation.height = scrolled_window->hscrollbar->requisition.height;
- child_allocation.x += allocation->x;
- child_allocation.y += allocation->y;
-
- gtk_widget_size_allocate (scrolled_window->hscrollbar, &child_allocation);
- }
-
- if (GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar))
- {
- child_allocation.x = viewport_allocation.x + viewport_allocation.width + SCROLLBAR_SPACING (scrolled_window);
- child_allocation.y = viewport_allocation.y;
- child_allocation.width = scrolled_window->vscrollbar->requisition.width;
- child_allocation.height = viewport_allocation.height;
- child_allocation.x += allocation->x;
- child_allocation.y += allocation->y;
-
- gtk_widget_size_allocate (scrolled_window->vscrollbar, &child_allocation);
- }
-
- gtk_container_enable_resize (GTK_CONTAINER (scrolled_window));
-}
-
-static void
-gtk_scrolled_window_add (GtkContainer *container,
- GtkWidget *widget)
-{
- GtkScrolledWindow *scrolled_window;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_SCROLLED_WINDOW (container));
- g_return_if_fail (widget != NULL);
-
- scrolled_window = GTK_SCROLLED_WINDOW (container);
- gtk_container_add (GTK_CONTAINER (scrolled_window->viewport), widget);
-}
-
-static void
-gtk_scrolled_window_remove (GtkContainer *container,
- GtkWidget *widget)
-{
- GtkScrolledWindow *scrolled_window;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_SCROLLED_WINDOW (container));
- g_return_if_fail (widget != NULL);
-
- scrolled_window = GTK_SCROLLED_WINDOW (container);
-
- if (scrolled_window->viewport == widget ||
- scrolled_window->hscrollbar == widget ||
- scrolled_window->vscrollbar == widget)
- {
- /* this happens during destroy */
- gtk_widget_unparent (widget);
- }
- else
- gtk_container_remove (GTK_CONTAINER (scrolled_window->viewport), widget);
-}
-
-static void
-gtk_scrolled_window_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
-{
- GtkScrolledWindow *scrolled_window;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_SCROLLED_WINDOW (container));
- g_return_if_fail (callback != NULL);
-
- scrolled_window = GTK_SCROLLED_WINDOW (container);
-
- (* callback) (scrolled_window->viewport, callback_data);
-}
-
-static void
-gtk_scrolled_window_viewport_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkScrolledWindow *scrolled_window;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (allocation != NULL);
-
- scrolled_window = GTK_SCROLLED_WINDOW (widget);
-
- allocation->x = GTK_CONTAINER (widget)->border_width;
- allocation->y = GTK_CONTAINER (widget)->border_width;
- allocation->width = widget->allocation.width - allocation->x * 2;
- allocation->height = widget->allocation.height - allocation->y * 2;
-
- if (GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar))
- allocation->width -= scrolled_window->vscrollbar->requisition.width + SCROLLBAR_SPACING (scrolled_window);
- if (GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar))
- allocation->height -= scrolled_window->hscrollbar->requisition.height + SCROLLBAR_SPACING (scrolled_window);
-}
-
-static void
-gtk_scrolled_window_adjustment_changed (GtkAdjustment *adjustment,
- gpointer data)
-{
- GtkScrolledWindow *scrolled_win;
- GtkWidget *scrollbar;
- gint hide_scrollbar;
- gint policy;
-
- g_return_if_fail (adjustment != NULL);
- g_return_if_fail (data != NULL);
-
- scrolled_win = GTK_SCROLLED_WINDOW (data);
-
- if (adjustment == gtk_range_get_adjustment (GTK_RANGE (scrolled_win->hscrollbar)))
- {
- scrollbar = scrolled_win->hscrollbar;
- policy = scrolled_win->hscrollbar_policy;
- }
- else if (adjustment == gtk_range_get_adjustment (GTK_RANGE (scrolled_win->vscrollbar)))
- {
- scrollbar = scrolled_win->vscrollbar;
- policy = scrolled_win->vscrollbar_policy;
- }
- else
- {
- g_warning ("could not determine which adjustment scrollbar received change signal for");
- return;
- }
-
- if (policy == GTK_POLICY_AUTOMATIC)
- {
- hide_scrollbar = FALSE;
-
- if ((adjustment->upper - adjustment->lower) <= adjustment->page_size)
- hide_scrollbar = TRUE;
-
- if (hide_scrollbar)
- {
- if (GTK_WIDGET_VISIBLE (scrollbar))
- gtk_widget_hide (scrollbar);
- }
- else
- {
- if (!GTK_WIDGET_VISIBLE (scrollbar))
- gtk_widget_show (scrollbar);
- }
- }
-}
diff --git a/gtk/gtkscrolledwindow.h b/gtk/gtkscrolledwindow.h
deleted file mode 100644
index 54ed5637e7..0000000000
--- a/gtk/gtkscrolledwindow.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_SCROLLED_WINDOW_H__
-#define __GTK_SCROLLED_WINDOW_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkhscrollbar.h>
-#include <gtk/gtkvscrollbar.h>
-#include <gtk/gtkviewport.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_SCROLLED_WINDOW(obj) GTK_CHECK_CAST (obj, gtk_scrolled_window_get_type (), GtkScrolledWindow)
-#define GTK_SCROLLED_WINDOW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_scrolled_window_get_type (), GtkScrolledWindowClass)
-#define GTK_IS_SCROLLED_WINDOW(obj) GTK_CHECK_TYPE (obj, gtk_scrolled_window_get_type ())
-
-
-typedef struct _GtkScrolledWindow GtkScrolledWindow;
-typedef struct _GtkScrolledWindowClass GtkScrolledWindowClass;
-
-struct _GtkScrolledWindow
-{
- GtkContainer container;
-
- GtkWidget *viewport;
- GtkWidget *hscrollbar;
- GtkWidget *vscrollbar;
-
- guint8 hscrollbar_policy;
- guint8 vscrollbar_policy;
-};
-
-struct _GtkScrolledWindowClass
-{
- GtkContainerClass parent_class;
-
- gint scrollbar_spacing;
-};
-
-
-guint gtk_scrolled_window_get_type (void);
-GtkWidget* gtk_scrolled_window_new (GtkAdjustment *hadjustment,
- GtkAdjustment *vadjustment);
-GtkAdjustment* gtk_scrolled_window_get_hadjustment (GtkScrolledWindow *scrolled_window);
-GtkAdjustment* gtk_scrolled_window_get_vadjustment (GtkScrolledWindow *scrolled_window);
-void gtk_scrolled_window_set_policy (GtkScrolledWindow *scrolled_window,
- GtkPolicyType hscrollbar_policy,
- GtkPolicyType vscrollbar_policy);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_SCROLLED_WINDOW_H__ */
diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c
index 8f51e6c6c5..1ad094165d 100644
--- a/gtk/gtkselection.c
+++ b/gtk/gtkselection.c
@@ -630,7 +630,7 @@ gtk_selection_clear (GtkWidget *widget,
}
if (tmp_list == NULL || selection_info->time > event->time)
- return TRUE;
+ return FALSE;
current_selections = g_list_remove_link (current_selections, tmp_list);
g_list_free (tmp_list);
diff --git a/gtk/gtkselection.h b/gtk/gtkselection.h
deleted file mode 100644
index 92aa12b016..0000000000
--- a/gtk/gtkselection.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_SELECTION_H__
-#define __GTK_SELECTION_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkenums.h>
-#include <gtk/gtkwidget.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-typedef struct _GtkSelectionData GtkSelectioData;
-
-/* a callback function that provides the selection. Arguments are:
- widget: selection owner
- offset: offset into selection
- buffer: buffer into which to store selection
- length: length of buffer
- bytes_after: (sizeof(selection) - offset - length ) (return)
- data: callback data */
-
-typedef void (*GtkSelectionFunction) (GtkWidget *widget,
- GtkSelectionData *selection_data,
- gpointer data);
-
-/* Public interface */
-
-gint gtk_selection_owner_set (GtkWidget *widget,
- GdkAtom selection,
- guint32 time);
-void gtk_selection_add_handler (GtkWidget *widget,
- GdkAtom selection,
- GdkAtom target,
- GtkSelectionFunction function,
- gpointer data);
-void gtk_selection_add_handler_full (GtkWidget *widget,
- GdkAtom selection,
- GdkAtom target,
- GtkSelectionFunction function,
- GtkCallbackMarshal marshal,
- gpointer data,
- GtkDestroyNotify destroy);
-gint gtk_selection_convert (GtkWidget *widget,
- GdkAtom selection,
- GdkAtom target,
- guint32 time);
-
-
-void gtk_selection_data_set (GtkSelectionData *selection_data,
- GdkAtom type,
- gint format,
- guchar *data,
- gint length);
-
-/* Called when a widget is destroyed */
-
-void gtk_selection_remove_all (GtkWidget *widget);
-
-/* Event handlers */
-
-gint gtk_selection_clear (GtkWidget *widget,
- GdkEventSelection *event);
-gint gtk_selection_request (GtkWidget *widget,
- GdkEventSelection *event);
-gint gtk_selection_incr_event (GdkWindow *window,
- GdkEventProperty *event);
-gint gtk_selection_notify (GtkWidget *widget,
- GdkEventSelection *event);
-gint gtk_selection_property_notify (GtkWidget *widget,
- GdkEventProperty *event);
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_SELECTION_H__ */
diff --git a/gtk/gtkseparator.c b/gtk/gtkseparator.c
deleted file mode 100644
index 1e14c737bb..0000000000
--- a/gtk/gtkseparator.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkseparator.h"
-
-
-static void gtk_separator_class_init (GtkSeparatorClass *klass);
-static void gtk_separator_init (GtkSeparator *separator);
-
-
-guint
-gtk_separator_get_type ()
-{
- static guint separator_type = 0;
-
- if (!separator_type)
- {
- GtkTypeInfo separator_info =
- {
- "GtkSeparator",
- sizeof (GtkSeparator),
- sizeof (GtkSeparatorClass),
- (GtkClassInitFunc) gtk_separator_class_init,
- (GtkObjectInitFunc) gtk_separator_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- separator_type = gtk_type_unique (gtk_widget_get_type (), &separator_info);
- }
-
- return separator_type;
-}
-
-static void
-gtk_separator_class_init (GtkSeparatorClass *class)
-{
-}
-
-static void
-gtk_separator_init (GtkSeparator *separator)
-{
- GTK_WIDGET_SET_FLAGS (separator, GTK_NO_WINDOW | GTK_BASIC);
-}
diff --git a/gtk/gtkseparator.h b/gtk/gtkseparator.h
deleted file mode 100644
index bfccd337a9..0000000000
--- a/gtk/gtkseparator.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_SEPARATOR_H__
-#define __GTK_SEPARATOR_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkwidget.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_SEPARATOR(obj) GTK_CHECK_CAST (obj, gtk_separator_get_type (), GtkSeparator)
-#define GTK_SEPARATOR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_separator_get_type (), GtkSeparatorClass)
-#define GTK_IS_SEPARATOR(obj) GTK_CHECK_TYPE (obj, gtk_separator_get_type ())
-
-
-typedef struct _GtkSeparator GtkSeparator;
-typedef struct _GtkSeparatorClass GtkSeparatorClass;
-
-struct _GtkSeparator
-{
- GtkWidget widget;
-};
-
-struct _GtkSeparatorClass
-{
- GtkWidgetClass parent_class;
-};
-
-
-guint gtk_separator_get_type (void);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_SEPARATOR_H__ */
diff --git a/gtk/gtksignal.c b/gtk/gtksignal.c
deleted file mode 100644
index b578917b54..0000000000
--- a/gtk/gtksignal.c
+++ /dev/null
@@ -1,1549 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <stdarg.h>
-#include "gtksignal.h"
-
-
-#define MAX_PARAMS 20
-#define DONE 1
-#define RESTART 2
-
-#define GTK_RUN_TYPE(x) ((x) & GTK_RUN_MASK)
-
-
-typedef struct _GtkSignal GtkSignal;
-typedef struct _GtkSignalInfo GtkSignalInfo;
-typedef struct _GtkHandler GtkHandler;
-typedef struct _GtkHandlerInfo GtkHandlerInfo;
-typedef struct _GtkEmission GtkEmission;
-
-typedef void (*GtkSignalMarshaller0) (GtkObject *object,
- gpointer data);
-
-struct _GtkSignalInfo
-{
- gchar *name;
- GtkType object_type;
- guint signal_type;
-};
-
-struct _GtkSignal
-{
- GtkSignalInfo info;
- guint function_offset;
- GtkSignalRunType run_type;
- GtkSignalMarshaller marshaller;
- GtkType return_val;
- GtkType *params;
- guint nparams;
-};
-
-struct _GtkHandler
-{
- guint id : 28;
- guint blocked : 1;
- guint object_signal : 1;
- guint after : 1;
- guint no_marshal : 1;
- guint16 ref_count;
- guint16 signal_type;
- GtkSignalFunc func;
- gpointer func_data;
- GtkSignalDestroy destroy_func;
- GtkHandler *prev;
- GtkHandler *next;
-};
-
-struct _GtkHandlerInfo
-{
- GtkObject *object;
- GtkSignalMarshaller marshaller;
- GtkArg *params;
- GtkType *param_types;
- GtkType return_val;
- GtkSignalRunType run_type;
- guint nparams;
- guint signal_type;
-};
-
-struct _GtkEmission
-{
- GtkObject *object;
- guint signal_type;
-};
-
-
-static void gtk_signal_init (void);
-static guint gtk_signal_hash (guint *key);
-static gint gtk_signal_compare (guint *a,
- guint *b);
-static guint gtk_signal_info_hash (GtkSignalInfo *a);
-static gint gtk_signal_info_compare (GtkSignalInfo *a,
- GtkSignalInfo *b);
-static GtkHandler* gtk_signal_handler_new (void);
-static void gtk_signal_handler_ref (GtkHandler *handler);
-static void gtk_signal_handler_unref (GtkHandler *handler,
- GtkObject *object);
-static void gtk_signal_handler_insert (GtkObject *object,
- GtkHandler *handler);
-static void gtk_signal_real_emit (GtkObject *object,
- guint signal_type,
- va_list args);
-static GtkHandler* gtk_signal_get_handlers (GtkObject *object,
- guint signal_type);
-static guint gtk_signal_connect_by_type (GtkObject *object,
- guint signal_type,
- GtkSignalFunc func,
- gpointer func_data,
- GtkSignalDestroy destroy_func,
- gint object_signal,
- gint after,
- gint no_marshal);
-static GtkEmission* gtk_emission_new (void);
-static void gtk_emission_destroy (GtkEmission *emission);
-static void gtk_emission_add (GList **emissions,
- GtkObject *object,
- guint signal_type);
-static void gtk_emission_remove (GList **emissions,
- GtkObject *object,
- guint signal_type);
-static gint gtk_emission_check (GList *emissions,
- GtkObject *object,
- guint signal_type);
-static gint gtk_handlers_run (GtkHandler *handlers,
- GtkHandlerInfo *info,
- gint after);
-static void gtk_params_get (GtkArg *params,
- guint nparams,
- GtkType *param_types,
- GtkType return_val,
- va_list args);
-
-
-static gint initialize = TRUE;
-static GHashTable *signal_hash_table = NULL;
-static GHashTable *signal_info_hash_table = NULL;
-static guint next_signal = 1;
-static guint next_handler_id = 1;
-
-static const gchar *handler_key = "gtk-signal-handlers";
-
-static GMemChunk *handler_mem_chunk = NULL;
-static GMemChunk *emission_mem_chunk = NULL;
-
-static GList *current_emissions = NULL;
-static GList *stop_emissions = NULL;
-static GList *restart_emissions = NULL;
-
-static GtkSignalMarshal marshal = NULL;
-static GtkSignalDestroy destroy = NULL;
-
-
-guint
-gtk_signal_new (const gchar *name,
- GtkSignalRunType run_type,
- GtkType object_type,
- guint function_offset,
- GtkSignalMarshaller marshaller,
- GtkType return_val,
- guint nparams,
- ...)
-{
- GtkType *params;
- guint i;
- va_list args;
- guint return_id;
-
- g_return_val_if_fail (nparams < 16, 0);
-
- if (nparams > 0)
- {
- params = g_new (GtkType, nparams);
-
- va_start (args, nparams);
-
- for (i = 0; i < nparams; i++)
- params[i] = va_arg (args, GtkType);
-
- va_end (args);
- }
- else
- params = NULL;
-
- return_id = gtk_signal_newv (name,
- run_type,
- object_type,
- function_offset,
- marshaller,
- return_val,
- nparams,
- params);
-
- g_free (params);
-
- return return_id;
-}
-
-guint
-gtk_signal_newv (const gchar *name,
- GtkSignalRunType run_type,
- GtkType object_type,
- guint function_offset,
- GtkSignalMarshaller marshaller,
- GtkType return_val,
- guint nparams,
- GtkType *params)
-{
- GtkSignal *signal;
- GtkSignalInfo info;
- guint *type;
- guint i;
-
- g_return_val_if_fail (name != NULL, 0);
- g_return_val_if_fail (marshaller != NULL, 0);
- g_return_val_if_fail (nparams < 16, 0);
- if (nparams)
- g_return_val_if_fail (params != NULL, 0);
-
- if (initialize)
- gtk_signal_init ();
-
- info.name = (char*)name;
- info.object_type = object_type;
-
- type = g_hash_table_lookup (signal_info_hash_table, &info);
- if (type)
- {
- g_warning ("gtk_signal_newv(): signal \"%s\" already exists in the `%s' class ancestry\n",
- name, gtk_type_name (object_type));
- return 0;
- }
-
- signal = g_new (GtkSignal, 1);
- signal->info.name = g_strdup (name);
- signal->info.object_type = object_type;
- signal->info.signal_type = next_signal++;
- signal->function_offset = function_offset;
- signal->run_type = run_type;
- signal->marshaller = marshaller;
- signal->return_val = return_val;
- signal->nparams = nparams;
-
- if (nparams > 0)
- {
- signal->params = g_new (GtkType, nparams);
-
- for (i = 0; i < nparams; i++)
- signal->params[i] = params[i];
- }
- else
- signal->params = NULL;
-
- g_hash_table_insert (signal_hash_table, &signal->info.signal_type, signal);
- g_hash_table_insert (signal_info_hash_table, &signal->info, &signal->info.signal_type);
-
- return signal->info.signal_type;
-}
-
-GtkSignalQuery*
-gtk_signal_query (guint signal_id)
-{
- GtkSignalQuery *query;
- GtkSignal *signal;
-
- g_return_val_if_fail (signal_id >= 1, NULL);
-
- signal = g_hash_table_lookup (signal_hash_table, &signal_id);
- if (signal)
- {
- query = g_new (GtkSignalQuery, 1);
-
- query->object_type = signal->info.object_type;
- query->signal_id = signal_id;
- query->signal_name = signal->info.name;
- query->is_user_signal = signal->function_offset == 0;
- query->run_type = signal->run_type;
- query->return_val = signal->return_val;
- query->nparams = signal->nparams;
- query->params = signal->params;
- }
- else
- query = NULL;
-
- return query;
-}
-
-guint
-gtk_signal_lookup (const gchar *name,
- GtkType object_type)
-{
- GtkSignalInfo info;
-
- g_return_val_if_fail (name != NULL, 0);
- g_return_val_if_fail (gtk_type_is_a (object_type, GTK_TYPE_OBJECT), 0);
-
- if (initialize)
- gtk_signal_init ();
-
- info.name = (char*)name;
-
- while (object_type)
- {
- guint *type;
-
- info.object_type = object_type;
-
- type = g_hash_table_lookup (signal_info_hash_table, &info);
- if (type)
- return *type;
-
- object_type = gtk_type_parent (object_type);
- }
-
- return 0;
-}
-
-gchar*
-gtk_signal_name (guint signal_id)
-{
- GtkSignal *signal;
-
- g_return_val_if_fail (signal_id >= 1, NULL);
-
- signal = g_hash_table_lookup (signal_hash_table, &signal_id);
- if (signal)
- return signal->info.name;
-
- return NULL;
-}
-
-void
-gtk_signal_emit (GtkObject *object,
- guint signal_id,
- ...)
-{
- va_list args;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (signal_id >= 1);
-
- if (initialize)
- gtk_signal_init ();
-
- va_start (args, signal_id);
-
- gtk_signal_real_emit (object, signal_id, args);
-
- va_end (args);
-}
-
-void
-gtk_signal_emit_by_name (GtkObject *object,
- const gchar *name,
- ...)
-{
- guint type;
- va_list args;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (name != NULL);
-
- if (initialize)
- gtk_signal_init ();
-
- type = gtk_signal_lookup (name, GTK_OBJECT_TYPE (object));
-
- if (type >= 1)
- {
- va_start (args, name);
-
- gtk_signal_real_emit (object, type, args);
-
- va_end (args);
- }
- else
- {
- g_warning ("gtk_signal_emit_by_name(): could not find signal \"%s\" in the `%s' class ancestry",
- name, gtk_type_name (GTK_OBJECT_TYPE (object)));
- }
-}
-
-void
-gtk_signal_emit_stop (GtkObject *object,
- guint signal_id)
-{
- g_return_if_fail (object != NULL);
- g_return_if_fail (signal_id >= 1);
-
- if (initialize)
- gtk_signal_init ();
-
- if (gtk_emission_check (current_emissions, object, signal_id))
- gtk_emission_add (&stop_emissions, object, signal_id);
- else
- g_warning ("gtk_signal_emit_stop(): no current emission (%u) for object `%s'",
- signal_id, gtk_type_name (GTK_OBJECT_TYPE (object)));
-}
-
-void
-gtk_signal_emit_stop_by_name (GtkObject *object,
- const gchar *name)
-{
- guint type;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (name != NULL);
-
- if (initialize)
- gtk_signal_init ();
-
- type = gtk_signal_lookup (name, GTK_OBJECT_TYPE (object));
- if (type)
- gtk_signal_emit_stop (object, type);
- else
- g_warning ("gtk_signal_emit_stop_by_name(): could not find signal \"%s\" in the `%s' class ancestry",
- name, gtk_type_name (GTK_OBJECT_TYPE (object)));
-}
-
-guint
-gtk_signal_connect (GtkObject *object,
- const gchar *name,
- GtkSignalFunc func,
- gpointer func_data)
-{
- guint type;
-
- g_return_val_if_fail (object != NULL, 0);
-
- if (initialize)
- gtk_signal_init ();
-
- type = gtk_signal_lookup (name, GTK_OBJECT_TYPE (object));
- if (!type)
- {
- g_warning ("gtk_signal_connect(): could not find signal \"%s\" in the `%s' class ancestry",
- name, gtk_type_name (GTK_OBJECT_TYPE (object)));
- return 0;
- }
-
- return gtk_signal_connect_by_type (object, type,
- func, func_data, NULL,
- FALSE, FALSE, FALSE);
-}
-
-guint
-gtk_signal_connect_after (GtkObject *object,
- const gchar *name,
- GtkSignalFunc func,
- gpointer func_data)
-{
- guint type;
-
- g_return_val_if_fail (object != NULL, 0);
-
- if (initialize)
- gtk_signal_init ();
-
- type = gtk_signal_lookup (name, GTK_OBJECT_TYPE (object));
- if (!type)
- {
- g_warning ("gtk_signal_connect_after(): could not find signal \"%s\" in the `%s' class ancestry",
- name, gtk_type_name (GTK_OBJECT_TYPE (object)));
- return 0;
- }
-
- return gtk_signal_connect_by_type (object, type,
- func, func_data, NULL,
- FALSE, TRUE, FALSE);
-}
-
-guint
-gtk_signal_connect_full (GtkObject *object,
- const gchar *name,
- GtkSignalFunc func,
- GtkCallbackMarshal marshal,
- gpointer func_data,
- GtkDestroyNotify destroy_func,
- gint object_signal,
- gint after)
-{
- guint type;
-
- g_return_val_if_fail (object != NULL, 0);
-
- if (initialize)
- gtk_signal_init ();
-
- type = gtk_signal_lookup (name, GTK_OBJECT_TYPE (object));
- if (!type)
- {
- g_warning ("gtk_signal_connect_full(): could not find signal \"%s\" in the `%s' class ancestry",
- name, gtk_type_name (GTK_OBJECT_TYPE (object)));
- return 0;
- }
-
- if (marshal)
- return gtk_signal_connect_by_type (object, type, (GtkSignalFunc) marshal,
- func_data, destroy_func,
- object_signal, after, TRUE);
- else
- return gtk_signal_connect_by_type (object, type, func,
- func_data, destroy_func,
- object_signal, after, FALSE);
-}
-
-guint
-gtk_signal_connect_interp (GtkObject *object,
- const gchar *name,
- GtkCallbackMarshal func,
- gpointer func_data,
- GtkDestroyNotify destroy_func,
- gint after)
-{
- return gtk_signal_connect_full (object, name, NULL, func,
- func_data, destroy_func, FALSE, after);
-}
-
-guint
-gtk_signal_connect_object (GtkObject *object,
- const gchar *name,
- GtkSignalFunc func,
- GtkObject *slot_object)
-{
- guint type;
-
- g_return_val_if_fail (object != NULL, 0);
- /* slot_object needs to be treated as ordinary pointer */
-
- if (initialize)
- gtk_signal_init ();
-
- type = gtk_signal_lookup (name, GTK_OBJECT_TYPE (object));
- if (!type)
- {
- g_warning ("gtk_signal_connect_object(): could not find signal \"%s\" in the `%s' class ancestry",
- name, gtk_type_name (GTK_OBJECT_TYPE (object)));
- return 0;
- }
-
- return gtk_signal_connect_by_type (object, type,
- func, slot_object, NULL,
- TRUE, FALSE, FALSE);
-}
-
-guint
-gtk_signal_connect_object_after (GtkObject *object,
- const gchar *name,
- GtkSignalFunc func,
- GtkObject *slot_object)
-{
- guint type;
-
- g_return_val_if_fail (object != NULL, 0);
-
- if (initialize)
- gtk_signal_init ();
-
- type = gtk_signal_lookup (name, GTK_OBJECT_TYPE (object));
- if (!type)
- {
- g_warning ("gtk_signal_connect_object_after(): could not find signal \"%s\" in the `%s' class ancestry",
- name, gtk_type_name (GTK_OBJECT_TYPE (object)));
- return 0;
- }
-
- return gtk_signal_connect_by_type (object, type,
- func, slot_object, NULL,
- TRUE, TRUE, FALSE);
-}
-
-typedef struct _GtkDisconnectInfo GtkDisconnectInfo;
-struct _GtkDisconnectInfo
-{
- GtkObject *object1;
- guint disconnect_handler1;
- guint signal_handler;
- GtkObject *object2;
- guint disconnect_handler2;
-};
-
-static guint
-gtk_alive_disconnecter (GtkDisconnectInfo *info)
-{
- g_return_val_if_fail (info != NULL, 0);
-
- gtk_signal_disconnect (info->object1, info->disconnect_handler1);
- gtk_signal_disconnect (info->object1, info->signal_handler);
- gtk_signal_disconnect (info->object2, info->disconnect_handler2);
- g_free (info);
-
- return 0;
-}
-
-void
-gtk_signal_connect_while_alive (GtkObject *object,
- const gchar *signal,
- GtkSignalFunc func,
- gpointer func_data,
- GtkObject *alive_object)
-{
- GtkDisconnectInfo *info;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_OBJECT (object));
- g_return_if_fail (signal != NULL);
- g_return_if_fail (func != NULL);
- g_return_if_fail (alive_object != NULL);
- g_return_if_fail (GTK_IS_OBJECT (alive_object));
-
- info = g_new (GtkDisconnectInfo, 1);
- info->object1 = object;
- info->object2 = alive_object;
-
- info->signal_handler = gtk_signal_connect (object, signal, func, func_data);
- info->disconnect_handler1 = gtk_signal_connect_object (info->object1,
- "destroy",
- GTK_SIGNAL_FUNC (gtk_alive_disconnecter),
- (GtkObject*) info);
- info->disconnect_handler2 = gtk_signal_connect_object (info->object2,
- "destroy",
- GTK_SIGNAL_FUNC (gtk_alive_disconnecter),
- (GtkObject*) info);
-}
-
-void
-gtk_signal_connect_object_while_alive (GtkObject *object,
- const gchar *signal,
- GtkSignalFunc func,
- GtkObject *alive_object)
-{
- GtkDisconnectInfo *info;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_OBJECT (object));
- g_return_if_fail (signal != NULL);
- g_return_if_fail (func != NULL);
- g_return_if_fail (alive_object != NULL);
- g_return_if_fail (GTK_IS_OBJECT (alive_object));
-
- info = g_new (GtkDisconnectInfo, 1);
- info->object1 = object;
- info->object2 = alive_object;
-
- info->signal_handler = gtk_signal_connect_object (object, signal, func, alive_object);
- info->disconnect_handler1 = gtk_signal_connect_object (info->object1,
- "destroy",
- GTK_SIGNAL_FUNC (gtk_alive_disconnecter),
- (GtkObject*) info);
- info->disconnect_handler2 = gtk_signal_connect_object (info->object2,
- "destroy",
- GTK_SIGNAL_FUNC (gtk_alive_disconnecter),
- (GtkObject*) info);
-}
-
-void
-gtk_signal_disconnect (GtkObject *object,
- guint handler_id)
-{
- GtkHandler *handler;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (handler_id > 0);
-
- handler = gtk_object_get_data (object, handler_key);
-
- while (handler)
- {
- if (handler->id == handler_id)
- {
- handler->id = 0;
- handler->blocked = TRUE;
- gtk_signal_handler_unref (handler, object);
- return;
- }
- handler = handler->next;
- }
-
- g_warning ("gtk_signal_disconnect(): could not find handler (%u)", handler_id);
-}
-
-void
-gtk_signal_disconnect_by_data (GtkObject *object,
- gpointer data)
-{
- GtkHandler *handler;
- gint found_one;
-
- g_return_if_fail (object != NULL);
-
- found_one = FALSE;
- handler = gtk_object_get_data (object, handler_key);
-
- while (handler)
- {
- GtkHandler *handler_next;
-
- handler_next = handler->next;
- if (handler->func_data == data &&
- handler->id > 0)
- {
- found_one = TRUE;
- handler->id = 0;
- handler->blocked = TRUE;
- gtk_signal_handler_unref (handler, object);
- }
- handler = handler_next;
- }
-
- if (!found_one)
- g_warning ("gtk_signal_disconnect_by_data(): could not find handler containing data (0x%0lX)", (long) data);
-}
-
-void
-gtk_signal_handler_block (GtkObject *object,
- guint handler_id)
-{
- GtkHandler *tmp;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (handler_id > 0);
-
- tmp = gtk_object_get_data (object, handler_key);
-
- while (tmp)
- {
- if (tmp->id == handler_id)
- {
- tmp->blocked = TRUE;
- return;
- }
-
- tmp = tmp->next;
- }
-
- g_warning ("gtk_signal_handler_block(): could not find handler (%u)", handler_id);
-}
-
-void
-gtk_signal_handler_block_by_data (GtkObject *object,
- gpointer data)
-{
- GtkHandler *handler;
- gint found_one;
-
- g_return_if_fail (object != NULL);
-
- if (initialize)
- gtk_signal_init ();
-
- found_one = FALSE;
- handler = gtk_object_get_data (object, handler_key);
-
- while (handler)
- {
- if (handler->func_data == data &&
- handler->id > 0)
- {
- found_one = TRUE;
- handler->blocked = TRUE;
- }
-
- handler = handler->next;
- }
-
- if (!found_one)
- g_warning ("gtk_signal_handler_block_by_data(): could not find handler containing data (0x%0lX)", (long) data);
-}
-
-void
-gtk_signal_handler_unblock (GtkObject *object,
- guint handler_id)
-{
- GtkHandler *handler;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (handler_id > 0);
-
- if (initialize)
- gtk_signal_init ();
-
- handler = gtk_object_get_data (object, handler_key);
-
- while (handler)
- {
- if (handler->id == handler_id)
- {
- handler->blocked = FALSE;
- return;
- }
-
- handler = handler->next;
- }
-
- g_warning ("gtk_signal_handler_unblock(): could not find handler (%u)", handler_id);
-}
-
-void
-gtk_signal_handler_unblock_by_data (GtkObject *object,
- gpointer data)
-{
- GtkHandler *handler;
- gint found_one;
-
- g_return_if_fail (object != NULL);
-
- if (initialize)
- gtk_signal_init ();
-
- found_one = FALSE;
- handler = gtk_object_get_data (object, handler_key);
-
- while (handler)
- {
- if (handler->func_data == data &&
- handler->id > 0)
- {
- found_one = TRUE;
- handler->blocked = FALSE;
- }
-
- handler = handler->next;
- }
-
- if (!found_one)
- g_warning ("gtk_signal_handler_unblock_by_data(): could not find handler containing data (0x%0lX)", (long) data);
-}
-
-void
-gtk_signal_handlers_destroy (GtkObject *object)
-{
- GtkHandler *handler;
-
- /* we make the "optimization" of destroying the first handler in the last
- * place, since we don't want gtk_signal_handler_unref() to reset the objects
- * handler_key data on each removal
- */
-
- handler = gtk_object_get_data (object, handler_key);
- if (handler)
- {
- handler = handler->next;
- while (handler)
- {
- GtkHandler *next;
-
- next = handler->next;
- gtk_signal_handler_unref (handler, object);
- handler = next;
- }
- handler = gtk_object_get_data (object, handler_key);
- gtk_signal_handler_unref (handler, object);
- }
-}
-
-void
-gtk_signal_default_marshaller (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *params)
-{
- GtkSignalMarshaller0 rfunc;
-
- rfunc = (GtkSignalMarshaller0) func;
-
- (* rfunc) (object, func_data);
-}
-
-void
-gtk_signal_set_funcs (GtkSignalMarshal marshal_func,
- GtkSignalDestroy destroy_func)
-{
- marshal = marshal_func;
- destroy = destroy_func;
-}
-
-
-static void
-gtk_signal_init ()
-{
- if (initialize)
- {
- initialize = FALSE;
- signal_hash_table = g_hash_table_new ((GHashFunc) gtk_signal_hash,
- (GCompareFunc) gtk_signal_compare);
- signal_info_hash_table = g_hash_table_new ((GHashFunc) gtk_signal_info_hash,
- (GCompareFunc) gtk_signal_info_compare);
- }
-}
-
-static guint
-gtk_signal_hash (guint *key)
-{
- return *key;
-}
-
-static gint
-gtk_signal_compare (guint *a,
- guint *b)
-{
- return (*a == *b);
-}
-
-static guint
-gtk_signal_info_hash (GtkSignalInfo *a)
-{
- return (g_str_hash (a->name) + a->object_type);
-}
-
-static gint
-gtk_signal_info_compare (GtkSignalInfo *a,
- GtkSignalInfo *b)
-{
- return ((a->object_type == b->object_type) &&
- g_str_equal (a->name, b->name));
-}
-
-static GtkHandler*
-gtk_signal_handler_new ()
-{
- GtkHandler *handler;
-
- if (!handler_mem_chunk)
- handler_mem_chunk = g_mem_chunk_new ("handler mem chunk", sizeof (GtkHandler),
- 1024, G_ALLOC_AND_FREE);
-
- handler = g_chunk_new (GtkHandler, handler_mem_chunk);
-
- handler->id = 0;
- handler->ref_count = 1;
- handler->signal_type = 0;
- handler->blocked = FALSE;
- handler->object_signal = FALSE;
- handler->after = FALSE;
- handler->no_marshal = FALSE;
- handler->func = NULL;
- handler->func_data = NULL;
- handler->destroy_func = NULL;
- handler->prev = NULL;
- handler->next = NULL;
-
- return handler;
-}
-
-static void
-gtk_signal_handler_ref (GtkHandler *handler)
-{
- handler->ref_count += 1;
-}
-
-static void
-gtk_signal_handler_unref (GtkHandler *handler,
- GtkObject *object)
-{
- if (!handler->ref_count)
- {
- /* FIXME: i wanna get removed some when */
- g_warning ("gtk_signal_handler_unref(): handler with ref_count==0!");
- return;
- }
-
- handler->ref_count -= 1;
- if (handler->ref_count == 0)
- {
- if (!handler->func && destroy)
- (* destroy) (handler->func_data);
- else if (handler->destroy_func)
- (* handler->destroy_func) (handler->func_data);
-
-
- if (handler->prev)
- handler->prev->next = handler->next;
- else
- gtk_object_set_data (object, handler_key, handler->next);
- if (handler->next)
- handler->next->prev = handler->prev;
-
- g_mem_chunk_free (handler_mem_chunk, handler);
- }
-}
-
-static void
-gtk_signal_handler_insert (GtkObject *object,
- GtkHandler *handler)
-{
- GtkHandler *tmp;
-
- /* FIXME: remove */ g_assert (handler->next == NULL);
- /* FIXME: remove */ g_assert (handler->prev == NULL);
-
- tmp = gtk_object_get_data (object, handler_key);
- if (!tmp)
- gtk_object_set_data (object, handler_key, handler);
- else
- while (tmp)
- {
- if (tmp->signal_type < handler->signal_type)
- {
- if (tmp->prev)
- {
- tmp->prev->next = handler;
- handler->prev = tmp->prev;
- }
- else
- gtk_object_set_data (object, handler_key, handler);
- tmp->prev = handler;
- handler->next = tmp;
- break;
- }
-
- if (!tmp->next)
- {
- tmp->next = handler;
- handler->prev = tmp;
- break;
- }
- tmp = tmp->next;
- }
-}
-
-static void
-gtk_signal_real_emit (GtkObject *object,
- guint signal_type,
- va_list args)
-{
- GtkSignal *signal;
- GtkHandler *handlers;
- GtkHandlerInfo info;
- guchar **signal_func_offset;
- GtkArg params[MAX_PARAMS];
-
- signal = g_hash_table_lookup (signal_hash_table, &signal_type);
- g_return_if_fail (signal != NULL);
- g_return_if_fail (gtk_type_is_a (GTK_OBJECT_TYPE (object),
- signal->info.object_type));
-
- if ((signal->run_type & GTK_RUN_NO_RECURSE) &&
- gtk_emission_check (current_emissions, object, signal_type))
- {
- gtk_emission_add (&restart_emissions, object, signal_type);
- return;
- }
-
- gtk_params_get (params, signal->nparams, signal->params,
- signal->return_val, args);
-
- gtk_emission_add (&current_emissions, object, signal_type);
-
- gtk_object_ref (object);
-
-restart:
- if (GTK_RUN_TYPE (signal->run_type) != GTK_RUN_LAST && signal->function_offset != 0)
- {
- signal_func_offset = (guchar**) ((guchar*) object->klass +
- signal->function_offset);
- if (*signal_func_offset)
- (* signal->marshaller) (object, (GtkSignalFunc) *signal_func_offset,
- NULL, params);
- }
-
- info.object = object;
- info.marshaller = signal->marshaller;
- info.params = params;
- info.param_types = signal->params;
- info.return_val = signal->return_val;
- info.nparams = signal->nparams;
- info.run_type = signal->run_type;
- info.signal_type = signal_type;
-
- handlers = gtk_signal_get_handlers (object, signal_type);
- switch (gtk_handlers_run (handlers, &info, FALSE))
- {
- case DONE:
- goto done;
- case RESTART:
- goto restart;
- }
-
- if (GTK_RUN_TYPE (signal->run_type) != GTK_RUN_FIRST && signal->function_offset != 0)
- {
- signal_func_offset = (guchar**) ((guchar*) object->klass +
- signal->function_offset);
- if (*signal_func_offset)
- (* signal->marshaller) (object, (GtkSignalFunc) *signal_func_offset,
- NULL, params);
- }
-
- handlers = gtk_signal_get_handlers (object, signal_type);
- switch (gtk_handlers_run (handlers, &info, TRUE))
- {
- case DONE:
- goto done;
- case RESTART:
- goto restart;
- }
-
-done:
-
- gtk_emission_remove (&current_emissions, object, signal_type);
-
- if (signal->run_type & GTK_RUN_NO_RECURSE)
- gtk_emission_remove (&restart_emissions, object, signal_type);
-
- gtk_object_unref (object);
-}
-
-static GtkHandler*
-gtk_signal_get_handlers (GtkObject *object,
- guint signal_type)
-{
- GtkHandler *handlers;
-
- g_return_val_if_fail (object != NULL, NULL);
- g_return_val_if_fail (signal_type >= 1, NULL);
-
- handlers = gtk_object_get_data (object, handler_key);
-
- while (handlers)
- {
- if (handlers->signal_type == signal_type)
- return handlers;
- handlers = handlers->next;
- }
-
- return NULL;
-}
-
-guint
-gtk_signal_handler_pending (GtkObject *object,
- guint signal_id,
- gboolean may_be_blocked)
-{
- GtkHandler *handlers;
- guint handler_id;
-
- g_return_val_if_fail (object != NULL, 0);
- g_return_val_if_fail (signal_id >= 1, 0);
-
- handlers = gtk_signal_get_handlers (object, signal_id);
-
- handler_id = 0;
- while (handlers && handlers->signal_type == signal_id)
- {
- if (handlers->id > 0 &&
- (may_be_blocked ||
- !handlers->blocked))
- {
- handler_id = handlers->id;
- break;
- }
-
- handlers = handlers->next;
- }
-
- return handler_id;
-}
-
-static guint
-gtk_signal_connect_by_type (GtkObject *object,
- guint signal_type,
- GtkSignalFunc func,
- gpointer func_data,
- GtkSignalDestroy destroy_func,
- gint object_signal,
- gint after,
- gint no_marshal)
-{
- GtkObjectClass *class;
- GtkHandler *handler;
- gint found_it;
-
- g_return_val_if_fail (object != NULL, 0);
- g_return_val_if_fail (object->klass != NULL, 0);
-
- /* Search through the signals for this object and make
- * sure the one we are adding is valid. We need to perform
- * the lookup on the objects parents as well. If it isn't
- * valid then issue a warning and return.
- */
- found_it = FALSE;
- class = object->klass;
- while (class)
- {
- GtkType parent;
- gint *object_signals;
- guint nsignals;
- guint i;
-
- object_signals = class->signals;
- nsignals = class->nsignals;
-
- for (i = 0; i < nsignals; i++)
- if (object_signals[i] == signal_type)
- {
- found_it = TRUE;
- break;
- }
-
- parent = gtk_type_parent (class->type);
- if (parent)
- class = gtk_type_class (parent);
- else
- class = NULL;
- }
-
- if (!found_it)
- {
- g_warning ("gtk_signal_connect_by_type(): could not find signal id (%u) in the `%s' class ancestry",
- signal_type,
- gtk_type_name (class->type));
- return 0;
- }
-
- handler = gtk_signal_handler_new ();
- handler->id = next_handler_id++;
- handler->signal_type = signal_type;
- handler->object_signal = object_signal;
- handler->func = func;
- handler->func_data = func_data;
- handler->destroy_func = destroy_func;
- handler->after = after != FALSE;
- handler->no_marshal = no_marshal;
-
- gtk_signal_handler_insert (object, handler);
- return handler->id;
-}
-
-static GtkEmission*
-gtk_emission_new ()
-{
- GtkEmission *emission;
-
- if (!emission_mem_chunk)
- emission_mem_chunk = g_mem_chunk_new ("emission mem chunk", sizeof (GtkEmission),
- 1024, G_ALLOC_AND_FREE);
-
- emission = g_chunk_new (GtkEmission, emission_mem_chunk);
-
- emission->object = NULL;
- emission->signal_type = 0;
-
- return emission;
-}
-
-static void
-gtk_emission_destroy (GtkEmission *emission)
-{
- g_mem_chunk_free (emission_mem_chunk, emission);
-}
-
-static void
-gtk_emission_add (GList **emissions,
- GtkObject *object,
- guint signal_type)
-{
- GtkEmission *emission;
-
- g_return_if_fail (emissions != NULL);
- g_return_if_fail (object != NULL);
-
- emission = gtk_emission_new ();
- emission->object = object;
- emission->signal_type = signal_type;
-
- *emissions = g_list_prepend (*emissions, emission);
-}
-
-static void
-gtk_emission_remove (GList **emissions,
- GtkObject *object,
- guint signal_type)
-{
- GtkEmission *emission;
- GList *tmp;
-
- g_return_if_fail (emissions != NULL);
-
- tmp = *emissions;
- while (tmp)
- {
- emission = tmp->data;
-
- if ((emission->object == object) &&
- (emission->signal_type == signal_type))
- {
- gtk_emission_destroy (emission);
- *emissions = g_list_remove_link (*emissions, tmp);
- g_list_free (tmp);
- break;
- }
-
- tmp = tmp->next;
- }
-}
-
-static gint
-gtk_emission_check (GList *emissions,
- GtkObject *object,
- guint signal_type)
-{
- GtkEmission *emission;
- GList *tmp;
-
- tmp = emissions;
- while (tmp)
- {
- emission = tmp->data;
- tmp = tmp->next;
-
- if ((emission->object == object) &&
- (emission->signal_type == signal_type))
- return TRUE;
- }
- return FALSE;
-}
-
-static gint
-gtk_handlers_run (GtkHandler *handlers,
- GtkHandlerInfo *info,
- gint after)
-{
- while (handlers && handlers->signal_type == info->signal_type)
- {
- GtkHandler *handlers_next;
-
- gtk_signal_handler_ref (handlers);
-
- if (!handlers->blocked && (handlers->after == after))
- {
- if (handlers->func)
- {
- if (handlers->no_marshal)
- (* (GtkCallbackMarshal)handlers->func) (info->object,
- handlers->func_data,
- info->nparams,
- info->params);
- else if (handlers->object_signal)
- (* info->marshaller) ((GtkObject*) handlers->func_data, /* don't GTK_OBJECT() cast */
- handlers->func,
- handlers->func_data,
- info->params);
- else
- (* info->marshaller) (info->object,
- handlers->func,
- handlers->func_data,
- info->params);
- }
- else if (marshal)
- (* marshal) (info->object,
- handlers->func_data,
- info->nparams,
- info->params,
- info->param_types,
- info->return_val);
-
- if (gtk_emission_check (stop_emissions, info->object,
- info->signal_type))
- {
- gtk_emission_remove (&stop_emissions, info->object,
- info->signal_type);
-
- if (info->run_type & GTK_RUN_NO_RECURSE)
- gtk_emission_remove (&restart_emissions, info->object,
- info->signal_type);
- gtk_signal_handler_unref (handlers, info->object);
- return DONE;
- }
- else if ((info->run_type & GTK_RUN_NO_RECURSE) &&
- gtk_emission_check (restart_emissions, info->object,
- info->signal_type))
- {
- gtk_emission_remove (&restart_emissions, info->object,
- info->signal_type);
- gtk_signal_handler_unref (handlers, info->object);
- return RESTART;
- }
- }
-
- handlers_next = handlers->next;
- gtk_signal_handler_unref (handlers, info->object);
- handlers = handlers_next;
- }
-
- return 0;
-}
-
-static void
-gtk_params_get (GtkArg *params,
- guint nparams,
- GtkType *param_types,
- GtkType return_val,
- va_list args)
-{
- gint i;
-
- for (i = 0; i < nparams; i++)
- {
- params[i].type = param_types[i];
- params[i].name = NULL;
-
- switch (GTK_FUNDAMENTAL_TYPE (param_types[i]))
- {
- case GTK_TYPE_INVALID:
- break;
- case GTK_TYPE_NONE:
- break;
- case GTK_TYPE_CHAR:
- GTK_VALUE_CHAR(params[i]) = va_arg (args, gint);
- break;
- case GTK_TYPE_BOOL:
- GTK_VALUE_BOOL(params[i]) = va_arg (args, gint);
- break;
- case GTK_TYPE_INT:
- GTK_VALUE_INT(params[i]) = va_arg (args, gint);
- break;
- case GTK_TYPE_UINT:
- GTK_VALUE_UINT(params[i]) = va_arg (args, guint);
- break;
- case GTK_TYPE_ENUM:
- GTK_VALUE_ENUM(params[i]) = va_arg (args, gint);
- break;
- case GTK_TYPE_FLAGS:
- GTK_VALUE_FLAGS(params[i]) = va_arg (args, gint);
- break;
- case GTK_TYPE_LONG:
- GTK_VALUE_LONG(params[i]) = va_arg (args, glong);
- break;
- case GTK_TYPE_ULONG:
- GTK_VALUE_ULONG(params[i]) = va_arg (args, gulong);
- break;
- case GTK_TYPE_FLOAT:
- GTK_VALUE_FLOAT(params[i]) = va_arg (args, gfloat);
- break;
- case GTK_TYPE_DOUBLE:
- GTK_VALUE_DOUBLE(params[i]) = va_arg (args, gdouble);
- break;
- case GTK_TYPE_STRING:
- GTK_VALUE_STRING(params[i]) = va_arg (args, gchar*);
- break;
- case GTK_TYPE_POINTER:
- GTK_VALUE_POINTER(params[i]) = va_arg (args, gpointer);
- break;
- case GTK_TYPE_BOXED:
- GTK_VALUE_BOXED(params[i]) = va_arg (args, gpointer);
- break;
- case GTK_TYPE_SIGNAL:
- GTK_VALUE_SIGNAL(params[i]).f = va_arg (args, GtkFunction);
- GTK_VALUE_SIGNAL(params[i]).d = va_arg (args, gpointer);
- break;
- case GTK_TYPE_FOREIGN:
- GTK_VALUE_FOREIGN(params[i]).data = va_arg (args, gpointer);
- GTK_VALUE_FOREIGN(params[i]).notify =
- va_arg (args, GtkDestroyNotify);
- break;
- case GTK_TYPE_CALLBACK:
- GTK_VALUE_CALLBACK(params[i]).marshal =
- va_arg (args, GtkCallbackMarshal);
- GTK_VALUE_CALLBACK(params[i]).data = va_arg (args, gpointer);
- GTK_VALUE_CALLBACK(params[i]).notify =
- va_arg (args, GtkDestroyNotify);
- break;
- case GTK_TYPE_C_CALLBACK:
- GTK_VALUE_C_CALLBACK(params[i]).func = va_arg (args, GtkFunction);
- GTK_VALUE_C_CALLBACK(params[i]).func_data = va_arg (args, gpointer);
- break;
- case GTK_TYPE_ARGS:
- GTK_VALUE_ARGS(params[i]).n_args = va_arg (args, gint);
- GTK_VALUE_ARGS(params[i]).args = va_arg (args, GtkArg*);
- break;
- case GTK_TYPE_OBJECT:
- GTK_VALUE_OBJECT(params[i]) = va_arg (args, GtkObject*);
- if (GTK_VALUE_OBJECT(params[i]) != NULL &&
- !GTK_CHECK_TYPE (GTK_VALUE_OBJECT(params[i]), params[i].type))
- g_warning ("signal arg `%s' is not of type `%s'",
- gtk_type_name (GTK_OBJECT_TYPE (GTK_VALUE_OBJECT(params[i]))),
- gtk_type_name (params[i].type));
- break;
- default:
- g_error ("unsupported type `%s' in signal arg",
- gtk_type_name (params[i].type));
- break;
- }
- }
-
- params[i].type = return_val;
- params[i].name = NULL;
-
- switch (GTK_FUNDAMENTAL_TYPE (return_val))
- {
- case GTK_TYPE_INVALID:
- break;
- case GTK_TYPE_NONE:
- break;
- case GTK_TYPE_CHAR:
- params[i].d.pointer_data = va_arg (args, gchar*);
- break;
- case GTK_TYPE_BOOL:
- params[i].d.pointer_data = va_arg (args, gint*);
- break;
- case GTK_TYPE_INT:
- params[i].d.pointer_data = va_arg (args, gint*);
- break;
- case GTK_TYPE_UINT:
- params[i].d.pointer_data = va_arg (args, guint*);
- break;
- case GTK_TYPE_ENUM:
- params[i].d.pointer_data = va_arg (args, gint*);
- break;
- case GTK_TYPE_FLAGS:
- params[i].d.pointer_data = va_arg (args, gint*);
- break;
- case GTK_TYPE_LONG:
- params[i].d.pointer_data = va_arg (args, glong*);
- break;
- case GTK_TYPE_ULONG:
- params[i].d.pointer_data = va_arg (args, gulong*);
- break;
- case GTK_TYPE_FLOAT:
- params[i].d.pointer_data = va_arg (args, gfloat*);
- break;
- case GTK_TYPE_DOUBLE:
- params[i].d.pointer_data = va_arg (args, gdouble*);
- break;
- case GTK_TYPE_STRING:
- params[i].d.pointer_data = va_arg (args, gchar**);
- break;
- case GTK_TYPE_POINTER:
- params[i].d.pointer_data = va_arg (args, gpointer*);
- break;
- case GTK_TYPE_BOXED:
- params[i].d.pointer_data = va_arg (args, gpointer*);
- break;
- case GTK_TYPE_OBJECT:
- params[i].d.pointer_data = va_arg (args, GtkObject**);
- break;
- case GTK_TYPE_SIGNAL:
- case GTK_TYPE_FOREIGN:
- case GTK_TYPE_CALLBACK:
- case GTK_TYPE_C_CALLBACK:
- case GTK_TYPE_ARGS:
- default:
- g_error ("unsupported type `%s' in signal return",
- gtk_type_name (return_val));
- break;
- }
-}
diff --git a/gtk/gtksignal.h b/gtk/gtksignal.h
deleted file mode 100644
index 571ca3c261..0000000000
--- a/gtk/gtksignal.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_SIGNAL_H__
-#define __GTK_SIGNAL_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkenums.h>
-#include <gtk/gtkobject.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#ifdef offsetof
-#define GTK_SIGNAL_OFFSET(t, f) ((int) offsetof (t, f))
-#else /* offsetof */
-#define GTK_SIGNAL_OFFSET(t, f) ((int) ((char*) &((t*) 0)->f))
-#endif /* offsetof */
-
-
-typedef void (*GtkSignalMarshal) (GtkObject *object,
- gpointer data,
- guint nparams,
- GtkArg *args,
- GtkType *arg_types,
- GtkType return_type);
-typedef void (*GtkSignalDestroy) (gpointer data);
-
-typedef struct _GtkSignalQuery GtkSignalQuery;
-
-struct _GtkSignalQuery
-{
- GtkType object_type;
- guint signal_id;
- const gchar *signal_name;
- gboolean is_user_signal;
- GtkSignalRunType run_type;
- GtkType return_val;
- guint nparams;
- const GtkType *params;
-};
-
-guint gtk_signal_new (const gchar *name,
- GtkSignalRunType run_type,
- GtkType object_type,
- guint function_offset,
- GtkSignalMarshaller marshaller,
- GtkType return_val,
- guint nparams,
- ...);
-guint gtk_signal_newv (const gchar *name,
- GtkSignalRunType run_type,
- GtkType object_type,
- guint function_offset,
- GtkSignalMarshaller marshaller,
- GtkType return_val,
- guint nparams,
- GtkType *params);
-guint gtk_signal_lookup (const gchar *name,
- GtkType object_type);
-gchar* gtk_signal_name (guint signal_id);
-void gtk_signal_emit (GtkObject *object,
- guint signal_id,
- ...);
-void gtk_signal_emit_by_name (GtkObject *object,
- const gchar *name,
- ...);
-void gtk_signal_emit_stop (GtkObject *object,
- guint signal_id);
-void gtk_signal_emit_stop_by_name (GtkObject *object,
- const gchar *name);
-guint gtk_signal_connect (GtkObject *object,
- const gchar *name,
- GtkSignalFunc func,
- gpointer func_data);
-guint gtk_signal_connect_after (GtkObject *object,
- const gchar *name,
- GtkSignalFunc func,
- gpointer func_data);
-guint gtk_signal_connect_object (GtkObject *object,
- const gchar *name,
- GtkSignalFunc func,
- GtkObject *slot_object);
-guint gtk_signal_connect_object_after (GtkObject *object,
- const gchar *name,
- GtkSignalFunc func,
- GtkObject *slot_object);
-guint gtk_signal_connect_full (GtkObject *object,
- const gchar *name,
- GtkSignalFunc func,
- GtkCallbackMarshal marshal,
- gpointer data,
- GtkDestroyNotify destroy_func,
- gint object_signal,
- gint after);
-guint gtk_signal_connect_interp (GtkObject *object,
- const gchar *name,
- GtkCallbackMarshal func,
- gpointer data,
- GtkDestroyNotify destroy_func,
- gint after);
-
-void gtk_signal_connect_object_while_alive (GtkObject *object,
- const gchar *signal,
- GtkSignalFunc func,
- GtkObject *alive_object);
-void gtk_signal_connect_while_alive (GtkObject *object,
- const gchar *signal,
- GtkSignalFunc func,
- gpointer func_data,
- GtkObject *alive_object);
-
-void gtk_signal_disconnect (GtkObject *object,
- guint handler_id);
-void gtk_signal_disconnect_by_data (GtkObject *object,
- gpointer data);
-void gtk_signal_handler_block (GtkObject *object,
- guint handler_id);
-void gtk_signal_handler_block_by_data (GtkObject *object,
- gpointer data);
-void gtk_signal_handler_unblock (GtkObject *object,
- guint handler_id);
-void gtk_signal_handler_unblock_by_data (GtkObject *object,
- gpointer data);
-guint gtk_signal_handler_pending (GtkObject *object,
- guint signal_id,
- gboolean may_be_blocked);
-void gtk_signal_handlers_destroy (GtkObject *object);
-void gtk_signal_default_marshaller (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void gtk_signal_set_funcs (GtkSignalMarshal marshal_func,
- GtkSignalDestroy destroy_func);
-
-/* Report internal information about a signal. The caller has the response
- * to invoke a supsequent g_free (returned_data); but must leave the
- * contents of GtkSignalQuery untouched.
- */
-GtkSignalQuery* gtk_signal_query (guint signal_id);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_SIGNAL_H__ */
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
deleted file mode 100644
index 69d97f3bde..0000000000
--- a/gtk/gtkspinbutton.c
+++ /dev/null
@@ -1,1054 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include "gdk/gdkkeysyms.h"
-#include "gtkspinbutton.h"
-#include "gtkmain.h"
-#include "gtksignal.h"
-
-
-#define MIN_SPIN_BUTTON_WIDTH 30
-#define ARROW_SIZE 11
-#define SPIN_BUTTON_INITIAL_TIMER_DELAY 200
-#define SPIN_BUTTON_TIMER_DELAY 20
-#define MAX_TEXT_LENGTH 256
-#define MAX_TIMER_CALLS 5
-
-
-static void gtk_spin_button_class_init (GtkSpinButtonClass *klass);
-static void gtk_spin_button_init (GtkSpinButton *spin_button);
-static void gtk_spin_button_finalize (GtkObject *object);
-static void gtk_spin_button_map (GtkWidget *widget);
-static void gtk_spin_button_unmap (GtkWidget *widget);
-static void gtk_spin_button_realize (GtkWidget *widget);
-static void gtk_spin_button_unrealize (GtkWidget *widget);
-static void gtk_spin_button_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_spin_button_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_spin_button_paint (GtkWidget *widget,
- GdkRectangle *area);
-static void gtk_spin_button_draw (GtkWidget *widget,
- GdkRectangle *area);
-static gint gtk_spin_button_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static gint gtk_spin_button_button_press (GtkWidget *widget,
- GdkEventButton *event);
-static gint gtk_spin_button_button_release (GtkWidget *widget,
- GdkEventButton *event);
-static gint gtk_spin_button_motion_notify (GtkWidget *widget,
- GdkEventMotion *event);
-static gint gtk_spin_button_enter_notify (GtkWidget *widget,
- GdkEventCrossing *event);
-static gint gtk_spin_button_leave_notify (GtkWidget *widget,
- GdkEventCrossing *event);
-static gint gtk_spin_button_focus_out (GtkWidget *widget,
- GdkEventFocus *event);
-static void gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
- guint arrow);
-static gint gtk_spin_button_timer (GtkSpinButton *spin_button);
-static void gtk_spin_button_spin (GtkSpinButton *spin_button,
- guint direction,
- gfloat step);
-static void gtk_spin_button_value_changed (GtkWidget *widget,
- GtkSpinButton *spin_button);
-static gint gtk_spin_button_key_press (GtkWidget *widget,
- GdkEventKey *event);
-static void gtk_spin_button_update (GtkSpinButton *spin_button);
-static void gtk_spin_button_changed (GtkEditable *editable);
-static void gtk_spin_button_activate (GtkEditable *editable);
-
-
-static GtkWidgetClass *parent_class = NULL;
-
-
-guint
-gtk_spin_button_get_type ()
-{
- static guint spin_button_type = 0;
-
- if (!spin_button_type)
- {
- GtkTypeInfo spin_button_info =
- {
- "GtkSpinButton",
- sizeof (GtkSpinButton),
- sizeof (GtkSpinButtonClass),
- (GtkClassInitFunc) gtk_spin_button_class_init,
- (GtkObjectInitFunc) gtk_spin_button_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- spin_button_type = gtk_type_unique (gtk_entry_get_type (),
- &spin_button_info);
- }
- return spin_button_type;
-}
-
-static void
-gtk_spin_button_class_init (GtkSpinButtonClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkEditableClass *editable_class;
-
- object_class = (GtkObjectClass*) class;
- widget_class = (GtkWidgetClass*) class;
- editable_class = (GtkEditableClass*) class;
-
- parent_class = gtk_type_class (gtk_entry_get_type ());
-
- object_class->finalize = gtk_spin_button_finalize;
-
- widget_class->map = gtk_spin_button_map;
- widget_class->unmap = gtk_spin_button_unmap;
- widget_class->realize = gtk_spin_button_realize;
- widget_class->unrealize = gtk_spin_button_unrealize;
- widget_class->size_request = gtk_spin_button_size_request;
- widget_class->size_allocate = gtk_spin_button_size_allocate;
- widget_class->draw = gtk_spin_button_draw;
- widget_class->expose_event = gtk_spin_button_expose;
- widget_class->button_press_event = gtk_spin_button_button_press;
- widget_class->button_release_event = gtk_spin_button_button_release;
- widget_class->motion_notify_event = gtk_spin_button_motion_notify;
- widget_class->key_press_event = gtk_spin_button_key_press;
- widget_class->enter_notify_event = gtk_spin_button_enter_notify;
- widget_class->leave_notify_event = gtk_spin_button_leave_notify;
- widget_class->focus_out_event = gtk_spin_button_focus_out;
-
- editable_class->changed = gtk_spin_button_changed;
- editable_class->activate = gtk_spin_button_activate;
-}
-
-static void
-gtk_spin_button_init (GtkSpinButton *spin_button)
-{
- spin_button->adjustment = NULL;
- spin_button->panel = NULL;
-
- spin_button->timer = 0;
- spin_button->climb_rate = 0.0;
- spin_button->timer_step = 0.0;
-
- spin_button->update_policy = GTK_UPDATE_ALWAYS | GTK_UPDATE_SNAP_TO_TICKS;
-
- spin_button->snapped = 0;
- spin_button->in_child = 2;
- spin_button->click_child = 2;
- spin_button->button = 0;
- spin_button->need_timer = 0;
- spin_button->timer_calls = 0;
- spin_button->digits = 0;
-}
-
-void
-gtk_spin_button_construct (GtkSpinButton *spin_button,
- GtkAdjustment *adjustment,
- gfloat climb_rate,
- gint digits)
-{
- char buf[MAX_TEXT_LENGTH];
-
- g_return_if_fail (spin_button != NULL);
- g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
- g_return_if_fail (digits >= 0 && digits < 128);
-
- if (!adjustment)
- adjustment = (GtkAdjustment*) gtk_adjustment_new (0, 0, 0, 0, 0, 0);
-
- gtk_spin_button_set_adjustment (spin_button, adjustment);
- spin_button->digits = digits;
- sprintf (buf, "%0.*f", digits, adjustment->value);
- gtk_entry_set_text (GTK_ENTRY (spin_button), buf);
- spin_button->climb_rate = climb_rate;
-}
-
-GtkWidget *
-gtk_spin_button_new (GtkAdjustment *adjustment,
- gfloat climb_rate,
- gint digits)
-{
- GtkSpinButton *spin;
-
- g_return_val_if_fail (digits >= 0 && digits < 128, NULL);
-
- spin = gtk_type_new (gtk_spin_button_get_type ());
-
- gtk_spin_button_construct (spin, adjustment, climb_rate, digits);
-
- return GTK_WIDGET (spin);
-}
-
-static void
-gtk_spin_button_finalize (GtkObject *object)
-{
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_SPIN_BUTTON (object));
-
- gtk_object_unref (GTK_OBJECT (GTK_SPIN_BUTTON (object)->adjustment));
-
- (* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-static void
-gtk_spin_button_map (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_SPIN_BUTTON (widget));
-
- if (GTK_WIDGET_REALIZED (widget) && !GTK_WIDGET_MAPPED (widget))
- {
- gdk_window_show (GTK_SPIN_BUTTON (widget)->panel);
- GTK_WIDGET_CLASS (parent_class)->map (widget);
- }
-}
-
-static void
-gtk_spin_button_unmap (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_SPIN_BUTTON (widget));
-
- if (GTK_WIDGET_MAPPED (widget))
- {
- gdk_window_hide (GTK_SPIN_BUTTON (widget)->panel);
- GTK_WIDGET_CLASS (parent_class)->unmap (widget);
- }
-}
-
-static void
-gtk_spin_button_realize (GtkWidget *widget)
-{
- GtkSpinButton *spin;
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_SPIN_BUTTON (widget));
-
- spin = GTK_SPIN_BUTTON (widget);
-
- GTK_WIDGET_CLASS (parent_class)->realize (widget);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget);
- attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK
- | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_ENTER_NOTIFY_MASK
- | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK;
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- attributes.x = widget->allocation.x + widget->allocation.width
- - ARROW_SIZE - 2 * widget->style->klass->xthickness;
- attributes.y = widget->allocation.y;
-
- attributes.width = ARROW_SIZE;
- attributes.height = widget->allocation.height;
-
- spin->panel = gdk_window_new (gtk_widget_get_parent_window (widget),
- &attributes, attributes_mask);
-
- gtk_style_set_background (widget->style, spin->panel, GTK_STATE_NORMAL);
-
- gdk_window_set_user_data (spin->panel, widget);
-}
-
-static void
-gtk_spin_button_unrealize (GtkWidget *widget)
-{
- GtkSpinButton *spin;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_SPIN_BUTTON (widget));
-
- spin = GTK_SPIN_BUTTON (widget);
-
- GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
-
- if (spin->panel)
- {
- gdk_window_set_user_data (spin->panel, NULL);
- gdk_window_destroy (spin->panel);
- spin->panel = NULL;
- }
-}
-
-static void
-gtk_spin_button_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (requisition != NULL);
- g_return_if_fail (GTK_IS_SPIN_BUTTON (widget));
-
- GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition);
-
- requisition->width = MIN_SPIN_BUTTON_WIDTH + ARROW_SIZE
- + 2 * widget->style->klass->xthickness;
-}
-
-static void
-gtk_spin_button_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkAllocation child_allocation;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_SPIN_BUTTON (widget));
- g_return_if_fail (allocation != NULL);
-
- child_allocation = *allocation;
- child_allocation.width = allocation->width - ARROW_SIZE
- - 2 * widget->style->klass->xthickness;
- child_allocation.height = allocation->height;
-
- GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, &child_allocation);
-
- widget->allocation = *allocation;
-
- if (GTK_WIDGET_REALIZED (widget))
- {
- child_allocation.width = ARROW_SIZE + 2 * widget->style->klass->xthickness;
- child_allocation.height = widget->requisition.height;
- child_allocation.x = (allocation->x + allocation->width - ARROW_SIZE -
- 2 * widget->style->klass->xthickness);
- child_allocation.y = allocation->y + (allocation->height -
- widget->requisition.height) / 2;
-
- gdk_window_move_resize (GTK_SPIN_BUTTON (widget)->panel,
- child_allocation.x,
- child_allocation.y,
- child_allocation.width,
- child_allocation.height);
- }
-}
-
-static void
-gtk_spin_button_paint (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkSpinButton *spin;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_SPIN_BUTTON (widget));
-
- spin = GTK_SPIN_BUTTON (widget);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- gtk_draw_shadow (widget->style, spin->panel,
- GTK_STATE_NORMAL, GTK_SHADOW_OUT,
- 0, 0, ARROW_SIZE + 2 * widget->style->klass->xthickness,
- widget->requisition.height);
-
- gtk_spin_button_draw_arrow (spin, GTK_ARROW_UP);
- gtk_spin_button_draw_arrow (spin, GTK_ARROW_DOWN);
-
- GTK_WIDGET_CLASS (parent_class)->draw (widget, area);
- }
-}
-
-static void
-gtk_spin_button_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_SPIN_BUTTON (widget));
- g_return_if_fail (area != NULL);
-
-
- if (GTK_WIDGET_DRAWABLE (widget))
- gtk_spin_button_paint (widget, area);
-}
-
-static gint
-gtk_spin_button_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_SPIN_BUTTON (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- gtk_spin_button_paint (widget, &event->area);
-
- return FALSE;
-}
-
-static void
-gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
- guint arrow)
-{
- GtkStateType state_type;
- GtkShadowType shadow_type;
- GtkWidget *widget;
-
- g_return_if_fail (spin_button != NULL);
- g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
-
- widget = GTK_WIDGET (spin_button);
-
- if (GTK_WIDGET_DRAWABLE (spin_button))
- {
- if (spin_button->in_child == arrow)
- {
- if (spin_button->click_child == arrow)
- state_type = GTK_STATE_ACTIVE;
- else
- state_type = GTK_STATE_PRELIGHT;
- }
- else
- state_type = GTK_STATE_NORMAL;
-
- if (spin_button->click_child == arrow)
- shadow_type = GTK_SHADOW_IN;
- else
- shadow_type = GTK_SHADOW_OUT;
-
- if (arrow == GTK_ARROW_UP)
- {
- gtk_draw_arrow (widget->style, spin_button->panel,
- state_type, shadow_type, arrow, TRUE,
- widget->style->klass->xthickness,
- widget->style->klass->ythickness,
- ARROW_SIZE,
- widget->requisition.height / 2
- - widget->style->klass->ythickness);
- }
- else
- {
- gtk_draw_arrow (widget->style, spin_button->panel,
- state_type, shadow_type, arrow, TRUE,
- widget->style->klass->xthickness,
- widget->requisition.height / 2,
- ARROW_SIZE,
- widget->requisition.height / 2
- - widget->style->klass->ythickness);
- }
- }
-}
-
-static gint
-gtk_spin_button_enter_notify (GtkWidget *widget,
- GdkEventCrossing *event)
-{
- GtkSpinButton *spin;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_SPIN_BUTTON (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- spin = GTK_SPIN_BUTTON (widget);
-
- if (event->window == spin->panel)
- {
- gint x;
- gint y;
-
- gdk_window_get_pointer (spin->panel, &x, &y, NULL);
-
- if (y <= widget->requisition.height / 2)
- {
- spin->in_child = GTK_ARROW_UP;
- if (spin->click_child == 2)
- gtk_spin_button_draw_arrow (spin, GTK_ARROW_UP);
- }
- else
- {
- spin->in_child = GTK_ARROW_DOWN;
- if (spin->click_child == 2)
- gtk_spin_button_draw_arrow (spin, GTK_ARROW_DOWN);
- }
- }
- return FALSE;
-}
-
-static gint
-gtk_spin_button_leave_notify (GtkWidget *widget,
- GdkEventCrossing *event)
-{
- GtkSpinButton *spin;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_SPIN_BUTTON (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- spin = GTK_SPIN_BUTTON (widget);
-
- if (event->window == spin->panel && spin->click_child == 2)
- {
- if (spin->in_child == GTK_ARROW_UP)
- {
- spin->in_child = 2;
- gtk_spin_button_draw_arrow (spin, GTK_ARROW_UP);
- }
- else
- {
- spin->in_child = 2;
- gtk_spin_button_draw_arrow (spin, GTK_ARROW_DOWN);
- }
- }
- return FALSE;
-}
-
-static gint
-gtk_spin_button_focus_out (GtkWidget *widget,
- GdkEventFocus *event)
-{
- GtkSpinButton *spin;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_SPIN_BUTTON (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- spin = GTK_SPIN_BUTTON (widget);
- if ((spin->update_policy & GTK_UPDATE_SNAP_TO_TICKS) && !spin->snapped)
- gtk_spin_button_update (spin);
-
- GTK_WIDGET_CLASS (parent_class)->focus_out_event (widget, event);
-
- return FALSE;
-}
-
-static gint
-gtk_spin_button_button_press (GtkWidget *widget,
- GdkEventButton *event)
-{
- GtkSpinButton *spin;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_SPIN_BUTTON (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- spin = GTK_SPIN_BUTTON (widget);
-
- if (!spin->button)
- {
- if (event->window == spin->panel)
- {
- if (!GTK_WIDGET_HAS_FOCUS (widget))
- gtk_widget_grab_focus (widget);
- gtk_grab_add (widget);
- spin->button = event->button;
-
- if (event->y <= widget->requisition.height / 2)
- {
- spin->click_child = GTK_ARROW_UP;
- if (event->button == 1)
- {
- gtk_spin_button_spin (spin, spin->click_child,
- spin->adjustment->step_increment);
- if (!spin->timer)
- {
- spin->timer_step = spin->adjustment->step_increment;
- spin->need_timer = TRUE;
- spin->timer = gtk_timeout_add
- (SPIN_BUTTON_INITIAL_TIMER_DELAY,
- (GtkFunction) gtk_spin_button_timer, (gpointer) spin);
- }
- }
- else if (event->button == 2)
- {
- gtk_spin_button_spin (spin, spin->click_child,
- spin->adjustment->page_increment);
- if (!spin->timer)
- {
- spin->timer_step = spin->adjustment->page_increment;
- spin->need_timer = TRUE;
- spin->timer = gtk_timeout_add
- (SPIN_BUTTON_INITIAL_TIMER_DELAY,
- (GtkFunction) gtk_spin_button_timer, (gpointer) spin);
- }
- }
- gtk_spin_button_draw_arrow (spin, GTK_ARROW_UP);
- }
- else
- {
- spin->click_child = GTK_ARROW_DOWN;
- if (event->button == 1)
- {
- gtk_spin_button_spin (spin, spin->click_child,
- spin->adjustment->step_increment);
- if (!spin->timer)
- {
- spin->timer_step = spin->adjustment->step_increment;
- spin->need_timer = TRUE;
- spin->timer = gtk_timeout_add
- (SPIN_BUTTON_INITIAL_TIMER_DELAY,
- (GtkFunction) gtk_spin_button_timer, (gpointer) spin);
- }
- }
- else if (event->button == 2)
- {
- gtk_spin_button_spin (spin, spin->click_child,
- spin->adjustment->page_increment);
- if (!spin->timer)
- {
- spin->timer_step = spin->adjustment->page_increment;
- spin->need_timer = TRUE;
- spin->timer = gtk_timeout_add
- (SPIN_BUTTON_INITIAL_TIMER_DELAY,
- (GtkFunction) gtk_spin_button_timer, (gpointer) spin);
- }
- }
- gtk_spin_button_draw_arrow (spin, GTK_ARROW_DOWN);
- }
- }
- else
- GTK_WIDGET_CLASS (parent_class)->button_press_event (widget, event);
- }
- return FALSE;
-}
-
-static gint
-gtk_spin_button_button_release (GtkWidget *widget,
- GdkEventButton *event)
-{
- GtkSpinButton *spin;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_SPIN_BUTTON (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (event->type != GDK_BUTTON_RELEASE)
- return FALSE;
-
- spin = GTK_SPIN_BUTTON (widget);
-
- if (event->button == spin->button)
- {
- guint click_child;
-
- if (spin->timer)
- {
- gtk_timeout_remove (spin->timer);
- spin->timer = 0;
- spin->timer_calls = 0;
- spin->need_timer = FALSE;
- }
-
- if (event->button == 3)
- {
- if (event->y >= 0 && event->x >= 0 &&
- event->y <= widget->requisition.height &&
- event->x <= ARROW_SIZE + 2 * widget->style->klass->xthickness)
- {
- if (spin->click_child == GTK_ARROW_UP &&
- spin->adjustment->value < spin->adjustment->upper &&
- event->y <= widget->requisition.height / 2)
- {
- spin->adjustment->value = spin->adjustment->upper;
- gtk_signal_emit_by_name (GTK_OBJECT (spin->adjustment),
- "value_changed");
- }
- else if (spin->click_child == GTK_ARROW_DOWN &&
- spin->adjustment->value > spin->adjustment->lower &&
- event->y > widget->requisition.height / 2)
- {
- spin->adjustment->value = spin->adjustment->lower;
- gtk_signal_emit_by_name (GTK_OBJECT (spin->adjustment),
- "value_changed");
- }
- }
- }
- gtk_grab_remove (widget);
- click_child = spin->click_child;
- spin->click_child = 2;
- spin->button = 0;
- gtk_spin_button_draw_arrow (spin, click_child);
- }
- else
- GTK_WIDGET_CLASS (parent_class)->button_release_event (widget, event);
-
- return FALSE;
-}
-
-static gint
-gtk_spin_button_motion_notify (GtkWidget *widget,
- GdkEventMotion *event)
-{
- GtkSpinButton *spin;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_SPIN_BUTTON (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- spin = GTK_SPIN_BUTTON (widget);
-
- if (spin->button)
- return FALSE;
-
- if (event->window == spin->panel)
- {
- gint y;
-
- y = event->y;
- if (event->is_hint)
- gdk_window_get_pointer (spin->panel, NULL, &y, NULL);
-
- if (y <= widget->requisition.height / 2 &&
- spin->in_child == GTK_ARROW_DOWN)
- {
- spin->in_child = GTK_ARROW_UP;
- gtk_spin_button_draw_arrow (spin, GTK_ARROW_UP);
- gtk_spin_button_draw_arrow (spin, GTK_ARROW_DOWN);
- }
- else if (y > widget->requisition.height / 2 &&
- spin->in_child == GTK_ARROW_UP)
- {
- spin->in_child = GTK_ARROW_DOWN;
- gtk_spin_button_draw_arrow (spin, GTK_ARROW_UP);
- gtk_spin_button_draw_arrow (spin, GTK_ARROW_DOWN);
- }
- return FALSE;
- }
-
- GTK_WIDGET_CLASS (parent_class)->motion_notify_event (widget, event);
-
- return FALSE;
-}
-
-static gint
-gtk_spin_button_timer (GtkSpinButton *spin_button)
-{
- g_return_val_if_fail (spin_button != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spin_button), FALSE);
-
- if (spin_button->timer)
- {
- gtk_spin_button_spin (spin_button, spin_button->click_child,
- spin_button->timer_step);
-
- if (spin_button->need_timer) {
- spin_button->need_timer = FALSE;
- spin_button->timer = gtk_timeout_add
- (SPIN_BUTTON_TIMER_DELAY, (GtkFunction) gtk_spin_button_timer,
- (gpointer) spin_button);
- return FALSE;
- }
- else if (spin_button->climb_rate > 0.0 &&
- spin_button->timer_step < spin_button->adjustment->page_increment)
- {
- if (spin_button->timer_calls < MAX_TIMER_CALLS)
- spin_button->timer_calls++;
- else
- {
- spin_button->timer_calls = 0;
- spin_button->timer_step += spin_button->climb_rate;
- }
- }
- return TRUE;
- }
- return FALSE;
-}
-
-static void
-gtk_spin_button_spin (GtkSpinButton *spin_button,
- guint direction,
- gfloat step)
-{
- gfloat new_value = 0.0;
-
- g_return_if_fail (spin_button != NULL);
- g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
-
- if (direction == GTK_ARROW_UP)
- {
- new_value = MIN (spin_button->adjustment->value + step,
- spin_button->adjustment->upper);
- }
- else if (direction == GTK_ARROW_DOWN)
- {
- new_value = MAX (spin_button->adjustment->value - step,
- spin_button->adjustment->lower);
- }
-
- if (new_value != spin_button->adjustment->value)
- {
- spin_button->adjustment->value = new_value;
- gtk_signal_emit_by_name (GTK_OBJECT (spin_button->adjustment),
- "value_changed");
- }
-}
-
-static void
-gtk_spin_button_value_changed (GtkWidget *widget,
- GtkSpinButton *spin_button)
-{
- char buf[MAX_TEXT_LENGTH];
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_ADJUSTMENT (widget));
-
- sprintf (buf, "%0.*f", spin_button->digits, spin_button->adjustment->value);
- gtk_entry_set_text (GTK_ENTRY (spin_button), buf);
-}
-
-static gint
-gtk_spin_button_key_press (GtkWidget *widget,
- GdkEventKey *event)
-{
- GtkSpinButton *spin;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_SPIN_BUTTON (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- spin = GTK_SPIN_BUTTON (widget);
-
- switch (event->keyval)
- {
- case GDK_Up:
- if (GTK_WIDGET_HAS_FOCUS (widget))
- {
- gtk_signal_emit_stop_by_name (GTK_OBJECT (widget),
- "key_press_event");
- gtk_spin_button_spin (spin, GTK_ARROW_UP,
- spin->adjustment->step_increment);
- return TRUE;
- }
- return FALSE;
- case GDK_Down:
- if (GTK_WIDGET_HAS_FOCUS (widget))
- {
- gtk_signal_emit_stop_by_name (GTK_OBJECT (widget),
- "key_press_event");
- gtk_spin_button_spin (spin, GTK_ARROW_DOWN,
- spin->adjustment->step_increment);
- return TRUE;
- }
- return FALSE;
- case GDK_Page_Up:
- if (event->state & GDK_CONTROL_MASK)
- {
- spin->adjustment->value = spin->adjustment->upper;
- gtk_signal_emit_by_name (GTK_OBJECT (spin->adjustment),
- "value_changed");
- }
- else
- gtk_spin_button_spin (spin, GTK_ARROW_UP,
- spin->adjustment->page_increment);
- return TRUE;
- case GDK_Page_Down:
- if (event->state & GDK_CONTROL_MASK)
- {
- spin->adjustment->value = spin->adjustment->lower;
- gtk_signal_emit_by_name (GTK_OBJECT (spin->adjustment),
- "value_changed");
- }
- else
- gtk_spin_button_spin (spin, GTK_ARROW_DOWN,
- spin->adjustment->page_increment);
- return TRUE;
- default:
- break;
- }
- return GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event);
-}
-
-static void
-gtk_spin_button_update (GtkSpinButton *spin_button)
-{
- gfloat tmp;
- gfloat val;
- gchar *error = NULL;
-
- g_return_if_fail (spin_button != NULL);
- g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
-
- val = strtod (GTK_ENTRY (spin_button)->text, &error);
-
- if (spin_button->update_policy & GTK_UPDATE_ALWAYS)
- {
- if (val < spin_button->adjustment->lower)
- val = spin_button->adjustment->lower;
- else if (val > spin_button->adjustment->upper)
- val = spin_button->adjustment->upper;
- }
- else if ((spin_button->update_policy & GTK_UPDATE_IF_VALID) &&
- (*error ||
- val < spin_button->adjustment->lower ||
- val > spin_button->adjustment->upper))
- {
- gtk_signal_emit_by_name (GTK_OBJECT (spin_button->adjustment),
- "value_changed");
- return;
- }
-
- if (spin_button->update_policy & GTK_UPDATE_SNAP_TO_TICKS)
- {
- gfloat inc;
-
- inc = spin_button->adjustment->step_increment;
- tmp = (val - spin_button->adjustment->lower) / inc;
- if (tmp - floor (tmp) < ceil (tmp) - tmp)
- val = spin_button->adjustment->lower + floor (tmp) * inc;
- else
- val = spin_button->adjustment->lower + ceil (tmp) * inc;
- spin_button->snapped = 1;
- }
- spin_button->adjustment->value = val;
- gtk_signal_emit_by_name (GTK_OBJECT (spin_button->adjustment),
- "value_changed");
-}
-
-static void
-gtk_spin_button_changed (GtkEditable *editable)
-{
- g_return_if_fail (editable != NULL);
- g_return_if_fail (GTK_IS_SPIN_BUTTON (editable));
-
- GTK_EDITABLE_CLASS (parent_class)->changed (editable);
- if (GTK_WIDGET_VISIBLE (GTK_WIDGET (editable)))
- {
- GtkSpinButton *spin;
- gfloat val;
- gchar *error = NULL;
-
- spin = GTK_SPIN_BUTTON (editable);
- spin->snapped = 0;
-
- val = strtod (GTK_ENTRY (editable)->text, &error);
- if (val < spin->adjustment->lower)
- val = spin->adjustment->lower;
- else if (val > spin->adjustment->upper)
- val = spin->adjustment->upper;
- spin->adjustment->value = val;
- }
-}
-
-static void
-gtk_spin_button_activate (GtkEditable *editable)
-{
- g_return_if_fail (editable != NULL);
- g_return_if_fail (GTK_IS_SPIN_BUTTON (editable));
-
- if (editable->editable)
- gtk_spin_button_update (GTK_SPIN_BUTTON (editable));
-}
-
-void
-gtk_spin_button_set_adjustment (GtkSpinButton *spin_button,
- GtkAdjustment *adjustment)
-{
- g_return_if_fail (spin_button != NULL);
- g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
-
- if (spin_button->adjustment != adjustment)
- {
- if (spin_button->adjustment)
- {
- gtk_signal_disconnect_by_data (GTK_OBJECT (spin_button->adjustment),
- (gpointer) spin_button);
- gtk_object_unref (GTK_OBJECT (spin_button->adjustment));
- }
- spin_button->adjustment = adjustment;
- if (adjustment)
- {
- gtk_object_ref (GTK_OBJECT (adjustment));
- gtk_object_sink (GTK_OBJECT (adjustment));
- gtk_signal_connect
- (GTK_OBJECT (adjustment), "value_changed",
- (GtkSignalFunc) gtk_spin_button_value_changed,
- (gpointer) spin_button);
- }
- }
-}
-
-GtkAdjustment *
-gtk_spin_button_get_adjustment (GtkSpinButton *spin_button)
-{
- g_return_val_if_fail (spin_button != NULL, NULL);
- g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spin_button), NULL);
-
- return spin_button->adjustment;
-}
-
-void
-gtk_spin_button_set_digits (GtkSpinButton *spin_button,
- gint digits)
-{
- g_return_if_fail (spin_button != NULL);
- g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
- g_return_if_fail (digits >= 0 || digits < 128);
-
- if (spin_button->digits != digits)
- {
- spin_button->digits = digits;
- if (GTK_WIDGET_VISIBLE (spin_button) && GTK_WIDGET_MAPPED (spin_button))
- gtk_signal_emit_by_name (GTK_OBJECT (spin_button->adjustment),
- "value_changed");
- }
-}
-
-gfloat
-gtk_spin_button_get_value_as_float (GtkSpinButton *spin_button)
-{
- g_return_val_if_fail (spin_button != NULL, 0.0);
- g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spin_button), 0.0);
-
- return spin_button->adjustment->value;
-}
-
-gint
-gtk_spin_button_get_value_as_int (GtkSpinButton *spin_button)
-{
- gfloat val;
-
- g_return_val_if_fail (spin_button != NULL, 0);
- g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spin_button), 0);
-
- val = spin_button->adjustment->value;
- if (val - floor (val) < ceil (val) - val)
- return floor (val);
- else
- return ceil (val);
-}
-
-void
-gtk_spin_button_set_value (GtkSpinButton *spin_button,
- gfloat value)
-{
- g_return_if_fail (spin_button != NULL);
- g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
-
- if (spin_button->adjustment->value != value)
- {
- spin_button->adjustment->value = value;
- if (GTK_WIDGET_VISIBLE (spin_button) && GTK_WIDGET_MAPPED (spin_button))
- gtk_signal_emit_by_name (GTK_OBJECT (spin_button->adjustment),
- "value_changed");
- }
-}
-
-void
-gtk_spin_button_set_update_policy (GtkSpinButton *spin_button,
- GtkSpinButtonUpdatePolicy policy)
-{
- g_return_if_fail (spin_button != NULL);
- g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
-
- spin_button->update_policy = policy;
-}
diff --git a/gtk/gtkspinbutton.h b/gtk/gtkspinbutton.h
deleted file mode 100644
index b9aed002a6..0000000000
--- a/gtk/gtkspinbutton.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef __GTK_SPIN_BUTTON_H__
-#define __GTK_SPIN_BUTTON_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkadjustment.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_SPIN_BUTTON(obj) GTK_CHECK_CAST (obj, gtk_spin_button_get_type (), GtkSpinButton)
-#define GTK_SPIN_BUTTON_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_spin_button_get_type (), GtkSpinButtonClass)
-#define GTK_IS_SPIN_BUTTON(obj) GTK_CHECK_TYPE (obj, gtk_spin_button_get_type ())
-
-
-typedef enum
-{
- GTK_UPDATE_ALWAYS = 1 << 0,
- GTK_UPDATE_IF_VALID = 1 << 1,
- GTK_UPDATE_SNAP_TO_TICKS = 1 << 2
-} GtkSpinButtonUpdatePolicy;
-
-
-typedef struct _GtkSpinButton GtkSpinButton;
-typedef struct _GtkSpinButtonClass GtkSpinButtonClass;
-
-
-struct _GtkSpinButton
-{
- GtkEntry entry;
-
- GtkAdjustment *adjustment;
-
- GdkWindow *panel;
-
- guint32 timer;
-
- gfloat climb_rate;
- gfloat timer_step;
-
- guint8 update_policy;
-
- guint snapped : 1;
- guint in_child : 2;
- guint click_child : 2;
- guint button : 2;
- guint need_timer : 1;
- guint timer_calls : 3;
- guint digits : 7;
-};
-
-struct _GtkSpinButtonClass
-{
- GtkEntryClass parent_class;
-};
-
-guint
-gtk_spin_button_get_type (void);
-
-void
-gtk_spin_button_construct (GtkSpinButton *spin_button,
- GtkAdjustment *adjustment,
- gfloat climb_rate,
- gint digits);
-
-GtkWidget *
-gtk_spin_button_new (GtkAdjustment *adjustment,
- gfloat climb_rate,
- gint digits);
-
-void
-gtk_spin_button_set_adjustment (GtkSpinButton *spin_button,
- GtkAdjustment *adjustment);
-
-GtkAdjustment *
-gtk_spin_button_get_adjustment (GtkSpinButton *spin_button);
-
-void
-gtk_spin_button_set_digits (GtkSpinButton *spin_button,
- gint digits);
-
-gfloat
-gtk_spin_button_get_value_as_float (GtkSpinButton *spin_button);
-
-gint
-gtk_spin_button_get_value_as_int (GtkSpinButton *spin_button);
-
-void
-gtk_spin_button_set_value (GtkSpinButton *spin_button,
- gfloat value);
-
-void
-gtk_spin_button_set_update_policy (GtkSpinButton *spin_button,
- GtkSpinButtonUpdatePolicy policy);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_SPIN_BUTTON_H__ */
diff --git a/gtk/gtkstatusbar.c b/gtk/gtkstatusbar.c
deleted file mode 100644
index 782f5718cd..0000000000
--- a/gtk/gtkstatusbar.c
+++ /dev/null
@@ -1,358 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- * GtkStatusbar Copyright (C) 1998 Shawn T. Amundson
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "gtkframe.h"
-#include "gtklabel.h"
-#include "gtksignal.h"
-#include "gtkstatusbar.h"
-
-
-enum
-{
- SIGNAL_TEXT_PUSHED,
- SIGNAL_TEXT_POPPED,
- SIGNAL_LAST
-};
-
-typedef void (*SignalTextP) (GtkObject *object,
- guint context_id,
- const gchar *text,
- gpointer func_data);
-
-static void gtk_statusbar_class_init (GtkStatusbarClass *class);
-static void gtk_statusbar_init (GtkStatusbar *statusbar);
-static void gtk_statusbar_destroy (GtkObject *object);
-static void gtk_statusbar_finalize (GtkObject *object);
-static void gtk_statusbar_update (GtkStatusbar *statusbar,
- guint context_id,
- const gchar *text);
-
-static GtkContainerClass *parent_class;
-static guint statusbar_signals[SIGNAL_LAST] = { 0 };
-
-guint
-gtk_statusbar_get_type ()
-{
- static guint statusbar_type = 0;
-
- if (!statusbar_type)
- {
- GtkTypeInfo statusbar_info =
- {
- "GtkStatusbar",
- sizeof (GtkStatusbar),
- sizeof (GtkStatusbarClass),
- (GtkClassInitFunc) gtk_statusbar_class_init,
- (GtkObjectInitFunc) gtk_statusbar_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- statusbar_type = gtk_type_unique (gtk_hbox_get_type (), &statusbar_info);
- }
-
- return statusbar_type;
-}
-
-static void
-gtk_statusbar_marshal_text_p (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- SignalTextP sfunc = (SignalTextP) func;
-
- (* sfunc) (object,
- GTK_VALUE_UINT (args[0]),
- GTK_VALUE_STRING (args[1]),
- func_data);
-}
-
-static void
-gtk_statusbar_class_init (GtkStatusbarClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GtkObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
- container_class = (GtkContainerClass *) class;
-
- parent_class = gtk_type_class (gtk_hbox_get_type ());
-
- statusbar_signals[SIGNAL_TEXT_PUSHED] =
- gtk_signal_new ("text_pushed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkStatusbarClass, text_pushed),
- gtk_statusbar_marshal_text_p,
- GTK_TYPE_NONE, 2,
- GTK_TYPE_UINT,
- GTK_TYPE_STRING);
- statusbar_signals[SIGNAL_TEXT_POPPED] =
- gtk_signal_new ("text_popped",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkStatusbarClass, text_popped),
- gtk_statusbar_marshal_text_p,
- GTK_TYPE_NONE, 2,
- GTK_TYPE_UINT,
- GTK_TYPE_STRING);
- gtk_object_class_add_signals (object_class, statusbar_signals, SIGNAL_LAST);
-
- object_class->destroy = gtk_statusbar_destroy;
- object_class->finalize = gtk_statusbar_finalize;
-
- class->messages_mem_chunk = g_mem_chunk_new ("GtkStatusBar messages mem chunk",
- sizeof (GtkStatusbarMsg),
- sizeof (GtkStatusbarMsg) * 64,
- G_ALLOC_AND_FREE);
-
- class->text_pushed = gtk_statusbar_update;
- class->text_popped = gtk_statusbar_update;
-}
-
-static void
-gtk_statusbar_init (GtkStatusbar *statusbar)
-{
- GtkBox *box;
-
- box = GTK_BOX (statusbar);
-
- box->spacing = 2;
- box->homogeneous = FALSE;
-
- statusbar->frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (statusbar->frame), GTK_SHADOW_IN);
- gtk_box_pack_start (box, statusbar->frame, TRUE, TRUE, 0);
- gtk_widget_show (statusbar->frame);
-
- statusbar->label = gtk_label_new ("");
- gtk_misc_set_alignment (GTK_MISC (statusbar->label), 0.0, 0.0);
- gtk_container_add (GTK_CONTAINER (statusbar->frame), statusbar->label);
- gtk_widget_show (statusbar->label);
-
- statusbar->seq_context_id = 1;
- statusbar->seq_message_id = 1;
- statusbar->messages = NULL;
- statusbar->keys = NULL;
-}
-
-GtkWidget*
-gtk_statusbar_new ()
-{
- return gtk_type_new (gtk_statusbar_get_type ());
-}
-
-static void
-gtk_statusbar_update (GtkStatusbar *statusbar,
- guint context_id,
- const gchar *text)
-{
- g_return_if_fail (statusbar != NULL);
- g_return_if_fail (GTK_IS_STATUSBAR (statusbar));
-
- if (!text)
- text = "";
-
- gtk_label_set (GTK_LABEL (statusbar->label), text);
-}
-
-guint
-gtk_statusbar_get_context_id (GtkStatusbar *statusbar,
- const gchar *context_description)
-{
- gchar *string;
- guint *id;
-
- g_return_val_if_fail (statusbar != NULL, 0);
- g_return_val_if_fail (GTK_IS_STATUSBAR (statusbar), 0);
- g_return_val_if_fail (context_description != NULL, 0);
-
- /* we need to preserve namespaces on object datas */
- string = g_strconcat ("gtk-status-bar-context:", context_description, NULL);
-
- id = gtk_object_get_data (GTK_OBJECT (statusbar), string);
- if (!id)
- {
- id = g_new (guint, 1);
- *id = statusbar->seq_context_id++;
- gtk_object_set_data_full (GTK_OBJECT (statusbar), string, id, (GtkDestroyNotify) g_free);
- statusbar->keys = g_slist_prepend (statusbar->keys, string);
- }
- else
- g_free (string);
-
- return *id;
-}
-
-guint
-gtk_statusbar_push (GtkStatusbar *statusbar,
- guint context_id,
- const gchar *text)
-{
- GtkStatusbarMsg *msg;
- GtkStatusbarClass *class;
-
- g_return_val_if_fail (statusbar != NULL, 0);
- g_return_val_if_fail (GTK_IS_STATUSBAR (statusbar), 0);
- g_return_val_if_fail (text != NULL, 0);
- g_return_val_if_fail (context_id > 0, 0);
-
- class = GTK_STATUSBAR_CLASS (GTK_OBJECT (statusbar)->klass);
- msg = g_chunk_new (GtkStatusbarMsg, class->messages_mem_chunk);
- msg->text = g_strdup (text);
- msg->context_id = context_id;
- msg->message_id = statusbar->seq_message_id++;
-
- statusbar->messages = g_slist_prepend (statusbar->messages, msg);
-
- gtk_signal_emit (GTK_OBJECT (statusbar),
- statusbar_signals[SIGNAL_TEXT_PUSHED],
- msg->context_id,
- msg->text);
-
- return msg->message_id;
-}
-
-void
-gtk_statusbar_pop (GtkStatusbar *statusbar,
- guint context_id)
-{
- GtkStatusbarMsg *msg;
-
- g_return_if_fail (statusbar != NULL);
- g_return_if_fail (GTK_IS_STATUSBAR (statusbar));
- g_return_if_fail (context_id > 0);
-
- if (statusbar->messages)
- {
- GSList *list;
- GtkStatusbarClass *class;
-
- list = statusbar->messages;
- msg = list->data;
- class = GTK_STATUSBAR_CLASS (GTK_OBJECT (statusbar)->klass);
-
- statusbar->messages = g_slist_remove_link (statusbar->messages, list);
- g_free (msg->text);
- g_mem_chunk_free (class->messages_mem_chunk, msg);
- g_slist_free_1 (list);
- }
-
- msg = statusbar->messages ? statusbar->messages->data : NULL;
-
- gtk_signal_emit (GTK_OBJECT (statusbar),
- statusbar_signals[SIGNAL_TEXT_POPPED],
- (guint) (msg ? msg->context_id : 0),
- msg ? msg->text : NULL);
-}
-
-void
-gtk_statusbar_remove (GtkStatusbar *statusbar,
- guint context_id,
- guint message_id)
-{
- GtkStatusbarMsg *msg;
-
- g_return_if_fail (statusbar != NULL);
- g_return_if_fail (GTK_IS_STATUSBAR (statusbar));
- g_return_if_fail (context_id > 0);
- g_return_if_fail (message_id > 0);
-
- msg = statusbar->messages ? statusbar->messages->data : NULL;
- if (msg)
- {
- GSList *list;
-
- /* care about signal emission if the topmost item is removed */
- if (msg->context_id == context_id &&
- msg->message_id == message_id)
- {
- gtk_statusbar_pop (statusbar, context_id);
- return;
- }
-
- for (list = statusbar->messages; list; list = list->next)
- {
- msg = list->data;
-
- if (msg->context_id == context_id &&
- msg->message_id == message_id)
- {
- GtkStatusbarClass *class;
-
- class = GTK_STATUSBAR_CLASS (GTK_OBJECT (statusbar)->klass);
- statusbar->messages = g_slist_remove_link (statusbar->messages, list);
- g_free (msg->text);
- g_mem_chunk_free (class->messages_mem_chunk, msg);
- g_slist_free_1 (list);
-
- break;
- }
- }
- }
-}
-
-static void
-gtk_statusbar_destroy (GtkObject *object)
-{
- GtkStatusbar *statusbar;
- GtkStatusbarClass *class;
- GSList *list;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_STATUSBAR (object));
-
- statusbar = GTK_STATUSBAR (object);
- class = GTK_STATUSBAR_CLASS (GTK_OBJECT (statusbar)->klass);
-
- for (list = statusbar->messages; list; list = list->next)
- {
- GtkStatusbarMsg *msg;
-
- msg = list->data;
- g_free (msg->text);
- g_mem_chunk_free (class->messages_mem_chunk, msg);
- }
- g_slist_free (statusbar->messages);
- statusbar->messages = NULL;
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-}
-
-static void
-gtk_statusbar_finalize (GtkObject *object)
-{
- GtkStatusbar *statusbar;
- GSList *list;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_STATUSBAR (object));
-
- statusbar = GTK_STATUSBAR (object);
-
- for (list = statusbar->keys; list; list = list->next)
- g_free (list->data);
- g_slist_free (statusbar->messages);
- statusbar->keys = NULL;
-
- GTK_OBJECT_CLASS (parent_class)->finalize (object);
-}
diff --git a/gtk/gtkstatusbar.h b/gtk/gtkstatusbar.h
deleted file mode 100644
index a0f1b13acb..0000000000
--- a/gtk/gtkstatusbar.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- * GtkStatusbar Copyright (C) 1998 Shawn T. Amundson
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef __GTK_STATUSBAR_H__
-#define __GTK_STATUSBAR_H__
-
-#include <gtk/gtkhbox.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define GTK_STATUSBAR(obj) GTK_CHECK_CAST (obj, gtk_statusbar_get_type (), GtkStatusbar)
-#define GTK_STATUSBAR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_statusbar_get_type (), GtkStatusbarClass)
-#define GTK_IS_STATUSBAR(obj) GTK_CHECK_TYPE (obj, gtk_statusbar_get_type ())
-
-typedef struct _GtkStatusbar GtkStatusbar;
-typedef struct _GtkStatusbarClass GtkStatusbarClass;
-typedef struct _GtkStatusbarMsg GtkStatusbarMsg;
-
-struct _GtkStatusbar
-{
- GtkHBox parent_widget;
-
- GtkWidget *frame;
- GtkWidget *label;
-
- GSList *messages;
- GSList *keys;
-
- guint seq_context_id;
- guint seq_message_id;
-};
-
-struct _GtkStatusbarClass
-{
- GtkHBoxClass parent_class;
-
- GMemChunk *messages_mem_chunk;
-
- void (*text_pushed) (GtkStatusbar *statusbar,
- guint context_id,
- const gchar *text);
- void (*text_popped) (GtkStatusbar *statusbar,
- guint context_id,
- const gchar *text);
-};
-
-struct _GtkStatusbarMsg
-{
- gchar *text;
- guint context_id;
- guint message_id;
-};
-
-guint gtk_statusbar_get_type (void);
-GtkWidget* gtk_statusbar_new (void);
-guint gtk_statusbar_get_context_id (GtkStatusbar *statusbar,
- const gchar *context_description);
-/* Returns message_id used for gtk_statusbar_remove */
-guint gtk_statusbar_push (GtkStatusbar *statusbar,
- guint context_id,
- const gchar *text);
-void gtk_statusbar_pop (GtkStatusbar *statusbar,
- guint context_id);
-void gtk_statusbar_remove (GtkStatusbar *statusbar,
- guint context_id,
- guint message_id);
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* __GTK_STATUSBAR_H__ */
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c
deleted file mode 100644
index 9aa87de2ac..0000000000
--- a/gtk/gtkstyle.c
+++ /dev/null
@@ -1,1791 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <math.h>
-#include "gtkgc.h"
-#include "gtkstyle.h"
-#include "gtkwidget.h"
-
-
-#define LIGHTNESS_MULT 1.3
-#define DARKNESS_MULT 0.7
-
-
-typedef struct _GtkStyleKey GtkStyleKey;
-
-struct _GtkStyleKey
-{
- GdkColor fg[5];
- GdkColor bg[5];
- GdkColor text[5];
- GdkColor base[5];
-
- GdkPixmap *bg_pixmap[5];
-
- GdkFont *font;
-
- gint depth;
- GdkColormap *colormap;
- GtkStyleClass *klass;
-};
-
-
-static void gtk_style_init (GtkStyle *style);
-static void gtk_styles_init (void);
-static void gtk_style_remove (GtkStyle *style);
-static GtkStyle* gtk_style_find (GtkStyle *style,
- GdkColormap *cmap,
- gint depth);
-static GtkStyle* gtk_style_new_from_key (GtkStyleKey *key);
-static GtkStyleKey* gtk_style_key_dup (GtkStyleKey *key);
-static void gtk_style_destroy (GtkStyle *style);
-static void gtk_style_key_destroy (GtkStyleKey *key);
-static guint gtk_style_key_hash (GtkStyleKey *key);
-static guint gtk_style_value_hash (GtkStyle *style);
-static gint gtk_style_key_compare (GtkStyleKey *a,
- GtkStyleKey *b);
-
-static void gtk_default_draw_hline (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- gint x1,
- gint x2,
- gint y);
-static void gtk_default_draw_vline (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- gint y1,
- gint y2,
- gint x);
-static void gtk_default_draw_shadow (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- gint x,
- gint y,
- gint width,
- gint height);
-static void gtk_default_draw_polygon (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GdkPoint *points,
- gint npoints,
- gint fill);
-static void gtk_default_draw_arrow (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkArrowType arrow_type,
- gint fill,
- gint x,
- gint y,
- gint width,
- gint height);
-static void gtk_default_draw_diamond (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- gint x,
- gint y,
- gint width,
- gint height);
-static void gtk_default_draw_oval (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- gint x,
- gint y,
- gint width,
- gint height);
-static void gtk_default_draw_string (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- gint x,
- gint y,
- const gchar *string);
-
-static void gtk_style_shade (GdkColor *a, GdkColor *b, gdouble k);
-static void rgb_to_hls (gdouble *r, gdouble *g, gdouble *b);
-static void hls_to_rgb (gdouble *h, gdouble *l, gdouble *s);
-
-
-static GtkStyleClass default_class =
-{
- 2,
- 2,
- gtk_default_draw_hline,
- gtk_default_draw_vline,
- gtk_default_draw_shadow,
- gtk_default_draw_polygon,
- gtk_default_draw_arrow,
- gtk_default_draw_diamond,
- gtk_default_draw_oval,
- gtk_default_draw_string,
-};
-
-static GdkColor gtk_default_normal_fg = { 0, 0, 0, 0 };
-static GdkColor gtk_default_active_fg = { 0, 0, 0, 0 };
-static GdkColor gtk_default_prelight_fg = { 0, 0, 0, 0 };
-static GdkColor gtk_default_selected_fg = { 0, 0xffff, 0xffff, 0xffff };
-static GdkColor gtk_default_insensitive_fg = { 0, 0x7530, 0x7530, 0x7530 };
-
-static GdkColor gtk_default_normal_bg = { 0, 0xd6d6, 0xd6d6, 0xd6d6 };
-static GdkColor gtk_default_active_bg = { 0, 0xc350, 0xc350, 0xc350 };
-static GdkColor gtk_default_prelight_bg = { 0, 0xea60, 0xea60, 0xea60 };
-static GdkColor gtk_default_selected_bg = { 0, 0, 0, 0x9c40 };
-static GdkColor gtk_default_insensitive_bg = { 0, 0xd6d6, 0xd6d6, 0xd6d6 };
-
-static GdkFont *default_font = NULL;
-
-static gint initialize = TRUE;
-static GCache *style_cache = NULL;
-static GSList *unattached_styles = NULL;
-
-static GMemChunk *key_mem_chunk = NULL;
-
-GtkStyle*
-gtk_style_copy (GtkStyle *style)
-{
- GtkStyle *new_style;
- guint i;
-
- g_return_val_if_fail (style != NULL, NULL);
-
- new_style = gtk_style_new ();
-
- for (i = 0; i < 5; i++)
- {
- new_style->fg[i] = style->fg[i];
- new_style->bg[i] = style->bg[i];
- new_style->text[i] = style->text[i];
- new_style->base[i] = style->base[i];
-
- new_style->bg_pixmap[i] = style->bg_pixmap[i];
- }
-
- new_style->font = style->font;
- gdk_font_ref (new_style->font);
-
- return new_style;
-}
-
-GtkStyle*
-gtk_style_new ()
-{
- GtkStyle *style;
- gint i;
-
- style = g_new0 (GtkStyle, 1);
-
- if (!default_font)
- default_font =
- gdk_font_load ("-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*");
-
- style->font = default_font;
- gdk_font_ref (style->font);
-
- style->ref_count = 1;
- style->attach_count = 0;
- style->colormap = NULL;
- style->depth = -1;
- style->klass = &default_class;
-
- style->black.red = 0;
- style->black.green = 0;
- style->black.blue = 0;
-
- style->white.red = 65535;
- style->white.green = 65535;
- style->white.blue = 65535;
-
- style->black_gc = NULL;
- style->white_gc = NULL;
-
- style->fg[GTK_STATE_NORMAL] = gtk_default_normal_fg;
- style->fg[GTK_STATE_ACTIVE] = gtk_default_active_fg;
- style->fg[GTK_STATE_PRELIGHT] = gtk_default_prelight_fg;
- style->fg[GTK_STATE_SELECTED] = gtk_default_selected_fg;
- style->fg[GTK_STATE_INSENSITIVE] = gtk_default_insensitive_fg;
-
- style->bg[GTK_STATE_NORMAL] = gtk_default_normal_bg;
- style->bg[GTK_STATE_ACTIVE] = gtk_default_active_bg;
- style->bg[GTK_STATE_PRELIGHT] = gtk_default_prelight_bg;
- style->bg[GTK_STATE_SELECTED] = gtk_default_selected_bg;
- style->bg[GTK_STATE_INSENSITIVE] = gtk_default_insensitive_bg;
-
- for (i = 0; i < 5; i++)
- {
- style->text[i] = style->fg[i];
- style->base[i] = style->white;
- }
-
- for (i = 0; i < 5; i++)
- style->bg_pixmap[i] = NULL;
-
- for (i = 0; i < 5; i++)
- {
- style->fg_gc[i] = NULL;
- style->bg_gc[i] = NULL;
- style->light_gc[i] = NULL;
- style->dark_gc[i] = NULL;
- style->mid_gc[i] = NULL;
- style->text_gc[i] = NULL;
- style->base_gc[i] = NULL;
- }
-
- unattached_styles = g_slist_prepend (unattached_styles, style);
-
- return style;
-}
-
-GtkStyle*
-gtk_style_attach (GtkStyle *style,
- GdkWindow *window)
-{
- GtkStyle *new_style;
- GdkColormap *colormap;
- gint depth;
-
- g_return_val_if_fail (style != NULL, NULL);
- g_return_val_if_fail (window != NULL, NULL);
-
- colormap = gdk_window_get_colormap (window);
- gdk_window_get_geometry (window, NULL, NULL, NULL, NULL, &depth);
-
- new_style = gtk_style_find (style, colormap, depth);
-
- if (new_style && (new_style != style))
- {
- gtk_style_unref (style);
- style = new_style;
- gtk_style_ref (style);
- }
-
- if (style->attach_count == 0)
- unattached_styles = g_slist_remove (unattached_styles, style);
-
- style->attach_count += 1;
-
- return style;
-}
-
-void
-gtk_style_detach (GtkStyle *style)
-{
- gint i;
-
- g_return_if_fail (style != NULL);
-
- style->attach_count -= 1;
- if (style->attach_count == 0)
- {
- unattached_styles = g_slist_prepend (unattached_styles, style);
-
- gtk_gc_release (style->black_gc);
- gtk_gc_release (style->white_gc);
-
- style->black_gc = NULL;
- style->white_gc = NULL;
-
- for (i = 0; i < 5; i++)
- {
- gtk_gc_release (style->fg_gc[i]);
- gtk_gc_release (style->bg_gc[i]);
- gtk_gc_release (style->light_gc[i]);
- gtk_gc_release (style->dark_gc[i]);
- gtk_gc_release (style->mid_gc[i]);
- gtk_gc_release (style->text_gc[i]);
- gtk_gc_release (style->base_gc[i]);
-
- style->fg_gc[i] = NULL;
- style->bg_gc[i] = NULL;
- style->light_gc[i] = NULL;
- style->dark_gc[i] = NULL;
- style->mid_gc[i] = NULL;
- style->text_gc[i] = NULL;
- style->base_gc[i] = NULL;
- }
-
- style->depth = -1;
- style->colormap = NULL;
- }
-
- gtk_style_remove (style);
-}
-
-GtkStyle*
-gtk_style_ref (GtkStyle *style)
-{
- g_return_val_if_fail (style != NULL, NULL);
-
- style->ref_count += 1;
- return style;
-}
-
-void
-gtk_style_unref (GtkStyle *style)
-{
- g_return_if_fail (style != NULL);
-
- style->ref_count -= 1;
- if (style->ref_count == 0)
- gtk_style_destroy (style);
-}
-
-void
-gtk_style_set_background (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type)
-{
- GdkPixmap *pixmap;
- gint parent_relative;
-
- g_return_if_fail (style != NULL);
- g_return_if_fail (window != NULL);
-
- if (style->bg_pixmap[state_type])
- {
- if (style->bg_pixmap[state_type] == (GdkPixmap*) GDK_PARENT_RELATIVE)
- {
- pixmap = NULL;
- parent_relative = TRUE;
- }
- else
- {
- pixmap = style->bg_pixmap[state_type];
- parent_relative = FALSE;
- }
-
- gdk_window_set_back_pixmap (window, pixmap, parent_relative);
- }
- else
- gdk_window_set_background (window, &style->bg[state_type]);
-}
-
-
-void
-gtk_draw_hline (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- gint x1,
- gint x2,
- gint y)
-{
- g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_hline != NULL);
-
- (*style->klass->draw_hline) (style, window, state_type, x1, x2, y);
-}
-
-
-void
-gtk_draw_vline (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- gint y1,
- gint y2,
- gint x)
-{
- g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_vline != NULL);
-
- (*style->klass->draw_vline) (style, window, state_type, y1, y2, x);
-}
-
-
-void
-gtk_draw_shadow (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_shadow != NULL);
-
- (*style->klass->draw_shadow) (style, window, state_type, shadow_type, x, y, width, height);
-}
-
-void
-gtk_draw_polygon (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GdkPoint *points,
- gint npoints,
- gint fill)
-{
- g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_shadow != NULL);
-
- (*style->klass->draw_polygon) (style, window, state_type, shadow_type, points, npoints, fill);
-}
-
-void
-gtk_draw_arrow (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkArrowType arrow_type,
- gint fill,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_arrow != NULL);
-
- (*style->klass->draw_arrow) (style, window, state_type, shadow_type, arrow_type, fill, x, y, width, height);
-}
-
-
-void
-gtk_draw_diamond (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_diamond != NULL);
-
- (*style->klass->draw_diamond) (style, window, state_type, shadow_type, x, y, width, height);
-}
-
-
-void
-gtk_draw_oval (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_oval != NULL);
-
- (*style->klass->draw_oval) (style, window, state_type, shadow_type, x, y, width, height);
-}
-
-void
-gtk_draw_string (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- gint x,
- gint y,
- const gchar *string)
-{
- g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_oval != NULL);
-
- (*style->klass->draw_string) (style, window, state_type, x, y, string);
-}
-
-
-static void
-gtk_style_init (GtkStyle *style)
-{
- GdkGCValues gc_values;
- GdkGCValuesMask gc_values_mask;
- GdkColormap *colormap;
- gint i;
-
- g_return_if_fail (style != NULL);
-
- if (style->attach_count == 0)
- {
- for (i = 0; i < 5; i++)
- {
- gtk_style_shade (&style->bg[i], &style->light[i], LIGHTNESS_MULT);
- gtk_style_shade (&style->bg[i], &style->dark[i], DARKNESS_MULT);
-
- style->mid[i].red = (style->light[i].red + style->dark[i].red) / 2;
- style->mid[i].green = (style->light[i].green + style->dark[i].green) / 2;
- style->mid[i].blue = (style->light[i].blue + style->dark[i].blue) / 2;
- }
-
- colormap = style->colormap;
-
- gdk_color_black (colormap, &style->black);
- gdk_color_white (colormap, &style->white);
-
- gc_values_mask = GDK_GC_FOREGROUND | GDK_GC_FONT;
- if (style->font->type == GDK_FONT_FONT)
- {
- gc_values.font = style->font;
- }
- else if (style->font->type == GDK_FONT_FONTSET)
- {
- gc_values.font = default_font;
- }
-
- gc_values.foreground = style->black;
- style->black_gc = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
-
- gc_values.foreground = style->white;
- style->white_gc = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
-
- for (i = 0; i < 5; i++)
- {
- if (!gdk_color_alloc (colormap, &style->fg[i]))
- g_warning ("unable to allocate color: ( %d %d %d )",
- style->fg[i].red, style->fg[i].green, style->fg[i].blue);
- if (!gdk_color_alloc (colormap, &style->bg[i]))
- g_warning ("unable to allocate color: ( %d %d %d )",
- style->bg[i].red, style->bg[i].green, style->bg[i].blue);
- if (!gdk_color_alloc (colormap, &style->light[i]))
- g_warning ("unable to allocate color: ( %d %d %d )",
- style->light[i].red, style->light[i].green, style->light[i].blue);
- if (!gdk_color_alloc (colormap, &style->dark[i]))
- g_warning ("unable to allocate color: ( %d %d %d )",
- style->dark[i].red, style->dark[i].green, style->dark[i].blue);
- if (!gdk_color_alloc (colormap, &style->mid[i]))
- g_warning ("unable to allocate color: ( %d %d %d )",
- style->mid[i].red, style->mid[i].green, style->mid[i].blue);
- if (!gdk_color_alloc (colormap, &style->text[i]))
- g_warning ("unable to allocate color: ( %d %d %d )",
- style->text[i].red, style->text[i].green, style->text[i].blue);
- if (!gdk_color_alloc (colormap, &style->base[i]))
- g_warning ("unable to allocate color: ( %d %d %d )",
- style->base[i].red, style->base[i].green, style->base[i].blue);
-
- gc_values.foreground = style->fg[i];
- style->fg_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
-
- gc_values.foreground = style->bg[i];
- style->bg_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
-
- gc_values.foreground = style->light[i];
- style->light_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
-
- gc_values.foreground = style->dark[i];
- style->dark_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
-
- gc_values.foreground = style->mid[i];
- style->mid_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
-
- gc_values.foreground = style->text[i];
- style->text_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
-
- gc_values.foreground = style->base[i];
- style->base_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
- }
- }
-}
-
-static void
-gtk_styles_init ()
-{
- if (initialize)
- {
- initialize = FALSE;
-
- style_cache = g_cache_new ((GCacheNewFunc) gtk_style_new_from_key,
- (GCacheDestroyFunc) gtk_style_unref,
- (GCacheDupFunc) gtk_style_key_dup,
- (GCacheDestroyFunc) gtk_style_key_destroy,
- (GHashFunc) gtk_style_key_hash,
- (GHashFunc) gtk_style_value_hash,
- (GCompareFunc) gtk_style_key_compare);
- }
-}
-
-static void
-gtk_style_remove (GtkStyle *style)
-{
- if (initialize)
- gtk_styles_init ();
- g_cache_remove (style_cache, style);
-}
-
-static GtkStyle*
-gtk_style_find (GtkStyle *style,
- GdkColormap *cmap,
- gint depth)
-{
- GtkStyleKey key;
- gint i;
-
- if (initialize)
- gtk_styles_init ();
-
- for (i = 0; i < 5; i++)
- {
- key.fg[i] = style->fg[i];
- key.bg[i] = style->bg[i];
- key.text[i] = style->text[i];
- key.base[i] = style->base[i];
- key.bg_pixmap[i] = style->bg_pixmap[i];
- }
-
- key.font = style->font;
- key.klass = style->klass;
- key.depth = depth;
- key.colormap = cmap;
-
- style = g_cache_insert (style_cache, &key);
-
- return style;
-}
-
-static GtkStyle*
-gtk_style_new_from_key (GtkStyleKey *key)
-{
- GtkStyle *style;
- GSList *list;
- gint i;
-
- style = NULL;
- list = unattached_styles;
-
- while (list)
- {
- style = list->data;
- list = list->next;
-
- if ((style->depth != -1) && (style->depth != key->depth))
- {
- style = NULL;
- continue;
- }
- if (style->colormap && (style->colormap != key->colormap))
- {
- style = NULL;
- continue;
- }
- if (style->klass != key->klass)
- {
- style = NULL;
- continue;
- }
- if (!gdk_font_equal (style->font, key->font))
- {
- style = NULL;
- continue;
- }
-
- for (i = 0; style && (i < 5); i++)
- {
- if (style->bg_pixmap[i] != key->bg_pixmap[i])
- {
- style = NULL;
- continue;
- }
-
- if ((style->fg[i].red != key->fg[i].red) ||
- (style->fg[i].green != key->fg[i].green) ||
- (style->fg[i].blue != key->fg[i].blue))
- {
- style = NULL;
- continue;
- }
-
- if ((style->bg[i].red != key->bg[i].red) ||
- (style->bg[i].green != key->bg[i].green) ||
- (style->bg[i].blue != key->bg[i].blue))
- {
- style = NULL;
- continue;
- }
-
- if ((style->text[i].red != key->text[i].red) ||
- (style->text[i].green != key->text[i].green) ||
- (style->text[i].blue != key->text[i].blue))
- {
- style = NULL;
- continue;
- }
-
- if ((style->base[i].red != key->base[i].red) ||
- (style->base[i].green != key->base[i].green) ||
- (style->base[i].blue != key->base[i].blue))
- {
- style = NULL;
- continue;
- }
- }
-
- if (style)
- {
- gtk_style_ref (style);
- break;
- }
- }
-
- if (!style)
- {
- style = g_new0 (GtkStyle, 1);
-
- style->ref_count = 1;
- style->attach_count = 0;
-
- style->font = key->font;
- gdk_font_ref (style->font);
-
- style->depth = key->depth;
- style->colormap = key->colormap;
- style->klass = key->klass;
-
- style->black.red = 0;
- style->black.green = 0;
- style->black.blue = 0;
-
- style->white.red = 65535;
- style->white.green = 65535;
- style->white.blue = 65535;
-
- style->black_gc = NULL;
- style->white_gc = NULL;
-
- for (i = 0; i < 5; i++)
- {
- style->fg[i] = key->fg[i];
- style->bg[i] = key->bg[i];
- style->text[i] = key->text[i];
- style->base[i] = key->base[i];
- }
-
- for (i = 0; i < 5; i++)
- style->bg_pixmap[i] = key->bg_pixmap[i];
-
- for (i = 0; i < 5; i++)
- {
- style->fg_gc[i] = NULL;
- style->bg_gc[i] = NULL;
- style->light_gc[i] = NULL;
- style->dark_gc[i] = NULL;
- style->mid_gc[i] = NULL;
- style->text_gc[i] = NULL;
- style->base_gc[i] = NULL;
- }
- }
-
- if (style->depth == -1)
- style->depth = key->depth;
- if (!style->colormap)
- style->colormap = key->colormap;
-
- gtk_style_init (style);
-
- return style;
-}
-
-static GtkStyleKey*
-gtk_style_key_dup (GtkStyleKey *key)
-{
- GtkStyleKey *new_key;
-
- if (!key_mem_chunk)
- key_mem_chunk = g_mem_chunk_new ("key mem chunk", sizeof (GtkStyleKey),
- 1024, G_ALLOC_AND_FREE);
-
- new_key = g_chunk_new (GtkStyleKey, key_mem_chunk);
-
- *new_key = *key;
-
- return new_key;
-}
-
-static void
-gtk_style_destroy (GtkStyle *style)
-{
- gint i;
-
- if (style->attach_count > 0)
- {
- gtk_gc_release (style->black_gc);
- gtk_gc_release (style->white_gc);
-
- for (i = 0; i < 5; i++)
- {
- gtk_gc_release (style->fg_gc[i]);
- gtk_gc_release (style->bg_gc[i]);
- gtk_gc_release (style->light_gc[i]);
- gtk_gc_release (style->dark_gc[i]);
- gtk_gc_release (style->mid_gc[i]);
- gtk_gc_release (style->text_gc[i]);
- gtk_gc_release (style->base_gc[i]);
- }
- }
-
- unattached_styles = g_slist_remove (unattached_styles, style);
-
- gdk_font_unref (style->font);
- g_free (style);
-}
-
-static void
-gtk_style_key_destroy (GtkStyleKey *key)
-{
- g_mem_chunk_free (key_mem_chunk, key);
-}
-
-static guint
-gtk_style_key_hash (GtkStyleKey *key)
-{
- guint hash_val;
- gint i;
-
- hash_val = 0;
-
- for (i = 0; i < 5; i++)
- {
- hash_val += key->fg[i].red + key->fg[i].green + key->fg[i].blue;
- hash_val += key->bg[i].red + key->bg[i].green + key->bg[i].blue;
- hash_val += key->text[i].red + key->text[i].green + key->text[i].blue;
- hash_val += key->base[i].red + key->base[i].green + key->base[i].blue;
- }
-
- hash_val += (guint) gdk_font_id (key->font);
- hash_val += (guint) key->depth;
- hash_val += (gulong) key->colormap;
- hash_val += (gulong) key->klass;
-
- return hash_val;
-}
-
-static guint
-gtk_style_value_hash (GtkStyle *style)
-{
- guint hash_val;
- gint i;
-
- hash_val = 0;
-
- for (i = 0; i < 5; i++)
- {
- hash_val += style->fg[i].red + style->fg[i].green + style->fg[i].blue;
- hash_val += style->bg[i].red + style->bg[i].green + style->bg[i].blue;
- hash_val += style->text[i].red + style->text[i].green + style->text[i].blue;
- hash_val += style->base[i].red + style->base[i].green + style->base[i].blue;
- }
-
- hash_val += (guint) gdk_font_id (style->font);
- hash_val += (gulong) style->klass;
-
- return hash_val;
-}
-
-static gint
-gtk_style_key_compare (GtkStyleKey *a,
- GtkStyleKey *b)
-{
- gint i;
-
- if (a->depth != b->depth)
- return FALSE;
- if (a->colormap != b->colormap)
- return FALSE;
- if (a->klass != b->klass)
- return FALSE;
- if (!gdk_font_equal (a->font, b->font))
- return FALSE;
-
- for (i = 0; i < 5; i++)
- {
- if (a->bg_pixmap[i] != b->bg_pixmap[i])
- return FALSE;
-
- if ((a->fg[i].red != b->fg[i].red) ||
- (a->fg[i].green != b->fg[i].green) ||
- (a->fg[i].blue != b->fg[i].blue))
- return FALSE;
- if ((a->bg[i].red != b->bg[i].red) ||
- (a->bg[i].green != b->bg[i].green) ||
- (a->bg[i].blue != b->bg[i].blue))
- return FALSE;
- if ((a->text[i].red != b->text[i].red) ||
- (a->text[i].green != b->text[i].green) ||
- (a->text[i].blue != b->text[i].blue))
- return FALSE;
- if ((a->base[i].red != b->base[i].red) ||
- (a->base[i].green != b->base[i].green) ||
- (a->base[i].blue != b->base[i].blue))
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-static void
-gtk_default_draw_hline (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- gint x1,
- gint x2,
- gint y)
-{
- gint thickness_light;
- gint thickness_dark;
- gint i;
-
- g_return_if_fail (style != NULL);
- g_return_if_fail (window != NULL);
-
- thickness_light = style->klass->ythickness / 2;
- thickness_dark = style->klass->ythickness - thickness_light;
-
- for (i = 0; i < thickness_dark; i++)
- {
- gdk_draw_line (window, style->light_gc[state_type], x2 - i - 1, y + i, x2, y + i);
- gdk_draw_line (window, style->dark_gc[state_type], x1, y + i, x2 - i - 1, y + i);
- }
-
- y += thickness_dark;
- for (i = 0; i < thickness_light; i++)
- {
- gdk_draw_line (window, style->dark_gc[state_type], x1, y + i, x1 + thickness_light - i - 1, y + i);
- gdk_draw_line (window, style->light_gc[state_type], x1 + thickness_light - i - 1, y + i, x2, y + i);
- }
-}
-
-
-static void
-gtk_default_draw_vline (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- gint y1,
- gint y2,
- gint x)
-{
- gint thickness_light;
- gint thickness_dark;
- gint i;
-
- g_return_if_fail (style != NULL);
- g_return_if_fail (window != NULL);
-
- thickness_light = style->klass->xthickness / 2;
- thickness_dark = style->klass->xthickness - thickness_light;
-
- for (i = 0; i < thickness_dark; i++)
- {
- gdk_draw_line (window, style->light_gc[state_type], x + i, y2 - i - 1, x + i, y2);
- gdk_draw_line (window, style->dark_gc[state_type], x + i, y1, x + i, y2 - i - 1);
- }
-
- x += thickness_dark;
- for (i = 0; i < thickness_light; i++)
- {
- gdk_draw_line (window, style->dark_gc[state_type], x + i, y1, x + i, y1 + thickness_light - i);
- gdk_draw_line (window, style->light_gc[state_type], x + i, y1 + thickness_light - i, x + i, y2);
- }
-}
-
-
-static void
-gtk_default_draw_shadow (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- GdkGC *gc1;
- GdkGC *gc2;
- gint thickness_light;
- gint thickness_dark;
- gint i;
-
- g_return_if_fail (style != NULL);
- g_return_if_fail (window != NULL);
-
- if ((width == -1) && (height == -1))
- gdk_window_get_size (window, &width, &height);
- else if (width == -1)
- gdk_window_get_size (window, &width, NULL);
- else if (height == -1)
- gdk_window_get_size (window, NULL, &height);
-
- switch (shadow_type)
- {
- case GTK_SHADOW_NONE:
- gc1 = NULL;
- gc2 = NULL;
- break;
- case GTK_SHADOW_IN:
- case GTK_SHADOW_ETCHED_IN:
- gc1 = style->light_gc[state_type];
- gc2 = style->dark_gc[state_type];
- break;
- case GTK_SHADOW_OUT:
- case GTK_SHADOW_ETCHED_OUT:
- gc1 = style->dark_gc[state_type];
- gc2 = style->light_gc[state_type];
- break;
- }
-
- switch (shadow_type)
- {
- case GTK_SHADOW_NONE:
- break;
-
- case GTK_SHADOW_IN:
- gdk_draw_line (window, gc1,
- x, y + height - 1, x + width - 1, y + height - 1);
- gdk_draw_line (window, gc1,
- x + width - 1, y, x + width - 1, y + height - 1);
-
- gdk_draw_line (window, style->bg_gc[state_type],
- x + 1, y + height - 2, x + width - 2, y + height - 2);
- gdk_draw_line (window, style->bg_gc[state_type],
- x + width - 2, y + 1, x + width - 2, y + height - 2);
-
- gdk_draw_line (window, style->black_gc,
- x + 1, y + 1, x + width - 2, y + 1);
- gdk_draw_line (window, style->black_gc,
- x + 1, y + 1, x + 1, y + height - 2);
-
- gdk_draw_line (window, gc2,
- x, y, x + width - 1, y);
- gdk_draw_line (window, gc2,
- x, y, x, y + height - 1);
- break;
-
- case GTK_SHADOW_OUT:
- gdk_draw_line (window, gc1,
- x + 1, y + height - 2, x + width - 2, y + height - 2);
- gdk_draw_line (window, gc1,
- x + width - 2, y + 1, x + width - 2, y + height - 2);
-
- gdk_draw_line (window, gc2,
- x, y, x + width - 1, y);
- gdk_draw_line (window, gc2,
- x, y, x, y + height - 1);
-
- gdk_draw_line (window, style->bg_gc[state_type],
- x + 1, y + 1, x + width - 2, y + 1);
- gdk_draw_line (window, style->bg_gc[state_type],
- x + 1, y + 1, x + 1, y + height - 2);
-
- gdk_draw_line (window, style->black_gc,
- x, y + height - 1, x + width - 1, y + height - 1);
- gdk_draw_line (window, style->black_gc,
- x + width - 1, y, x + width - 1, y + height - 1);
- break;
-
- case GTK_SHADOW_ETCHED_IN:
- case GTK_SHADOW_ETCHED_OUT:
- thickness_light = 1;
- thickness_dark = 1;
-
- for (i = 0; i < thickness_dark; i++)
- {
- gdk_draw_line (window, gc1,
- x + i,
- y + height - i - 1,
- x + width - i - 1,
- y + height - i - 1);
- gdk_draw_line (window, gc1,
- x + width - i - 1,
- y + i,
- x + width - i - 1,
- y + height - i - 1);
-
- gdk_draw_line (window, gc2,
- x + i,
- y + i,
- x + width - i - 2,
- y + i);
- gdk_draw_line (window, gc2,
- x + i,
- y + i,
- x + i,
- y + height - i - 2);
- }
-
- for (i = 0; i < thickness_light; i++)
- {
- gdk_draw_line (window, gc1,
- x + thickness_dark + i,
- y + thickness_dark + i,
- x + width - thickness_dark - i - 1,
- y + thickness_dark + i);
- gdk_draw_line (window, gc1,
- x + thickness_dark + i,
- y + thickness_dark + i,
- x + thickness_dark + i,
- y + height - thickness_dark - i - 1);
-
- gdk_draw_line (window, gc2,
- x + thickness_dark + i,
- y + height - thickness_light - i - 1,
- x + width - thickness_light - 1,
- y + height - thickness_light - i - 1);
- gdk_draw_line (window, gc2,
- x + width - thickness_light - i - 1,
- y + thickness_dark + i,
- x + width - thickness_light - i - 1,
- y + height - thickness_light - 1);
- }
- break;
- }
-}
-
-
-static void
-gtk_default_draw_polygon (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GdkPoint *points,
- gint npoints,
- gint fill)
-{
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif /* M_PI */
-#ifndef M_PI_4
-#define M_PI_4 0.78539816339744830962
-#endif /* M_PI_4 */
-
- static const gdouble pi_over_4 = M_PI_4;
- static const gdouble pi_3_over_4 = M_PI_4 * 3;
-
- GdkGC *gc1;
- GdkGC *gc2;
- GdkGC *gc3;
- GdkGC *gc4;
- gdouble angle;
- gint xadjust;
- gint yadjust;
- gint i;
-
- g_return_if_fail (style != NULL);
- g_return_if_fail (window != NULL);
- g_return_if_fail (points != NULL);
-
- switch (shadow_type)
- {
- case GTK_SHADOW_IN:
- gc1 = style->bg_gc[state_type];
- gc2 = style->dark_gc[state_type];
- gc3 = style->light_gc[state_type];
- gc4 = style->black_gc;
- break;
- case GTK_SHADOW_OUT:
- gc1 = style->dark_gc[state_type];
- gc2 = style->light_gc[state_type];
- gc3 = style->black_gc;
- gc4 = style->bg_gc[state_type];
- break;
- default:
- return;
- }
-
- if (fill)
- gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, npoints);
-
- npoints--;
-
- for (i = 0; i < npoints; i++)
- {
- if ((points[i].x == points[i+1].x) &&
- (points[i].y == points[i+1].y))
- {
- angle = 0;
- }
- else
- {
- angle = atan2 (points[i+1].y - points[i].y,
- points[i+1].x - points[i].x);
- }
-
- if ((angle > -pi_3_over_4) && (angle < pi_over_4))
- {
- if (angle > -pi_over_4)
- {
- xadjust = 0;
- yadjust = 1;
- }
- else
- {
- xadjust = 1;
- yadjust = 0;
- }
-
- gdk_draw_line (window, gc1,
- points[i].x-xadjust, points[i].y-yadjust,
- points[i+1].x-xadjust, points[i+1].y-yadjust);
- gdk_draw_line (window, gc3,
- points[i].x, points[i].y,
- points[i+1].x, points[i+1].y);
- }
- else
- {
- if ((angle < -pi_3_over_4) || (angle > pi_3_over_4))
- {
- xadjust = 0;
- yadjust = 1;
- }
- else
- {
- xadjust = 1;
- yadjust = 0;
- }
-
- gdk_draw_line (window, gc4,
- points[i].x+xadjust, points[i].y+yadjust,
- points[i+1].x+xadjust, points[i+1].y+yadjust);
- gdk_draw_line (window, gc2,
- points[i].x, points[i].y,
- points[i+1].x, points[i+1].y);
- }
- }
-}
-
-
-static void
-gtk_default_draw_arrow (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkArrowType arrow_type,
- gint fill,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- GdkGC *gc1;
- GdkGC *gc2;
- GdkGC *gc3;
- GdkGC *gc4;
- gint half_width;
- gint half_height;
- GdkPoint points[3];
-
- g_return_if_fail (style != NULL);
- g_return_if_fail (window != NULL);
-
- switch (shadow_type)
- {
- case GTK_SHADOW_IN:
- gc1 = style->bg_gc[state_type];
- gc2 = style->dark_gc[state_type];
- gc3 = style->light_gc[state_type];
- gc4 = style->black_gc;
- break;
- case GTK_SHADOW_OUT:
- gc1 = style->dark_gc[state_type];
- gc2 = style->light_gc[state_type];
- gc3 = style->black_gc;
- gc4 = style->bg_gc[state_type];
- break;
- default:
- return;
- }
-
- if ((width == -1) && (height == -1))
- gdk_window_get_size (window, &width, &height);
- else if (width == -1)
- gdk_window_get_size (window, &width, NULL);
- else if (height == -1)
- gdk_window_get_size (window, NULL, &height);
-
- half_width = width / 2;
- half_height = height / 2;
-
- switch (arrow_type)
- {
- case GTK_ARROW_UP:
- if (fill)
- {
- points[0].x = x + half_width;
- points[0].y = y;
- points[1].x = x;
- points[1].y = y + height - 1;
- points[2].x = x + width - 1;
- points[2].y = y + height - 1;
-
- gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
- }
-
- gdk_draw_line (window, gc1,
- x + 1, y + height - 2,
- x + width - 2, y + height - 2);
- gdk_draw_line (window, gc3,
- x + 0, y + height - 1,
- x + width - 1, y + height - 1);
-
- gdk_draw_line (window, gc1,
- x + width - 2, y + height - 1,
- x + half_width, y + 1);
- gdk_draw_line (window, gc3,
- x + width - 1, y + height - 1,
- x + half_width, y);
-
- gdk_draw_line (window, gc4,
- x + half_width, y + 1,
- x + 1, y + height - 1);
- gdk_draw_line (window, gc2,
- x + half_width, y,
- x, y + height - 1);
- break;
- case GTK_ARROW_DOWN:
- if (fill)
- {
- points[0].x = x + width - 1;
- points[0].y = y;
- points[1].x = x;
- points[1].y = y;
- points[2].x = x + half_width;
- points[2].y = y + height - 1;
-
- gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
- }
-
- gdk_draw_line (window, gc4,
- x + width - 2,
- y + 1, x + 1, y + 1);
- gdk_draw_line (window, gc2,
- x + width - 1, y,
- x, y);
-
- gdk_draw_line (window, gc4,
- x + 1, y,
- x + half_width, y + height - 2);
- gdk_draw_line (window, gc2,
- x, y,
- x + half_width, y + height - 1);
-
- gdk_draw_line (window, gc1,
- x + half_width, y + height - 2,
- x + width - 2, y);
- gdk_draw_line (window, gc3,
- x + half_width, y + height - 1,
- x + width - 1, y);
- break;
- case GTK_ARROW_LEFT:
- if (fill)
- {
- points[0].x = x;
- points[0].y = y + half_height;
- points[1].x = x + width - 1;
- points[1].y = y + height - 1;
- points[2].x = x + width - 1;
- points[2].y = y;
-
- gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
- }
-
- gdk_draw_line (window, gc1,
- x + 1, y + half_height,
- x + width - 1, y + height - 1);
- gdk_draw_line (window, gc3,
- x, y + half_height,
- x + width - 1, y + height - 1);
-
- gdk_draw_line (window, gc1,
- x + width - 2, y + height - 1,
- x + width - 2, y + 1);
- gdk_draw_line (window, gc3,
- x + width - 1, y + height - 1,
- x + width - 1, y);
-
- gdk_draw_line (window, gc4,
- x + width - 1, y + 1,
- x + 1, y + half_width);
- gdk_draw_line (window, gc2,
- x + width - 1, y,
- x, y + half_width);
- break;
- case GTK_ARROW_RIGHT:
- if (fill)
- {
- points[0].x = x + width - 1;
- points[0].y = y + half_height;
- points[1].x = x;
- points[1].y = y;
- points[2].x = x;
- points[2].y = y + height - 1;
-
- gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
- }
-
- gdk_draw_line (window, gc4,
- x + width - 1, y + half_height,
- x + 1, y + 1);
- gdk_draw_line (window, gc2,
- x + width - 1, y + half_height,
- x, y);
-
- gdk_draw_line (window, gc4,
- x + 1, y + 1,
- x + 1, y + height - 2);
- gdk_draw_line (window, gc2,
- x, y,
- x, y + height - 1);
-
- gdk_draw_line (window, gc1,
- x + 1, y + height - 2,
- x + width - 1, y + half_height);
- gdk_draw_line (window, gc3,
- x, y + height - 1,
- x + width - 1, y + half_height);
- break;
- }
-}
-
-
-static void
-gtk_default_draw_diamond (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- gint half_width;
- gint half_height;
-
- g_return_if_fail (style != NULL);
- g_return_if_fail (window != NULL);
-
- if ((width == -1) && (height == -1))
- gdk_window_get_size (window, &width, &height);
- else if (width == -1)
- gdk_window_get_size (window, &width, NULL);
- else if (height == -1)
- gdk_window_get_size (window, NULL, &height);
-
- half_width = width / 2;
- half_height = height / 2;
-
- switch (shadow_type)
- {
- case GTK_SHADOW_IN:
- gdk_draw_line (window, style->bg_gc[state_type],
- x + 2, y + half_height,
- x + half_width, y + height - 2);
- gdk_draw_line (window, style->bg_gc[state_type],
- x + half_width, y + height - 2,
- x + width - 2, y + half_height);
- gdk_draw_line (window, style->light_gc[state_type],
- x + 1, y + half_height,
- x + half_width, y + height - 1);
- gdk_draw_line (window, style->light_gc[state_type],
- x + half_width, y + height - 1,
- x + width - 1, y + half_height);
- gdk_draw_line (window, style->light_gc[state_type],
- x, y + half_height,
- x + half_width, y + height);
- gdk_draw_line (window, style->light_gc[state_type],
- x + half_width, y + height,
- x + width, y + half_height);
-
- gdk_draw_line (window, style->black_gc,
- x + 2, y + half_height,
- x + half_width, y + 2);
- gdk_draw_line (window, style->black_gc,
- x + half_width, y + 2,
- x + width - 2, y + half_height);
- gdk_draw_line (window, style->dark_gc[state_type],
- x + 1, y + half_height,
- x + half_width, y + 1);
- gdk_draw_line (window, style->dark_gc[state_type],
- x + half_width, y + 1,
- x + width - 1, y + half_height);
- gdk_draw_line (window, style->dark_gc[state_type],
- x, y + half_height,
- x + half_width, y);
- gdk_draw_line (window, style->dark_gc[state_type],
- x + half_width, y,
- x + width, y + half_height);
- break;
- case GTK_SHADOW_OUT:
- gdk_draw_line (window, style->dark_gc[state_type],
- x + 2, y + half_height,
- x + half_width, y + height - 2);
- gdk_draw_line (window, style->dark_gc[state_type],
- x + half_width, y + height - 2,
- x + width - 2, y + half_height);
- gdk_draw_line (window, style->dark_gc[state_type],
- x + 1, y + half_height,
- x + half_width, y + height - 1);
- gdk_draw_line (window, style->dark_gc[state_type],
- x + half_width, y + height - 1,
- x + width - 1, y + half_height);
- gdk_draw_line (window, style->black_gc,
- x, y + half_height,
- x + half_width, y + height);
- gdk_draw_line (window, style->black_gc,
- x + half_width, y + height,
- x + width, y + half_height);
-
- gdk_draw_line (window, style->bg_gc[state_type],
- x + 2, y + half_height,
- x + half_width, y + 2);
- gdk_draw_line (window, style->bg_gc[state_type],
- x + half_width, y + 2,
- x + width - 2, y + half_height);
- gdk_draw_line (window, style->light_gc[state_type],
- x + 1, y + half_height,
- x + half_width, y + 1);
- gdk_draw_line (window, style->light_gc[state_type],
- x + half_width, y + 1,
- x + width - 1, y + half_height);
- gdk_draw_line (window, style->light_gc[state_type],
- x, y + half_height,
- x + half_width, y);
- gdk_draw_line (window, style->light_gc[state_type],
- x + half_width, y,
- x + width, y + half_height);
- break;
- default:
- break;
- }
-}
-
-
-static void
-gtk_default_draw_oval (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- g_return_if_fail (style != NULL);
- g_return_if_fail (window != NULL);
-}
-
-static void
-gtk_default_draw_string (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- gint x,
- gint y,
- const gchar *string)
-{
- g_return_if_fail (style != NULL);
- g_return_if_fail (window != NULL);
-
- if (state_type == GTK_STATE_INSENSITIVE)
- gdk_draw_string (window, style->font, style->white_gc, x + 1, y + 1, string);
- gdk_draw_string (window, style->font, style->fg_gc[state_type], x, y, string);
-}
-
-
-static void
-gtk_style_shade (GdkColor *a,
- GdkColor *b,
- gdouble k)
-{
- gdouble red;
- gdouble green;
- gdouble blue;
-
- red = (gdouble) a->red / 65535.0;
- green = (gdouble) a->green / 65535.0;
- blue = (gdouble) a->blue / 65535.0;
-
- rgb_to_hls (&red, &green, &blue);
-
- green *= k;
- if (green > 1.0)
- green = 1.0;
- else if (green < 0.0)
- green = 0.0;
-
- blue *= k;
- if (blue > 1.0)
- blue = 1.0;
- else if (blue < 0.0)
- blue = 0.0;
-
- hls_to_rgb (&red, &green, &blue);
-
- b->red = red * 65535.0;
- b->green = green * 65535.0;
- b->blue = blue * 65535.0;
-}
-
-static void
-rgb_to_hls (gdouble *r,
- gdouble *g,
- gdouble *b)
-{
- gdouble min;
- gdouble max;
- gdouble red;
- gdouble green;
- gdouble blue;
- gdouble h, l, s;
- gdouble delta;
-
- red = *r;
- green = *g;
- blue = *b;
-
- if (red > green)
- {
- if (red > blue)
- max = red;
- else
- max = blue;
-
- if (green < blue)
- min = green;
- else
- min = blue;
- }
- else
- {
- if (green > blue)
- max = green;
- else
- max = blue;
-
- if (red < blue)
- min = red;
- else
- min = blue;
- }
-
- l = (max + min) / 2;
- s = 0;
- h = 0;
-
- if (max != min)
- {
- if (l <= 0.5)
- s = (max - min) / (max + min);
- else
- s = (max - min) / (2 - max - min);
-
- delta = max -min;
- if (red == max)
- h = (green - blue) / delta;
- else if (green == max)
- h = 2 + (blue - red) / delta;
- else if (blue == max)
- h = 4 + (red - green) / delta;
-
- h *= 60;
- if (h < 0.0)
- h += 360;
- }
-
- *r = h;
- *g = l;
- *b = s;
-}
-
-static void
-hls_to_rgb (gdouble *h,
- gdouble *l,
- gdouble *s)
-{
- gdouble hue;
- gdouble lightness;
- gdouble saturation;
- gdouble m1, m2;
- gdouble r, g, b;
-
- lightness = *l;
- saturation = *s;
-
- if (lightness <= 0.5)
- m2 = lightness * (1 + saturation);
- else
- m2 = lightness + saturation - lightness * saturation;
- m1 = 2 * lightness - m2;
-
- if (saturation == 0)
- {
- *h = lightness;
- *l = lightness;
- *s = lightness;
- }
- else
- {
- hue = *h + 120;
- while (hue > 360)
- hue -= 360;
- while (hue < 0)
- hue += 360;
-
- if (hue < 60)
- r = m1 + (m2 - m1) * hue / 60;
- else if (hue < 180)
- r = m2;
- else if (hue < 240)
- r = m1 + (m2 - m1) * (240 - hue) / 60;
- else
- r = m1;
-
- hue = *h;
- while (hue > 360)
- hue -= 360;
- while (hue < 0)
- hue += 360;
-
- if (hue < 60)
- g = m1 + (m2 - m1) * hue / 60;
- else if (hue < 180)
- g = m2;
- else if (hue < 240)
- g = m1 + (m2 - m1) * (240 - hue) / 60;
- else
- g = m1;
-
- hue = *h - 120;
- while (hue > 360)
- hue -= 360;
- while (hue < 0)
- hue += 360;
-
- if (hue < 60)
- b = m1 + (m2 - m1) * hue / 60;
- else if (hue < 180)
- b = m2;
- else if (hue < 240)
- b = m1 + (m2 - m1) * (240 - hue) / 60;
- else
- b = m1;
-
- *h = r;
- *l = g;
- *s = b;
- }
-}
diff --git a/gtk/gtkstyle.h b/gtk/gtkstyle.h
deleted file mode 100644
index 26cd1931b0..0000000000
--- a/gtk/gtkstyle.h
+++ /dev/null
@@ -1,220 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_STYLE_H__
-#define __GTK_STYLE_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkenums.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-typedef struct _GtkStyle GtkStyle;
-typedef struct _GtkStyleClass GtkStyleClass;
-
-/* This is used for having dynamic style changing stuff */
-/* fg, bg, light, dark, mid, text, base */
-#define GTK_STYLE_NUM_STYLECOLORS() 7*5
-
-#define GTK_STYLE_ATTACHED(style) (((GtkStyle*)(style))->attach_count > 0)
-
-struct _GtkStyle
-{
- GdkColor fg[5];
- GdkColor bg[5];
- GdkColor light[5];
- GdkColor dark[5];
- GdkColor mid[5];
- GdkColor text[5];
- GdkColor base[5];
-
- GdkColor black;
- GdkColor white;
- GdkFont *font;
-
- GdkGC *fg_gc[5];
- GdkGC *bg_gc[5];
- GdkGC *light_gc[5];
- GdkGC *dark_gc[5];
- GdkGC *mid_gc[5];
- GdkGC *text_gc[5];
- GdkGC *base_gc[5];
- GdkGC *black_gc;
- GdkGC *white_gc;
-
- GdkPixmap *bg_pixmap[5];
-
- gint ref_count;
- gint attach_count;
-
- gint depth;
- GdkColormap *colormap;
-
- GtkStyleClass *klass;
-};
-
-struct _GtkStyleClass
-{
- gint xthickness;
- gint ythickness;
-
- void (*draw_hline) (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- gint x1,
- gint x2,
- gint y);
- void (*draw_vline) (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- gint y1,
- gint y2,
- gint x);
- void (*draw_shadow) (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- gint x,
- gint y,
- gint width,
- gint height);
- void (*draw_polygon) (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GdkPoint *point,
- gint npoints,
- gint fill);
- void (*draw_arrow) (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkArrowType arrow_type,
- gint fill,
- gint x,
- gint y,
- gint width,
- gint height);
- void (*draw_diamond) (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- gint x,
- gint y,
- gint width,
- gint height);
- void (*draw_oval) (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- gint x,
- gint y,
- gint width,
- gint height);
- void (*draw_string) (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- gint x,
- gint y,
- const gchar *string);
-};
-
-
-GtkStyle* gtk_style_new (void);
-GtkStyle* gtk_style_copy (GtkStyle *style);
-GtkStyle* gtk_style_attach (GtkStyle *style,
- GdkWindow *window);
-void gtk_style_detach (GtkStyle *style);
-GtkStyle* gtk_style_ref (GtkStyle *style);
-void gtk_style_unref (GtkStyle *style);
-void gtk_style_set_background (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type);
-
-
-void gtk_draw_hline (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- gint x1,
- gint x2,
- gint y);
-void gtk_draw_vline (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- gint y1,
- gint y2,
- gint x);
-void gtk_draw_shadow (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- gint x,
- gint y,
- gint width,
- gint height);
-void gtk_draw_polygon (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GdkPoint *points,
- gint npoints,
- gint fill);
-void gtk_draw_arrow (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- GtkArrowType arrow_type,
- gint fill,
- gint x,
- gint y,
- gint width,
- gint height);
-void gtk_draw_diamond (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- gint x,
- gint y,
- gint width,
- gint height);
-void gtk_draw_oval (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- gint x,
- gint y,
- gint width,
- gint height);
-void gtk_draw_string (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- gint x,
- gint y,
- const gchar *string);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_STYLE_H__ */
diff --git a/gtk/gtktable.c b/gtk/gtktable.c
deleted file mode 100644
index 0f5959f749..0000000000
--- a/gtk/gtktable.c
+++ /dev/null
@@ -1,1178 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtktable.h"
-
-
-static void gtk_table_class_init (GtkTableClass *klass);
-static void gtk_table_init (GtkTable *table);
-static void gtk_table_finalize (GtkObject *object);
-static void gtk_table_map (GtkWidget *widget);
-static void gtk_table_unmap (GtkWidget *widget);
-static void gtk_table_draw (GtkWidget *widget,
- GdkRectangle *area);
-static gint gtk_table_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static void gtk_table_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_table_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_table_add (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_table_remove (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_table_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data);
-
-static void gtk_table_size_request_init (GtkTable *table);
-static void gtk_table_size_request_pass1 (GtkTable *table);
-static void gtk_table_size_request_pass2 (GtkTable *table);
-static void gtk_table_size_request_pass3 (GtkTable *table);
-
-static void gtk_table_size_allocate_init (GtkTable *table);
-static void gtk_table_size_allocate_pass1 (GtkTable *table);
-static void gtk_table_size_allocate_pass2 (GtkTable *table);
-
-
-static GtkContainerClass *parent_class = NULL;
-
-
-guint
-gtk_table_get_type ()
-{
- static guint table_type = 0;
-
- if (!table_type)
- {
- GtkTypeInfo table_info =
- {
- "GtkTable",
- sizeof (GtkTable),
- sizeof (GtkTableClass),
- (GtkClassInitFunc) gtk_table_class_init,
- (GtkObjectInitFunc) gtk_table_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- table_type = gtk_type_unique (gtk_container_get_type (), &table_info);
- }
-
- return table_type;
-}
-
-static void
-gtk_table_class_init (GtkTableClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GtkObjectClass*) class;
- widget_class = (GtkWidgetClass*) class;
- container_class = (GtkContainerClass*) class;
-
- parent_class = gtk_type_class (gtk_container_get_type ());
-
- object_class->finalize = gtk_table_finalize;
-
- widget_class->map = gtk_table_map;
- widget_class->unmap = gtk_table_unmap;
- widget_class->draw = gtk_table_draw;
- widget_class->expose_event = gtk_table_expose;
- widget_class->size_request = gtk_table_size_request;
- widget_class->size_allocate = gtk_table_size_allocate;
-
- container_class->add = gtk_table_add;
- container_class->remove = gtk_table_remove;
- container_class->foreach = gtk_table_foreach;
-}
-
-static void
-gtk_table_init (GtkTable *table)
-{
- GTK_WIDGET_SET_FLAGS (table, GTK_NO_WINDOW | GTK_BASIC);
-
- table->children = NULL;
- table->rows = NULL;
- table->cols = NULL;
- table->nrows = 0;
- table->ncols = 0;
- table->homogeneous = FALSE;
-}
-
-static void
-gtk_table_init_rows (GtkTable *table, int start, int end)
-{
- const int spacing = table->row_spacing;
- int row;
-
- for (row = start; row < end; row++)
- {
- table->rows[row].requisition = 0;
- table->rows[row].allocation = 0;
- table->rows[row].spacing = spacing;
- table->rows[row].need_expand = 0;
- table->rows[row].need_shrink = 0;
- table->rows[row].expand = 0;
- table->rows[row].shrink = 0;
- }
-}
-
-static void
-gtk_table_init_cols (GtkTable *table, int start, int end)
-{
- const int spacing = table->column_spacing;
- int col;
-
- for (col = start; col < end; col++)
- {
- table->cols[col].requisition = 0;
- table->cols[col].allocation = 0;
- table->cols[col].spacing = spacing;
- table->cols[col].need_expand = 0;
- table->cols[col].need_shrink = 0;
- table->cols[col].expand = 0;
- table->cols[col].shrink = 0;
- }
-}
-
-GtkWidget*
-gtk_table_new (gint rows,
- gint columns,
- gint homogeneous)
-{
- GtkTable *table;
-
- table = gtk_type_new (gtk_table_get_type ());
-
- table->nrows = rows;
- table->ncols = columns;
- table->homogeneous = (homogeneous ? TRUE : FALSE);
- table->column_spacing = 0;
- table->row_spacing = 0;
-
- table->rows = g_new (GtkTableRowCol, table->nrows);
- table->cols = g_new (GtkTableRowCol, table->ncols);
-
- gtk_table_init_rows (table, 0, table->nrows);
- gtk_table_init_cols (table, 0, table->ncols);
-
- return GTK_WIDGET (table);
-}
-
-static void
-gtk_table_expand_cols (GtkTable *table, int new_max)
-{
- table->cols = g_realloc (table->cols, new_max * sizeof (GtkTableRowCol));
- gtk_table_init_cols (table, table->ncols, new_max);
- table->ncols = new_max;
-}
-
-static void
-gtk_table_expand_rows (GtkTable *table, int new_max)
-{
- table->rows = g_realloc (table->rows, new_max * sizeof (GtkTableRowCol));
- gtk_table_init_rows (table, table->nrows, new_max);
- table->nrows = new_max;
-}
-
-void
-gtk_table_attach (GtkTable *table,
- GtkWidget *child,
- gint left_attach,
- gint right_attach,
- gint top_attach,
- gint bottom_attach,
- gint xoptions,
- gint yoptions,
- gint xpadding,
- gint ypadding)
-{
- GtkTableChild *table_child;
-
- g_return_if_fail (table != NULL);
- g_return_if_fail (GTK_IS_TABLE (table));
- g_return_if_fail (child != NULL);
-
- g_return_if_fail (left_attach >= 0);
- g_return_if_fail (left_attach < right_attach);
- g_return_if_fail (top_attach >= 0);
- g_return_if_fail (top_attach < bottom_attach);
-
- if (right_attach >= table->ncols)
- gtk_table_expand_cols (table, right_attach);
-
- if (bottom_attach >= table->nrows)
- gtk_table_expand_rows (table, bottom_attach);
-
- table_child = g_new (GtkTableChild, 1);
- table_child->widget = child;
- table_child->left_attach = left_attach;
- table_child->right_attach = right_attach;
- table_child->top_attach = top_attach;
- table_child->bottom_attach = bottom_attach;
- table_child->xexpand = (xoptions & GTK_EXPAND) != 0;
- table_child->xshrink = (xoptions & GTK_SHRINK) != 0;
- table_child->xfill = (xoptions & GTK_FILL) != 0;
- table_child->xpadding = xpadding;
- table_child->yexpand = (yoptions & GTK_EXPAND) != 0;
- table_child->yshrink = (yoptions & GTK_SHRINK) != 0;
- table_child->yfill = (yoptions & GTK_FILL) != 0;
- table_child->ypadding = ypadding;
-
- table->children = g_list_prepend (table->children, table_child);
-
- gtk_widget_set_parent (child, GTK_WIDGET (table));
-
- if (GTK_WIDGET_VISIBLE (GTK_WIDGET (table)))
- {
- if (GTK_WIDGET_REALIZED (GTK_WIDGET (table)) &&
- !GTK_WIDGET_REALIZED (child))
- gtk_widget_realize (child);
-
- if (GTK_WIDGET_MAPPED (GTK_WIDGET (table)) &&
- !GTK_WIDGET_MAPPED (child))
- gtk_widget_map (child);
- }
-
- if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (table))
- gtk_widget_queue_resize (child);
-}
-
-void
-gtk_table_attach_defaults (GtkTable *table,
- GtkWidget *widget,
- gint left_attach,
- gint right_attach,
- gint top_attach,
- gint bottom_attach)
-{
- gtk_table_attach (table, widget,
- left_attach, right_attach,
- top_attach, bottom_attach,
- GTK_EXPAND | GTK_FILL,
- GTK_EXPAND | GTK_FILL,
- 0, 0);
-}
-
-void
-gtk_table_set_row_spacing (GtkTable *table,
- gint row,
- gint spacing)
-{
- g_return_if_fail (table != NULL);
- g_return_if_fail (GTK_IS_TABLE (table));
- g_return_if_fail ((row >= 0) && (row < (table->nrows - 1)));
-
- if (table->rows[row].spacing != spacing)
- {
- table->rows[row].spacing = spacing;
-
- if (GTK_WIDGET_VISIBLE (table))
- gtk_widget_queue_resize (GTK_WIDGET (table));
- }
-}
-
-void
-gtk_table_set_col_spacing (GtkTable *table,
- gint column,
- gint spacing)
-{
- g_return_if_fail (table != NULL);
- g_return_if_fail (GTK_IS_TABLE (table));
- g_return_if_fail ((column >= 0) && (column < (table->ncols - 1)));
-
- if (table->cols[column].spacing != spacing)
- {
- table->cols[column].spacing = spacing;
-
- if (GTK_WIDGET_VISIBLE (table))
- gtk_widget_queue_resize (GTK_WIDGET (table));
- }
-}
-
-void
-gtk_table_set_row_spacings (GtkTable *table,
- gint spacing)
-{
- gint row;
-
- g_return_if_fail (table != NULL);
- g_return_if_fail (GTK_IS_TABLE (table));
-
- table->row_spacing = spacing;
- for (row = 0; row < table->nrows - 1; row++)
- table->rows[row].spacing = spacing;
-
- if (GTK_WIDGET_VISIBLE (table))
- gtk_widget_queue_resize (GTK_WIDGET (table));
-}
-
-void
-gtk_table_set_col_spacings (GtkTable *table,
- gint spacing)
-{
- gint col;
-
- g_return_if_fail (table != NULL);
- g_return_if_fail (GTK_IS_TABLE (table));
-
- table->column_spacing = spacing;
- for (col = 0; col < table->ncols - 1; col++)
- table->cols[col].spacing = spacing;
-
- if (GTK_WIDGET_VISIBLE (table))
- gtk_widget_queue_resize (GTK_WIDGET (table));
-}
-
-
-static void
-gtk_table_finalize (GtkObject *object)
-{
- GtkTable *table;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_TABLE (object));
-
- table = GTK_TABLE (object);
-
- g_free (table->rows);
- g_free (table->cols);
-
- (* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-static void
-gtk_table_map (GtkWidget *widget)
-{
- GtkTable *table;
- GtkTableChild *child;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TABLE (widget));
-
- table = GTK_TABLE (widget);
- GTK_WIDGET_SET_FLAGS (table, GTK_MAPPED);
-
- children = table->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child->widget) &&
- !GTK_WIDGET_MAPPED (child->widget))
- gtk_widget_map (child->widget);
- }
-}
-
-static void
-gtk_table_unmap (GtkWidget *widget)
-{
- GtkTable *table;
- GtkTableChild *child;
- GList *children;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TABLE (widget));
-
- table = GTK_TABLE (widget);
- GTK_WIDGET_UNSET_FLAGS (table, GTK_MAPPED);
-
- children = table->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child->widget) &&
- GTK_WIDGET_MAPPED (child->widget))
- gtk_widget_unmap (child->widget);
- }
-}
-
-static void
-gtk_table_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkTable *table;
- GtkTableChild *child;
- GList *children;
- GdkRectangle child_area;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TABLE (widget));
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget))
- {
- table = GTK_TABLE (widget);
-
- children = table->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (gtk_widget_intersect (child->widget, area, &child_area))
- gtk_widget_draw (child->widget, &child_area);
- }
- }
-}
-
-static gint
-gtk_table_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkTable *table;
- GtkTableChild *child;
- GList *children;
- GdkEventExpose child_event;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_TABLE (widget), FALSE);
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget))
- {
- table = GTK_TABLE (widget);
-
- child_event = *event;
-
- children = table->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_NO_WINDOW (child->widget) &&
- gtk_widget_intersect (child->widget, &event->area, &child_event.area))
- gtk_widget_event (child->widget, (GdkEvent*) &child_event);
- }
- }
-
- return FALSE;
-}
-
-static void
-gtk_table_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkTable *table;
- gint row, col;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TABLE (widget));
- g_return_if_fail (requisition != NULL);
-
- table = GTK_TABLE (widget);
-
- requisition->width = 0;
- requisition->height = 0;
-
- gtk_table_size_request_init (table);
- gtk_table_size_request_pass1 (table);
- gtk_table_size_request_pass2 (table);
- gtk_table_size_request_pass3 (table);
- gtk_table_size_request_pass2 (table);
-
- for (col = 0; col < table->ncols; col++)
- requisition->width += table->cols[col].requisition;
- for (col = 0; col < table->ncols - 1; col++)
- requisition->width += table->cols[col].spacing;
-
- for (row = 0; row < table->nrows; row++)
- requisition->height += table->rows[row].requisition;
- for (row = 0; row < table->nrows - 1; row++)
- requisition->height += table->rows[row].spacing;
-
- requisition->width += GTK_CONTAINER (table)->border_width * 2;
- requisition->height += GTK_CONTAINER (table)->border_width * 2;
-}
-
-static void
-gtk_table_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkTable *table;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TABLE (widget));
- g_return_if_fail (allocation != NULL);
-
- widget->allocation = *allocation;
- table = GTK_TABLE (widget);
-
- gtk_table_size_allocate_init (table);
- gtk_table_size_allocate_pass1 (table);
- gtk_table_size_allocate_pass2 (table);
-}
-
-static void
-gtk_table_add (GtkContainer *container,
- GtkWidget *widget)
-{
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_TABLE (container));
- g_return_if_fail (widget != NULL);
-
- gtk_table_attach_defaults (GTK_TABLE (container), widget, 0, 1, 0, 1);
-}
-
-static void
-gtk_table_remove (GtkContainer *container,
- GtkWidget *widget)
-{
- GtkTable *table;
- GtkTableChild *child;
- GList *children;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_TABLE (container));
- g_return_if_fail (widget != NULL);
-
- table = GTK_TABLE (container);
- children = table->children;
-
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (child->widget == widget)
- {
- gtk_widget_unparent (widget);
-
- table->children = g_list_remove (table->children, child);
- g_free (child);
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (container))
- gtk_widget_queue_resize (GTK_WIDGET (container));
- break;
- }
- }
-}
-
-static void
-gtk_table_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
-{
- GtkTable *table;
- GtkTableChild *child;
- GList *children;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_TABLE (container));
- g_return_if_fail (callback != NULL);
-
- table = GTK_TABLE (container);
- children = table->children;
-
- while (children)
- {
- child = children->data;
- children = children->next;
-
- (* callback) (child->widget, callback_data);
- }
-}
-
-static void
-gtk_table_size_request_init (GtkTable *table)
-{
- GtkTableChild *child;
- GList *children;
- gint row, col;
-
- for (row = 0; row < table->nrows; row++)
- table->rows[row].requisition = 0;
- for (col = 0; col < table->ncols; col++)
- table->cols[col].requisition = 0;
-
- children = table->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child->widget))
- gtk_widget_size_request (child->widget, &child->widget->requisition);
- }
-}
-
-static void
-gtk_table_size_request_pass1 (GtkTable *table)
-{
- GtkTableChild *child;
- GList *children;
- gint width;
- gint height;
-
- children = table->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child->widget))
- {
- /* Child spans a single column.
- */
- if (child->left_attach == (child->right_attach - 1))
- {
- width = child->widget->requisition.width + child->xpadding * 2;
- table->cols[child->left_attach].requisition = MAX (table->cols[child->left_attach].requisition, width);
- }
-
- /* Child spans a single row.
- */
- if (child->top_attach == (child->bottom_attach - 1))
- {
- height = child->widget->requisition.height + child->ypadding * 2;
- table->rows[child->top_attach].requisition = MAX (table->rows[child->top_attach].requisition, height);
- }
- }
- }
-}
-
-static void
-gtk_table_size_request_pass2 (GtkTable *table)
-{
- gint max_width;
- gint max_height;
- gint row, col;
-
- if (table->homogeneous)
- {
- max_width = 0;
- max_height = 0;
-
- for (col = 0; col < table->ncols; col++)
- max_width = MAX (max_width, table->cols[col].requisition);
- for (row = 0; row < table->nrows; row++)
- max_height = MAX (max_height, table->rows[row].requisition);
-
- for (col = 0; col < table->ncols; col++)
- table->cols[col].requisition = max_width;
- for (row = 0; row < table->nrows; row++)
- table->rows[row].requisition = max_height;
- }
-}
-
-static void
-gtk_table_size_request_pass3 (GtkTable *table)
-{
- GtkTableChild *child;
- GList *children;
- gint width, height;
- gint row, col;
- gint extra;
-
- children = table->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child->widget))
- {
- /* Child spans multiple columns.
- */
- if (child->left_attach != (child->right_attach - 1))
- {
- /* Check and see if there is already enough space
- * for the child.
- */
- width = 0;
- for (col = child->left_attach; col < child->right_attach; col++)
- {
- width += table->cols[col].requisition;
- if ((col + 1) < child->right_attach)
- width += table->cols[col].spacing;
- }
-
- /* If we need to request more space for this child to fill
- * its requisition, then divide up the needed space evenly
- * amongst the columns it spans.
- */
- if (width < child->widget->requisition.width)
- {
- width = child->widget->requisition.width - width;
-
- for (col = child->left_attach; col < child->right_attach; col++)
- {
- extra = width / (child->right_attach - col);
- table->cols[col].requisition += extra;
- width -= extra;
- }
- }
- }
-
- /* Child spans multiple rows.
- */
- if (child->top_attach != (child->bottom_attach - 1))
- {
- /* Check and see if there is already enough space
- * for the child.
- */
- height = 0;
- for (row = child->top_attach; row < child->bottom_attach; row++)
- {
- height += table->rows[row].requisition;
- if ((row + 1) < child->bottom_attach)
- height += table->rows[row].spacing;
- }
-
- /* If we need to request more space for this child to fill
- * its requisition, then divide up the needed space evenly
- * amongst the columns it spans.
- */
- if (height < child->widget->requisition.height)
- {
- height = child->widget->requisition.height - height;
-
- for (row = child->top_attach; row < child->bottom_attach; row++)
- {
- extra = height / (child->bottom_attach - row);
- table->rows[row].requisition += extra;
- height -= extra;
- }
- }
- }
- }
- }
-}
-
-static void
-gtk_table_size_allocate_init (GtkTable *table)
-{
- GtkTableChild *child;
- GList *children;
- gint row, col;
- gint has_expand;
- gint has_shrink;
-
- /* Initialize the rows and cols.
- * By default, rows and cols do not expand and do shrink.
- * Those values are modified by the children that occupy
- * the rows and cols.
- */
- for (col = 0; col < table->ncols; col++)
- {
- table->cols[col].allocation = table->cols[col].requisition;
- table->cols[col].need_expand = FALSE;
- table->cols[col].need_shrink = TRUE;
- table->cols[col].expand = FALSE;
- table->cols[col].shrink = TRUE;
- }
- for (row = 0; row < table->nrows; row++)
- {
- table->rows[row].allocation = table->rows[row].requisition;
- table->rows[row].need_expand = FALSE;
- table->rows[row].need_shrink = TRUE;
- table->rows[row].expand = FALSE;
- table->rows[row].shrink = TRUE;
- }
-
- /* Loop over all the children and adjust the row and col values
- * based on whether the children want to be allowed to expand
- * or shrink. This loop handles children that occupy a single
- * row or column.
- */
- children = table->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child->widget))
- {
- if (child->left_attach == (child->right_attach - 1))
- {
- if (child->xexpand)
- table->cols[child->left_attach].expand = TRUE;
-
- if (!child->xshrink)
- table->cols[child->left_attach].shrink = FALSE;
- }
-
- if (child->top_attach == (child->bottom_attach - 1))
- {
- if (child->yexpand)
- table->rows[child->top_attach].expand = TRUE;
-
- if (!child->yshrink)
- table->rows[child->top_attach].shrink = FALSE;
- }
- }
- }
-
- /* Loop over all the children again and this time handle children
- * which span multiple rows or columns.
- */
- children = table->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child->widget))
- {
- if (child->left_attach != (child->right_attach - 1))
- {
- if (child->xexpand)
- {
- has_expand = FALSE;
- for (col = child->left_attach; col < child->right_attach; col++)
- if (table->cols[col].expand)
- {
- has_expand = TRUE;
- break;
- }
-
- if (!has_expand)
- for (col = child->left_attach; col < child->right_attach; col++)
- table->cols[col].need_expand = TRUE;
- }
-
- if (!child->xshrink)
- {
- has_shrink = TRUE;
- for (col = child->left_attach; col < child->right_attach; col++)
- if (!table->cols[col].shrink)
- {
- has_shrink = FALSE;
- break;
- }
-
- if (has_shrink)
- for (col = child->left_attach; col < child->right_attach; col++)
- table->cols[col].need_shrink = FALSE;
- }
- }
-
- if (child->top_attach != (child->bottom_attach - 1))
- {
- if (child->yexpand)
- {
- has_expand = FALSE;
- for (row = child->top_attach; row < child->bottom_attach; row++)
- if (table->rows[row].expand)
- {
- has_expand = TRUE;
- break;
- }
-
- if (!has_expand)
- for (row = child->top_attach; row < child->bottom_attach; row++)
- table->rows[row].need_expand = TRUE;
- }
-
- if (!child->yshrink)
- {
- has_shrink = TRUE;
- for (row = child->top_attach; row < child->bottom_attach; row++)
- if (!table->rows[row].shrink)
- {
- has_shrink = FALSE;
- break;
- }
-
- if (has_shrink)
- for (row = child->top_attach; row < child->bottom_attach; row++)
- table->rows[row].need_shrink = FALSE;
- }
- }
- }
- }
-
- /* Loop over the columns and set the expand and shrink values
- * if the column can be expanded or shrunk.
- */
- for (col = 0; col < table->ncols; col++)
- {
- if (table->cols[col].need_expand)
- table->cols[col].expand = TRUE;
- if (!table->cols[col].need_shrink)
- table->cols[col].shrink = FALSE;
- }
-
- /* Loop over the rows and set the expand and shrink values
- * if the row can be expanded or shrunk.
- */
- for (row = 0; row < table->nrows; row++)
- {
- if (table->rows[row].need_expand)
- table->rows[row].expand = TRUE;
- if (!table->rows[row].need_shrink)
- table->rows[row].shrink = FALSE;
- }
-}
-
-static void
-gtk_table_size_allocate_pass1 (GtkTable *table)
-{
- gint real_width;
- gint real_height;
- gint width, height;
- gint row, col;
- gint nexpand;
- gint nshrink;
- gint extra;
-
- /* If we were allocated more space than we requested
- * then we have to expand any expandable rows and columns
- * to fill in the extra space.
- */
-
- real_width = GTK_WIDGET (table)->allocation.width - GTK_CONTAINER (table)->border_width * 2;
- real_height = GTK_WIDGET (table)->allocation.height - GTK_CONTAINER (table)->border_width * 2;
-
- if (table->homogeneous)
- {
- nexpand = 0;
- for (col = 0; col < table->ncols; col++)
- if (table->cols[col].expand)
- {
- nexpand += 1;
- break;
- }
-
- if (nexpand > 0)
- {
- width = real_width;
-
- for (col = 0; col < table->ncols - 1; col++)
- width -= table->cols[col].spacing;
-
- for (col = 0; col < table->ncols; col++)
- {
- extra = width / (table->ncols - col);
- table->cols[col].allocation = extra;
- width -= extra;
- }
- }
- }
- else
- {
- width = 0;
- nexpand = 0;
- nshrink = 0;
-
- for (col = 0; col < table->ncols; col++)
- {
- width += table->cols[col].requisition;
- if (table->cols[col].expand)
- nexpand += 1;
- if (table->cols[col].shrink)
- nshrink += 1;
- }
- for (col = 0; col < table->ncols - 1; col++)
- width += table->cols[col].spacing;
-
- /* Check to see if we were allocated more width than we requested.
- */
- if ((width < real_width) && (nexpand >= 1))
- {
- width = real_width - width;
-
- for (col = 0; col < table->ncols; col++)
- if (table->cols[col].expand)
- {
- extra = width / nexpand;
- table->cols[col].allocation += extra;
-
- width -= extra;
- nexpand -= 1;
- }
- }
-
- /* Check to see if we were allocated less width than we requested.
- */
- if ((width > real_width) && (nshrink >= 1))
- {
- width = width - real_width;
-
- for (col = 0; col < table->ncols; col++)
- if (table->cols[col].shrink)
- {
- extra = width / nshrink;
- table->cols[col].allocation -= extra;
-
- width -= extra;
- nshrink -= 1;
- }
- }
- }
-
- if (table->homogeneous)
- {
- nexpand = 0;
- for (row = 0; row < table->nrows; row++)
- if (table->rows[row].expand)
- {
- nexpand += 1;
- break;
- }
-
- if (nexpand > 0)
- {
- height = real_height;
-
- for (row = 0; row < table->nrows - 1; row++)
- height -= table->rows[row].spacing;
-
-
- for (row = 0; row < table->nrows; row++)
- {
- extra = height / (table->nrows - row);
- table->rows[row].allocation = extra;
- height -= extra;
- }
- }
- }
- else
- {
- height = 0;
- nexpand = 0;
- nshrink = 0;
-
- for (row = 0; row < table->nrows; row++)
- {
- height += table->rows[row].requisition;
- if (table->rows[row].expand)
- nexpand += 1;
- if (table->rows[row].shrink)
- nshrink += 1;
- }
- for (row = 0; row < table->nrows - 1; row++)
- height += table->rows[row].spacing;
-
- /* Check to see if we were allocated more height than we requested.
- */
- if ((height < real_height) && (nexpand >= 1))
- {
- height = real_height - height;
-
- for (row = 0; row < table->nrows; row++)
- if (table->rows[row].expand)
- {
- extra = height / nexpand;
- table->rows[row].allocation += extra;
-
- height -= extra;
- nexpand -= 1;
- }
- }
-
- /* Check to see if we were allocated less height than we requested.
- */
- if ((height > real_height) && (nshrink >= 1))
- {
- height = height - real_height;
-
- for (row = 0; row < table->nrows; row++)
- if (table->rows[row].shrink)
- {
- extra = height / nshrink;
- table->rows[row].allocation -= extra;
-
- height -= extra;
- nshrink -= 1;
- }
- }
- }
-}
-
-static void
-gtk_table_size_allocate_pass2 (GtkTable *table)
-{
- GtkTableChild *child;
- GList *children;
- gint max_width;
- gint max_height;
- gint x, y;
- gint row, col;
- GtkAllocation allocation;
-
- children = table->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child->widget))
- {
- x = GTK_WIDGET (table)->allocation.x + GTK_CONTAINER (table)->border_width;
- y = GTK_WIDGET (table)->allocation.y + GTK_CONTAINER (table)->border_width;
- max_width = 0;
- max_height = 0;
-
- for (col = 0; col < child->left_attach; col++)
- {
- x += table->cols[col].allocation;
- x += table->cols[col].spacing;
- }
-
- for (col = child->left_attach; col < child->right_attach; col++)
- {
- max_width += table->cols[col].allocation;
- if ((col + 1) < child->right_attach)
- max_width += table->cols[col].spacing;
- }
-
- for (row = 0; row < child->top_attach; row++)
- {
- y += table->rows[row].allocation;
- y += table->rows[row].spacing;
- }
-
- for (row = child->top_attach; row < child->bottom_attach; row++)
- {
- max_height += table->rows[row].allocation;
- if ((row + 1) < child->bottom_attach)
- max_height += table->rows[row].spacing;
- }
-
- if (child->xfill)
- {
- allocation.width = max_width - child->xpadding * 2;
- allocation.x = x + (max_width - allocation.width) / 2;
- }
- else
- {
- allocation.width = child->widget->requisition.width;
- allocation.x = x + (max_width - allocation.width) / 2;
- }
-
- if (child->yfill)
- {
- allocation.height = max_height - child->ypadding * 2;
- allocation.y = y + (max_height - allocation.height) / 2;
- }
- else
- {
- allocation.height = child->widget->requisition.height;
- allocation.y = y + (max_height - allocation.height) / 2;
- }
-
- gtk_widget_size_allocate (child->widget, &allocation);
- }
- }
-}
diff --git a/gtk/gtktable.h b/gtk/gtktable.h
deleted file mode 100644
index afd2cd2bdc..0000000000
--- a/gtk/gtktable.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_TABLE_H__
-#define __GTK_TABLE_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkcontainer.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_TABLE(obj) GTK_CHECK_CAST (obj, gtk_table_get_type (), GtkTable)
-#define GTK_TABLE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_table_get_type (), GtkTableClass)
-#define GTK_IS_TABLE(obj) GTK_CHECK_TYPE (obj, gtk_table_get_type ())
-
-
-typedef struct _GtkTable GtkTable;
-typedef struct _GtkTableClass GtkTableClass;
-typedef struct _GtkTableChild GtkTableChild;
-typedef struct _GtkTableRowCol GtkTableRowCol;
-
-struct _GtkTable
-{
- GtkContainer container;
-
- GList *children;
- GtkTableRowCol *rows;
- GtkTableRowCol *cols;
- guint16 nrows;
- guint16 ncols;
- guint16 column_spacing;
- guint16 row_spacing;
- guint homogeneous : 1;
-};
-
-struct _GtkTableClass
-{
- GtkContainerClass parent_class;
-};
-
-struct _GtkTableChild
-{
- GtkWidget *widget;
- guint16 left_attach;
- guint16 right_attach;
- guint16 top_attach;
- guint16 bottom_attach;
- guint16 xpadding;
- guint16 ypadding;
- guint xexpand : 1;
- guint yexpand : 1;
- guint xshrink : 1;
- guint yshrink : 1;
- guint xfill : 1;
- guint yfill : 1;
-};
-
-struct _GtkTableRowCol
-{
- guint16 requisition;
- guint16 allocation;
- guint16 spacing;
- guint need_expand : 1;
- guint need_shrink : 1;
- guint expand : 1;
- guint shrink : 1;
-};
-
-
-guint gtk_table_get_type (void);
-GtkWidget* gtk_table_new (gint rows,
- gint columns,
- gint homogeneous);
-
-void gtk_table_attach (GtkTable *table,
- GtkWidget *child,
- gint left_attach,
- gint right_attach,
- gint top_attach,
- gint bottom_attach,
- gint xoptions,
- gint yoptions,
- gint xpadding,
- gint ypadding);
-void gtk_table_attach_defaults (GtkTable *table,
- GtkWidget *widget,
- gint left_attach,
- gint right_attach,
- gint top_attach,
- gint bottom_attach);
-void gtk_table_set_row_spacing (GtkTable *table,
- gint row,
- gint spacing);
-void gtk_table_set_col_spacing (GtkTable *table,
- gint column,
- gint spacing);
-void gtk_table_set_row_spacings (GtkTable *table,
- gint spacing);
-void gtk_table_set_col_spacings (GtkTable *table,
- gint spacing);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_TABLE_H__ */
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index c1f3c830e3..ba709e40bb 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -294,8 +294,10 @@ static void gtk_text_delete_forward_word (GtkText *text);
static void gtk_text_delete_backward_word (GtkText *text);
static void gtk_text_delete_line (GtkText *text);
static void gtk_text_delete_to_line_end (GtkText *text);
-static void gtk_text_select_word (GtkText *text);
-static void gtk_text_select_line (GtkText *text);
+static void gtk_text_select_word (GtkText *text,
+ guint32 time);
+static void gtk_text_select_line (GtkText *text,
+ guint32 time);
/* #define DEBUG_GTK_TEXT */
@@ -781,7 +783,7 @@ gtk_text_forward_delete (GtkText *text,
if (text->point.index < text->first_line_start_index)
{
- if (text->point.index >= text->first_line_start_index - nchars)
+ if (text->point.index + nchars >= text->first_line_start_index)
{
text->first_line_start_index = text->point.index;
while ((text->first_line_start_index > 0) &&
@@ -794,13 +796,15 @@ gtk_text_forward_delete (GtkText *text,
}
if (text->point.index < editable->selection_start_pos)
- editable->selection_start_pos -= nchars;
+ editable->selection_start_pos -=
+ MIN(nchars, editable->selection_start_pos - text->point.index);
if (text->point.index < editable->selection_end_pos)
- editable->selection_end_pos -= nchars;
+ editable->selection_end_pos -=
+ MIN(nchars, editable->selection_end_pos - text->point.index);
/* We'll reset the cursor later anyways if we aren't frozen */
if (text->point.index < text->cursor_mark.index)
- text->cursor_mark.index -= nchars;
-
+ text->cursor_mark.index -=
+ MIN(nchars, text->cursor_mark.index - text->point.index);
move_gap_to_point (text);
@@ -828,14 +832,14 @@ gtk_text_get_chars (GtkEditable *editable,
gchar *p;
guint n, nchars;
- if (end_pos < 0)
- end_pos = TEXT_LENGTH (text);
-
g_return_val_if_fail (editable != NULL, NULL);
g_return_val_if_fail (GTK_IS_TEXT (editable), NULL);
text = GTK_TEXT (editable);
- if (end_pos > TEXT_LENGTH (text))
+ if (end_pos < 0)
+ end_pos = TEXT_LENGTH (text);
+
+ if ((end_pos > TEXT_LENGTH (text)) || (end_pos < start_pos))
return NULL;
nchars = end_pos - start_pos;
@@ -1344,7 +1348,7 @@ gtk_text_button_press (GtkWidget *widget,
text = GTK_TEXT (widget);
editable = GTK_EDITABLE (widget);
- if (text->button)
+ if (text->button && (event->type == GDK_BUTTON_PRESS))
{
GdkEventButton release_event = *event;
@@ -1380,11 +1384,11 @@ gtk_text_button_press (GtkWidget *widget,
break;
case GDK_2BUTTON_PRESS:
- gtk_text_select_word (text);
+ gtk_text_select_word (text, event->time);
break;
case GDK_3BUTTON_PRESS:
- gtk_text_select_line (text);
+ gtk_text_select_line (text, event->time);
break;
default:
@@ -1585,7 +1589,8 @@ gtk_text_delete_text (GtkEditable *editable,
if (end_pos < 0)
end_pos = TEXT_LENGTH (text);
- gtk_text_forward_delete (text, end_pos - start_pos);
+ if (end_pos > start_pos)
+ gtk_text_forward_delete (text, end_pos - start_pos);
}
static gint
@@ -2033,10 +2038,14 @@ static void
fetch_lines_backward (GtkText* text)
{
GList* new_lines = NULL, *new_line_start;
+ GtkPropertyMark mark;
+
+ if (CACHE_DATA(text->line_start_cache).start.index == 0)
+ return;
- GtkPropertyMark mark = find_this_line_start_mark (text,
- CACHE_DATA(text->line_start_cache).start.index - 1,
- &CACHE_DATA(text->line_start_cache).start);
+ mark = find_this_line_start_mark (text,
+ CACHE_DATA(text->line_start_cache).start.index - 1,
+ &CACHE_DATA(text->line_start_cache).start);
new_line_start = new_lines = fetch_lines (text, &mark, NULL, FetchLinesCount, 1);
@@ -2092,7 +2101,7 @@ compute_lines_pixels (GtkText* text, guint char_count,
if (line == text->current_line)
chars_left -= CACHE_DATA(line).end.index - text->point.index + 1;
else
- chars_left -= CACHE_DATA(line).end.index -CACHE_DATA(line).start.index + 1;
+ chars_left -= CACHE_DATA(line).end.index - CACHE_DATA(line).start.index + 1;
if (!text->line_wrap || !CACHE_DATA(line).wraps)
*lines += 1;
@@ -2591,7 +2600,7 @@ insert_text_property (GtkText* text, GdkFont* font,
forward_prop->length += len;
}
else if ((MARK_NEXT_LIST_PTR(mark) == NULL) &&
- (MARK_OFFSET(mark) == forward_prop->length - 1))
+ (MARK_OFFSET(mark) + 1 == forward_prop->length))
{
/* Inserting before only the last position in the text */
@@ -3306,6 +3315,8 @@ gtk_text_move_previous_line (GtkText *text)
static void
gtk_text_move_forward_word (GtkText *text)
{
+ text->cursor_virtual_x = 0;
+
undraw_cursor (text, FALSE);
while (!LAST_INDEX (text, text->cursor_mark) &&
@@ -3323,6 +3334,8 @@ gtk_text_move_forward_word (GtkText *text)
static void
gtk_text_move_backward_word (GtkText *text)
{
+ text->cursor_virtual_x = 0;
+
undraw_cursor (text, FALSE);
while ((text->cursor_mark.index > 0) &&
@@ -3340,6 +3353,8 @@ gtk_text_move_backward_word (GtkText *text)
static void
gtk_text_move_beginning_of_line (GtkText *text)
{
+ text->cursor_virtual_x = 0;
+
undraw_cursor (text, FALSE);
while ((text->cursor_mark.index > 0) &&
@@ -3353,6 +3368,8 @@ gtk_text_move_beginning_of_line (GtkText *text)
static void
gtk_text_move_end_of_line (GtkText *text)
{
+ text->cursor_virtual_x = 0;
+
undraw_cursor (text, FALSE);
while (!LAST_INDEX (text, text->cursor_mark) &&
@@ -3473,7 +3490,7 @@ gtk_text_delete_to_line_end (GtkText *text)
}
static void
-gtk_text_select_word (GtkText *text)
+gtk_text_select_word (GtkText *text, guint32 time)
{
gint start_pos;
gint end_pos;
@@ -3487,11 +3504,13 @@ gtk_text_select_word (GtkText *text)
gtk_text_move_forward_word (text);
end_pos = text->cursor_mark.index;
+ editable->has_selection = TRUE;
gtk_text_set_selection (editable, start_pos, end_pos);
+ gtk_editable_claim_selection (editable, start_pos != end_pos, time);
}
static void
-gtk_text_select_line (GtkText *text)
+gtk_text_select_line (GtkText *text, guint32 time)
{
gint start_pos;
gint end_pos;
@@ -3506,7 +3525,9 @@ gtk_text_select_line (GtkText *text)
gtk_text_move_forward_character (text);
end_pos = text->cursor_mark.index;
+ editable->has_selection = TRUE;
gtk_text_set_selection (editable, start_pos, end_pos);
+ gtk_editable_claim_selection (editable, start_pos != end_pos, time);
}
/**********************************************************************/
@@ -4453,10 +4474,13 @@ gtk_text_update_text (GtkEditable *editable,
GdkRectangle area;
gint width;
gint height;
-
+
if (end_pos < 0)
end_pos = TEXT_LENGTH (text);
+ if (end_pos < start_pos)
+ return;
+
gdk_window_get_size (text->text_area, &width, &height);
area.x = 0;
area.y = -1;
diff --git a/gtk/gtktext.h b/gtk/gtktext.h
deleted file mode 100644
index 82aa25e7ab..0000000000
--- a/gtk/gtktext.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_TEXT_H__
-#define __GTK_TEXT_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkadjustment.h>
-#include <gtk/gtkeditable.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_TEXT(obj) GTK_CHECK_CAST (obj, gtk_text_get_type (), GtkText)
-#define GTK_TEXT_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_text_get_type (), GtkTextClass)
-#define GTK_IS_TEXT(obj) GTK_CHECK_TYPE (obj, gtk_text_get_type ())
-
-
-typedef struct _GtkPropertyMark GtkPropertyMark;
-typedef struct _GtkText GtkText;
-typedef struct _GtkTextClass GtkTextClass;
-
-struct _GtkPropertyMark
-{
- /* Position in list. */
- GList* property;
-
- /* Offset into that property. */
- guint offset;
-
- /* Current index. */
- guint index;
-};
-
-struct _GtkText
-{
- GtkEditable editable;
-
- GdkWindow *text_area;
-
- GtkAdjustment *hadj;
- GtkAdjustment *vadj;
-
- GdkGC *gc;
-
- GdkPixmap* line_wrap_bitmap;
- GdkPixmap* line_arrow_bitmap;
-
- /* GAPPED TEXT SEGMENT */
-
- /* The text, a single segment of text a'la emacs, with a gap
- * where insertion occurs. */
- guchar* text;
- /* The allocated length of the text segment. */
- guint text_len;
- /* The gap position, index into address where a char
- * should be inserted. */
- guint gap_position;
- /* The gap size, s.t. *(text + gap_position + gap_size) is
- * the first valid character following the gap. */
- guint gap_size;
- /* The last character position, index into address where a
- * character should be appeneded. Thus, text_end - gap_size
- * is the length of the actual data. */
- guint text_end;
- /* LINE START CACHE */
-
- /* A cache of line-start information. Data is a LineParam*. */
- GList *line_start_cache;
- /* Index to the start of the first visible line. */
- guint first_line_start_index;
- /* The number of pixels cut off of the top line. */
- guint first_cut_pixels;
- /* First visible horizontal pixel. */
- guint first_onscreen_hor_pixel;
- /* First visible vertical pixel. */
- guint first_onscreen_ver_pixel;
-
- /* FLAGS */
-
- /* True iff the cursor has been placed yet. */
- guint has_cursor : 1;
- /* True iff this buffer is wrapping lines, otherwise it is using a
- * horizontal scrollbar. */
- guint line_wrap : 1;
- /* Frozen, don't do updates. @@@ fixme */
- guint freeze : 1;
-
- /* TEXT PROPERTIES */
-
- /* A doubly-linked-list containing TextProperty objects. */
- GList *text_properties;
- /* The end of this list. */
- GList *text_properties_end;
- /* The first node before or on the point along with its offset to
- * the point and the buffer's current point. This is the only
- * PropertyMark whose index is guaranteed to remain correct
- * following a buffer insertion or deletion. */
- GtkPropertyMark point;
-
- /* SCRATCH AREA */
-
- guchar* scratch_buffer;
- guint scratch_buffer_len;
-
- /* SCROLLING */
-
- gint last_ver_value;
-
- /* CURSOR */
-
- gint cursor_pos_x; /* Position of cursor. */
- gint cursor_pos_y; /* Baseline of line cursor is drawn on. */
- GtkPropertyMark cursor_mark; /* Where it is in the buffer. */
- gchar cursor_char; /* Character to redraw. */
- gchar cursor_char_offset; /* Distance from baseline of the font. */
- gint cursor_virtual_x; /* Where it would be if it could be. */
- gint cursor_drawn_level; /* How many people have undrawn. */
-
- /* Current Line */
-
- GList *current_line;
-
- /* Tab Stops */
-
- GList *tab_stops;
- gint default_tab_width;
-
- /* Timer used for auto-scrolling off ends */
- gint timer;
-
- guint button; /* currently pressed mouse button */
-};
-
-struct _GtkTextClass
-{
- GtkEditableClass parent_class;
-};
-
-
-guint gtk_text_get_type (void);
-GtkWidget* gtk_text_new (GtkAdjustment *hadj,
- GtkAdjustment *vadj);
-void gtk_text_set_editable (GtkText *text,
- gint editable);
-void gtk_text_set_adjustments (GtkText *text,
- GtkAdjustment *hadj,
- GtkAdjustment *vadj);
-void gtk_text_set_point (GtkText *text,
- guint index);
-guint gtk_text_get_point (GtkText *text);
-guint gtk_text_get_length (GtkText *text);
-void gtk_text_freeze (GtkText *text);
-void gtk_text_thaw (GtkText *text);
-void gtk_text_insert (GtkText *text,
- GdkFont *font,
- GdkColor *fore,
- GdkColor *back,
- const char *chars,
- gint length);
-gint gtk_text_backward_delete (GtkText *text,
- guint nchars);
-gint gtk_text_forward_delete (GtkText *text,
- guint nchars);
-
-#define GTK_TEXT_INDEX(t, index) \
- ((index) < (t)->gap_position ? (t)->text[index] : \
- (t)->text[(index) + (t)->gap_size])
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_TEXT_H__ */
diff --git a/gtk/gtktipsquery.c b/gtk/gtktipsquery.c
deleted file mode 100644
index 657432af6f..0000000000
--- a/gtk/gtktipsquery.c
+++ /dev/null
@@ -1,543 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * GtkQueryTips: Query onscreen widgets for their tooltips
- * Copyright (C) 1998 Tim Janik
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id$
- */
-#include "gtktipsquery.h"
-#include "gtksignal.h"
-#include "gtktooltips.h"
-#include "gtkmain.h"
-
-
-
-/* --- arguments --- */
-enum {
- ARG_0,
- ARG_EMIT_ALWAYS,
- ARG_CALLER,
- ARG_LABEL_INACTIVE,
- ARG_LABEL_NO_TIP
-};
-
-
-/* --- signals --- */
-enum
-{
- SIGNAL_START_QUERY,
- SIGNAL_STOP_QUERY,
- SIGNAL_WIDGET_ENTERED,
- SIGNAL_WIDGET_SELECTED,
- SIGNAL_LAST
-};
-typedef void (*SignalWidgetEntered) (GtkObject *object,
- GtkWidget *widget,
- const gchar *tip_text,
- const gchar *tip_private,
- gpointer func_data);
-typedef gint (*SignalWidgetSelected) (GtkObject *object,
- GtkWidget *widget,
- const gchar *tip_text,
- const gchar *tip_private,
- GdkEventButton *event,
- gpointer func_data);
-
-
-/* --- prototypes --- */
-static void gtk_tips_query_class_init (GtkTipsQueryClass *class);
-static void gtk_tips_query_init (GtkTipsQuery *tips_query);
-static void gtk_tips_query_destroy (GtkObject *object);
-static gint gtk_tips_query_event (GtkWidget *widget,
- GdkEvent *event);
-static void gtk_tips_query_set_arg (GtkTipsQuery *tips_query,
- GtkArg *arg,
- guint arg_id);
-static void gtk_tips_query_get_arg (GtkTipsQuery *tips_query,
- GtkArg *arg,
- guint arg_id);
-static void gtk_tips_query_real_start_query (GtkTipsQuery *tips_query);
-static void gtk_tips_query_real_stop_query (GtkTipsQuery *tips_query);
-static void gtk_tips_query_widget_entered (GtkTipsQuery *tips_query,
- GtkWidget *widget,
- const gchar *tip_text,
- const gchar *tip_private);
-
-
-/* --- variables --- */
-static GtkLabelClass *parent_class = NULL;
-static guint tips_query_signals[SIGNAL_LAST] = { 0 };
-
-
-/* --- functions --- */
-guint
-gtk_tips_query_get_type (void)
-{
- static guint tips_query_type = 0;
-
- if (!tips_query_type)
- {
- GtkTypeInfo tips_query_info =
- {
- "GtkTipsQuery",
- sizeof (GtkTipsQuery),
- sizeof (GtkTipsQueryClass),
- (GtkClassInitFunc) gtk_tips_query_class_init,
- (GtkObjectInitFunc) gtk_tips_query_init,
- (GtkArgSetFunc) gtk_tips_query_set_arg,
- (GtkArgGetFunc) gtk_tips_query_get_arg,
- };
-
- tips_query_type = gtk_type_unique (gtk_label_get_type (), &tips_query_info);
- }
-
- return tips_query_type;
-}
-
-static void
-gtk_tips_query_marshal_widget_entered (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- SignalWidgetEntered sfunc = (SignalWidgetEntered) func;
-
- (* sfunc) (object,
- (GtkWidget*) GTK_VALUE_OBJECT (args[0]),
- GTK_VALUE_STRING (args[1]),
- GTK_VALUE_STRING (args[2]),
- func_data);
-}
-
-static void
-gtk_tips_query_marshal_widget_selected (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- gint *return_val;
-
- SignalWidgetSelected sfunc = (SignalWidgetSelected) func;
- return_val = GTK_RETLOC_BOOL (args[4]);
-
- *return_val = (* sfunc) (object,
- (GtkWidget*) GTK_VALUE_OBJECT (args[0]),
- GTK_VALUE_STRING (args[1]),
- GTK_VALUE_STRING (args[2]),
- GTK_VALUE_BOXED (args[3]),
- func_data);
-}
-
-static void
-gtk_tips_query_class_init (GtkTipsQueryClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- object_class = (GtkObjectClass*) class;
- widget_class = (GtkWidgetClass*) class;
-
- parent_class = gtk_type_class (gtk_label_get_type ());
-
- gtk_object_add_arg_type ("GtkTipsQuery::emit_always", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EMIT_ALWAYS);
- gtk_object_add_arg_type ("GtkTipsQuery::caller", GTK_TYPE_WIDGET, GTK_ARG_READWRITE, ARG_CALLER);
- gtk_object_add_arg_type ("GtkTipsQuery::label_inactive", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_LABEL_INACTIVE);
- gtk_object_add_arg_type ("GtkTipsQuery::label_no_tip", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_LABEL_NO_TIP);
-
- tips_query_signals[SIGNAL_START_QUERY] =
- gtk_signal_new ("start_query",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkTipsQueryClass, start_query),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
- tips_query_signals[SIGNAL_STOP_QUERY] =
- gtk_signal_new ("stop_query",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkTipsQueryClass, stop_query),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
- tips_query_signals[SIGNAL_WIDGET_ENTERED] =
- gtk_signal_new ("widget_entered",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkTipsQueryClass, widget_entered),
- gtk_tips_query_marshal_widget_entered,
- GTK_TYPE_NONE, 3,
- GTK_TYPE_WIDGET,
- GTK_TYPE_STRING,
- GTK_TYPE_STRING);
- tips_query_signals[SIGNAL_WIDGET_SELECTED] =
- gtk_signal_new ("widget_selected",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkTipsQueryClass, widget_selected),
- gtk_tips_query_marshal_widget_selected,
- GTK_TYPE_INT, 4,
- GTK_TYPE_WIDGET,
- GTK_TYPE_STRING,
- GTK_TYPE_STRING,
- GTK_TYPE_BOXED);
- gtk_object_class_add_signals (object_class, tips_query_signals, SIGNAL_LAST);
-
- object_class->destroy = gtk_tips_query_destroy;
- widget_class->event = gtk_tips_query_event;
-
- class->start_query = gtk_tips_query_real_start_query;
- class->stop_query = gtk_tips_query_real_stop_query;
- class->widget_entered = gtk_tips_query_widget_entered;
- class->widget_selected = NULL;
-}
-
-static void
-gtk_tips_query_init (GtkTipsQuery *tips_query)
-{
- tips_query->emit_always = FALSE;
- tips_query->in_query = FALSE;
- tips_query->label_inactive = g_strdup ("");
- tips_query->label_no_tip = g_strdup ("--- No Tip ---");
- tips_query->caller = NULL;
- tips_query->last_crossed = NULL;
- tips_query->query_cursor = NULL;
-
- gtk_label_set (GTK_LABEL (tips_query), tips_query->label_inactive);
-}
-
-static void
-gtk_tips_query_set_arg (GtkTipsQuery *tips_query,
- GtkArg *arg,
- guint arg_id)
-{
- switch (arg_id)
- {
- case ARG_EMIT_ALWAYS:
- tips_query->emit_always = (GTK_VALUE_BOOL (*arg) != FALSE);
- break;
- case ARG_CALLER:
- gtk_tips_query_set_caller (tips_query, GTK_WIDGET (GTK_VALUE_OBJECT (*arg)));
- break;
- case ARG_LABEL_INACTIVE:
- gtk_tips_query_set_labels (tips_query, GTK_VALUE_STRING (*arg), tips_query->label_no_tip);
- break;
- case ARG_LABEL_NO_TIP:
- gtk_tips_query_set_labels (tips_query, tips_query->label_inactive, GTK_VALUE_STRING (*arg));
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-gtk_tips_query_get_arg (GtkTipsQuery *tips_query,
- GtkArg *arg,
- guint arg_id)
-{
- switch (arg_id)
- {
- case ARG_EMIT_ALWAYS:
- GTK_VALUE_BOOL (*arg) = tips_query->emit_always;
- break;
- case ARG_CALLER:
- GTK_VALUE_OBJECT (*arg) = (GtkObject*) tips_query->caller;
- break;
- case ARG_LABEL_INACTIVE:
- GTK_VALUE_STRING (*arg) = g_strdup (tips_query->label_inactive);
- break;
- case ARG_LABEL_NO_TIP:
- GTK_VALUE_STRING (*arg) = g_strdup (tips_query->label_no_tip);
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-gtk_tips_query_destroy (GtkObject *object)
-{
- GtkTipsQuery *tips_query;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_TIPS_QUERY (object));
-
- tips_query = GTK_TIPS_QUERY (object);
-
- if (tips_query->in_query)
- gtk_tips_query_stop_query (tips_query);
-
- gtk_tips_query_set_caller (tips_query, NULL);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-GtkWidget*
-gtk_tips_query_new (void)
-{
- GtkTipsQuery *tips_query;
-
- tips_query = gtk_type_new (gtk_tips_query_get_type ());
-
- return GTK_WIDGET (tips_query);
-}
-
-void
-gtk_tips_query_set_labels (GtkTipsQuery *tips_query,
- const gchar *label_inactive,
- const gchar *label_no_tip)
-{
- gchar *old;
-
- g_return_if_fail (tips_query != NULL);
- g_return_if_fail (GTK_IS_TIPS_QUERY (tips_query));
- g_return_if_fail (label_inactive != NULL);
- g_return_if_fail (label_no_tip != NULL);
-
- old = tips_query->label_inactive;
- tips_query->label_inactive = g_strdup (label_inactive);
- g_free (old);
- old = tips_query->label_no_tip;
- tips_query->label_no_tip = g_strdup (label_no_tip);
- g_free (old);
-}
-
-void
-gtk_tips_query_set_caller (GtkTipsQuery *tips_query,
- GtkWidget *caller)
-{
- g_return_if_fail (tips_query != NULL);
- g_return_if_fail (GTK_IS_TIPS_QUERY (tips_query));
- g_return_if_fail (tips_query->in_query == FALSE);
- if (caller)
- g_return_if_fail (GTK_IS_WIDGET (caller));
-
- if (caller)
- gtk_widget_ref (caller);
-
- if (tips_query->caller)
- gtk_widget_unref (tips_query->caller);
-
- tips_query->caller = caller;
-}
-
-void
-gtk_tips_query_start_query (GtkTipsQuery *tips_query)
-{
- g_return_if_fail (tips_query != NULL);
- g_return_if_fail (GTK_IS_TIPS_QUERY (tips_query));
- g_return_if_fail (tips_query->in_query == FALSE);
- g_return_if_fail (GTK_WIDGET_REALIZED (tips_query));
-
- tips_query->in_query = TRUE;
- gtk_signal_emit (GTK_OBJECT (tips_query), tips_query_signals[SIGNAL_START_QUERY]);
-}
-
-void
-gtk_tips_query_stop_query (GtkTipsQuery *tips_query)
-{
- g_return_if_fail (tips_query != NULL);
- g_return_if_fail (GTK_IS_TIPS_QUERY (tips_query));
- g_return_if_fail (tips_query->in_query == TRUE);
-
- gtk_signal_emit (GTK_OBJECT (tips_query), tips_query_signals[SIGNAL_STOP_QUERY]);
- tips_query->in_query = FALSE;
-}
-
-static void
-gtk_tips_query_real_start_query (GtkTipsQuery *tips_query)
-{
- gint failure;
-
- g_return_if_fail (tips_query != NULL);
- g_return_if_fail (GTK_IS_TIPS_QUERY (tips_query));
-
- tips_query->query_cursor = gdk_cursor_new (GDK_QUESTION_ARROW);
- failure = gdk_pointer_grab (GTK_WIDGET (tips_query)->window,
- TRUE,
- GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
- GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK,
- NULL,
- tips_query->query_cursor,
- GDK_CURRENT_TIME);
- if (failure)
- {
- gdk_cursor_destroy (tips_query->query_cursor);
- tips_query->query_cursor = NULL;
- }
- gtk_grab_add (GTK_WIDGET (tips_query));
-}
-
-static void
-gtk_tips_query_real_stop_query (GtkTipsQuery *tips_query)
-{
- g_return_if_fail (tips_query != NULL);
- g_return_if_fail (GTK_IS_TIPS_QUERY (tips_query));
-
- gtk_grab_remove (GTK_WIDGET (tips_query));
- if (tips_query->query_cursor)
- {
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
- gdk_cursor_destroy (tips_query->query_cursor);
- tips_query->query_cursor = NULL;
- }
- if (tips_query->last_crossed)
- {
- gtk_widget_unref (tips_query->last_crossed);
- tips_query->last_crossed = NULL;
- }
-
- gtk_label_set (GTK_LABEL (tips_query), tips_query->label_inactive);
-}
-
-static void
-gtk_tips_query_widget_entered (GtkTipsQuery *tips_query,
- GtkWidget *widget,
- const gchar *tip_text,
- const gchar *tip_private)
-{
- g_return_if_fail (tips_query != NULL);
- g_return_if_fail (GTK_IS_TIPS_QUERY (tips_query));
-
- if (!tip_text)
- tip_text = tips_query->label_no_tip;
-
- if (!g_str_equal (GTK_LABEL (tips_query)->label, (gchar*) tip_text))
- gtk_label_set (GTK_LABEL (tips_query), tip_text);
-}
-
-static void
-gtk_tips_query_emit_widget_entered (GtkTipsQuery *tips_query,
- GtkWidget *widget)
-{
- GtkTooltipsData *tdata;
-
- if (widget == (GtkWidget*) tips_query)
- widget = NULL;
-
- if (widget)
- tdata = gtk_tooltips_data_get (widget);
- else
- tdata = NULL;
-
- if (!widget && tips_query->last_crossed)
- {
- gtk_signal_emit (GTK_OBJECT (tips_query),
- tips_query_signals[SIGNAL_WIDGET_ENTERED],
- NULL,
- NULL,
- NULL);
- gtk_widget_unref (tips_query->last_crossed);
- tips_query->last_crossed = NULL;
- }
- else if (widget && widget != tips_query->last_crossed)
- {
- gtk_widget_ref (widget);
- if (tdata || tips_query->emit_always)
- gtk_signal_emit (GTK_OBJECT (tips_query),
- tips_query_signals[SIGNAL_WIDGET_ENTERED],
- widget,
- tdata ? tdata->tip_text : NULL,
- tdata ? tdata->tip_private : NULL);
- if (tips_query->last_crossed)
- gtk_widget_unref (tips_query->last_crossed);
- tips_query->last_crossed = widget;
- }
-}
-
-static gint
-gtk_tips_query_event (GtkWidget *widget,
- GdkEvent *event)
-{
- GtkTipsQuery *tips_query;
- GtkWidget *event_widget;
- gboolean event_handled;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_TIPS_QUERY (widget), FALSE);
-
- tips_query = GTK_TIPS_QUERY (widget);
- if (!tips_query->in_query)
- {
- if (GTK_WIDGET_CLASS (parent_class)->event)
- return GTK_WIDGET_CLASS (parent_class)->event (widget, event);
- else
- return FALSE;
- }
-
- event_widget = gtk_get_event_widget (event);
-
- event_handled = FALSE;
- switch (event->type)
- {
- GdkWindow *pointer_window;
-
- case GDK_LEAVE_NOTIFY:
- if (event_widget)
- pointer_window = gdk_window_get_pointer (event_widget->window, NULL, NULL, NULL);
- else
- pointer_window = NULL;
- event_widget = NULL;
- if (pointer_window)
- gdk_window_get_user_data (pointer_window, (gpointer*) &event_widget);
- gtk_tips_query_emit_widget_entered (tips_query, event_widget);
- event_handled = TRUE;
- break;
-
- case GDK_ENTER_NOTIFY:
- gtk_tips_query_emit_widget_entered (tips_query, event_widget);
- event_handled = TRUE;
- break;
-
- case GDK_BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- if (event_widget)
- {
- if (event_widget == (GtkWidget*) tips_query ||
- event_widget == tips_query->caller)
- gtk_tips_query_stop_query (tips_query);
- else
- {
- gint stop;
- GtkTooltipsData *tdata;
-
- stop = TRUE;
- tdata = gtk_tooltips_data_get (event_widget);
- if (tdata || tips_query->emit_always)
- gtk_signal_emit (GTK_OBJECT (tips_query),
- tips_query_signals[SIGNAL_WIDGET_SELECTED],
- event_widget,
- tdata ? tdata->tip_text : NULL,
- tdata ? tdata->tip_private : NULL,
- event,
- &stop);
-
- if (stop)
- gtk_tips_query_stop_query (tips_query);
- }
- }
- event_handled = TRUE;
- break;
-
- default:
- break;
- }
-
- return event_handled;
-}
diff --git a/gtk/gtktipsquery.h b/gtk/gtktipsquery.h
deleted file mode 100644
index a03bb0ff2b..0000000000
--- a/gtk/gtktipsquery.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * GtkQueryTips: Query onscreen widgets for their tooltips
- * Copyright (C) 1998 Tim Janik
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTKTIPSQUERY_H__
-#define __GTKTIPSQUERY_H__
-
-
-#include <gtk/gtklabel.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-
-/* --- type macros --- */
-#define GTK_TIPS_QUERY(obj) (GTK_CHECK_CAST (obj, gtk_tips_query_get_type (), GtkTipsQuery))
-#define GTK_TIPS_QUERY_CLASS(klass) (GTK_CHECK_CLASS_CAST (klass, gtk_tips_query_get_type (), GtkTipsQueryClass))
-#define GTK_IS_TIPS_QUERY(obj) (GTK_CHECK_TYPE (obj, gtk_tips_query_get_type ()))
-
-
-/* --- typedefs --- */
-typedef struct _GtkTipsQuery GtkTipsQuery;
-typedef struct _GtkTipsQueryClass GtkTipsQueryClass;
-
-
-/* --- structures --- */
-struct _GtkTipsQuery
-{
- GtkLabel label;
-
- guint emit_always : 1;
- guint in_query : 1;
- gchar *label_inactive;
- gchar *label_no_tip;
-
- GtkWidget *caller;
- GtkWidget *last_crossed;
-
- GdkCursor *query_cursor;
-};
-
-struct _GtkTipsQueryClass
-{
- GtkLabelClass parent_class;
-
- void (*start_query) (GtkTipsQuery *tips_query);
- void (*stop_query) (GtkTipsQuery *tips_query);
- void (*widget_entered) (GtkTipsQuery *tips_query,
- GtkWidget *widget,
- const gchar *tip_text,
- const gchar *tip_private);
- gint (*widget_selected) (GtkTipsQuery *tips_query,
- GtkWidget *widget,
- const gchar *tip_text,
- const gchar *tip_private,
- GdkEventButton *event);
-};
-
-
-/* --- prototypes --- */
-GtkType gtk_tips_query_get_type (void);
-GtkWidget* gtk_tips_query_new (void);
-void gtk_tips_query_start_query (GtkTipsQuery *tips_query);
-void gtk_tips_query_stop_query (GtkTipsQuery *tips_query);
-void gtk_tips_query_set_caller (GtkTipsQuery *tips_query,
- GtkWidget *caller);
-void gtk_tips_query_set_labels (GtkTipsQuery *tips_query,
- const gchar *label_inactive,
- const gchar *label_no_tip);
-
-
-
-#ifdef __cplusplus
-#pragma {
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTKTIPSQUERY_H__ */
diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c
deleted file mode 100644
index c9eb8ad824..0000000000
--- a/gtk/gtktogglebutton.c
+++ /dev/null
@@ -1,373 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtklabel.h"
-#include "gtkmain.h"
-#include "gtksignal.h"
-#include "gtktogglebutton.h"
-
-
-#define DEFAULT_LEFT_POS 4
-#define DEFAULT_TOP_POS 4
-#define DEFAULT_SPACING 7
-
-enum {
- TOGGLED,
- LAST_SIGNAL
-};
-
-
-static void gtk_toggle_button_class_init (GtkToggleButtonClass *klass);
-static void gtk_toggle_button_init (GtkToggleButton *toggle_button);
-static void gtk_toggle_button_draw_focus (GtkWidget *widget);
-static void gtk_toggle_button_pressed (GtkButton *button);
-static void gtk_toggle_button_released (GtkButton *button);
-static void gtk_toggle_button_clicked (GtkButton *button);
-static void gtk_toggle_button_enter (GtkButton *button);
-static void gtk_toggle_button_leave (GtkButton *button);
-
-
-static guint toggle_button_signals[LAST_SIGNAL] = { 0 };
-
-
-guint
-gtk_toggle_button_get_type ()
-{
- static guint toggle_button_type = 0;
-
- if (!toggle_button_type)
- {
- GtkTypeInfo toggle_button_info =
- {
- "GtkToggleButton",
- sizeof (GtkToggleButton),
- sizeof (GtkToggleButtonClass),
- (GtkClassInitFunc) gtk_toggle_button_class_init,
- (GtkObjectInitFunc) gtk_toggle_button_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- toggle_button_type = gtk_type_unique (gtk_button_get_type (), &toggle_button_info);
- }
-
- return toggle_button_type;
-}
-
-static void
-gtk_toggle_button_class_init (GtkToggleButtonClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
- GtkButtonClass *button_class;
-
- object_class = (GtkObjectClass*) class;
- widget_class = (GtkWidgetClass*) class;
- container_class = (GtkContainerClass*) class;
- button_class = (GtkButtonClass*) class;
-
- toggle_button_signals[TOGGLED] =
- gtk_signal_new ("toggled",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkToggleButtonClass, toggled),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, toggle_button_signals, LAST_SIGNAL);
-
- widget_class->draw_focus = gtk_toggle_button_draw_focus;
- widget_class->draw_default = NULL;
-
- button_class->pressed = gtk_toggle_button_pressed;
- button_class->released = gtk_toggle_button_released;
- button_class->clicked = gtk_toggle_button_clicked;
- button_class->enter = gtk_toggle_button_enter;
- button_class->leave = gtk_toggle_button_leave;
-
- class->toggled = NULL;
-}
-
-static void
-gtk_toggle_button_init (GtkToggleButton *toggle_button)
-{
- toggle_button->active = FALSE;
- toggle_button->draw_indicator = FALSE;
-}
-
-
-GtkWidget*
-gtk_toggle_button_new ()
-{
- return GTK_WIDGET (gtk_type_new (gtk_toggle_button_get_type ()));
-}
-
-GtkWidget*
-gtk_toggle_button_new_with_label (const gchar *label)
-{
- GtkWidget *toggle_button;
- GtkWidget *label_widget;
-
- toggle_button = gtk_toggle_button_new ();
- label_widget = gtk_label_new (label);
- gtk_misc_set_alignment (GTK_MISC (label_widget), 0.5, 0.5);
-
- gtk_container_add (GTK_CONTAINER (toggle_button), label_widget);
- gtk_widget_show (label_widget);
-
- return toggle_button;
-}
-
-void
-gtk_toggle_button_set_mode (GtkToggleButton *toggle_button,
- gint draw_indicator)
-{
- g_return_if_fail (toggle_button != NULL);
- g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle_button));
-
- draw_indicator = draw_indicator ? TRUE : FALSE;
-
- if (toggle_button->draw_indicator != draw_indicator)
- {
- toggle_button->draw_indicator = draw_indicator;
-
- if (GTK_WIDGET_VISIBLE (toggle_button))
- gtk_widget_queue_resize (GTK_WIDGET (toggle_button));
- }
-}
-
-void
-gtk_toggle_button_set_state (GtkToggleButton *toggle_button,
- gint state)
-{
- g_return_if_fail (toggle_button != NULL);
- g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle_button));
-
- if (toggle_button->active != state)
- gtk_button_clicked (GTK_BUTTON (toggle_button));
-}
-
-void
-gtk_toggle_button_toggled (GtkToggleButton *toggle_button)
-{
- gtk_signal_emit (GTK_OBJECT (toggle_button), toggle_button_signals[TOGGLED]);
-}
-
-
-static void
-gtk_toggle_button_draw_focus (GtkWidget *widget)
-{
- GtkButton *button;
- GtkToggleButton *toggle_button;
- GtkShadowType shadow_type;
- gint width, height;
- gint x, y;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget));
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- button = GTK_BUTTON (widget);
- toggle_button = GTK_TOGGLE_BUTTON (widget);
-
- x = 0;
- y = 0;
- width = widget->allocation.width - GTK_CONTAINER (widget)->border_width * 2;
- height = widget->allocation.height - GTK_CONTAINER (widget)->border_width * 2;
-
- if (GTK_WIDGET_CAN_DEFAULT (widget))
- {
- x += widget->style->klass->xthickness;
- y += widget->style->klass->ythickness;
- width -= 2 * x + DEFAULT_SPACING;
- height -= 2 * y + DEFAULT_SPACING;
- x += DEFAULT_LEFT_POS;
- y += DEFAULT_TOP_POS;
- }
-
- if (GTK_WIDGET_HAS_FOCUS (widget))
- {
- x += 1;
- y += 1;
- width -= 2;
- height -= 2;
- }
- else
- {
- if (GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE)
- gdk_draw_rectangle (widget->window,
- widget->style->bg_gc[GTK_WIDGET_STATE (widget)], FALSE,
- x + 1, y + 1, width - 4, height - 4);
- else
- gdk_draw_rectangle (widget->window,
- widget->style->bg_gc[GTK_WIDGET_STATE (widget)], FALSE,
- x + 2, y + 2, width - 5, height - 5);
- }
-
- if (GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE)
- shadow_type = GTK_SHADOW_IN;
- else if ((GTK_WIDGET_STATE (widget) == GTK_STATE_PRELIGHT) && toggle_button->active)
- shadow_type = GTK_SHADOW_IN;
- else
- shadow_type = GTK_SHADOW_OUT;
-
- gtk_draw_shadow (widget->style, widget->window,
- GTK_WIDGET_STATE (widget), shadow_type,
- x, y, width, height);
-
- if (GTK_WIDGET_HAS_FOCUS (widget))
- {
- x -= 1;
- y -= 1;
- width += 2;
- height += 2;
-
- gdk_draw_rectangle (widget->window,
- widget->style->black_gc, FALSE,
- x, y, width - 1, height - 1);
- }
- }
-}
-
-static void
-gtk_toggle_button_pressed (GtkButton *button)
-{
- GtkToggleButton *toggle_button;
- GtkStateType new_state;
-
- g_return_if_fail (button != NULL);
- g_return_if_fail (GTK_IS_TOGGLE_BUTTON (button));
-
- toggle_button = GTK_TOGGLE_BUTTON (button);
-
- button->button_down = TRUE;
-
- if (toggle_button->active)
- new_state = (button->in_button ? GTK_STATE_NORMAL : GTK_STATE_ACTIVE);
- else
- new_state = (button->in_button ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL);
-
- if (GTK_WIDGET_STATE (button) != new_state)
- {
- gtk_widget_set_state (GTK_WIDGET (button), new_state);
- gtk_widget_queue_draw (GTK_WIDGET (button));
- }
-}
-
-static void
-gtk_toggle_button_released (GtkButton *button)
-{
- GtkToggleButton *toggle_button;
- GtkStateType new_state;
-
- g_return_if_fail (button != NULL);
- g_return_if_fail (GTK_IS_TOGGLE_BUTTON (button));
-
- if (button->button_down)
- {
- toggle_button = GTK_TOGGLE_BUTTON (button);
-
- button->button_down = FALSE;
-
- if (button->in_button)
- {
- gtk_button_clicked (button);
- }
- else
- {
- if (toggle_button->active)
- new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_ACTIVE);
- else
- new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL);
-
- if (GTK_WIDGET_STATE (button) != new_state)
- {
- gtk_widget_set_state (GTK_WIDGET (button), new_state);
- gtk_widget_queue_draw (GTK_WIDGET (button));
- }
- }
- }
-}
-
-static void
-gtk_toggle_button_clicked (GtkButton *button)
-{
- GtkToggleButton *toggle_button;
- GtkStateType new_state;
-
- g_return_if_fail (button != NULL);
- g_return_if_fail (GTK_IS_TOGGLE_BUTTON (button));
-
- toggle_button = GTK_TOGGLE_BUTTON (button);
- toggle_button->active = !toggle_button->active;
-
- gtk_toggle_button_toggled (toggle_button);
-
- if (toggle_button->active)
- new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_ACTIVE);
- else
- new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL);
-
- if (GTK_WIDGET_STATE (button) != new_state)
- gtk_widget_set_state (GTK_WIDGET (button), new_state);
- gtk_widget_queue_draw (GTK_WIDGET (button));
-}
-
-static void
-gtk_toggle_button_enter (GtkButton *button)
-{
- GtkToggleButton *toggle_button;
- GtkStateType new_state;
-
- g_return_if_fail (button != NULL);
- g_return_if_fail (GTK_IS_TOGGLE_BUTTON (button));
-
- toggle_button = GTK_TOGGLE_BUTTON (button);
-
- if (toggle_button->active)
- new_state = (button->button_down ? GTK_STATE_NORMAL : GTK_STATE_PRELIGHT);
- else
- new_state = (button->button_down ? GTK_STATE_ACTIVE : GTK_STATE_PRELIGHT);
-
- if (GTK_WIDGET_STATE (button) != new_state)
- {
- gtk_widget_set_state (GTK_WIDGET (button), new_state);
- gtk_widget_queue_draw (GTK_WIDGET (button));
- }
-}
-
-static void
-gtk_toggle_button_leave (GtkButton *button)
-{
- GtkToggleButton *toggle_button;
- GtkStateType new_state;
-
- g_return_if_fail (button != NULL);
- g_return_if_fail (GTK_IS_TOGGLE_BUTTON (button));
-
- toggle_button = GTK_TOGGLE_BUTTON (button);
-
- new_state = (toggle_button->active ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL);
-
- if (GTK_WIDGET_STATE (button) != new_state)
- {
- gtk_widget_set_state (GTK_WIDGET (button), new_state);
- gtk_widget_queue_draw (GTK_WIDGET (button));
- }
-}
diff --git a/gtk/gtktogglebutton.h b/gtk/gtktogglebutton.h
deleted file mode 100644
index e48d1cf5a2..0000000000
--- a/gtk/gtktogglebutton.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_TOGGLE_BUTTON_H__
-#define __GTK_TOGGLE_BUTTON_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkbutton.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_TOGGLE_BUTTON(obj) GTK_CHECK_CAST (obj, gtk_toggle_button_get_type (), GtkToggleButton)
-#define GTK_TOGGLE_BUTTON_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_toggle_button_get_type (), GtkToggleButtonClass)
-#define GTK_IS_TOGGLE_BUTTON(obj) GTK_CHECK_TYPE (obj, gtk_toggle_button_get_type ())
-
-
-typedef struct _GtkToggleButton GtkToggleButton;
-typedef struct _GtkToggleButtonClass GtkToggleButtonClass;
-
-struct _GtkToggleButton
-{
- GtkButton button;
-
- guint active : 1;
- guint draw_indicator : 1;
-};
-
-struct _GtkToggleButtonClass
-{
- GtkButtonClass parent_class;
-
- void (* toggled) (GtkToggleButton *toggle_button);
-};
-
-
-guint gtk_toggle_button_get_type (void);
-GtkWidget* gtk_toggle_button_new (void);
-GtkWidget* gtk_toggle_button_new_with_label (const gchar *label);
-void gtk_toggle_button_set_mode (GtkToggleButton *toggle_button,
- gint draw_indicator);
-void gtk_toggle_button_set_state (GtkToggleButton *toggle_button,
- gint state);
-void gtk_toggle_button_toggled (GtkToggleButton *toggle_button);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_TOGGLE_BUTTON_H__ */
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
deleted file mode 100644
index e79ab84d64..0000000000
--- a/gtk/gtktoolbar.c
+++ /dev/null
@@ -1,951 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- * GtkToolbar copyright (C) Federico Mena
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "gtkbutton.h"
-#include "gtktogglebutton.h"
-#include "gtkradiobutton.h"
-#include "gtklabel.h"
-#include "gtkvbox.h"
-#include "gtktoolbar.h"
-
-
-#define DEFAULT_SPACE_SIZE 5
-
-
-enum {
- ORIENTATION_CHANGED,
- STYLE_CHANGED,
- LAST_SIGNAL
-};
-
-typedef void (*GtkToolbarSignal1) (GtkObject *object,
- gint arg1,
- gpointer data);
-
-static void gtk_toolbar_marshal_signal_1 (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-
-static void gtk_toolbar_class_init (GtkToolbarClass *class);
-static void gtk_toolbar_init (GtkToolbar *toolbar);
-static void gtk_toolbar_destroy (GtkObject *object);
-static void gtk_toolbar_map (GtkWidget *widget);
-static void gtk_toolbar_unmap (GtkWidget *widget);
-static void gtk_toolbar_draw (GtkWidget *widget,
- GdkRectangle *area);
-static gint gtk_toolbar_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static void gtk_toolbar_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_toolbar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_toolbar_add (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_toolbar_remove (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_toolbar_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data);
-static void gtk_real_toolbar_orientation_changed (GtkToolbar *toolbar,
- GtkOrientation orientation);
-static void gtk_real_toolbar_style_changed (GtkToolbar *toolbar,
- GtkToolbarStyle style);
-
-
-static GtkContainerClass *parent_class;
-
-static guint toolbar_signals[LAST_SIGNAL] = { 0 };
-
-
-guint
-gtk_toolbar_get_type (void)
-{
- static guint toolbar_type = 0;
-
- if (!toolbar_type)
- {
- GtkTypeInfo toolbar_info =
- {
- "GtkToolbar",
- sizeof (GtkToolbar),
- sizeof (GtkToolbarClass),
- (GtkClassInitFunc) gtk_toolbar_class_init,
- (GtkObjectInitFunc) gtk_toolbar_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- toolbar_type = gtk_type_unique (gtk_container_get_type (), &toolbar_info);
- }
-
- return toolbar_type;
-}
-
-static void
-gtk_toolbar_class_init (GtkToolbarClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GtkObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
- container_class = (GtkContainerClass *) class;
-
- parent_class = gtk_type_class (gtk_container_get_type ());
-
- toolbar_signals[ORIENTATION_CHANGED] =
- gtk_signal_new ("orientation_changed",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkToolbarClass, orientation_changed),
- gtk_toolbar_marshal_signal_1,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_INT);
- toolbar_signals[STYLE_CHANGED] =
- gtk_signal_new ("style_changed",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkToolbarClass, style_changed),
- gtk_toolbar_marshal_signal_1,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_INT);
-
- gtk_object_class_add_signals (object_class, toolbar_signals, LAST_SIGNAL);
-
- object_class->destroy = gtk_toolbar_destroy;
-
- widget_class->map = gtk_toolbar_map;
- widget_class->unmap = gtk_toolbar_unmap;
- widget_class->draw = gtk_toolbar_draw;
- widget_class->expose_event = gtk_toolbar_expose;
- widget_class->size_request = gtk_toolbar_size_request;
- widget_class->size_allocate = gtk_toolbar_size_allocate;
-
- container_class->add = gtk_toolbar_add;
- container_class->remove = gtk_toolbar_remove;
- container_class->foreach = gtk_toolbar_foreach;
- container_class->focus = NULL;
-
- class->orientation_changed = gtk_real_toolbar_orientation_changed;
- class->style_changed = gtk_real_toolbar_style_changed;
-}
-
-static void
-gtk_toolbar_init (GtkToolbar *toolbar)
-{
- GTK_WIDGET_SET_FLAGS (toolbar, GTK_NO_WINDOW);
- GTK_WIDGET_UNSET_FLAGS (toolbar, GTK_CAN_FOCUS);
-
- toolbar->num_children = 0;
- toolbar->children = NULL;
- toolbar->orientation = GTK_ORIENTATION_HORIZONTAL;
- toolbar->style = GTK_TOOLBAR_ICONS;
- toolbar->space_size = DEFAULT_SPACE_SIZE;
- toolbar->tooltips = gtk_tooltips_new ();
- toolbar->button_maxw = 0;
- toolbar->button_maxh = 0;
-}
-
-GtkWidget *
-gtk_toolbar_new (GtkOrientation orientation,
- GtkToolbarStyle style)
-{
- GtkToolbar *toolbar;
-
- toolbar = gtk_type_new (gtk_toolbar_get_type ());
-
- toolbar->orientation = orientation;
- toolbar->style = style;
-
- return GTK_WIDGET (toolbar);
-}
-
-static void
-gtk_toolbar_destroy (GtkObject *object)
-{
- GtkToolbar *toolbar;
- GList *children;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_TOOLBAR (object));
-
- toolbar = GTK_TOOLBAR (object);
-
- gtk_object_unref (GTK_OBJECT (toolbar->tooltips));
- toolbar->tooltips = NULL;
-
- for (children = toolbar->children; children; children = children->next)
- {
- GtkToolbarChild *child;
-
- child = children->data;
-
- if (child->type != GTK_TOOLBAR_CHILD_SPACE)
- {
- gtk_widget_ref (child->widget);
- gtk_widget_unparent (child->widget);
- gtk_widget_destroy (child->widget);
- gtk_widget_unref (child->widget);
- }
-
- g_free (child);
- }
-
- g_list_free (toolbar->children);
- toolbar->children = NULL;
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-static void
-gtk_toolbar_map (GtkWidget *widget)
-{
- GtkToolbar *toolbar;
- GList *children;
- GtkToolbarChild *child;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TOOLBAR (widget));
-
- toolbar = GTK_TOOLBAR (widget);
- GTK_WIDGET_SET_FLAGS (toolbar, GTK_MAPPED);
-
- for (children = toolbar->children; children; children = children->next)
- {
- child = children->data;
-
- if ((child->type != GTK_TOOLBAR_CHILD_SPACE)
- && GTK_WIDGET_VISIBLE (child->widget) && !GTK_WIDGET_MAPPED (child->widget))
- gtk_widget_map (child->widget);
- }
-}
-
-static void
-gtk_toolbar_unmap (GtkWidget *widget)
-{
- GtkToolbar *toolbar;
- GList *children;
- GtkToolbarChild *child;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TOOLBAR (widget));
-
- toolbar = GTK_TOOLBAR (widget);
- GTK_WIDGET_UNSET_FLAGS (toolbar, GTK_MAPPED);
-
- for (children = toolbar->children; children; children = children->next)
- {
- child = children->data;
-
- if ((child->type != GTK_TOOLBAR_CHILD_SPACE)
- && GTK_WIDGET_VISIBLE (child->widget) && GTK_WIDGET_MAPPED (child->widget))
- gtk_widget_unmap (child->widget);
- }
-}
-
-static void
-gtk_toolbar_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkToolbar *toolbar;
- GList *children;
- GtkToolbarChild *child;
- GdkRectangle child_area;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TOOLBAR (widget));
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- toolbar = GTK_TOOLBAR (widget);
-
- for (children = toolbar->children; children; children = children->next)
- {
- child = children->data;
-
- if ((child->type != GTK_TOOLBAR_CHILD_SPACE)
- && gtk_widget_intersect (child->widget, area, &child_area))
- gtk_widget_draw (child->widget, &child_area);
- }
- }
-}
-
-static gint
-gtk_toolbar_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkToolbar *toolbar;
- GList *children;
- GtkToolbarChild *child;
- GdkEventExpose child_event;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_TOOLBAR (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- toolbar = GTK_TOOLBAR (widget);
-
- child_event = *event;
-
- for (children = toolbar->children; children; children = children->next)
- {
- child = children->data;
-
- if ((child->type != GTK_TOOLBAR_CHILD_SPACE)
- && GTK_WIDGET_NO_WINDOW (child->widget)
- && gtk_widget_intersect (child->widget, &event->area, &child_event.area))
- gtk_widget_event (child->widget, (GdkEvent *) &child_event);
- }
- }
-
- return FALSE;
-}
-
-static void
-gtk_toolbar_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkToolbar *toolbar;
- GList *children;
- GtkToolbarChild *child;
- gint nbuttons;
- gint button_maxw, button_maxh;
- gint widget_maxw, widget_maxh;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TOOLBAR (widget));
- g_return_if_fail (requisition != NULL);
-
- toolbar = GTK_TOOLBAR (widget);
-
- requisition->width = GTK_CONTAINER (toolbar)->border_width * 2;
- requisition->height = GTK_CONTAINER (toolbar)->border_width * 2;
- nbuttons = 0;
- button_maxw = 0;
- button_maxh = 0;
- widget_maxw = 0;
- widget_maxh = 0;
-
- for (children = toolbar->children; children; children = children->next)
- {
- child = children->data;
-
- switch (child->type)
- {
- case GTK_TOOLBAR_CHILD_SPACE:
- if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
- requisition->width += toolbar->space_size;
- else
- requisition->height += toolbar->space_size;
-
- break;
-
- case GTK_TOOLBAR_CHILD_BUTTON:
- case GTK_TOOLBAR_CHILD_RADIOBUTTON:
- case GTK_TOOLBAR_CHILD_TOGGLEBUTTON:
- if (GTK_WIDGET_VISIBLE (child->widget))
- {
- gtk_widget_size_request (child->widget, &child->widget->requisition);
-
- nbuttons++;
- button_maxw = MAX (button_maxw, child->widget->requisition.width);
- button_maxh = MAX (button_maxh, child->widget->requisition.height);
- }
-
- break;
-
- case GTK_TOOLBAR_CHILD_WIDGET:
- if (GTK_WIDGET_VISIBLE (child->widget))
- {
- gtk_widget_size_request (child->widget, &child->widget->requisition);
-
- widget_maxw = MAX (widget_maxw, child->widget->requisition.width);
- widget_maxh = MAX (widget_maxh, child->widget->requisition.height);
-
- if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
- requisition->width += child->widget->requisition.width;
- else
- requisition->height += child->widget->requisition.height;
- }
-
- break;
-
- default:
- g_assert_not_reached ();
- }
- }
-
- if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
- {
- requisition->width += nbuttons * button_maxw;
- requisition->height += MAX (button_maxh, widget_maxh);
- }
- else
- {
- requisition->width += MAX (button_maxw, widget_maxw);
- requisition->height += nbuttons * button_maxh;
- }
-
- toolbar->button_maxw = button_maxw;
- toolbar->button_maxh = button_maxh;
-}
-
-static void
-gtk_toolbar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkToolbar *toolbar;
- GList *children;
- GtkToolbarChild *child;
- GtkAllocation alloc;
- gint border_width;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TOOLBAR (widget));
- g_return_if_fail (allocation != NULL);
-
- toolbar = GTK_TOOLBAR (widget);
- widget->allocation = *allocation;
-
- border_width = GTK_CONTAINER (toolbar)->border_width;
-
- if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
- alloc.x = allocation->x + border_width;
- else
- alloc.y = allocation->y + border_width;
-
- for (children = toolbar->children; children; children = children->next)
- {
- child = children->data;
-
- switch (child->type)
- {
- case GTK_TOOLBAR_CHILD_SPACE:
- if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
- alloc.x += toolbar->space_size;
- else
- alloc.y += toolbar->space_size;
-
- break;
-
- case GTK_TOOLBAR_CHILD_BUTTON:
- case GTK_TOOLBAR_CHILD_RADIOBUTTON:
- case GTK_TOOLBAR_CHILD_TOGGLEBUTTON:
- alloc.width = toolbar->button_maxw;
- alloc.height = toolbar->button_maxh;
-
- if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
- alloc.y = allocation->y + (allocation->height - toolbar->button_maxh) / 2;
- else
- alloc.x = allocation->x + (allocation->width - toolbar->button_maxw) / 2;
-
- gtk_widget_size_allocate (child->widget, &alloc);
-
- if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
- alloc.x += toolbar->button_maxw;
- else
- alloc.y += toolbar->button_maxh;
-
- break;
-
- case GTK_TOOLBAR_CHILD_WIDGET:
- alloc.width = child->widget->requisition.width;
- alloc.height = child->widget->requisition.height;
-
- if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
- alloc.y = allocation->y + (allocation->height - child->widget->requisition.height) / 2;
- else
- alloc.x = allocation->x + (allocation->width - child->widget->requisition.width) / 2;
-
- gtk_widget_size_allocate (child->widget, &alloc);
-
- if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
- alloc.x += child->widget->requisition.width;
- else
- alloc.y += child->widget->requisition.height;
-
- break;
-
- default:
- g_assert_not_reached ();
- }
- }
-}
-
-static void
-gtk_toolbar_add (GtkContainer *container,
- GtkWidget *widget)
-{
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_TOOLBAR (container));
- g_return_if_fail (widget != NULL);
-
- gtk_toolbar_append_widget (GTK_TOOLBAR (container), widget, NULL, NULL);
-}
-
-static void
-gtk_toolbar_remove (GtkContainer *container,
- GtkWidget *widget)
-{
- GtkToolbar *toolbar;
- GList *children;
- GtkToolbarChild *child;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_TOOLBAR (container));
- g_return_if_fail (widget != NULL);
-
- toolbar = GTK_TOOLBAR (container);
-
- for (children = toolbar->children; children; children = children->next)
- {
- child = children->data;
-
- if ((child->type != GTK_TOOLBAR_CHILD_SPACE) && (child->widget == widget))
- {
- gboolean was_visible;
-
- was_visible = GTK_WIDGET_VISIBLE (widget);
- gtk_widget_unparent (widget);
-
- toolbar->children = g_list_remove_link (toolbar->children, children);
- g_free (child);
- g_list_free (children);
- toolbar->num_children--;
-
- if (was_visible && GTK_WIDGET_VISIBLE (container))
- gtk_widget_queue_resize (GTK_WIDGET (container));
-
- break;
- }
- }
-}
-
-static void
-gtk_toolbar_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
-{
- GtkToolbar *toolbar;
- GList *children;
- GtkToolbarChild *child;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_TOOLBAR (container));
- g_return_if_fail (callback != NULL);
-
- toolbar = GTK_TOOLBAR (container);
-
- for (children = toolbar->children; children; children = children->next)
- {
- child = children->data;
-
- if (child->type != GTK_TOOLBAR_CHILD_SPACE)
- (*callback) (child->widget, callback_data);
- }
-}
-
-GtkWidget *
-gtk_toolbar_append_item (GtkToolbar *toolbar,
- const char *text,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkWidget *icon,
- GtkSignalFunc callback,
- gpointer user_data)
-{
- return gtk_toolbar_insert_element (toolbar, GTK_TOOLBAR_CHILD_BUTTON,
- NULL, text,
- tooltip_text, tooltip_private_text,
- icon, callback, user_data,
- toolbar->num_children);
-}
-
-GtkWidget *
-gtk_toolbar_prepend_item (GtkToolbar *toolbar,
- const char *text,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkWidget *icon,
- GtkSignalFunc callback,
- gpointer user_data)
-{
- return gtk_toolbar_insert_element (toolbar, GTK_TOOLBAR_CHILD_BUTTON,
- NULL, text,
- tooltip_text, tooltip_private_text,
- icon, callback, user_data,
- 0);
-}
-
-GtkWidget *
-gtk_toolbar_insert_item (GtkToolbar *toolbar,
- const char *text,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkWidget *icon,
- GtkSignalFunc callback,
- gpointer user_data,
- gint position)
-{
- return gtk_toolbar_insert_element (toolbar, GTK_TOOLBAR_CHILD_BUTTON,
- NULL, text,
- tooltip_text, tooltip_private_text,
- icon, callback, user_data,
- position);
-}
-
-void
-gtk_toolbar_append_space (GtkToolbar *toolbar)
-{
- gtk_toolbar_insert_element (toolbar, GTK_TOOLBAR_CHILD_SPACE,
- NULL, NULL,
- NULL, NULL,
- NULL, NULL, NULL,
- toolbar->num_children);
-}
-
-void
-gtk_toolbar_prepend_space (GtkToolbar *toolbar)
-{
- gtk_toolbar_insert_element (toolbar, GTK_TOOLBAR_CHILD_SPACE,
- NULL, NULL,
- NULL, NULL,
- NULL, NULL, NULL,
- 0);
-}
-
-void
-gtk_toolbar_insert_space (GtkToolbar *toolbar,
- gint position)
-{
- gtk_toolbar_insert_element (toolbar, GTK_TOOLBAR_CHILD_SPACE,
- NULL, NULL,
- NULL, NULL,
- NULL, NULL, NULL,
- position);
-}
-
-void
-gtk_toolbar_append_widget (GtkToolbar *toolbar,
- GtkWidget *widget,
- const gchar *tooltip_text,
- const gchar *tooltip_private_text)
-{
- gtk_toolbar_insert_element (toolbar, GTK_TOOLBAR_CHILD_WIDGET,
- widget, NULL,
- tooltip_text, tooltip_private_text,
- NULL, NULL, NULL,
- toolbar->num_children);
-}
-
-void
-gtk_toolbar_prepend_widget (GtkToolbar *toolbar,
- GtkWidget *widget,
- const gchar *tooltip_text,
- const gchar *tooltip_private_text)
-{
- gtk_toolbar_insert_element (toolbar, GTK_TOOLBAR_CHILD_WIDGET,
- widget, NULL,
- tooltip_text, tooltip_private_text,
- NULL, NULL, NULL,
- toolbar->num_children);
-}
-
-void
-gtk_toolbar_insert_widget (GtkToolbar *toolbar,
- GtkWidget *widget,
- const char *tooltip_text,
- const char *tooltip_private_text,
- gint position)
-{
- gtk_toolbar_insert_element (toolbar, GTK_TOOLBAR_CHILD_WIDGET,
- widget, NULL,
- tooltip_text, tooltip_private_text,
- NULL, NULL, NULL,
- position);
-}
-
-GtkWidget *gtk_toolbar_append_element (GtkToolbar *toolbar,
- GtkToolbarChildType type,
- GtkWidget *widget,
- const char *text,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkWidget *icon,
- GtkSignalFunc callback,
- gpointer user_data)
-{
- return gtk_toolbar_insert_element(toolbar, type, widget, text,
- tooltip_text, tooltip_private_text,
- icon, callback, user_data,
- toolbar->num_children);
-}
-
-GtkWidget *gtk_toolbar_prepend_element (GtkToolbar *toolbar,
- GtkToolbarChildType type,
- GtkWidget *widget,
- const char *text,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkWidget *icon,
- GtkSignalFunc callback,
- gpointer user_data)
-{
- return gtk_toolbar_insert_element(toolbar, type, widget, text,
- tooltip_text, tooltip_private_text,
- icon, callback, user_data, 0);
-}
-
-GtkWidget *gtk_toolbar_insert_element (GtkToolbar *toolbar,
- GtkToolbarChildType type,
- GtkWidget *widget,
- const char *text,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkWidget *icon,
- GtkSignalFunc callback,
- gpointer user_data,
- gint position)
-{
- GtkToolbarChild *child;
- GtkWidget *vbox;
-
- g_return_val_if_fail (toolbar != NULL, NULL);
- g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), NULL);
-
- child = g_new (GtkToolbarChild, 1);
- child->type = type;
- child->icon = NULL;
- child->label = NULL;
-
- switch (type) {
- case GTK_TOOLBAR_CHILD_SPACE:
- child->widget = NULL;
- break;
- case GTK_TOOLBAR_CHILD_WIDGET:
- child->widget = widget;
- break;
- case GTK_TOOLBAR_CHILD_BUTTON:
- case GTK_TOOLBAR_CHILD_TOGGLEBUTTON:
- case GTK_TOOLBAR_CHILD_RADIOBUTTON:
- if (type == GTK_TOOLBAR_CHILD_BUTTON) {
- child->widget = gtk_button_new ();
- } else if (type == GTK_TOOLBAR_CHILD_TOGGLEBUTTON) {
- child->widget = gtk_toggle_button_new ();
- gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON(child->widget),
- FALSE);
- } else {
- child->widget =
- gtk_radio_button_new(
- widget
- ? gtk_radio_button_group(GTK_RADIO_BUTTON(widget))
- : NULL);
- gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON(child->widget),
- FALSE);
- }
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (child->widget), vbox);
- gtk_widget_show (vbox);
-
- if (icon) {
- child->icon = GTK_WIDGET (icon);
- gtk_box_pack_start (GTK_BOX (vbox), child->icon, FALSE, FALSE, 0);
- if (toolbar->style != GTK_TOOLBAR_TEXT)
- gtk_widget_show (child->icon);
- }
-
- if (text) {
- child->label = gtk_label_new (text);
- gtk_box_pack_start (GTK_BOX (vbox), child->label, FALSE, FALSE, 0);
- if (toolbar->style != GTK_TOOLBAR_ICONS)
- gtk_widget_show (child->label);
- }
-
- gtk_widget_show (child->widget);
- break;
- default:
- g_assert_not_reached ();
- }
-
- if (callback)
- gtk_signal_connect (GTK_OBJECT (child->widget), "clicked",
- callback, user_data);
-
- if (tooltip_text)
- gtk_tooltips_set_tip (toolbar->tooltips, child->widget,
- tooltip_text, tooltip_private_text);
-
- toolbar->children = g_list_insert (toolbar->children, child, position);
- toolbar->num_children++;
-
- if (type != GTK_TOOLBAR_CHILD_SPACE)
- gtk_widget_set_parent (child->widget, GTK_WIDGET (toolbar));
-
- if (type != GTK_TOOLBAR_CHILD_SPACE && GTK_WIDGET_VISIBLE (toolbar))
- {
- if (GTK_WIDGET_REALIZED (toolbar)
- && !GTK_WIDGET_REALIZED (child->widget))
- gtk_widget_realize (child->widget);
-
- if (GTK_WIDGET_MAPPED (toolbar)
- && !GTK_WIDGET_MAPPED (child->widget))
- gtk_widget_map (child->widget);
- }
-
- if (GTK_WIDGET_VISIBLE (toolbar) &&
- (type == GTK_TOOLBAR_CHILD_SPACE ||
- GTK_WIDGET_VISIBLE (child->widget)))
- gtk_widget_queue_resize (GTK_WIDGET (toolbar));
-
- return child->widget;
-}
-
-void
-gtk_toolbar_set_orientation (GtkToolbar *toolbar,
- GtkOrientation orientation)
-{
- gtk_signal_emit (GTK_OBJECT (toolbar), toolbar_signals[ORIENTATION_CHANGED], orientation);
-}
-
-void
-gtk_toolbar_set_style (GtkToolbar *toolbar,
- GtkToolbarStyle style)
-{
- gtk_signal_emit (GTK_OBJECT (toolbar), toolbar_signals[STYLE_CHANGED], style);
-}
-
-void
-gtk_toolbar_set_space_size (GtkToolbar *toolbar,
- gint space_size)
-{
- g_return_if_fail (toolbar != NULL);
- g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
-
- if (toolbar->space_size != space_size)
- {
- toolbar->space_size = space_size;
- gtk_widget_queue_resize (GTK_WIDGET (toolbar));
- }
-}
-
-void
-gtk_toolbar_set_tooltips (GtkToolbar *toolbar,
- gint enable)
-{
- g_return_if_fail (toolbar != NULL);
- g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
-
- if (enable)
- gtk_tooltips_enable (toolbar->tooltips);
- else
- gtk_tooltips_disable (toolbar->tooltips);
-}
-
-static void
-gtk_toolbar_marshal_signal_1 (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkToolbarSignal1 rfunc;
-
- rfunc = (GtkToolbarSignal1) func;
-
- (*rfunc) (object, GTK_VALUE_ENUM (args[0]), func_data);
-}
-
-static void
-gtk_real_toolbar_orientation_changed (GtkToolbar *toolbar,
- GtkOrientation orientation)
-{
- g_return_if_fail (toolbar != NULL);
- g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
-
- if (toolbar->orientation != orientation)
- {
- toolbar->orientation = orientation;
- gtk_widget_queue_resize (GTK_WIDGET (toolbar));
- }
-}
-
-static void
-gtk_real_toolbar_style_changed (GtkToolbar *toolbar,
- GtkToolbarStyle style)
-{
- GList *children;
- GtkToolbarChild *child;
-
- g_return_if_fail (toolbar != NULL);
- g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
-
- if (toolbar->style != style)
- {
- toolbar->style = style;
-
- for (children = toolbar->children; children; children = children->next)
- {
- child = children->data;
-
- if (child->type == GTK_TOOLBAR_CHILD_BUTTON ||
- child->type == GTK_TOOLBAR_CHILD_RADIOBUTTON ||
- child->type == GTK_TOOLBAR_CHILD_TOGGLEBUTTON)
- switch (style)
- {
- case GTK_TOOLBAR_ICONS:
- if (child->icon && !GTK_WIDGET_VISIBLE (child->icon))
- gtk_widget_show (child->icon);
-
- if (child->label && GTK_WIDGET_VISIBLE (child->label))
- gtk_widget_hide (child->label);
-
- break;
-
- case GTK_TOOLBAR_TEXT:
- if (child->icon && GTK_WIDGET_VISIBLE (child->icon))
- gtk_widget_hide (child->icon);
-
- if (child->label && !GTK_WIDGET_VISIBLE (child->label))
- gtk_widget_show (child->label);
-
- break;
-
- case GTK_TOOLBAR_BOTH:
- if (child->icon && !GTK_WIDGET_VISIBLE (child->icon))
- gtk_widget_show (child->icon);
-
- if (child->label && !GTK_WIDGET_VISIBLE (child->label))
- gtk_widget_show (child->label);
-
- break;
-
- default:
- g_assert_not_reached ();
- }
- }
-
- gtk_widget_queue_resize (GTK_WIDGET (toolbar));
- }
-}
diff --git a/gtk/gtktoolbar.h b/gtk/gtktoolbar.h
deleted file mode 100644
index 82c00b3046..0000000000
--- a/gtk/gtktoolbar.h
+++ /dev/null
@@ -1,186 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- * GtkToolbar copyright (C) Federico Mena
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef __GTK_TOOLBAR_H__
-#define __GTK_TOOLBAR_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkcontainer.h>
-#include <gtk/gtkenums.h>
-#include <gtk/gtkpixmap.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtktooltips.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_TOOLBAR(obj) GTK_CHECK_CAST (obj, gtk_toolbar_get_type (), GtkToolbar)
-#define GTK_TOOLBAR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_toolbar_get_type (), GtkToolbarClass)
-#define GTK_IS_TOOLBAR(obj) GTK_CHECK_TYPE (obj, gtk_toolbar_get_type ())
-
-enum _GtkToolbarChildType
-{
- GTK_TOOLBAR_CHILD_SPACE,
- GTK_TOOLBAR_CHILD_BUTTON,
- GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
- GTK_TOOLBAR_CHILD_RADIOBUTTON,
- GTK_TOOLBAR_CHILD_WIDGET
-};
-
-typedef enum _GtkToolbarChildType GtkToolbarChildType;
-typedef struct _GtkToolbarChild GtkToolbarChild;
-typedef struct _GtkToolbar GtkToolbar;
-typedef struct _GtkToolbarClass GtkToolbarClass;
-
-struct _GtkToolbarChild
-{
- GtkToolbarChildType type;
- GtkWidget *widget;
- GtkWidget *icon;
- GtkWidget *label;
-};
-
-struct _GtkToolbar
-{
- GtkContainer container;
-
- gint num_children;
- GList *children;
- GtkOrientation orientation;
- GtkToolbarStyle style;
- gint space_size; /* big optional space between buttons */
-
- GtkTooltips *tooltips;
-
- gint button_maxw;
- gint button_maxh;
-};
-
-struct _GtkToolbarClass
-{
- GtkContainerClass parent_class;
-
- void (* orientation_changed) (GtkToolbar *toolbar,
- GtkOrientation orientation);
- void (* style_changed) (GtkToolbar *toolbar,
- GtkToolbarStyle style);
-};
-
-
-guint gtk_toolbar_get_type (void);
-GtkWidget *gtk_toolbar_new (GtkOrientation orientation,
- GtkToolbarStyle style);
-
-/* Simple button items */
-GtkWidget *gtk_toolbar_append_item (GtkToolbar *toolbar,
- const char *text,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkWidget *icon,
- GtkSignalFunc callback,
- gpointer user_data);
-GtkWidget *gtk_toolbar_prepend_item (GtkToolbar *toolbar,
- const char *text,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkWidget *icon,
- GtkSignalFunc callback,
- gpointer user_data);
-GtkWidget *gtk_toolbar_insert_item (GtkToolbar *toolbar,
- const char *text,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkWidget *icon,
- GtkSignalFunc callback,
- gpointer user_data,
- gint position);
-
-/* Space Items */
-void gtk_toolbar_append_space (GtkToolbar *toolbar);
-void gtk_toolbar_prepend_space (GtkToolbar *toolbar);
-void gtk_toolbar_insert_space (GtkToolbar *toolbar,
- gint position);
-
-/* Any element type */
-GtkWidget *gtk_toolbar_append_element (GtkToolbar *toolbar,
- GtkToolbarChildType type,
- GtkWidget *widget,
- const char *text,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkWidget *icon,
- GtkSignalFunc callback,
- gpointer user_data);
-
-GtkWidget *gtk_toolbar_prepend_element (GtkToolbar *toolbar,
- GtkToolbarChildType type,
- GtkWidget *widget,
- const char *text,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkWidget *icon,
- GtkSignalFunc callback,
- gpointer user_data);
-
-GtkWidget *gtk_toolbar_insert_element (GtkToolbar *toolbar,
- GtkToolbarChildType type,
- GtkWidget *widget,
- const char *text,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkWidget *icon,
- GtkSignalFunc callback,
- gpointer user_data,
- gint position);
-
-/* Generic Widgets */
-void gtk_toolbar_append_widget (GtkToolbar *toolbar,
- GtkWidget *widget,
- const char *tooltip_text,
- const char *tooltip_private_text);
-void gtk_toolbar_prepend_widget (GtkToolbar *toolbar,
- GtkWidget *widget,
- const char *tooltip_text,
- const char *tooltip_private_text);
-void gtk_toolbar_insert_widget (GtkToolbar *toolbar,
- GtkWidget *widget,
- const char *tooltip_text,
- const char *tooltip_private_text,
- gint position);
-
-/* Style functions */
-void gtk_toolbar_set_orientation (GtkToolbar *toolbar,
- GtkOrientation orientation);
-void gtk_toolbar_set_style (GtkToolbar *toolbar,
- GtkToolbarStyle style);
-void gtk_toolbar_set_space_size (GtkToolbar *toolbar,
- gint space_size);
-void gtk_toolbar_set_tooltips (GtkToolbar *toolbar,
- gint enable);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __GTK_TOOLBAR_H__ */
diff --git a/gtk/gtktooltips.c b/gtk/gtktooltips.c
deleted file mode 100644
index 00e39234f5..0000000000
--- a/gtk/gtktooltips.c
+++ /dev/null
@@ -1,639 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#include "gtkmain.h"
-#include "gtkwidget.h"
-#include "gtkwindow.h"
-#include "gtksignal.h"
-#include "gtkstyle.h"
-#include "gtktooltips.h"
-
-
-#define DEFAULT_DELAY 500 /* Default delay in ms */
-
-static void gtk_tooltips_class_init (GtkTooltipsClass *klass);
-static void gtk_tooltips_init (GtkTooltips *tooltips);
-static void gtk_tooltips_destroy (GtkObject *object);
-
-static gint gtk_tooltips_event_handler (GtkWidget *widget,
- GdkEvent *event);
-static void gtk_tooltips_widget_unmap (GtkWidget *widget,
- gpointer data);
-static void gtk_tooltips_widget_remove (GtkWidget *widget,
- gpointer data);
-static void gtk_tooltips_set_active_widget (GtkTooltips *tooltips,
- GtkWidget *widget);
-static gint gtk_tooltips_widget_visible (GtkWidget *widget);
-static gint gtk_tooltips_timeout (gpointer data);
-static void gtk_tooltips_create_window (GtkTooltips *tooltips);
-static void gtk_tooltips_draw_tips (GtkTooltips *tooltips);
-
-static GtkDataClass *parent_class;
-static const gchar *tooltips_data_key = "_GtkTooltipsData";
-
-guint
-gtk_tooltips_get_type ()
-{
- static guint tooltips_type = 0;
-
- if (!tooltips_type)
- {
- GtkTypeInfo tooltips_info =
- {
- "GtkTooltips",
- sizeof (GtkTooltips),
- sizeof (GtkTooltipsClass),
- (GtkClassInitFunc) gtk_tooltips_class_init,
- (GtkObjectInitFunc) gtk_tooltips_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- tooltips_type = gtk_type_unique (gtk_data_get_type (), &tooltips_info);
- }
-
- return tooltips_type;
-}
-
-static void
-gtk_tooltips_class_init (GtkTooltipsClass *class)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass*) class;
- parent_class = gtk_type_class (gtk_data_get_type ());
-
- object_class->destroy = gtk_tooltips_destroy;
-}
-
-static void
-gtk_tooltips_init (GtkTooltips *tooltips)
-{
- tooltips->enabled = TRUE;
- tooltips->delay = DEFAULT_DELAY;
- tooltips->widget_list = NULL;
- tooltips->gc = NULL;
- tooltips->foreground = NULL;
- tooltips->background = NULL;
- tooltips->tip_window = NULL;
-}
-
-GtkTooltips *
-gtk_tooltips_new ()
-{
- return gtk_type_new (gtk_tooltips_get_type ());
-}
-
-void
-gtk_tooltips_free_string (gpointer data, gpointer user_data)
-{
- if (data)
- g_free (data);
-}
-
-static void
-gtk_tooltips_destroy_data (GtkTooltipsData *tooltipsdata)
-{
- g_free (tooltipsdata->tip_text);
- g_free (tooltipsdata->tip_private);
- g_list_foreach (tooltipsdata->row, gtk_tooltips_free_string, 0);
- if (tooltipsdata->row)
- g_list_free (tooltipsdata->row);
- gtk_signal_disconnect_by_data (GTK_OBJECT (tooltipsdata->widget),
- (gpointer) tooltipsdata);
- gtk_object_remove_data (GTK_OBJECT (tooltipsdata->widget), tooltips_data_key);
- gtk_widget_unref (tooltipsdata->widget);
- g_free (tooltipsdata);
-}
-
-static void
-gtk_tooltips_destroy (GtkObject *object)
-{
- GtkTooltips *tooltips = GTK_TOOLTIPS (object);
- GList *current;
- GtkTooltipsData *tooltipsdata;
-
- g_return_if_fail (tooltips != NULL);
-
- if (tooltips->timer_active == TRUE)
- {
- tooltips->timer_active = FALSE;
- gtk_timeout_remove (tooltips->timer_tag);
- }
-
- if (tooltips->widget_list != NULL)
- {
- current = g_list_first (tooltips->widget_list);
- while (current != NULL)
- {
- tooltipsdata = (GtkTooltipsData*) current->data;
- current = current->next;
- gtk_tooltips_widget_remove (tooltipsdata->widget, tooltipsdata);
- }
- }
-
- if (tooltips->tip_window != NULL)
- {
- gtk_widget_destroy (tooltips->tip_window);
- gtk_widget_unref (tooltips->tip_window);
- tooltips->tip_window = NULL;
- }
-
- if (tooltips->gc != NULL)
- {
- gdk_gc_destroy (tooltips->gc);
- tooltips->gc = NULL;
- }
-}
-
-static void
-gtk_tooltips_create_window (GtkTooltips *tooltips)
-{
- tooltips->tip_window = gtk_window_new (GTK_WINDOW_POPUP);
- gtk_widget_ref (tooltips->tip_window);
- gtk_window_set_policy (GTK_WINDOW (tooltips->tip_window), FALSE, FALSE, TRUE);
- gtk_widget_realize (tooltips->tip_window);
-}
-
-static void
-gtk_tooltips_layout_text (GtkTooltips *tooltips, GtkTooltipsData *data)
-{
- gchar *row_end, *text, *row_text, *break_pos;
- gint i, row_width, window_width = 0;
- size_t len;
-
- if (tooltips->tip_window == NULL)
- gtk_tooltips_create_window (tooltips);
-
- g_list_foreach (data->row, gtk_tooltips_free_string, 0);
- if (data->row)
- g_list_free (data->row);
- data->row = 0;
- data->font = tooltips->tip_window->style->font;
- data->width = 0;
-
- text = data->tip_text;
- if (!text)
- return;
-
- while (*text)
- {
- row_end = strchr (text, '\n');
- if (!row_end)
- row_end = strchr (text, '\0');
-
- len = row_end - text + 1;
- row_text = g_new(gchar, len);
- memcpy (row_text, text, len - 1);
- row_text[len - 1] = '\0';
-
- /* now either adjust the window's width or shorten the row until
- it fits in the window */
-
- while (1)
- {
- row_width = gdk_string_width (data->font, row_text);
- if (!window_width)
- {
- /* make an initial guess at window's width: */
-
- if (row_width > gdk_screen_width () / 4)
- window_width = gdk_screen_width () / 4;
- else
- window_width = row_width;
- }
- if (row_width <= window_width)
- break;
-
- if (strchr (row_text, ' '))
- {
- /* the row is currently too wide, but we have blanks in
- the row so we can break it into smaller pieces */
-
- gint avg_width = row_width / strlen (row_text);
-
- i = window_width;
- if (avg_width)
- i /= avg_width;
- if ((size_t) i >= len)
- i = len - 1;
-
- break_pos = strchr (row_text + i, ' ');
- if (!break_pos)
- {
- break_pos = row_text + i;
- while (*--break_pos != ' ');
- }
- *break_pos = '\0';
- }
- else
- {
- /* we can't break this row into any smaller pieces, so
- we have no choice but to widen the window: */
-
- window_width = row_width;
- break;
- }
- }
- if (row_width > data->width)
- data->width = row_width;
- data->row = g_list_append (data->row, row_text);
- text += strlen (row_text);
- if (!*text)
- break;
-
- if (text[0] == '\n' && text[1])
- /* end of paragraph and there is more text to come */
- data->row = g_list_append (data->row, 0);
- ++text; /* skip blank or newline */
- }
- data->width += 8; /* leave some border */
-}
-
-void
-gtk_tooltips_enable (GtkTooltips *tooltips)
-{
- g_return_if_fail (tooltips != NULL);
-
- tooltips->enabled = TRUE;
-}
-
-void
-gtk_tooltips_disable (GtkTooltips *tooltips)
-{
- g_return_if_fail (tooltips != NULL);
-
- tooltips->enabled = FALSE;
-
- if (tooltips->timer_active == TRUE)
- {
- gtk_timeout_remove (tooltips->timer_tag);
- tooltips->timer_active = FALSE;
- }
-
- if (tooltips->active_widget != NULL)
- {
- if (tooltips->tip_window != NULL)
- gtk_widget_hide (tooltips->tip_window);
- tooltips->active_widget = NULL;
- }
-}
-
-void
-gtk_tooltips_set_delay (GtkTooltips *tooltips,
- gint delay)
-{
- g_return_if_fail (tooltips != NULL);
-
- tooltips->delay = delay;
-}
-
-GtkTooltipsData*
-gtk_tooltips_data_get (GtkWidget *widget)
-{
- g_return_val_if_fail (widget != NULL, NULL);
-
- return gtk_object_get_data ((GtkObject*) widget, tooltips_data_key);
-}
-
-void
-gtk_tooltips_set_tip (GtkTooltips *tooltips,
- GtkWidget *widget,
- const gchar *tip_text,
- const gchar *tip_private)
-{
- GtkTooltipsData *tooltipsdata;
-
- g_return_if_fail (tooltips != NULL);
- g_return_if_fail (GTK_IS_TOOLTIPS (tooltips));
- g_return_if_fail (widget != NULL);
-
- tooltipsdata = gtk_tooltips_data_get (widget);
- if (tooltipsdata)
- gtk_tooltips_widget_remove (tooltipsdata->widget, tooltipsdata);
-
- if (!tip_text)
- return;
-
- tooltipsdata = g_new0 (GtkTooltipsData, 1);
-
- if (tooltipsdata != NULL)
- {
- tooltipsdata->tooltips = tooltips;
- tooltipsdata->widget = widget;
- gtk_widget_ref (widget);
-
- tooltipsdata->tip_text = g_strdup (tip_text);
- tooltipsdata->tip_private = g_strdup (tip_private);
-
- gtk_tooltips_layout_text (tooltips, tooltipsdata);
- tooltips->widget_list = g_list_append (tooltips->widget_list,
- tooltipsdata);
- gtk_signal_connect_after(GTK_OBJECT (widget), "event",
- (GtkSignalFunc) gtk_tooltips_event_handler,
- (gpointer) tooltipsdata);
-
- gtk_object_set_data (GTK_OBJECT (widget), tooltips_data_key,
- (gpointer) tooltipsdata);
-
- gtk_signal_connect (GTK_OBJECT (widget), "unmap",
- (GtkSignalFunc) gtk_tooltips_widget_unmap,
- (gpointer) tooltipsdata);
-
- gtk_signal_connect (GTK_OBJECT (widget), "unrealize",
- (GtkSignalFunc) gtk_tooltips_widget_unmap,
- (gpointer) tooltipsdata);
-
- gtk_signal_connect (GTK_OBJECT (widget), "destroy",
- (GtkSignalFunc) gtk_tooltips_widget_remove,
- (gpointer) tooltipsdata);
- }
-}
-
-void
-gtk_tooltips_set_colors (GtkTooltips *tooltips,
- GdkColor *background,
- GdkColor *foreground)
-{
- g_return_if_fail (tooltips != NULL);
-
- if (background != NULL)
- tooltips->foreground = foreground;
- if (foreground != NULL)
- tooltips->background = background;
-}
-
-static void
-gtk_tooltips_draw_tips (GtkTooltips * tooltips)
-{
- GtkWidget *widget;
- GtkStyle *style;
- gint gap, x, y, w, h, scr_w, scr_h, baseline_skip;
- GtkTooltipsData *data;
- GList *el;
-
- if (tooltips->tip_window == NULL)
- {
- gtk_tooltips_create_window (tooltips);
- }
- else
- gtk_widget_hide (tooltips->tip_window);
-
- style = tooltips->tip_window->style;
-
- widget = tooltips->active_widget->widget;
-
- scr_w = gdk_screen_width ();
- scr_h = gdk_screen_height ();
-
- data = tooltips->active_widget;
- if (data->font != style->font)
- gtk_tooltips_layout_text (tooltips, data);
-
- gap = (style->font->ascent + style->font->descent) / 4;
- if (gap < 2)
- gap = 2;
- baseline_skip = style->font->ascent + style->font->descent + gap;
- w = data->width;
- h = 8 - gap;
- for (el = data->row; el; el = el->next)
- if (el->data)
- h += baseline_skip;
- else
- h += baseline_skip / 2;
- if (h < 8)
- h = 8;
-
- gdk_window_get_pointer (NULL, &x, NULL, NULL);
- gdk_window_get_origin (widget->window, NULL, &y);
-
- x -= ((w >> 1) + 4);
-
- if ((x + w) > scr_w)
- x -= (x + w) - scr_w;
- else if (x < 0)
- x = 0;
-
- if ((y + h + widget->allocation.height + 4) > scr_h)
- y = y - h - 4;
- else
- y = y + widget->allocation.height + 4;
-
- gtk_widget_set_usize (tooltips->tip_window, w + 1, h + 1);
- gtk_widget_popup (tooltips->tip_window, x, y);
-
- if (tooltips->gc == NULL)
- tooltips->gc = gdk_gc_new (tooltips->tip_window->window);
-
- if (tooltips->background != NULL)
- {
- gdk_gc_set_foreground (tooltips->gc, tooltips->background);
- gdk_gc_set_background (tooltips->gc, tooltips->foreground);
- }
- else
- {
- gdk_gc_set_foreground (tooltips->gc, &style->bg[GTK_STATE_NORMAL]);
- gdk_gc_set_background (tooltips->gc, &style->fg[GTK_STATE_NORMAL]);
- }
-
- gdk_gc_set_font (tooltips->gc, style->font);
- gdk_draw_rectangle (tooltips->tip_window->window, tooltips->gc, TRUE, 0, 0, w, h);
-
- if (tooltips->foreground != NULL)
- {
- gdk_gc_set_foreground (tooltips->gc, tooltips->foreground);
- gdk_gc_set_background (tooltips->gc, tooltips->background);
- }
- else
- {
- gdk_gc_set_foreground (tooltips->gc, &style->fg[GTK_STATE_NORMAL]);
- gdk_gc_set_background (tooltips->gc, &style->bg[GTK_STATE_NORMAL]);
- }
-
- gdk_draw_rectangle (tooltips->tip_window->window, tooltips->gc, FALSE, 0, 0, w, h);
- y = style->font->ascent + 4;
-
- for (el = data->row; el; el = el->next)
- {
- if (el->data)
- {
- gdk_draw_string (tooltips->tip_window->window, style->font,
- tooltips->gc, 4, y, el->data);
- y += baseline_skip;
- }
- else
- y += baseline_skip / 2;
- }
-}
-
-static gint
-gtk_tooltips_timeout (gpointer data)
-{
- GtkTooltips *tooltips = (GtkTooltips *) data;
-
- if (tooltips->active_widget != NULL &&
- GTK_WIDGET_DRAWABLE (tooltips->active_widget->widget))
- gtk_tooltips_draw_tips (tooltips);
-
- return FALSE;
-}
-
-static gint
-gtk_tooltips_widget_visible (GtkWidget *widget)
-{
- GtkWidget *current;
-
- current = widget;
-
- while (current != NULL)
- {
- if (!GTK_WIDGET_MAPPED (current) || !GTK_WIDGET_REALIZED (current))
- return FALSE;
- current = current->parent;
- }
-
- return TRUE;
-}
-
-static void
-gtk_tooltips_set_active_widget (GtkTooltips *tooltips,
- GtkWidget *widget)
-{
- GtkTooltipsData *tooltipsdata;
- GList *current;
-
- current = g_list_first (tooltips->widget_list);
- tooltips->active_widget = NULL;
-
- while (current != NULL)
- {
- tooltipsdata = (GtkTooltipsData*) current->data;
-
- if (widget == tooltipsdata->widget &&
- gtk_tooltips_widget_visible (tooltipsdata->widget) == TRUE)
- {
- tooltips->active_widget = tooltipsdata;
- return;
- }
-
- current = current->next;
- }
-}
-
-static gint
-gtk_tooltips_event_handler (GtkWidget *widget,
- GdkEvent *event)
-{
- GtkTooltips *tooltips;
- GtkTooltipsData *old_widget;
- GtkWidget *event_widget;
- gint returnval = FALSE;
-
- old_widget = gtk_tooltips_data_get (widget);
- tooltips = old_widget->tooltips;
- event_widget = gtk_get_event_widget (event);
-
- if (tooltips->enabled == FALSE ||
- event_widget != widget)
- return returnval;
-
- if ((event->type == GDK_LEAVE_NOTIFY || event->type == GDK_ENTER_NOTIFY) &&
- event->crossing.detail == GDK_NOTIFY_INFERIOR)
- return returnval;
-
- if (event->type == GDK_LEAVE_NOTIFY)
- {
- if (tooltips->timer_active == TRUE)
- {
- gtk_timeout_remove (tooltips->timer_tag);
- tooltips->timer_active = FALSE;
- }
- if (tooltips->tip_window != NULL)
- gtk_widget_hide (tooltips->tip_window);
- tooltips->active_widget = NULL;
- }
- else if (event->type == GDK_MOTION_NOTIFY || event->type == GDK_ENTER_NOTIFY)
- {
- old_widget = tooltips->active_widget;
-
- gtk_tooltips_set_active_widget (tooltips, widget);
-
- if (old_widget != tooltips->active_widget)
- {
- if (tooltips->timer_active == TRUE)
- {
- gtk_timeout_remove (tooltips->timer_tag);
- tooltips->timer_active = FALSE;
- }
- if (tooltips->active_widget != NULL)
- {
- if (tooltips->tip_window != NULL)
- gtk_widget_hide (tooltips->tip_window);
-
- tooltips->timer_tag = gtk_timeout_add (tooltips->delay,
- gtk_tooltips_timeout, (gpointer) tooltips);
-
- tooltips->timer_active = TRUE;
- }
- }
- else if (tooltips->active_widget == NULL)
- {
- if (tooltips->tip_window != NULL)
- gtk_widget_hide (tooltips->tip_window);
- }
- }
- else
- {
- if (tooltips->tip_window != NULL)
- gtk_widget_hide (tooltips->tip_window);
- }
-
- return returnval;
-}
-
-static void
-gtk_tooltips_widget_unmap (GtkWidget *widget,
- gpointer data)
-{
- GtkTooltipsData *tooltipsdata = (GtkTooltipsData *)data;
- GtkTooltips *tooltips = tooltipsdata->tooltips;
-
- if (tooltips->active_widget &&
- (tooltips->active_widget->widget == widget))
- {
- if (tooltips->tip_window != NULL)
- gtk_widget_hide (tooltips->tip_window);
- tooltips->active_widget = NULL;
- }
-}
-
-static void
-gtk_tooltips_widget_remove (GtkWidget *widget,
- gpointer data)
-{
- GtkTooltipsData *tooltipsdata = (GtkTooltipsData*) data;
- GtkTooltips *tooltips = tooltipsdata->tooltips;
-
- gtk_tooltips_widget_unmap (widget, data);
- tooltips->widget_list = g_list_remove (tooltips->widget_list,
- tooltipsdata);
- gtk_tooltips_destroy_data (tooltipsdata);
-}
diff --git a/gtk/gtktooltips.h b/gtk/gtktooltips.h
deleted file mode 100644
index 9220b53616..0000000000
--- a/gtk/gtktooltips.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_TOOLTIPS_H__
-#define __GTK_TOOLTIPS_H__
-
-#include <gdk/gdk.h>
-#include <gtk/gtkdata.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define GTK_TOOLTIPS(obj) GTK_CHECK_CAST (obj, gtk_tooltips_get_type (), GtkTooltips)
-#define GTK_TOOLTIPS_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_tooltips_get_type (), GtkTooltipsClass)
-#define GTK_IS_TOOLTIPS(obj) GTK_CHECK_TYPE (obj, gtk_tooltips_get_type ())
-
-typedef struct _GtkTooltips GtkTooltips;
-typedef struct _GtkTooltipsClass GtkTooltipsClass;
-typedef struct _GtkTooltipsData GtkTooltipsData;
-
-struct _GtkTooltipsData
-{
- GtkTooltips *tooltips;
- GtkWidget *widget;
- gchar *tip_text;
- gchar *tip_private;
- GdkFont *font;
- gint width;
- GList *row;
-};
-
-struct _GtkTooltips
-{
- GtkData data;
-
- GtkWidget *tip_window;
- GtkTooltipsData *active_widget;
- GList *widget_list;
-
- GdkGC *gc;
- GdkColor *foreground;
- GdkColor *background;
-
- gint16 delay;
- gint enabled : 1;
- gint timer_active : 1;
- gint timer_tag;
-};
-
-struct _GtkTooltipsClass
-{
- GtkDataClass parent_class;
-};
-
-GtkType gtk_tooltips_get_type (void);
-GtkTooltips* gtk_tooltips_new (void);
-
-void gtk_tooltips_enable (GtkTooltips *tooltips);
-void gtk_tooltips_disable (GtkTooltips *tooltips);
-void gtk_tooltips_set_delay (GtkTooltips *tooltips,
- gint delay);
-void gtk_tooltips_set_tip (GtkTooltips *tooltips,
- GtkWidget *widget,
- const gchar *tip_text,
- const gchar *tip_private);
-void gtk_tooltips_set_colors (GtkTooltips *tooltips,
- GdkColor *background,
- GdkColor *foreground);
-GtkTooltipsData* gtk_tooltips_data_get (GtkWidget *widget);
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_TOOLTIPS_H__ */
diff --git a/gtk/gtktree.c b/gtk/gtktree.c
deleted file mode 100644
index d9be758b7c..0000000000
--- a/gtk/gtktree.c
+++ /dev/null
@@ -1,1187 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtktree.h"
-#include "gtktreeitem.h"
-#include "gtkmain.h"
-#include "gtksignal.h"
-#include "gtklist.h"
-
-enum {
- SELECTION_CHANGED,
- SELECT_CHILD,
- UNSELECT_CHILD,
- LAST_SIGNAL
-};
-
-typedef void (*GtkTreeSignal) (GtkObject *object,
- gpointer arg1,
- gpointer data);
-
-
-static void gtk_tree_class_init (GtkTreeClass *klass);
-static void gtk_tree_init (GtkTree *tree);
-static void gtk_tree_destroy (GtkObject *object);
-static void gtk_tree_map (GtkWidget *widget);
-static void gtk_tree_unmap (GtkWidget *widget);
-static void gtk_tree_realize (GtkWidget *widget);
-static void gtk_tree_draw (GtkWidget *widget,
- GdkRectangle *area);
-static gint gtk_tree_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static gint gtk_tree_motion_notify (GtkWidget *widget,
- GdkEventMotion *event);
-static gint gtk_tree_button_press (GtkWidget *widget,
- GdkEventButton *event);
-static gint gtk_tree_button_release (GtkWidget *widget,
- GdkEventButton *event);
-static void gtk_tree_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_tree_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_tree_add (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_tree_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data);
-
-static void gtk_real_tree_select_child (GtkTree *tree,
- GtkWidget *child);
-static void gtk_real_tree_unselect_child (GtkTree *tree,
- GtkWidget *child);
-
-static void gtk_tree_marshal_signal (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-static GtkContainerClass *parent_class = NULL;
-static guint tree_signals[LAST_SIGNAL] = { 0 };
-
-guint
-gtk_tree_get_type ()
-{
- static guint tree_type = 0;
-
- if (!tree_type)
- {
- GtkTypeInfo tree_info =
- {
- "GtkTree",
- sizeof (GtkTree),
- sizeof (GtkTreeClass),
- (GtkClassInitFunc) gtk_tree_class_init,
- (GtkObjectInitFunc) gtk_tree_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- tree_type = gtk_type_unique (gtk_container_get_type (), &tree_info);
- }
-
- return tree_type;
-}
-
-static void
-gtk_tree_class_init (GtkTreeClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GtkObjectClass*) class;
- widget_class = (GtkWidgetClass*) class;
- container_class = (GtkContainerClass*) class;
-
- parent_class = gtk_type_class (gtk_container_get_type ());
-
- tree_signals[SELECTION_CHANGED] =
- gtk_signal_new ("selection_changed",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkTreeClass, selection_changed),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
- tree_signals[SELECT_CHILD] =
- gtk_signal_new ("select_child",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkTreeClass, select_child),
- gtk_tree_marshal_signal,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_WIDGET);
- tree_signals[UNSELECT_CHILD] =
- gtk_signal_new ("unselect_child",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkTreeClass, unselect_child),
- gtk_tree_marshal_signal,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_WIDGET);
-
- gtk_object_class_add_signals (object_class, tree_signals, LAST_SIGNAL);
-
- object_class->destroy = gtk_tree_destroy;
-
- widget_class->map = gtk_tree_map;
- widget_class->unmap = gtk_tree_unmap;
- widget_class->realize = gtk_tree_realize;
- widget_class->draw = gtk_tree_draw;
- widget_class->expose_event = gtk_tree_expose;
- widget_class->motion_notify_event = gtk_tree_motion_notify;
- widget_class->button_press_event = gtk_tree_button_press;
- widget_class->button_release_event = gtk_tree_button_release;
- widget_class->size_request = gtk_tree_size_request;
- widget_class->size_allocate = gtk_tree_size_allocate;
-
- container_class->add = gtk_tree_add;
- container_class->remove =
- (void (*)(GtkContainer *, GtkWidget *)) gtk_tree_remove_item;
- container_class->foreach = gtk_tree_foreach;
-
- class->selection_changed = NULL;
- class->select_child = gtk_real_tree_select_child;
- class->unselect_child = gtk_real_tree_unselect_child;
-}
-
-static void
-gtk_tree_init (GtkTree *tree)
-{
- tree->children = NULL;
- tree->root_tree = NULL;
- tree->selection = NULL;
- tree->tree_owner = NULL;
- tree->selection_mode = GTK_SELECTION_SINGLE;
- tree->indent_value = 9;
- tree->current_indent = 0;
- tree->level = 0;
- tree->view_mode = GTK_TREE_VIEW_LINE;
- tree->view_line = 1;
-}
-
-GtkWidget*
-gtk_tree_new ()
-{
- return GTK_WIDGET (gtk_type_new (gtk_tree_get_type ()));
-}
-
-void
-gtk_tree_append (GtkTree *tree,
- GtkWidget *child)
-{
-
- g_return_if_fail (tree != NULL);
- g_return_if_fail (GTK_IS_TREE_ITEM (child));
-
- gtk_tree_insert(tree, child, -1);
-}
-
-void
-gtk_tree_prepend (GtkTree *tree,
- GtkWidget *child)
-{
- g_return_if_fail (tree != NULL);
- g_return_if_fail (GTK_IS_TREE_ITEM (child));
-
- gtk_tree_insert(tree, child, 0);
-
-}
-
-void
-gtk_tree_insert (GtkTree *tree,
- GtkWidget *child,
- gint position)
-{
- gint nchildren;
-
- g_return_if_fail (tree != NULL || child != NULL);
- g_return_if_fail (GTK_IS_TREE_ITEM(child));
-
- /* set parent widget to item */
- gtk_widget_set_parent (child, GTK_WIDGET (tree));
-
- if (GTK_WIDGET_VISIBLE (child->parent))
- {
- if (GTK_WIDGET_REALIZED (child->parent) &&
- !GTK_WIDGET_REALIZED (child))
- gtk_widget_realize (child);
-
- if (GTK_WIDGET_MAPPED (child->parent) &&
- !GTK_WIDGET_MAPPED (child))
- gtk_widget_map (child);
- }
-
- nchildren = g_list_length (tree->children);
-
- if ((position < 0) || (position > nchildren))
- position = nchildren;
-
- if (position == nchildren)
- {
- tree->children = g_list_append(tree->children, child);
- }
- else
- {
- tree->children = g_list_insert(tree->children, child, position);
- }
-
- if (GTK_WIDGET_VISIBLE (tree))
- gtk_widget_queue_resize (GTK_WIDGET (tree));
-
-}
-
-static void
-gtk_tree_add (GtkContainer *container,
- GtkWidget *widget)
-{
- GtkTree *tree;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_TREE (container));
- g_return_if_fail (widget != NULL);
-
- tree = GTK_TREE (container);
-
- gtk_widget_set_parent (widget, GTK_WIDGET (container));
- if (GTK_WIDGET_VISIBLE (widget->parent))
- {
- if (GTK_WIDGET_REALIZED (widget->parent) &&
- !GTK_WIDGET_REALIZED (widget))
- gtk_widget_realize (widget);
-
- if (GTK_WIDGET_MAPPED (widget->parent) &&
- !GTK_WIDGET_MAPPED (widget))
- gtk_widget_map (widget);
- }
-
- tree->children = g_list_append (tree->children, widget);
-
- if (!tree->selection && (tree->selection_mode == GTK_SELECTION_BROWSE))
- {
- gtk_tree_select_child (tree, widget);
- }
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (container))
- gtk_widget_queue_resize (widget);
-
-}
-
-static gint
-gtk_tree_button_press (GtkWidget *widget,
- GdkEventButton *event)
-{
- GtkTree *tree;
- GtkWidget *item;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_TREE (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- tree = GTK_TREE (widget);
- item = gtk_get_event_widget ((GdkEvent*) event);
-
- while (!gtk_type_is_a (GTK_WIDGET_TYPE (item), gtk_tree_item_get_type ()))
- item = item->parent;
-
- switch(event->button)
- {
- case 1:
- gtk_tree_select_child (tree, item);
- break;
- case 2:
- if(GTK_TREE_ITEM(item)->subtree) gtk_tree_item_expand(GTK_TREE_ITEM(item));
- break;
- case 3:
- if(GTK_TREE_ITEM(item)->subtree) gtk_tree_item_collapse(GTK_TREE_ITEM(item));
- break;
- }
-
- return TRUE;
-}
-
-static gint
-gtk_tree_button_release (GtkWidget *widget,
- GdkEventButton *event)
-{
- GtkTree *tree;
- GtkWidget *item;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_TREE (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- tree = GTK_TREE (widget);
- item = gtk_get_event_widget ((GdkEvent*) event);
-
- return TRUE;
-}
-
-gint
-gtk_tree_child_position (GtkTree *tree,
- GtkWidget *child)
-{
- GList *children;
- gint pos;
-
-
- g_return_val_if_fail (tree != NULL, -1);
- g_return_val_if_fail (GTK_IS_TREE (tree), -1);
- g_return_val_if_fail (child != NULL, -1);
-
- pos = 0;
- children = tree->children;
-
- while (children)
- {
- if (child == GTK_WIDGET (children->data))
- return pos;
-
- pos += 1;
- children = children->next;
- }
-
-
- return -1;
-}
-
-void
-gtk_tree_clear_items (GtkTree *tree,
- gint start,
- gint end)
-{
- g_return_if_fail (tree != NULL);
- g_return_if_fail (GTK_IS_TREE (tree));
-
-}
-
-static void
-gtk_tree_destroy (GtkObject *object)
-{
- GtkTree *tree;
- GtkWidget *child;
- GList *children;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_TREE (object));
-
- tree = GTK_TREE (object);
-
- children = tree->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- gtk_widget_ref (child);
- gtk_widget_unparent (child);
- gtk_widget_destroy (child);
- gtk_widget_unref (child);
- }
-
- g_list_free (tree->children);
- tree->children = NULL;
-
- if (tree->root_tree == tree)
- {
- GList *node;
- for (node = tree->selection; node; node = node->next)
- gtk_widget_unref ((GtkWidget *)node->data);
- g_list_free (tree->selection);
- tree->selection = NULL;
- }
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-static void
-gtk_tree_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkTree *tree;
- GtkWidget *subtree;
- GtkWidget *child;
- GdkRectangle child_area;
- GList *children;
-
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TREE (widget));
- g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- tree = GTK_TREE (widget);
-
- children = tree->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (gtk_widget_intersect (child, area, &child_area))
- gtk_widget_draw (child, &child_area);
-
- if((subtree = GTK_TREE_ITEM(child)->subtree) &&
- GTK_WIDGET_VISIBLE(subtree) &&
- gtk_widget_intersect (subtree, area, &child_area))
- gtk_widget_draw (subtree, &child_area);
- }
- }
-
-}
-
-static gint
-gtk_tree_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkTree *tree;
- GtkWidget *child;
- GdkEventExpose child_event;
- GList *children;
-
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_TREE (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- tree = GTK_TREE (widget);
-
- child_event = *event;
-
- children = tree->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_NO_WINDOW (child) &&
- gtk_widget_intersect (child, &event->area, &child_event.area))
- gtk_widget_event (child, (GdkEvent*) &child_event);
- }
- }
-
-
- return FALSE;
-}
-
-static void
-gtk_tree_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
-{
- GtkTree *tree;
- GtkWidget *child;
- GList *children;
-
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_TREE (container));
- g_return_if_fail (callback != NULL);
-
- tree = GTK_TREE (container);
- children = tree->children;
-
- while (children)
- {
- child = children->data;
- children = children->next;
-
- (* callback) (child, callback_data);
-
- if(GTK_TREE_ITEM(child)->subtree)
- (* callback)(GTK_TREE_ITEM(child)->subtree, callback_data);
- }
-}
-
-static void
-gtk_tree_map (GtkWidget *widget)
-{
- GtkTree *tree;
- GtkWidget *child;
- GList *children;
-
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TREE (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
- tree = GTK_TREE (widget);
-
- gdk_window_show (widget->window);
-
- if(GTK_IS_TREE(widget->parent))
- {
- /* set root tree for this tree */
- tree->root_tree = GTK_TREE(widget->parent)->root_tree;
-
- tree->level = GTK_TREE(GTK_WIDGET(tree)->parent)->level+1;
- tree->indent_value = GTK_TREE(GTK_WIDGET(tree)->parent)->indent_value;
- tree->current_indent = GTK_TREE(GTK_WIDGET(tree)->parent)->current_indent +
- tree->indent_value;
- tree->view_mode = GTK_TREE(GTK_WIDGET(tree)->parent)->view_mode;
- tree->view_line = GTK_TREE(GTK_WIDGET(tree)->parent)->view_line;
- }
- else
- tree->root_tree = tree;
-
- children = tree->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child) &&
- !GTK_WIDGET_MAPPED (child))
- gtk_widget_map (child);
-
- if ((child = GTK_WIDGET(GTK_TREE_ITEM(child)->subtree)) &&
- GTK_WIDGET_VISIBLE (child) &&
- !GTK_WIDGET_MAPPED (child))
- gtk_widget_map (child);
- }
-}
-
-static void
-gtk_tree_marshal_signal (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkTreeSignal rfunc;
-
- rfunc = (GtkTreeSignal) func;
-
- (* rfunc) (object, GTK_VALUE_OBJECT (args[0]), func_data);
-}
-
-static gint
-gtk_tree_motion_notify (GtkWidget *widget,
- GdkEventMotion *event)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_TREE (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
-#ifdef TREE_DEBUG
- g_print("gtk_tree_motion_notify\n");
-#endif /* TREE_DEBUG */
-
- return FALSE;
-}
-
-static void
-gtk_tree_realize (GtkWidget *widget)
-{
- GdkWindowAttr attributes;
- gint attributes_mask;
-
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TREE (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = GDK_EXPOSURE_MASK;
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
- gdk_window_set_background (widget->window,
- &widget->style->base[GTK_STATE_NORMAL]);
-
-}
-
-void
-gtk_tree_remove_item (GtkTree *container,
- GtkWidget *widget)
-{
- GList *item_list;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_TREE (container));
- g_return_if_fail (widget != NULL);
- g_return_if_fail (container == GTK_TREE (widget->parent));
-
- item_list = g_list_alloc ();
- item_list->data = widget;
-
- gtk_tree_remove_items (GTK_TREE (container), item_list);
-
- g_list_free (item_list);
-}
-
-/* used by gtk_tree_remove_items to make the function independant of
- order in list of items to remove.
- Sort item bu depth in tree */
-static gint
-gtk_tree_sort_item_by_depth(GtkWidget* a, GtkWidget* b)
-{
- if((GTK_TREE(a->parent)->level) < (GTK_TREE(b->parent)->level))
- return 1;
- if((GTK_TREE(a->parent)->level) > (GTK_TREE(b->parent)->level))
- return -1;
-
- return 0;
-}
-
-void
-gtk_tree_remove_items (GtkTree *tree,
- GList *items)
-{
- GtkWidget *widget;
- GList *selected_widgets;
- GList *tmp_list;
- GList *sorted_list;
- GtkTree *real_tree;
- GtkTree *root_tree;
-
- g_return_if_fail (tree != NULL);
- g_return_if_fail (GTK_IS_TREE (tree));
-
-#ifdef TREE_DEBUG
- g_print("+ gtk_tree_remove_items [ tree %#x items list %#x ]\n", (int)tree, (int)items);
-#endif /* TREE_DEBUG */
-
- root_tree = GTK_TREE(GTK_TREE_ROOT_TREE(tree));
- tmp_list = items;
- selected_widgets = NULL;
- sorted_list = NULL;
- widget = NULL;
-
-#ifdef TREE_DEBUG
- g_print("* sort list by depth\n");
-#endif /* TREE_DEBUG */
- while(tmp_list)
- {
-#ifdef TREE_DEBUG
- g_print("* item [%#x] depth [%d]\n",
- (int)tmp_list->data,
- (int)GTK_TREE(GTK_WIDGET(tmp_list->data)->parent)->level);
-#endif /* TREE_DEBUG */
-
- sorted_list = g_list_insert_sorted(sorted_list,
- tmp_list->data,
- (GCompareFunc)gtk_tree_sort_item_by_depth);
- tmp_list = g_list_next(tmp_list);
- }
-
-#ifdef TREE_DEBUG
- /* print sorted list */
- g_print("* sorted list result\n");
- tmp_list = sorted_list;
- while(tmp_list)
- {
- g_print("* item [%#x] depth [%d]\n",
- (int)tmp_list->data,
- (int)GTK_TREE(GTK_WIDGET(tmp_list->data)->parent)->level);
- tmp_list = g_list_next(tmp_list);
- }
-#endif /* TREE_DEBUG */
-
-#ifdef TREE_DEBUG
- g_print("* scan sorted list\n");
-#endif /* TREE_DEBUG */
- tmp_list = sorted_list;
- while (tmp_list)
- {
- widget = tmp_list->data;
- tmp_list = tmp_list->next;
-
-#ifdef TREE_DEBUG
- g_print("* item [%#x] subtree [%#x]\n",
- (int)widget, (int)GTK_TREE_ITEM_SUBTREE(widget));
-#endif /* TREE_DEBUG */
-
- /* get real owner of this widget */
- real_tree = GTK_TREE(widget->parent);
-#ifdef TREE_DEBUG
- g_print("* subtree having this widget [%#x]\n", (int)real_tree);
-#endif /* TREE_DEBUG */
-
-
- if (widget->state == GTK_STATE_SELECTED)
- {
- selected_widgets = g_list_prepend (selected_widgets, widget);
-#ifdef TREE_DEBUG
- g_print("* selected widget - adding it in selected list [%#x]\n",
- (int)selected_widgets);
-#endif /* TREE_DEBUG */
- }
-
- /* remove this item of his real parent */
-#ifdef TREE_DEBUG
- g_print("* remove widget of his owner tree\n");
-#endif /* TREE_DEBUG */
- real_tree->children = g_list_remove (real_tree->children, widget);
-
- /* remove subtree associate at this item if it exist */
- if(GTK_TREE_ITEM(widget)->subtree)
- {
-#ifdef TREE_DEBUG
- g_print("* remove subtree associate at this item [%#x]\n",
- (int) GTK_TREE_ITEM(widget)->subtree);
-#endif /* TREE_DEBUG */
- if (GTK_WIDGET_MAPPED (GTK_TREE_ITEM(widget)->subtree))
- gtk_widget_unmap (GTK_TREE_ITEM(widget)->subtree);
-
- gtk_widget_unparent (GTK_TREE_ITEM(widget)->subtree);
- GTK_TREE_ITEM(widget)->subtree = NULL;
- }
-
- /* really remove widget for this item */
-#ifdef TREE_DEBUG
- g_print("* unmap and unparent widget [%#x]\n", (int)widget);
-#endif /* TREE_DEBUG */
- if (GTK_WIDGET_MAPPED (widget))
- gtk_widget_unmap (widget);
-
- gtk_widget_unparent (widget);
-
- /* delete subtree if there is no children in it */
- if(real_tree->children == NULL &&
- real_tree != root_tree)
- {
-#ifdef TREE_DEBUG
- g_print("* owner tree don't have children ... destroy it\n");
-#endif /* TREE_DEBUG */
- gtk_tree_item_remove_subtree(GTK_TREE_ITEM(real_tree->tree_owner));
- }
-
-#ifdef TREE_DEBUG
- g_print("* next item in list\n");
-#endif /* TREE_DEBUG */
- }
-
- if (selected_widgets)
- {
-#ifdef TREE_DEBUG
- g_print("* scan selected item list\n");
-#endif /* TREE_DEBUG */
- tmp_list = selected_widgets;
- while (tmp_list)
- {
- widget = tmp_list->data;
- tmp_list = tmp_list->next;
-
-#ifdef TREE_DEBUG
- g_print("* widget [%#x] subtree [%#x]\n",
- (int)widget, (int)GTK_TREE_ITEM_SUBTREE(widget));
-#endif /* TREE_DEBUG */
-
- /* remove widget of selection */
- root_tree->selection = g_list_remove (root_tree->selection, widget);
-
- /* unref it to authorize is destruction */
- gtk_widget_unref (widget);
- }
-
- /* emit only one selection_changed signal */
- gtk_signal_emit (GTK_OBJECT (root_tree),
- tree_signals[SELECTION_CHANGED]);
- }
-
-#ifdef TREE_DEBUG
- g_print("* free selected_widgets list\n");
-#endif /* TREE_DEBUG */
- g_list_free (selected_widgets);
- g_list_free (sorted_list);
-
- if (root_tree->children && !root_tree->selection &&
- (root_tree->selection_mode == GTK_SELECTION_BROWSE))
- {
-#ifdef TREE_DEBUG
- g_print("* BROWSE mode, select another item\n");
-#endif /* TREE_DEBUG */
- widget = root_tree->children->data;
- gtk_tree_select_child (root_tree, widget);
- }
-
- if (GTK_WIDGET_VISIBLE (root_tree))
- {
-#ifdef TREE_DEBUG
- g_print("* query queue resizing for root_tree\n");
-#endif /* TREE_DEBUG */
- gtk_widget_queue_resize (GTK_WIDGET (root_tree));
- }
-}
-
-void
-gtk_tree_select_child (GtkTree *tree,
- GtkWidget *child)
-{
-
- gtk_signal_emit (GTK_OBJECT (tree), tree_signals[SELECT_CHILD], child);
-
-}
-
-void
-gtk_tree_select_item (GtkTree *tree,
- gint item)
-{
- GList *tmp_list;
-
-
- g_return_if_fail (tree != NULL);
- g_return_if_fail (GTK_IS_TREE (tree));
-
- tmp_list = g_list_nth (tree->children, item);
- if (tmp_list)
- gtk_tree_select_child (tree, GTK_WIDGET (tmp_list->data));
-
-}
-
-static void
-gtk_tree_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkTree *tree;
- GtkWidget *child, *subtree;
- GtkAllocation child_allocation;
- GList *children;
-
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TREE (widget));
- g_return_if_fail (allocation != NULL);
-
- tree = GTK_TREE (widget);
-
- widget->allocation = *allocation;
- if (GTK_WIDGET_REALIZED (widget))
- gdk_window_move_resize (widget->window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
-
- if (tree->children)
- {
- child_allocation.x = GTK_CONTAINER (tree)->border_width;
- child_allocation.y = GTK_CONTAINER (tree)->border_width;
- child_allocation.width = allocation->width - child_allocation.x * 2;
-
- children = tree->children;
-
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child))
- {
- child_allocation.height = child->requisition.height;
-
- gtk_widget_size_allocate (child, &child_allocation);
-
- child_allocation.y += child_allocation.height;
-
- if((subtree = GTK_TREE_ITEM(child)->subtree))
- if(GTK_WIDGET_VISIBLE (subtree))
- {
- child_allocation.height = subtree->requisition.height;
- gtk_widget_size_allocate (subtree, &child_allocation);
- child_allocation.y += child_allocation.height;
- }
- }
- }
- }
-
-}
-
-static void
-gtk_tree_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkTree *tree;
- GtkWidget *child, *subtree;
- GList *children;
-
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TREE (widget));
- g_return_if_fail (requisition != NULL);
-
- tree = GTK_TREE (widget);
- requisition->width = 0;
- requisition->height = 0;
-
- children = tree->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child))
- {
- gtk_widget_size_request (child, &child->requisition);
-
- requisition->width = MAX (requisition->width, child->requisition.width);
- requisition->height += child->requisition.height;
-
- if((subtree = GTK_TREE_ITEM(child)->subtree) &&
- GTK_WIDGET_VISIBLE (subtree))
- {
- gtk_widget_size_request (subtree, &subtree->requisition);
-
- requisition->width = MAX (requisition->width,
- subtree->requisition.width);
-
- requisition->height += subtree->requisition.height;
- }
- }
- }
-
- requisition->width += GTK_CONTAINER (tree)->border_width * 2;
- requisition->height += GTK_CONTAINER (tree)->border_width * 2;
-
- requisition->width = MAX (requisition->width, 1);
- requisition->height = MAX (requisition->height, 1);
-
-}
-
-static void
-gtk_tree_unmap (GtkWidget *widget)
-{
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TREE (widget));
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
- gdk_window_hide (widget->window);
-
-}
-
-void
-gtk_tree_unselect_child (GtkTree *tree,
- GtkWidget *child)
-{
- gtk_signal_emit (GTK_OBJECT (tree), tree_signals[UNSELECT_CHILD], child);
-}
-
-void
-gtk_tree_unselect_item (GtkTree *tree,
- gint item)
-{
- GList *tmp_list;
-
-
- g_return_if_fail (tree != NULL);
- g_return_if_fail (GTK_IS_TREE (tree));
-
- tmp_list = g_list_nth (tree->children, item);
- if (tmp_list)
- gtk_tree_unselect_child (tree, GTK_WIDGET (tmp_list->data));
-
-}
-
-static void
-gtk_real_tree_select_child (GtkTree *tree,
- GtkWidget *child)
-{
- GList *selection, *root_selection;
- GList *tmp_list;
- GtkWidget *tmp_item;
-
-
- g_return_if_fail (tree != NULL);
- g_return_if_fail (GTK_IS_TREE (tree));
- g_return_if_fail (child != NULL);
- g_return_if_fail (GTK_IS_TREE_ITEM (child));
-
- root_selection = tree->root_tree->selection;
-
- switch (tree->root_tree->selection_mode)
- {
- case GTK_SELECTION_SINGLE:
-
- selection = root_selection;
-
- /* remove old selection list */
- while (selection)
- {
- tmp_item = selection->data;
-
- if (tmp_item != child)
- {
- gtk_tree_item_deselect (GTK_TREE_ITEM (tmp_item));
-
- tmp_list = selection;
- selection = selection->next;
-
- root_selection = g_list_remove_link (root_selection, tmp_list);
- gtk_widget_unref (tmp_item);
-
- g_list_free (tmp_list);
- }
- else
- selection = selection->next;
- }
-
- if (child->state == GTK_STATE_NORMAL)
- {
- gtk_tree_item_select (GTK_TREE_ITEM (child));
- root_selection = g_list_prepend (root_selection, child);
- gtk_widget_ref (child);
- }
- else if (child->state == GTK_STATE_SELECTED)
- {
- gtk_tree_item_deselect (GTK_TREE_ITEM (child));
- root_selection = g_list_remove (root_selection, child);
- gtk_widget_unref (child);
- }
-
- tree->root_tree->selection = root_selection;
-
- gtk_signal_emit (GTK_OBJECT (tree->root_tree),
- tree_signals[SELECTION_CHANGED]);
- break;
-
-
- case GTK_SELECTION_BROWSE:
- selection = root_selection;
-
- while (selection)
- {
- tmp_item = selection->data;
-
- if (tmp_item != child)
- {
- gtk_tree_item_deselect (GTK_TREE_ITEM (tmp_item));
-
- tmp_list = selection;
- selection = selection->next;
-
- root_selection = g_list_remove_link (root_selection, tmp_list);
- gtk_widget_unref (tmp_item);
-
- g_list_free (tmp_list);
- }
- else
- selection = selection->next;
- }
-
- tree->root_tree->selection = root_selection;
-
- if (child->state == GTK_STATE_NORMAL)
- {
- gtk_tree_item_select (GTK_TREE_ITEM (child));
- root_selection = g_list_prepend (root_selection, child);
- gtk_widget_ref (child);
- tree->root_tree->selection = root_selection;
- gtk_signal_emit (GTK_OBJECT (tree->root_tree),
- tree_signals[SELECTION_CHANGED]);
- }
- break;
-
- case GTK_SELECTION_MULTIPLE:
- if (child->state == GTK_STATE_NORMAL)
- {
- gtk_tree_item_select (GTK_TREE_ITEM (child));
- root_selection = g_list_prepend (root_selection, child);
- gtk_widget_ref (child);
- tree->root_tree->selection = root_selection;
- gtk_signal_emit (GTK_OBJECT (tree->root_tree),
- tree_signals[SELECTION_CHANGED]);
- }
- else if (child->state == GTK_STATE_SELECTED)
- {
- gtk_tree_item_deselect (GTK_TREE_ITEM (child));
- root_selection = g_list_remove (root_selection, child);
- gtk_widget_unref (child);
- tree->root_tree->selection = root_selection;
- gtk_signal_emit (GTK_OBJECT (tree->root_tree),
- tree_signals[SELECTION_CHANGED]);
- }
- break;
-
- case GTK_SELECTION_EXTENDED:
- break;
- }
-}
-
-static void
-gtk_real_tree_unselect_child (GtkTree *tree,
- GtkWidget *child)
-{
-
- g_return_if_fail (tree != NULL);
- g_return_if_fail (GTK_IS_TREE (tree));
- g_return_if_fail (child != NULL);
- g_return_if_fail (GTK_IS_TREE_ITEM (child));
-
- switch (tree->selection_mode)
- {
- case GTK_SELECTION_SINGLE:
- case GTK_SELECTION_MULTIPLE:
- case GTK_SELECTION_BROWSE:
- if (child->state == GTK_STATE_SELECTED)
- {
- GtkTree* root_tree = GTK_TREE_ROOT_TREE(tree);
- gtk_tree_item_deselect (GTK_TREE_ITEM (child));
- root_tree->selection = g_list_remove (root_tree->selection, child);
- gtk_widget_unref (child);
- gtk_signal_emit (GTK_OBJECT (tree->root_tree),
- tree_signals[SELECTION_CHANGED]);
- }
- break;
-
- case GTK_SELECTION_EXTENDED:
- break;
- }
-}
-
-void
-gtk_tree_set_selection_mode (GtkTree *tree,
- GtkSelectionMode mode)
-{
- g_return_if_fail (tree != NULL);
- g_return_if_fail (GTK_IS_TREE (tree));
-
- tree->selection_mode = mode;
-}
-
-void
-gtk_tree_set_view_mode (GtkTree *tree,
- GtkTreeViewMode mode)
-{
- g_return_if_fail (tree != NULL);
- g_return_if_fail (GTK_IS_TREE (tree));
-
- tree->view_mode = mode;
-}
-
-void
-gtk_tree_set_view_lines (GtkTree *tree,
- guint flag)
-{
- g_return_if_fail (tree != NULL);
- g_return_if_fail (GTK_IS_TREE (tree));
-
- tree->view_line = flag;
-}
diff --git a/gtk/gtktree.h b/gtk/gtktree.h
deleted file mode 100644
index 94c849b465..0000000000
--- a/gtk/gtktree.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_TREE_H__
-#define __GTK_TREE_H__
-
-/* set this flag to enable tree debugging output */
-/* #define TREE_DEBUG */
-
-#include <gdk/gdk.h>
-#include <gtk/gtkcontainer.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_TREE(obj) GTK_CHECK_CAST (obj, gtk_tree_get_type (), GtkTree)
-#define GTK_TREE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_tree_get_type (), GtkTreeClass)
-#define GTK_IS_TREE(obj) GTK_CHECK_TYPE (obj, gtk_tree_get_type ())
-
-#define GTK_IS_ROOT_TREE(obj) ((GtkObject*) GTK_TREE(obj)->root_tree == (GtkObject*)obj)
-#define GTK_TREE_ROOT_TREE(obj) (GTK_TREE(obj)->root_tree ? GTK_TREE(obj)->root_tree : GTK_TREE(obj))
-#define GTK_TREE_SELECTION(obj) (GTK_TREE_ROOT_TREE(obj)->selection)
-
-typedef enum
-{
- GTK_TREE_VIEW_LINE, /* default view mode */
- GTK_TREE_VIEW_ITEM
-} GtkTreeViewMode;
-
-typedef struct _GtkTree GtkTree;
-typedef struct _GtkTreeClass GtkTreeClass;
-
-struct _GtkTree
-{
- GtkContainer container;
-
- GList *children;
-
- GtkTree* root_tree; /* owner of selection list */
- GtkWidget* tree_owner;
- GList *selection;
- guint level;
- guint indent_value;
- guint current_indent;
- guint selection_mode : 2;
- guint view_mode : 1;
- guint view_line : 1;
-};
-
-struct _GtkTreeClass
-{
- GtkContainerClass parent_class;
-
- void (* selection_changed) (GtkTree *tree);
- void (* select_child) (GtkTree *tree,
- GtkWidget *child);
- void (* unselect_child) (GtkTree *tree,
- GtkWidget *child);
-};
-
-
-guint gtk_tree_get_type (void);
-GtkWidget* gtk_tree_new (void);
-void gtk_tree_append (GtkTree *tree,
- GtkWidget *child);
-void gtk_tree_prepend (GtkTree *tree,
- GtkWidget *child);
-void gtk_tree_insert (GtkTree *tree,
- GtkWidget *child,
- gint position);
-void gtk_tree_remove_items (GtkTree *tree,
- GList *items);
-void gtk_tree_clear_items (GtkTree *tree,
- gint start,
- gint end);
-void gtk_tree_select_item (GtkTree *tree,
- gint item);
-void gtk_tree_unselect_item (GtkTree *tree,
- gint item);
-void gtk_tree_select_child (GtkTree *tree,
- GtkWidget *child);
-void gtk_tree_unselect_child (GtkTree *tree,
- GtkWidget *child);
-gint gtk_tree_child_position (GtkTree *tree,
- GtkWidget *child);
-void gtk_tree_set_selection_mode (GtkTree *tree,
- GtkSelectionMode mode);
-void gtk_tree_set_view_mode (GtkTree *tree,
- GtkTreeViewMode mode);
-void gtk_tree_set_view_lines (GtkTree *tree,
- guint flag);
-
-/* deprecated function, use gtk_container_remove instead.
- */
-void gtk_tree_remove_item (GtkTree *tree,
- GtkWidget *child);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_TREE_H__ */
diff --git a/gtk/gtktreeitem.c b/gtk/gtktreeitem.c
deleted file mode 100644
index fcb039f608..0000000000
--- a/gtk/gtktreeitem.c
+++ /dev/null
@@ -1,1069 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtklabel.h"
-#include "gtktree.h"
-#include "gtktreeitem.h"
-#include "gtkeventbox.h"
-#include "gtkpixmap.h"
-#include "gtkmain.h"
-#include "gtksignal.h"
-
-#include "tree_plus.xpm"
-#include "tree_minus.xpm"
-
-#define DEFAULT_DELTA 9
-
-enum {
- COLLAPSE_TREE,
- EXPAND_TREE,
- LAST_SIGNAL
-};
-
-typedef struct _GtkTreePixmaps GtkTreePixmaps;
-
-struct _GtkTreePixmaps {
- gint refcount;
- GdkColormap *colormap;
-
- GdkPixmap *pixmap_plus;
- GdkPixmap *pixmap_minus;
- GdkBitmap *mask_plus;
- GdkBitmap *mask_minus;
-};
-
-static GList *pixmaps = NULL;
-
-typedef void (*GtkTreeItemSignal) (GtkObject *object,
- gpointer arg1,
- gpointer data);
-
-static void gtk_tree_item_class_init (GtkTreeItemClass *klass);
-static void gtk_tree_item_init (GtkTreeItem *tree_item);
-static void gtk_tree_item_realize (GtkWidget *widget);
-static void gtk_tree_item_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_tree_item_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_tree_item_draw (GtkWidget *widget,
- GdkRectangle *area);
-static void gtk_tree_item_draw_focus (GtkWidget *widget);
-static gint gtk_tree_item_button_press (GtkWidget *widget,
- GdkEventButton *event);
-static gint gtk_tree_item_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static gint gtk_tree_item_focus_in (GtkWidget *widget,
- GdkEventFocus *event);
-static gint gtk_tree_item_focus_out (GtkWidget *widget,
- GdkEventFocus *event);
-static void gtk_real_tree_item_select (GtkItem *item);
-static void gtk_real_tree_item_deselect (GtkItem *item);
-static void gtk_real_tree_item_toggle (GtkItem *item);
-static void gtk_real_tree_item_expand (GtkTreeItem *item);
-static void gtk_real_tree_item_collapse (GtkTreeItem *item);
-static void gtk_real_tree_item_expand (GtkTreeItem *item);
-static void gtk_real_tree_item_collapse (GtkTreeItem *item);
-static void gtk_tree_item_destroy (GtkObject *object);
-static void gtk_tree_item_subtree_button_click (GtkWidget *widget);
-static void gtk_tree_item_subtree_button_changed_state (GtkWidget *widget);
-
-static void gtk_tree_item_map(GtkWidget*);
-static void gtk_tree_item_unmap(GtkWidget*);
-
-static void gtk_tree_item_add_pixmaps (GtkTreeItem *tree_item);
-static void gtk_tree_item_remove_pixmaps (GtkTreeItem *tree_item);
-
-static GtkItemClass *parent_class = NULL;
-static GtkContainerClass *container_class = NULL;
-static guint tree_item_signals[LAST_SIGNAL] = { 0 };
-
-guint
-gtk_tree_item_get_type ()
-{
- static guint tree_item_type = 0;
-
- if (!tree_item_type)
- {
- GtkTypeInfo tree_item_info =
- {
- "GtkTreeItem",
- sizeof (GtkTreeItem),
- sizeof (GtkTreeItemClass),
- (GtkClassInitFunc) gtk_tree_item_class_init,
- (GtkObjectInitFunc) gtk_tree_item_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- tree_item_type = gtk_type_unique (gtk_item_get_type (), &tree_item_info);
- }
-
- return tree_item_type;
-}
-
-static void
-gtk_tree_item_class_init (GtkTreeItemClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkItemClass *item_class;
-
- object_class = (GtkObjectClass*) class;
- widget_class = (GtkWidgetClass*) class;
- item_class = (GtkItemClass*) class;
- container_class = (GtkContainerClass*) class;
-
- parent_class = gtk_type_class (gtk_item_get_type ());
-
- tree_item_signals[EXPAND_TREE] =
- gtk_signal_new ("expand",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkTreeItemClass, expand),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
- tree_item_signals[COLLAPSE_TREE] =
- gtk_signal_new ("collapse",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkTreeItemClass, collapse),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, tree_item_signals, LAST_SIGNAL);
-
- object_class->destroy = gtk_tree_item_destroy;
-
- widget_class->realize = gtk_tree_item_realize;
- widget_class->size_request = gtk_tree_item_size_request;
- widget_class->size_allocate = gtk_tree_item_size_allocate;
- widget_class->draw = gtk_tree_item_draw;
- widget_class->draw_focus = gtk_tree_item_draw_focus;
- widget_class->button_press_event = gtk_tree_item_button_press;
- widget_class->expose_event = gtk_tree_item_expose;
- widget_class->focus_in_event = gtk_tree_item_focus_in;
- widget_class->focus_out_event = gtk_tree_item_focus_out;
- widget_class->map = gtk_tree_item_map;
- widget_class->unmap = gtk_tree_item_unmap;
-
- item_class->select = gtk_real_tree_item_select;
- item_class->deselect = gtk_real_tree_item_deselect;
- item_class->toggle = gtk_real_tree_item_toggle;
-
- class->expand = gtk_real_tree_item_expand;
- class->collapse = gtk_real_tree_item_collapse;
-
- container_class = (GtkContainerClass*) parent_class;
-}
-
-/* callback for event box mouse event */
-static void
-gtk_tree_item_subtree_button_click (GtkWidget *widget)
-{
- GtkTreeItem* item;
-
- item = (GtkTreeItem*) gtk_object_get_user_data(GTK_OBJECT(widget));
- if(!GTK_WIDGET_IS_SENSITIVE(item))
- return;
-
- if(item->expanded)
- gtk_tree_item_collapse(item);
- else
- gtk_tree_item_expand(item);
-}
-
-/* callback for event box state changed */
-static void
-gtk_tree_item_subtree_button_changed_state(GtkWidget *w)
-{
- if(GTK_WIDGET_VISIBLE (w)) {
-
- if (w->state == GTK_STATE_NORMAL)
- gdk_window_set_background (w->window, &w->style->base[w->state]);
- else
- gdk_window_set_background (w->window, &w->style->bg[w->state]);
-
- if (GTK_WIDGET_DRAWABLE(w))
- gdk_window_clear_area (w->window, 0, 0,
- w->allocation.width, w->allocation.height);
- }
-}
-
-static void
-gtk_tree_item_init (GtkTreeItem *tree_item)
-{
- GtkWidget *eventbox, *pixmapwid;
-
- tree_item->expanded = FALSE;
- tree_item->subtree = NULL;
- GTK_WIDGET_SET_FLAGS (tree_item, GTK_CAN_FOCUS);
-
- /* create an event box containing one pixmaps */
- eventbox = gtk_event_box_new();
- gtk_widget_set_events (eventbox, GDK_BUTTON_PRESS_MASK);
- gtk_signal_connect(GTK_OBJECT(eventbox), "state_changed",
- (GtkSignalFunc)gtk_tree_item_subtree_button_changed_state,
- (gpointer)NULL);
- gtk_signal_connect(GTK_OBJECT(eventbox), "realize",
- (GtkSignalFunc)gtk_tree_item_subtree_button_changed_state,
- (gpointer)NULL);
- gtk_signal_connect(GTK_OBJECT(eventbox), "button_press_event",
- (GtkSignalFunc)gtk_tree_item_subtree_button_click,
- (gpointer)NULL);
- gtk_object_set_user_data(GTK_OBJECT(eventbox), tree_item);
- tree_item->pixmaps_box = eventbox;
-
- /* create pixmap for button '+' */
- pixmapwid = gtk_type_new (gtk_pixmap_get_type ());
- if (!tree_item->expanded)
- gtk_container_add (GTK_CONTAINER (eventbox), pixmapwid);
- gtk_widget_show (pixmapwid);
- tree_item->plus_pix_widget = pixmapwid;
- gtk_widget_ref (tree_item->plus_pix_widget);
- gtk_object_sink (GTK_OBJECT (tree_item->plus_pix_widget));
-
- /* create pixmap for button '-' */
- pixmapwid = gtk_type_new (gtk_pixmap_get_type ());
- if (tree_item->expanded)
- gtk_container_add (GTK_CONTAINER (eventbox), pixmapwid);
- gtk_widget_show (pixmapwid);
- tree_item->minus_pix_widget = pixmapwid;
- gtk_widget_ref (tree_item->minus_pix_widget);
- gtk_object_sink (GTK_OBJECT (tree_item->minus_pix_widget));
-
- gtk_widget_set_parent (eventbox, GTK_WIDGET (tree_item));
-}
-
-
-GtkWidget*
-gtk_tree_item_new ()
-{
- GtkWidget *tree_item;
-
- tree_item = GTK_WIDGET (gtk_type_new (gtk_tree_item_get_type ()));
-
- return tree_item;
-}
-
-GtkWidget*
-gtk_tree_item_new_with_label (gchar *label)
-{
- GtkWidget *tree_item;
- GtkWidget *label_widget;
-
-
- tree_item = gtk_tree_item_new ();
- label_widget = gtk_label_new (label);
- gtk_misc_set_alignment (GTK_MISC (label_widget), 0.0, 0.5);
-
- gtk_container_add (GTK_CONTAINER (tree_item), label_widget);
- gtk_widget_show (label_widget);
-
-
- return tree_item;
-}
-
-void
-gtk_tree_item_set_subtree (GtkTreeItem *tree_item,
- GtkWidget *subtree)
-{
- g_return_if_fail (tree_item != NULL);
- g_return_if_fail (GTK_IS_TREE_ITEM (tree_item));
-
- if(tree_item->subtree) {
- g_warning("there is already a subtree for this tree item\n");
- return;
- }
-
- tree_item->subtree = subtree;
- GTK_TREE(subtree)->tree_owner = GTK_WIDGET(tree_item);
-
- /* set root tree for selection list */
- GTK_TREE(subtree)->root_tree = GTK_TREE(GTK_WIDGET(tree_item)->parent)->root_tree;
-
- /* show subtree button */
- if (tree_item->pixmaps_box)
- gtk_widget_show(tree_item->pixmaps_box);
-
- /* set parent widget */
- gtk_widget_set_parent(subtree, GTK_WIDGET(tree_item)->parent);
-
- if(GTK_WIDGET_VISIBLE(GTK_WIDGET(tree_item)))
- {
- if(GTK_WIDGET_REALIZED (GTK_WIDGET(tree_item)) &&
- !GTK_WIDGET_REALIZED (GTK_WIDGET(subtree)))
- gtk_widget_realize (GTK_WIDGET(subtree));
-
- if(GTK_WIDGET_MAPPED (GTK_WIDGET(tree_item)) &&
- !GTK_WIDGET_MAPPED (GTK_WIDGET(subtree)))
- gtk_widget_map (GTK_WIDGET(subtree));
- }
-
- if(tree_item->expanded)
- gtk_widget_show(subtree);
- else
- gtk_widget_hide(subtree);
-
- if (GTK_WIDGET_VISIBLE (tree_item) && GTK_WIDGET_VISIBLE (tree_item))
- gtk_widget_queue_resize (GTK_WIDGET(tree_item));
-
-}
-
-void
-gtk_tree_item_select (GtkTreeItem *tree_item)
-{
-
- gtk_item_select (GTK_ITEM (tree_item));
-
-}
-
-void
-gtk_tree_item_deselect (GtkTreeItem *tree_item)
-{
-
- gtk_item_deselect (GTK_ITEM (tree_item));
-
-}
-
-void
-gtk_tree_item_expand (GtkTreeItem *tree_item)
-{
-
- gtk_signal_emit (GTK_OBJECT (tree_item), tree_item_signals[EXPAND_TREE], NULL);
-
-}
-
-void
-gtk_tree_item_collapse (GtkTreeItem *tree_item)
-{
-
- gtk_signal_emit (GTK_OBJECT (tree_item), tree_item_signals[COLLAPSE_TREE], NULL);
-
-}
-
-static void
-gtk_tree_item_add_pixmaps (GtkTreeItem *tree_item)
-{
- GList *tmp_list;
- GdkColormap *colormap;
- GtkTreePixmaps *pixmap_node = NULL;
-
- if (tree_item->pixmaps)
- return;
-
- colormap = gtk_widget_get_colormap (GTK_WIDGET (tree_item));
-
- tmp_list = pixmaps;
- while (tmp_list)
- {
- pixmap_node = (GtkTreePixmaps *)tmp_list->data;
-
- if (pixmap_node->colormap == colormap)
- break;
-
- tmp_list = tmp_list->next;
- }
-
- if (tmp_list)
- {
- pixmap_node->refcount++;
- tree_item->pixmaps = tmp_list;
- }
- else
- {
- pixmap_node = g_new (GtkTreePixmaps, 1);
-
- pixmap_node->colormap = colormap;
- gdk_colormap_ref (colormap);
-
- pixmap_node->refcount = 1;
-
- /* create pixmaps for plus icon */
- pixmap_node->pixmap_plus =
- gdk_pixmap_create_from_xpm_d (GTK_WIDGET (tree_item)->window,
- &pixmap_node->mask_plus,
- NULL,
- tree_plus);
-
- /* create pixmaps for minus icon */
- pixmap_node->pixmap_minus =
- gdk_pixmap_create_from_xpm_d (GTK_WIDGET (tree_item)->window,
- &pixmap_node->mask_minus,
- NULL,
- tree_minus);
-
- tree_item->pixmaps = pixmaps = g_list_prepend (pixmaps, pixmap_node);
- }
-
- gtk_pixmap_set (GTK_PIXMAP (tree_item->plus_pix_widget),
- pixmap_node->pixmap_plus, pixmap_node->mask_plus);
- gtk_pixmap_set (GTK_PIXMAP (tree_item->minus_pix_widget),
- pixmap_node->pixmap_minus, pixmap_node->mask_minus);
-}
-
-static void
-gtk_tree_item_remove_pixmaps (GtkTreeItem *tree_item)
-{
- if (tree_item->pixmaps)
- {
- GtkTreePixmaps *pixmap_node = (GtkTreePixmaps *)tree_item->pixmaps->data;
-
- g_assert (pixmap_node->refcount > 0);
-
- if (--pixmap_node->refcount == 0)
- {
- gdk_colormap_unref (pixmap_node->colormap);
- gdk_pixmap_unref (pixmap_node->pixmap_plus);
- gdk_bitmap_unref (pixmap_node->mask_plus);
- gdk_pixmap_unref (pixmap_node->pixmap_minus);
- gdk_bitmap_unref (pixmap_node->mask_minus);
-
- pixmaps = g_list_remove_link (pixmaps, tree_item->pixmaps);
- g_list_free_1 (tree_item->pixmaps);
- g_free (pixmap_node);
- }
-
- tree_item->pixmaps = NULL;
- }
-}
-
-static void
-gtk_tree_item_realize (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TREE_ITEM (widget));
-
- if (GTK_WIDGET_CLASS (parent_class)->realize)
- (* GTK_WIDGET_CLASS (parent_class)->realize) (widget);
-
- gdk_window_set_background (widget->window,
- &widget->style->base[GTK_STATE_NORMAL]);
-
- gtk_tree_item_add_pixmaps (GTK_TREE_ITEM (widget));
-}
-
-static void
-gtk_tree_item_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkBin *bin;
- GtkTreeItem* item;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TREE_ITEM (widget));
- g_return_if_fail (requisition != NULL);
-
- bin = GTK_BIN (widget);
- item = GTK_TREE_ITEM(widget);
-
- requisition->width = (GTK_CONTAINER (widget)->border_width +
- widget->style->klass->xthickness) * 2;
- requisition->height = GTK_CONTAINER (widget)->border_width * 2;
-
- if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
- {
- gtk_widget_size_request (bin->child, &bin->child->requisition);
-
- requisition->width += bin->child->requisition.width;
-
- gtk_widget_size_request (item->pixmaps_box,
- &item->pixmaps_box->requisition);
- requisition->width += item->pixmaps_box->requisition.width + DEFAULT_DELTA +
- GTK_TREE(widget->parent)->current_indent;
-
- requisition->height += MAX(bin->child->requisition.height,
- item->pixmaps_box->requisition.height);
- }
-}
-
-static void
-gtk_tree_item_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkBin *bin;
- GtkTreeItem* item;
- GtkAllocation child_allocation;
- guint border_width;
- int temp;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TREE_ITEM (widget));
- g_return_if_fail (allocation != NULL);
-
- widget->allocation = *allocation;
- if (GTK_WIDGET_REALIZED (widget))
- gdk_window_move_resize (widget->window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
-
- bin = GTK_BIN (widget);
- item = GTK_TREE_ITEM(widget);
-
- if (bin->child)
- {
- border_width = (GTK_CONTAINER (widget)->border_width +
- widget->style->klass->xthickness);
-
- child_allocation.x = border_width + GTK_TREE(widget->parent)->current_indent;
- child_allocation.y = GTK_CONTAINER (widget)->border_width;
-
-#if 0
- child_allocation.height = allocation->height - child_allocation.y * 2;
- child_allocation.width = item->pixmaps_box->requisition.width;
-
- child_allocation.y += 1;
- child_allocation.height -= 2;
- gtk_widget_size_allocate (item->pixmaps_box, &child_allocation);
-
- child_allocation.height += 2;
-#else
- child_allocation.width = item->pixmaps_box->requisition.width;
- child_allocation.height = item->pixmaps_box->requisition.height;
-
- temp = allocation->height - child_allocation.height;
- child_allocation.y += ( temp / 2 ) + ( temp % 2 );
-
- gtk_widget_size_allocate (item->pixmaps_box, &child_allocation);
-
- child_allocation.y = GTK_CONTAINER (widget)->border_width;
- child_allocation.height = allocation->height - child_allocation.y * 2;
-#endif
- child_allocation.x += item->pixmaps_box->requisition.width+DEFAULT_DELTA;
-
- child_allocation.width =
- allocation->width - (child_allocation.x + border_width);
-
- gtk_widget_size_allocate (bin->child, &child_allocation);
- }
-
-}
-
-static void
-gtk_tree_item_draw_lines(GtkWidget *widget)
-{
- GtkTreeItem* item;
- GtkTree* tree;
- guint lx1, ly1, lx2, ly2;
-
- item = GTK_TREE_ITEM(widget);
- tree = GTK_TREE(widget->parent);
-
- /* draw vertical line */
- lx1 = item->pixmaps_box->allocation.width;
- lx1 = lx2 = ( lx1 / 2 ) + ( lx1 % 2 ) +
- GTK_CONTAINER(widget)->border_width + 1 + tree->current_indent;
- ly1 = 0;
- ly2 = widget->allocation.height;
-
- if(g_list_last(tree->children)->data == (gpointer)widget)
- ly2 = (ly2 / 2) + (ly2 % 2);
-
- if(tree != tree->root_tree)
- gdk_draw_line(widget->window, widget->style->black_gc,
- lx1, ly1, lx2, ly2);
-
- /* draw vertical line for subtree connecting */
- if(g_list_last(tree->children)->data != (gpointer)widget)
- ly2 = (ly2 / 2) + (ly2 % 2);
-
- lx2 += DEFAULT_DELTA;
-
- if(item->subtree && item->expanded)
- gdk_draw_line(widget->window, widget->style->black_gc,
- lx2, ly2, lx2, widget->allocation.height);
-
- /* draw horizontal line */
- ly1 = ly2;
- lx2 += 2;
-
- gdk_draw_line(widget->window, widget->style->black_gc,
- lx1, ly1, lx2, ly2);
-
- lx2 -= DEFAULT_DELTA+2;
- ly1 = 0;
- ly2 = widget->allocation.height;
-
- if(tree != tree->root_tree)
- {
- item = GTK_TREE_ITEM(tree->tree_owner);
- tree = GTK_TREE(GTK_WIDGET(tree)->parent);
- while(tree != tree->root_tree) {
- lx1 = lx2 -= tree->indent_value;
-
- if(g_list_last(tree->children)->data != (gpointer)item)
- gdk_draw_line(widget->window, widget->style->black_gc,
- lx1, ly1, lx2, ly2);
- item = GTK_TREE_ITEM(tree->tree_owner);
- tree = GTK_TREE(GTK_WIDGET(tree)->parent);
- }
- }
-}
-
-static void
-gtk_tree_item_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkBin *bin;
- GdkRectangle child_area, item_area;
- GtkTreeItem* tree_item;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TREE_ITEM (widget));
- g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- bin = GTK_BIN (widget);
- tree_item = GTK_TREE_ITEM(widget);
-
- /* draw left size of tree item */
- item_area.x = 0; item_area.y = 0;
- item_area.width = tree_item->pixmaps_box->allocation.width+DEFAULT_DELTA +
- (GTK_TREE(widget->parent)->current_indent + 2);
- item_area.height = widget->allocation.height;
-
- if(gdk_rectangle_intersect(&item_area, area, &child_area)) {
-
- if (!GTK_WIDGET_IS_SENSITIVE (widget))
- gtk_style_set_background (widget->style, widget->window,
- GTK_STATE_INSENSITIVE);
- else if(GTK_TREE(widget->parent)->view_mode == GTK_TREE_VIEW_LINE &&
- widget->state == GTK_STATE_SELECTED)
- gtk_style_set_background (widget->style, widget->window, widget->state);
- else
- gdk_window_set_background (widget->window,
- &widget->style->base[GTK_STATE_NORMAL]);
-
- gdk_window_clear_area (widget->window,
- child_area.x, child_area.y,
- child_area.width, child_area.height);
-
-/* gtk_tree_item_draw_lines(widget); */
-
- if (tree_item->pixmaps_box &&
- GTK_WIDGET_VISIBLE(tree_item->pixmaps_box) &&
- gtk_widget_intersect (tree_item->pixmaps_box, area, &child_area))
- gtk_widget_draw (tree_item->pixmaps_box, &child_area);
- }
-
- /* draw right side */
- if(gtk_widget_intersect (bin->child, area, &child_area)) {
-
- if (!GTK_WIDGET_IS_SENSITIVE (widget))
- gtk_style_set_background (widget->style, widget->window,
- GTK_STATE_INSENSITIVE);
- else if (widget->state == GTK_STATE_NORMAL)
- gdk_window_set_background(widget->window, &widget->style->base[GTK_STATE_NORMAL]);
- else
- gtk_style_set_background (widget->style, widget->window, widget->state);
-
- gdk_window_clear_area (widget->window, child_area.x, child_area.y,
- child_area.width+1, child_area.height);
-
- if (bin->child &&
- GTK_WIDGET_VISIBLE(bin->child) &&
- gtk_widget_intersect (bin->child, area, &child_area))
- gtk_widget_draw (bin->child, &child_area);
- }
-
- gtk_widget_draw_focus (widget);
- }
-}
-
-static void
-gtk_tree_item_draw_focus (GtkWidget *widget)
-{
- GdkGC *gc;
- int dx;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TREE_ITEM (widget));
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- if (GTK_WIDGET_HAS_FOCUS (widget))
- gc = widget->style->black_gc;
- else if (!GTK_WIDGET_IS_SENSITIVE (widget))
- gc = widget->style->bg_gc[GTK_STATE_INSENSITIVE];
- else if (widget->state == GTK_STATE_NORMAL)
- gc = widget->style->base_gc[GTK_STATE_NORMAL];
- else
- gc = widget->style->bg_gc[widget->state];
-
- dx = 0;
-
- if(GTK_TREE(widget->parent)->view_mode == GTK_TREE_VIEW_ITEM)
- dx = GTK_TREE_ITEM(widget)->pixmaps_box->allocation.width + DEFAULT_DELTA +
- GTK_TREE(widget->parent)->current_indent+1;
-
- gdk_draw_rectangle (widget->window, gc, FALSE, dx, 0,
- widget->allocation.width - 1 - dx,
- widget->allocation.height - 1);
-
- if (GTK_TREE (widget->parent)->view_line &&
- (!GTK_IS_ROOT_TREE (widget->parent) ||
- (GTK_IS_ROOT_TREE (widget->parent) && GTK_TREE_ITEM(widget)->subtree)))
- {
- gtk_tree_item_draw_lines(widget);
- }
- }
-}
-
-static gint
-gtk_tree_item_button_press (GtkWidget *widget,
- GdkEventButton *event)
-{
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_TREE_ITEM (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (event->type == GDK_BUTTON_PRESS
- && GTK_WIDGET_IS_SENSITIVE(widget)
- && !GTK_WIDGET_HAS_FOCUS (widget))
- gtk_widget_grab_focus (widget);
-
- return FALSE;
-}
-
-static gint
-gtk_tree_item_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_TREE_ITEM (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- gtk_tree_item_draw(widget, &event->area);
-
- return FALSE;
-}
-
-static gint
-gtk_tree_item_focus_in (GtkWidget *widget,
- GdkEventFocus *event)
-{
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_TREE_ITEM (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
- gtk_widget_draw_focus (widget);
-
-
- return FALSE;
-}
-
-static gint
-gtk_tree_item_focus_out (GtkWidget *widget,
- GdkEventFocus *event)
-{
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_TREE_ITEM (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
- gtk_widget_draw_focus (widget);
-
-
- return FALSE;
-}
-
-static void
-gtk_real_tree_item_select (GtkItem *item)
-{
-
- g_return_if_fail (item != NULL);
- g_return_if_fail (GTK_IS_TREE_ITEM (item));
-
- if (GTK_WIDGET (item)->state == GTK_STATE_SELECTED
- || !GTK_WIDGET_IS_SENSITIVE(item))
- return;
-
- if(GTK_TREE(GTK_WIDGET(item)->parent)->view_mode == GTK_TREE_VIEW_LINE)
- gtk_widget_set_state (GTK_TREE_ITEM (item)->pixmaps_box, GTK_STATE_SELECTED);
-
- gtk_widget_set_state (GTK_WIDGET (item), GTK_STATE_SELECTED);
-
- gtk_widget_queue_draw (GTK_WIDGET (item));
-}
-
-static void
-gtk_real_tree_item_deselect (GtkItem *item)
-{
-
- g_return_if_fail (item != NULL);
- g_return_if_fail (GTK_IS_TREE_ITEM (item));
-
- if (GTK_WIDGET (item)->state == GTK_STATE_NORMAL)
- return;
-
- if(GTK_WIDGET_MAPPED(GTK_WIDGET (item)))
- {
- gtk_widget_set_state (GTK_WIDGET (item), GTK_STATE_NORMAL);
-
- if(GTK_TREE(GTK_WIDGET(item)->parent)->view_mode == GTK_TREE_VIEW_LINE)
- gtk_widget_set_state (GTK_TREE_ITEM (item)->pixmaps_box, GTK_STATE_NORMAL);
-
- gtk_widget_queue_draw (GTK_WIDGET (item));
- }
-}
-
-static void
-gtk_real_tree_item_toggle (GtkItem *item)
-{
-
- g_return_if_fail (item != NULL);
- g_return_if_fail (GTK_IS_TREE_ITEM (item));
-
- if(!GTK_WIDGET_IS_SENSITIVE(item))
- return;
-
- if (GTK_WIDGET (item)->parent && GTK_IS_TREE (GTK_WIDGET (item)->parent))
- gtk_tree_select_child (GTK_TREE (GTK_WIDGET (item)->parent),
- GTK_WIDGET (item));
- else
- {
- /* Should we really bother with this bit? A listitem not in a list?
- * -Johannes Keukelaar
- * yes, always be on the save side!
- * -timj
- */
- if (GTK_WIDGET (item)->state == GTK_STATE_SELECTED)
- gtk_widget_set_state (GTK_WIDGET (item), GTK_STATE_NORMAL);
- else
- gtk_widget_set_state (GTK_WIDGET (item), GTK_STATE_SELECTED);
- gtk_widget_queue_draw (GTK_WIDGET (item));
- }
-}
-
-static void
-gtk_real_tree_item_expand (GtkTreeItem *tree_item)
-{
- GtkTree* tree;
-
- g_return_if_fail (tree_item != NULL);
- g_return_if_fail (GTK_IS_TREE_ITEM (tree_item));
- g_return_if_fail (tree_item->subtree != NULL);
-
-
- if(!tree_item->expanded)
- {
- tree = GTK_TREE(GTK_WIDGET(tree_item)->parent);
-
- /* hide subtree widget */
- gtk_widget_show(tree_item->subtree);
-
- /* hide button '+' and show button '-' */
- if(tree_item->pixmaps_box) {
- gtk_container_remove(GTK_CONTAINER(tree_item->pixmaps_box),
- tree_item->plus_pix_widget);
- gtk_container_add(GTK_CONTAINER(tree_item->pixmaps_box),
- tree_item->minus_pix_widget);
- }
- if(tree->root_tree) gtk_widget_queue_resize(GTK_WIDGET(tree->root_tree));
- tree_item->expanded = TRUE;
- }
-}
-
-static void
-gtk_real_tree_item_collapse (GtkTreeItem *tree_item)
-{
- GtkTree* tree;
-
- g_return_if_fail (tree_item != NULL);
- g_return_if_fail (GTK_IS_TREE_ITEM (tree_item));
- g_return_if_fail (tree_item->subtree != NULL);
-
- if(tree_item->expanded)
- {
- tree = GTK_TREE(GTK_WIDGET(tree_item)->parent);
-
- /* hide subtree widget */
- gtk_widget_hide(tree_item->subtree);
-
- /* hide button '-' and show button '+' */
- if(tree_item->pixmaps_box) {
- gtk_container_remove(GTK_CONTAINER(tree_item->pixmaps_box),
- tree_item->minus_pix_widget);
- gtk_container_add(GTK_CONTAINER(tree_item->pixmaps_box),
- tree_item->plus_pix_widget);
- }
- if(tree->root_tree) gtk_widget_queue_resize(GTK_WIDGET(tree->root_tree));
- tree_item->expanded = FALSE;
- }
-
-}
-
-static void
-gtk_tree_item_destroy (GtkObject *object)
-{
- GtkTreeItem* item;
- GtkWidget* child;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_TREE_ITEM (object));
-
-#ifdef TREE_DEBUG
- g_print("+ gtk_tree_item_destroy [object %#x]\n", (int)object);
-#endif /* TREE_DEBUG */
-
- item = GTK_TREE_ITEM(object);
-
- /* free sub tree if it exist */
- if((child = item->subtree))
- {
- gtk_widget_ref (child);
- gtk_widget_unparent (child);
- gtk_widget_destroy (child);
- gtk_widget_unref (child);
- item->subtree = NULL;
- }
-
- /* free pixmaps box */
- if((child = item->pixmaps_box))
- {
- gtk_widget_ref (child);
- gtk_widget_unparent (child);
- gtk_widget_destroy (child);
- gtk_widget_unref (child);
- item->pixmaps_box = NULL;
- }
-
-
- /* destroy plus pixmap */
- if (item->plus_pix_widget)
- {
- gtk_widget_destroy (item->plus_pix_widget);
- gtk_widget_unref (item->plus_pix_widget);
- item->plus_pix_widget = NULL;
- }
-
- /* destroy minus pixmap */
- if (item->minus_pix_widget)
- {
- gtk_widget_destroy (item->minus_pix_widget);
- gtk_widget_unref (item->minus_pix_widget);
- item->minus_pix_widget = NULL;
- }
-
- /* By removing the pixmaps here, and not in unrealize, we depend on
- * the fact that a widget can never change colormap or visual.
- */
- gtk_tree_item_remove_pixmaps (item);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-
-#ifdef TREE_DEBUG
- g_print("- gtk_tree_item_destroy\n");
-#endif /* TREE_DEBUG */
-}
-
-void
-gtk_tree_item_remove_subtree (GtkTreeItem* item)
-{
- g_return_if_fail(item != NULL);
- g_return_if_fail(GTK_IS_TREE_ITEM(item));
- g_return_if_fail(item->subtree);
-
- if(GTK_TREE(item->subtree)->children)
- gtk_tree_remove_items(GTK_TREE(item->subtree),
- GTK_TREE(item->subtree)->children);
-
- if (GTK_WIDGET_MAPPED (item->subtree))
- gtk_widget_unmap (item->subtree);
-
- gtk_widget_unparent (item->subtree);
-
- if(item->pixmaps_box)
- gtk_widget_hide(item->pixmaps_box);
-
- item->subtree = NULL;
- item->expanded = FALSE;
- if(item->pixmaps_box) {
- gtk_container_remove(GTK_CONTAINER(item->pixmaps_box),
- item->minus_pix_widget);
- gtk_container_add(GTK_CONTAINER(item->pixmaps_box),
- item->plus_pix_widget);
- }
-}
-
-static void
-gtk_tree_item_map (GtkWidget *widget)
-{
- GtkBin *bin;
- GtkTreeItem* item;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TREE_ITEM (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
- bin = GTK_BIN (widget);
- item = GTK_TREE_ITEM(widget);
-
- if (!GTK_WIDGET_NO_WINDOW (widget))
- gdk_window_show (widget->window);
- else
- gtk_widget_queue_draw (widget);
-
- if(item->pixmaps_box &&
- GTK_WIDGET_VISIBLE (item->pixmaps_box) &&
- !GTK_WIDGET_MAPPED (item->pixmaps_box))
- gtk_widget_map (item->pixmaps_box);
-
- if (bin->child &&
- GTK_WIDGET_VISIBLE (bin->child) &&
- !GTK_WIDGET_MAPPED (bin->child))
- gtk_widget_map (bin->child);
-}
-
-static void
-gtk_tree_item_unmap (GtkWidget *widget)
-{
- GtkBin *bin;
- GtkTreeItem* item;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TREE_ITEM (widget));
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
- bin = GTK_BIN (widget);
- item = GTK_TREE_ITEM(widget);
-
- if (GTK_WIDGET_NO_WINDOW (widget))
- gdk_window_clear_area (widget->window,
- widget->allocation.x,
- widget->allocation.y,
- widget->allocation.width,
- widget->allocation.height);
- else
- gdk_window_hide (widget->window);
-
- if(item->pixmaps_box &&
- GTK_WIDGET_VISIBLE (item->pixmaps_box) &&
- GTK_WIDGET_MAPPED (item->pixmaps_box))
- gtk_widget_unmap (bin->child);
-
- if (bin->child &&
- GTK_WIDGET_VISIBLE (bin->child) &&
- GTK_WIDGET_MAPPED (bin->child))
- gtk_widget_unmap (bin->child);
-}
diff --git a/gtk/gtktreeitem.h b/gtk/gtktreeitem.h
deleted file mode 100644
index 8093620f9d..0000000000
--- a/gtk/gtktreeitem.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_TREE_ITEM_H__
-#define __GTK_TREE_ITEM_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkitem.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_TREE_ITEM(obj) GTK_CHECK_CAST (obj, gtk_tree_item_get_type (), GtkTreeItem)
-#define GTK_TREE_ITEM_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_tree_item_get_type (), GtkTreeItemClass)
-#define GTK_IS_TREE_ITEM(obj) GTK_CHECK_TYPE (obj, gtk_tree_item_get_type ())
-
-#define GTK_TREE_ITEM_SUBTREE(obj) GTK_TREE_ITEM(obj)->subtree
-
-typedef struct _GtkTreeItem GtkTreeItem;
-typedef struct _GtkTreeItemClass GtkTreeItemClass;
-
-struct _GtkTreeItem
-{
- GtkItem item;
-
- GtkWidget *subtree;
- GtkWidget *pixmaps_box;
- GtkWidget *plus_pix_widget, *minus_pix_widget;
-
- GList *pixmaps; /* pixmap node for this items color depth */
-
- guint expanded : 1;
-};
-
-struct _GtkTreeItemClass
-{
- GtkItemClass parent_class;
-
- void (* expand) (GtkTreeItem *tree_item);
- void (* collapse) (GtkTreeItem *tree_item);
-};
-
-
-guint gtk_tree_item_get_type (void);
-GtkWidget* gtk_tree_item_new (void);
-GtkWidget* gtk_tree_item_new_with_label (gchar *label);
-void gtk_tree_item_set_subtree (GtkTreeItem *tree_item,
- GtkWidget *subtree);
-void gtk_tree_item_remove_subtree (GtkTreeItem *tree_item);
-void gtk_tree_item_select (GtkTreeItem *tree_item);
-void gtk_tree_item_deselect (GtkTreeItem *tree_item);
-void gtk_tree_item_expand (GtkTreeItem *tree_item);
-void gtk_tree_item_collapse (GtkTreeItem *tree_item);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_TREE_ITEM_H__ */
diff --git a/gtk/gtktypebuiltins.c b/gtk/gtktypebuiltins.c
deleted file mode 100644
index d42ba64b94..0000000000
--- a/gtk/gtktypebuiltins.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* generated by gentypeinfo from "gtk.defs" */
-
- { "GtkWindowType", GTK_TYPE_ENUM },
- { "GtkStateType", GTK_TYPE_ENUM },
- { "GtkDirectionType", GTK_TYPE_ENUM },
- { "GtkShadowType", GTK_TYPE_ENUM },
- { "GtkArrowType", GTK_TYPE_ENUM },
- { "GtkPackType", GTK_TYPE_ENUM },
- { "GtkPolicyType", GTK_TYPE_ENUM },
- { "GtkUpdateType", GTK_TYPE_ENUM },
- { "GtkAttachOptions", GTK_TYPE_FLAGS },
- { "GtkSignalRunType", GTK_TYPE_FLAGS },
- { "GtkWindowPosition", GTK_TYPE_ENUM },
- { "GtkSubmenuDirection", GTK_TYPE_ENUM },
- { "GtkSubmenuPlacement", GTK_TYPE_ENUM },
- { "GtkMenuFactoryType", GTK_TYPE_ENUM },
- { "GtkMetricType", GTK_TYPE_ENUM },
- { "GtkScrollType", GTK_TYPE_ENUM },
- { "GtkTroughType", GTK_TYPE_ENUM },
- { "GtkPositionType", GTK_TYPE_ENUM },
- { "GtkPreviewType", GTK_TYPE_ENUM },
- { "GtkWidgetFlags", GTK_TYPE_FLAGS },
- { "GtkSelectionMode", GTK_TYPE_ENUM },
- { "GtkCurveType", GTK_TYPE_ENUM },
- { "GtkFundamentalType", GTK_TYPE_ENUM },
- { "GtkJustification", GTK_TYPE_ENUM },
- { "GdkWindowType", GTK_TYPE_ENUM },
- { "GdkWindowClass", GTK_TYPE_ENUM },
- { "GdkImageType", GTK_TYPE_ENUM },
- { "GdkVisualType", GTK_TYPE_ENUM },
- { "GdkWindowAttributesType", GTK_TYPE_FLAGS },
- { "GdkWindowHints", GTK_TYPE_FLAGS },
- { "GdkFunction", GTK_TYPE_ENUM },
- { "GdkFill", GTK_TYPE_ENUM },
- { "GdkLineStyle", GTK_TYPE_ENUM },
- { "GdkCapStyle", GTK_TYPE_ENUM },
- { "GdkJoinStyle", GTK_TYPE_ENUM },
- { "GdkCursorType", GTK_TYPE_ENUM },
- { "GdkEventType", GTK_TYPE_ENUM },
- { "GdkEventMask", GTK_TYPE_FLAGS },
- { "GdkNotifyType", GTK_TYPE_ENUM },
- { "GdkModifierType", GTK_TYPE_FLAGS },
- { "GdkSubwindowMode", GTK_TYPE_ENUM },
- { "GdkInputCondition", GTK_TYPE_FLAGS },
- { "GdkStatus", GTK_TYPE_ENUM },
- { "GdkByteOrder", GTK_TYPE_ENUM },
- { "GdkGCValuesMask", GTK_TYPE_FLAGS },
- { "GdkSelection", GTK_TYPE_ENUM },
- { "GdkPropertyState", GTK_TYPE_ENUM },
- { "GdkPropMode", GTK_TYPE_ENUM },
- { "GtkAcceleratorTable", GTK_TYPE_BOXED },
- { "GtkStyle", GTK_TYPE_BOXED },
- { "GdkColormap", GTK_TYPE_BOXED },
- { "GdkVisual", GTK_TYPE_BOXED },
- { "GdkFont", GTK_TYPE_BOXED },
- { "GdkWindow", GTK_TYPE_BOXED },
- { "GdkEvent", GTK_TYPE_BOXED },
- { "GdkColor", GTK_TYPE_BOXED },
- { "GtkTooltips", GTK_TYPE_BOXED },
diff --git a/gtk/gtktypebuiltins.h b/gtk/gtktypebuiltins.h
deleted file mode 100644
index 4cf9f8f403..0000000000
--- a/gtk/gtktypebuiltins.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* generated by gentypeinfo from "gtk.defs" */
-
-#define GTK_TYPE_WINDOW_TYPE (gtk_type_builtins[0])
-#define GTK_TYPE_STATE_TYPE (gtk_type_builtins[1])
-#define GTK_TYPE_DIRECTION_TYPE (gtk_type_builtins[2])
-#define GTK_TYPE_SHADOW_TYPE (gtk_type_builtins[3])
-#define GTK_TYPE_ARROW_TYPE (gtk_type_builtins[4])
-#define GTK_TYPE_PACK_TYPE (gtk_type_builtins[5])
-#define GTK_TYPE_POLICY_TYPE (gtk_type_builtins[6])
-#define GTK_TYPE_UPDATE_TYPE (gtk_type_builtins[7])
-#define GTK_TYPE_ATTACH_OPTIONS (gtk_type_builtins[8])
-#define GTK_TYPE_SIGNAL_RUN_TYPE (gtk_type_builtins[9])
-#define GTK_TYPE_WINDOW_POSITION (gtk_type_builtins[10])
-#define GTK_TYPE_SUBMENU_DIRECTION (gtk_type_builtins[11])
-#define GTK_TYPE_SUBMENU_PLACEMENT (gtk_type_builtins[12])
-#define GTK_TYPE_MENU_FACTORY_TYPE (gtk_type_builtins[13])
-#define GTK_TYPE_METRIC_TYPE (gtk_type_builtins[14])
-#define GTK_TYPE_SCROLL_TYPE (gtk_type_builtins[15])
-#define GTK_TYPE_TROUGH_TYPE (gtk_type_builtins[16])
-#define GTK_TYPE_POSITION_TYPE (gtk_type_builtins[17])
-#define GTK_TYPE_PREVIEW_TYPE (gtk_type_builtins[18])
-#define GTK_TYPE_WIDGET_FLAGS (gtk_type_builtins[19])
-#define GTK_TYPE_SELECTION_MODE (gtk_type_builtins[20])
-#define GTK_TYPE_CURVE_TYPE (gtk_type_builtins[21])
-#define GTK_TYPE_FUNDAMENTAL_TYPE (gtk_type_builtins[22])
-#define GTK_TYPE_JUSTIFICATION (gtk_type_builtins[23])
-#define GTK_TYPE_GDK_WINDOW_TYPE (gtk_type_builtins[24])
-#define GTK_TYPE_GDK_WINDOW_CLASS (gtk_type_builtins[25])
-#define GTK_TYPE_GDK_IMAGE_TYPE (gtk_type_builtins[26])
-#define GTK_TYPE_GDK_VISUAL_TYPE (gtk_type_builtins[27])
-#define GTK_TYPE_GDK_WINDOW_ATTRIBUTES_TYPE (gtk_type_builtins[28])
-#define GTK_TYPE_GDK_WINDOW_HINTS (gtk_type_builtins[29])
-#define GTK_TYPE_GDK_FUNCTION (gtk_type_builtins[30])
-#define GTK_TYPE_GDK_FILL (gtk_type_builtins[31])
-#define GTK_TYPE_GDK_LINE_STYLE (gtk_type_builtins[32])
-#define GTK_TYPE_GDK_CAP_STYLE (gtk_type_builtins[33])
-#define GTK_TYPE_GDK_JOIN_STYLE (gtk_type_builtins[34])
-#define GTK_TYPE_GDK_CURSOR_TYPE (gtk_type_builtins[35])
-#define GTK_TYPE_GDK_EVENT_TYPE (gtk_type_builtins[36])
-#define GTK_TYPE_GDK_EVENT_MASK (gtk_type_builtins[37])
-#define GTK_TYPE_GDK_NOTIFY_TYPE (gtk_type_builtins[38])
-#define GTK_TYPE_GDK_MODIFIER_TYPE (gtk_type_builtins[39])
-#define GTK_TYPE_GDK_SUBWINDOW_MODE (gtk_type_builtins[40])
-#define GTK_TYPE_GDK_INPUT_CONDITION (gtk_type_builtins[41])
-#define GTK_TYPE_GDK_STATUS (gtk_type_builtins[42])
-#define GTK_TYPE_GDK_BYTE_ORDER (gtk_type_builtins[43])
-#define GTK_TYPE_GDK_GCVALUES_MASK (gtk_type_builtins[44])
-#define GTK_TYPE_GDK_SELECTION (gtk_type_builtins[45])
-#define GTK_TYPE_GDK_PROPERTY_STATE (gtk_type_builtins[46])
-#define GTK_TYPE_GDK_PROP_MODE (gtk_type_builtins[47])
-#define GTK_TYPE_ACCELERATOR_TABLE (gtk_type_builtins[48])
-#define GTK_TYPE_STYLE (gtk_type_builtins[49])
-#define GTK_TYPE_GDK_COLORMAP (gtk_type_builtins[50])
-#define GTK_TYPE_GDK_VISUAL (gtk_type_builtins[51])
-#define GTK_TYPE_GDK_FONT (gtk_type_builtins[52])
-#define GTK_TYPE_GDK_WINDOW (gtk_type_builtins[53])
-#define GTK_TYPE_GDK_EVENT (gtk_type_builtins[54])
-#define GTK_TYPE_GDK_COLOR (gtk_type_builtins[55])
-#define GTK_TYPE_TOOLTIPS (gtk_type_builtins[56])
-#define GTK_TYPE_NUM_BUILTINS 57
diff --git a/gtk/gtktypeutils.c b/gtk/gtktypeutils.c
deleted file mode 100644
index 2891e7c301..0000000000
--- a/gtk/gtktypeutils.c
+++ /dev/null
@@ -1,511 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <string.h>
-#include "gtkobject.h"
-#include "gtktypeutils.h"
-
-
-typedef struct _GtkTypeNode GtkTypeNode;
-
-struct _GtkTypeNode
-{
- GtkType type;
- gint init_class;
- gpointer klass;
- GtkTypeInfo type_info;
- GtkTypeNode *parent;
- GList *children;
-};
-
-
-static void gtk_type_insert (guint parent_type,
- GtkType type,
- GtkTypeInfo *type_info);
-static void gtk_type_class_init (GtkTypeNode *node);
-static void gtk_type_object_init (GtkTypeNode *node,
- gpointer object);
-static guint gtk_type_hash (GtkType *key);
-static gint gtk_type_compare (GtkType *a,
- GtkType *b);
-static guint gtk_type_name_hash (const char *key);
-static gint gtk_type_name_compare (const char *a,
- const char *b);
-static void gtk_type_init_builtin_types (void);
-
-
-static int initialize = TRUE;
-static GHashTable *type_hash_table = NULL;
-static GHashTable *name_hash_table = NULL;
-
-
-void
-gtk_type_init ()
-{
- if (initialize)
- {
- g_assert (sizeof (GtkType) >= 4);
-
- initialize = FALSE;
- type_hash_table = g_hash_table_new ((GHashFunc) gtk_type_hash,
- (GCompareFunc) gtk_type_compare);
- name_hash_table = g_hash_table_new ((GHashFunc) gtk_type_name_hash,
- (GCompareFunc) gtk_type_name_compare);
- gtk_type_init_builtin_types ();
- }
-}
-
-GtkType
-gtk_type_unique (GtkType parent_type,
- GtkTypeInfo *type_info)
-{
- static guint next_seqno = 0;
- GtkType new_type;
-
- g_return_val_if_fail (type_info != NULL, 0);
-
- if (initialize)
- gtk_type_init ();
-
- next_seqno++;
- if (parent_type == GTK_TYPE_INVALID)
- new_type = next_seqno;
- else
- new_type = GTK_TYPE_MAKE (GTK_FUNDAMENTAL_TYPE (parent_type), next_seqno);
- gtk_type_insert (parent_type, new_type, type_info);
-
- return new_type;
-}
-
-gchar*
-gtk_type_name (GtkType type)
-{
- GtkTypeNode *node;
-
- if (initialize)
- gtk_type_init ();
-
- node = g_hash_table_lookup (type_hash_table, &type);
-
- if (node)
- return node->type_info.type_name;
-
- return NULL;
-}
-
-GtkType
-gtk_type_from_name (const gchar *name)
-{
- GtkTypeNode *node;
-
- if (initialize)
- gtk_type_init ();
-
- node = g_hash_table_lookup (name_hash_table, (gpointer) name);
-
- if (node)
- return node->type;
-
- return 0;
-}
-
-GtkType
-gtk_type_parent (GtkType type)
-{
- GtkTypeNode *node;
-
- if (initialize)
- gtk_type_init ();
-
- node = g_hash_table_lookup (type_hash_table, &type);
-
- if (node && node->parent)
- return node->parent->type;
-
- return 0;
-}
-
-gpointer
-gtk_type_class (GtkType type)
-{
- GtkTypeNode *node;
-
- if (initialize)
- gtk_type_init ();
-
- node = g_hash_table_lookup (type_hash_table, &type);
- g_return_val_if_fail (node != NULL, NULL);
-
- if (node->init_class)
- gtk_type_class_init (node);
-
- return node->klass;
-}
-
-gpointer
-gtk_type_new (GtkType type)
-{
- GtkTypeNode *node;
- gpointer object;
-
- if (initialize)
- gtk_type_init ();
-
- node = g_hash_table_lookup (type_hash_table, &type);
- g_return_val_if_fail (node != NULL, NULL);
-
- object = g_new0 (guchar, node->type_info.object_size);
- ((GtkObject*) object)->klass = gtk_type_class (type);
- gtk_type_object_init (node, object);
-
- return object;
-}
-
-void
-gtk_type_describe_heritage (GtkType type)
-{
- GtkTypeNode *node;
- gint first;
-
- if (initialize)
- gtk_type_init ();
-
- node = g_hash_table_lookup (type_hash_table, &type);
- first = TRUE;
-
- while (node)
- {
- if (first)
- {
- first = FALSE;
- g_print ("is a ");
- }
-
- if (node->type_info.type_name)
- g_print ("%s\n", node->type_info.type_name);
- else
- g_print ("<unnamed type>\n");
-
- node = node->parent;
- }
-}
-
-void
-gtk_type_describe_tree (GtkType type,
- gint show_size)
-{
- static gint indent = 0;
- GtkTypeNode *node;
- GtkTypeNode *child;
- GList *children;
- gint old_indent;
- gint i;
-
- if (initialize)
- gtk_type_init ();
-
- node = g_hash_table_lookup (type_hash_table, &type);
-
- for (i = 0; i < indent; i++)
- g_print (" ");
-
- if (node->type_info.type_name)
- g_print ("%s", node->type_info.type_name);
- else
- g_print ("<unnamed type>");
-
- if (show_size)
- g_print (" ( %d bytes )\n", node->type_info.object_size);
- else
- g_print ("\n");
-
- old_indent = indent;
- indent += 4;
-
- children = node->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- gtk_type_describe_tree (child->type, show_size);
- }
-
- indent = old_indent;
-}
-
-gint
-gtk_type_is_a (GtkType type,
- GtkType is_a_type)
-{
- GtkTypeNode *node;
-
- if (initialize)
- gtk_type_init ();
-
- node = g_hash_table_lookup (type_hash_table, &type);
-
- while (node)
- {
- if (node->type == is_a_type)
- return TRUE;
- node = node->parent;
- }
-
- return FALSE;
-}
-
-void
-gtk_type_get_arg (GtkObject *object,
- GtkType type,
- GtkArg *arg,
- guint arg_id)
-{
- GtkTypeNode *node;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (arg != NULL);
-
- if (initialize)
- gtk_type_init ();
-
- node = g_hash_table_lookup (type_hash_table, &type);
-
- if (node && node->type_info.arg_get_func)
- (* node->type_info.arg_get_func) (object, arg, arg_id);
- else
- arg->type = GTK_TYPE_INVALID;
-}
-
-void
-gtk_type_set_arg (GtkObject *object,
- GtkType type,
- GtkArg *arg,
- guint arg_id)
-{
- GtkTypeNode *node;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (arg != NULL);
-
- if (initialize)
- gtk_type_init ();
-
- node = g_hash_table_lookup (type_hash_table, &type);
-
- if (node && node->type_info.arg_set_func)
- (* node->type_info.arg_set_func) (object, arg, arg_id);
-}
-
-GtkArg*
-gtk_arg_copy (GtkArg *src_arg,
- GtkArg *dest_arg)
-{
- g_return_val_if_fail (src_arg != NULL, NULL);
-
- if (!dest_arg)
- {
- dest_arg = g_new0 (GtkArg, 1);
- dest_arg->name = src_arg->name;
- }
-
- dest_arg->type = src_arg->type;
- dest_arg->d = src_arg->d;
-
- if (src_arg->type == GTK_TYPE_STRING)
- dest_arg->d.string_data = g_strdup (src_arg->d.string_data);
-
- return dest_arg;
-}
-
-static void
-gtk_type_insert (GtkType parent_type,
- GtkType type,
- GtkTypeInfo *type_info)
-{
- GtkTypeNode *node;
- GtkTypeNode *parent;
-
- parent = g_hash_table_lookup (type_hash_table, &parent_type);
-
- node = g_new (GtkTypeNode, 1);
- node->type = type;
- node->init_class = TRUE;
- node->klass = NULL;
- node->type_info = *type_info;
- node->parent = parent;
- node->children = NULL;
-
- if (node->parent)
- node->parent->children = g_list_append (node->parent->children, node);
-
- g_hash_table_insert (type_hash_table, &node->type, node);
- g_hash_table_insert (name_hash_table, node->type_info.type_name, node);
-}
-
-static void
-gtk_type_class_init (GtkTypeNode *node)
-{
- GtkObjectClass *object_class;
-
- if (node->init_class)
- {
- node->init_class = FALSE;
- node->klass = g_new0 (guchar, node->type_info.class_size);
-
- if (node->parent)
- {
- if (node->parent->init_class)
- gtk_type_class_init (node->parent);
-
- memcpy (node->klass, node->parent->klass, node->parent->type_info.class_size);
- }
-
- object_class = node->klass;
- object_class->type = node->type;
- object_class->signals = NULL;
- object_class->nsignals = 0;
- object_class->n_args = 0;
-
- if (node->type_info.class_init_func)
- (* node->type_info.class_init_func) (node->klass);
- }
-}
-
-static void
-gtk_type_object_init (GtkTypeNode *node,
- gpointer object)
-{
- if (node->parent)
- gtk_type_object_init (node->parent, object);
-
- if (node->type_info.object_init_func)
- (* node->type_info.object_init_func) (object);
-}
-
-static guint
-gtk_type_hash (GtkType *key)
-{
- return GTK_TYPE_SEQNO (*key);
-}
-
-static gint
-gtk_type_compare (GtkType *a,
- GtkType *b)
-{
- g_return_val_if_fail(a != NULL && b != NULL, 0);
- return (*a == *b);
-}
-
-static guint
-gtk_type_name_hash (const char *key)
-{
- guint result;
-
- result = 0;
- while (*key)
- result += (result << 3) + *key++;
-
- return result;
-}
-
-static gint
-gtk_type_name_compare (const char *a,
- const char *b)
-{
- return (strcmp (a, b) == 0);
-}
-
-static GtkType
-gtk_type_register_builtin (char *name,
- GtkType parent)
-{
- GtkTypeInfo info;
-
- info.type_name = name;
- info.object_size = info.class_size = 0;
- info.class_init_func = NULL;
- info.object_init_func = NULL;
- info.arg_set_func = NULL;
- info.arg_get_func = NULL;
-
- return gtk_type_unique (parent, &info);
-}
-
-extern void gtk_object_init_type (void);
-
-GtkType gtk_type_builtins[GTK_TYPE_NUM_BUILTINS];
-
-static void
-gtk_type_init_builtin_types ()
-{
- /* GTK_TYPE_INVALID has typeid 0. The first type id returned by
- gtk_type_unique is 1, which is GTK_TYPE_NONE. And so on. */
-
- static struct {
- GtkType enum_id;
- gchar *name;
- } fundamental_info[] = {
- { GTK_TYPE_NONE, "void" },
- { GTK_TYPE_CHAR, "char" },
- { GTK_TYPE_BOOL, "bool" },
- { GTK_TYPE_INT, "int" },
- { GTK_TYPE_UINT, "uint" },
- { GTK_TYPE_LONG, "long" },
- { GTK_TYPE_ULONG, "ulong" },
- { GTK_TYPE_FLOAT, "float" },
- { GTK_TYPE_DOUBLE, "double" },
- { GTK_TYPE_STRING, "string" },
- { GTK_TYPE_ENUM, "enum" },
- { GTK_TYPE_FLAGS, "flags" },
- { GTK_TYPE_BOXED, "boxed" },
- { GTK_TYPE_FOREIGN, "foreign" },
- { GTK_TYPE_CALLBACK, "callback" },
- { GTK_TYPE_ARGS, "args" },
-
- { GTK_TYPE_POINTER, "pointer" },
- { GTK_TYPE_SIGNAL, "signal" },
- { GTK_TYPE_C_CALLBACK, "c_callback" }
- };
-
- static struct {
- char *name;
- GtkType parent;
- } builtin_info[] = {
-#include "gtktypebuiltins.c"
- { NULL }
- };
-
- int i;
-
- for (i = 0; i < sizeof (fundamental_info)/sizeof(fundamental_info[0]); i++)
- {
- GtkType id;
- id = gtk_type_register_builtin (fundamental_info[i].name,
- GTK_TYPE_INVALID);
- g_assert (id == fundamental_info[i].enum_id);
- }
-
- gtk_object_init_type ();
-
- for (i = 0; builtin_info[i].name; i++)
- {
- gtk_type_builtins[i] =
- gtk_type_register_builtin (builtin_info[i].name,
- builtin_info[i].parent);
- }
-}
diff --git a/gtk/gtktypeutils.h b/gtk/gtktypeutils.h
deleted file mode 100644
index eb826cea48..0000000000
--- a/gtk/gtktypeutils.h
+++ /dev/null
@@ -1,209 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_TYPE_UTILS_H__
-#define __GTK_TYPE_UTILS_H__
-
-
-#include <gdk/gdk.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/* Fundamental Types */
-
-typedef enum
-{
- GTK_TYPE_INVALID,
- GTK_TYPE_NONE,
- GTK_TYPE_CHAR,
- GTK_TYPE_BOOL,
- GTK_TYPE_INT,
- GTK_TYPE_UINT,
- GTK_TYPE_LONG,
- GTK_TYPE_ULONG,
- GTK_TYPE_FLOAT,
- GTK_TYPE_DOUBLE,
- GTK_TYPE_STRING,
- GTK_TYPE_ENUM,
- GTK_TYPE_FLAGS,
- GTK_TYPE_BOXED,
- GTK_TYPE_FOREIGN,
- GTK_TYPE_CALLBACK,
- GTK_TYPE_ARGS,
-
- GTK_TYPE_POINTER,
-
- /* it'd be great if the next two could be removed eventually */
- GTK_TYPE_SIGNAL,
- GTK_TYPE_C_CALLBACK,
-
- GTK_TYPE_OBJECT
-
-} GtkFundamentalType;
-
-typedef guint GtkType;
-
-/* Builtin Types */
-
-extern GtkType gtk_type_builtins[];
-#include <gtk/gtktypebuiltins.h>
-
-/* General Types */
-
-#define GTK_TYPE_MAKE(ft, seqno) (((seqno)<<8)|ft)
-#define GTK_FUNDAMENTAL_TYPE(t) ((GtkFundamentalType)((t)&0xFF))
-#define GTK_TYPE_SEQNO(t) ((t)>0xFF? (t)>>8:(t))
-
-typedef struct _GtkArg GtkArg;
-typedef struct _GtkObject GtkObject; /* forward declaration of object type */
-typedef struct _GtkTypeInfo GtkTypeInfo;
-
-typedef void (*GtkClassInitFunc) (gpointer klass);
-typedef void (*GtkObjectInitFunc) (gpointer object);
-typedef void (*GtkArgGetFunc) (GtkObject *object, GtkArg *arg, guint arg_id);
-typedef void (*GtkArgSetFunc) (GtkObject *object, GtkArg *arg, guint arg_id);
-typedef gint (*GtkFunction) (gpointer data);
-typedef void (*GtkCallbackMarshal) (GtkObject *object,
- gpointer data,
- guint n_args,
- GtkArg *args);
-typedef void (*GtkDestroyNotify) (gpointer data);
-
-struct _GtkArg
-{
- GtkType type;
- gchar *name;
-
- union {
- gchar char_data;
- gint int_data;
- guint uint_data;
- gint bool_data;
- glong long_data;
- gulong ulong_data;
- gfloat float_data;
- gdouble double_data;
- gchar *string_data;
- gpointer pointer_data;
- GtkObject *object_data;
- struct {
- GtkCallbackMarshal marshal;
- gpointer data;
- GtkDestroyNotify notify;
- } callback_data;
- struct {
- gpointer data;
- GtkDestroyNotify notify;
- } foreign_data;
- struct {
- gint n_args;
- GtkArg *args;
- } args_data;
- struct {
- GtkFunction f;
- gpointer d;
- } signal_data;
- struct {
- GtkFunction func;
- gpointer func_data;
- } c_callback_data;
- } d;
-};
-
-#define GTK_VALUE_CHAR(a) ((a).d.char_data)
-#define GTK_VALUE_BOOL(a) ((a).d.bool_data)
-#define GTK_VALUE_INT(a) ((a).d.int_data)
-#define GTK_VALUE_UINT(a) ((a).d.uint_data)
-#define GTK_VALUE_LONG(a) ((a).d.long_data)
-#define GTK_VALUE_ULONG(a) ((a).d.ulong_data)
-#define GTK_VALUE_FLOAT(a) ((a).d.float_data)
-#define GTK_VALUE_DOUBLE(a) ((a).d.double_data)
-#define GTK_VALUE_STRING(a) ((a).d.string_data)
-#define GTK_VALUE_ENUM(a) ((a).d.int_data)
-#define GTK_VALUE_FLAGS(a) ((a).d.int_data)
-#define GTK_VALUE_BOXED(a) ((a).d.pointer_data)
-#define GTK_VALUE_FOREIGN(a) ((a).d.foreign_data)
-#define GTK_VALUE_CALLBACK(a) ((a).d.callback_data)
-#define GTK_VALUE_ARGS(a) ((a).d.args_data)
-#define GTK_VALUE_OBJECT(a) ((a).d.object_data)
-#define GTK_VALUE_POINTER(a) ((a).d.pointer_data)
-#define GTK_VALUE_SIGNAL(a) ((a).d.signal_data)
-#define GTK_VALUE_C_CALLBACK(a) ((a).d.c_callback_data)
-
-#define GTK_RETLOC_CHAR(a) ((gchar*)(a).d.pointer_data)
-#define GTK_RETLOC_BOOL(a) ((gint*)(a).d.pointer_data)
-#define GTK_RETLOC_INT(a) ((gint*)(a).d.pointer_data)
-#define GTK_RETLOC_UINT(a) ((guint*)(a).d.pointer_data)
-#define GTK_RETLOC_LONG(a) ((glong*)(a).d.pointer_data)
-#define GTK_RETLOC_ULONG(a) ((gulong*)(a).d.pointer_data)
-#define GTK_RETLOC_FLOAT(a) ((gfloat*)(a).d.pointer_data)
-#define GTK_RETLOC_DOUBLE(a) ((gdouble*)(a).d.pointer_data)
-#define GTK_RETLOC_STRING(a) ((gchar**)(a).d.pointer_data)
-#define GTK_RETLOC_ENUM(a) ((gint*)(a).d.pointer_data)
-#define GTK_RETLOC_FLAGS(a) ((gint*)(a).d.pointer_data)
-#define GTK_RETLOC_BOXED(a) ((gpointer*)(a).d.pointer_data)
-#define GTK_RETLOC_OBJECT(a) ((GtkObject**)(a).d.pointer_data)
-#define GTK_RETLOC_POINTER(a) ((gpointer*)(a).d.pointer_data)
-
-struct _GtkTypeInfo
-{
- gchar *type_name;
- guint object_size;
- guint class_size;
- GtkClassInitFunc class_init_func;
- GtkObjectInitFunc object_init_func;
- GtkArgSetFunc arg_set_func;
- GtkArgGetFunc arg_get_func;
-};
-
-
-void gtk_type_init (void);
-GtkType gtk_type_unique (guint parent_type,
- GtkTypeInfo *type_info);
-gchar* gtk_type_name (guint type);
-GtkType gtk_type_from_name (const gchar *name);
-GtkType gtk_type_parent (GtkType type);
-gpointer gtk_type_class (GtkType type);
-gpointer gtk_type_new (GtkType type);
-void gtk_type_describe_heritage (GtkType type);
-void gtk_type_describe_tree (GtkType type,
- gint show_size);
-gint gtk_type_is_a (GtkType type,
- GtkType is_a_type);
-void gtk_type_get_arg (GtkObject *object,
- GtkType type,
- GtkArg *arg,
- guint arg_id);
-void gtk_type_set_arg (GtkObject *object,
- GtkType type,
- GtkArg *arg,
- guint arg_id);
-GtkArg* gtk_arg_copy (GtkArg *src_arg,
- GtkArg *dest_arg);
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_TYPE_UTILS_H__ */
diff --git a/gtk/gtkvbbox.c b/gtk/gtkvbbox.c
deleted file mode 100644
index 98351604f0..0000000000
--- a/gtk/gtkvbbox.c
+++ /dev/null
@@ -1,276 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkvbbox.h"
-
-
-static void gtk_vbutton_box_class_init (GtkVButtonBoxClass *klass);
-static void gtk_vbutton_box_init (GtkVButtonBox *box);
-static void gtk_vbutton_box_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_vbutton_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-
-static gint default_spacing = 10;
-static GtkButtonBoxStyle default_layout_style = GTK_BUTTONBOX_EDGE;
-
-guint
-gtk_vbutton_box_get_type ()
-{
- static guint vbutton_box_type = 0;
-
- if (!vbutton_box_type)
- {
- GtkTypeInfo vbutton_box_info =
- {
- "GtkVButtonBox",
- sizeof (GtkVButtonBox),
- sizeof (GtkVButtonBoxClass),
- (GtkClassInitFunc) gtk_vbutton_box_class_init,
- (GtkObjectInitFunc) gtk_vbutton_box_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- vbutton_box_type = gtk_type_unique (gtk_button_box_get_type (), &vbutton_box_info);
- }
-
- return vbutton_box_type;
-}
-
-static void
-gtk_vbutton_box_class_init (GtkVButtonBoxClass *class)
-{
- GtkWidgetClass *widget_class;
-
- widget_class = (GtkWidgetClass*) class;
-
- widget_class->size_request = gtk_vbutton_box_size_request;
- widget_class->size_allocate = gtk_vbutton_box_size_allocate;
-}
-
-static void
-gtk_vbutton_box_init (GtkVButtonBox *vbutton_box)
-{
- /* button_box_init has done everything allready */
-}
-
-GtkWidget*
-gtk_vbutton_box_new ()
-{
- GtkVButtonBox *vbutton_box;
-
- vbutton_box = gtk_type_new (gtk_vbutton_box_get_type ());
- return GTK_WIDGET (vbutton_box);
-}
-
-
-
-/* set default value for spacing */
-
-void gtk_vbutton_box_set_spacing_default (gint spacing)
-{
- default_spacing = spacing;
-}
-
-
-/* set default value for layout style */
-
-void gtk_vbutton_box_set_layout_default (GtkButtonBoxStyle layout)
-{
- g_return_if_fail (layout >= GTK_BUTTONBOX_DEFAULT_STYLE &&
- layout <= GTK_BUTTONBOX_END);
-
- default_layout_style = layout;
-}
-
-/* get default value for spacing */
-
-gint gtk_vbutton_box_get_spacing_default (void)
-{
- return default_spacing;
-}
-
-
-
-/* get default value for layout style */
-
-GtkButtonBoxStyle gtk_vbutton_box_get_layout_default (void)
-{
- return default_layout_style;
-}
-
-
-
-
-static void
-gtk_vbutton_box_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkBox *box;
- GtkButtonBox *bbox;
- gint nvis_children;
- gint child_width;
- gint child_height;
- gint spacing;
- GtkButtonBoxStyle layout;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_VBUTTON_BOX (widget));
- g_return_if_fail (requisition != NULL);
-
- box = GTK_BOX (widget);
- bbox = GTK_BUTTON_BOX (widget);
-
- spacing = bbox->spacing != GTK_BUTTONBOX_DEFAULT
- ? bbox->spacing : default_spacing;
- layout = bbox->layout_style != GTK_BUTTONBOX_DEFAULT_STYLE
- ? bbox->layout_style : default_layout_style;
-
- gtk_button_box_child_requisition (widget,
- &nvis_children,
- &child_width,
- &child_height);
-
- if (nvis_children == 0)
- {
- requisition->width = 0;
- requisition->height = 0;
- }
- else
- {
- switch (layout)
- {
- case GTK_BUTTONBOX_SPREAD:
- requisition->height =
- nvis_children*child_height + ((nvis_children+1)*spacing);
- break;
- case GTK_BUTTONBOX_EDGE:
- case GTK_BUTTONBOX_START:
- case GTK_BUTTONBOX_END:
- requisition->height =
- nvis_children*child_height + ((nvis_children-1)*spacing);
- break;
- default:
- g_assert_not_reached();
- break;
- }
-
- requisition->width = child_width;
- }
-
- requisition->width += GTK_CONTAINER (box)->border_width * 2;
- requisition->height += GTK_CONTAINER (box)->border_width * 2;
-}
-
-
-
-static void
-gtk_vbutton_box_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkButtonBox *box;
- GtkVButtonBox *hbox;
- GtkBoxChild *child;
- GList *children;
- GtkAllocation child_allocation;
- gint nvis_children;
- gint child_width;
- gint child_height;
- gint x = 0;
- gint y = 0;
- gint height;
- gint childspace;
- gint childspacing = 0;
- GtkButtonBoxStyle layout;
- gint spacing;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_VBUTTON_BOX (widget));
- g_return_if_fail (allocation != NULL);
-
- box = GTK_BUTTON_BOX (widget);
- hbox = GTK_VBUTTON_BOX (widget);
- spacing = box->spacing != GTK_BUTTONBOX_DEFAULT
- ? box->spacing : default_spacing;
- layout = box->layout_style != GTK_BUTTONBOX_DEFAULT_STYLE
- ? box->layout_style : default_layout_style;
- gtk_button_box_child_requisition (widget,
- &nvis_children,
- &child_width,
- &child_height);
- widget->allocation = *allocation;
- height = allocation->height - GTK_CONTAINER (box)->border_width*2;
- switch (layout)
- {
- case GTK_BUTTONBOX_SPREAD:
- childspacing = (height - (nvis_children*child_height)) / (nvis_children+1);
- y = allocation->y + GTK_CONTAINER (box)->border_width + childspacing;
- break;
- case GTK_BUTTONBOX_EDGE:
- if (nvis_children >= 2)
- {
- childspacing =
- (height - (nvis_children*child_height)) / (nvis_children-1);
- y = allocation->y + GTK_CONTAINER (box)->border_width;
- }
- else
- {
- /* one or zero children, just center */
- childspacing = height;
- y = allocation->y + (allocation->height - child_height) / 2;
- }
- break;
- case GTK_BUTTONBOX_START:
- childspacing = spacing;
- y = allocation->y + GTK_CONTAINER (box)->border_width;
- break;
- case GTK_BUTTONBOX_END:
- childspacing = spacing;
- y = allocation->x + allocation->height - child_height * nvis_children
- - spacing * (nvis_children-1)
- - GTK_CONTAINER (box)->border_width;
- break;
- default:
- g_assert_not_reached();
- break;
- }
-
-
- x = allocation->x + (allocation->width - child_width) / 2;
- childspace = child_height + childspacing;
-
- children = GTK_BOX (box)->children;
-
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child->widget))
- {
- child_allocation.width = child_width;
- child_allocation.height = child_height;
- child_allocation.x = x;
- child_allocation.y = y;
- gtk_widget_size_allocate (child->widget, &child_allocation);
- y += childspace;
- }
- }
-}
-
-
diff --git a/gtk/gtkvbbox.h b/gtk/gtkvbbox.h
deleted file mode 100644
index 5b334b0ad1..0000000000
--- a/gtk/gtkvbbox.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_VBUTTON_BOX_H__
-#define __GTK_VBUTTON_BOX_H__
-
-
-#include "gtkbbox.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_VBUTTON_BOX(obj) GTK_CHECK_CAST (obj, gtk_vbutton_box_get_type (), GtkVButtonBox)
-#define GTK_VBUTTON_BOX_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_vbutton_box_get_type (), GtkVButtonBoxClass)
-#define GTK_IS_VBUTTON_BOX(obj) GTK_CHECK_TYPE (obj, gtk_vbutton_box_get_type ())
-
-
-typedef struct _GtkVButtonBox GtkVButtonBox;
-typedef struct _GtkVButtonBoxClass GtkVButtonBoxClass;
-
-struct _GtkVButtonBox
-{
- GtkButtonBox button_box;
-};
-
-struct _GtkVButtonBoxClass
-{
- GtkButtonBoxClass parent_class;
-};
-
-
-guint gtk_vbutton_box_get_type (void);
-GtkWidget *gtk_vbutton_box_new (void);
-
-/* buttons can be added by gtk_container_add() */
-
-gint gtk_vbutton_box_get_spacing_default (void);
-void gtk_vbutton_box_set_spacing_default (gint spacing);
-
-GtkButtonBoxStyle gtk_vbutton_box_get_layout_default (void);
-void gtk_vbutton_box_set_layout_default (GtkButtonBoxStyle layout);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_VBUTTON_BOX_H__ */
diff --git a/gtk/gtkvbox.c b/gtk/gtkvbox.c
deleted file mode 100644
index a26f33ebc1..0000000000
--- a/gtk/gtkvbox.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkvbox.h"
-
-
-static void gtk_vbox_class_init (GtkVBoxClass *klass);
-static void gtk_vbox_init (GtkVBox *box);
-static void gtk_vbox_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_vbox_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-
-
-guint
-gtk_vbox_get_type ()
-{
- static guint vbox_type = 0;
-
- if (!vbox_type)
- {
- GtkTypeInfo vbox_info =
- {
- "GtkVBox",
- sizeof (GtkVBox),
- sizeof (GtkVBoxClass),
- (GtkClassInitFunc) gtk_vbox_class_init,
- (GtkObjectInitFunc) gtk_vbox_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- vbox_type = gtk_type_unique (gtk_box_get_type (), &vbox_info);
- }
-
- return vbox_type;
-}
-
-static void
-gtk_vbox_class_init (GtkVBoxClass *class)
-{
- GtkWidgetClass *widget_class;
-
- widget_class = (GtkWidgetClass*) class;
-
- widget_class->size_request = gtk_vbox_size_request;
- widget_class->size_allocate = gtk_vbox_size_allocate;
-}
-
-static void
-gtk_vbox_init (GtkVBox *vbox)
-{
-}
-
-GtkWidget*
-gtk_vbox_new (gint homogeneous,
- gint spacing)
-{
- GtkVBox *vbox;
-
- vbox = gtk_type_new (gtk_vbox_get_type ());
-
- GTK_BOX (vbox)->spacing = spacing;
- GTK_BOX (vbox)->homogeneous = homogeneous ? TRUE : FALSE;
-
- return GTK_WIDGET (vbox);
-}
-
-
-static void
-gtk_vbox_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkBox *box;
- GtkBoxChild *child;
- GList *children;
- gint nvis_children;
- gint height;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_VBOX (widget));
- g_return_if_fail (requisition != NULL);
-
- box = GTK_BOX (widget);
- requisition->width = 0;
- requisition->height = 0;
- nvis_children = 0;
-
- children = box->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child->widget))
- {
- gtk_widget_size_request (child->widget, &child->widget->requisition);
-
- if (box->homogeneous)
- {
- height = child->widget->requisition.height + child->padding * 2;
- requisition->height = MAX (requisition->height, height);
- }
- else
- {
- requisition->height += child->widget->requisition.height + child->padding * 2;
- }
-
- requisition->width = MAX (requisition->width, child->widget->requisition.width);
-
- nvis_children += 1;
- }
- }
-
- if (nvis_children > 0)
- {
- if (box->homogeneous)
- requisition->height *= nvis_children;
- requisition->height += (nvis_children - 1) * box->spacing;
- }
-
- requisition->width += GTK_CONTAINER (box)->border_width * 2;
- requisition->height += GTK_CONTAINER (box)->border_width * 2;
-}
-
-static void
-gtk_vbox_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkBox *box;
- GtkBoxChild *child;
- GList *children;
- GtkAllocation child_allocation;
- gint nvis_children;
- gint nexpand_children;
- gint child_height;
- gint height;
- gint extra;
- gint y;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_VBOX (widget));
- g_return_if_fail (allocation != NULL);
-
- box = GTK_BOX (widget);
- widget->allocation = *allocation;
-
- nvis_children = 0;
- nexpand_children = 0;
- children = box->children;
-
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if (GTK_WIDGET_VISIBLE (child->widget))
- {
- nvis_children += 1;
- if (child->expand)
- nexpand_children += 1;
- }
- }
-
- if (nvis_children > 0)
- {
- if (box->homogeneous)
- {
- height = (allocation->height -
- GTK_CONTAINER (box)->border_width * 2 -
- (nvis_children - 1) * box->spacing);
- extra = height / nvis_children;
- }
- else if (nexpand_children > 0)
- {
- height = allocation->height - widget->requisition.height;
- extra = height / nexpand_children;
- }
- else
- {
- height = 0;
- extra = 0;
- }
-
- y = allocation->y + GTK_CONTAINER (box)->border_width;
- child_allocation.x = allocation->x + GTK_CONTAINER (box)->border_width;
- child_allocation.width = allocation->width - GTK_CONTAINER (box)->border_width * 2;
-
- children = box->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if ((child->pack == GTK_PACK_START) && GTK_WIDGET_VISIBLE (child->widget))
- {
- if (box->homogeneous)
- {
- if (nvis_children == 1)
- child_height = height;
- else
- child_height = extra;
-
- nvis_children -= 1;
- height -= extra;
- }
- else
- {
- child_height = child->widget->requisition.height + child->padding * 2;
-
- if (child->expand)
- {
- if (nexpand_children == 1)
- child_height += height;
- else
- child_height += extra;
-
- nexpand_children -= 1;
- height -= extra;
- }
- }
-
- if (child->fill)
- {
- child_allocation.height = child_height - child->padding * 2;
- child_allocation.y = y + child->padding;
- }
- else
- {
- child_allocation.height = child->widget->requisition.height;
- child_allocation.y = y + (child_height - child_allocation.height) / 2;
- }
-
- gtk_widget_size_allocate (child->widget, &child_allocation);
-
- y += child_height + box->spacing;
- }
- }
-
- y = allocation->y + allocation->height - GTK_CONTAINER (box)->border_width;
-
- children = box->children;
- while (children)
- {
- child = children->data;
- children = children->next;
-
- if ((child->pack == GTK_PACK_END) && GTK_WIDGET_VISIBLE (child->widget))
- {
- if (box->homogeneous)
- {
- if (nvis_children == 1)
- child_height = height;
- else
- child_height = extra;
-
- nvis_children -= 1;
- height -= extra;
- }
- else
- {
- child_height = child->widget->requisition.height + child->padding * 2;
-
- if (child->expand)
- {
- if (nexpand_children == 1)
- child_height += height;
- else
- child_height += extra;
-
- nexpand_children -= 1;
- height -= extra;
- }
- }
-
- if (child->fill)
- {
- child_allocation.height = child_height - child->padding * 2;
- child_allocation.y = y + child->padding - child_height;
- }
- else
- {
- child_allocation.height = child->widget->requisition.height;
- child_allocation.y = y + (child_height - child_allocation.height) / 2 - child_height;
- }
-
- gtk_widget_size_allocate (child->widget, &child_allocation);
-
- y -= (child_height + box->spacing);
- }
- }
- }
-}
diff --git a/gtk/gtkvbox.h b/gtk/gtkvbox.h
deleted file mode 100644
index aad32c914d..0000000000
--- a/gtk/gtkvbox.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_VBOX_H__
-#define __GTK_VBOX_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkbox.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_VBOX(obj) GTK_CHECK_CAST (obj, gtk_vbox_get_type (), GtkVBox)
-#define GTK_VBOX_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_vbox_get_type (), GtkVBoxClass)
-#define GTK_IS_VBOX(obj) GTK_CHECK_TYPE (obj, gtk_vbox_get_type ())
-
-
-typedef struct _GtkVBox GtkVBox;
-typedef struct _GtkVBoxClass GtkVBoxClass;
-
-struct _GtkVBox
-{
- GtkBox box;
-};
-
-struct _GtkVBoxClass
-{
- GtkBoxClass parent_class;
-};
-
-
-guint gtk_vbox_get_type (void);
-GtkWidget* gtk_vbox_new (gint homogeneous,
- gint spacing);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_VBOX_H__ */
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c
deleted file mode 100644
index 08e5d27a28..0000000000
--- a/gtk/gtkviewport.c
+++ /dev/null
@@ -1,681 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtksignal.h"
-#include "gtkviewport.h"
-
-
-static void gtk_viewport_class_init (GtkViewportClass *klass);
-static void gtk_viewport_init (GtkViewport *viewport);
-static void gtk_viewport_finalize (GtkObject *object);
-static void gtk_viewport_map (GtkWidget *widget);
-static void gtk_viewport_unmap (GtkWidget *widget);
-static void gtk_viewport_realize (GtkWidget *widget);
-static void gtk_viewport_unrealize (GtkWidget *widget);
-static void gtk_viewport_paint (GtkWidget *widget,
- GdkRectangle *area);
-static void gtk_viewport_draw (GtkWidget *widget,
- GdkRectangle *area);
-static gint gtk_viewport_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static void gtk_viewport_add (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_viewport_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_viewport_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static gint gtk_viewport_need_resize (GtkContainer *container);
-static void gtk_viewport_adjustment_changed (GtkAdjustment *adjustment,
- gpointer data);
-static void gtk_viewport_adjustment_value_changed (GtkAdjustment *adjustment,
- gpointer data);
-
-static GtkBinClass *parent_class;
-
-guint
-gtk_viewport_get_type ()
-{
- static guint viewport_type = 0;
-
- if (!viewport_type)
- {
- GtkTypeInfo viewport_info =
- {
- "GtkViewport",
- sizeof (GtkViewport),
- sizeof (GtkViewportClass),
- (GtkClassInitFunc) gtk_viewport_class_init,
- (GtkObjectInitFunc) gtk_viewport_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- viewport_type = gtk_type_unique (gtk_bin_get_type (), &viewport_info);
- }
-
- return viewport_type;
-}
-
-static void
-gtk_viewport_class_init (GtkViewportClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GtkObjectClass*) class;
- widget_class = (GtkWidgetClass*) class;
- container_class = (GtkContainerClass*) class;
- parent_class = (GtkBinClass*) gtk_type_class (gtk_bin_get_type ());
-
- object_class->finalize = gtk_viewport_finalize;
-
- widget_class->map = gtk_viewport_map;
- widget_class->unmap = gtk_viewport_unmap;
- widget_class->realize = gtk_viewport_realize;
- widget_class->unrealize = gtk_viewport_unrealize;
- widget_class->draw = gtk_viewport_draw;
- widget_class->expose_event = gtk_viewport_expose;
- widget_class->size_request = gtk_viewport_size_request;
- widget_class->size_allocate = gtk_viewport_size_allocate;
-
- container_class->add = gtk_viewport_add;
- container_class->need_resize = gtk_viewport_need_resize;
-}
-
-static void
-gtk_viewport_init (GtkViewport *viewport)
-{
- GTK_WIDGET_UNSET_FLAGS (viewport, GTK_NO_WINDOW);
- GTK_WIDGET_SET_FLAGS (viewport, GTK_BASIC);
-
- viewport->shadow_type = GTK_SHADOW_IN;
- viewport->view_window = NULL;
- viewport->bin_window = NULL;
- viewport->hadjustment = NULL;
- viewport->vadjustment = NULL;
-}
-
-GtkWidget*
-gtk_viewport_new (GtkAdjustment *hadjustment,
- GtkAdjustment *vadjustment)
-{
- GtkViewport *viewport;
-
- viewport = gtk_type_new (gtk_viewport_get_type ());
-
- if (!hadjustment)
- hadjustment = (GtkAdjustment*) gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
-
- if (!vadjustment)
- vadjustment = (GtkAdjustment*) gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
-
- gtk_viewport_set_hadjustment (viewport, hadjustment);
- gtk_viewport_set_vadjustment (viewport, vadjustment);
-
- return GTK_WIDGET (viewport);
-}
-
-static void
-gtk_viewport_finalize (GtkObject *object)
-{
- GtkViewport *viewport = GTK_VIEWPORT (object);
-
- gtk_object_unref (GTK_OBJECT (viewport->hadjustment));
- gtk_object_unref (GTK_OBJECT (viewport->vadjustment));
-
- GTK_OBJECT_CLASS(parent_class)->finalize (object);
-}
-
-GtkAdjustment*
-gtk_viewport_get_hadjustment (GtkViewport *viewport)
-{
- g_return_val_if_fail (viewport != NULL, NULL);
- g_return_val_if_fail (GTK_IS_VIEWPORT (viewport), NULL);
-
- return viewport->hadjustment;
-}
-
-GtkAdjustment*
-gtk_viewport_get_vadjustment (GtkViewport *viewport)
-{
- g_return_val_if_fail (viewport != NULL, NULL);
- g_return_val_if_fail (GTK_IS_VIEWPORT (viewport), NULL);
-
- return viewport->vadjustment;
-}
-
-void
-gtk_viewport_set_hadjustment (GtkViewport *viewport,
- GtkAdjustment *adjustment)
-{
- g_return_if_fail (viewport != NULL);
- g_return_if_fail (GTK_IS_VIEWPORT (viewport));
- g_return_if_fail (adjustment != NULL);
-
- if (viewport->hadjustment != adjustment)
- {
- if (viewport->hadjustment)
- {
- gtk_signal_disconnect_by_data (GTK_OBJECT (viewport->hadjustment),
- (gpointer) viewport);
- gtk_object_unref (GTK_OBJECT (viewport->hadjustment));
- }
-
- viewport->hadjustment = adjustment;
- gtk_object_ref (GTK_OBJECT (viewport->hadjustment));
- gtk_object_sink (GTK_OBJECT (viewport->hadjustment));
-
- gtk_signal_connect (GTK_OBJECT (adjustment), "changed",
- (GtkSignalFunc) gtk_viewport_adjustment_changed,
- (gpointer) viewport);
- gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
- (GtkSignalFunc)gtk_viewport_adjustment_value_changed,
- (gpointer) viewport);
-
- gtk_viewport_adjustment_changed (adjustment, (gpointer) viewport);
- }
-}
-
-void
-gtk_viewport_set_vadjustment (GtkViewport *viewport,
- GtkAdjustment *adjustment)
-{
- g_return_if_fail (viewport != NULL);
- g_return_if_fail (GTK_IS_VIEWPORT (viewport));
- g_return_if_fail (adjustment != NULL);
-
- if (viewport->vadjustment != adjustment)
- {
- if (viewport->vadjustment)
- {
- gtk_signal_disconnect_by_data (GTK_OBJECT (viewport->vadjustment),
- (gpointer) viewport);
- gtk_object_unref (GTK_OBJECT (viewport->vadjustment));
- }
-
- viewport->vadjustment = adjustment;
- gtk_object_ref (GTK_OBJECT (viewport->vadjustment));
- gtk_object_sink (GTK_OBJECT (viewport->vadjustment));
-
- gtk_signal_connect (GTK_OBJECT (adjustment), "changed",
- (GtkSignalFunc) gtk_viewport_adjustment_changed,
- (gpointer) viewport);
- gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
- (GtkSignalFunc)gtk_viewport_adjustment_value_changed,
- (gpointer) viewport);
-
- gtk_viewport_adjustment_changed (adjustment, (gpointer) viewport);
- }
-}
-
-void
-gtk_viewport_set_shadow_type (GtkViewport *viewport,
- GtkShadowType type)
-{
- g_return_if_fail (viewport != NULL);
- g_return_if_fail (GTK_IS_VIEWPORT (viewport));
-
- if ((GtkShadowType) viewport->shadow_type != type)
- {
- viewport->shadow_type = type;
-
- if (GTK_WIDGET_VISIBLE (viewport))
- {
- gtk_widget_size_allocate (GTK_WIDGET (viewport), &(GTK_WIDGET (viewport)->allocation));
- gtk_widget_queue_draw (GTK_WIDGET (viewport));
- }
- }
-}
-
-
-static void
-gtk_viewport_map (GtkWidget *widget)
-{
- GtkBin *bin;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_VIEWPORT (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
- bin = GTK_BIN (widget);
-
- gdk_window_show (widget->window);
-
- if (bin->child &&
- GTK_WIDGET_VISIBLE (bin->child) &&
- !GTK_WIDGET_MAPPED (bin->child))
- gtk_widget_map (bin->child);
-}
-
-static void
-gtk_viewport_unmap (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_VIEWPORT (widget));
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
-
- gdk_window_hide (widget->window);
-}
-
-static void
-gtk_viewport_realize (GtkWidget *widget)
-{
- GtkBin *bin;
- GtkViewport *viewport;
- GdkWindowAttr attributes;
- GtkRequisition *child_requisition;
- gint attributes_mask;
- gint event_mask;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_VIEWPORT (widget));
-
- bin = GTK_BIN (widget);
- viewport = GTK_VIEWPORT (widget);
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- attributes.x = widget->allocation.x + GTK_CONTAINER (widget)->border_width;
- attributes.y = widget->allocation.y + GTK_CONTAINER (widget)->border_width;
- attributes.width = widget->allocation.width - GTK_CONTAINER (widget)->border_width * 2;
- attributes.height = widget->allocation.height - GTK_CONTAINER (widget)->border_width * 2;
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
-
- event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
- attributes.event_mask = event_mask;
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
- &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, viewport);
-
- attributes.x += widget->style->klass->xthickness;
- attributes.y += widget->style->klass->ythickness;
- attributes.width -= widget->style->klass->xthickness * 2;
- attributes.height -= widget->style->klass->ythickness * 2;
- attributes.event_mask = 0;
-
- viewport->view_window = gdk_window_new (widget->window, &attributes, attributes_mask);
- gdk_window_set_user_data (viewport->view_window, viewport);
-
- attributes.x = 0;
- attributes.y = 0;
- attributes.event_mask = event_mask;
-
- viewport->bin_window = gdk_window_new (viewport->view_window, &attributes, attributes_mask);
- gdk_window_set_user_data (viewport->bin_window, viewport);
-
- if (bin->child)
- {
- child_requisition = &GTK_WIDGET (GTK_BIN (viewport)->child)->requisition;
- attributes.width = child_requisition->width;
- attributes.height = child_requisition->height;
-
- gtk_widget_set_parent_window (bin->child, viewport->bin_window);
- }
-
- widget->style = gtk_style_attach (widget->style, widget->window);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
- gtk_style_set_background (widget->style, viewport->bin_window, GTK_STATE_NORMAL);
-
- gdk_window_show (viewport->bin_window);
- gdk_window_show (viewport->view_window);
-}
-
-static void
-gtk_viewport_unrealize (GtkWidget *widget)
-{
- GtkViewport *viewport;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_VIEWPORT (widget));
-
- viewport = GTK_VIEWPORT (widget);
-
- gdk_window_set_user_data (viewport->view_window, NULL);
- gdk_window_destroy (viewport->view_window);
- viewport->view_window = NULL;
-
- gdk_window_set_user_data (viewport->bin_window, NULL);
- gdk_window_destroy (viewport->bin_window);
- viewport->bin_window = NULL;
-
- if (GTK_WIDGET_CLASS (parent_class)->unrealize)
- (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
-}
-
-static void
-gtk_viewport_paint (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkViewport *viewport;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_VIEWPORT (widget));
- g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- viewport = GTK_VIEWPORT (widget);
-
- gtk_draw_shadow (widget->style, widget->window,
- GTK_STATE_NORMAL, viewport->shadow_type,
- 0, 0, -1, -1);
- }
-}
-
-static void
-gtk_viewport_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkViewport *viewport;
- GtkBin *bin;
- GdkRectangle tmp_area;
- GdkRectangle child_area;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_VIEWPORT (widget));
- g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- viewport = GTK_VIEWPORT (widget);
- bin = GTK_BIN (widget);
-
- gtk_viewport_paint (widget, area);
-
- if (bin->child)
- {
- tmp_area = *area;
- tmp_area.x += viewport->hadjustment->value;
- tmp_area.y += viewport->vadjustment->value;
-
- if (gtk_widget_intersect (bin->child, &tmp_area, &child_area))
- gtk_widget_draw (bin->child, &child_area);
- }
- }
-}
-
-static gint
-gtk_viewport_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- GtkViewport *viewport;
- GtkBin *bin;
- GdkEventExpose child_event;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_VIEWPORT (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- viewport = GTK_VIEWPORT (widget);
- bin = GTK_BIN (widget);
-
- if (event->window == widget->window)
- gtk_viewport_paint (widget, &event->area);
-
- child_event = *event;
- if ((event->window == viewport->bin_window) &&
- (bin->child != NULL) &&
- GTK_WIDGET_NO_WINDOW (bin->child) &&
- gtk_widget_intersect (bin->child, &event->area, &child_event.area))
- gtk_widget_event (bin->child, (GdkEvent*) &child_event);
- }
-
- return FALSE;
-}
-
-static void
-gtk_viewport_add (GtkContainer *container,
- GtkWidget *widget)
-{
- GtkBin *bin;
-
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_VIEWPORT (container));
- g_return_if_fail (widget != NULL);
-
- bin = GTK_BIN (container);
-
- if (!bin->child)
- {
- gtk_widget_set_parent (widget, GTK_WIDGET (container));
- gtk_widget_set_parent_window (widget, GTK_VIEWPORT (container)->bin_window);
- if (GTK_WIDGET_VISIBLE (widget->parent))
- {
- if (GTK_WIDGET_MAPPED (widget->parent) &&
- !GTK_WIDGET_MAPPED (widget))
- gtk_widget_map (widget);
- }
-
- bin->child = widget;
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (container))
- gtk_widget_queue_resize (widget);
- }
-}
-
-static void
-gtk_viewport_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkViewport *viewport;
- GtkBin *bin;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_VIEWPORT (widget));
- g_return_if_fail (requisition != NULL);
-
- viewport = GTK_VIEWPORT (widget);
- bin = GTK_BIN (widget);
-
- requisition->width = (GTK_CONTAINER (widget)->border_width +
- GTK_WIDGET (widget)->style->klass->xthickness) * 2 + 5;
-
- requisition->height = (GTK_CONTAINER (widget)->border_width * 2 +
- GTK_WIDGET (widget)->style->klass->ythickness) * 2 + 5;
-
- if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
- gtk_widget_size_request (bin->child, &bin->child->requisition);
-}
-
-static void
-gtk_viewport_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkViewport *viewport;
- GtkBin *bin;
- GtkAllocation child_allocation;
- gint hval, vval;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_VIEWPORT (widget));
- g_return_if_fail (allocation != NULL);
-
- widget->allocation = *allocation;
- viewport = GTK_VIEWPORT (widget);
- bin = GTK_BIN (widget);
-
- child_allocation.x = 0;
- child_allocation.y = 0;
-
- if (viewport->shadow_type != GTK_SHADOW_NONE)
- {
- child_allocation.x = GTK_WIDGET (viewport)->style->klass->xthickness;
- child_allocation.y = GTK_WIDGET (viewport)->style->klass->ythickness;
- }
-
- child_allocation.width = allocation->width - child_allocation.x * 2;
- child_allocation.height = allocation->height - child_allocation.y * 2;
-
- if (GTK_WIDGET_REALIZED (widget))
- {
- gdk_window_move_resize (widget->window,
- allocation->x + GTK_CONTAINER (viewport)->border_width,
- allocation->y + GTK_CONTAINER (viewport)->border_width,
- allocation->width - GTK_CONTAINER (viewport)->border_width * 2,
- allocation->height - GTK_CONTAINER (viewport)->border_width * 2);
-
- gdk_window_move_resize (viewport->view_window,
- child_allocation.x,
- child_allocation.y,
- child_allocation.width,
- child_allocation.height);
- }
-
- viewport->hadjustment->page_size = child_allocation.width;
- viewport->hadjustment->page_increment = viewport->hadjustment->page_size / 2;
- viewport->hadjustment->step_increment = 10;
-
- viewport->vadjustment->page_size = child_allocation.height;
- viewport->vadjustment->page_increment = viewport->vadjustment->page_size / 2;
- viewport->vadjustment->step_increment = 10;
-
- hval = viewport->hadjustment->value;
- vval = viewport->vadjustment->value;
-
- if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
- {
- viewport->hadjustment->lower = 0;
- viewport->hadjustment->upper = MAX (bin->child->requisition.width,
- child_allocation.width);
-
- hval = CLAMP (hval, 0,
- viewport->hadjustment->upper -
- viewport->hadjustment->page_size);
-
- viewport->vadjustment->lower = 0;
- viewport->vadjustment->upper = MAX (bin->child->requisition.height,
- child_allocation.height);
-
- vval = CLAMP (vval, 0,
- viewport->vadjustment->upper -
- viewport->vadjustment->page_size);
- }
-
- if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
- {
- child_allocation.x = 0;
- child_allocation.y = 0;
-
- child_allocation.width = viewport->hadjustment->upper;
- child_allocation.height = viewport->vadjustment->upper;
-
- if (!GTK_WIDGET_REALIZED (widget))
- gtk_widget_realize (widget);
-
- gdk_window_resize (viewport->bin_window,
- child_allocation.width,
- child_allocation.height);
-
- child_allocation.x = 0;
- child_allocation.y = 0;
- gtk_widget_size_allocate (bin->child, &child_allocation);
- }
-
- gtk_signal_emit_by_name (GTK_OBJECT (viewport->hadjustment), "changed");
- gtk_signal_emit_by_name (GTK_OBJECT (viewport->vadjustment), "changed");
- if (viewport->hadjustment->value != hval)
- {
- viewport->hadjustment->value = hval;
- gtk_signal_emit_by_name (GTK_OBJECT (viewport->hadjustment), "value_changed");
- }
- if (viewport->vadjustment->value != vval)
- {
- viewport->vadjustment->value = vval;
- gtk_signal_emit_by_name (GTK_OBJECT (viewport->vadjustment), "value_changed");
- }
-}
-
-static gint
-gtk_viewport_need_resize (GtkContainer *container)
-{
- GtkBin *bin;
-
- g_return_val_if_fail (container != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_VIEWPORT (container), FALSE);
-
- if (GTK_WIDGET_REALIZED (container))
- {
- bin = GTK_BIN (container);
-
- gtk_widget_size_request (bin->child, &bin->child->requisition);
-
- gtk_widget_size_allocate (GTK_WIDGET (container),
- &(GTK_WIDGET (container)->allocation));
- }
-
- return FALSE;
-}
-
-static void
-gtk_viewport_adjustment_changed (GtkAdjustment *adjustment,
- gpointer data)
-{
- GtkViewport *viewport;
-
- g_return_if_fail (adjustment != NULL);
- g_return_if_fail (data != NULL);
- g_return_if_fail (GTK_IS_VIEWPORT (data));
-
- viewport = GTK_VIEWPORT (data);
-}
-
-static void
-gtk_viewport_adjustment_value_changed (GtkAdjustment *adjustment,
- gpointer data)
-{
- GtkViewport *viewport;
- GtkBin *bin;
- GtkAllocation child_allocation;
- gint width, height;
-
- g_return_if_fail (adjustment != NULL);
- g_return_if_fail (data != NULL);
- g_return_if_fail (GTK_IS_VIEWPORT (data));
-
- viewport = GTK_VIEWPORT (data);
- bin = GTK_BIN (data);
-
- if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
- {
- gdk_window_get_size (viewport->view_window, &width, &height);
-
- child_allocation.x = 0;
- child_allocation.y = 0;
-
- if (viewport->hadjustment->lower != (viewport->hadjustment->upper -
- viewport->hadjustment->page_size))
- child_allocation.x = viewport->hadjustment->lower - viewport->hadjustment->value;
-
- if (viewport->vadjustment->lower != (viewport->vadjustment->upper -
- viewport->vadjustment->page_size))
- child_allocation.y = viewport->vadjustment->lower - viewport->vadjustment->value;
-
- if (GTK_WIDGET_REALIZED (viewport))
- gdk_window_move (viewport->bin_window,
- child_allocation.x,
- child_allocation.y);
- }
-}
diff --git a/gtk/gtkviewport.h b/gtk/gtkviewport.h
deleted file mode 100644
index fd3bac5fd7..0000000000
--- a/gtk/gtkviewport.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_VIEWPORT_H__
-#define __GTK_VIEWPORT_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkadjustment.h>
-#include <gtk/gtkbin.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_VIEWPORT(obj) GTK_CHECK_CAST (obj, gtk_viewport_get_type (), GtkViewport)
-#define GTK_VIEWPORT_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_viewport_get_type (), GtkViewportClass)
-#define GTK_IS_VIEWPORT(obj) GTK_CHECK_TYPE (obj, gtk_viewport_get_type ())
-
-
-typedef struct _GtkViewport GtkViewport;
-typedef struct _GtkViewportClass GtkViewportClass;
-
-struct _GtkViewport
-{
- GtkBin bin;
-
- gint shadow_type;
- GdkWindow *view_window;
- GdkWindow *bin_window;
- GtkAdjustment *hadjustment;
- GtkAdjustment *vadjustment;
-};
-
-struct _GtkViewportClass
-{
- GtkBinClass parent_class;
-};
-
-
-guint gtk_viewport_get_type (void);
-GtkWidget* gtk_viewport_new (GtkAdjustment *hadjustment,
- GtkAdjustment *vadjustment);
-GtkAdjustment* gtk_viewport_get_hadjustment (GtkViewport *viewport);
-GtkAdjustment* gtk_viewport_get_vadjustment (GtkViewport *viewport);
-void gtk_viewport_set_hadjustment (GtkViewport *viewport,
- GtkAdjustment *adjustment);
-void gtk_viewport_set_vadjustment (GtkViewport *viewport,
- GtkAdjustment *adjustment);
-void gtk_viewport_set_shadow_type (GtkViewport *viewport,
- GtkShadowType type);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_VIEWPORT_H__ */
diff --git a/gtk/gtkvpaned.c b/gtk/gtkvpaned.c
deleted file mode 100644
index 6db823ff60..0000000000
--- a/gtk/gtkvpaned.c
+++ /dev/null
@@ -1,360 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkvpaned.h"
-#include "gtkmain.h"
-#include "gtksignal.h"
-
-static void gtk_vpaned_class_init (GtkVPanedClass *klass);
-static void gtk_vpaned_init (GtkVPaned *vpaned);
-static void gtk_vpaned_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_vpaned_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_vpaned_draw (GtkWidget *widget,
- GdkRectangle *area);
-static void gtk_vpaned_xor_line (GtkPaned *paned);
-static gint gtk_vpaned_button_press (GtkWidget *widget,
- GdkEventButton *event);
-static gint gtk_vpaned_button_release (GtkWidget *widget,
- GdkEventButton *event);
-static gint gtk_vpaned_motion (GtkWidget *widget,
- GdkEventMotion *event);
-
-guint
-gtk_vpaned_get_type ()
-{
- static guint vpaned_type = 0;
-
- if (!vpaned_type)
- {
- GtkTypeInfo vpaned_info =
- {
- "GtkVPaned",
- sizeof (GtkVPaned),
- sizeof (GtkVPanedClass),
- (GtkClassInitFunc) gtk_vpaned_class_init,
- (GtkObjectInitFunc) gtk_vpaned_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- vpaned_type = gtk_type_unique (gtk_paned_get_type (), &vpaned_info);
- }
-
- return vpaned_type;
-}
-
-static void
-gtk_vpaned_class_init (GtkVPanedClass *class)
-{
- GtkWidgetClass *widget_class;
-
- widget_class = (GtkWidgetClass*) class;
-
- widget_class->size_request = gtk_vpaned_size_request;
- widget_class->size_allocate = gtk_vpaned_size_allocate;
- widget_class->draw = gtk_vpaned_draw;
- widget_class->button_press_event = gtk_vpaned_button_press;
- widget_class->button_release_event = gtk_vpaned_button_release;
- widget_class->motion_notify_event = gtk_vpaned_motion;
-}
-
-static void
-gtk_vpaned_init (GtkVPaned *vpaned)
-{
-}
-
-GtkWidget*
-gtk_vpaned_new ()
-{
- GtkVPaned *vpaned;
-
- vpaned = gtk_type_new (gtk_vpaned_get_type ());
-
- return GTK_WIDGET (vpaned);
-}
-
-static void
-gtk_vpaned_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkPaned *paned;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_VPANED (widget));
- g_return_if_fail (requisition != NULL);
-
- paned = GTK_PANED (widget);
- requisition->width = 0;
- requisition->height = 0;
-
- if (paned->child1 && GTK_WIDGET_VISIBLE (paned->child1))
- {
- gtk_widget_size_request (paned->child1, &paned->child1->requisition);
-
- requisition->height = paned->child1->requisition.height;
- requisition->width = paned->child1->requisition.width;
- }
-
- if (paned->child2 && GTK_WIDGET_VISIBLE (paned->child2))
- {
- gtk_widget_size_request (paned->child2, &paned->child2->requisition);
-
- requisition->width = MAX (requisition->width,
- paned->child2->requisition.width);
- requisition->height += paned->child2->requisition.height;
- }
-
- requisition->height += GTK_CONTAINER (paned)->border_width * 2 + paned->gutter_size;
- requisition->width += GTK_CONTAINER (paned)->border_width * 2;
-}
-
-static void
-gtk_vpaned_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkPaned *paned;
- GtkAllocation child1_allocation;
- GtkAllocation child2_allocation;
- guint16 border_width;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_VPANED (widget));
- g_return_if_fail (allocation != NULL);
-
- widget->allocation = *allocation;
-
- paned = GTK_PANED (widget);
- border_width = GTK_CONTAINER (widget)->border_width;
-
- if (!paned->position_set)
- {
- if (paned->child1 && GTK_WIDGET_VISIBLE (paned->child1))
- paned->child1_size = paned->child1->requisition.height;
- else
- paned->child1_size = 0;
- }
-
- /* Move the handle before the children so we don't get extra expose events */
-
- paned->handle_xpos = allocation->width - border_width - 2 * paned->handle_size;
- paned->handle_ypos = paned->child1_size + border_width + paned->gutter_size / 2 - paned->handle_size / 2;
-
- if (GTK_WIDGET_REALIZED (widget))
- {
- gdk_window_move_resize (widget->window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
-
- gdk_window_move (paned->handle, paned->handle_xpos, paned->handle_ypos);
- }
-
- if (GTK_WIDGET_MAPPED (widget))
- {
- gdk_window_clear_area (widget->window,
- paned->groove_rectangle.x,
- paned->groove_rectangle.y,
- paned->groove_rectangle.width,
- paned->groove_rectangle.height);
- }
-
- child1_allocation.width = child2_allocation.width = allocation->width - border_width * 2;
- child1_allocation.height = paned->child1_size;
- child1_allocation.x = child2_allocation.x = border_width;
- child1_allocation.y = border_width;
-
- paned->groove_rectangle.y = child1_allocation.y
- + child1_allocation.height + paned->gutter_size / 2 - 1;
- paned->groove_rectangle.x = 0;
- paned->groove_rectangle.height = 2;
- paned->groove_rectangle.width = allocation->width;
-
- child2_allocation.y = paned->groove_rectangle.y + paned->gutter_size / 2 + 1;
- child2_allocation.height = allocation->height
- - child2_allocation.y - border_width;
-
- /* Now allocate the childen, making sure, when resizing not to
- * overlap the windows */
- if (GTK_WIDGET_MAPPED(widget) &&
- paned->child1 && GTK_WIDGET_VISIBLE (paned->child1) &&
- paned->child1->allocation.height < child1_allocation.height)
- {
- if (paned->child2 && GTK_WIDGET_VISIBLE (paned->child2))
- gtk_widget_size_allocate (paned->child2, &child2_allocation);
- gtk_widget_size_allocate (paned->child1, &child1_allocation);
- }
- else
- {
- if (paned->child1 && GTK_WIDGET_VISIBLE (paned->child1))
- gtk_widget_size_allocate (paned->child1, &child1_allocation);
- if (paned->child2 && GTK_WIDGET_VISIBLE (paned->child2))
- gtk_widget_size_allocate (paned->child2, &child2_allocation);
- }
-}
-
-static void
-gtk_vpaned_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- GtkPaned *paned;
- GdkRectangle child_area;
- guint16 border_width;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_PANED (widget));
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget))
- {
- paned = GTK_PANED (widget);
- border_width = GTK_CONTAINER (paned)->border_width;
-
- if (paned->child1 &&
- gtk_widget_intersect (paned->child1, area, &child_area))
- gtk_widget_draw (paned->child1, &child_area);
- if (paned->child2 &&
- gtk_widget_intersect (paned->child2, area, &child_area))
- gtk_widget_draw (paned->child2, &child_area);
-
- gdk_draw_line (widget->window,
- widget->style->dark_gc[widget->state],
- 0,
- border_width + paned->child1_size + paned->gutter_size / 2 - 1,
- widget->allocation.width - 1,
- border_width + paned->child1_size + paned->gutter_size / 2 - 1);
- gdk_draw_line (widget->window,
- widget->style->light_gc[widget->state],
- 0,
- border_width + paned->child1_size + paned->gutter_size / 2,
- widget->allocation.width - 1,
- border_width + paned->child1_size + paned->gutter_size / 2);
- }
-}
-
-static void
-gtk_vpaned_xor_line (GtkPaned *paned)
-{
- GtkWidget *widget;
- GdkGCValues values;
- guint16 ypos;
-
- widget = GTK_WIDGET(paned);
-
- if (!paned->xor_gc)
- {
- values.foreground = widget->style->white;
- values.function = GDK_XOR;
- values.subwindow_mode = GDK_INCLUDE_INFERIORS;
- paned->xor_gc = gdk_gc_new_with_values (widget->window,
- &values,
- GDK_GC_FOREGROUND |
- GDK_GC_FUNCTION |
- GDK_GC_SUBWINDOW);
- }
-
- ypos = paned->child1_size
- + GTK_CONTAINER (paned)->border_width + paned->gutter_size / 2;
-
- gdk_draw_line (widget->window, paned->xor_gc,
- 0,
- ypos,
- widget->allocation.width - 1,
- ypos);
-}
-
-static gint
-gtk_vpaned_button_press (GtkWidget *widget, GdkEventButton *event)
-{
- GtkPaned *paned;
-
- g_return_val_if_fail (widget != NULL,FALSE);
- g_return_val_if_fail (GTK_IS_PANED (widget),FALSE);
-
- paned = GTK_PANED (widget);
-
- if (!paned->in_drag &&
- (event->window == paned->handle) && (event->button == 1))
- {
- paned->in_drag = TRUE;
- /* We need a server grab here, not gtk_grab_add(), since
- * we don't want to pass events on to the widget's children */
- gdk_pointer_grab (paned->handle, FALSE,
- GDK_POINTER_MOTION_HINT_MASK
- | GDK_BUTTON1_MOTION_MASK
- | GDK_BUTTON_RELEASE_MASK,
- NULL, NULL, event->time);
- paned->child1_size += event->y - paned->handle_size / 2;
- paned->child1_size = CLAMP (paned->child1_size, 0,
- widget->allocation.height - paned->gutter_size
- - 2 * GTK_CONTAINER (paned)->border_width);
- gtk_vpaned_xor_line (paned);
- }
-
- return TRUE;
-}
-
-static gint
-gtk_vpaned_button_release (GtkWidget *widget, GdkEventButton *event)
-{
- GtkPaned *paned;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_PANED (widget), FALSE);
-
- paned = GTK_PANED (widget);
-
- if (paned->in_drag && (event->button == 1))
- {
- gtk_vpaned_xor_line (paned);
- paned->in_drag = FALSE;
- paned->position_set = TRUE;
- gdk_pointer_ungrab (event->time);
- gtk_widget_queue_resize (GTK_WIDGET (paned));
- }
-
- return TRUE;
-}
-
-static gint
-gtk_vpaned_motion (GtkWidget *widget, GdkEventMotion *event)
-{
- GtkPaned *paned;
- gint y;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_PANED (widget), FALSE);
-
- if (event->is_hint || event->window != widget->window)
- gtk_widget_get_pointer(widget, NULL, &y);
- else
- y = event->y;
-
- paned = GTK_PANED (widget);
-
- if (paned->in_drag)
- {
- gtk_vpaned_xor_line (paned);
- paned->child1_size = y - GTK_CONTAINER (paned)->border_width -
- paned->gutter_size/2;
- paned->child1_size = CLAMP (paned->child1_size, 0,
- widget->allocation.height - paned->gutter_size
- - 2 * GTK_CONTAINER (paned)->border_width);
- gtk_vpaned_xor_line (paned);
- }
-
- return TRUE;
-}
diff --git a/gtk/gtkvpaned.h b/gtk/gtkvpaned.h
deleted file mode 100644
index 5429681932..0000000000
--- a/gtk/gtkvpaned.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_VPANED_H__
-#define __GTK_VPANED_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkpaned.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_VPANED(obj) GTK_CHECK_CAST (obj, gtk_vpaned_get_type (), GtkVPaned)
-#define GTK_VPANED_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_vpaned_get_type (), GtkVPanedClass)
-#define GTK_IS_VPANED(obj) GTK_CHECK_TYPE (obj, gtk_vpaned_get_type ())
-
-
-typedef struct _GtkVPaned GtkVPaned;
-typedef struct _GtkVPanedClass GtkVPanedClass;
-
-struct _GtkVPaned
-{
- GtkPaned paned;
-};
-
-struct _GtkVPanedClass
-{
- GtkPanedClass parent_class;
-};
-
-
-guint gtk_vpaned_get_type (void);
-GtkWidget* gtk_vpaned_new (void);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_VPANED_H__ */
diff --git a/gtk/gtkvruler.c b/gtk/gtkvruler.c
deleted file mode 100644
index 80c97a61fa..0000000000
--- a/gtk/gtkvruler.c
+++ /dev/null
@@ -1,295 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-#include "gtkvruler.h"
-
-
-#define RULER_WIDTH 14
-#define MINIMUM_INCR 5
-#define MAXIMUM_SUBDIVIDE 5
-#define MAXIMUM_SCALES 10
-
-#define ROUND(x) ((int) ((x) + 0.5))
-
-
-static void gtk_vruler_class_init (GtkVRulerClass *klass);
-static void gtk_vruler_init (GtkVRuler *vruler);
-static gint gtk_vruler_motion_notify (GtkWidget *widget,
- GdkEventMotion *event);
-static void gtk_vruler_draw_ticks (GtkRuler *ruler);
-static void gtk_vruler_draw_pos (GtkRuler *ruler);
-
-
-guint
-gtk_vruler_get_type ()
-{
- static guint vruler_type = 0;
-
- if (!vruler_type)
- {
- GtkTypeInfo vruler_info =
- {
- "GtkVRuler",
- sizeof (GtkVRuler),
- sizeof (GtkVRulerClass),
- (GtkClassInitFunc) gtk_vruler_class_init,
- (GtkObjectInitFunc) gtk_vruler_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- vruler_type = gtk_type_unique (gtk_ruler_get_type (), &vruler_info);
- }
-
- return vruler_type;
-}
-
-static void
-gtk_vruler_class_init (GtkVRulerClass *klass)
-{
- GtkWidgetClass *widget_class;
- GtkRulerClass *ruler_class;
-
- widget_class = (GtkWidgetClass*) klass;
- ruler_class = (GtkRulerClass*) klass;
-
- widget_class->motion_notify_event = gtk_vruler_motion_notify;
-
- ruler_class->draw_ticks = gtk_vruler_draw_ticks;
- ruler_class->draw_pos = gtk_vruler_draw_pos;
-}
-
-static void
-gtk_vruler_init (GtkVRuler *vruler)
-{
- GtkWidget *widget;
-
- widget = GTK_WIDGET (vruler);
- widget->requisition.width = widget->style->klass->xthickness * 2 + RULER_WIDTH;
- widget->requisition.height = widget->style->klass->ythickness * 2 + 1;
-}
-
-GtkWidget*
-gtk_vruler_new ()
-{
- return GTK_WIDGET (gtk_type_new (gtk_vruler_get_type ()));
-}
-
-
-static gint
-gtk_vruler_motion_notify (GtkWidget *widget,
- GdkEventMotion *event)
-{
- GtkRuler *ruler;
- gint y;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_VRULER (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- ruler = GTK_RULER (widget);
-
- if (event->is_hint)
- gdk_window_get_pointer (widget->window, NULL, &y, NULL);
- else
- y = event->y;
-
- ruler->position = ruler->lower + ((ruler->upper - ruler->lower) * y) / widget->allocation.height;
-
- /* Make sure the ruler has been allocated already */
- if (ruler->backing_store != NULL)
- gtk_ruler_draw_pos (ruler);
-
- return FALSE;
-}
-
-static void
-gtk_vruler_draw_ticks (GtkRuler *ruler)
-{
- GtkWidget *widget;
- GdkGC *gc, *bg_gc;
- GdkFont * font;
- gint i, j;
- gint width, height;
- gint xthickness;
- gint ythickness;
- gint length, ideal_length;
- gfloat subd_incr;
- gfloat step_incr;
- gfloat increment;
- gfloat start, end, cur;
- gchar unit_str[12];
- gchar digit_str[2] = { '\0', '\0' };
- gint text_height;
- gint digit_height;
- gint pos;
- gint scale;
-
- g_return_if_fail (ruler != NULL);
- g_return_if_fail (GTK_IS_VRULER (ruler));
-
- if (GTK_WIDGET_DRAWABLE (ruler))
- {
- widget = GTK_WIDGET (ruler);
-
- gc = widget->style->fg_gc[GTK_STATE_NORMAL];
- bg_gc = widget->style->bg_gc[GTK_STATE_NORMAL];
- font = widget->style->font;
- xthickness = widget->style->klass->xthickness;
- ythickness = widget->style->klass->ythickness;
- digit_height = font->ascent; /* Assume descent == 0 ? */
-
- width = widget->allocation.height;
- height = widget->allocation.width - ythickness * 2;
- gdk_draw_line (ruler->backing_store, gc,
- height + xthickness,
- ythickness,
- height + xthickness,
- widget->allocation.height - ythickness);
-
- if ((ruler->upper - ruler->lower) == 0)
- return;
-
- increment = (gfloat) width * ruler->metric->pixels_per_unit / (ruler->upper - ruler->lower);
-
- /* determine the scale
- * use the maximum extents of the ruler to determine the largest possible
- * number to be displayed. calculate the height in pixels of this displayed
- * text as for the vertical ruler case. use this height to find a scale
- * which leaves sufficient room for drawing the ruler.
- */
- scale = ceil (ruler->max_size / ruler->metric->pixels_per_unit);
- sprintf (unit_str, "%d", scale);
- text_height = strlen (unit_str) * digit_height + 1;
-
- for (scale = 0; scale < MAXIMUM_SCALES; scale++)
- if (ruler->metric->ruler_scale[scale] * increment > 2 * text_height)
- break;
-
- if (scale == MAXIMUM_SCALES)
- scale = MAXIMUM_SCALES - 1;
-
- length = 0;
- for (i = MAXIMUM_SUBDIVIDE - 1; i >= 0; i--)
- {
- subd_incr = (gfloat) ruler->metric->ruler_scale[scale] / (gfloat) ruler->metric->subdivide[i];
- step_incr = subd_incr * increment;
- if (step_incr <= MINIMUM_INCR)
- continue;
-
- start = floor ((ruler->lower / ruler->metric->pixels_per_unit) / subd_incr) * subd_incr;
- end = ceil ((ruler->upper / ruler->metric->pixels_per_unit) / subd_incr) * subd_incr;
-
- ideal_length = height / (i + 1) - 1;
- if (ideal_length > ++length)
- length = ideal_length;
-
- cur = start;
- while (cur <= end)
- {
- pos = ROUND ((cur - (ruler->lower / ruler->metric->pixels_per_unit)) * increment);
-
- gdk_draw_line (ruler->backing_store, gc,
- height + xthickness - length,
- pos,
- height + xthickness,
- pos);
-
- if (i == 0)
- {
- sprintf (unit_str, "%d", (int) cur);
- for (j = 0; j < (int) strlen (unit_str); j++)
- {
- digit_str[0] = unit_str[j];
- gdk_draw_rectangle (ruler->backing_store,
- bg_gc, TRUE,
- xthickness + 1,
- pos + digit_height * j + 1,
- gdk_string_width(font, digit_str),
- digit_height);
- gdk_draw_string (ruler->backing_store, font, gc,
- xthickness + 1,
- pos + digit_height * (j + 1) + 1,
- digit_str);
- }
- }
-
- cur += subd_incr;
- }
- }
- }
-}
-
-static void
-gtk_vruler_draw_pos (GtkRuler *ruler)
-{
- GtkWidget *widget;
- GdkGC *gc;
- int i;
- gint x, y;
- gint width, height;
- gint bs_width, bs_height;
- gint xthickness;
- gint ythickness;
- gfloat increment;
-
- g_return_if_fail (ruler != NULL);
- g_return_if_fail (GTK_IS_VRULER (ruler));
-
- if (GTK_WIDGET_DRAWABLE (ruler))
- {
- widget = GTK_WIDGET (ruler);
-
- gc = widget->style->fg_gc[GTK_STATE_NORMAL];
- xthickness = widget->style->klass->xthickness;
- ythickness = widget->style->klass->ythickness;
- width = widget->allocation.width - xthickness * 2;
- height = widget->allocation.height;
-
- bs_height = width / 2;
- bs_height |= 1; /* make sure it's odd */
- bs_width = bs_height / 2 + 1;
-
- if ((bs_width > 0) && (bs_height > 0))
- {
- /* If a backing store exists, restore the ruler */
- if (ruler->backing_store && ruler->non_gr_exp_gc)
- gdk_draw_pixmap (ruler->widget.window,
- ruler->non_gr_exp_gc,
- ruler->backing_store,
- ruler->xsrc, ruler->ysrc,
- ruler->xsrc, ruler->ysrc,
- bs_width, bs_height);
-
- increment = (gfloat) height / (ruler->upper - ruler->lower);
-
- x = (width + bs_width) / 2 + xthickness;
- y = ROUND ((ruler->position - ruler->lower) * increment) + (ythickness - bs_height) / 2 - 1;
-
- for (i = 0; i < bs_width; i++)
- gdk_draw_line (widget->window, gc,
- x + i, y + i,
- x + i, y + bs_height - 1 - i);
-
- ruler->xsrc = x;
- ruler->ysrc = y;
- }
- }
-}
diff --git a/gtk/gtkvruler.h b/gtk/gtkvruler.h
deleted file mode 100644
index 22bef7164e..0000000000
--- a/gtk/gtkvruler.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_VRULER_H__
-#define __GTK_VRULER_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkruler.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_VRULER(obj) GTK_CHECK_CAST (obj, gtk_vruler_get_type (), GtkVRuler)
-#define GTK_VRULER_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_vruler_get_type (), GtkVRulerClass)
-#define GTK_IS_VRULER(obj) GTK_CHECK_TYPE (obj, gtk_vruler_get_type ())
-
-
-typedef struct _GtkVRuler GtkVRuler;
-typedef struct _GtkVRulerClass GtkVRulerClass;
-
-struct _GtkVRuler
-{
- GtkRuler ruler;
-};
-
-struct _GtkVRulerClass
-{
- GtkRulerClass parent_class;
-};
-
-
-guint gtk_vruler_get_type (void);
-GtkWidget* gtk_vruler_new (void);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_VRULER_H__ */
diff --git a/gtk/gtkvscale.c b/gtk/gtkvscale.c
deleted file mode 100644
index 292d3a7bcb..0000000000
--- a/gtk/gtkvscale.c
+++ /dev/null
@@ -1,442 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <stdio.h>
-#include "gtkvscale.h"
-#include "gtksignal.h"
-#include "gdk/gdkkeysyms.h"
-
-
-#define SCALE_CLASS(w) GTK_SCALE_CLASS (GTK_OBJECT (w)->klass)
-#define RANGE_CLASS(w) GTK_RANGE_CLASS (GTK_OBJECT (w)->klass)
-
-
-static void gtk_vscale_class_init (GtkVScaleClass *klass);
-static void gtk_vscale_init (GtkVScale *vscale);
-static void gtk_vscale_realize (GtkWidget *widget);
-static void gtk_vscale_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_vscale_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_vscale_pos_trough (GtkVScale *vscale,
- gint *x,
- gint *y,
- gint *w,
- gint *h);
-static void gtk_vscale_draw_slider (GtkRange *range);
-static void gtk_vscale_draw_value (GtkScale *scale);
-static gint gtk_vscale_trough_keys (GtkRange *range,
- GdkEventKey *key,
- GtkScrollType *scroll,
- GtkTroughType *pos);
-
-
-guint
-gtk_vscale_get_type ()
-{
- static guint vscale_type = 0;
-
- if (!vscale_type)
- {
- GtkTypeInfo vscale_info =
- {
- "GtkVScale",
- sizeof (GtkVScale),
- sizeof (GtkVScaleClass),
- (GtkClassInitFunc) gtk_vscale_class_init,
- (GtkObjectInitFunc) gtk_vscale_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- vscale_type = gtk_type_unique (gtk_scale_get_type (), &vscale_info);
- }
-
- return vscale_type;
-}
-
-static void
-gtk_vscale_class_init (GtkVScaleClass *class)
-{
- GtkWidgetClass *widget_class;
- GtkRangeClass *range_class;
- GtkScaleClass *scale_class;
-
- widget_class = (GtkWidgetClass*) class;
- range_class = (GtkRangeClass*) class;
- scale_class = (GtkScaleClass*) class;
-
- widget_class->realize = gtk_vscale_realize;
- widget_class->size_request = gtk_vscale_size_request;
- widget_class->size_allocate = gtk_vscale_size_allocate;
-
- range_class->slider_update = gtk_range_default_vslider_update;
- range_class->trough_click = gtk_range_default_vtrough_click;
- range_class->motion = gtk_range_default_vmotion;
- range_class->draw_slider = gtk_vscale_draw_slider;
- range_class->trough_keys = gtk_vscale_trough_keys;
-
- scale_class->draw_value = gtk_vscale_draw_value;
-}
-
-static void
-gtk_vscale_init (GtkVScale *vscale)
-{
-}
-
-GtkWidget*
-gtk_vscale_new (GtkAdjustment *adjustment)
-{
- GtkVScale *vscale;
-
- vscale = gtk_type_new (gtk_vscale_get_type ());
-
- if (!adjustment)
- adjustment = (GtkAdjustment*) gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
-
- gtk_range_set_adjustment (GTK_RANGE (vscale), adjustment);
-
- return GTK_WIDGET (vscale);
-}
-
-
-static void
-gtk_vscale_realize (GtkWidget *widget)
-{
- GtkRange *range;
- GdkWindowAttr attributes;
- gint attributes_mask;
- gint x, y, w, h;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_VSCALE (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
- range = GTK_RANGE (widget);
-
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
-
- gtk_vscale_pos_trough (GTK_VSCALE (widget), &x, &y, &w, &h);
- attributes.x = x;
- attributes.y = y;
- attributes.width = w;
- attributes.height = h;
- attributes.event_mask |= (GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_ENTER_NOTIFY_MASK |
- GDK_LEAVE_NOTIFY_MASK);
-
- range->trough = gdk_window_new (widget->window, &attributes, attributes_mask);
-
- attributes.width = RANGE_CLASS (range)->slider_width;
- attributes.height = SCALE_CLASS (range)->slider_length;
- attributes.event_mask |= (GDK_BUTTON_MOTION_MASK |
- GDK_POINTER_MOTION_HINT_MASK);
-
- range->slider = gdk_window_new (range->trough, &attributes, attributes_mask);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
-
- gdk_window_set_user_data (widget->window, widget);
- gdk_window_set_user_data (range->trough, widget);
- gdk_window_set_user_data (range->slider, widget);
-
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
- gtk_style_set_background (widget->style, range->trough, GTK_STATE_ACTIVE);
- gtk_style_set_background (widget->style, range->slider, GTK_STATE_NORMAL);
-
- gtk_range_slider_update (GTK_RANGE (widget));
-
- gdk_window_show (range->slider);
- gdk_window_show (range->trough);
-}
-
-static void
-gtk_vscale_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkScale *scale;
- gint value_width;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_VSCALE (widget));
- g_return_if_fail (requisition != NULL);
-
- scale = GTK_SCALE (widget);
-
- requisition->width = (RANGE_CLASS (scale)->slider_width +
- widget->style->klass->ythickness * 2);
- requisition->height = (SCALE_CLASS (scale)->slider_length +
- widget->style->klass->xthickness) * 2;
-
- if (scale->draw_value)
- {
- value_width = gtk_scale_value_width (scale);
-
- if ((scale->value_pos == GTK_POS_LEFT) ||
- (scale->value_pos == GTK_POS_RIGHT))
- {
- requisition->width += value_width + SCALE_CLASS (scale)->value_spacing;
- if (requisition->height < (widget->style->font->ascent + widget->style->font->descent))
- requisition->height = widget->style->font->ascent + widget->style->font->descent;
- }
- else if ((scale->value_pos == GTK_POS_TOP) ||
- (scale->value_pos == GTK_POS_BOTTOM))
- {
- if (requisition->width < value_width)
- requisition->width = value_width;
- requisition->height += widget->style->font->ascent + widget->style->font->descent;
- }
- }
-}
-
-static void
-gtk_vscale_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkRange *range;
- GtkScale *scale;
- gint width, height;
- gint x, y;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_VSCALE (widget));
- g_return_if_fail (allocation != NULL);
-
- widget->allocation = *allocation;
- if (GTK_WIDGET_REALIZED (widget))
- {
- range = GTK_RANGE (widget);
- scale = GTK_SCALE (widget);
-
- gdk_window_move_resize (widget->window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
-
- gtk_vscale_pos_trough (GTK_VSCALE (widget), &x, &y, &width, &height);
-
- gdk_window_move_resize (range->trough, x, y, width, height);
- gtk_range_slider_update (GTK_RANGE (widget));
- }
-}
-
-static void
-gtk_vscale_pos_trough (GtkVScale *vscale,
- gint *x,
- gint *y,
- gint *w,
- gint *h)
-{
- GtkWidget *widget;
- GtkScale *scale;
-
- g_return_if_fail (vscale != NULL);
- g_return_if_fail (GTK_IS_VSCALE (vscale));
- g_return_if_fail ((x != NULL) && (y != NULL) && (w != NULL) && (h != NULL));
-
- widget = GTK_WIDGET (vscale);
- scale = GTK_SCALE (vscale);
-
- *w = (RANGE_CLASS (scale)->slider_width +
- widget->style->klass->xthickness * 2);
- *h = widget->allocation.height;
-
- if (scale->draw_value)
- {
- *x = 0;
- *y = 0;
-
- switch (scale->value_pos)
- {
- case GTK_POS_LEFT:
- *x = (gtk_scale_value_width (scale) +
- (widget->allocation.width - widget->requisition.width) / 2);
- break;
- case GTK_POS_RIGHT:
- *x = (widget->allocation.width - widget->requisition.width) / 2;
- break;
- case GTK_POS_TOP:
- *x = (widget->allocation.width - *w) / 2;
- *y = widget->style->font->ascent + widget->style->font->descent;
- *h -= *y;
- break;
- case GTK_POS_BOTTOM:
- *x = (widget->allocation.width - *w) / 2;
- *h -= widget->style->font->ascent + widget->style->font->descent;
- break;
- }
- }
- else
- {
- *x = (widget->allocation.width - *w) / 2;
- *y = 0;
- }
- *y += 1;
- *h -= 2;
-}
-
-static void
-gtk_vscale_draw_slider (GtkRange *range)
-{
- GtkStateType state_type;
- gint width, height;
-
- g_return_if_fail (range != NULL);
- g_return_if_fail (GTK_IS_VSCALE (range));
-
- if (range->slider)
- {
- if ((range->in_child == RANGE_CLASS (range)->slider) ||
- (range->click_child == RANGE_CLASS (range)->slider))
- state_type = GTK_STATE_PRELIGHT;
- else
- state_type = GTK_STATE_NORMAL;
-
- gtk_style_set_background (GTK_WIDGET (range)->style, range->slider, state_type);
- gdk_window_clear (range->slider);
-
- gdk_window_get_size (range->slider, &width, &height);
- gtk_draw_hline (GTK_WIDGET (range)->style, range->slider,
- state_type, 1, width - 2, height / 2);
-
- gtk_draw_shadow (GTK_WIDGET (range)->style, range->slider,
- state_type, GTK_SHADOW_OUT,
- 0, 0, -1, -1);
- }
-}
-
-static void
-gtk_vscale_draw_value (GtkScale *scale)
-{
- GtkStateType state_type;
- gchar buffer[16];
- gint text_width;
- gint width, height;
- gint x, y;
-
- g_return_if_fail (scale != NULL);
- g_return_if_fail (GTK_IS_VSCALE (scale));
-
- if (scale->draw_value)
- {
- gdk_window_get_size (GTK_WIDGET (scale)->window, &width, &height);
- gdk_window_clear_area (GTK_WIDGET (scale)->window, 1, 1, width - 3, height - 3);
-
- sprintf (buffer, "%0.*f", GTK_RANGE (scale)->digits, GTK_RANGE (scale)->adjustment->value);
- text_width = gdk_string_measure (GTK_WIDGET (scale)->style->font, buffer);
-
- switch (scale->value_pos)
- {
- case GTK_POS_LEFT:
- gdk_window_get_position (GTK_RANGE (scale)->trough, &x, NULL);
- gdk_window_get_position (GTK_RANGE (scale)->slider, NULL, &y);
- gdk_window_get_size (GTK_RANGE (scale)->trough, &width, NULL);
- gdk_window_get_size (GTK_RANGE (scale)->slider, NULL, &height);
-
- x -= SCALE_CLASS (scale)->value_spacing + text_width;
- y += ((height -
- (GTK_WIDGET (scale)->style->font->ascent +
- GTK_WIDGET (scale)->style->font->descent)) / 2 +
- GTK_WIDGET (scale)->style->font->ascent);
- break;
- case GTK_POS_RIGHT:
- gdk_window_get_position (GTK_RANGE (scale)->trough, &x, NULL);
- gdk_window_get_position (GTK_RANGE (scale)->slider, NULL, &y);
- gdk_window_get_size (GTK_RANGE (scale)->trough, &width, NULL);
- gdk_window_get_size (GTK_RANGE (scale)->slider, NULL, &height);
-
- x += width + SCALE_CLASS (scale)->value_spacing;
- y += ((height -
- (GTK_WIDGET (scale)->style->font->ascent +
- GTK_WIDGET (scale)->style->font->descent)) / 2 +
- GTK_WIDGET (scale)->style->font->ascent);
- break;
- case GTK_POS_TOP:
- gdk_window_get_position (GTK_RANGE (scale)->trough, &x, &y);
- gdk_window_get_size (GTK_RANGE (scale)->slider, &width, NULL);
- gdk_window_get_size (GTK_RANGE (scale)->trough, NULL, &height);
-
- x += (width - text_width) / 2;
- y -= GTK_WIDGET (scale)->style->font->descent;
- break;
- case GTK_POS_BOTTOM:
- gdk_window_get_position (GTK_RANGE (scale)->trough, &x, &y);
- gdk_window_get_size (GTK_RANGE (scale)->slider, &width, NULL);
- gdk_window_get_size (GTK_RANGE (scale)->trough, NULL, &height);
-
- x += (width - text_width) / 2;
- y += height + GTK_WIDGET (scale)->style->font->ascent;
- break;
- }
-
- state_type = GTK_STATE_NORMAL;
- if (!GTK_WIDGET_IS_SENSITIVE (scale))
- state_type = GTK_STATE_INSENSITIVE;
-
- gtk_draw_string (GTK_WIDGET (scale)->style,
- GTK_WIDGET (scale)->window,
- state_type, x, y, buffer);
- }
-}
-
-static gint
-gtk_vscale_trough_keys(GtkRange *range,
- GdkEventKey *key,
- GtkScrollType *scroll,
- GtkTroughType *pos)
-{
- gint return_val = FALSE;
- switch (key->keyval)
- {
- case GDK_Up:
- return_val = TRUE;
- *scroll = GTK_SCROLL_STEP_BACKWARD;
- break;
- case GDK_Down:
- return_val = TRUE;
- *scroll = GTK_SCROLL_STEP_FORWARD;
- break;
- case GDK_Page_Up:
- return_val = TRUE;
- *scroll = GTK_SCROLL_PAGE_BACKWARD;
- break;
- case GDK_Page_Down:
- return_val = TRUE;
- *scroll = GTK_SCROLL_PAGE_FORWARD;
- break;
- case GDK_Home:
- return_val = TRUE;
- *pos = GTK_TROUGH_START;
- break;
- case GDK_End:
- return_val = TRUE;
- *pos = GTK_TROUGH_END;
- break;
- }
- return return_val;
-}
diff --git a/gtk/gtkvscale.h b/gtk/gtkvscale.h
deleted file mode 100644
index 75862d389d..0000000000
--- a/gtk/gtkvscale.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_VSCALE_H__
-#define __GTK_VSCALE_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkscale.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define GTK_VSCALE(obj) GTK_CHECK_CAST (obj, gtk_vscale_get_type (), GtkVScale)
-#define GTK_VSCALE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_vscale_get_type (), GtkVScaleClass)
-#define GTK_IS_VSCALE(obj) GTK_CHECK_TYPE (obj, gtk_vscale_get_type ())
-
-
-typedef struct _GtkVScale GtkVScale;
-typedef struct _GtkVScaleClass GtkVScaleClass;
-
-struct _GtkVScale
-{
- GtkScale scale;
-};
-
-struct _GtkVScaleClass
-{
- GtkScaleClass parent_class;
-};
-
-
-guint gtk_vscale_get_type (void);
-GtkWidget* gtk_vscale_new (GtkAdjustment *adjustment);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_VSCALE_H__ */
diff --git a/gtk/gtkvscrollbar.c b/gtk/gtkvscrollbar.c
deleted file mode 100644
index 47697e792b..0000000000
--- a/gtk/gtkvscrollbar.c
+++ /dev/null
@@ -1,391 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkvscrollbar.h"
-#include "gtksignal.h"
-#include "gdk/gdkkeysyms.h"
-
-
-#define EPSILON 0.01
-
-#define RANGE_CLASS(w) GTK_RANGE_CLASS (GTK_OBJECT (w)->klass)
-
-
-static void gtk_vscrollbar_class_init (GtkVScrollbarClass *klass);
-static void gtk_vscrollbar_init (GtkVScrollbar *vscrollbar);
-static void gtk_vscrollbar_realize (GtkWidget *widget);
-static void gtk_vscrollbar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_vscrollbar_draw_step_forw (GtkRange *range);
-static void gtk_vscrollbar_draw_step_back (GtkRange *range);
-static void gtk_vscrollbar_slider_update (GtkRange *range);
-static void gtk_vscrollbar_calc_slider_size (GtkVScrollbar *vscrollbar);
-static gint gtk_vscrollbar_trough_keys (GtkRange *range,
- GdkEventKey *key,
- GtkScrollType *scroll,
- GtkTroughType *pos);
-
-guint
-gtk_vscrollbar_get_type ()
-{
- static guint vscrollbar_type = 0;
-
- if (!vscrollbar_type)
- {
- GtkTypeInfo vscrollbar_info =
- {
- "GtkVScrollbar",
- sizeof (GtkVScrollbar),
- sizeof (GtkVScrollbarClass),
- (GtkClassInitFunc) gtk_vscrollbar_class_init,
- (GtkObjectInitFunc) gtk_vscrollbar_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- vscrollbar_type = gtk_type_unique (gtk_scrollbar_get_type (), &vscrollbar_info);
- }
-
- return vscrollbar_type;
-}
-
-static void
-gtk_vscrollbar_class_init (GtkVScrollbarClass *klass)
-{
- GtkWidgetClass *widget_class;
- GtkRangeClass *range_class;
-
- widget_class = (GtkWidgetClass*) klass;
- range_class = (GtkRangeClass*) klass;
-
- widget_class->realize = gtk_vscrollbar_realize;
- widget_class->size_allocate = gtk_vscrollbar_size_allocate;
-
- range_class->draw_step_forw = gtk_vscrollbar_draw_step_forw;
- range_class->draw_step_back = gtk_vscrollbar_draw_step_back;
- range_class->slider_update = gtk_vscrollbar_slider_update;
- range_class->trough_click = gtk_range_default_vtrough_click;
- range_class->trough_keys = gtk_vscrollbar_trough_keys;
- range_class->motion = gtk_range_default_vmotion;
-}
-
-static void
-gtk_vscrollbar_init (GtkVScrollbar *vscrollbar)
-{
- GtkWidget *widget;
- GtkRequisition *requisition;
-
- widget = GTK_WIDGET (vscrollbar);
- GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
- requisition = &widget->requisition;
-
- requisition->width = (RANGE_CLASS (widget)->slider_width +
- widget->style->klass->xthickness * 2);
- requisition->height = (RANGE_CLASS (widget)->min_slider_size +
- RANGE_CLASS (widget)->stepper_size +
- RANGE_CLASS (widget)->stepper_slider_spacing +
- widget->style->klass->ythickness) * 2;
-}
-
-GtkWidget*
-gtk_vscrollbar_new (GtkAdjustment *adjustment)
-{
- GtkVScrollbar *vscrollbar;
-
- vscrollbar = gtk_type_new (gtk_vscrollbar_get_type ());
-
- if (!adjustment)
- adjustment = (GtkAdjustment*) gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
-
- gtk_range_set_adjustment (GTK_RANGE (vscrollbar), adjustment);
-
- return GTK_WIDGET (vscrollbar);
-}
-
-
-static void
-gtk_vscrollbar_realize (GtkWidget *widget)
-{
- GtkRange *range;
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_VSCROLLBAR (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
- range = GTK_RANGE (widget);
-
- attributes.x = widget->allocation.x + (widget->allocation.width - widget->requisition.width) / 2;
- attributes.y = widget->allocation.y;
- attributes.width = widget->requisition.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget);
- attributes.event_mask |= (GDK_EXPOSURE_MASK |
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_ENTER_NOTIFY_MASK |
- GDK_LEAVE_NOTIFY_MASK);
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
-
- range->trough = widget->window;
- gdk_window_ref (range->trough);
-
- attributes.x = widget->style->klass->xthickness;
- attributes.y = widget->style->klass->ythickness;
- attributes.width = RANGE_CLASS (widget)->stepper_size;
- attributes.height = RANGE_CLASS (widget)->stepper_size;
-
- range->step_back = gdk_window_new (range->trough, &attributes, attributes_mask);
-
- attributes.y = (widget->allocation.height -
- widget->style->klass->ythickness -
- RANGE_CLASS (widget)->stepper_size);
-
- range->step_forw = gdk_window_new (range->trough, &attributes, attributes_mask);
-
- attributes.x = widget->style->klass->ythickness;
- attributes.y = 0;
- attributes.width = RANGE_CLASS (widget)->slider_width;
- attributes.height = RANGE_CLASS (widget)->min_slider_size;
- attributes.event_mask |= (GDK_BUTTON_MOTION_MASK |
- GDK_POINTER_MOTION_HINT_MASK);
-
- range->slider = gdk_window_new (range->trough, &attributes, attributes_mask);
-
- gtk_vscrollbar_calc_slider_size (GTK_VSCROLLBAR (widget));
- gtk_range_slider_update (GTK_RANGE (widget));
-
- widget->style = gtk_style_attach (widget->style, widget->window);
-
- gdk_window_set_user_data (range->trough, widget);
- gdk_window_set_user_data (range->slider, widget);
- gdk_window_set_user_data (range->step_forw, widget);
- gdk_window_set_user_data (range->step_back, widget);
-
- gtk_style_set_background (widget->style, range->trough, GTK_STATE_ACTIVE);
- gtk_style_set_background (widget->style, range->slider, GTK_STATE_NORMAL);
- gtk_style_set_background (widget->style, range->step_forw, GTK_STATE_ACTIVE);
- gtk_style_set_background (widget->style, range->step_back, GTK_STATE_ACTIVE);
-
- gdk_window_show (range->slider);
- gdk_window_show (range->step_forw);
- gdk_window_show (range->step_back);
-}
-
-static void
-gtk_vscrollbar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkRange *range;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_VSCROLLBAR (widget));
- g_return_if_fail (allocation != NULL);
-
- widget->allocation = *allocation;
- if (GTK_WIDGET_REALIZED (widget))
- {
- range = GTK_RANGE (widget);
-
- gdk_window_move_resize (range->trough,
- allocation->x + (allocation->width - widget->requisition.width) / 2,
- allocation->y,
- widget->requisition.width, allocation->height);
- gdk_window_move_resize (range->step_back,
- widget->style->klass->xthickness,
- widget->style->klass->ythickness,
- widget->requisition.width - widget->style->klass->xthickness * 2,
- RANGE_CLASS (widget)->stepper_size);
- gdk_window_move_resize (range->step_forw,
- widget->style->klass->xthickness,
- allocation->height - widget->style->klass->ythickness -
- RANGE_CLASS (widget)->stepper_size,
- widget->requisition.width - widget->style->klass->xthickness * 2,
- RANGE_CLASS (widget)->stepper_size);
- gdk_window_resize (range->slider,
- widget->requisition.width - widget->style->klass->xthickness * 2,
- RANGE_CLASS (range)->min_slider_size);
-
- gtk_range_slider_update (GTK_RANGE (widget));
- }
-}
-
-static void
-gtk_vscrollbar_draw_step_forw (GtkRange *range)
-{
- GtkStateType state_type;
- GtkShadowType shadow_type;
-
- g_return_if_fail (range != NULL);
- g_return_if_fail (GTK_IS_VSCROLLBAR (range));
-
- if (GTK_WIDGET_DRAWABLE (range))
- {
- if (range->in_child == RANGE_CLASS (range)->step_forw)
- {
- if (range->click_child == RANGE_CLASS (range)->step_forw)
- state_type = GTK_STATE_ACTIVE;
- else
- state_type = GTK_STATE_PRELIGHT;
- }
- else
- state_type = GTK_STATE_NORMAL;
-
- if (range->click_child == RANGE_CLASS (range)->step_forw)
- shadow_type = GTK_SHADOW_IN;
- else
- shadow_type = GTK_SHADOW_OUT;
-
- gtk_draw_arrow (GTK_WIDGET (range)->style, range->step_forw,
- state_type, shadow_type, GTK_ARROW_DOWN,
- TRUE, 0, 0, -1, -1);
- }
-}
-
-static void
-gtk_vscrollbar_draw_step_back (GtkRange *range)
-{
- GtkStateType state_type;
- GtkShadowType shadow_type;
-
- g_return_if_fail (range != NULL);
- g_return_if_fail (GTK_IS_VSCROLLBAR (range));
-
- if (GTK_WIDGET_DRAWABLE (range))
- {
- if (range->in_child == RANGE_CLASS (range)->step_back)
- {
- if (range->click_child == RANGE_CLASS (range)->step_back)
- state_type = GTK_STATE_ACTIVE;
- else
- state_type = GTK_STATE_PRELIGHT;
- }
- else
- state_type = GTK_STATE_NORMAL;
-
- if (range->click_child == RANGE_CLASS (range)->step_back)
- shadow_type = GTK_SHADOW_IN;
- else
- shadow_type = GTK_SHADOW_OUT;
-
- gtk_draw_arrow (GTK_WIDGET (range)->style, range->step_back,
- state_type, shadow_type, GTK_ARROW_UP,
- TRUE, 0, 0, -1, -1);
- }
-}
-
-static void
-gtk_vscrollbar_slider_update (GtkRange *range)
-{
- g_return_if_fail (range != NULL);
- g_return_if_fail (GTK_IS_VSCROLLBAR (range));
-
- gtk_vscrollbar_calc_slider_size (GTK_VSCROLLBAR (range));
- gtk_range_default_vslider_update (range);
-}
-
-static void
-gtk_vscrollbar_calc_slider_size (GtkVScrollbar *vscrollbar)
-{
- GtkRange *range;
- gint step_back_y;
- gint step_back_height;
- gint step_forw_y;
- gint slider_width;
- gint slider_height;
- gint top, bottom;
- gint height;
-
- g_return_if_fail (vscrollbar != NULL);
- g_return_if_fail (GTK_IS_VSCROLLBAR (vscrollbar));
-
- if (GTK_WIDGET_REALIZED (vscrollbar))
- {
- range = GTK_RANGE (vscrollbar);
-
- gdk_window_get_size (range->step_back, NULL, &step_back_height);
- gdk_window_get_position (range->step_back, NULL, &step_back_y);
- gdk_window_get_position (range->step_forw, NULL, &step_forw_y);
-
- top = (step_back_y +
- step_back_height +
- RANGE_CLASS (vscrollbar)->stepper_slider_spacing);
- bottom = step_forw_y - RANGE_CLASS (vscrollbar)->stepper_slider_spacing;
- height = bottom - top;
-
- if ((range->adjustment->page_size > 0) &&
- (range->adjustment->lower != range->adjustment->upper))
- {
- if (range->adjustment->page_size >
- (range->adjustment->upper - range->adjustment->lower))
- range->adjustment->page_size = range->adjustment->upper - range->adjustment->lower;
-
- height = (height * range->adjustment->page_size /
- (range->adjustment->upper - range->adjustment->lower));
-
- if (height < RANGE_CLASS (vscrollbar)->min_slider_size)
- height = RANGE_CLASS (vscrollbar)->min_slider_size;
- }
-
- gdk_window_get_size (range->slider, &slider_width, &slider_height);
-
- if (slider_height != height)
- gdk_window_resize (range->slider, slider_width, height);
- }
-}
-
-static gint
-gtk_vscrollbar_trough_keys(GtkRange *range,
- GdkEventKey *key,
- GtkScrollType *scroll,
- GtkTroughType *pos)
-{
- gint return_val = FALSE;
- switch (key->keyval)
- {
- case GDK_Up:
- return_val = TRUE;
- *scroll = GTK_SCROLL_STEP_BACKWARD;
- break;
- case GDK_Down:
- return_val = TRUE;
- *scroll = GTK_SCROLL_STEP_FORWARD;
- break;
- case GDK_Page_Up:
- return_val = TRUE;
- if (key->state & GDK_CONTROL_MASK)
- *pos = GTK_TROUGH_START;
- else
- *scroll = GTK_SCROLL_PAGE_BACKWARD;
- break;
- case GDK_Page_Down:
- return_val = TRUE;
- if (key->state & GDK_CONTROL_MASK)
- *pos = GTK_TROUGH_END;
- else
- *scroll = GTK_SCROLL_PAGE_FORWARD;
- break;
- }
- return return_val;
-}
diff --git a/gtk/gtkvscrollbar.h b/gtk/gtkvscrollbar.h
deleted file mode 100644
index 3160fc0758..0000000000
--- a/gtk/gtkvscrollbar.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_VSCROLLBAR_H__
-#define __GTK_VSCROLLBAR_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkscrollbar.h>
-
-
-#define GTK_VSCROLLBAR(obj) GTK_CHECK_CAST (obj, gtk_vscrollbar_get_type (), GtkVScrollbar)
-#define GTK_VSCROLLBAR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_vscrollbar_get_type (), GtkVScrollbarClass)
-#define GTK_IS_VSCROLLBAR(obj) GTK_CHECK_TYPE (obj, gtk_vscrollbar_get_type ())
-
-
-typedef struct _GtkVScrollbar GtkVScrollbar;
-typedef struct _GtkVScrollbarClass GtkVScrollbarClass;
-
-struct _GtkVScrollbar
-{
- GtkScrollbar scrollbar;
-};
-
-struct _GtkVScrollbarClass
-{
- GtkScrollbarClass parent_class;
-};
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-guint gtk_vscrollbar_get_type (void);
-GtkWidget* gtk_vscrollbar_new (GtkAdjustment *adjustment);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_VSCROLLBAR_H__ */
diff --git a/gtk/gtkvseparator.c b/gtk/gtkvseparator.c
deleted file mode 100644
index 9e9b6d8851..0000000000
--- a/gtk/gtkvseparator.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include "gtkvseparator.h"
-
-
-static void gtk_vseparator_class_init (GtkVSeparatorClass *klass);
-static void gtk_vseparator_init (GtkVSeparator *vseparator);
-static gint gtk_vseparator_expose (GtkWidget *widget,
- GdkEventExpose *event);
-
-
-guint
-gtk_vseparator_get_type ()
-{
- static guint vseparator_type = 0;
-
- if (!vseparator_type)
- {
- GtkTypeInfo vseparator_info =
- {
- "GtkVSeparator",
- sizeof (GtkVSeparator),
- sizeof (GtkVSeparatorClass),
- (GtkClassInitFunc) gtk_vseparator_class_init,
- (GtkObjectInitFunc) gtk_vseparator_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- vseparator_type = gtk_type_unique (gtk_separator_get_type (), &vseparator_info);
- }
-
- return vseparator_type;
-}
-
-static void
-gtk_vseparator_class_init (GtkVSeparatorClass *klass)
-{
- GtkWidgetClass *widget_class;
-
- widget_class = (GtkWidgetClass*) klass;
-
- widget_class->expose_event = gtk_vseparator_expose;
-}
-
-static void
-gtk_vseparator_init (GtkVSeparator *vseparator)
-{
- GTK_WIDGET (vseparator)->requisition.width = GTK_WIDGET (vseparator)->style->klass->xthickness;
- GTK_WIDGET (vseparator)->requisition.height = 1;
-}
-
-GtkWidget*
-gtk_vseparator_new ()
-{
- return GTK_WIDGET (gtk_type_new (gtk_vseparator_get_type ()));
-}
-
-
-static gint
-gtk_vseparator_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_VSEPARATOR (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- gtk_draw_vline (widget->style, widget->window, GTK_STATE_NORMAL,
- widget->allocation.y,
- widget->allocation.y + widget->allocation.height,
- widget->allocation.x + (widget->allocation.width -
- widget->style->klass->xthickness) / 2);
-
- return FALSE;
-}
diff --git a/gtk/gtkvseparator.h b/gtk/gtkvseparator.h
deleted file mode 100644
index 74d07dd687..0000000000
--- a/gtk/gtkvseparator.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_VSEPARATOR_H__
-#define __GTK_VSEPARATOR_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkseparator.h>
-
-
-#define GTK_VSEPARATOR(obj) GTK_CHECK_CAST (obj, gtk_vseparator_get_type (), GtkVSeparator)
-#define GTK_VSEPARATOR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_vseparator_get_type (), GtkVSeparatorClass)
-#define GTK_IS_VSEPARATOR(obj) GTK_CHECK_TYPE (obj, gtk_vseparator_get_type ())
-
-
-typedef struct _GtkVSeparator GtkVSeparator;
-typedef struct _GtkVSeparatorClass GtkVSeparatorClass;
-
-struct _GtkVSeparator
-{
- GtkSeparator separator;
-};
-
-struct _GtkVSeparatorClass
-{
- GtkSeparatorClass parent_class;
-};
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-guint gtk_vseparator_get_type (void);
-GtkWidget* gtk_vseparator_new (void);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_SEPARATOR_H__ */
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
deleted file mode 100644
index d0d42c148e..0000000000
--- a/gtk/gtkwidget.c
+++ /dev/null
@@ -1,3997 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <stdarg.h>
-#include <string.h>
-#include "gtkcontainer.h"
-#include "gtkmain.h"
-#include "gtkrc.h"
-#include "gtkselection.h"
-#include "gtksignal.h"
-#include "gtkwidget.h"
-#include "gtkwindow.h"
-#include "gtkprivate.h"
-#include "gdk/gdk.h"
-#include "gdk/gdkx.h"
-
-
-#define WIDGET_CLASS(w) GTK_WIDGET_CLASS (GTK_OBJECT (w)->klass)
-
-
-enum {
- SHOW,
- HIDE,
- MAP,
- UNMAP,
- REALIZE,
- UNREALIZE,
- DRAW,
- DRAW_FOCUS,
- DRAW_DEFAULT,
- SIZE_REQUEST,
- SIZE_ALLOCATE,
- STATE_CHANGED,
- PARENT_SET,
- STYLE_SET,
- INSTALL_ACCELERATOR,
- REMOVE_ACCELERATOR,
- EVENT,
- BUTTON_PRESS_EVENT,
- BUTTON_RELEASE_EVENT,
- MOTION_NOTIFY_EVENT,
- DELETE_EVENT,
- DESTROY_EVENT,
- EXPOSE_EVENT,
- KEY_PRESS_EVENT,
- KEY_RELEASE_EVENT,
- ENTER_NOTIFY_EVENT,
- LEAVE_NOTIFY_EVENT,
- CONFIGURE_EVENT,
- FOCUS_IN_EVENT,
- FOCUS_OUT_EVENT,
- MAP_EVENT,
- UNMAP_EVENT,
- PROPERTY_NOTIFY_EVENT,
- SELECTION_CLEAR_EVENT,
- SELECTION_REQUEST_EVENT,
- SELECTION_NOTIFY_EVENT,
- SELECTION_RECEIVED,
- PROXIMITY_IN_EVENT,
- PROXIMITY_OUT_EVENT,
- DRAG_BEGIN_EVENT,
- DRAG_REQUEST_EVENT,
- DRAG_END_EVENT,
- DROP_ENTER_EVENT,
- DROP_LEAVE_EVENT,
- DROP_DATA_AVAILABLE_EVENT,
- OTHER_EVENT,
- CLIENT_EVENT,
- NO_EXPOSE_EVENT,
- LAST_SIGNAL
-};
-
-enum {
- ARG_0,
- ARG_X,
- ARG_Y,
- ARG_WIDTH,
- ARG_HEIGHT,
- ARG_VISIBLE,
- ARG_SENSITIVE,
- ARG_CAN_FOCUS,
- ARG_HAS_FOCUS,
- ARG_CAN_DEFAULT,
- ARG_HAS_DEFAULT,
- ARG_EVENTS,
- ARG_EXTENSION_EVENTS,
- ARG_NAME,
- ARG_STYLE,
- ARG_PARENT
-};
-
-
-typedef void (*GtkWidgetSignal1) (GtkObject *object,
- gpointer arg1,
- gpointer data);
-typedef gint (*GtkWidgetSignal2) (GtkObject *object,
- gpointer arg1,
- gchar arg2,
- gchar arg3,
- gpointer data);
-typedef void (*GtkWidgetSignal3) (GtkObject *object,
- gpointer arg1,
- gpointer data);
-typedef gint (*GtkWidgetSignal4) (GtkObject *object,
- gpointer arg1,
- gpointer data);
-typedef void (*GtkWidgetSignal5) (GtkObject *object,
- guint arg1,
- gpointer data);
-typedef void (*GtkWidgetSignal6) (GtkObject *object,
- GtkObject *arg1,
- gpointer data);
-typedef void (*GtkWidgetSignal7) (GtkObject *object,
- gpointer arg1,
- gpointer data);
-
-typedef struct _GtkStateData GtkStateData;
-
-struct _GtkStateData
-{
- GtkStateType state;
- gint parent_sensitive;
-};
-
-
-static void gtk_widget_marshal_signal_1 (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-static void gtk_widget_marshal_signal_2 (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-static void gtk_widget_marshal_signal_3 (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-static void gtk_widget_marshal_signal_4 (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-static void gtk_widget_marshal_signal_5 (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-static void gtk_widget_marshal_signal_6 (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-static void gtk_widget_marshal_signal_7 (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-static void gtk_widget_class_init (GtkWidgetClass *klass);
-static void gtk_widget_init (GtkWidget *widget);
-static void gtk_widget_set_arg (GtkWidget *widget,
- GtkArg *arg,
- guint arg_id);
-static void gtk_widget_get_arg (GtkWidget *widget,
- GtkArg *arg,
- guint arg_id);
-static void gtk_widget_real_destroy (GtkObject *object);
-static void gtk_widget_real_finalize (GtkObject *object);
-static void gtk_widget_real_show (GtkWidget *widget);
-static void gtk_widget_real_hide (GtkWidget *widget);
-static void gtk_widget_real_map (GtkWidget *widget);
-static void gtk_widget_real_unmap (GtkWidget *widget);
-static void gtk_widget_real_realize (GtkWidget *widget);
-static void gtk_widget_real_unrealize (GtkWidget *widget);
-static void gtk_widget_real_draw (GtkWidget *widget,
- GdkRectangle *area);
-static gint gtk_widget_real_queue_draw (GtkWidget *widget);
-static void gtk_widget_real_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_widget_style_set (GtkWidget *widget,
- GtkStyle *previous_style);
-
-static GdkColormap* gtk_widget_peek_colormap (void);
-static GdkVisual* gtk_widget_peek_visual (void);
-static GtkStyle* gtk_widget_peek_style (void);
-
-static void gtk_widget_reparent_container_child (GtkWidget *widget,
- gpointer client_data);
-static void gtk_widget_propagate_state (GtkWidget *widget,
- GtkStateData *data);
-static void gtk_widget_draw_children_recurse (GtkWidget *widget,
- gpointer client_data);
-static void gtk_widget_set_style_internal (GtkWidget *widget,
- GtkStyle *style,
- gboolean initial_emission);
-static void gtk_widget_set_style_recurse (GtkWidget *widget,
- gpointer client_data);
-
-extern GtkArg* gtk_object_collect_args (guint *nargs,
- va_list args1,
- va_list args2);
-
-static GtkWidgetAuxInfo* gtk_widget_aux_info_new (void);
-static void gtk_widget_aux_info_destroy (GtkWidgetAuxInfo *aux_info);
-
-static GtkObjectClass *parent_class = NULL;
-static guint widget_signals[LAST_SIGNAL] = { 0 };
-
-static GMemChunk *aux_info_mem_chunk = NULL;
-
-static GdkColormap *default_colormap = NULL;
-static GdkVisual *default_visual = NULL;
-static GtkStyle *default_style = NULL;
-
-static GSList *colormap_stack = NULL;
-static GSList *visual_stack = NULL;
-static GSList *style_stack = NULL;
-
-static GSList *gtk_widget_redraw_queue = NULL;
-static GSList *gtk_widget_resize_queue = NULL;
-
-static const gchar *aux_info_key = "gtk-aux-info";
-static const gchar *colormap_key = "gtk-colormap";
-static const gchar *visual_key = "gtk-visual";
-static const gchar *event_key = "gtk-event-mask";
-static const gchar *extension_event_key = "gtk-extension-event-mode";
-static const gchar *parent_window_key = "gtk-parent-window";
-static const gchar *shape_info_key = "gtk-shape-info";
-static const gchar *saved_default_style_key = "gtk-saved-default-style";
-
-
-
-/*****************************************
- * gtk_widget_get_type:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-guint
-gtk_widget_get_type ()
-{
- static guint widget_type = 0;
-
- if (!widget_type)
- {
- GtkTypeInfo widget_info =
- {
- "GtkWidget",
- sizeof (GtkWidget),
- sizeof (GtkWidgetClass),
- (GtkClassInitFunc) gtk_widget_class_init,
- (GtkObjectInitFunc) gtk_widget_init,
- (GtkArgSetFunc) gtk_widget_set_arg,
- (GtkArgGetFunc) gtk_widget_get_arg,
- };
-
- widget_type = gtk_type_unique (gtk_object_get_type (), &widget_info);
- }
-
- return widget_type;
-}
-
-/*****************************************
- * gtk_widget_class_init:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_widget_class_init (GtkWidgetClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass*) klass;
-
- parent_class = gtk_type_class (gtk_object_get_type ());
-
- gtk_object_add_arg_type ("GtkWidget::x", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_X);
- gtk_object_add_arg_type ("GtkWidget::y", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_Y);
- gtk_object_add_arg_type ("GtkWidget::width", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_WIDTH);
- gtk_object_add_arg_type ("GtkWidget::height", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_HEIGHT);
- gtk_object_add_arg_type ("GtkWidget::visible", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_VISIBLE);
- gtk_object_add_arg_type ("GtkWidget::sensitive", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_SENSITIVE);
- gtk_object_add_arg_type ("GtkWidget::can_focus", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_CAN_FOCUS);
- gtk_object_add_arg_type ("GtkWidget::has_focus", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HAS_FOCUS);
- gtk_object_add_arg_type ("GtkWidget::can_default", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_CAN_DEFAULT);
- gtk_object_add_arg_type ("GtkWidget::has_default", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HAS_DEFAULT);
- gtk_object_add_arg_type ("GtkWidget::events", GTK_TYPE_GDK_EVENT_MASK, GTK_ARG_READWRITE, ARG_EVENTS);
- gtk_object_add_arg_type ("GtkWidget::extension_events", GTK_TYPE_GDK_EVENT_MASK, GTK_ARG_READWRITE, ARG_EXTENSION_EVENTS);
- gtk_object_add_arg_type ("GtkWidget::name", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_NAME);
- gtk_object_add_arg_type ("GtkWidget::style", GTK_TYPE_STYLE, GTK_ARG_READWRITE, ARG_STYLE);
- gtk_object_add_arg_type ("GtkWidget::parent", GTK_TYPE_CONTAINER, GTK_ARG_READWRITE, ARG_PARENT);
-
- widget_signals[SHOW] =
- gtk_signal_new ("show",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, show),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
- widget_signals[HIDE] =
- gtk_signal_new ("hide",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, hide),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
- widget_signals[MAP] =
- gtk_signal_new ("map",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, map),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
- widget_signals[UNMAP] =
- gtk_signal_new ("unmap",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, unmap),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
- widget_signals[REALIZE] =
- gtk_signal_new ("realize",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, realize),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
- widget_signals[UNREALIZE] =
- gtk_signal_new ("unrealize",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, unrealize),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
- widget_signals[DRAW] =
- gtk_signal_new ("draw",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, draw),
- gtk_widget_marshal_signal_1,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_POINTER);
- widget_signals[DRAW_FOCUS] =
- gtk_signal_new ("draw_focus",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, draw_focus),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
- widget_signals[DRAW_DEFAULT] =
- gtk_signal_new ("draw_default",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, draw_default),
- gtk_signal_default_marshaller,
- GTK_TYPE_NONE, 0);
- widget_signals[SIZE_REQUEST] =
- gtk_signal_new ("size_request",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, size_request),
- gtk_widget_marshal_signal_1,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_POINTER);
- widget_signals[SIZE_ALLOCATE] =
- gtk_signal_new ("size_allocate",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, size_allocate),
- gtk_widget_marshal_signal_1,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_POINTER);
- widget_signals[STATE_CHANGED] =
- gtk_signal_new ("state_changed",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, state_changed),
- gtk_widget_marshal_signal_5,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_UINT);
- widget_signals[PARENT_SET] =
- gtk_signal_new ("parent_set",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, parent_set),
- gtk_widget_marshal_signal_6,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_OBJECT);
- widget_signals[STYLE_SET] =
- gtk_signal_new ("style_set",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, style_set),
- gtk_widget_marshal_signal_7,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_BOXED);
- widget_signals[INSTALL_ACCELERATOR] =
- gtk_signal_new ("install_accelerator",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, install_accelerator),
- gtk_widget_marshal_signal_2,
- GTK_TYPE_BOOL, 3,
- GTK_TYPE_STRING,
- GTK_TYPE_CHAR,
- GTK_TYPE_INT);
- widget_signals[REMOVE_ACCELERATOR] =
- gtk_signal_new ("remove_accelerator",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, remove_accelerator),
- gtk_widget_marshal_signal_3,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_STRING);
- widget_signals[EVENT] =
- gtk_signal_new ("event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[BUTTON_PRESS_EVENT] =
- gtk_signal_new ("button_press_event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, button_press_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[BUTTON_RELEASE_EVENT] =
- gtk_signal_new ("button_release_event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, button_release_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[MOTION_NOTIFY_EVENT] =
- gtk_signal_new ("motion_notify_event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, motion_notify_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[DELETE_EVENT] =
- gtk_signal_new ("delete_event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, delete_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[DESTROY_EVENT] =
- gtk_signal_new ("destroy_event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, destroy_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[EXPOSE_EVENT] =
- gtk_signal_new ("expose_event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, expose_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[KEY_PRESS_EVENT] =
- gtk_signal_new ("key_press_event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, key_press_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[KEY_RELEASE_EVENT] =
- gtk_signal_new ("key_release_event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, key_release_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[ENTER_NOTIFY_EVENT] =
- gtk_signal_new ("enter_notify_event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, enter_notify_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[LEAVE_NOTIFY_EVENT] =
- gtk_signal_new ("leave_notify_event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, leave_notify_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[CONFIGURE_EVENT] =
- gtk_signal_new ("configure_event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, configure_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[FOCUS_IN_EVENT] =
- gtk_signal_new ("focus_in_event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, focus_in_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[FOCUS_OUT_EVENT] =
- gtk_signal_new ("focus_out_event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, focus_out_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[MAP_EVENT] =
- gtk_signal_new ("map_event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, map_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[UNMAP_EVENT] =
- gtk_signal_new ("unmap_event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, unmap_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[PROPERTY_NOTIFY_EVENT] =
- gtk_signal_new ("property_notify_event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, property_notify_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[SELECTION_CLEAR_EVENT] =
- gtk_signal_new ("selection_clear_event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, selection_clear_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[SELECTION_REQUEST_EVENT] =
- gtk_signal_new ("selection_request_event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, selection_request_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[SELECTION_NOTIFY_EVENT] =
- gtk_signal_new ("selection_notify_event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, selection_notify_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[SELECTION_RECEIVED] =
- gtk_signal_new ("selection_received",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, selection_received),
- gtk_widget_marshal_signal_1,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[PROXIMITY_IN_EVENT] =
- gtk_signal_new ("proximity_in_event",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, proximity_in_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[PROXIMITY_OUT_EVENT] =
- gtk_signal_new ("proximity_out_event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, proximity_out_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[DRAG_BEGIN_EVENT] =
- gtk_signal_new ("drag_begin_event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, drag_begin_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[DRAG_REQUEST_EVENT] =
- gtk_signal_new ("drag_request_event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, drag_request_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[DRAG_END_EVENT] =
- gtk_signal_new ("drag_end_event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, drag_end_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[DROP_ENTER_EVENT] =
- gtk_signal_new ("drop_enter_event",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, drop_enter_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[DROP_LEAVE_EVENT] =
- gtk_signal_new ("drop_leave_event",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, drop_leave_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[DROP_DATA_AVAILABLE_EVENT] =
- gtk_signal_new ("drop_data_available_event",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass,
- drop_data_available_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[OTHER_EVENT] =
- gtk_signal_new ("other_event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, other_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[CLIENT_EVENT] =
- gtk_signal_new ("client_event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, client_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
- widget_signals[NO_EXPOSE_EVENT] =
- gtk_signal_new ("no_expose_event",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWidgetClass, no_expose_event),
- gtk_widget_marshal_signal_4,
- GTK_TYPE_BOOL, 1,
- GTK_TYPE_GDK_EVENT);
-
- gtk_object_class_add_signals (object_class, widget_signals, LAST_SIGNAL);
-
- object_class->destroy = gtk_widget_real_destroy;
- object_class->finalize = gtk_widget_real_finalize;
-
- klass->activate_signal = 0;
- klass->show = gtk_widget_real_show;
- klass->hide = gtk_widget_real_hide;
- klass->show_all = gtk_widget_real_show;
- klass->hide_all = gtk_widget_real_hide;
- klass->map = gtk_widget_real_map;
- klass->unmap = gtk_widget_real_unmap;
- klass->realize = gtk_widget_real_realize;
- klass->unrealize = gtk_widget_real_unrealize;
- klass->draw = gtk_widget_real_draw;
- klass->draw_focus = NULL;
- klass->size_request = NULL;
- klass->size_allocate = gtk_widget_real_size_allocate;
- klass->state_changed = NULL;
- klass->parent_set = NULL;
- klass->style_set = gtk_widget_style_set;
- klass->install_accelerator = NULL;
- klass->remove_accelerator = NULL;
- klass->event = NULL;
- klass->button_press_event = NULL;
- klass->button_release_event = NULL;
- klass->motion_notify_event = NULL;
- klass->delete_event = NULL;
- klass->destroy_event = NULL;
- klass->expose_event = NULL;
- klass->key_press_event = NULL;
- klass->key_release_event = NULL;
- klass->enter_notify_event = NULL;
- klass->leave_notify_event = NULL;
- klass->configure_event = NULL;
- klass->focus_in_event = NULL;
- klass->focus_out_event = NULL;
- klass->map_event = NULL;
- klass->unmap_event = NULL;
- klass->property_notify_event = gtk_selection_property_notify;
- klass->selection_clear_event = gtk_selection_clear;
- klass->selection_request_event = gtk_selection_request;
- klass->selection_notify_event = gtk_selection_notify;
- klass->selection_received = NULL;
- klass->proximity_in_event = NULL;
- klass->proximity_out_event = NULL;
- klass->drag_begin_event = NULL;
- klass->drag_request_event = NULL;
- klass->drop_enter_event = NULL;
- klass->drop_leave_event = NULL;
- klass->drop_data_available_event = NULL;
- klass->other_event = NULL;
- klass->no_expose_event = NULL;
-}
-
-/*****************************************
- * gtk_widget_set_arg:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_widget_set_arg (GtkWidget *widget,
- GtkArg *arg,
- guint arg_id)
-{
- switch (arg_id)
- {
- case ARG_X:
- gtk_widget_set_uposition (widget, GTK_VALUE_INT (*arg), -2);
- break;
- case ARG_Y:
- gtk_widget_set_uposition (widget, -2, GTK_VALUE_INT (*arg));
- break;
- case ARG_WIDTH:
- gtk_widget_set_usize (widget, GTK_VALUE_INT (*arg), -1);
- break;
- case ARG_HEIGHT:
- gtk_widget_set_usize (widget, -1, GTK_VALUE_INT (*arg));
- break;
- case ARG_VISIBLE:
- if (GTK_VALUE_BOOL(*arg))
- gtk_widget_show (widget);
- else
- gtk_widget_hide (widget);
- break;
- case ARG_SENSITIVE:
- gtk_widget_set_sensitive (widget, GTK_VALUE_BOOL (*arg));
- break;
- case ARG_CAN_FOCUS:
- if (GTK_VALUE_BOOL (*arg))
- GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
- else
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS);
- break;
- case ARG_HAS_FOCUS:
- if (GTK_VALUE_BOOL (*arg))
- gtk_widget_grab_focus (widget);
- break;
- case ARG_CAN_DEFAULT:
- if (GTK_VALUE_BOOL (*arg))
- GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_DEFAULT);
- else
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_DEFAULT);
- break;
- case ARG_HAS_DEFAULT:
- if (GTK_VALUE_BOOL (*arg))
- gtk_widget_grab_default (widget);
- break;
- case ARG_EVENTS:
- gtk_widget_set_events (widget, GTK_VALUE_FLAGS (*arg));
- break;
- case ARG_EXTENSION_EVENTS:
- gtk_widget_set_extension_events (widget, GTK_VALUE_FLAGS (*arg));
- break;
- case ARG_NAME:
- gtk_widget_set_name (widget, GTK_VALUE_STRING (*arg));
- break;
- case ARG_STYLE:
- gtk_widget_set_style (widget, (GtkStyle*) GTK_VALUE_BOXED (*arg));
- break;
- case ARG_PARENT:
- gtk_container_add (GTK_CONTAINER (GTK_VALUE_OBJECT (*arg)), widget);
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-/*****************************************
- * gtk_widget_get_arg:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_widget_get_arg (GtkWidget *widget,
- GtkArg *arg,
- guint arg_id)
-{
- GtkWidgetAuxInfo *aux_info;
- gint *eventp;
- GdkExtensionMode *modep;
-
- switch (arg_id)
- {
- case ARG_X:
- aux_info = gtk_object_get_data (GTK_OBJECT (widget), aux_info_key);
- if (!aux_info)
- GTK_VALUE_INT (*arg) = -2;
- else
- GTK_VALUE_INT (*arg) = aux_info->x;
- break;
- case ARG_Y:
- aux_info = gtk_object_get_data (GTK_OBJECT (widget), aux_info_key);
- if (!aux_info)
- GTK_VALUE_INT (*arg) = -2;
- else
- GTK_VALUE_INT (*arg) = aux_info->y;
- break;
- case ARG_WIDTH:
- aux_info = gtk_object_get_data (GTK_OBJECT (widget), aux_info_key);
- if (!aux_info)
- GTK_VALUE_INT (*arg) = -2;
- else
- GTK_VALUE_INT (*arg) = aux_info->width;
- break;
- case ARG_HEIGHT:
- aux_info = gtk_object_get_data (GTK_OBJECT (widget), aux_info_key);
- if (!aux_info)
- GTK_VALUE_INT (*arg) = -2;
- else
- GTK_VALUE_INT (*arg) = aux_info->height;
- break;
- case ARG_VISIBLE:
- GTK_VALUE_BOOL (*arg) = GTK_WIDGET_VISIBLE (widget);
- break;
- case ARG_SENSITIVE:
- GTK_VALUE_BOOL (*arg) = GTK_WIDGET_SENSITIVE (widget);
- break;
- case ARG_CAN_FOCUS:
- GTK_VALUE_BOOL (*arg) = GTK_WIDGET_CAN_FOCUS (widget);
- break;
- case ARG_HAS_FOCUS:
- GTK_VALUE_BOOL (*arg) = GTK_WIDGET_HAS_FOCUS (widget);
- break;
- case ARG_CAN_DEFAULT:
- GTK_VALUE_BOOL (*arg) = GTK_WIDGET_CAN_DEFAULT (widget);
- break;
- case ARG_HAS_DEFAULT:
- GTK_VALUE_BOOL (*arg) = GTK_WIDGET_HAS_DEFAULT (widget);
- break;
- case ARG_EVENTS:
- eventp = gtk_object_get_data (GTK_OBJECT (widget), event_key);
- if (!eventp)
- GTK_VALUE_FLAGS (*arg) = 0;
- else
- GTK_VALUE_FLAGS (*arg) = *eventp;
- break;
- case ARG_EXTENSION_EVENTS:
- modep = gtk_object_get_data (GTK_OBJECT (widget), extension_event_key);
- if (!modep)
- GTK_VALUE_FLAGS (*arg) = 0;
- else
- GTK_VALUE_FLAGS (*arg) = *modep;
- break;
- case ARG_NAME:
- if (widget->name)
- GTK_VALUE_STRING (*arg) = g_strdup (widget->name);
- else
- GTK_VALUE_STRING (*arg) = g_strdup ("");
- break;
- case ARG_STYLE:
- GTK_VALUE_BOXED (*arg) = (gpointer) gtk_widget_get_style (widget);
- break;
- case ARG_PARENT:
- GTK_VALUE_OBJECT (*arg) = (GtkObject*) widget->parent;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-/*****************************************
- * gtk_widget_init:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_widget_init (GtkWidget *widget)
-{
- GdkColormap *colormap;
- GdkVisual *visual;
-
- GTK_PRIVATE_FLAGS (widget) = 0;
- widget->state = GTK_STATE_NORMAL;
- widget->saved_state = GTK_STATE_NORMAL;
- widget->name = NULL;
- widget->requisition.width = 0;
- widget->requisition.height = 0;
- widget->allocation.x = -1;
- widget->allocation.y = -1;
- widget->allocation.width = 1;
- widget->allocation.height = 1;
- widget->window = NULL;
- widget->parent = NULL;
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_SENSITIVE | GTK_PARENT_SENSITIVE);
-
- widget->style = gtk_widget_peek_style ();
- gtk_style_ref (widget->style);
-
- colormap = gtk_widget_peek_colormap ();
- visual = gtk_widget_peek_visual ();
-
- /* XXX - should we ref the colormap and visual, too? */
-
- if (colormap != gtk_widget_get_default_colormap ())
- {
- /* gdk_colormap_ref (colormap); */
- gtk_object_set_data (GTK_OBJECT (widget), colormap_key, colormap);
- }
-
- if (visual != gtk_widget_get_default_visual ())
- {
- /* gdk_visual_ref (visual); */
- gtk_object_set_data (GTK_OBJECT (widget), visual_key, visual);
- }
-}
-
-/*****************************************
- * gtk_widget_new:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-GtkWidget*
-gtk_widget_new (guint type,
- ...)
-{
- GtkObject *obj;
- GtkArg *args;
- guint nargs;
- va_list args1;
- va_list args2;
-
- g_return_val_if_fail (gtk_type_is_a (type, gtk_widget_get_type ()), NULL);
-
- obj = gtk_type_new (type);
-
- va_start (args1, type);
- va_start (args2, type);
-
- args = gtk_object_collect_args (&nargs, args1, args2);
- gtk_object_setv (obj, nargs, args);
- g_free (args);
-
- va_end (args1);
- va_end (args2);
-
- return GTK_WIDGET (obj);
-}
-
-/*****************************************
- * gtk_widget_newv:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-GtkWidget*
-gtk_widget_newv (guint type,
- guint nargs,
- GtkArg *args)
-{
- g_return_val_if_fail (gtk_type_is_a (type, gtk_widget_get_type ()), NULL);
-
- return GTK_WIDGET (gtk_object_newv (type, nargs, args));
-}
-
-/*****************************************
- * gtk_widget_get:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_get (GtkWidget *widget,
- GtkArg *arg)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (arg != NULL);
-
- gtk_object_getv (GTK_OBJECT (widget), 1, arg);
-}
-
-/*****************************************
- * gtk_widget_getv:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_getv (GtkWidget *widget,
- guint nargs,
- GtkArg *args)
-{
- gtk_object_getv (GTK_OBJECT (widget), nargs, args);
-}
-
-/*****************************************
- * gtk_widget_set:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_set (GtkWidget *widget,
- ...)
-{
- GtkArg *args;
- guint nargs;
- va_list args1;
- va_list args2;
-
- g_return_if_fail (widget != NULL);
-
- va_start (args1, widget);
- va_start (args2, widget);
-
- args = gtk_object_collect_args (&nargs, args1, args2);
- gtk_object_setv (GTK_OBJECT (widget), nargs, args);
- g_free (args);
-
- va_end (args1);
- va_end (args2);
-}
-
-/*****************************************
- * gtk_widget_setv:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_setv (GtkWidget *widget,
- guint nargs,
- GtkArg *args)
-{
- gtk_object_setv (GTK_OBJECT (widget), nargs, args);
-}
-
-/*****************************************
- * gtk_widget_unparent:
- * do any cleanup necessary necessary
- * for setting parent = NULL.
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_unparent (GtkWidget *widget)
-{
- GtkWidget *toplevel;
- GtkWidget *child;
- GtkWidget *old_parent;
-
- g_return_if_fail (widget != NULL);
- if (widget->parent == NULL)
- return;
-
- /* keep this function in sync with gtk_menu_detach()
- */
-
- toplevel = gtk_widget_get_toplevel (widget);
- if (GTK_IS_WINDOW (toplevel))
- {
- child = GTK_WINDOW (toplevel)->focus_widget;
-
- while (child && child != widget)
- child = child->parent;
-
- if (child == widget)
- gtk_window_set_focus (GTK_WINDOW (toplevel), NULL);
- }
-
- if (GTK_WIDGET_RESIZE_NEEDED (widget))
- {
- GTK_CONTAINER (toplevel)->resize_widgets =
- g_slist_remove (GTK_CONTAINER (toplevel)->resize_widgets, widget);
- GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED);
- }
-
- /* Reset the width and height here, to force reallocation if we
- * get added back to a new parent. This won't work if our new
- * allocation is smaller than 1x1 and we actually want a size of 1x1...
- * (would 0x0 be OK here?)
- */
- widget->allocation.width = 1;
- widget->allocation.height = 1;
-
- if (widget->window &&
- GTK_WIDGET_NO_WINDOW (widget) &&
- GTK_WIDGET_DRAWABLE (widget))
- gdk_window_clear_area (widget->window,
- widget->allocation.x,
- widget->allocation.y,
- widget->allocation.width,
- widget->allocation.height);
-
- if (GTK_WIDGET_REALIZED (widget) && !GTK_WIDGET_IN_REPARENT (widget))
- gtk_widget_unrealize (widget);
-
- old_parent = widget->parent;
- widget->parent = NULL;
- gtk_signal_emit (GTK_OBJECT (widget), widget_signals[PARENT_SET], old_parent);
-
- gtk_widget_unref (widget);
-}
-
-/*****************************************
- * gtk_widget_destroy:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_destroy (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_VISIBLE);
- if (GTK_WIDGET_REALIZED (widget))
- gtk_widget_unrealize (widget);
-
- gtk_object_destroy (GTK_OBJECT (widget));
-}
-
-/*****************************************
- * gtk_widget_destroyed:
- * Utility function: sets widget_pointer
- * to NULL when widget is destroyed.
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_destroyed (GtkWidget *widget,
- GtkWidget **widget_pointer)
-{
- /* Don't make any assumptions about the
- * value of widget!
- * Even check widget_pointer.
- */
- if (widget_pointer)
- *widget_pointer = NULL;
-}
-
-/*****************************************
- * gtk_widget_show:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_show (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
-
- if (!GTK_WIDGET_VISIBLE (widget))
- gtk_signal_emit (GTK_OBJECT (widget), widget_signals[SHOW]);
-}
-
-/*****************************************
- * gtk_widget_hide:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_hide (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
-
- if (GTK_WIDGET_VISIBLE (widget))
- gtk_signal_emit (GTK_OBJECT (widget), widget_signals[HIDE]);
-}
-
-/*****************************************
- * gtk_widget_show_all:
- *
- * Shows the widget and all children.
- *
- * Container classes overwrite
- * show_all and hide_all to call
- * show_all (hide_all) on both themselves
- * and on their child widgets.
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_show_all (GtkWidget *widget)
-{
- GtkWidgetClass *widget_class;
-
- g_return_if_fail (widget != NULL);
-
- /* show_all shouldn't be invoked through a signal,
- because in this case it would be quite slow - there would
- be a show and show_all signal emitted for every child widget.
- */
- widget_class = GTK_WIDGET_CLASS(GTK_OBJECT(widget)->klass);
- widget_class->show_all (widget);
-}
-
-/*****************************************
- * gtk_widget_hide_all:
- *
- * Hides the widget and all children.
- * See gtk_widget_show_all.
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_hide_all (GtkWidget *widget)
-{
- GtkWidgetClass *widget_class;
-
- g_return_if_fail (widget != NULL);
- g_assert (widget->parent);
-
- if (GTK_WIDGET_RESIZE_NEEDED (widget))
- {
- GtkWidget *toplevel;
-
- toplevel = gtk_widget_get_toplevel (widget);
- if (toplevel != widget)
- GTK_CONTAINER (toplevel)->resize_widgets =
- g_slist_remove (GTK_CONTAINER (toplevel)->resize_widgets, widget);
- GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED);
- }
-
- widget_class = GTK_WIDGET_CLASS(GTK_OBJECT(widget)->klass);
- widget_class->hide_all (widget);
-}
-
-/*****************************************
- * gtk_widget_map:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_map (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
-
- if (!GTK_WIDGET_MAPPED (widget))
- {
- if (!GTK_WIDGET_REALIZED (widget))
- gtk_widget_realize (widget);
-
- gtk_signal_emit (GTK_OBJECT (widget), widget_signals[MAP]);
- }
-}
-
-/*****************************************
- * gtk_widget_unmap:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_unmap (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
-
- if (GTK_WIDGET_MAPPED (widget))
- gtk_signal_emit (GTK_OBJECT (widget), widget_signals[UNMAP]);
-}
-
-/*****************************************
- * gtk_widget_realize:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_realize (GtkWidget *widget)
-{
- gint events;
- GdkExtensionMode mode;
- GtkWidgetShapeInfo *shape_info;
-
- g_return_if_fail (widget != NULL);
-
- if (!GTK_WIDGET_REALIZED (widget))
- {
- /*
- if (GTK_IS_CONTAINER (widget) && !GTK_WIDGET_NO_WINDOW (widget))
- g_print ("%s\n", gtk_type_name (GTK_WIDGET_TYPE (widget)));
- */
-
- if (widget->parent && !GTK_WIDGET_REALIZED (widget->parent))
- gtk_widget_realize (widget->parent);
-
- gtk_widget_ensure_style (widget);
-
- gtk_signal_emit (GTK_OBJECT (widget), widget_signals[REALIZE]);
-
- if (GTK_WIDGET_HAS_SHAPE_MASK (widget))
- {
- shape_info = gtk_object_get_data (GTK_OBJECT (widget),
- shape_info_key);
- gdk_window_shape_combine_mask (widget->window,
- shape_info->shape_mask,
- shape_info->offset_x,
- shape_info->offset_y);
- }
-
- if (!GTK_WIDGET_NO_WINDOW (widget))
- {
- mode = gtk_widget_get_extension_events (widget);
- if (mode != GDK_EXTENSION_EVENTS_NONE)
- {
- events = gtk_widget_get_events (widget);
- gdk_input_set_extension_events (widget->window, events, mode);
- }
- }
-
- }
-}
-
-/*****************************************
- * gtk_widget_unrealize:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_unrealize (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
-
- if (GTK_WIDGET_REALIZED (widget))
- gtk_signal_emit (GTK_OBJECT (widget), widget_signals[UNREALIZE]);
-}
-
-/*****************************************
- * gtk_widget_queue_draw:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static gint
-gtk_widget_idle_draw (void *data)
-{
- GSList *node;
-
- node = gtk_widget_redraw_queue;
- gtk_widget_redraw_queue = NULL;
- while (node)
- {
- gtk_widget_real_queue_draw ((GtkWidget*) node->data);
- node = node->next;
- }
-
- return gtk_widget_redraw_queue != NULL;
-}
-
-void
-gtk_widget_queue_draw (GtkWidget *widget)
-{
- GtkWidget *parent;
-
- g_return_if_fail (widget != NULL);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- /* We queue the redraw if:
- * a) the widget is not already queued for redraw and
- * b) non of the widgets ancestors are queued for redraw.
- */
- parent = widget;
- while (parent)
- {
- if (GTK_WIDGET_REDRAW_PENDING (parent))
- return;
- parent = parent->parent;
- }
-
- GTK_PRIVATE_SET_FLAG (widget, GTK_REDRAW_PENDING);
- if (gtk_widget_redraw_queue == NULL)
- gtk_idle_add_priority (GTK_PRIORITY_INTERNAL,
- (GtkFunction) gtk_widget_idle_draw, NULL);
-
- gtk_widget_redraw_queue = g_slist_prepend (gtk_widget_redraw_queue, widget);
- }
-}
-
-/*****************************************
- * gtk_widget_queue_resize:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static gint
-gtk_widget_idle_sizer (void *data)
-{
- GSList *slist, *free_slist;
-
- free_slist = gtk_widget_resize_queue;
- gtk_widget_resize_queue = NULL;
- slist = free_slist;
- while (slist)
- {
- GtkWidget *widget;
-
- widget = slist->data;
-
- GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_PENDING);
- if (gtk_container_need_resize (GTK_CONTAINER (widget)))
- gtk_widget_queue_resize (widget);
-
- slist = slist->next;
- }
- g_slist_free (free_slist);
-
- return gtk_widget_resize_queue != NULL;
-}
-
-void
-gtk_widget_queue_resize (GtkWidget *widget)
-{
- GtkWidget *toplevel;
-
- g_return_if_fail (widget != NULL);
-
- toplevel = gtk_widget_get_toplevel (widget);
- if (GTK_WIDGET_TOPLEVEL (toplevel))
- {
- if (GTK_WIDGET_VISIBLE (toplevel))
- {
- if (!GTK_CONTAINER_RESIZE_PENDING (toplevel))
- {
- GTK_PRIVATE_SET_FLAG (toplevel, GTK_RESIZE_PENDING);
- if (gtk_widget_resize_queue == NULL)
- gtk_idle_add_priority (GTK_PRIORITY_INTERNAL,
- (GtkFunction) gtk_widget_idle_sizer, NULL);
- gtk_widget_resize_queue = g_slist_prepend (gtk_widget_resize_queue, toplevel);
- }
-
- if (!GTK_WIDGET_RESIZE_NEEDED (widget))
- {
- GTK_PRIVATE_SET_FLAG (widget, GTK_RESIZE_NEEDED);
- GTK_CONTAINER (toplevel)->resize_widgets =
- g_slist_prepend (GTK_CONTAINER (toplevel)->resize_widgets, widget);
- }
- else
- g_assert (g_slist_find (GTK_CONTAINER (toplevel)->resize_widgets, widget)); /* paranoid */
- }
- else
- gtk_container_need_resize (GTK_CONTAINER (toplevel));
- }
-}
-
-/*****************************************
- * gtk_widget_draw:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- GdkRectangle temp_area;
-
- g_return_if_fail (widget != NULL);
-
- if (GTK_WIDGET_DRAWABLE (widget) &&
- !GTK_WIDGET_REDRAW_PENDING (widget))
- {
- if (!area)
- {
- if (GTK_WIDGET_NO_WINDOW (widget))
- {
- temp_area.x = widget->allocation.x;
- temp_area.y = widget->allocation.y;
- }
- else
- {
- temp_area.x = 0;
- temp_area.y = 0;
- }
-
- temp_area.width = widget->allocation.width;
- temp_area.height = widget->allocation.height;
- area = &temp_area;
- }
-
- gtk_signal_emit (GTK_OBJECT (widget), widget_signals[DRAW], area);
- }
-}
-
-/*****************************************
- * gtk_widget_draw_focus:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_draw_focus (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
-
- gtk_signal_emit (GTK_OBJECT (widget), widget_signals[DRAW_FOCUS]);
-}
-
-/*****************************************
- * gtk_widget_draw_default:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_draw_default (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
-
- gtk_signal_emit (GTK_OBJECT (widget), widget_signals[DRAW_DEFAULT]);
-}
-
-/*****************************************
- * gtk_widget_draw_children:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_draw_children (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
-
- if (GTK_IS_CONTAINER (widget))
- gtk_container_foreach (GTK_CONTAINER (widget),
- gtk_widget_draw_children_recurse,
- NULL);
-}
-
-/*****************************************
- * gtk_widget_size_request:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkWidgetAuxInfo *aux_info;
-
- g_return_if_fail (widget != NULL);
-
- gtk_widget_ref (widget);
- gtk_widget_ensure_style (widget);
- gtk_signal_emit (GTK_OBJECT (widget), widget_signals[SIZE_REQUEST],
- requisition);
- aux_info = gtk_object_get_data (GTK_OBJECT (widget), aux_info_key);
- if (aux_info)
- {
- if (aux_info->width > 0)
- requisition->width = aux_info->width;
- if (aux_info->height > 0)
- requisition->height = aux_info->height;
- }
- gtk_widget_unref (widget);
-}
-
-/*****************************************
- * gtk_widget_size_allocate:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkWidgetAuxInfo *aux_info;
- GtkAllocation real_allocation;
-
- g_return_if_fail (widget != NULL);
-
- real_allocation = *allocation;
- aux_info = gtk_object_get_data (GTK_OBJECT (widget), aux_info_key);
-
- if (aux_info)
- {
- if (aux_info->x != -1)
- real_allocation.x = aux_info->x;
- if (aux_info->y != -1)
- real_allocation.y = aux_info->y;
- }
-
- gtk_signal_emit (GTK_OBJECT (widget), widget_signals[SIZE_ALLOCATE], &real_allocation);
-}
-
-/*****************************************
- * gtk_widget_install_accelerator:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_install_accelerator (GtkWidget *widget,
- GtkAcceleratorTable *table,
- const gchar *signal_name,
- gchar key,
- guint8 modifiers)
-{
- gint return_val;
-
- g_return_if_fail (widget != NULL);
-
- gtk_widget_ref (widget);
- return_val = TRUE;
- gtk_signal_emit (GTK_OBJECT (widget), widget_signals[INSTALL_ACCELERATOR],
- signal_name, key, modifiers, &return_val);
- if (return_val)
- gtk_accelerator_table_install (table,
- GTK_OBJECT (widget),
- signal_name,
- key,
- modifiers);
- gtk_widget_unref (widget);
-}
-
-/*****************************************
- * gtk_widget_remove_accelerator:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_remove_accelerator (GtkWidget *widget,
- GtkAcceleratorTable *table,
- const gchar *signal_name)
-{
- g_return_if_fail (widget != NULL);
-
- gtk_widget_ref (widget);
- gtk_signal_emit (GTK_OBJECT (widget), widget_signals[REMOVE_ACCELERATOR],
- signal_name);
- gtk_accelerator_table_remove (table, GTK_OBJECT (widget), signal_name);
- gtk_widget_unref (widget);
-}
-
-/*****************************************
- * gtk_widget_event:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-gint
-gtk_widget_event (GtkWidget *widget,
- GdkEvent *event)
-{
- gint return_val;
- gint signal_num;
-
- g_return_val_if_fail (widget != NULL, TRUE);
-
- gtk_widget_ref (widget);
- return_val = FALSE;
- gtk_signal_emit (GTK_OBJECT (widget), widget_signals[EVENT], event,
- &return_val);
- if (return_val || GTK_OBJECT_DESTROYED (widget))
- {
- gtk_widget_unref (widget);
- return TRUE;
- }
-
- switch (event->type)
- {
- case GDK_NOTHING:
- signal_num = -1;
- break;
- case GDK_BUTTON_PRESS:
- case GDK_2BUTTON_PRESS:
- case GDK_3BUTTON_PRESS:
- signal_num = BUTTON_PRESS_EVENT;
- break;
- case GDK_BUTTON_RELEASE:
- signal_num = BUTTON_RELEASE_EVENT;
- break;
- case GDK_MOTION_NOTIFY:
- signal_num = MOTION_NOTIFY_EVENT;
- break;
- case GDK_DELETE:
- signal_num = DELETE_EVENT;
- break;
- case GDK_DESTROY:
- signal_num = DESTROY_EVENT;
- break;
- case GDK_KEY_PRESS:
- signal_num = KEY_PRESS_EVENT;
- break;
- case GDK_KEY_RELEASE:
- signal_num = KEY_RELEASE_EVENT;
- break;
- case GDK_ENTER_NOTIFY:
- signal_num = ENTER_NOTIFY_EVENT;
- break;
- case GDK_LEAVE_NOTIFY:
- signal_num = LEAVE_NOTIFY_EVENT;
- break;
- case GDK_FOCUS_CHANGE:
- if (event->focus_change.in)
- signal_num = FOCUS_IN_EVENT;
- else
- signal_num = FOCUS_OUT_EVENT;
- break;
- case GDK_CONFIGURE:
- signal_num = CONFIGURE_EVENT;
- break;
- case GDK_MAP:
- signal_num = MAP_EVENT;
- break;
- case GDK_UNMAP:
- signal_num = UNMAP_EVENT;
- break;
- case GDK_PROPERTY_NOTIFY:
- signal_num = PROPERTY_NOTIFY_EVENT;
- break;
- case GDK_SELECTION_CLEAR:
- signal_num = SELECTION_CLEAR_EVENT;
- break;
- case GDK_SELECTION_REQUEST:
- signal_num = SELECTION_REQUEST_EVENT;
- break;
- case GDK_SELECTION_NOTIFY:
- signal_num = SELECTION_NOTIFY_EVENT;
- break;
- case GDK_PROXIMITY_IN:
- signal_num = PROXIMITY_IN_EVENT;
- break;
- case GDK_PROXIMITY_OUT:
- signal_num = PROXIMITY_OUT_EVENT;
- break;
- case GDK_DRAG_BEGIN:
- signal_num = DRAG_BEGIN_EVENT;
- break;
- case GDK_DRAG_REQUEST:
- signal_num = DRAG_REQUEST_EVENT;
- break;
- case GDK_DROP_ENTER:
- signal_num = DROP_ENTER_EVENT;
- break;
- case GDK_DROP_LEAVE:
- signal_num = DROP_LEAVE_EVENT;
- break;
- case GDK_DROP_DATA_AVAIL:
- signal_num = DROP_DATA_AVAILABLE_EVENT;
- break;
- case GDK_OTHER_EVENT:
- signal_num = OTHER_EVENT;
- break;
- case GDK_NO_EXPOSE:
- signal_num = NO_EXPOSE_EVENT;
- break;
- case GDK_CLIENT_EVENT:
- signal_num = CLIENT_EVENT;
- break;
- case GDK_EXPOSE:
- /* there is no sense in providing a widget with bogus expose events
- */
- if (!event->any.window)
- {
- gtk_widget_unref (widget);
- return TRUE;
- }
- signal_num = EXPOSE_EVENT;
- break;
- default:
- g_warning ("could not determine signal number for event: %d", event->type);
- gtk_widget_unref (widget);
- return TRUE;
- }
-
- if (signal_num != -1)
- gtk_signal_emit (GTK_OBJECT (widget), widget_signals[signal_num], event, &return_val);
-
- return_val |= GTK_OBJECT_DESTROYED (widget);
-
- gtk_widget_unref (widget);
-
- return return_val;
-}
-
-/*****************************************
- * gtk_widget_activate:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_activate (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
- if (WIDGET_CLASS (widget)->activate_signal)
- gtk_signal_emit (GTK_OBJECT (widget), WIDGET_CLASS (widget)->activate_signal);
-}
-
-/*****************************************
- * gtk_widget_reparent_container_child:
- * assistent function to gtk_widget_reparent
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_widget_reparent_container_child(GtkWidget *widget,
- gpointer client_data)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (client_data != NULL);
-
- if (GTK_WIDGET_NO_WINDOW (widget))
- {
- if (widget->window)
- gdk_window_unref (widget->window);
- widget->window = (GdkWindow*) client_data;
- if (widget->window)
- gdk_window_ref (widget->window);
-
- if (GTK_IS_CONTAINER (widget))
- gtk_container_foreach (GTK_CONTAINER (widget),
- gtk_widget_reparent_container_child,
- client_data);
- }
- else
- gdk_window_reparent (widget->window,
- (GdkWindow*) client_data, 0, 0);
-}
-
-/*****************************************
- * gtk_widget_reparent:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_reparent (GtkWidget *widget,
- GtkWidget *new_parent)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_WIDGET (widget));
- g_return_if_fail (new_parent != NULL);
- g_return_if_fail (GTK_IS_CONTAINER (new_parent));
- g_return_if_fail (widget->parent != NULL);
-
- if (widget->parent != new_parent)
- {
- /* First try to see if we can get away without unrealizing
- * the widget as we reparent it. if so we set a flag so
- * that gtk_widget_unparent doesn't unrealize widget
- */
- if (GTK_WIDGET_REALIZED (widget) && GTK_WIDGET_REALIZED (new_parent))
- GTK_PRIVATE_SET_FLAG (widget, GTK_IN_REPARENT);
-
- gtk_widget_ref (widget);
- gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
- gtk_container_add (GTK_CONTAINER (new_parent), widget);
- gtk_widget_unref (widget);
-
- if (GTK_WIDGET_IN_REPARENT (widget))
- {
- GTK_PRIVATE_UNSET_FLAG (widget, GTK_IN_REPARENT);
-
- /* OK, now fix up the widget's window. (And that for any
- * children, if the widget is NO_WINDOW and a container)
- */
- if (GTK_WIDGET_NO_WINDOW (widget))
- {
- if (GTK_IS_CONTAINER (widget))
- gtk_container_foreach (GTK_CONTAINER (widget),
- gtk_widget_reparent_container_child,
- gtk_widget_get_parent_window (widget));
- else
- {
- GdkWindow *parent_window;
-
- parent_window = gtk_widget_get_parent_window (widget);
- if (parent_window != widget->window)
- {
- if (widget->window)
- gdk_window_unref (widget->window);
- widget->window = parent_window;
- if (widget->window)
- gdk_window_ref (widget->window);
- }
- }
- }
- else
- gdk_window_reparent (widget->window, gtk_widget_get_parent_window (widget), 0, 0);
- }
- }
-}
-
-/*****************************************
- * gtk_widget_popup:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_popup (GtkWidget *widget,
- gint x,
- gint y)
-{
- g_return_if_fail (widget != NULL);
-
- if (!GTK_WIDGET_VISIBLE (widget))
- {
- if (!GTK_WIDGET_REALIZED (widget))
- gtk_widget_realize (widget);
- if (!GTK_WIDGET_NO_WINDOW (widget))
- gdk_window_move (widget->window, x, y);
- gtk_widget_show (widget);
- }
-}
-
-/*****************************************
- * gtk_widget_intersect:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-gint
-gtk_widget_intersect (GtkWidget *widget,
- GdkRectangle *area,
- GdkRectangle *intersection)
-{
- GdkRectangle *dest;
- GdkRectangle tmp;
- gint return_val;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (area != NULL, FALSE);
-
- if (intersection)
- dest = intersection;
- else
- dest = &tmp;
-
- return_val = gdk_rectangle_intersect ((GdkRectangle*) &widget->allocation, area, dest);
-
- if (return_val && intersection && !GTK_WIDGET_NO_WINDOW (widget))
- {
- intersection->x -= widget->allocation.x;
- intersection->y -= widget->allocation.y;
- }
-
- return return_val;
-}
-
-
-gint
-gtk_widget_basic (GtkWidget *widget)
-{
- GList *children;
- GList *tmp_list;
- gint return_val;
-
- g_return_val_if_fail (widget != NULL, FALSE);
-
- if (!GTK_WIDGET_BASIC (widget))
- return FALSE;
- else if (GTK_IS_CONTAINER (widget))
- {
- children = gtk_container_children (GTK_CONTAINER (widget));
- if (children)
- {
- return_val = TRUE;
- tmp_list = children;
-
- while (tmp_list)
- {
- if (!gtk_widget_basic (GTK_WIDGET (tmp_list->data)))
- {
- return_val = FALSE;
- break;
- }
-
- tmp_list = tmp_list->next;
- }
-
- g_list_free (children);
- return return_val;
- }
- }
-
- return TRUE;
-}
-
-
-/*****************************************
- * gtk_widget_grab_focus:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_grab_focus (GtkWidget *widget)
-{
- GtkWidget *window;
- GtkWidget *child;
- GtkType window_type;
-
- g_return_if_fail (widget != NULL);
-
- window_type = gtk_window_get_type ();
- window = widget->parent;
- child = widget;
-
- while (window && !gtk_type_is_a (GTK_WIDGET_TYPE (window), window_type))
- {
- GTK_CONTAINER (window)->focus_child = child;
- child = window;
- window = window->parent;
- }
-
- if (window && gtk_type_is_a (GTK_WIDGET_TYPE (window), window_type))
- {
- GTK_CONTAINER (window)->focus_child = child;
- gtk_window_set_focus (GTK_WINDOW (window), widget);
- }
-}
-
-/*****************************************
- * gtk_widget_grab_default:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_grab_default (GtkWidget *widget)
-{
- GtkWidget *window;
- GtkType window_type;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_WIDGET_CAN_DEFAULT (widget));
-
- window_type = gtk_window_get_type ();
- window = widget->parent;
-
- while (window && !gtk_type_is_a (GTK_WIDGET_TYPE (window), window_type))
- window = window->parent;
-
- if (window && gtk_type_is_a (GTK_WIDGET_TYPE (window), window_type))
- gtk_window_set_default (GTK_WINDOW (window), widget);
-}
-
-/*****************************************
- * gtk_widget_set_name:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_set_name (GtkWidget *widget,
- const gchar *name)
-{
- g_return_if_fail (widget != NULL);
-
- if (widget->name)
- g_free (widget->name);
- widget->name = g_strdup (name);
-
- if (!GTK_WIDGET_USER_STYLE (widget))
- gtk_widget_set_rc_style (widget);
-}
-
-/*****************************************
- * gtk_widget_get_name:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-gchar*
-gtk_widget_get_name (GtkWidget *widget)
-{
- g_return_val_if_fail (widget != NULL, NULL);
-
- if (widget->name)
- return widget->name;
- return gtk_type_name (GTK_WIDGET_TYPE (widget));
-}
-
-/*****************************************
- * gtk_widget_set_state:
- *
- * arguments:
- * widget
- * state
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_set_state (GtkWidget *widget,
- GtkStateType state)
-{
- g_return_if_fail (widget != NULL);
-
- if (state == GTK_WIDGET_STATE (widget))
- return;
-
- if (state == GTK_STATE_INSENSITIVE)
- gtk_widget_set_sensitive (widget, FALSE);
- else
- {
- GtkStateData data;
- GtkStateType old_state;
-
- data.state = state;
- if (widget->parent)
- data.parent_sensitive = GTK_WIDGET_IS_SENSITIVE (widget->parent);
- else
- data.parent_sensitive = GTK_PARENT_SENSITIVE;
-
- old_state = GTK_WIDGET_STATE (widget);
-
- gtk_widget_propagate_state (widget, &data);
- if (old_state != GTK_WIDGET_STATE (widget))
- gtk_widget_queue_draw (widget);
- }
-}
-
-/*****************************************
- * gtk_widget_set_sensitive:
- *
- * arguments:
- * widget
- * boolean value for sensitivity
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_set_sensitive (GtkWidget *widget,
- gint sensitive)
-{
- GtkStateData data;
- GtkStateType old_state;
-
- g_return_if_fail (widget != NULL);
-
- if (sensitive)
- {
- GTK_WIDGET_SET_FLAGS (widget, GTK_SENSITIVE);
- if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
- data.state = GTK_WIDGET_SAVED_STATE (widget);
- else
- data.state = GTK_WIDGET_STATE (widget);
- }
- else
- {
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_SENSITIVE);
- data.state = GTK_WIDGET_STATE (widget);
- }
-
- if (widget->parent)
- data.parent_sensitive = GTK_WIDGET_IS_SENSITIVE (widget->parent);
- else
- data.parent_sensitive = GTK_PARENT_SENSITIVE;
-
- old_state = GTK_WIDGET_STATE (widget);
- gtk_widget_propagate_state (widget, &data);
- if (old_state != GTK_WIDGET_STATE (widget))
- gtk_widget_queue_draw (widget);
-}
-
-/*****************************************
- * gtk_widget_set_parent:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_set_parent (GtkWidget *widget,
- GtkWidget *parent)
-{
- GtkStateData data;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (widget->parent == NULL);
- g_return_if_fail (!GTK_WIDGET_TOPLEVEL (widget));
- g_return_if_fail (parent != NULL);
-
- /* keep this function in sync with gtk_menu_attach_to_widget()
- */
-
- gtk_widget_ref (widget);
- gtk_object_sink (GTK_OBJECT (widget));
- widget->parent = parent;
-
- if (GTK_WIDGET_STATE (parent) != GTK_STATE_NORMAL)
- data.state = GTK_WIDGET_STATE (parent);
- else
- data.state = GTK_WIDGET_STATE (widget);
- data.parent_sensitive = GTK_WIDGET_IS_SENSITIVE (parent);
-
- gtk_widget_propagate_state (widget, &data);
-
- while (parent->parent != NULL)
- parent = parent->parent;
-
- gtk_widget_set_style_recurse (widget, NULL);
-
- gtk_signal_emit (GTK_OBJECT (widget), widget_signals[PARENT_SET], NULL);
-}
-
-/*****************************************
- * Widget styles
- * see docs/styles.txt
- *****************************************/
-void
-gtk_widget_set_style (GtkWidget *widget,
- GtkStyle *style)
-{
- GtkStyle *default_style;
- gboolean initial_emission;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (style != NULL);
-
- initial_emission = !GTK_WIDGET_RC_STYLE (widget) && !GTK_WIDGET_USER_STYLE (widget);
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_RC_STYLE);
- GTK_PRIVATE_SET_FLAG (widget, GTK_USER_STYLE);
-
- default_style = gtk_object_get_data (GTK_OBJECT (widget), saved_default_style_key);
- if (!default_style)
- {
- gtk_style_ref (widget->style);
- gtk_object_set_data (GTK_OBJECT (widget), saved_default_style_key, widget->style);
- }
-
- gtk_widget_set_style_internal (widget, style, initial_emission);
-}
-
-void
-gtk_widget_ensure_style (GtkWidget *widget)
-{
- if (!GTK_WIDGET_USER_STYLE (widget) &&
- !GTK_WIDGET_RC_STYLE (widget))
- gtk_widget_set_rc_style (widget);
-}
-
-void
-gtk_widget_set_rc_style (GtkWidget *widget)
-{
- GtkStyle *saved_style;
- GtkStyle *new_style;
- gboolean initial_emission;
-
- g_return_if_fail (widget != NULL);
-
- initial_emission = !GTK_WIDGET_RC_STYLE (widget) && !GTK_WIDGET_USER_STYLE (widget);
-
- GTK_PRIVATE_UNSET_FLAG (widget, GTK_USER_STYLE);
- GTK_WIDGET_SET_FLAGS (widget, GTK_RC_STYLE);
-
- saved_style = gtk_object_get_data (GTK_OBJECT (widget), saved_default_style_key);
- new_style = gtk_rc_get_style (widget);
- if (new_style)
- {
- if (!saved_style)
- {
- gtk_style_ref (widget->style);
- gtk_object_set_data (GTK_OBJECT (widget), saved_default_style_key, widget->style);
- }
- gtk_widget_set_style_internal (widget, new_style, initial_emission);
- }
- else
- {
- if (saved_style)
- {
- g_assert (initial_emission == FALSE); /* FIXME: remove this line */
-
- gtk_object_remove_data (GTK_OBJECT (widget), saved_default_style_key);
- gtk_widget_set_style_internal (widget, saved_style, initial_emission);
- gtk_style_unref (saved_style);
- }
- else
- {
- if (initial_emission)
- gtk_widget_set_style_internal (widget, widget->style, TRUE);
- }
- }
-}
-
-void
-gtk_widget_restore_default_style (GtkWidget *widget)
-{
- GtkStyle *default_style;
-
- g_return_if_fail (widget != NULL);
-
- GTK_PRIVATE_UNSET_FLAG (widget, GTK_USER_STYLE);
-
- default_style = gtk_object_get_data (GTK_OBJECT (widget), saved_default_style_key);
- if (default_style)
- {
- gtk_object_remove_data (GTK_OBJECT (widget), saved_default_style_key);
- gtk_widget_set_style_internal (widget, default_style, FALSE);
- gtk_style_unref (default_style);
- }
-}
-
-GtkStyle*
-gtk_widget_get_style (GtkWidget *widget)
-{
- g_return_val_if_fail (widget != NULL, NULL);
-
- return widget->style;
-}
-
-static void
-gtk_widget_style_set (GtkWidget *widget,
- GtkStyle *previous_style)
-{
- if (GTK_WIDGET_REALIZED (widget) &&
- !GTK_WIDGET_NO_WINDOW (widget))
- gtk_style_set_background (widget->style, widget->window, widget->state);
-}
-
-static void
-gtk_widget_set_style_internal (GtkWidget *widget,
- GtkStyle *style,
- gboolean initial_emission)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (style != NULL);
-
- if (widget->style != style)
- {
- GtkStyle *previous_style;
-
- if (GTK_WIDGET_REALIZED (widget))
- gtk_style_detach (widget->style);
-
- previous_style = widget->style;
- widget->style = style;
- gtk_style_ref (widget->style);
-
- if (GTK_WIDGET_REALIZED (widget))
- widget->style = gtk_style_attach (widget->style, widget->window);
-
- gtk_signal_emit (GTK_OBJECT (widget),
- widget_signals[STYLE_SET],
- initial_emission ? NULL : previous_style);
- gtk_style_unref (previous_style);
-
- if (widget->parent && !initial_emission)
- {
- GtkRequisition old_requisition;
-
- old_requisition = widget->requisition;
- gtk_widget_size_request (widget, &widget->requisition);
-
- if ((old_requisition.width != widget->requisition.width) ||
- (old_requisition.height != widget->requisition.height))
- gtk_widget_queue_resize (widget);
- else if (GTK_WIDGET_DRAWABLE (widget))
- gtk_widget_queue_draw (widget);
- }
- }
- else if (initial_emission)
- {
- gtk_signal_emit (GTK_OBJECT (widget),
- widget_signals[STYLE_SET],
- NULL);
- }
-}
-
-static void
-gtk_widget_set_style_recurse (GtkWidget *widget,
- gpointer client_data)
-{
- if (GTK_WIDGET_RC_STYLE (widget))
- gtk_widget_set_rc_style (widget);
-
- if (GTK_IS_CONTAINER (widget))
- gtk_container_foreach (GTK_CONTAINER (widget),
- gtk_widget_set_style_recurse,
- NULL);
-}
-
-void
-gtk_widget_set_default_style (GtkStyle *style)
-{
- if (style != default_style)
- {
- if (default_style)
- gtk_style_unref (default_style);
- default_style = style;
- if (default_style)
- gtk_style_ref (default_style);
- }
-}
-
-GtkStyle*
-gtk_widget_get_default_style ()
-{
- if (!default_style)
- {
- default_style = gtk_style_new ();
- gtk_style_ref (default_style);
- }
-
- return default_style;
-}
-
-void
-gtk_widget_push_style (GtkStyle *style)
-{
- g_return_if_fail (style != NULL);
-
- gtk_style_ref (style);
- style_stack = g_slist_prepend (style_stack, style);
-}
-
-static GtkStyle*
-gtk_widget_peek_style ()
-{
- if (style_stack)
- return (GtkStyle*) style_stack->data;
- else
- return gtk_widget_get_default_style ();
-}
-
-void
-gtk_widget_pop_style ()
-{
- GSList *tmp;
-
- if (style_stack)
- {
- tmp = style_stack;
- style_stack = style_stack->next;
- gtk_style_unref ((GtkStyle*) tmp->data);
- g_slist_free_1 (tmp);
- }
-}
-
-/* Basically, send a message to all toplevel windows telling them
- * that a new _GTK_STYLE_COLORS property is available on the root
- * window
- */
-void
-gtk_widget_propagate_default_style (void)
-{
- GdkEventClient sev;
- int i;
-
- /* Set the property on the root window */
- gdk_property_change(GDK_ROOT_PARENT(),
- gdk_atom_intern("_GTK_DEFAULT_COLORS", FALSE),
- gdk_atom_intern("STRING", FALSE),
- 8*sizeof(gushort),
- GDK_PROP_MODE_REPLACE,
- (guchar *)gtk_widget_get_default_style(),
- GTK_STYLE_NUM_STYLECOLORS() * sizeof(GdkColor));
-
- for(i = 0; i < 5; i++)
- sev.data.l[i] = 0;
- sev.data_format = 32;
- sev.message_type = gdk_atom_intern ("_GTK_STYLE_CHANGED", FALSE);
- gdk_event_send_clientmessage_toall ((GdkEvent *) &sev);
-}
-
-/*************************************************************
- * gtk_widget_set_parent_window:
- * Set a non default parent window for widget
- *
- * arguments:
- * widget:
- * parent_window
- *
- * results:
- *************************************************************/
-
-void
-gtk_widget_set_parent_window (GtkWidget *widget,
- GdkWindow *parent_window)
-{
- GdkWindow *old_parent_window;
-
- g_return_if_fail (widget != NULL);
-
- old_parent_window = gtk_object_get_data (GTK_OBJECT (widget),
- parent_window_key);
-
- if (parent_window != old_parent_window)
- {
- gtk_object_set_data (GTK_OBJECT (widget), parent_window_key,
- parent_window);
- if (old_parent_window)
- gdk_window_unref (old_parent_window);
- if (parent_window)
- gdk_window_ref (parent_window);
- }
-}
-
-/*************************************************************
- * gtk_widget_get_parent_window:
- * Get widget's parent window
- *
- * arguments:
- * widget:
- *
- * results:
- * parent window
- *************************************************************/
-
-GdkWindow *
-gtk_widget_get_parent_window (GtkWidget *widget)
-{
- GdkWindow *parent_window;
-
- g_return_val_if_fail (widget != NULL, NULL);
- g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
- g_return_val_if_fail (widget->parent != NULL, NULL);
-
- parent_window = gtk_object_get_data (GTK_OBJECT (widget),
- parent_window_key);
-
- return (parent_window != NULL) ? parent_window : widget->parent->window;
-}
-
-/*****************************************
- * gtk_widget_set_uposition:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_set_uposition (GtkWidget *widget,
- gint x,
- gint y)
-{
- GtkWidgetAuxInfo *aux_info;
-
- g_return_if_fail (widget != NULL);
-
- aux_info = gtk_object_get_data (GTK_OBJECT (widget), aux_info_key);
- if (!aux_info)
- {
- aux_info = gtk_widget_aux_info_new ();
- gtk_object_set_data (GTK_OBJECT (widget), aux_info_key, aux_info);
- }
-
- if (x > -2)
- aux_info->x = x;
- if (y > -2)
- aux_info->y = y;
-
- if (GTK_WIDGET_REALIZED (widget) && GTK_IS_WINDOW (widget) &&
- (aux_info->x != -1) && (aux_info->y != -1))
- {
- gdk_window_set_hints (widget->window, aux_info->x, aux_info->y, 0, 0, 0, 0, GDK_HINT_POS);
- gdk_window_move (widget->window, aux_info->x, aux_info->y);
- }
-
- if (GTK_WIDGET_VISIBLE (widget) && widget->parent)
- gtk_widget_size_allocate (widget, &widget->allocation);
-}
-
-/*****************************************
- * gtk_widget_set_usize:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_set_usize (GtkWidget *widget,
- gint width,
- gint height)
-{
- GtkWidgetAuxInfo *aux_info;
-
- g_return_if_fail (widget != NULL);
-
- aux_info = gtk_object_get_data (GTK_OBJECT (widget), aux_info_key);
- if (!aux_info)
- {
- aux_info = gtk_widget_aux_info_new ();
- gtk_object_set_data (GTK_OBJECT (widget), aux_info_key, aux_info);
- }
-
- if (width > -1)
- aux_info->width = width;
- if (height > -1)
- aux_info->height = height;
-
- if (GTK_WIDGET_VISIBLE (widget))
- gtk_widget_queue_resize (widget);
-}
-
-/*****************************************
- * gtk_widget_set_events:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_set_events (GtkWidget *widget,
- gint events)
-{
- gint *eventp;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (!GTK_WIDGET_NO_WINDOW (widget));
- g_return_if_fail (!GTK_WIDGET_REALIZED (widget));
-
- eventp = gtk_object_get_data (GTK_OBJECT (widget), event_key);
-
- if (events)
- {
- if (!eventp)
- eventp = g_new (gint, 1);
-
- *eventp = events;
- gtk_object_set_data (GTK_OBJECT (widget), event_key, eventp);
- }
- else
- {
- if (eventp)
- g_free (eventp);
-
- gtk_object_remove_data (GTK_OBJECT (widget), event_key);
- }
-}
-
-/*****************************************
- * gtk_widget_set_extension_events:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_set_extension_events (GtkWidget *widget,
- GdkExtensionMode mode)
-{
- GdkExtensionMode *modep;
-
- g_return_if_fail (widget != NULL);
-
- modep = gtk_object_get_data (GTK_OBJECT (widget), extension_event_key);
-
- if (!modep)
- modep = g_new (GdkExtensionMode, 1);
-
- *modep = mode;
- gtk_object_set_data (GTK_OBJECT (widget), extension_event_key, modep);
-}
-
-
-/*****************************************
- * gtk_widget_get_toplevel:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-GtkWidget*
-gtk_widget_get_toplevel (GtkWidget *widget)
-{
- g_return_val_if_fail (widget != NULL, NULL);
-
- while (widget->parent)
- widget = widget->parent;
-
- return widget;
-}
-
-/*****************************************
- * gtk_widget_get_ancestor:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-GtkWidget*
-gtk_widget_get_ancestor (GtkWidget *widget,
- GtkType widget_type)
-{
- g_return_val_if_fail (widget != NULL, NULL);
-
- while (widget && !gtk_type_is_a (GTK_WIDGET_TYPE (widget), widget_type))
- widget = widget->parent;
-
- if (!(widget && gtk_type_is_a (GTK_WIDGET_TYPE (widget), widget_type)))
- return NULL;
-
- return widget;
-}
-
-/*****************************************
- * gtk_widget_get_colormap:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-GdkColormap*
-gtk_widget_get_colormap (GtkWidget *widget)
-{
- GdkColormap *colormap;
-
- g_return_val_if_fail (widget != NULL, NULL);
-
- if (!widget->window)
- {
- colormap = gtk_object_get_data (GTK_OBJECT (widget), colormap_key);
- if (colormap)
- return colormap;
- return gtk_widget_get_default_colormap ();
- }
-
- return gdk_window_get_colormap (widget->window);
-}
-
-/*****************************************
- * gtk_widget_get_visual:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-GdkVisual*
-gtk_widget_get_visual (GtkWidget *widget)
-{
- GdkVisual *visual;
-
- g_return_val_if_fail (widget != NULL, NULL);
-
- if (!widget->window)
- {
- visual = gtk_object_get_data (GTK_OBJECT (widget), visual_key);
- if (visual)
- return visual;
- return gtk_widget_get_default_visual ();
- }
-
- return gdk_window_get_visual (widget->window);
-}
-
-/*****************************************
- * gtk_widget_get_events:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-gint
-gtk_widget_get_events (GtkWidget *widget)
-{
- gint *events;
-
- g_return_val_if_fail (widget != NULL, 0);
-
- events = gtk_object_get_data (GTK_OBJECT (widget), event_key);
- if (events)
- return *events;
-
- return 0;
-}
-
-/*****************************************
- * gtk_widget_get_extension_events:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-GdkExtensionMode
-gtk_widget_get_extension_events (GtkWidget *widget)
-{
- GdkExtensionMode *mode;
-
- g_return_val_if_fail (widget != NULL, 0);
-
- mode = gtk_object_get_data (GTK_OBJECT (widget), extension_event_key);
- if (mode)
- return *mode;
-
- return 0;
-}
-
-/*****************************************
- * gtk_widget_get_pointer:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_get_pointer (GtkWidget *widget,
- gint *x,
- gint *y)
-{
- g_return_if_fail (widget != NULL);
-
- if (x)
- *x = -1;
- if (y)
- *y = -1;
-
- if (GTK_WIDGET_REALIZED (widget))
- {
- gdk_window_get_pointer (widget->window, x, y, NULL);
-
- if (GTK_WIDGET_NO_WINDOW (widget))
- {
- if (x)
- *x -= widget->allocation.x;
- if (y)
- *y -= widget->allocation.y;
- }
- }
-}
-
-/*****************************************
- * gtk_widget_is_ancestor:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-gint
-gtk_widget_is_ancestor (GtkWidget *widget,
- GtkWidget *ancestor)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (ancestor != NULL, FALSE);
-
- while (widget)
- {
- if (widget->parent == ancestor)
- return TRUE;
- widget = widget->parent;
- }
-
- return FALSE;
-}
-
-/*****************************************
- * gtk_widget_is_child:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-gint
-gtk_widget_is_child (GtkWidget *widget,
- GtkWidget *child)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (child != NULL, FALSE);
-
- return (child->parent == widget);
-}
-
-/*****************************************
- * gtk_widget_push_colormap:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_push_colormap (GdkColormap *cmap)
-{
- g_return_if_fail (cmap != NULL);
-
- colormap_stack = g_slist_prepend (colormap_stack, cmap);
-}
-
-/*****************************************
- * gtk_widget_push_visual:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_push_visual (GdkVisual *visual)
-{
- g_return_if_fail (visual != NULL);
-
- visual_stack = g_slist_prepend (visual_stack, visual);
-}
-
-/*****************************************
- * gtk_widget_pop_colormap:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_pop_colormap ()
-{
- GSList *tmp;
-
- if (colormap_stack)
- {
- tmp = colormap_stack;
- colormap_stack = colormap_stack->next;
- g_slist_free_1 (tmp);
- }
-}
-
-/*****************************************
- * gtk_widget_pop_visual:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_pop_visual ()
-{
- GSList *tmp;
-
- if (visual_stack)
- {
- tmp = visual_stack;
- visual_stack = visual_stack->next;
- g_slist_free_1 (tmp);
- }
-}
-
-/*****************************************
- * gtk_widget_set_default_colormap:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_set_default_colormap (GdkColormap *colormap)
-{
- if (default_colormap != colormap)
- {
- if (default_colormap)
- gdk_colormap_unref (default_colormap);
- default_colormap = colormap;
- if (default_colormap)
- gdk_colormap_ref (default_colormap);
- }
-}
-
-/*****************************************
- * gtk_widget_set_default_visual:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-void
-gtk_widget_set_default_visual (GdkVisual *visual)
-{
- default_visual = visual;
-}
-
-/*****************************************
- * gtk_widget_get_default_colormap:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-GdkColormap*
-gtk_widget_get_default_colormap ()
-{
- if (!default_colormap)
- default_colormap = gdk_colormap_get_system ();
-
- return default_colormap;
-}
-
-/*****************************************
- * gtk_widget_get_default_visual:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-GdkVisual*
-gtk_widget_get_default_visual ()
-{
- if (!default_visual)
- default_visual = gdk_visual_get_system ();
-
- return default_visual;
-}
-
-/*****************************************
- * gtk_widget_marshal_signal_1:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_widget_marshal_signal_1 (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkWidgetSignal1 rfunc;
-
- rfunc = (GtkWidgetSignal1) func;
-
- (* rfunc) (object,
- GTK_VALUE_POINTER (args[0]),
- func_data);
-}
-
-/*****************************************
- * gtk_widget_marshal_signal_2:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_widget_marshal_signal_2 (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkWidgetSignal2 rfunc;
- gint *return_val;
-
- rfunc = (GtkWidgetSignal2) func;
- return_val = GTK_RETLOC_BOOL (args[3]);
-
- *return_val = (* rfunc) (object,
- GTK_VALUE_STRING (args[0]),
- GTK_VALUE_CHAR (args[1]),
- GTK_VALUE_INT (args[2]),
- func_data);
-}
-
-/*****************************************
- * gtk_widget_marshal_signal_3:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_widget_marshal_signal_3 (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkWidgetSignal3 rfunc;
-
- rfunc = (GtkWidgetSignal3) func;
-
- (* rfunc) (object,
- GTK_VALUE_STRING (args[0]),
- func_data);
-}
-
-/*****************************************
- * gtk_widget_marshal_signal_4:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_widget_marshal_signal_4 (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkWidgetSignal4 rfunc;
- gint *return_val;
-
- rfunc = (GtkWidgetSignal4) func;
- return_val = GTK_RETLOC_BOOL (args[1]);
-
- *return_val = (* rfunc) (object,
- GTK_VALUE_BOXED (args[0]),
- func_data);
-}
-
-/*****************************************
- * gtk_widget_marshal_signal_5:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_widget_marshal_signal_5 (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkWidgetSignal5 rfunc;
-
- rfunc = (GtkWidgetSignal5) func;
-
- (* rfunc) (object,
- GTK_VALUE_UINT (args[0]),
- func_data);
-}
-
-/*****************************************
- * gtk_widget_marshal_signal_6:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_widget_marshal_signal_6 (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkWidgetSignal6 rfunc;
-
- rfunc = (GtkWidgetSignal6) func;
-
- (* rfunc) (object,
- GTK_VALUE_OBJECT (args[0]),
- func_data);
-}
-
-/*****************************************
- * gtk_widget_marshal_signal_7:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_widget_marshal_signal_7 (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkWidgetSignal7 rfunc;
-
- rfunc = (GtkWidgetSignal7) func;
-
- (* rfunc) (object,
- GTK_VALUE_BOXED (args[0]),
- func_data);
-}
-
-static void
-gtk_widget_real_destroy (GtkObject *object)
-{
- GtkWidget *widget = GTK_WIDGET (object);
- GtkStyle *saved_style;
-
- gtk_widget_ref (widget);
-
- if (GTK_WIDGET_REDRAW_PENDING (widget))
- {
- gtk_widget_redraw_queue = g_slist_remove (gtk_widget_redraw_queue, widget);
- GTK_PRIVATE_UNSET_FLAG (widget, GTK_REDRAW_PENDING);
- }
-
- if (GTK_CONTAINER_RESIZE_PENDING (widget))
- {
- gtk_widget_resize_queue = g_slist_remove (gtk_widget_resize_queue, widget);
- GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_PENDING);
- }
-
- if (GTK_WIDGET_HAS_SHAPE_MASK (widget))
- gtk_widget_shape_combine_mask (widget, NULL, -1, -1);
-
- gtk_grab_remove (widget);
- gtk_selection_remove_all (widget);
-
- if (widget->parent)
- gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
-
- saved_style = gtk_object_get_data (GTK_OBJECT (widget), saved_default_style_key);
- if (saved_style)
- {
- gtk_style_unref (saved_style);
- gtk_object_remove_data (GTK_OBJECT (widget), saved_default_style_key);
- }
-
- gtk_style_unref (widget->style);
- widget->style = NULL;
-
- parent_class->destroy (object);
-
- gtk_widget_unref (widget);
-}
-
-static void
-gtk_widget_real_finalize (GtkObject *object)
-{
- GtkWidget *widget;
- GtkWidgetAuxInfo *aux_info;
- gint *events;
- GdkExtensionMode *mode;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_WIDGET (object));
-
- widget = GTK_WIDGET (object);
-
- if (widget->name)
- {
- g_free (widget->name);
- widget->name = NULL;
- }
-
- aux_info = gtk_object_get_data (GTK_OBJECT (widget), aux_info_key);
- if (aux_info)
- {
- gtk_widget_aux_info_destroy (aux_info);
- gtk_object_remove_data (GTK_OBJECT (widget), aux_info_key);
- }
-
- events = gtk_object_get_data (GTK_OBJECT (widget), event_key);
- if (events)
- {
- g_free (events);
- gtk_object_remove_data (GTK_OBJECT (widget), event_key);
- }
-
- mode = gtk_object_get_data (GTK_OBJECT (widget), extension_event_key);
- if (mode)
- {
- g_free (mode);
- gtk_object_remove_data (GTK_OBJECT (widget), extension_event_key);
- }
-
- parent_class->finalize (object);
-}
-
-/*****************************************
- * gtk_widget_real_show:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_widget_real_show (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
- if (!GTK_WIDGET_VISIBLE (widget))
- {
- GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
-
- if (widget->parent)
- {
- gtk_widget_queue_resize (widget);
-
- if (GTK_WIDGET_MAPPED (widget->parent))
- gtk_widget_map (widget);
- }
- }
-}
-
-/*****************************************
- * gtk_widget_real_hide:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_widget_real_hide (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
- if (GTK_WIDGET_VISIBLE (widget))
- {
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_VISIBLE);
-
- if (GTK_WIDGET_MAPPED (widget))
- gtk_widget_unmap (widget);
-
- if (widget->parent)
- gtk_widget_queue_resize (widget);
- }
-}
-
-/*****************************************
- * gtk_widget_real_map:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_widget_real_map (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
- if (GTK_WIDGET_REALIZED (widget) && !GTK_WIDGET_MAPPED (widget))
- {
- GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
-
- if (!GTK_WIDGET_NO_WINDOW (widget))
- gdk_window_show (widget->window);
- else
- gtk_widget_queue_draw (widget);
- }
-}
-
-/*****************************************
- * gtk_widget_real_unmap:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_widget_real_unmap (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
- if (GTK_WIDGET_MAPPED (widget))
- {
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
-
- if (GTK_WIDGET_NO_WINDOW (widget))
- gdk_window_clear_area (widget->window,
- widget->allocation.x,
- widget->allocation.y,
- widget->allocation.width,
- widget->allocation.height);
- else
- gdk_window_hide (widget->window);
- }
-}
-
-/*****************************************
- * gtk_widget_real_realize:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_widget_real_realize (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_WIDGET (widget));
- g_return_if_fail (GTK_WIDGET_NO_WINDOW (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
- if (widget->parent)
- {
- widget->window = gtk_widget_get_parent_window (widget);
- gdk_window_ref (widget->window);
- }
- widget->style = gtk_style_attach (widget->style, widget->window);
-}
-
-/*****************************************
- * gtk_widget_real_unrealize:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_widget_real_unrealize (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
- if (GTK_WIDGET_NO_WINDOW (widget) && GTK_WIDGET_MAPPED (widget))
- gtk_widget_real_unmap (widget);
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_REALIZED | GTK_MAPPED);
-
- /* printf ("unrealizing %s\n", gtk_type_name (GTK_OBJECT(widget)->klass->type));
- */
-
- gtk_style_detach (widget->style);
- if (!GTK_WIDGET_NO_WINDOW (widget))
- {
- gdk_window_set_user_data (widget->window, NULL);
- gdk_window_destroy (widget->window);
- }
- else
- {
- gdk_window_unref (widget->window);
- }
-
- /* Unrealize afterwards to improve visual effect */
-
- if (GTK_IS_CONTAINER (widget))
- gtk_container_foreach (GTK_CONTAINER (widget),
- (GtkCallback)gtk_widget_unrealize,
- NULL);
-
- widget->window = NULL;
-}
-
-/*****************************************
- * gtk_widget_real_draw:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_widget_real_draw (GtkWidget *widget,
- GdkRectangle *area)
-{
- GdkEventExpose event;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_WIDGET (widget));
- g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- event.type = GDK_EXPOSE;
- event.window = widget->window;
- event.area = *area;
-
- gdk_window_ref (event.window);
- gtk_widget_event (widget, (GdkEvent*) &event);
- gdk_window_unref (event.window);
- }
-}
-
-/*****************************************
- * gtk_widget_real_queue_draw:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static gint
-gtk_widget_real_queue_draw (GtkWidget *widget)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
-
- GTK_PRIVATE_UNSET_FLAG (widget, GTK_REDRAW_PENDING);
- gtk_widget_draw (widget, NULL);
-
- return FALSE;
-}
-
-/*****************************************
- * gtk_widget_real_size_allocate:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_widget_real_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_WIDGET (widget));
-
- if (GTK_WIDGET_NO_WINDOW (widget) &&
- GTK_WIDGET_MAPPED (widget) &&
- ((widget->allocation.x != allocation->x) ||
- (widget->allocation.y != allocation->y) ||
- (widget->allocation.width != allocation->width) ||
- (widget->allocation.height != allocation->height)) &&
- (widget->allocation.width != 0) &&
- (widget->allocation.height != 0))
- gdk_window_clear_area (widget->window,
- widget->allocation.x,
- widget->allocation.y,
- widget->allocation.width,
- widget->allocation.height);
-
- widget->allocation = *allocation;
-
- if (GTK_WIDGET_REALIZED (widget) &&
- !GTK_WIDGET_NO_WINDOW (widget))
- gdk_window_move_resize (widget->window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
-}
-
-/*****************************************
- * gtk_widget_peek_colormap:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static GdkColormap*
-gtk_widget_peek_colormap ()
-{
- if (colormap_stack)
- return (GdkColormap*) colormap_stack->data;
- return gtk_widget_get_default_colormap ();
-}
-
-/*****************************************
- * gtk_widget_peek_visual:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static GdkVisual*
-gtk_widget_peek_visual ()
-{
- if (visual_stack)
- return (GdkVisual*) visual_stack->data;
- return gtk_widget_get_default_visual ();
-}
-
-/*************************************************************
- * gtk_widget_propagate_state:
- * Propagate a change in the widgets state down the tree
- *
- * arguments:
- * widget
- * GtkStateData: state
- * parent_sensitive
- *
- * results:
- *************************************************************/
-
-static void
-gtk_widget_propagate_state (GtkWidget *widget,
- GtkStateData *data)
-{
- guint8 old_state;
-
- /* don't call this function with state=GTK_STATE_INSENSITIVE,
- * parent_sensitive=TRUE and a sensitive widget
- */
-
- old_state = GTK_WIDGET_STATE (widget);
-
- if (data->parent_sensitive)
- {
- GTK_WIDGET_SET_FLAGS (widget, GTK_PARENT_SENSITIVE);
-
- if (GTK_WIDGET_IS_SENSITIVE (widget))
- GTK_WIDGET_STATE (widget) = data->state;
- else
- {
- GTK_WIDGET_STATE (widget) = GTK_STATE_INSENSITIVE;
- if (data->state != GTK_STATE_INSENSITIVE)
- GTK_WIDGET_SAVED_STATE (widget) = data->state;
- }
- }
- else
- {
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_PARENT_SENSITIVE);
- GTK_WIDGET_STATE (widget) = GTK_STATE_INSENSITIVE;
- if (data->state != GTK_STATE_INSENSITIVE)
- GTK_WIDGET_SAVED_STATE (widget) = data->state;
- }
-
- if (GTK_WIDGET_HAS_FOCUS (widget) && !GTK_WIDGET_IS_SENSITIVE (widget))
- {
- GtkWidget *window;
-
- window = gtk_widget_get_ancestor (widget, gtk_window_get_type ());
- if (window)
- gtk_window_set_focus (GTK_WINDOW (window), NULL);
- }
-
- if (old_state != GTK_WIDGET_STATE (widget))
- {
- gtk_widget_ref (widget);
- gtk_signal_emit (GTK_OBJECT (widget), widget_signals[STATE_CHANGED], old_state);
-
- if (GTK_IS_CONTAINER (widget))
- {
- data->parent_sensitive = GTK_WIDGET_IS_SENSITIVE (widget);
- data->state = GTK_WIDGET_STATE (widget);
- gtk_container_foreach (GTK_CONTAINER (widget),
- (GtkCallback) gtk_widget_propagate_state,
- data);
- }
- gtk_widget_unref (widget);
- }
-}
-
-/*****************************************
- * gtk_widget_draw_children_recurse:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_widget_draw_children_recurse (GtkWidget *widget,
- gpointer client_data)
-{
- gtk_widget_draw (widget, NULL);
- gtk_widget_draw_children (widget);
-}
-
-/*****************************************
- * gtk_widget_aux_info_new:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static GtkWidgetAuxInfo*
-gtk_widget_aux_info_new ()
-{
- GtkWidgetAuxInfo *aux_info;
-
- if (!aux_info_mem_chunk)
- aux_info_mem_chunk = g_mem_chunk_new ("widget aux info mem chunk",
- sizeof (GtkWidgetAuxInfo),
- 1024, G_ALLOC_AND_FREE);
-
- aux_info = g_chunk_new (GtkWidgetAuxInfo, aux_info_mem_chunk);
-
- aux_info->x = -1;
- aux_info->y = -1;
- aux_info->width = 0;
- aux_info->height = 0;
-
- return aux_info;
-}
-
-/*****************************************
- * gtk_widget_aux_info_destroy:
- *
- * arguments:
- *
- * results:
- *****************************************/
-
-static void
-gtk_widget_aux_info_destroy (GtkWidgetAuxInfo *aux_info)
-{
- g_return_if_fail (aux_info != NULL);
-
- g_mem_chunk_free (aux_info_mem_chunk, aux_info);
-}
-
-/*****************************************
- * gtk_widget_shape_combine_mask:
- * set a shape for this widgets' gdk window, this allows for
- * transparent windows etc., see gdk_window_shape_combine_mask
- * for more information
- *
- * arguments:
- *
- * results:
- *****************************************/
-void
-gtk_widget_shape_combine_mask (GtkWidget *widget,
- GdkBitmap *shape_mask,
- gint offset_x,
- gint offset_y)
-{
- GtkWidgetShapeInfo* shape_info;
-
- g_return_if_fail (widget != NULL);
- /* set_shape doesn't work on widgets without gdk window */
- g_return_if_fail (!GTK_WIDGET_NO_WINDOW (widget));
-
- if (!shape_mask)
- {
- GTK_PRIVATE_UNSET_FLAG (widget, GTK_HAS_SHAPE_MASK);
-
- if (widget->window)
- gdk_window_shape_combine_mask (widget->window, NULL, 0, 0);
-
- shape_info = gtk_object_get_data (GTK_OBJECT (widget), shape_info_key);
- gtk_object_remove_data (GTK_OBJECT (widget), shape_info_key);
- g_free (shape_info);
- }
- else
- {
- GTK_PRIVATE_SET_FLAG (widget, GTK_HAS_SHAPE_MASK);
-
- shape_info = gtk_object_get_data (GTK_OBJECT (widget), shape_info_key);
- if (!shape_info)
- {
- shape_info = g_new (GtkWidgetShapeInfo, 1);
- gtk_object_set_data (GTK_OBJECT (widget), shape_info_key, shape_info);
- }
- shape_info->shape_mask = shape_mask;
- shape_info->offset_x = offset_x;
- shape_info->offset_y = offset_y;
-
- /* set shape if widget has a gdk window allready.
- * otherwise the shape is scheduled to be set by gtk_widget_realize.
- */
- if (widget->window)
- gdk_window_shape_combine_mask (widget->window, shape_mask,
- offset_x, offset_y);
- }
-}
-
-/*****************************************
- * gtk_widget_dnd_drag_add:
- * when you get a DRAG_ENTER event, you can use this
- * to tell Gtk ofother widgets that are to be dragged as well
- *
- * arguments:
- *
- * results:
- *****************************************/
-void
-gtk_widget_dnd_drag_add (GtkWidget *widget)
-{
-}
-
-/*****************************************
- * gtk_widget_dnd_drag_set:
- * these two functions enable drag and/or drop on a
- * widget and also let Gtk know what data types will be accepted
- * use MIME type naming,plus tacking "URL:" on the front for link
- * dragging
- *
- *
- * arguments:
- *
- * results:
- *****************************************/
-void
-gtk_widget_dnd_drag_set (GtkWidget *widget,
- guint8 drag_enable,
- gchar **type_accept_list,
- guint numtypes)
-{
- g_return_if_fail(widget != NULL);
-
- if (!widget->window)
- gtk_widget_realize (widget);
-
- g_return_if_fail (widget->window != NULL);
- gdk_window_dnd_drag_set (widget->window,
- drag_enable,
- type_accept_list,
- numtypes);
-}
-
-/*****************************************
- * gtk_widget_dnd_drop_set:
- *
- * arguments:
- *
- * results:
- *****************************************/
-void
-gtk_widget_dnd_drop_set (GtkWidget *widget,
- guint8 drop_enable,
- gchar **type_accept_list,
- guint numtypes,
- guint8 is_destructive_operation)
-{
- g_return_if_fail(widget != NULL);
-
- if (!widget->window)
- gtk_widget_realize (widget);
-
- g_return_if_fail (widget->window != NULL);
- gdk_window_dnd_drop_set (widget->window,
- drop_enable,
- type_accept_list,
- numtypes,
- is_destructive_operation);
-}
-
-/*****************************************
- * gtk_widget_dnd_data_set:
- *
- * arguments:
- *
- * results:
- *****************************************/
-void
-gtk_widget_dnd_data_set (GtkWidget *widget,
- GdkEvent *event,
- gpointer data,
- gulong data_numbytes)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (widget->window != NULL);
-
- gdk_window_dnd_data_set (widget->window, event, data, data_numbytes);
-}
-
-
-#undef gtk_widget_ref
-#undef gtk_widget_unref
-
-
-void
-gtk_widget_ref (GtkWidget *widget)
-{
- gtk_object_ref (GTK_OBJECT (widget));
-}
-
-void
-gtk_widget_unref (GtkWidget *widget)
-{
- gtk_object_unref (GTK_OBJECT (widget));
-}
-
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
deleted file mode 100644
index 3c805a4d6a..0000000000
--- a/gtk/gtkwidget.h
+++ /dev/null
@@ -1,540 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_WIDGET_H__
-#define __GTK_WIDGET_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkaccelerator.h>
-#include <gtk/gtkobject.h>
-#include <gtk/gtkstyle.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/* The flags that are used by GtkWidget on top of the
- * flags field of GtkObject.
- */
-enum
-{
- GTK_TOPLEVEL = 1 << 4,
- GTK_NO_WINDOW = 1 << 5,
- GTK_REALIZED = 1 << 6,
- GTK_MAPPED = 1 << 7,
- GTK_VISIBLE = 1 << 8,
- GTK_SENSITIVE = 1 << 9,
- GTK_PARENT_SENSITIVE = 1 << 10,
- GTK_CAN_FOCUS = 1 << 11,
- GTK_HAS_FOCUS = 1 << 12,
- GTK_CAN_DEFAULT = 1 << 13,
- GTK_HAS_DEFAULT = 1 << 14,
- GTK_HAS_GRAB = 1 << 15,
- GTK_BASIC = 1 << 16,
- GTK_RESERVED_3 = 1 << 17,
- GTK_RC_STYLE = 1 << 18
-};
-
-
-/* Macro for casting a pointer to a GtkWidget pointer.
- */
-#define GTK_WIDGET(wid) GTK_CHECK_CAST ((wid), gtk_widget_get_type (), GtkWidget)
-
-/* Macro for casting the klass field of a widget to a GtkWidgetClass pointer.
- */
-#define GTK_WIDGET_CLASS(klass) GTK_CHECK_CLASS_CAST ((klass), gtk_widget_get_type (), GtkWidgetClass)
-
-/* Macros for extracting various fields from GtkWidget and GtkWidgetClass.
- */
-#define GTK_WIDGET_TYPE(wid) (GTK_OBJECT_TYPE (wid))
-#define GTK_WIDGET_STATE(wid) (GTK_WIDGET (wid)->state)
-#define GTK_WIDGET_SAVED_STATE(wid) (GTK_WIDGET (wid)->saved_state)
-
-/* Macros for extracting the widget flags from GtkWidget.
- */
-#define GTK_WIDGET_FLAGS(wid) (GTK_OBJECT_FLAGS (wid))
-#define GTK_WIDGET_TOPLEVEL(wid) (GTK_WIDGET_FLAGS (wid) & GTK_TOPLEVEL)
-#define GTK_WIDGET_NO_WINDOW(wid) (GTK_WIDGET_FLAGS (wid) & GTK_NO_WINDOW)
-#define GTK_WIDGET_REALIZED(wid) (GTK_WIDGET_FLAGS (wid) & GTK_REALIZED)
-#define GTK_WIDGET_MAPPED(wid) (GTK_WIDGET_FLAGS (wid) & GTK_MAPPED)
-#define GTK_WIDGET_VISIBLE(wid) (GTK_WIDGET_FLAGS (wid) & GTK_VISIBLE)
-#define GTK_WIDGET_DRAWABLE(wid) (GTK_WIDGET_VISIBLE (wid) && GTK_WIDGET_MAPPED (wid))
-#define GTK_WIDGET_SENSITIVE(wid) (GTK_WIDGET_FLAGS (wid) & GTK_SENSITIVE)
-#define GTK_WIDGET_PARENT_SENSITIVE(wid) (GTK_WIDGET_FLAGS (wid) & GTK_PARENT_SENSITIVE)
-#define GTK_WIDGET_IS_SENSITIVE(wid) ((GTK_WIDGET_SENSITIVE (wid) && \
- GTK_WIDGET_PARENT_SENSITIVE (wid)) != 0)
-#define GTK_WIDGET_CAN_FOCUS(wid) (GTK_WIDGET_FLAGS (wid) & GTK_CAN_FOCUS)
-#define GTK_WIDGET_HAS_FOCUS(wid) (GTK_WIDGET_FLAGS (wid) & GTK_HAS_FOCUS)
-#define GTK_WIDGET_CAN_DEFAULT(wid) (GTK_WIDGET_FLAGS (wid) & GTK_CAN_DEFAULT)
-#define GTK_WIDGET_HAS_DEFAULT(wid) (GTK_WIDGET_FLAGS (wid) & GTK_HAS_DEFAULT)
-#define GTK_WIDGET_HAS_GRAB(wid) (GTK_WIDGET_FLAGS (wid) & GTK_HAS_GRAB)
-#define GTK_WIDGET_BASIC(wid) (GTK_WIDGET_FLAGS (wid) & GTK_BASIC)
-#define GTK_WIDGET_RC_STYLE(wid) (GTK_WIDGET_FLAGS (wid) & GTK_RC_STYLE)
-
-/* Macros for setting and clearing widget flags.
- */
-#define GTK_WIDGET_SET_FLAGS(wid,flag) G_STMT_START{ (GTK_WIDGET_FLAGS (wid) |= (flag)); }G_STMT_END
-#define GTK_WIDGET_UNSET_FLAGS(wid,flag) G_STMT_START{ (GTK_WIDGET_FLAGS (wid) &= ~(flag)); }G_STMT_END
-
-/* Macros for testing whether "wid" is of type GtkWidget.
- */
-#define GTK_IS_WIDGET(wid) GTK_CHECK_TYPE ((wid), GTK_TYPE_WIDGET)
-#define GTK_TYPE_WIDGET (gtk_widget_get_type ())
-
-
-
-typedef struct _GtkRequisition GtkRequisition;
-typedef struct _GtkAllocation GtkAllocation;
-typedef struct _GtkSelectionData GtkSelectionData;
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWidgetClass GtkWidgetClass;
-typedef struct _GtkWidgetAuxInfo GtkWidgetAuxInfo;
-typedef struct _GtkWidgetShapeInfo GtkWidgetShapeInfo;
-
-typedef void (*GtkCallback) (GtkWidget *widget,
- gpointer data);
-
-/* A requisition is a desired amount of space which a
- * widget may request.
- */
-struct _GtkRequisition
-{
- guint16 width;
- guint16 height;
-};
-
-/* An allocation is a size and position. Where a widget
- * can ask for a desired size, it is actually given
- * this amount of space at the specified position.
- */
-struct _GtkAllocation
-{
- gint16 x;
- gint16 y;
- guint16 width;
- guint16 height;
-};
-
-/* The contents of a selection are returned in a GtkSelectionData
- structure. selection/target identify the request.
- type specifies the type of the return; if length < 0, and
- the data should be ignored. This structure has object semantics -
- no fields should be modified directly, they should not be created
- directly, and pointers to them should not be stored beyond the duration of
- a callback. (If the last is changed, we'll need to add reference
- counting) */
-
-struct _GtkSelectionData
-{
- GdkAtom selection;
- GdkAtom target;
- GdkAtom type;
- gint format;
- guchar *data;
- gint length;
-};
-
-/* The widget is the base of the tree for displayable objects.
- * (A displayable object is one which takes up some amount
- * of screen real estate). It provides a common base and interface
- * which actual widgets must adhere to.
- */
-struct _GtkWidget
-{
- /* The object structure needs to be the first
- * element in the widget structure in order for
- * the object mechanism to work correctly. This
- * allows a GtkWidget pointer to be cast to a
- * GtkObject pointer.
- */
- GtkObject object;
-
- /* 16 bits of internally used private flags.
- * this will be packed into the same 4 byte alignment frame that
- * state and saved_state go. we therefore don't waste any new
- * space on this.
- */
- guint16 private_flags;
-
- /* The state of the widget. There are actually only
- * 5 widget states (defined in "gtkenums.h").
- */
- guint8 state;
-
- /* The saved state of the widget. When a widgets state
- * is changed to GTK_STATE_INSENSITIVE via
- * "gtk_widget_set_state" or "gtk_widget_set_sensitive"
- * the old state is kept around in this field. The state
- * will be restored once the widget gets sensitive again.
- */
- guint8 saved_state;
-
- /* The widgets name. If the widget does not have a name
- * (the name is NULL), then its name (as returned by
- * "gtk_widget_get_name") is its classes name.
- * Among other things, the widget name is used to determine
- * the style to use for a widget.
- */
- gchar *name;
-
- /* The style for the widget. The style contains the
- * colors the widget should be drawn in for each state
- * along with graphics contexts used to draw with and
- * the font to use for text.
- */
- GtkStyle *style;
-
- /* The widgets desired size.
- */
- GtkRequisition requisition;
-
- /* The widgets allocated size.
- */
- GtkAllocation allocation;
-
- /* The widgets window or its parent window if it does
- * not have a window. (Which will be indicated by the
- * GTK_NO_WINDOW flag being set).
- */
- GdkWindow *window;
-
- /* The widgets parent.
- */
- GtkWidget *parent;
-};
-
-struct _GtkWidgetClass
-{
- /* The object class structure needs to be the first
- * element in the widget class structure in order for
- * the class mechanism to work correctly. This allows a
- * GtkWidgetClass pointer to be cast to a GtkObjectClass
- * pointer.
- */
- GtkObjectClass parent_class;
-
- /* The signal to emit when an object of this class is activated.
- * This is used when activating the current focus widget and
- * the default widget.
- */
- guint activate_signal;
-
- /* basics */
- void (* show) (GtkWidget *widget);
- void (* hide) (GtkWidget *widget);
- void (* show_all) (GtkWidget *widget);
- void (* hide_all) (GtkWidget *widget);
- void (* map) (GtkWidget *widget);
- void (* unmap) (GtkWidget *widget);
- void (* realize) (GtkWidget *widget);
- void (* unrealize) (GtkWidget *widget);
- void (* draw) (GtkWidget *widget,
- GdkRectangle *area);
- void (* draw_focus) (GtkWidget *widget);
- void (* draw_default) (GtkWidget *widget);
- void (* size_request) (GtkWidget *widget,
- GtkRequisition *requisition);
- void (* size_allocate) (GtkWidget *widget,
- GtkAllocation *allocation);
- void (* state_changed) (GtkWidget *widget,
- guint previous_state);
- void (* parent_set) (GtkWidget *widget,
- GtkWidget *previous_parent);
- void (* style_set) (GtkWidget *widget,
- GtkStyle *previous_style);
-
- /* accelerators */
- gint (* install_accelerator) (GtkWidget *widget,
- const gchar *signal_name,
- gchar key,
- guint8 modifiers);
- void (* remove_accelerator) (GtkWidget *widget,
- const gchar *signal_name);
-
- /* events */
- gint (* event) (GtkWidget *widget,
- GdkEvent *event);
- gint (* button_press_event) (GtkWidget *widget,
- GdkEventButton *event);
- gint (* button_release_event) (GtkWidget *widget,
- GdkEventButton *event);
- gint (* motion_notify_event) (GtkWidget *widget,
- GdkEventMotion *event);
- gint (* delete_event) (GtkWidget *widget,
- GdkEventAny *event);
- gint (* destroy_event) (GtkWidget *widget,
- GdkEventAny *event);
- gint (* expose_event) (GtkWidget *widget,
- GdkEventExpose *event);
- gint (* key_press_event) (GtkWidget *widget,
- GdkEventKey *event);
- gint (* key_release_event) (GtkWidget *widget,
- GdkEventKey *event);
- gint (* enter_notify_event) (GtkWidget *widget,
- GdkEventCrossing *event);
- gint (* leave_notify_event) (GtkWidget *widget,
- GdkEventCrossing *event);
- gint (* configure_event) (GtkWidget *widget,
- GdkEventConfigure *event);
- gint (* focus_in_event) (GtkWidget *widget,
- GdkEventFocus *event);
- gint (* focus_out_event) (GtkWidget *widget,
- GdkEventFocus *event);
- gint (* map_event) (GtkWidget *widget,
- GdkEventAny *event);
- gint (* unmap_event) (GtkWidget *widget,
- GdkEventAny *event);
- gint (* property_notify_event) (GtkWidget *widget,
- GdkEventProperty *event);
- gint (* selection_clear_event) (GtkWidget *widget,
- GdkEventSelection *event);
- gint (* selection_request_event) (GtkWidget *widget,
- GdkEventSelection *event);
- gint (* selection_notify_event) (GtkWidget *widget,
- GdkEventSelection *event);
- gint (* proximity_in_event) (GtkWidget *widget,
- GdkEventProximity *event);
- gint (* proximity_out_event) (GtkWidget *widget,
- GdkEventProximity *event);
- gint (* drag_begin_event) (GtkWidget *widget,
- GdkEventDragBegin *event);
- gint (* drag_request_event) (GtkWidget *widget,
- GdkEventDragRequest *event);
- gint (* drag_end_event) (GtkWidget *widget,
- GdkEvent *event);
- gint (* drop_enter_event) (GtkWidget *widget,
- GdkEventDropEnter *event);
- gint (* drop_leave_event) (GtkWidget *widget,
- GdkEventDropLeave *event);
- gint (* drop_data_available_event) (GtkWidget *widget,
- GdkEventDropDataAvailable *event);
- gint (* other_event) (GtkWidget *widget,
- GdkEventOther *event);
-
- /* selection */
- void (* selection_received) (GtkWidget *widget,
- GtkSelectionData *selection_data);
-
- gint (* client_event) (GtkWidget *widget,
- GdkEventClient *event);
- gint (* no_expose_event) (GtkWidget *widget,
- GdkEventAny *event);
-};
-
-struct _GtkWidgetAuxInfo
-{
- gint16 x;
- gint16 y;
- guint16 width;
- guint16 height;
-};
-
-struct _GtkWidgetShapeInfo
-{
- gint16 offset_x;
- gint16 offset_y;
- GdkBitmap *shape_mask;
-};
-
-
-guint gtk_widget_get_type (void);
-GtkWidget* gtk_widget_new (guint type,
- ...);
-GtkWidget* gtk_widget_newv (guint type,
- guint nargs,
- GtkArg *args);
-void gtk_widget_ref (GtkWidget *widget);
-void gtk_widget_unref (GtkWidget *widget);
-void gtk_widget_destroy (GtkWidget *widget);
-void gtk_widget_destroyed (GtkWidget *widget,
- GtkWidget **widget_pointer);
-void gtk_widget_get (GtkWidget *widget,
- GtkArg *arg);
-void gtk_widget_getv (GtkWidget *widget,
- guint nargs,
- GtkArg *args);
-void gtk_widget_set (GtkWidget *widget,
- ...);
-void gtk_widget_setv (GtkWidget *widget,
- guint nargs,
- GtkArg *args);
-void gtk_widget_unparent (GtkWidget *widget);
-void gtk_widget_show (GtkWidget *widget);
-void gtk_widget_hide (GtkWidget *widget);
-void gtk_widget_show_all (GtkWidget *widget);
-void gtk_widget_hide_all (GtkWidget *widget);
-void gtk_widget_map (GtkWidget *widget);
-void gtk_widget_unmap (GtkWidget *widget);
-void gtk_widget_realize (GtkWidget *widget);
-void gtk_widget_unrealize (GtkWidget *widget);
-void gtk_widget_queue_draw (GtkWidget *widget);
-void gtk_widget_queue_resize (GtkWidget *widget);
-void gtk_widget_draw (GtkWidget *widget,
- GdkRectangle *area);
-void gtk_widget_draw_focus (GtkWidget *widget);
-void gtk_widget_draw_default (GtkWidget *widget);
-void gtk_widget_draw_children (GtkWidget *widget);
-void gtk_widget_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-void gtk_widget_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-void gtk_widget_install_accelerator (GtkWidget *widget,
- GtkAcceleratorTable *table,
- const gchar *signal_name,
- gchar key,
- guint8 modifiers);
-void gtk_widget_remove_accelerator (GtkWidget *widget,
- GtkAcceleratorTable *table,
- const gchar *signal_name);
-gint gtk_widget_event (GtkWidget *widget,
- GdkEvent *event);
-
-void gtk_widget_activate (GtkWidget *widget);
-void gtk_widget_reparent (GtkWidget *widget,
- GtkWidget *new_parent);
-void gtk_widget_popup (GtkWidget *widget,
- gint x,
- gint y);
-gint gtk_widget_intersect (GtkWidget *widget,
- GdkRectangle *area,
- GdkRectangle *intersection);
-gint gtk_widget_basic (GtkWidget *widget);
-
-void gtk_widget_grab_focus (GtkWidget *widget);
-void gtk_widget_grab_default (GtkWidget *widget);
-
-void gtk_widget_set_name (GtkWidget *widget,
- const gchar *name);
-gchar* gtk_widget_get_name (GtkWidget *widget);
-void gtk_widget_set_state (GtkWidget *widget,
- GtkStateType state);
-void gtk_widget_set_sensitive (GtkWidget *widget,
- gint sensitive);
-void gtk_widget_set_parent (GtkWidget *widget,
- GtkWidget *parent);
-void gtk_widget_set_parent_window (GtkWidget *widget,
- GdkWindow *parent_window);
-GdkWindow *gtk_widget_get_parent_window (GtkWidget *widget);
-void gtk_widget_set_uposition (GtkWidget *widget,
- gint x,
- gint y);
-void gtk_widget_set_usize (GtkWidget *widget,
- gint width,
- gint height);
-void gtk_widget_set_events (GtkWidget *widget,
- gint events);
-void gtk_widget_set_extension_events (GtkWidget *widget,
- GdkExtensionMode mode);
-
-GdkExtensionMode gtk_widget_get_extension_events (GtkWidget *widget);
-GtkWidget* gtk_widget_get_toplevel (GtkWidget *widget);
-GtkWidget* gtk_widget_get_ancestor (GtkWidget *widget,
- GtkType widget_type);
-GdkColormap* gtk_widget_get_colormap (GtkWidget *widget);
-GdkVisual* gtk_widget_get_visual (GtkWidget *widget);
-gint gtk_widget_get_events (GtkWidget *widget);
-void gtk_widget_get_pointer (GtkWidget *widget,
- gint *x,
- gint *y);
-
-gint gtk_widget_is_ancestor (GtkWidget *widget,
- GtkWidget *ancestor);
-gint gtk_widget_is_child (GtkWidget *widget,
- GtkWidget *child);
-
-/* Widget styles.
- */
-void gtk_widget_set_style (GtkWidget *widget,
- GtkStyle *style);
-void gtk_widget_set_rc_style (GtkWidget *widget);
-void gtk_widget_ensure_style (GtkWidget *widget);
-GtkStyle* gtk_widget_get_style (GtkWidget *widget);
-void gtk_widget_restore_default_style (GtkWidget *widget);
-
-/* Tell other Gtk applications to use the same default colors.
- */
-void gtk_widget_propagate_default_style (void);
-
-/* Push/pop pairs, to change default values upon a widget's creation.
- * This will override the values that got set by the
- * gtk_widget_set_default_* () functions.
- */
-void gtk_widget_push_style (GtkStyle *style);
-void gtk_widget_push_colormap (GdkColormap *cmap);
-void gtk_widget_push_visual (GdkVisual *visual);
-void gtk_widget_pop_style (void);
-void gtk_widget_pop_colormap (void);
-void gtk_widget_pop_visual (void);
-
-/* Set certain default values to be used at widget creation time.
- */
-void gtk_widget_set_default_style (GtkStyle *style);
-void gtk_widget_set_default_colormap (GdkColormap *colormap);
-void gtk_widget_set_default_visual (GdkVisual *visual);
-GtkStyle* gtk_widget_get_default_style (void);
-GdkColormap* gtk_widget_get_default_colormap (void);
-GdkVisual* gtk_widget_get_default_visual (void);
-
-/* Counterpart to gdk_window_shape_combine_mask.
- */
-void gtk_widget_shape_combine_mask (GtkWidget *widget,
- GdkBitmap *shape_mask,
- gint offset_x,
- gint offset_y);
-
-/* When you get a drag_enter event, you can use this to tell Gtk of other
- * items that are to be dragged as well...
- */
-void gtk_widget_dnd_drag_add (GtkWidget *widget);
-
-/* These two functions enable drag and/or drop on a widget,
- * and also let Gtk know what data types will be accepted (use MIME
- * type naming, plus tacking "URL:" on the front for link dragging)
- */
-void gtk_widget_dnd_drag_set (GtkWidget *widget,
- guint8 drag_enable,
- gchar **type_accept_list,
- guint numtypes);
-void gtk_widget_dnd_drop_set (GtkWidget *widget,
- guint8 drop_enable,
- gchar **type_accept_list,
- guint numtypes,
- guint8 is_destructive_operation);
-
-/* Used to reply to a DRAG_REQUEST event - if you don't want to
- * give the data then pass in NULL for it
- */
-void gtk_widget_dnd_data_set (GtkWidget *widget,
- GdkEvent *event,
- gpointer data,
- gulong data_numbytes);
-
-#if defined (GTK_TRACE_OBJECTS) && defined (__GNUC__)
-# define gtk_widget_ref gtk_object_ref
-# define gtk_widget_unref gtk_object_unref
-#endif /* GTK_TRACE_OBJECTS && __GNUC__ */
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_WIDGET_H__ */
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
deleted file mode 100644
index 6b87710d00..0000000000
--- a/gtk/gtkwindow.c
+++ /dev/null
@@ -1,1344 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <string.h>
-#include <limits.h>
-#include "gdk/gdk.h"
-#include "gdk/gdkkeysyms.h"
-#include "gdk/gdkx.h"
-#include "gtkprivate.h"
-#include "gtksignal.h"
-#include "gtkwindow.h"
-
-enum {
- MOVE_RESIZE,
- SET_FOCUS,
- LAST_SIGNAL
-};
-enum {
- ARG_0,
- ARG_TYPE,
- ARG_TITLE,
- ARG_AUTO_SHRINK,
- ARG_ALLOW_SHRINK,
- ARG_ALLOW_GROW,
- ARG_WIN_POS
-};
-
-typedef gint (*GtkWindowSignal1) (GtkObject *object,
- gpointer arg1,
- gpointer arg2,
- gint arg3,
- gint arg4,
- gpointer data);
-typedef void (*GtkWindowSignal2) (GtkObject *object,
- gpointer arg1,
- gpointer data);
-
-static void gtk_window_marshal_signal_1 (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-static void gtk_window_marshal_signal_2 (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-static void gtk_window_class_init (GtkWindowClass *klass);
-static void gtk_window_init (GtkWindow *window);
-static void gtk_window_set_arg (GtkWindow *window,
- GtkArg *arg,
- guint arg_id);
-static void gtk_window_get_arg (GtkWindow *window,
- GtkArg *arg,
- guint arg_id);
-static void gtk_window_destroy (GtkObject *object);
-static void gtk_window_finalize (GtkObject *object);
-static void gtk_window_show (GtkWidget *widget);
-static void gtk_window_hide (GtkWidget *widget);
-static void gtk_window_map (GtkWidget *widget);
-static void gtk_window_unmap (GtkWidget *widget);
-static void gtk_window_realize (GtkWidget *widget);
-static void gtk_window_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_window_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static gint gtk_window_expose_event (GtkWidget *widget,
- GdkEventExpose *event);
-static gint gtk_window_configure_event (GtkWidget *widget,
- GdkEventConfigure *event);
-static gint gtk_window_key_press_event (GtkWidget *widget,
- GdkEventKey *event);
-static gint gtk_window_key_release_event (GtkWidget *widget,
- GdkEventKey *event);
-static gint gtk_window_enter_notify_event (GtkWidget *widget,
- GdkEventCrossing *event);
-static gint gtk_window_leave_notify_event (GtkWidget *widget,
- GdkEventCrossing *event);
-static gint gtk_window_focus_in_event (GtkWidget *widget,
- GdkEventFocus *event);
-static gint gtk_window_focus_out_event (GtkWidget *widget,
- GdkEventFocus *event);
-static gint gtk_window_client_event (GtkWidget *widget,
- GdkEventClient *event);
-static gint gtk_window_need_resize (GtkContainer *container);
-static gint gtk_real_window_move_resize (GtkWindow *window,
- gint *x,
- gint *y,
- gint width,
- gint height);
-static void gtk_real_window_set_focus (GtkWindow *window,
- GtkWidget *focus);
-static gint gtk_window_move_resize (GtkWidget *widget);
-static void gtk_window_set_hints (GtkWidget *widget,
- GtkRequisition *requisition);
-static gint gtk_window_check_accelerator (GtkWindow *window,
- gint key,
- guint mods);
-
-
-static GtkBinClass *parent_class = NULL;
-static guint window_signals[LAST_SIGNAL] = { 0 };
-
-
-guint
-gtk_window_get_type ()
-{
- static guint window_type = 0;
-
- if (!window_type)
- {
- GtkTypeInfo window_info =
- {
- "GtkWindow",
- sizeof (GtkWindow),
- sizeof (GtkWindowClass),
- (GtkClassInitFunc) gtk_window_class_init,
- (GtkObjectInitFunc) gtk_window_init,
- (GtkArgSetFunc) gtk_window_set_arg,
- (GtkArgGetFunc) gtk_window_get_arg,
- };
-
- window_type = gtk_type_unique (gtk_bin_get_type (), &window_info);
- }
-
- return window_type;
-}
-
-static void
-gtk_window_class_init (GtkWindowClass *klass)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GtkObjectClass*) klass;
- widget_class = (GtkWidgetClass*) klass;
- container_class = (GtkContainerClass*) klass;
-
- parent_class = gtk_type_class (gtk_bin_get_type ());
-
- gtk_object_add_arg_type ("GtkWindow::type", GTK_TYPE_WINDOW_TYPE, GTK_ARG_READWRITE, ARG_TYPE);
- gtk_object_add_arg_type ("GtkWindow::title", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_TITLE);
- gtk_object_add_arg_type ("GtkWindow::auto_shrink", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_AUTO_SHRINK);
- gtk_object_add_arg_type ("GtkWindow::allow_shrink", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_ALLOW_SHRINK);
- gtk_object_add_arg_type ("GtkWindow::allow_grow", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_ALLOW_GROW);
- gtk_object_add_arg_type ("GtkWindow::window_position", GTK_TYPE_ENUM, GTK_ARG_READWRITE, ARG_WIN_POS);
-
- window_signals[MOVE_RESIZE] =
- gtk_signal_new ("move_resize",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWindowClass, move_resize),
- gtk_window_marshal_signal_1,
- GTK_TYPE_BOOL, 4,
- GTK_TYPE_POINTER, GTK_TYPE_POINTER,
- GTK_TYPE_INT, GTK_TYPE_INT);
-
- window_signals[SET_FOCUS] =
- gtk_signal_new ("set_focus",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkWindowClass, set_focus),
- gtk_window_marshal_signal_2,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_POINTER);
-
- gtk_object_class_add_signals (object_class, window_signals, LAST_SIGNAL);
-
- object_class->destroy = gtk_window_destroy;
- object_class->finalize = gtk_window_finalize;
-
- widget_class->show = gtk_window_show;
- widget_class->hide = gtk_window_hide;
- widget_class->map = gtk_window_map;
- widget_class->unmap = gtk_window_unmap;
- widget_class->realize = gtk_window_realize;
- widget_class->size_request = gtk_window_size_request;
- widget_class->size_allocate = gtk_window_size_allocate;
- widget_class->expose_event = gtk_window_expose_event;
- widget_class->configure_event = gtk_window_configure_event;
- widget_class->key_press_event = gtk_window_key_press_event;
- widget_class->key_release_event = gtk_window_key_release_event;
- widget_class->enter_notify_event = gtk_window_enter_notify_event;
- widget_class->leave_notify_event = gtk_window_leave_notify_event;
- widget_class->focus_in_event = gtk_window_focus_in_event;
- widget_class->focus_out_event = gtk_window_focus_out_event;
- widget_class->client_event = gtk_window_client_event;
-
- container_class->need_resize = gtk_window_need_resize;
-
- klass->move_resize = gtk_real_window_move_resize;
- klass->set_focus = gtk_real_window_set_focus;
-}
-
-static void
-gtk_window_init (GtkWindow *window)
-{
- GTK_WIDGET_UNSET_FLAGS (window, GTK_NO_WINDOW);
- GTK_WIDGET_SET_FLAGS (window, GTK_TOPLEVEL);
-
- window->title = NULL;
- window->wmclass_name = NULL;
- window->wmclass_class = NULL;
- window->type = GTK_WINDOW_TOPLEVEL;
- window->accelerator_tables = NULL;
- window->focus_widget = NULL;
- window->default_widget = NULL;
- window->resize_count = 0;
- window->need_resize = FALSE;
- window->allow_shrink = FALSE;
- window->allow_grow = TRUE;
- window->auto_shrink = FALSE;
- window->handling_resize = FALSE;
- window->position = GTK_WIN_POS_NONE;
- window->use_uposition = TRUE;
-
- gtk_container_register_toplevel (GTK_CONTAINER (window));
-}
-
-static void
-gtk_window_set_arg (GtkWindow *window,
- GtkArg *arg,
- guint arg_id)
-{
- switch (arg_id)
- {
- case ARG_TYPE:
- window->type = GTK_VALUE_ENUM (*arg);
- break;
- case ARG_TITLE:
- gtk_window_set_title (window, GTK_VALUE_STRING (*arg));
- break;
- case ARG_AUTO_SHRINK:
- window->auto_shrink = (GTK_VALUE_BOOL (*arg) != FALSE);
- break;
- case ARG_ALLOW_SHRINK:
- window->allow_shrink = (GTK_VALUE_BOOL (*arg) != FALSE);
- break;
- case ARG_ALLOW_GROW:
- window->allow_grow = (GTK_VALUE_BOOL (*arg) != FALSE);
- break;
- case ARG_WIN_POS:
- gtk_window_position (window, GTK_VALUE_ENUM (*arg));
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-gtk_window_get_arg (GtkWindow *window,
- GtkArg *arg,
- guint arg_id)
-{
- switch (arg_id)
- {
- case ARG_TYPE:
- GTK_VALUE_ENUM (*arg) = window->type;
- break;
- case ARG_TITLE:
- GTK_VALUE_STRING (*arg) = g_strdup (window->title);
- break;
- case ARG_AUTO_SHRINK:
- GTK_VALUE_BOOL (*arg) = window->auto_shrink;
- break;
- case ARG_ALLOW_SHRINK:
- GTK_VALUE_BOOL (*arg) = window->allow_shrink;
- break;
- case ARG_ALLOW_GROW:
- GTK_VALUE_BOOL (*arg) = window->allow_grow;
- break;
- case ARG_WIN_POS:
- GTK_VALUE_ENUM (*arg) = window->position;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-GtkWidget*
-gtk_window_new (GtkWindowType type)
-{
- GtkWindow *window;
-
- window = gtk_type_new (gtk_window_get_type ());
-
- window->type = type;
-
- return GTK_WIDGET (window);
-}
-
-void
-gtk_window_set_title (GtkWindow *window,
- const gchar *title)
-{
- g_return_if_fail (window != NULL);
- g_return_if_fail (GTK_IS_WINDOW (window));
-
- if (window->title)
- g_free (window->title);
- window->title = g_strdup (title);
-
- if (GTK_WIDGET_REALIZED (window))
- gdk_window_set_title (GTK_WIDGET (window)->window, window->title);
-}
-
-void
-gtk_window_set_wmclass (GtkWindow *window,
- gchar *wmclass_name,
- gchar *wmclass_class)
-{
- g_return_if_fail (window != NULL);
- g_return_if_fail (GTK_IS_WINDOW (window));
-
- g_free (window->wmclass_name);
- window->wmclass_name = g_strdup (wmclass_name);
-
- g_free (window->wmclass_class);
- window->wmclass_class = g_strdup (wmclass_class);
-
- if (GTK_WIDGET_REALIZED (window))
- g_warning ("shouldn't set wmclass after window is realized!\n");
-}
-
-void
-gtk_window_set_focus (GtkWindow *window,
- GtkWidget *focus)
-{
- gtk_signal_emit (GTK_OBJECT (window), window_signals[SET_FOCUS], focus);
-}
-
-void
-gtk_window_set_default (GtkWindow *window,
- GtkWidget *defaultw)
-{
- g_return_if_fail (window != NULL);
- g_return_if_fail (GTK_IS_WINDOW (window));
- g_return_if_fail (GTK_WIDGET_CAN_DEFAULT (defaultw));
-
- if (window->default_widget != defaultw)
- {
- if (window->default_widget)
- {
- GTK_WIDGET_UNSET_FLAGS (window->default_widget, GTK_HAS_DEFAULT);
- gtk_widget_draw_default (window->default_widget);
- }
-
- window->default_widget = defaultw;
-
- if (window->default_widget)
- {
- GTK_WIDGET_SET_FLAGS (window->default_widget, GTK_HAS_DEFAULT);
- gtk_widget_draw_default (window->default_widget);
- }
- }
-}
-
-void
-gtk_window_set_policy (GtkWindow *window,
- gint allow_shrink,
- gint allow_grow,
- gint auto_shrink)
-{
- g_return_if_fail (window != NULL);
- g_return_if_fail (GTK_IS_WINDOW (window));
-
- window->allow_shrink = (allow_shrink != FALSE);
- window->allow_grow = (allow_grow != FALSE);
- window->auto_shrink = (auto_shrink != FALSE);
-}
-
-void
-gtk_window_add_accelerator_table (GtkWindow *window,
- GtkAcceleratorTable *table)
-{
- g_return_if_fail (window != NULL);
- g_return_if_fail (GTK_IS_WINDOW (window));
-
- gtk_accelerator_table_ref (table);
- window->accelerator_tables = g_list_prepend (window->accelerator_tables,
- table);
-}
-
-void
-gtk_window_remove_accelerator_table (GtkWindow *window,
- GtkAcceleratorTable *table)
-{
- GList *list;
-
- g_return_if_fail (window != NULL);
- g_return_if_fail (GTK_IS_WINDOW (window));
-
- for (list = window->accelerator_tables; list; list = list->next)
- {
- if (list->data == table)
- {
- gtk_accelerator_table_unref (table);
- window->accelerator_tables = g_list_remove_link (window->accelerator_tables, list);
- g_list_free_1 (list);
- break;
- }
- }
-}
-
-void
-gtk_window_position (GtkWindow *window,
- GtkWindowPosition position)
-{
- g_return_if_fail (window != NULL);
- g_return_if_fail (GTK_IS_WINDOW (window));
-
- window->position = position;
-}
-
-gint
-gtk_window_activate_focus (GtkWindow *window)
-{
- g_return_val_if_fail (window != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
-
- if (window->focus_widget)
- {
- gtk_widget_activate (window->focus_widget);
- return TRUE;
- }
-
- return FALSE;
-}
-
-gint
-gtk_window_activate_default (GtkWindow *window)
-{
- g_return_val_if_fail (window != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
-
- if (window->default_widget)
- {
- gtk_widget_activate (window->default_widget);
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void
-gtk_window_marshal_signal_1 (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkWindowSignal1 rfunc;
- gint *return_val;
-
- rfunc = (GtkWindowSignal1) func;
- return_val = GTK_RETLOC_BOOL (args[4]);
-
- *return_val = (* rfunc) (object,
- GTK_VALUE_POINTER (args[0]),
- GTK_VALUE_POINTER (args[1]),
- GTK_VALUE_INT (args[2]),
- GTK_VALUE_INT (args[3]),
- func_data);
-}
-
-static void
-gtk_window_marshal_signal_2 (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkWindowSignal2 rfunc;
-
- rfunc = (GtkWindowSignal2) func;
-
- (* rfunc) (object, GTK_VALUE_POINTER (args[0]), func_data);
-}
-
-static void
-gtk_window_destroy (GtkObject *object)
-{
- GList *list;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_WINDOW (object));
-
- gtk_container_unregister_toplevel (GTK_CONTAINER (object));
-
- for (list = GTK_WINDOW (object)->accelerator_tables; list; list = list->next)
- gtk_accelerator_table_unref (list->data);
- g_list_free (GTK_WINDOW (object)->accelerator_tables);
- GTK_WINDOW (object)->accelerator_tables = NULL;
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-static void
-gtk_window_finalize (GtkObject *object)
-{
- GtkWindow *window;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GTK_IS_WINDOW (object));
-
- window = GTK_WINDOW (object);
- g_free (window->title);
- g_free (window->wmclass_name);
- g_free (window->wmclass_class);
-
- GTK_OBJECT_CLASS(parent_class)->finalize (object);
-}
-
-static void
-gtk_window_show (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_WINDOW (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
- gtk_container_need_resize (GTK_CONTAINER (widget));
- gtk_widget_map (widget);
-}
-
-static void
-gtk_window_hide (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_WINDOW (widget));
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_VISIBLE);
- gtk_widget_unmap (widget);
-}
-
-static void
-gtk_window_map (GtkWidget *widget)
-{
- GtkWindow *window;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_WINDOW (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
-
- gtk_window_move_resize (widget);
- window = GTK_WINDOW (widget);
-
- if (window->bin.child &&
- GTK_WIDGET_VISIBLE (window->bin.child) &&
- !GTK_WIDGET_MAPPED (window->bin.child))
- gtk_widget_map (window->bin.child);
-
- gtk_window_set_hints (widget, &widget->requisition);
- gdk_window_show (widget->window);
-}
-
-static void
-gtk_window_unmap (GtkWidget *widget)
-{
- GtkWindow *window;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_WINDOW (widget));
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
- gdk_window_hide (widget->window);
-
- window = GTK_WINDOW (widget);
- window->use_uposition = TRUE;
-}
-
-static void
-gtk_window_realize (GtkWidget *widget)
-{
- GtkWindow *window;
- GdkWindowAttr attributes;
- gint attributes_mask;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_WINDOW (widget));
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
- window = GTK_WINDOW (widget);
-
- switch (window->type)
- {
- case GTK_WINDOW_TOPLEVEL:
- attributes.window_type = GDK_WINDOW_TOPLEVEL;
- break;
- case GTK_WINDOW_DIALOG:
- attributes.window_type = GDK_WINDOW_DIALOG;
- break;
- case GTK_WINDOW_POPUP:
- attributes.window_type = GDK_WINDOW_TEMP;
- break;
- }
-
- attributes.title = window->title;
- attributes.wmclass_name = window->wmclass_name;
- attributes.wmclass_class = window->wmclass_class;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget);
- attributes.event_mask |= (GDK_EXPOSURE_MASK |
- GDK_KEY_PRESS_MASK |
- GDK_ENTER_NOTIFY_MASK |
- GDK_LEAVE_NOTIFY_MASK |
- GDK_FOCUS_CHANGE_MASK |
- GDK_STRUCTURE_MASK);
-
- attributes_mask = GDK_WA_VISUAL | GDK_WA_COLORMAP;
- attributes_mask |= (window->title ? GDK_WA_TITLE : 0);
- attributes_mask |= (window->wmclass_name ? GDK_WA_WMCLASS : 0);
-
- widget->window = gdk_window_new (NULL, &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, window);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
-}
-
-static void
-gtk_window_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkWindow *window;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_WINDOW (widget));
- g_return_if_fail (requisition != NULL);
-
- window = GTK_WINDOW (widget);
-
- if (window->bin.child)
- {
- requisition->width = GTK_CONTAINER (window)->border_width * 2;
- requisition->height = GTK_CONTAINER (window)->border_width * 2;
-
- gtk_widget_size_request (window->bin.child, &window->bin.child->requisition);
-
- requisition->width += window->bin.child->requisition.width;
- requisition->height += window->bin.child->requisition.height;
- }
- else
- {
- if (!GTK_WIDGET_VISIBLE (window))
- window->need_resize = TRUE;
- }
-}
-
-static void
-gtk_window_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- GtkWindow *window;
- GtkAllocation child_allocation;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_WINDOW (widget));
- g_return_if_fail (allocation != NULL);
-
- window = GTK_WINDOW (widget);
- widget->allocation = *allocation;
-
- if (window->bin.child && GTK_WIDGET_VISIBLE (window->bin.child))
- {
- child_allocation.x = GTK_CONTAINER (window)->border_width;
- child_allocation.y = GTK_CONTAINER (window)->border_width;
- child_allocation.width = allocation->width - child_allocation.x * 2;
- child_allocation.height = allocation->height - child_allocation.y * 2;
-
- gtk_widget_size_allocate (window->bin.child, &child_allocation);
- }
-}
-
-static gint
-gtk_window_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_WINDOW (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget))
- if (GTK_WIDGET_CLASS (parent_class)->expose_event)
- return (* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
-
- return FALSE;
-}
-
-static gint
-gtk_window_configure_event (GtkWidget *widget,
- GdkEventConfigure *event)
-{
- GtkWindow *window;
- GtkAllocation allocation;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_WINDOW (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- /* If the window was merely moved, do nothing */
- if ((widget->allocation.width == event->width) &&
- (widget->allocation.height == event->height))
- return FALSE;
-
- window = GTK_WINDOW (widget);
- window->handling_resize = TRUE;
-
- allocation.x = 0;
- allocation.y = 0;
- allocation.width = event->width;
- allocation.height = event->height;
-
- gtk_widget_size_allocate (widget, &allocation);
-
- if (window->bin.child &&
- GTK_WIDGET_VISIBLE (window->bin.child) &&
- !GTK_WIDGET_MAPPED (window->bin.child))
- gtk_widget_map (window->bin.child);
-
- if (window->resize_count > 0)
- {
- window->resize_count -= 1;
-
- if ((window->resize_count == 0) &&
- ((event->width != widget->requisition.width) ||
- (event->height != widget->requisition.height)))
- {
- window->resize_count = 1;
- gdk_window_resize (widget->window,
- widget->requisition.width,
- widget->requisition.height);
- }
- }
-
- window->handling_resize = FALSE;
-
- return FALSE;
-}
-
-static gint
-gtk_window_key_press_event (GtkWidget *widget,
- GdkEventKey *event)
-{
- GtkWindow *window;
- GtkDirectionType direction = 0;
- gint return_val;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_WINDOW (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- window = GTK_WINDOW (widget);
-
- return_val = FALSE;
- if (window->focus_widget)
- return_val = gtk_widget_event (window->focus_widget, (GdkEvent*) event);
-
- if (!return_val && gtk_window_check_accelerator (window, event->keyval, event->state))
- return_val = TRUE;
-
- if (!return_val)
- {
- switch (event->keyval)
- {
- case GDK_space:
- if (window->focus_widget)
- {
- gtk_widget_activate (window->focus_widget);
- return_val = TRUE;
- }
- break;
- case GDK_Return:
- case GDK_KP_Enter:
- if (window->default_widget)
- {
- gtk_widget_activate (window->default_widget);
- return_val = TRUE;
- }
- else if (window->focus_widget)
- {
- gtk_widget_activate (window->focus_widget);
- return_val = TRUE;
- }
- break;
- case GDK_Up:
- case GDK_Down:
- case GDK_Left:
- case GDK_Right:
- case GDK_Tab:
- case GDK_ISO_Left_Tab:
- switch (event->keyval)
- {
- case GDK_Up:
- direction = GTK_DIR_UP;
- break;
- case GDK_Down:
- direction = GTK_DIR_DOWN;
- break;
- case GDK_Left:
- direction = GTK_DIR_LEFT;
- break;
- case GDK_Right:
- direction = GTK_DIR_RIGHT;
- break;
- case GDK_Tab:
- case GDK_ISO_Left_Tab:
- if (event->state & GDK_SHIFT_MASK)
- direction = GTK_DIR_TAB_BACKWARD;
- else
- direction = GTK_DIR_TAB_FORWARD;
- break;
- default :
- direction = GTK_DIR_UP; /* never reached, but makes compiler happy */
- }
-
- gtk_container_focus (GTK_CONTAINER (widget), direction);
-
- if (!GTK_CONTAINER (window)->focus_child)
- gtk_window_set_focus (GTK_WINDOW (widget), NULL);
- else
- return_val = TRUE;
- break;
- }
- }
-
- return return_val;
-}
-
-static gint
-gtk_window_key_release_event (GtkWidget *widget,
- GdkEventKey *event)
-{
- GtkWindow *window;
- gint return_val;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_WINDOW (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- window = GTK_WINDOW (widget);
- return_val = FALSE;
- if (window->focus_widget)
- return_val = gtk_widget_event (window->focus_widget, (GdkEvent*) event);
-
- return return_val;
-}
-
-static gint
-gtk_window_enter_notify_event (GtkWidget *widget,
- GdkEventCrossing *event)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_WINDOW (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- return FALSE;
-}
-
-static gint
-gtk_window_leave_notify_event (GtkWidget *widget,
- GdkEventCrossing *event)
-{
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_WINDOW (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- return FALSE;
-}
-
-static gint
-gtk_window_focus_in_event (GtkWidget *widget,
- GdkEventFocus *event)
-{
- GtkWindow *window;
- GdkEventFocus fevent;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_WINDOW (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- /* It appears spurious focus in events can occur when
- * the window is hidden. So we'll just check to see if
- * the window is visible before actually handling the
- * event
- */
- if (GTK_WIDGET_VISIBLE (widget))
- {
- window = GTK_WINDOW (widget);
- if (window->focus_widget && !GTK_WIDGET_HAS_FOCUS (window->focus_widget))
- {
- fevent.type = GDK_FOCUS_CHANGE;
- fevent.window = window->focus_widget->window;
- fevent.in = TRUE;
-
- gtk_widget_event (window->focus_widget, (GdkEvent*) &fevent);
- }
- }
-
- return FALSE;
-}
-
-static gint
-gtk_window_focus_out_event (GtkWidget *widget,
- GdkEventFocus *event)
-{
- GtkWindow *window;
- GdkEventFocus fevent;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_WINDOW (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- window = GTK_WINDOW (widget);
- if (window->focus_widget && GTK_WIDGET_HAS_FOCUS (window->focus_widget))
- {
- fevent.type = GDK_FOCUS_CHANGE;
- fevent.window = window->focus_widget->window;
- fevent.in = FALSE;
-
- gtk_widget_event (window->focus_widget, (GdkEvent*) &fevent);
- }
-
- return FALSE;
-}
-
-static void
-gtk_window_style_set_event (GtkWidget *widget,
- GdkEventClient *event)
-{
- GdkAtom atom_default_colors;
- GtkStyle *style_newdefault;
- GdkAtom realtype;
- gint retfmt, retlen;
- GdkColor *data, *stylecolors;
- int i = 0;
- GdkColormap *widget_cmap;
-
- atom_default_colors = gdk_atom_intern("_GTK_DEFAULT_COLORS", FALSE);
-
- if(gdk_property_get (GDK_ROOT_PARENT(),
- atom_default_colors,
- gdk_atom_intern("STRING", FALSE),
- 0,
- sizeof(GdkColor) * GTK_STYLE_NUM_STYLECOLORS(),
- FALSE,
- &realtype,
- &retfmt,
- &retlen,
- (guchar **)&data) != TRUE) {
- g_warning("gdk_property_get() failed in _GTK_STYLE_CHANGED handler\n");
- return;
- }
- if(retfmt != sizeof(gushort)*8) {
- g_warning("retfmt (%d) != sizeof(gushort)*8 (%d)\n", retfmt,
- sizeof(gushort)*8);
- return;
- }
- /* We have the color data, now let's interpret it */
- style_newdefault = gtk_widget_get_default_style();
- gtk_style_ref(style_newdefault);
- stylecolors = (GdkColor *) style_newdefault;
-
- widget_cmap = gtk_widget_get_colormap(widget);
- for(i = 0; i < GTK_STYLE_NUM_STYLECOLORS(); i++) {
- stylecolors[i] = data[i];
- gdk_color_alloc(widget_cmap, &stylecolors[i]);
- }
-
- gtk_widget_set_default_style(style_newdefault);
- gtk_style_unref(style_newdefault);
-
- /* Now we need to redraw everything */
- gtk_widget_draw(widget, NULL);
- gtk_widget_draw_children(widget);
-}
-
-static gint
-gtk_window_client_event (GtkWidget *widget,
- GdkEventClient *event)
-{
- GdkAtom atom_styleset;
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_WINDOW (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- atom_styleset = gdk_atom_intern("_GTK_STYLE_CHANGED", FALSE);
-
- if(event->message_type == atom_styleset) {
- gtk_window_style_set_event(widget, event);
- }
- return FALSE;
-}
-
-static gint
-gtk_window_need_resize (GtkContainer *container)
-{
- GtkWindow *window;
- gint return_val;
-
- g_return_val_if_fail (container != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_WINDOW (container), FALSE);
-
- return_val = FALSE;
-
- window = GTK_WINDOW (container);
- if (window->handling_resize)
- return return_val;
-
- if (GTK_WIDGET_VISIBLE (container))
- {
- window->need_resize = TRUE;
- return_val = gtk_window_move_resize (GTK_WIDGET (window));
- window->need_resize = FALSE;
- }
-
- return return_val;
-}
-
-static gint
-gtk_real_window_move_resize (GtkWindow *window,
- gint *x,
- gint *y,
- gint width,
- gint height)
-{
- GtkWidget *widget;
-
- g_return_val_if_fail (window != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
- g_return_val_if_fail ((x != NULL) || (y != NULL), FALSE);
-
- widget = GTK_WIDGET (window);
-
- if ((*x != -1) && (*y != -1))
- gdk_window_move (widget->window, *x, *y);
-
- if ((widget->requisition.width == 0) ||
- (widget->requisition.height == 0))
- {
- widget->requisition.width = 200;
- widget->requisition.height = 200;
- }
-
- gdk_window_get_geometry (widget->window, NULL, NULL, &width, &height, NULL);
-
- if ((window->auto_shrink &&
- ((width != widget->requisition.width) ||
- (height != widget->requisition.height))) ||
- (width < widget->requisition.width) ||
- (height < widget->requisition.height))
- {
- if (window->resize_count == 0)
- {
- window->resize_count = 1;
- gdk_window_resize (widget->window,
- widget->requisition.width,
- widget->requisition.height);
- }
- }
- else
- {
- /* The window hasn't changed size but one of its children
- * queued a resize request. Which means that the allocation
- * is not sufficient for the requisition of some child.
- * We've already performed a size request at this point,
- * so we simply need to run through the list of resize
- * widgets and reallocate their sizes appropriately. We
- * make the optimization of not performing reallocation
- * for a widget who also has a parent in the resize widgets
- * list. GTK_RESIZE_NEEDED is used for flagging those
- * parents inside this function.
- */
- GSList *resize_widgets;
- GSList *resize_containers;
- GSList *node;
-
- resize_widgets = GTK_CONTAINER (window)->resize_widgets;
- GTK_CONTAINER (window)->resize_widgets = NULL;
-
- for (node = resize_widgets; node; node = node->next)
- {
- widget = node->data;
-
- GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED);
-
- while (widget && widget->parent &&
- ((widget->allocation.width < widget->requisition.width) ||
- (widget->allocation.height < widget->requisition.height)))
- widget = widget->parent;
-
- GTK_PRIVATE_SET_FLAG (widget, GTK_RESIZE_NEEDED);
- node->data = widget;
- }
-
- resize_containers = NULL;
-
- for (node = resize_widgets; node; node = node->next)
- {
- GtkWidget *resize_container;
-
- widget = node->data;
-
- if (!GTK_WIDGET_RESIZE_NEEDED (widget))
- continue;
-
- resize_container = widget->parent;
-
- if (resize_container)
- {
- GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED);
- widget = resize_container->parent;
-
- while (widget)
- {
- if (GTK_WIDGET_RESIZE_NEEDED (widget))
- {
- GTK_PRIVATE_UNSET_FLAG (resize_container, GTK_RESIZE_NEEDED);
- resize_container = widget;
- }
- widget = widget->parent;
- }
- }
- else
- resize_container = widget;
-
- if (!g_slist_find (resize_containers, resize_container))
- resize_containers = g_slist_prepend (resize_containers,
- resize_container);
- }
- g_slist_free (resize_widgets);
-
- for (node = resize_containers; node; node = node->next)
- {
- widget = node->data;
-
- GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED);
- gtk_widget_size_allocate (widget, &widget->allocation);
- gtk_widget_queue_draw (widget);
- }
- g_slist_free (resize_containers);
- }
-
- return FALSE;
-}
-
-static gint
-gtk_window_move_resize (GtkWidget *widget)
-{
- GtkWindow *window;
- gint x, y;
- gint width, height;
- gint screen_width;
- gint screen_height;
- gint return_val;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_WINDOW (widget), FALSE);
-
- return_val = FALSE;
-
- if (GTK_WIDGET_REALIZED (widget))
- {
- window = GTK_WINDOW (widget);
-
- /* Remember old size, to know if we have to reset hints */
- width = widget->requisition.width;
- height = widget->requisition.height;
- gtk_widget_size_request (widget, &widget->requisition);
-
- if (GTK_WIDGET_MAPPED (widget) &&
- (width != widget->requisition.width ||
- height != widget->requisition.height))
- gtk_window_set_hints (widget, &widget->requisition);
-
- x = -1;
- y = -1;
- width = widget->requisition.width;
- height = widget->requisition.height;
-
- if (window->use_uposition)
- switch (window->position)
- {
- case GTK_WIN_POS_CENTER:
- x = (gdk_screen_width () - width) / 2;
- y = (gdk_screen_height () - height) / 2;
- gtk_widget_set_uposition (widget, x, y);
- break;
- case GTK_WIN_POS_MOUSE:
- gdk_window_get_pointer (NULL, &x, &y, NULL);
-
- x -= width / 2;
- y -= height / 2;
-
- screen_width = gdk_screen_width ();
- screen_height = gdk_screen_height ();
-
- if (x < 0)
- x = 0;
- else if (x > (screen_width - width))
- x = screen_width - width;
-
- if (y < 0)
- y = 0;
- else if (y > (screen_height - height))
- y = screen_height - height;
-
- gtk_widget_set_uposition (widget, x, y);
- break;
- }
-
- gtk_signal_emit (GTK_OBJECT (widget), window_signals[MOVE_RESIZE],
- &x, &y, width, height, &return_val);
- }
-
- return return_val;
-}
-
-static void
-gtk_real_window_set_focus (GtkWindow *window,
- GtkWidget *focus)
-{
- GdkEventFocus event;
-
- g_return_if_fail (window != NULL);
- g_return_if_fail (GTK_IS_WINDOW (window));
-
- if (focus && !GTK_WIDGET_CAN_FOCUS (focus))
- return;
-
- if (window->focus_widget != focus)
- {
- if (window->focus_widget)
- {
- event.type = GDK_FOCUS_CHANGE;
- event.window = window->focus_widget->window;
- event.in = FALSE;
-
- gtk_widget_event (window->focus_widget, (GdkEvent*) &event);
- }
-
- window->focus_widget = focus;
-
- if (window->focus_widget)
- {
- event.type = GDK_FOCUS_CHANGE;
- event.window = window->focus_widget->window;
- event.in = TRUE;
-
- gtk_widget_event (window->focus_widget, (GdkEvent*) &event);
- }
- }
-}
-
-static void
-gtk_window_set_hints (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkWindow *window;
- GtkWidgetAuxInfo *aux_info;
- gint flags;
- gint ux, uy;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_WINDOW (widget));
- g_return_if_fail (requisition != NULL);
-
- if (GTK_WIDGET_REALIZED (widget))
- {
- window = GTK_WINDOW (widget);
-
- flags = 0;
- ux = 0;
- uy = 0;
-
- aux_info = gtk_object_get_data (GTK_OBJECT (widget), "gtk-aux-info");
- if (aux_info && (aux_info->x != -1) && (aux_info->y != -1))
- {
- ux = aux_info->x;
- uy = aux_info->y;
- flags |= GDK_HINT_POS;
- }
- if (!window->allow_shrink)
- flags |= GDK_HINT_MIN_SIZE;
- if (!window->allow_grow)
- flags |= GDK_HINT_MAX_SIZE;
-
- gdk_window_set_hints (widget->window, ux, uy,
- requisition->width, requisition->height,
- requisition->width, requisition->height,
- flags);
-
- if (window->use_uposition && (flags & GDK_HINT_POS))
- {
- window->use_uposition = FALSE;
- gdk_window_move (widget->window, ux, uy);
- }
- }
-}
-
-static gint
-gtk_window_check_accelerator (GtkWindow *window,
- gint key,
- guint mods)
-{
- GtkAcceleratorTable *table;
- GList *tmp;
-
- if ((key >= 0x20) && (key <= 0xFF))
- {
- tmp = window->accelerator_tables;
- while (tmp)
- {
- table = tmp->data;
- tmp = tmp->next;
-
- if (gtk_accelerator_table_check (table, key, mods))
- return TRUE;
- }
-
- if (gtk_accelerator_table_check (NULL, key, mods))
- return TRUE;
- }
-
- return FALSE;
-}
diff --git a/gtk/gtkwindow.h b/gtk/gtkwindow.h
deleted file mode 100644
index f1fc2ca1cb..0000000000
--- a/gtk/gtkwindow.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef __GTK_WINDOW_H__
-#define __GTK_WINDOW_H__
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkaccelerator.h>
-#include <gtk/gtkbin.h>
-#include <gtk/gtkenums.h>
-#include <gtk/gtkwidget.h>
-
-
-#define GTK_WINDOW(obj) GTK_CHECK_CAST (obj, gtk_window_get_type (), GtkWindow)
-#define GTK_WINDOW_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_window_get_type (), GtkWindowClass)
-#define GTK_IS_WINDOW(obj) GTK_CHECK_TYPE (obj, gtk_window_get_type ())
-
-
-typedef struct _GtkWindow GtkWindow;
-typedef struct _GtkWindowClass GtkWindowClass;
-
-struct _GtkWindow
-{
- GtkBin bin;
-
- gchar *title;
- gchar *wmclass_name;
- gchar *wmclass_class;
- GtkWindowType type;
- GList *accelerator_tables;
-
- GtkWidget *focus_widget;
- GtkWidget *default_widget;
-
- gushort resize_count;
- guint need_resize : 1;
- guint allow_shrink : 1;
- guint allow_grow : 1;
- guint auto_shrink : 1;
- guint handling_resize : 1;
- guint position : 2;
- guint use_uposition : 1;
-};
-
-struct _GtkWindowClass
-{
- GtkBinClass parent_class;
-
- gint (* move_resize) (GtkWindow *window,
- gint *x,
- gint *y,
- gint width,
- gint height);
- void (* set_focus) (GtkWindow *window,
- GtkWidget *focus);
-};
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-guint gtk_window_get_type (void);
-GtkWidget* gtk_window_new (GtkWindowType type);
-void gtk_window_set_title (GtkWindow *window,
- const gchar *title);
-void gtk_window_set_wmclass (GtkWindow *window,
- gchar *wmclass_name,
- gchar *wmclass_class);
-void gtk_window_set_focus (GtkWindow *window,
- GtkWidget *focus);
-void gtk_window_set_default (GtkWindow *window,
- GtkWidget *defaultw);
-void gtk_window_set_policy (GtkWindow *window,
- gint allow_shrink,
- gint allow_grow,
- gint auto_shrink);
-void gtk_window_add_accelerator_table (GtkWindow *window,
- GtkAcceleratorTable *table);
-void gtk_window_remove_accelerator_table (GtkWindow *window,
- GtkAcceleratorTable *table);
-void gtk_window_position (GtkWindow *window,
- GtkWindowPosition position);
-gint gtk_window_activate_focus (GtkWindow *window);
-gint gtk_window_activate_default (GtkWindow *window);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GTK_WINDOW_H__ */
diff --git a/gtk/line-arrow.xbm b/gtk/line-arrow.xbm
deleted file mode 100644
index 493ecf325d..0000000000
--- a/gtk/line-arrow.xbm
+++ /dev/null
@@ -1,4 +0,0 @@
-#define line_arrow_width 6
-#define line_arrow_height 9
-static unsigned char line_arrow_bits[] = {
- 0x00, 0x00, 0x04, 0x0c, 0x18, 0x3f, 0x18, 0x0c, 0x04};
diff --git a/gtk/line-wrap.xbm b/gtk/line-wrap.xbm
deleted file mode 100644
index 82428037d9..0000000000
--- a/gtk/line-wrap.xbm
+++ /dev/null
@@ -1,4 +0,0 @@
-#define line_wrap_width 6
-#define line_wrap_height 9
-static unsigned char line_wrap_bits[] = {
- 0x1e, 0x3e, 0x30, 0x30, 0x39, 0x1f, 0x0f, 0x0f, 0x1f, };
diff --git a/gtk/marble.xpm b/gtk/marble.xpm
deleted file mode 100644
index 1ef2607610..0000000000
--- a/gtk/marble.xpm
+++ /dev/null
@@ -1,408 +0,0 @@
-/* XPM */
-static char *granite07[] = {
-/* width height num_colors chars_per_pixel */
-" 384 384 16 1",
-/* colors */
-". c #000000",
-"# c #111111",
-"a c #222222",
-"b c #333333",
-"c c #444444",
-"d c #555555",
-"e c #666666",
-"f c #777777",
-"g c #888888",
-"h c #999999",
-"i c #aaaaaa",
-"j c #bbbbbb",
-"k c #cccccc",
-"l c #dddddd",
-"m c #eeeeee",
-"n c #ffffff",
-/* pixels */
-"aacfedbbcbbaaaaaaaaabaabaaaaabcbcbbbabbchfdcccbbabbbaaabaabcbaa#aa#######a#aaaabcddeefhec##dgbabbaaadabbcfbaa##########aaabbaaa#a#####a#aa###a#aaabbbbcbbbccdedaaaaa#aaaaa#a#abaaabbabbbeddbbaaaaaca##a#aaaba########aaaadcababbabdehd.##.a######.cgdcb###b##.##.##aaaaa####abcba######a##aac#a##a####aa#aa##babbbcfccbbbcdccccecbbbcbbbcdccddcbcdfeecbhhjihhgffc.aaa####.#######aaaaaaaabbaaaaa",
-"aaacedccbbcbaaaaaa#bbaabbbaaaabcaabbbbbbafhfccbbbbbbabacbacbaaaaa##########a###abbcdeghhhcagb#ababaaccbacdfca#a####aa###aaaaabaaa#####aca#aabaababbcccccccbcdfdaaaa###aaaaaaaaaaabbbbbbccccccbbcbcaaa##aaaaabaaaa###abdaccceebaaaabehja####a######..#aeec#bb##########aa#####abba#########aaca########aa#aa###aaaabddbbbbbbbbbbccbbabbbbabbabbabcbcbcefhfeddccefhhijheecb#...a####aaaaaaaabaaaaa",
-"aaabccccccdbabcbaaa#aaaaaaaaaaabbabbbbbccabefdccabcbbabacccbaaabaa######a######aaabceiiiihije#bbabbaaeaabcedcaabaa########aaaabaa##a###ab#aabcababbccccccdeeeecc#a##a##aaaaaaaaaabbbbbbbcccbbbdcbbcdaa#a#aabbaaaaa###acbaa#bccaa#abcfig.#######.#######acddgefdda#######a########a#######aaaaaa#a######aaaa#####aaacdcbabbaaabbbcaaaaaaaaabbbaaabbaabbbcbcbabbabcdeefghjkjgc#..####aaaaaaaaaaaa#",
-"#aaaaaacbccbcabbbaaaaaabcaaaaabbbbbbabbbcbaabffccbccbccbbcbaaaabaaaa#aa#aa##a#aaaaabbikkjhijicabbbcc#faaacdebcbda#########aaaaaaaaa####aa##cacccabcccdccccdddfdcbaa##a##abbbabccbbcbbbccccaaa#abbaaba#a##abbbbbaaaaaaaaaaccaaca##aabcfic.###aa#######a####bddeeddb####.##.###aaa#########aaaa###aa####aaaa#######aabdbbbbcabbbaaaa#aaaaaaaaabaaabbbaabbbbdbbaaabccccccdcefhhkhda##aaaa#a#aaaaa##",
-"#aaabaabcecbaa##bcaaaaaaaababbabaaabbabbaabb#chhfdccccbcbecaaabaaaaaaaaaa####aaaaaaabdgjkkijijdabbdcabfaabcecbbec###########a#aaaabaa#######abbaaaadddedddeeefeccaa###a#aabcccdcbcbbbbccbbbbaaaaa#aabbaaaabbbbbbaaaaaaabbbbbaaa####acegha##a#aabbb####a##adccdedbcc#######.###a###a#######aaa#a#aa##..#aa#########abdbaabbabbbaa###aaaaaaaaaaaaacbaaababbdbabbabcbbcbcbccbbdegjkgb#aa#aa#aaaaaaa",
-"##aa#aabccccaaaaaaaa#aaaaaabbaabbbaaaaabbbcbbcfhhgfcccbbbbccbaabbaaaaaaabaa#aaaabaaaabbcehkljjdabacccbgbaaccdb#adea#########aa#abaaaaa#####ac#ba##accdedddefffeaba##a#aaaaacccccccbbbcccaabaaaaaaaaa#aaaaabcbbaaa#bbbbaaefccdbaaa#aaacdei##aa##aabbbaaa#a#cdcccccbcea.#########bbaaa######a###a#aaaa.#aaba####.###abcbaaabaabbbaa###aaaaaaaaaaaabbaaaaaaaaaaababcbbcbbaabbbdddeghheba##ab#abaa##",
-"#####bbaaaaabaaaaa##aa#adccaabaaabbbbabbabbbabccbccfdbccbbbbbcaabcaabaaabbaaaaaaaaaaaabbbcglli#accbbbddgabcddbbaacea#a##########aaa#aaa##aaaa####aabcddeeefffgdbbaaaa###baabbbbbbcdabdcbcaaabaaaaaaa#aaaaaabcbbbbadfbbbaejhhebbccaaaaaccfi.aba##abaaaba####ecbbccba#fc.####.##.bba#a#######aaaaaaaaaaa##aaaa######abcdaa#aaaabaaa###aaaaabaaabbbaaba##aaababcbbcbbbbbcbaaabbccccddgggeb#aadca###",
-"#####bcaaaaaabcbaaa#aaaabcccaaaaaaabaaabbbbbbbaacbabeeddddccbcbbcccbabaaaabaabaaaaaaaaabbbbglmdbcbaabebdgdbcecbbaabdbaa#########aabbaaaa#aa#a##a#aabbdceeedccdcbbaaaaa##aaabbcbbbabaaabbababbaaaa#aaaaaaaabcdccbbbabcbbbcfijfbcdcabb#abcbif#abb##aaabaaaa##fcccbbcaa#db#..##.##.aaa#########ab#aaaaaa#aabaaaaa#####abdbbaaaabbaaaa###b#a#aaaabaaaaaaaaaaaaaabbabbbbaabbbaaaabbbbbbbceffecccbaa##",
-"#####abaaaaa#accbbbbaaabaaaaaaaaaaadcbaabbabbbabbdcaacgfddddcdddcadfcaaaabcbbabaaaaaabcabbbdjliacbababcbdfcdeeaaaaaabba########a##aa#aabaa##a######abddeggca#bcbaaaaaa####aaaaaabbbbbcbbbbbaaa##a#aaaaaaaabcbccbbaaaabaabfgfiecccccbbaaaccicbbbcbaaabaaabb#ceccccdca##aacdb######aaa###a###aabaaaaaa#aabca#abba#####abca##aaaaaaaaa##a##aaaaaaabaaaaaaabaaaacbcbacdbaaabaaaaaabaaaaabbcddccbaa##",
-"####aa#aaaaaaabccbabbaaaaaaaaaaaaabfaaabbcbbbbbabdebaabdffddedefedccecccdcbbbbbccbccbbbbbbccekldaabaaabccbfaaaaaaaaaaaba########aaaaaaaaba##aaa###aabbccfgfaababbbaaaaa#aabbaabaaccaabcccbcbaa##aaaaaabaabbbccbbbaabbbbbbdddghdbbbcccb#abcdebcccbaabbbabbcbaecddddbaa##.#acdeca#######a#aaaaaaaaaaaaaaabba##abba####aacba##aaaaaaaaaaaaa##aba#abaaaaaaabaaaabbbbbbcbabbaabbaaaaabaaaaaaaaccbaa##",
-".####aa#aabaa##bccbaabbbba#aaaaabbaefdaabbbbccbbbaddaaabadeeffhhhffdedddeecbbbbcccbbabcbabbcfjjlkeaaaaacdadcaa#aaaaaaa#ab######ba#aaabbabcaa#aa###babcddcedba##acbaaaaaa#ababbbacbbbcccdfffbaa#aaaacbaabcbabccbbcbbbbbbcbbccedbbbccdccbaabcgb#bccbbbababbbcccdededcb#a####...addcba##aabbbbbbbbaaaaabba#aaa##abba####abbaa###a#aa#aa##aaa#a##abaaaaaaaaabababbcdbcb#baaaaaaaaaaaaaaaaaa#aaaaa###",
-"######a##aaaaaa#accbaaabbbaaa#aaababdcaaabbbbcccbbbdbabbbacdccgecadbbbcdccddeddcccccbaabcbbcgjhhjgeb#aacdcccaa#aa#aaa#a#aaa##aaaaa#aaabbaabb#aa###aabccddeccbbbaabcbbbcbbb#aacbbadbabcccddbaaa#aaaaabbbbabbbbcdbbbabbcddcbbbccaabbbccbbaaaadi##abbbbbbbaabbbacdeedbd######aa####bceda#aabbabaaaaaaaaba#aaaaa#aabaaa###acaaaa####aa##aaaaaaaa#aaaaaaaaaaababaaaaabcaaaaaaabbcbaaaaaaaaa###aaaa###",
-"##########aabaa#accbbabbbbbba##aaaabbcbbbbbbbbcbaaabdbbbbbbddccbbbbaaaabbabbbbcefefdcbaadbcddje#debgfbabecdc####aa##a###a#aa#aa##a##aaabbcabbaa###aabbcceedbcbaaaabdcccbabaaabbbbabbccbbaaaaaa#aaaaaaaabbbbbcbccabcccccdcccbbbbabbababbba#abfe#aaaaaaaabccbbaaaedddc######adcaaaa##dfcaaaaaaaaaa#aaaaa##aabcaaabbaa#aaab###aa###aaaaaaaaaaaa##aaaaaaaaaabaaabaaabcabaaaaaaabcbaabaaa##a###aa####",
-"#########aaaaaaabbcbbbbabcbaacbaa##aaabaaabccccccbaabecabbbcddbacdeba#aaaaabaaabbdfgedcbaccdcgica#aadghdbddd#aa#aaa#a###aaaabaa#####aaaaabbbbbba#aaabccceecbddbaa#bbccabcbbbbbacccdbbdabbaaaaaaa#aaaa#aabbbbcccdcbcbbccccccbcaababbdbabbba#bbgaabaaa#aaacccdcddbeedba#a##a#aba#aaaa##decbaaba#aaa###a#a###abba#bba###aaba####a####aaaaaaaaaaaa#aaabbbaaabbaabbaabbaaa#aa#a#abbaabbbaaa#aaaa#####",
-"############aaaaaaacbbbbbbbaa#aaa#a##aaaaaaaacbbbbbbabdcabbbcdbaccdba#aaaaaababbcbbdddedccddefihaa#aaahiiiffd#aaaa#abaa##aaaaacaa##a#bcaaaabbbcaaaabccdddecabaaaaacbbbabbccccccbbdbdfdaabbaaa###a#aaaaaaaabbbbbbbaaabdcddccbbbbabbbccaabbbaabfdaaabaa#aa##aabbbbbddba##aa#a#aa##aaaaaabcdbbaaa##aa#####a#aaabbaaaaa##abb######aa###aaaaaaaaaaaaaaaaabaaaaaaaabbbbaaabaaa#aaaaaaabbbaaaaaaaaa####",
-"###########aa#aa#aaaccabbaaaaaaabb#######a#aaabcbbbabbaeebbccbcbacdaaa##a#aabbbbccbbcbcdegifdfgifba##aaaagigha#aaaaabbaaaaaaaaabaaa##acaaaaabbbbbbabcdddefeba####abbaabccccbbbcbadcbcbaabba#aaaa#aaaaaababacccbaadbabbccedcccbbccbbabaaaaa##ade###abba#aa##abbba#cebb.#a####.#a#aaaaaaaaacfca#aaa###aa###abaabaaaaaaaabbaa#######aaaaa#aa#aaaaaaaaaaababdaaabbbbbababaaaaaa#aaaaaabbaaabaaaaa###",
-"##########a#aaabaaaaccaaaaaaabaaaaaaba###a##abaaabbababaccbcbbcccaaba#a###aaabbccdccccccdeegggfigaabb#aaa#fffcba#abbaaaaaaaaaaa#abba##aaa##aabbbcbbbbcdeegfeb####aabaabacbbbcbccaabbabaaaaaaa##aa#aaaaababbabbcbcdbbcccbddcdcccabcbbababba###afba#aabba#acaaabbbbaddb##aa####.####aabbaaaabffcaaaaaa##a##bcabbaaaaaaabbbc#a#a#######aaaaa#####a##ababbbbbaaaabbcbaaaaaaaaaaa#aaaaaabaaababaaaaa#",
-"#######a#####a#aaaaabcbaaaaaa#aabaaaaaa###abbabaaaaaccaaabdbccbccbaaca#####accddcccccccddeeefikjeabcca#a#abfifbaa#abbbbbaaaaaaaaa#bbba#bcaaaaaaaccbcccceffeccaa##aaabbbcabbacbddbbaabdbaaaaaaaaaaaaaaabbbaabbbbbbbbbcbbccccdcdcccabbbbbaaba###dcaaaabbaaabaabcbccaadba#aaa########aaaa##aaaacgdbaaaa####cfffda#a#aaaabbdbaa#aaa########aaaa#aa##aaabbabbbaaabbbaaaaaabaaaaaaaa#aaaaabaaaaaaaaa#a",
-"a###########aaaaaaaabbaabaaa###abaaa#a##a###a#aaaaabacaaabccbbbcbbbcbb####a#bdfbbccccccdefecdgiiddaabbaaaabacfeaaaaaabcccbaaaaaaabaaacaa##aaaaaaabccddcfgfgbabaaa#aaabbcccbccbcddbbacabbbbbbbbaaacbaaaabcbabbbbbcbbcbccbccdccdccdcbaabbbaabaaade#aa#baaabaa##abbcbacdb#.#abbccc#.##aaa####aa#aeeaaaaaaabbabddfgfba#aabcd#aaaa########aa##a##aaaaaababbaabbbbbabccbababaaaaaaa##a#aaaabbaaaaaaaa#",
-"#a###a######aaaaaaaacdaaaaaaaa#aaaaaaaaaa#####a###abbbbaaaaccbbbcbbbbaa#aaaaaeecabcccbccdedcdfgigeaaaacbaaabaacbaaaaaaabcbbbaaaaaaaaabccaaaaaaaaaacccceffffbabb#a####aaaabcccccddcdedbbbbaabcabbbccbccbcbcbbbbbbbbbcecbccccceccccdccbbaaaaaaabce#bbaaa###aaa##ababcacda#abb##a#######a#########bfdca#abcbaabaabcffddbabdc#aaaaa##########aa####aaaaaaabbabbbbbbbcbbbcbaaaaaaaa#aa#aaaaaabaa##b##",
-"##a#########aabaaaabcdbabaaaaa##aaaaabaaba######a##ababbbbbabbbbcbcdddbbaa#abceecabccccccdddfedgjgdbaaabaaabbbaaba#aabaabaccaaaaaaaabbccbbbaaabaaabcddefgfebbbb#aa####aaaabbcccccbbfeccbbbaaababbbbbbbccba#abbbabbcdccdcbddcddcccdcddcbaaaaaabcfbadaa#######a#abbacbbcc###a#a########a######a##aabdcabccbbababaaaacdfededbbaa#aa##aa######ba#aa#aaabbabaababcbbcbcbbbabbaaaaaaaa##aaabaaacba#a##",
-"##########a#abaaaaabbbcbbbcaa###a#aaaaa##aba#######aaaaaabbdccbaabccdddecaaaabccdbbacccddcdefdfgiifcba#bbaaabbaaaababbbbbbbabbaabaaaacbbbcbbaaaaaaaceeeefffbaaaa###a##aaaabbcbbbddcddddcbcbbaaabbbbababbabaaabababbbbcccdccddcddccccdecaaaa#abccfbbaaa#######aabbaacabe###a#aa#a#a##.aa#######a#aa#cfeecdcccccabbbabacggcabbaaabbaaaa####aabb#aaaabbababbbbbbcccbbbbbcccbbbaaaa#aaaaaababbaaaa##",
-"######a####abcbaaaaabbccbcbaa###a##aaa##a###aa######aaaaaabdgebaaabbbccacbaaaaabbbaaabccddcdeeffgigbaaaaaabaabcaaababbbbaabbacbaaabbaaaababccbabbabbdffefhdcaaa###aaabba#aababcbdeeccceccccbababbbbabbabbaaaaaabbaabbcbcccccdcddddccccdcaaaababcdeaba#####.###aaabaab#b####a####a##aa#b########aaaaabedddcccccaaaabbcabeaaaabbccbaaa#abbaaabbbaaaabbbaaacbcbcbbdccbaabbacbbbbbaaaaaaaaabbaa#####",
-"######aaa#abbcbaaaaabdccbbaaa#######aaa#####aaa##a#a##aaaababcbbaaaaabdebbbaaa##aaaaaaaabccddeefggieaaaaaaaacabaabbbabbbbaaaabbaaaaaaabbbabbccbaabbbdfgghebbbaa#####abba#aabbbcbccdcbbbcddcccbbbabbabbbabbabaaaaaaacbbabcbbccccddddccbcccaaaaaabbdcbc##########aaacbbaa####a####aa###a#aa###aaa###abbceddedcccbaaaacccdca##a#abbbabaaaabaaabbba#aabbbbbbccbbbbaaacccbbcbbaaabbbbbbabaaabaaaa####",
-"#######aa#aaccabbabaabdecbb#a########aaaa####aaa#aba##a#aaaaaaabbdcaabdcbcaacb####abb#abaabccdeffghfdabaaaa#acbbbbcbabcabcbaaaabbbabaaaabbbbbcccbbbccdfedccbbb#########aaaababbacccbcbbbddbdcccccbbbbaaaabbaabbaaaaabaabbbbccdcceedccccacbaaaabbbbddb####aa######aabbaa####a####aa#aa###a#####aa#aabbddeccddccbbbabbbbceb###aa#aaaaaa##aa####aaaa#abbbbbccacccbaa#accbbbbbaaababbabaaaaaaaaa####",
-"##a#####aaaaaabbbbabacdddccaa########aa#a#####aaa#aa#aaaaaaaaaaaabcabbcbbbbababa###baaaaaaabccdeeehifbabaaa###abbcbbcaccbcbbbaabbbbabaaabbbbbbbbcccccddbccbbbbba#######aaabbbaabbcccbdcbbdbbddcdcccbabaabaaaaaaaaaaaaaaaabbcccddecccbbacccbbbaabbbceca############aaaaa#############a#############aaaaabccddcbbbabbbbbbba#####a##a####aaa#######aaa#babaabbcbaaa##abbbaabbcbbbbaaaaaaaabbaaa####",
-"#########abaaabbabbbbbddeccca##aa######a#aa####bbaaaaaaaaaaaaaaaaaabccbcccebacfdb#####aaaaaaabcdddcfgfccbaa##a##abcbbcbbdcccccabbabaababbbbbbbbbbcdccddbabbbbbba########aaababbbacdccccaabcbbcabddddbbaaabbabbbaaaaaaaaabbbddcddecbccbbbdcbabbbaabbcda#############abaaaa############a####bb##a####aaaaabcffdcccbbbbbbbb#######aaa###aaaa#######aabaaaabbcbaaaaaaaa#aaaaaabbccbbaaaaaabbbaaa####",
-"#########aaabbabcbbbbbdddcbaaaaa###############aabaaaa#aaaaaaaaaaabbabbdefffccbba###aa##aaaaaabcdceecggdcbbaa##aa#aacbb#bcdddddabbbbbabbbabbbbbbbccfeedbbbbbbcbba#a#####a#acababbbdcbcbabbabaabaabeedcaaaaaaaabcbbaaaaaaabbcdfdddccbbbbcbccbabbbaaabcda########a#aaaaaaa#aa#####aaabaaaaaaacb##aaa#aaababbcdefddbbcbccbaa#####aaaaaaaab##a########aa#abbcccbaaaaaa###aaaaabaabccbbbaaaaaaaaa####",
-"########aaaaaaabbbbbbcdedbbbbabaa##########aa###bbb###a##aaaaaaabbaabbbdfeedb##a#a##aa###aaabbbbccdefbfecbbbaaa####a#adb#acdecdfcbaabcbbbbcbbbbbbcdeffbcccabbcdbbba#a###a#aabaaaaaccccbaaaaabbbbaabdfedaaaababbbbbaaaaaaababbcedcccbbbbaccccbaaaccbbabeb######aaaaa#aaa###a######aaaaaaabacbca#aaaaaabbbbccdegfeccccccbcbaaa#####aaaa#aaaaa###a###aaaabbbcccb##a#aaa#aaaaaaaabbdeddcbabaaaaa####",
-"#########a#aabbbbbbbbdddccbbba#aaaa##aa##a####a#bba#a#a#aaaabaabbbabbeedeeefdaaaa#####bb##aaabbabcddehgifffdcbaaaa#aa#aaaaaccdeddcabbbcbbbccbabbccdceeecdcaaaabbcccaaaaaaaaaaaaaabacdddbaabaabbbbcccccfdbaabbaabbcaaaaaaababbcccccbbbbbbbccbcca#acbbbbbda#####aaaa####ab##a######aaaaaaabaccbaaaaabbbbbbccceffcdeedcbbbbaaaa#aaaaaaaaa#aaabaaaaaa##aaaabbbcbbcbaa#####aaaaaabbbcccddcbbaaaaa####",
-"##########a#aabbcbcbbcecccbbbabaaaaaa#####a#aaaabbaa##ba#acaaababbbbbbbcdcfgdbbbaa####aba##aaaabbbccdfefhfgedecaaa##abaaaaacbabebbbbbbbbcccbcbbbbddbedbddcaaaaaabdccaaba#aaaaaa#bbbbbaddccaaabcbbdcbbcbddabbbbbbbccaaaaaaaaabcddcbbbbbbbbbbbbbbaaaabbaabe#########a####bb#aa#####aa#aaaabccdbbbbabbcbbbccccdccbaaeffdbca#aaaa#aaaaaaa#aaaaabaaaa#aaaabaabbccbbcceb#bcaaaaaaaabbbbcdcbbbaaaaa####",
-"#######aa#aaaaabbccbbcdccddcabaaaaaaaaa###aaa#aabcaaa#bba#aabaabbbbbbabcccdfedcaa##aaa######aaaabbbbcdddghhgfedcbaaaa#aaaaabcbbbccbbbbbbbcbccdcccccbeebccbbbaaaaaccccccba#aaaaaaabaaabbbddbbbbcccbcccbaceeacbbbcbccbaaabbabbbbceccbbbbbabbbbbbbab#aabbbbcc#.######a####.bcbcba####aaaa#bedccbbbbbbbaabccddedaaaaa##beeda#aaaaaaaaaaaaaaaaaaaaabba##babbabbbbcbbbccccbbaaaaabbabaabddcbbbaaaa####",
-"##########aaaabbbbccccbcddddbaaaa##a#a#a###aaaa#baabbaaaaaaaabbbabcbaabccbddfebaaba#ba######aaaabbbbbcddfiiigggedbaaaaaaaaaabcbabccbbbbbbbcccddddccceecccccbbaaaabccddbbba#aaaaaaaaabcbbbcccdccbcbabcbabceecbabbbbbbaaaabaabbbcddbbbbbbbbaabbbcbbbbaaabcbdc########..####ccccba#abbaaaabddbabbbcabbbbcccceeca###aaa##aaa##a#aaaaaaaaaaaaaaaaaaaaa##aabcbbbbbbbccbbbbcddaaaaacbaaaabddbbaaaaaa###",
-"############aaabbabcddccdbcdcbcbbbaaaaa##a##aaaa##abaaabaaaaaaabbaacaabddabcefc#aabaaa###a####aaabbbbbbddgihhfffgeaaaaaaaaaaaaabbbcbbbbbbbbbcddeeedceccdcccccaaaaabcbddbaa#a#ab#aaacbbbbbbddebbbbccbbbabbbedbaaaaaaaaaaaabbabbccecbbbbccbbbbaabbbbcc#aaabbcc######a#####.bccabbacbababaabdcabbbabbabbbcbdecabaa##aaaa####aaaaba##aaaaabaaababa##aa#aaabbbbbbbbcbbbbacbedbaaa#bbaaaabcbbbbaaaa#aa",
-"#######a####aaaaabaabbcccbabbbbbbbcbaaa######a#aa######aaaa#aaa#acbbbabeeebabddbaaabaa####aa#a#aababbbbbcehhgeeffdca##aaaaaaaaaabbbbabbbbbbcdcdddfgfhcbbcbbbcbaaaaabcccdbba###baaaabcbbaabcdeecaaabbbbbbaabddecaaaaaaaabbbbbbbccfcbcbbbbbbbaaaaabbbcca#aabacc#######a####acdcbbbbbbaaaabbccaabbbbbbbabbceecabb#aa#aaaa#######aaa##aaaaaaabbaaaaaaaaaaaabbbaabccbbcbaaacgdaaaa#aababbbabbbbaaaaa#",
-"###a#####a#aaaaaabcbacbbddcaaabbbbbbbaaaaaa##a#####a####aaaaa#aaabdbcbbedefcaaabaaaaabaaa#a##abaaaaababbbcfgggfeefea##aaaaaaaaaaabcbbbbbbbbcdcdddefgeabbbbaabccaabaaceddeeaaa##aaaaaabbbabbcdedbabbbaaaaaaaacfecaaaaabaabbbbbbcdfdbccbbbbbaaaaaabbbcdbaa#aabdb#########a#acdcccbaaab#aabccbbbbbbabbbceedccbcbbaaaa#baa#a###a#a##aa###aaaabaaaaaaaa##aaaabbaaabcbbbbbabbdfeaaaa#ababbcbbaabaaaaaa",
-"#####a#####aaaaaabbbbbbbcddcbabccaaabbaaaaa#a##a##a######aaaaaabaaaaacbbbffeaaaababbabbbbbaa##bbaaaabbbbcccghghgeffbaaabbaaaaaabbabccbbbbbbcdddefggecccbabaaabbbacbabbdddecbaa####aabaababbcccdcabaa#aaa###abceedcaaaaabbbbccddefdccdccbcbbaaaaabbccdccdb#abbd###a#####a#a#cddcccaaaaaaaaabccbbbbdeefbba##aabaaa#aaaaaa#aa###aaa##a####aaaaaaaaaaaa##aaaabacbabbbbbcbbbbcfgbaaa#aa#abbab#aaaabba",
-"##########abaaabbbbbcbcdcccdcbbbcbbbbbba#aaaaa#a############aa#aaaaaaababbdeaaaacbbbbbddcbaaa##abaaaabbbbcccghhhedecababcbaaaaaababcbbbbbccbddceggffecccbbbaaabca#aaaadddedcb#a##aaaabbbabbbbcccdd###aaaa#aa##bcefeddcddccefdddfdcccccccccbbaaaaaabccccdddaabbda########ab##bbbddcbbaa#aaaabcbbbcdddccaaaaa#abaaaaaaaaaa#aa#aaaabaa#####aaaaaaaa#######aabaacbabbbbbbcbbbbdfbbaaaa###baabaabaaba",
-"###########aaaabbcbbbcccbddbcdccbbbbcabbaaaaaaaaa###a##aa###aaaabaaababbccbbdb#abccabddbbbba#aaaabdbbaabbbbcdehihbaabbbbcdcbbbbaababbedcbbaccdddeeefedabbabaaa#aaa#aa#beeeeffca###aaabbbcbbbbbbcced#a###a##aaa#abffgfedcccfhcbdebcbccdccccbbaaaaaabbcccccddbaabdcb#.#aa#aaa##abdddcbbbaaababbbbbcbdbabbbbbb##ababbbaaaaa#aa#aa##aaa######ababaaa#####a#aabcbbbabbbbbbcccbbbeabcbba###aaaaaaaaaab",
-"b#########aaaaababbbbabbbbdebcccccbbbabaaaaaaaaaaaa########aa#abbaaabbabbdbcbbbaaadcbcbdbabba##aa##abcb#aaabcdcfhgdabbbccdcbcbbbbbbabcgdcbdbbdedeeehfgdbbbbbaaaa#aaa#abddddgeedcaaaaaabbbdccccccbceeaa###a###aaaacfghhgedccggefbccccccccccbbbbbbaabbcccccccdaabaaccb#aaa###a##adedccbcbaaabbbbcbbcddbaaabbbbaadbbaabbaaa##abaaa#aaaaaaaa#aaabaa########abbadccaaabbbcccccbbdcbcbbba###aaaaaaaabb",
-"aa##########aaabbbbbbbaabbaccbceeebbaabbaabaaabbbbaaa###aaaba#aabaaaaababbccggcbaabccbbbccbca##aaaabdbbabbabbcdddghbabbccddcbbbcbbbbbccgfcbccceddddeddedddcbababaaaaaa#accdeffedbaaaaaaaacccccbbbccffb#a#####aaaaabfhgghhhhgghecbccbccccccccbbbbaaabbbbcbbbcdcbbabbcb#####abca#abccccccabbbbbbbbbdddbaaaaabab#cdba#aabaaaaaaaa#aaa#a#aa#####aaaa#######aabbbbccbbbabbdeddcbbeaabbcb###aaaaaaaaab",
-"baaa######a#aaabaabdbbcbabbaccccedaaaaaaaaaaaaaaadbaa#aaaa##aaaaaaaaabbbcbcccdbaaaaabdcbacbcdcaaaaaaaabaaccbbccdddhgcabcccdecbcbbcbbabadedbbcdedcddeeccdddeeedcbbcbaabbbabbcddddec#aaaaaabbcccccbccdffc##a##a#aaaaaafheffhgeccefcbbcbcccccccbbbbaaabbbbccbbddedbabbcc.##a##abc###cdcccbcbbbabbbaddccababbbaaabaddba##aaaaaa#aaa#a#aaaaa##aa##aaaa#######abbbbccbcbbbbdefeeccecaaaaa####aabaaaaaa",
-"bb#a########aabbbaaababcccdaacdbbaba#aaaaaa#aaa##acaa###aa#aaaaaaaaaaabcdcccaaaaaaaaadbcbbbbacc###aaaaaaaacbbccdcdfggbbbcccdecccddcbbbacdfdbcdebbbcccdcccccdcbefccbaaaaabcbbccabdfcaaaaaaabbdddccccccefe##a##aaaaaaaadfghhhdbbcccccbcbbccdccbbbcaaaabbbbdccddeeba#bbda######.acabbddccabcbbbbbbbddccaaaaaaaaaaabdca#a#aaa#aaaaa##a#aaaaa##aa##aaa#a##a##abbbbccbbdbbccefffeccd#a########abaaaaaa",
-"aa##########aaaaabaabbaaccdcaacbbaab####aaaa#aaaaaa#a####abaaaaaaabcaaabddcacda#aaabacbbbbddddcbaaa##aaaaa#abbdcccdegfbbcdcdefccddccccbcbbfdccecabccbcbbbcdddcbffdcccb#aacbaabcbbeecaa#aaaabcedddccccddfeb#####aaaaaabbehhfcccbcccccbbccccccbcbcbbaaabbbcdcceddcbbabba########bcbbcdcbbbbbbbbaacccccaaaaaaaaaaaabcba####aba##aaaaaa#aaaaaa##a#aaaaaaa#aaabaabbcbbbbbbbdffffeeeaa########aabcaaaa",
-"aba#a#aa####aaaaabbabbabbaccaaabaaaa#######a####aaaaa####aaa#bbaaaabaaacbddcbccaaaaaaaaaaacdeabcbba#a###a#aaabccccdeegfcbcdddeedcdccddccccfedddcbbccbbbbbbccddedecccdca#aaaaaaabacedcddcbabaabccccccccceccd####aaaaaabaacdghhfecccccbbccccccccbcbbbaabbbcccccddcddceaca########cdccdccbbbbbbbbbccbcdcaaaaaaaaaaaaaaba#####aaaaaaa###aaaaa##a####aaaa###aabbbbbbccbdbbbcdefffgaa#a#######aabaaaaa",
-"aa#####aa###aaababbccccbbbbcbaaababa#######a#aabaaaaaa####aa#abbaaaabbaabbdcbbcdbbbbaaaaaabcddbcbba#####a#aaabcdccceefhgbbdcceeeeccccccddeefeeecccacccbcbabbccdefdbcebaaaabaababbbcdcdfffdabbbbbcccccccecade#aa#aabaaaabaackijkidbbbcbccccccccbcbbbbaabbccccccccddegfdaa#######ceedcbbcaacccccbcccccbaaaaaaaaaabaaaaaaaaa####aaa.baa######aaaa####baaa#aaaabbbbbccdcbbcddedfgfb##########abbaaa#",
-"#a########aaaaaaccbbcdcccbbbba#aaaaaa#####aa#aaab#aaaa#.###aa#aabababcbabaccbccdedaaaa#aaaaabccacbaa#a######aacbcccdffhigeccccdeedddccbcddffdefcbabbbcdecbabbbbcddecddbbaaabbabbbcccddeeffabbabbbbcccccdecdedb#a#aaabbaaaaahifgikfcbcccccccccccbbaaabbcbbbccbbbbcccdhea#a#####aedfebccccbbcbcccccccbaaaaaabaa#aaaaaaaaaba#b###aaa#b#######a####aa##abbbabaaabbbbbcdecbbcdedefghc#########abcedcb",
-"a############a#abcbbbcddccbbbcaaaaaa#a####a#a###ba#aa#######aaba#bbbbbccaabcccddeebaaaa##aaaabaaabaaaa#####a#aaaabcbdeggihfccccdddffdcbcccdfcbcbbbbbbccbbbbabaabcdfebcbbca##aabbbbcdcdfffeeaabbbccbbcccdeeddeed##aaabaaaaachgcccfijebbcccccccccbbaaaaabbbaabbaabbcbbcfecaaa#aaadcddbbdcccabbcccbbbabbaaaa#aaa###aaaaaaaaaaaaa##aaaaba######a######a#abbbbbbabbcbbbddcabcddddefgfa########aacedcc",
-"#######aaa#####aaaccccddcdcccbbaaaaa####a####a#aaaa#aa#######abaaabbccacdaadccdddccba#aa#bbaaabaaabaaaaaa#aaaaaababbbdeffiiebcccdddeedcccdcfbcbbbbaabcbbbbbbaaaabcdeefeeddedbaaabcbdccefffffabbbbbbbbbcdcdddddefbaabbbbabaeidccddcejgbbccccccccbbbbaaabaaaaabaaabccccdffebaabbaaddcc#cdccabcccccbbbbbaaaaa#aaaa##aa#aaaaaaaaabaaaba#b##a####a#a#a##a#aabbabbaabbbbddecbbdcccddeega.##.#a##aab###",
-"#########a#####ababccbbbdcccccabbb##aaaaaa#aaaaa##aaaaaa#..###aaaaaaccbbdcbbccdbccdaa##a#a#aaaaaa#ba###a#a#aaaaaaabbbcdeefhgeccedbbcdedeedgebbbbbbbbcdcbbbaabaaabacccddccccbdcaabbadddeefffgfbabbbbccccccccdddbggbaabbbbabhefcccddddihdccccccccbbbababaaa###aa#aabbbcdeeffa.##abcfedabccbcccabcbbbbbbabaaaaa###aaaaaaaabaaaaaaaaaaaaba#######aaab#####aaabaaaabbbaceffecbccddccdec#####.##aa#aa#",
-"#aa########a####abbccbbccdcccbbbbba#a##aaaaabaa#aa####aaba#.##baaaabccdabdbabbbbbcccbaa####aaaaaaa#aaaa######aaaabbabccdfeehihfggfdbceedddeddfdccbbcbbbbbbbbbbaaabaccccbbccdddecababedefffffhgdaaabccbcccccdddbfhfbbbcbbackdeeccdddccfhgbccccbbbaabaaabba#####a#aabbbdeddeda.###aeddcbaaccccccccbbbbbabaaaaaaaaaa##aba##abbaaaaaaaaaab######aa##aa###aaabbbaaaaabbbeffffdcdcdeffda######.###aaa#",
-"#aaa############aabcdcbcdcfedeecbbaba##aaaaabaa###b#a##aaaa####abaaacdcaacdaacbcaaaaaaaabc##aaaabaaaaaa######aaaaabbbdddeddfhhhhhhfcccffffdbaabcbdbabbbbbbbbbbaaaaabbcccbbbbcfdedbbadeddeefdefhffecbbcbcccccceddgibbbbbbdecccbbccccddddhidccccbbaacaaabba########aabccedddeda####cdcecbccccddddcbbbbbabbaaa#a#####a#######abaaaaaaa#aaaa#a##aaaa#a####aabaaaaaaaaabccddfgfddefge################",
-"##aaaaa#aa######aaabdccbccdeefebbaccb###aaabcbaa########aa######aaba#bdbbbcabbbbbbaaba##aba#####ababaaa##a#a##aaaabbcddedddeeefhghfddccdhecbbbaaaababbbabbabcbaaaaaabbccbbbbbbeefdbbbddbddffdggihiebbbcbbcccccedeicbcbbcdccccccccddddddcfifccbbbbabbabbbaaa####aa#aabcedddefeb##.bdcdeccbcccdddcbabbbbaaaaaa#aa############abaa#aaaaa#aaaaaaaaaa#######aabaaaaaaaabbabbcefgecbcc############a#a#",
-"##aaaa####aa##a##aaabcdcbbccdcdccbcaba##aaaabbbaa#aa#a####a######aabaaabaaaaaaaabbba#aa###a##a###abbbaa#aaaa#a##aabbcededddddeghggcdfedffddcbbbaaabbbbbccabbbbbcaaaaabccbbbbbbeccefdbcdbcbcefefhgghdbbcbcccccccdcefedbadccbbcccccddddddddeggcbbbaacaabbbaaa######aaaabdcdeedefbaa#deddcdcbbcdedccbbbcbaaaaaa##################aaaaa#aa##abaaaa#aaa#aa##aaaaaaaaaabaabbacdbacbaaba###############",
-"##a#aaa####aa##a##aaabbbbbcdeccbbaaaaabbaaabbaabaa###aaaa#########aaab#aaaaaaaaabbaaaa#a#a#aa#a#aabaaaa###abb##aaaaabcdeeddefghhhebbbfebbdddccbbbbbaaabdcbcbcbacbaaabbabcbbcccddbbcefecdcbbbcddehgggcbbcbcccccccdddffbbdbbbbbccccddddddddddegcbbaabaaabbbaaa######aaabbbcdefdeca#ddedcdddbacadedccbbbbbabaaaa###############.####aaa##a###a##aaa#aaa#abaabaaaaaaaaaaaaabcdbaaaa#a########a##a###",
-"a##a#aaaa#####aaaaaaabcccbbcdebbaaba#a#bbaaabbaaaa####aaa#####aa#abaaaaaaaabaaaaaabbbaaaaaa#aaaaaababaaa####aaaaaaaabcddddefedhhgbbbbcefbcdedcedabbbababbbcbbbbbbaaabbaabbbbbcbcddbbbcdcebbbbdcabehhebbbbcccccccceddhfddbbbbbccccddddddddddcdfdaaaaaababbaaaaaaaaaaabbbbccddcdfededffddddcbcabcddccbbcbbaaaaa#####################aa##a#a#######aa###aaaaaa###aaaaaaaaaabbccaabaaaa######a######",
-"aaaabaa##aa####aaaaaabbccccbcccaabbba#a##aaaabbb######aaaaba##aaaaababb##aaaaaa#aabaaaa#aaa#aabaaaaaacbaa####aaaaaaabcdeddefefhheabbbbbdfgfgedcfaaabbbbbbaaaaaacabaa#baaabbabaabbdeeeccabdccbbbcaachifbbbcccccbcccddejkeabbbbccccddddddddddccceebabbaabaaaaaaa#aaaabbbcbbcccddefgedfedddcccbaabcdcccbcbcaabaaaa########.##.########aa###a########aaaaa#a###a###aaaaaaaaababccaabaa#########aa#a#",
-"##aaaacb########aaaaabbbbcccbdcddbbcbc#aaaca##a#aba######abca#aaaa#aa###aa###aaaaaabbaaa#a###aaaaaaa##bcbba###a#aaaabbceedddehgfdaaabaccbfhiihffcaaaaccbaaaaaaacabaaabbaabcbbbbbbbcbdeffedfdb#acaabafjgbbcbcccbccccdefiicbbbbacccddddddddccccbbcfbbbbbabaaaaaaaaaabbbcbbbbccccdegfecfdbaabdabbbbcccdcccbbbbaaaa###################a#aa##a#a##a####a#aaaaa###########aaaaaabbbbbaabaa#######aa###",
-"###aaacba#######abaabbdcbbcdcbbefcbabcbbaaaaa####aa#a#a#a#a##aaab###a#aa####abb#a#aacbaa####aaaaaaa#aaabdcbaaaaaaaaabaceefeeffffbaaabbabccehigfeeddefdbabaaaaabbbabaabaaaaabbbbbbabccbabdedda##aaabbachhbbcbccccbbcccdeghebbbaccddddddddddccccbacecbabaaaaaa#aaaaabbbccbbbbcccdcdgfdfebbbbbcccbcbcddccccccbbaaaaa################aabbaaaa####aa###a##aba#############aaaaabbbddbbaba##########.#",
-"####aaaba#######aaaaabdfdbbcccbbdebbaaaab#aaa#a###aa###aaa###aba#####aaa#####aba#aaa#baaa#####aaaaa###aabcccaabbbbbcbbbdfffgeccebaaabbbbcbbeffedccfghhebaaaaaabbaaaaaaaabaabbabbbbbacbbbbcbdda####abbabghabbbccccbbccddddghdaabcddddeedddddcccbbabdfdaaaaa##aaaaaabccccccbbccddcbefdffdcbbbcdccbbccddcccccbbbaaaa################bbccbaabaa#aaaaaa#aabba##a#########a#aaaaabbccbcabaa###########",
-"#####aaaba#######aaacccefcccbcdccbcbbaaaaa#abcba#########aaaaaaa######aaaa####aa##aaa#aaaaaaa##aaaaa##aaaccddcccdddddcceeffdccdccbaaaaabbbbcfggdddfffggfebaaaaaaaaaabaaabccbbbbbbbabccbbbbbcbdb###aabbbbghbacccccccccccdddfigdbcddddddeddddcccbbbabbfeabaa#####aaaabcccccbcbdddecegfffcccabbccccbbccdcccccbbbbaaaa############a#aaaababaaaaaaa#aaa##aaaa#aaa##########aaaaaabbcccbbdba#########.",
-"#####aaaaa######aaabddefcccbabdccccbaaaaaa###aaa######aaabaabbba#######aaaa####a###aaaaaa#a##a#aaaaaaaaaabcddddcdeeedefgfefecdaabbaaaaabbbbbadfebcfdfgffeeecaaaaaaabaaacabdbaaabbbcdcbbbbbbbbccb#a###abbaegcabccccdcccccdddcfihfdccdddddddddcccbaaaaaddbaa######aaabccccbcbccdddhfcfgecccbbbbcbccbccbccbcccbbbbaaaa#a##########aaaaaabccbcba#aa#aa#aaaaa#aaaaa###########aaaabbaddedaa##a#.#####",
-"####aaaaaa#######cffdabcbcdcbbadfbcbbaa###a#aaa#aaaaaaabaaaababaa#######a##a#########aaa##aa##aa#aaaaaaaaabdeddccddddddffeeeec#a#aaabbbaaabbbcggdcfeeeeegfdccbabccbbaaabbbcaaaaabbbcdbbbbccbbbdbaaa###abbccebabbccccbcccccddcdfhjhedddddddddccbbaaaaaabdda#######aaabbddccbbdddedccdgeeedccbbccdccbccbcbccccbbbaaaaa#########.##aaabbaabbbcbaaa###aaaaaaa#a#a#a########aaaaabbaccddeb###########",
-"########aaa######acddbabcbbcccabcddcaabbaaa##aaaaaabbbcaaaabbaaaaaba########aaa#aa###aaa###aa##abaaaaaacbbbcdffeddeccdffffeddbaaaa#abbaaaabaabegebdfeddeffeddddcdddcabbacbcbccbaabbacccbcdbbbcdb#aa##aabbbbbffbbccccbccccccdddedfkkidddddddcccbbaaaaabbabdb#a#####abcccdbccccddfcccdfgeedccbbbcbccccbbabbcccbbbbbbaaa############a#a#aaaacacbaaa####aaa#aa###a##a######aaabaabbbbbbdfa##########",
-"#################abbcbaacccccbccaacbcaaaaaaaaaaaaaaabccabbbbaaab##bb######a#aba##aa##aaaaa##a#a#acabbbacdcbcddffffdgeefefeddcb#a##aaaaabaaaaaaddfdcfdccccccdcbcbcccecbbabccdddddcbbbbccccccbbbceb#aa###aaaabbfgbacccbcccdcdddeedgjkihccddcccccbbaaaabaabaadca####aabbcccbcddccefdcdeeeedddcacbccccccbabaaabbbbbbbaaaa###########.#####aaaabacbba##aaaaaaa####a####a######abbabbcbcbcdb###a##.##.",
-"###########aa#####bdbaaaaccddbbdcba#bbaa##aa#aaaabbbbbbaaabaaaaba##aa.####aaa##a#aaaaaabbbaa#####abaabbbbbccdddeefeffddefdccaa####aaaaaaaaaabaeefdedeccbabbbdddbbccccabbbbbbbbcdcccbcccccccccbaaaa#a####aaaabacgcabbcccdddefffedgijfehdcccccccbbbaa#aaaaaaabcbaaaaaabbccdcdddefgecddeefedccbbbabccbbbbaaaaaabbbbaaaaaa################aaabcbabbaa#aaaaa#aaa###a####a####aaabaabcbbbcbba###aa####",
-"############a#####abaaaaaabddccbcdddbaaaa###aaaabaaabbbaaaabbabba###b######aa######a##aacbcbba##a##babbccccdddddeeefgfeedccdb####a#aaaaaaaaaaadefedecbabbbbbcddddbcddcaabaaaaaabbbbbaabbccdcccbbbcb#a##aa#aaabbbfdbbccddddeffffefggeedjhedcdcccbbaaaaaaaaaaabbcaaaaabbcdcccdeefgdcccdefeccbbbbbbbccbbbbaaaaaaabbbaaaaa#######aa######aaabbbcab#a#aaaaaaaa#a##a#####abaaa#abaabbbbbbdccc####aa#.#",
-"###aaa###a#a#a####aabaaaaaabdbbbcecdcbaaaaaaaa#aaaaaaaaaaaaabccbb###a########a#a#aaaaa##aaaabca#a##aabbccccccdcccbbbbcbcabbbb#a#a#a#aaaabaaaabbeffddeabcbbbbcccccdccbbbaaaaa#abaaaaaaaaaababbbbbcbb#a##a##a#aaaabefcbdeeddeffffffeddfbchjieccccbbbaaaaaaaaaaaacfcabbbbcdddcdehggffeeddgfecbbccbbbccbcbbaaaaaaaaabaaa######a##aaa####aaaaaaabbaa##aaaaaaa#aaaa#####aabbaaaabbbbbbccccddbaaaa####.",
-"####aaaaa#aaaa#aaaaaaabbaaabccbbbcddbbdcbaaaaaabaaaaaabbbbaaaaabaaa###############aaaaa##a#aaaaaaaaaaabbccccdcbbbaaaaaaaabaaa#######aaaaabbbabaacffffbbbbbbbbbbbbccccbaaaaaaaaaaaa##aaaaaaabbccca#######aa###aaaabcgfcdeeefgggggggeffcbbehkjebbcbbaa##aaaa#aaaadheabbbcdddcegfbccdfffgggedccccbbbbbabbbaaaaaaaaabaaaaaa######aaaaa#aa##aaaabaaaaaaaaaaaaa##aaa##aaa#acbaaabababbcccdecbaaaa###a#",
-"#######a###abaaaaaaaaaaabbdccccbbbceefebcaaaaaa#aaaaaabbbcccaabaaa###aaa#######a###aaaba##aaaaaaa#aaaabccccccbbbaaaaaaaaabaa###a###a#aaaaacbababa#eeedbbbbcddbcbccbccccaaaaaaaa#a#aaaaaaaabbbbcba########aa####aabbbghdeeegggggghggfedbbbcdikgbbbbbaa#aaaaaaaaaabheaabccddegdccccdddccfffddbbabbbcbbbbbbbbbbbaaaaaaaa########a###aaaa#a#abaaaaaaaaaaabbabaaaaaaa#a##ccaaaaaaaaaabcccbacaaabaa###",
-"##a#aa#####aaaaaaaaaa#aabbbabbcbbabcdeedcbbbaaaaaaabbbccdddccccbbccbdcbcca########aa####aa##a#aaa###aabbccdccbbbaaaaaabaaaaa#########aaaaabcaaabaa#dfcccbcccbcccccdccccdbbaaaaaa###aaaaaaabbbcb######aa###aaaa###abbcfheeffghhghhijifcbbbbbehjhcbbba##aaaa##aaa##afgdbbcefecdcdccddddddeedcbabbcbbabbcbbbaaaaaaaabaa######a#a#a###aaaa#aaabaaaaa#aaaaaaaaaaaaaaaa#a#bcaaaaabaaaaabbcccbcabbbaaa#",
-"aaaaaaaaaa#aaaaaaaaaaaa#abaa#aaaaaaaaabcbbaabbbabbbbccddddddefdbcdccdecddcaa##aab######baaaa##ab###aaaabbbcccbbaaaaaaaaaaaaaa########aaaaaacdbaabaa#dcabccdddcccccdeeddddddbaaaaaa###aaaaabbbca#a#########a###a##aaabcegefgfhhggiiihddbbccbbfegihfb###aaaaa#aaaa##adgfefecbddccccddcedccefdcbabcdcaabbbbbbbaaaaaaaaaa#a####aaa#aa###aaaabaaaa#aaaaaaa#aaa##aaabaa##abcbaaa#aaaaaaabbbbdddbbbaaaa",
-"aaaabbabaaaaabaaaaa#a#aaa#abaaaaabaaaaaaaaababbbbccdddeeefdfffedccbbbbcccccaaaaacb#abaab#aaba#aaa###a#aaaabccbaaaa##aaa#abaa###a##a#aa#aaaaacca#abaaadbabddddfededcbbcaaabcddcaaaaaa###aabbbcdca######a####aa##aaaaabbcdkgghhhhhgiigecabbbccffedgiida#aaaaaaa#aaaaaabfecbccccbbbabbbddddddccbaaacdcbbcbbbbbbbaaaaaaaaa##################baaaaaaaa######aa#aaaaa#a##abbbbaaaaabbaaaababbddcbbbbaa",
-"aaaaabcccbbbaabaaaaa#aaaaa#aaaaaaaaaaaaabaaabaaabbbcdffefgffdcccdddcccccbaabaaacbab#aa##aaabb#a#a##aaaaaaabbbcaaa###aaaa#aaa#a###aaa#abaaaaaacccbaaaabcbaaccbbdccbbbababba#abccbaaaaaaaaaabdeabaa##########aa####aaaabbceghghhihiihhgcbbbbbbegdcdedhhdd#aaaaaaaaaaaaabdccccccaaabbbbcddddfeffdbbabcbbbbbbbbbaaaaaa###a#########aa#######acbaaa#####aaaa##aaaaaaaaa#a#aaaaaaaaaabbbbaabbccddbbbba",
-"aaaababbbccbbcbaaaaaa#aaabba#aaaaabaaaaababbbbbaaaaaa#aabbcaaabbbbbbbbbcbaaaaaabaaaa####a##aaaa######aaaaaabbbbb#######a#aaa#a###a##a#aaa#aaacbbcbabbabcabbbcddbaaabbaaaa##aaaabbaaaaaaaabbcdbaaa###########a####aaaaabbbcfihghhhihhhdabbbbbbeeccccbdehfaa##aaaa#aaaaaabedccbaaaabcdcddcbfeffddeedccbbbbbbabbaaaaa#############aa########ababaa###aaaaa###aaaaaaaaa##abaaaaabbbbbbbbbbbbcdffabaa",
-"aaaaabbacbbbabaaaa#aaa#aaaacba###aaabaaaaaababaaaaaaaaaa##aaaaaaaaababbccc###aabaaaa##a##aaaaa#aa##aa#abaaaacccb##a#a#a#aaaaa####aaaa###a#aa#ababdbbbabcbabbbbbbbbbcbbaaaaaaaaaaba#a###aaacbcdaaaa#########.#####aaaaaabbccfkjgfhhifdfdaaababbffcbbbbbacgda#aaaaaaaaaaaaaddcba#aabccccdbbdeefeddfdfecbbacaaaabbaa##############aaaaa#######a#aa###aaa####aaaaaabaaaaaaaba#aaababbbcccddddgihcabb",
-"baaaaababccccbbaaa##aaaaaaa#cddb#####aabbbbaaaaaaaaaaa#####aaa##aa#aabadedca#abbaaaaaa####aaaa#a#aaaaa##aababcbca#aaaa#####aa###a#aa##aaaaa#a#aaacbaabbbcbabcccbbbbcbabba#aaaaaaaa#bbaaaaabbadb###################aaaaaabacbgkkihhggfedaaaaaaaceecbaaaaabffgeca#aaaaaa###acdca#aaacbbccbcbeeefffdabdfecabaaababbaa#a##########aaaaaa#######abaa##aaaa#####aaaaaaaaaaaaaabaaabaabbbbbcdegghffdabb",
-"bbaaaaaabbcccccbbaaaaaaabaaaabccca###aabcceebaaaaaaaaaaa#a##a#####aa#aaaddbbaaabaaaaaaaaaaaaabb##abb#aaaaaaabcbba##aaa###aaa#########a#aaaaaaaaaaaaaabbbccbaabccbcbbbbbaaaaaaaaa##aaabaaaaccbed#################.##aaa#aaaaacekljihhhdbaaaaaaabdeedbaaaaaabceffdaaaaa#####abdd##abbbbccccbcedfeddbbbbdddbbaaababaaa#################aa#aa.###aa##ba##aa###aaaaaaabaaaaabaaaaababbabbbdfhjifeecba",
-"bbbaaababaabbcccbaaaaaa#aaaaa#aaba##aaabcbbccbaaaaaaaaaaaaa#aa####aaaaaabccbaaa#aaaabaabaaaa#abdca#acaaaaabaabbaba#aaaaaaabba##aaaaaaaaaaaa##a#aabbbbbbbccbbbacbcbabbbbbaaa#aaa##aaaaaacbccccdbbba#a########a#.####aaaaabaaaaafklljhfcaaaaaaaa#dcgfcbbaaabccccdggcbaaaaa#aaaacdaabbbbbbbbcbddeeddccccbbcecbaaaaaaaa#a##############aaa##a####aa##b###aa#aaaaaaaaaaaaaa#aabaaaaaabaabbdggghhfbdeb",
-"bbabbaaaaaabbcbccbabba#aaaa##a#aaa#a#aaabbabbbaaaaaabbabaaaa#a#####aaaaaadcba###aaaaaaaaaaaaaaabbaa#abaaaabbbcbaa#aaaaaaaaaaaa#aaaaaaaaaa#aaaaaaaabbbbbbbcbababbbcbbbbaaaa###a###aaaaaaaccddcddbaaba#aaaa####a#.#.#aaaaabbaaa##djlljc#aaaaaaaa#afdfebaaaabccccddegfdbaabbbbbbabddbbbbbbbbbadceedcdcccbbabdebaaaa#aaa#############aaaaaa#ab####a##ba#####aaaaaaaaaaaaaaaaaaaaaaaaaabcdfebbbabbbcc",
-"ecabbaaaaababcdcccbbbcdbaaaabbaa#aaaa##aabcbbbaabaaabbaabaaa#aa###aaaaaabecbaa#a#a#aaaaaaaaaa#aaaaaaaaaaaabbcbaa###aaaaabaaaaaaa#a####aaa#aabaaaaaabbbbbbdcbbabbbcbbaaaaa####aaa#aa###aaabcccccbaabbba##a####aa#####aaaabaaaaa##ahlkfa#aaaaaaa##fbbecaaaabccbcdddceghecbbccccbbbccddbbabaa#ccedddddccbbaaacfbaa#a##a############a##aaaaaaaaa##a###ca#aa###aaaaaaaaabaaaacabbaaabbbbddea###aaaabc",
-"abbcbbbbaaaabbccbbbbaaaa#a#aaaabcaaaaaa#aabbbbaabaaccbbabaaaaaaaaaaaabbabdcbaaaaa###aaaaaaaa#aaaaaabbbaabbbabaa#aaaaaa#aaacbbaaa##aa##aaaaabcbaaaaabacbccccabaabaacbcbaaa####aaaaa####aaaabdccdba#abbaaa#######a######aaaaaba#####dljfa#aaaaaaa#ddaadcbccbbbbccccdccehihfddccccccbbdfaaaabbbceefedddcbbbbaaaecaaaaa##a###a####a##a##aaaaaa####a###ba#aa###aaaaaaaaabbbbacbbbbbaaacccdd#####aaaab",
-"babbbcccbbbaacdbccbbbaaaaa######aaaaaaaa##abbbbabaaabbaaaaaaaaaaaa##abbbdcccbaa#aa#####aa#aaaaaaaaaaabcbabbabaa##aaaaaab#accbaaaaa#aaaaaaabcddbaaaaabbbccccbaabbbbaabbbbaa###aaaaa#####a#abceeeaaa#aaaaba#######a#######aaaaaaa###.cgjgb#aaaaaaaafcaacdcdcbcbbcbbccdeefeeghfeccccbcddc#aabaaaeffeccccbbbbbaaacdcaaba##aa##a#aa#aaaa#aa###a####a####b#a##aaaaaaaaaaaaabbbbcababbbbcdddeb#a#####aa",
-"bacbbcddcbbbbacddccbabbaaaaaa#a##aaaaaa####aabbaaaaaaabaaaaabaaaaaaaaabbcccbbabaaaaa#a#aaaaaaaaaaaaaaaabbccbbba##aaa#aaaaaabbbaaaa#aaa##abbaabbcbaabbcccccbbbbbabbbabbbbaa#############aaabbcedbaaaaaa#aaa######a########a#aaaa##a##adhjc#aaaaaaacdb##bddcbbbbaabbccefgecceffgfcbceccedabbaaacffdccbbbbbbbbbaabccbbaaa#aa####a###aaaaa#a##bb##a###ab##a###aaaaaaaaaaabaaabbbcbcbbbcefeb#####aa#a",
-"aaccbcddcbbabcbcddcbbbcbaaaaaaaa#aaaabaa##a#aaaa##aaaaaaaaaaaaaa#aaaaaaaaabbccaaaaaaa#aaabbaaaaaaaaaa##aabccccbaa#aaaa#abaaaaaaaaaaaaaabbbbaabbaccbddedcbbbbbabbbcbcbbcaaaa############a#aacbcba##aaaaaa#aaa#a###########a###aaaaa####adid#aaaaa##eca##addcbbaaaabbcddefddefddgiedccccffbaaaaaefeccbbbbbbbbbaabacdbbba####aa#a##a##aaaaaaccbba###.aa#aa#ba#a#aa#aaaaabbabcbccbcbcccegc######ba#a",
-"abcbbccdedcbbbabdddcbabbbbbaa##aa#aaabaa######aaaaaaaaaaaaaaa#aa#######aa#aabcbbaaaaaaaaabcaaa###abaaa#aaabcbcb#aa##aa#abbaaaaaaaabbcaaaaaabbgecbbbbccbbbbbabcabbcbbbbaaaaa##############aaabaaaa#aaba#######a###########ba#aaa#aaa###aabffcaaaaaabeb####cdcbaaaaaaabbccdeffeeegihfddddffcaaaabefeccaabbbbbbbaaaabdba#aa####aaaaa###aaaacccbbba#######aaaa#aa#a##aabbbbbbbccccccccddgf#aa##a#aaa",
-"aabcdddddddbbbccabcdccbaaaaaa#####bbaaaa#######aaaaaaa###a#####a#########aaaacbbbaaaa#accdddba#a#aaaaaaaaabbbcbaaaaa#aaaabaaaaabba#bdaaaaabeecbbcbcbccbbbbabbbbbbbabbbbaa#aa####a########aaaaacaabaabaa#######aa########abbbbaa##aaaa###aaegfb#aa##dcaaaabddbaaa##a##aaabcdfgffgiggfffedefea#aabffccbaaabbaaabaaaaacbaaaaaaa####a##aaaaaabbabaaa##aa##aaaaa######aabcbaabbccccbbddedeeaaaaa#baaa",
-"aabbdeedeedddaccbbbcbcccbaaaaaabbaccaaa#a#aa###aa#aaaa#########aa#a#####a##babbbbbcbbcfdccccbbaabaaaaabaabbbccbbaaaaaaaaaabaaaaaaaaacfcaaabcbbaaababbcaabbbabbbbbaaacbabaaa####a##.########a#abd##baaaaaa##.###aa#######abbadb#a#########aaeiib####bca#aabadcba########aabccdgghgfeddddeedegdaaabdedbbaaabbabbaaaaa#cbaaaaaaaa#a##a#aaa#abbbbaaa#aa##aaaaaaa#####aaabaabbbbccbbbcdecef######acaa",
-"baabcccddedddbacccbccdcbbbbaa####aa##aaa###a###aaaa#a#####aaaa#a#aaa###aaaaabbbbbabcgjfdccbbbaaaaaaaaaaaabbacccba###aaaaaaab##aaaabbbdfdbaabdecbbbabaabbbbbbbbbbbbababbaaaaaa######.########a#acdb#aaaaaaa######aa######abbccb####aa######afiifa###bca#aaaabcbba#a######aaabcdeefcbcedccccceffaaaaacdbaaabbbaabbabaaabcbbaaaaaaaaa##a#a##abbaaaa#ba##aaa###a####aaaaaaaaaaccbbbcccdeff.######aaa",
-"a#aabbbcdeddcccbcccccdcbbabaaaa##a###aa#a#a#####aa##a###a##aaa####aa#a#a#aaabbaabbbbbffdccbbbabbaaaabbbbbabcbbbaaa##aaaaaaaaa###aabcbbcdfdaacebbbbbaaabbbbbbbbbaaaaabbabaaaa###aa############abcdcaaaabbaaa######aa#####abbbdc#############adghf###cdaa##aaaabbaa##.##.##aaabcdecedbbcdecbbbccebaabacdaaaaabbbbbbbaaaaabdcbaaabaaaaa##aa#aaabaaa#bcaaaaaa###aa#a#a#aaaaaaaaababccdceec##########",
-"###bbbbcdeddddcccccbccbccbbbaaa#####.#a##aa######a##aaaa###aaaaa##a###aaaaaabbbbbbbccddcdcbbbbbcdbbbadecccccbcb###a###aaaabaaaa###accbbccfhcacbbbabbabbbbbbbbaaabbbaabbbaa####aa#########.####aabcbaaaabbaaaa#####a#####aabacfb###############dhhc.ddb###a###bbca#.#....##aaabcdccecbbccedbbcccedbabbdcbaaaaaaaabaaabaaaacccaabaaaaaaaaaaa#abaaabbcaaaaaa###########aaaaaaababbbceeda.#####a###a",
-"#baaabbcdeddddddddbbcccbcbbbbaaaa################aaababba####aaaaaa###aaaaaaabbaabbdecbccccccbbbccccbcbbbcbbddeeca###aaaabccaaaaaa##abbbbcdedbbabbaaaaabbbbbbbbaaaaaaabbaa#######aaa##########aabbbaaabbaabaaa########aaaaaabdfb####aa#########cghhceba###a##aabaa#.....###aaabcdceebbbbbddcbccbcdcabcedbbaaaaaaaabaaaaaa#cddbbbaaaaaaaaaaaaaaaaccbaaaaaba#a#a######a##a#aaaaaaccdeed####aa####a",
-"aaabaabccceeddeedcabbbcbbcbbbbbbaaaaa#########a##aaaaabbcbaa#aa#aaaaa#aaaaaaaaaaabbcddcbbbbbbbbbbbbbabbbbbbaabbdgfba#aaaaabbaaa##aaaaaabbbcceedaaaaabbabbbabbbbbbaaaaaabba#######aba#########a##abbcaabcbaabbba########aabbaabddca#aaaaa#########adjhaaa#aa#####aaa#...####aaabbcccfdabbbbbddcccbbccacffccbaaaaaaaaababaaa##bccccbabaaaaaa#aaaaabdcaabbaaaaa#########a#a#aaa###bcddhga####aa####",
-"##aabbbbcdffeddeebdcbbbbbcbbcbcbaaaaaa##.##aa######aabbbbaaaa#aaaaaaa##aaabb#aaaaacddfbcbabbccbccbbbaabbaaba#abadfdbbaaaabcaaaaaaaaabbbababbceedaaaabbabbbbbbbbbbaaaaaaaaa##.#####aa#########aaa#aacdabbbaaaaaaaa#######bbbbccdcddbaabbaaa####aa###bhgea#######.##aaa#####aaaababbbcebababbabdeccbbbceffeecbaaaaaaaaabaaaaaaa#bcccbbbbaaaaaaababbbbbaaaabaaa#######a##a#aa#aaaaabddhg###########",
-"#a#aaabcdddffdddeeedbbbbbcbbbbcbbbaabaaa#a##a##aacaaaaaaaaaa#a##aaaaacdaaaabaaaa#accdeaaaaabbbbccbbbbaaaaabbbababcdddcccbbaaaa#aaaabbbaaaaaabdeeeaaaaaababbbbbbaaaaaaaaaaaa###a####ba####a####aaaaaabecaa######aaa#####a#ababccccbcbabaaaaaaa###a####dijdb########a#a###aa##a#abbbbddbaaaaabbabdddcfeffffeccbbaaaaa#aaaaaaaaaa#abccbcabaaaaaaaabbaaababaaaaa#aaaa###aaa#aaaaaaaaabchga#####aaa##",
-"#a#a###abccdddefdeeecbbbbbbaabbbbbbbbba#########abaa#aaaaaaa##a#aaaaaccbaaabbabbcbbccfbcaaaababbbbbaaaaaaaaaaaabbbabbabaabaaa#aaaaaabbabaaa#abcdfea#aaaabbbbaaaaaaaaaaaaaaaa#######bba##########aaaabcedbb#######aa#####a##abdcbbccbaaaaaa#aaaaa#aa###bgjjga#######aba#aadba##aabbbccbaaaaabbaaabedffeffffdcbbaaaaaaaaaaaaaaaa#aaaccbbbaaaaaaaaaaaababbbaaaa#aaa#####aaaaaaaaaaabbbghc#####aaaaa",
-"a##a#aa#aabccbdfgeefeccababbbaabaabbbaa#a##.######aaaaaaabba##aa##abbbcbcbbccacbbdedgheccbbabbaaaaaaaaabbaaaaaaaaaaaaaaaaaacbbba#ababbbbaaaaaaabdeeca#aabcbaaaaaaaa#aaabaaaaa####.##ba###########aaabbceeba########a#########cbbbabbbaaa#aa#aaaaaaaaa###djkjb#b#..#abbcaaabcba##aaabbcaaa#aaaaabaacfffffedffccbaaaaaaaaaaaaaaaaaaaabcbbaaaaaa##aaaaabaaabaa#aaaaaaa#a#a#a#aaaabbbbccgc######aaa#",
-"##aaaaaa##aaccbaeihfgggcbabbbaaaaacbbceceeca########aaaaaabaaaaaaaabbbdcccdebbcbbabacedecbbbabaa#aaaaaabbbbaaaaaaaaaa#aaaaa#abbbbacbbbbbbaaaaaaaccddbbbbbbbaaaaaaaaa##aaa#a##a#####aa#############aaabbceeea########a########aaaaaaaabbaa###a###aaa######agjkhgfb.#aabddaaaaaaa###aabdb##b###aaaaa#cffffeeeeeccbaaaaa#aaaaaaaaaaaaaabcbaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaabbbbbdfeba####aaa#",
-"#a#aaaaa###aacca#cjjhhjebcbaa##a##acegebdcbdb#.#cbcaaaaaaaaaaaaaaaaaabbcdgiecbbaaabbbcbcdcbbbbbaaaa#aabaabcbaaaaa#aa#aa#aaa###aaaaaa####a###aaaabcddbcbbbaaaaaaa#aaaa#aaaaa##a#####baa#.#######a##aabbcdddffa##.####aa##.####aaaaaaaaaabaaa###########a####chhiihc..ceffbabaaabaaaaabccaacc###aaccbbegfffededdccbaa#a#aaaaaaaaaaaaaaaabcbbaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaabcccefeaaa###aa#a",
-"aaa#abaaaa##aaba##eiiikhccbddefeeffgecccdccdeffefddc#aaaba#aaabaabbaaaabcdhfbbbbaaacdecbbaabbbcbbbbaaaabbbbbbaaaaaa#######a###aaa#aaaaa######aaaaaccbcbaaaaaaa####aa##aaaaa#####a##############a##aaabcccccdfb##.#####a######aaa#aaaaaaaaaaa##########aaa##.#aejjifb#cffacbbbaaa#acbbcc##ddda##cddeefgfffeedddcabbaa#aaaaaaaaaaaaaaaaaaacbbaaaaaaabbabbbcaabaaaabbabbbbabbbbbbbbbbbdfc####a##aa#",
-"#aaa#a#a##a####b###dgkkjgccfiifdfdeeccddddcdcccccbca#aa##aa#aaaaabbbaababeggdbaaaaadfcbbbbbbcccbabcbaaaaabcabbbcbaaaaaa##########a#a########aa##a#accbbaaa#########aa###aaaa###aaa####.#########b##aabcbbcddfb###############aaaa###abbaaba#aaa#########aa#####djjjifbcebccdcba#bbacbcb##addccdcdeeefgfffeecbccbbbaaaaaaaa#aaaaaaaaaaaaaabbaaaaaaabaabbbbbaabababbbbbbbbbccccbbbbcced####a###aa#",
-"a##aaaaaaaaa#a#ba..#agkgfecfikgddcccdcccbcccbcbcbbdba##bccaaa#bbccccbaabbefffcaaaabdfbbbbbbbbccaaabaaaaaaabcbbbabbbbaaaa#######aaa############aa###abbaaa####a############a####a#######.#####a##aaa####aaaacfa#######..######aaaa###a#cdcbbbabcbaa#aab#########.chiiihfcddeghhgdccdabdaa#addcddceefeeffeeeedbbcccbbaaaaa#aaaaaaaaaaaaaaaaabbbbaaaaaaabaabbaaaababbbbbbbcccdccdcbbceea####aa###aa",
-"a####aaaabaaabbab#.#aaeecdhfijfcccddcccbbbbccbbbccaaa###.a#abccccbcbcbbbbbff#a###abcebabbbbccbcaabbaaaaabccbbbbbbbbbbbaaa#aa####aa##############aaaa#ababaa##############a#a######a####################aabbcacaaab#####.#.##abbaa###aaabcacbcaaaaaaa#aa#########.bgihiifcdgijjjiidaaabe#a#bdcbccccddddddecdecbbbccbbaaaaa##aabbaaaaaaaaaaabbbbbabbbaaaabbbbbaaabbbbbbbccdddedddefeffa####a#####a",
-"#######aaaaaaaaaa#.#abcdaahkkjgbbcccbbbbbcbbcbbbbaaaa#a######abddedccccbbacffcbb##acccacdcabbdccdbabaaaa#abbbbbaabbbbcba###a############.##.###########ababaa##################a##a###.################aaabcbcdbbbaa##.#.#.#aabaa###abcdcaabaa####aa#aabbb###a###.#bgjhacegijjjjjjhedfgea##cbbbccbbbcccccdcccbbbccaabaaaaaaaaaaaaaaaaaaaaaabcbabaaabaaabbbbbaababbbbbbccddddedffceedb######aa###",
-"aaa#a####a##aaa##a.##acda#cejjfdbbbbbabcbaabbcbbaa#aaa##a#a###baecbdfedddefhhgefea#cedbafecbbcbecbbccbbbbabbbbbbbccabbcdcaa####################.#######aaaaca##########################.########a######aaaaccccbbca#a########aaaa####bedcaabaa##aaaabaaabc########..#figefhikjihhhhiijiihd##bbcdbcccbcccddebcbbbbcdbaaaaaaaaaaaaaaaa#aaaaaabbcbbbbbbbabbbbbbbabbbbbccddedeedffa###a#####aaaaaaa#",
-"###aa############a#.##bccbbbbehhaabbbaaabbabbcbaba#aaa#######becdda#fgecddeehghegdabdecaabedbcaacbbddbbbbbbcbbbbbbdbaaccccba#########a################aaaaabcaba###############################a#####.###aaaabccbcb##a######aab##a###accbca#b#####aaaaaaaaa###.####...diihiiihfgeffeffhijid##ddcdccccccddddccbbaabddcaaaaaaabaaaaaaaaaaaaaaabbcbbabbababbbbbbbabbcbccdddedefc.##########aa#aaaa#",
-"#aaaaa#aaa##a######.#abbccaaaabgfb#ababa#aaaacbaaaaabbbab####edeefeccgedcddehhfacebadecaaaabcccbbbbcbabbbbbcbbcbccccccabccdb#######abb###a##############aaaacbccba##########a######.########a###a#########aabcceccb###a#####aaaa##aaaaacbb##ac######aaaaa##aaa#######..diihffffffdeddddefiigaaeddddbbcdddccdccbaaabcedbbbaababaaaaaaaaaaaaaaaabdcbaabbababbbbbbbbbbbbcceeegc.#############aaaaaa",
-"aabcbbaaaaaaaa########bbcdbaaaaaffa#aaaaa#aaabbaaaabcdeddabaefcdddefcgfddddeghcccffddbaaabbbbbccbccdbcbabbbbbbcbbbbbdcabbbddb########bca#a#######a##a###aaaaaaabdbaa#aaa####aca##...###aa####a##a########aaabbbdecc##aaa############aa#abba##a#########aa#aaaaa########.bgiedcccdccccccccdhigdeeeeedcdddccbcebaaaaaaceebbbbbbbababaaaaaaaaaaaabcccccfedcbbbbbbbbbbbbabcfffe############a###aaaaa",
-"a#aaedbbbbaaa#a#######abddca#aaaadcaa##aa####aabababbbccccfggcbcccccfgeccccdddffedfecddcbbbbccbbccdcddbbbbbbcbbbaabbcc#abaacba########aa##..#######aa####aaaaa###bbaaa#aaaaa#cc###a.####aa##aaa#########aaabbbbadcdaaabba##########a#aa#bbaa##a#######a#aa#aaaaaa#######.ageccbbbbbbbbbbbcbehigffeedddddccbcccbbaaa#accdcbbbbbbaaaaaaaaaaaaaabbcbccdbaadfdcbbbbbbbcbcefccba#################aaa#",
-"#aaacbaabbcbbbaa#######abcca##aaabbcba########abbaaabaabccdcbabbbccbcedccccccccccccedbbcdbbbccbcbbcbcbbbbbbbbbbabbbbcccbbaaaaaa##a####a#aa####.#####aa##a#aaaaa##abbcaaaabbbabcaaa#.#.###aa#a##a########aaabccabbddbaabaa####.##.aaaaaa##bba##############aaaa##a########.#bddbbbbbbbbbaaaaabfhhgfeedddccbccbdabaaabbbccddcbbbbbbaaaaaaaaaaabacbbcceb#a#babcbbbbbbcbce##.####################aa#",
-"aaaaaa#aaaababba#######abcccb#a#aaacddb######aaaaa#aaaaabbbbbbbcbbbbcdcbcbccbccccddbababcccccccccbbbbaaabbbbccbdcbbbbabcbbaa######aa#aaa############aa#####aaaaa#acbabaa#baabbcb#a##.#####baaa#########aaaabcdcccccbaaaa##########abaaa###aa##############a####aaa########.##dcbbbbbbbaaaaaaaabghgffedccccccbbcabbaaabbcbdedbbbbbbaaaaaaaaaabaaabccdecbcabbbcbbbbbcbeea###aa####################",
-"aaaaaaaaaaaaaa##########acceeba###bbbcda#######a####aaaaabbbabbabbbbbcccccccccbcbbcdcbaabbcbcccccbbbbbcabbbbddegebbbbbbbcaaaaa#########a######aba#####aa#####abaaaabcbb#aa##abaaba#####a##aaaaa######aaaaaaacccccbccaa##a#######aa#aabaa##aaa####aa########a#aaaaaa###########addcbbbaaaaaaaaaa#fieeeddcccbbbbbaaabaabbaaabdedcccbaaaabaaaaabbaabbbcdebaaccbbdddcbbcdc#aaaa###########.########b",
-"aaaaa#aaa#aa#############abcdfdaaaabcdf###aaaa##a#####aaaaabbccabbaaaabbbcccccbcbabbccbbbbbbbbbbbccbbcccbbbcdcdedecabbbbaaaaaaa########abb##aa#aaabaa#aba###a#aa#aabcccbabb###aa#aaa######aa##aa######aaaaaaaccccdaba###########aaa#aaba#aaaa#aa##a########aca##aaa######a######cffaaaaaaaaaaaaa#ehfeeedcbbbbbbcbaabbbbbbbaadeeefedcbaabbabbccbabbdcbcaabdcccccceedffb##aa####################a#",
-"aaaaa###aaaaaa#####.####aabccfgbaabbcfeda##aaabaaaaaa#aaaaaaaccbccbaaabcccbbccbbbbbbcbbbbbbbcbbbbbcabcccbababccdeccbabbbbaaaaa#aa########aaaaaaaabedaa##a#aaabaaaaabaccbaaaca###aaaaaa#####a###aa###a##aaa#aaaccbbabaa############aaaaaaaaaaaaa#########a##acdaabaaaa############acecaaaaaaaaaaaaafhffeddcbbabbcbbabbbbbbbbaabbdeddfeddbabbbdcabbabbababbbcbcbccddffcdaaaa##a###################",
-"aa#a#####aa#aaaa#########abcdcfeaaacbdccfcbbbdddbbbbbaaaaa#aaaabcbaabbbcccbbbcbbcccccccccbbcbcccbbbbbcccbbabbacddedcaabbabaaaaa##aa########cb##aa#cfdaa##aaababbbbaaaabbbbaabaaa#abaaa#####a#bbaaaa##a##aaaaaabbccdaaaaa#####bb#####aa##aaaaaaaa############aabbbbaaaa##aa##########deaaa###aaaaabcgiggddccccccccabbbbbabbaba#aabcaacccccbbcdbaacbbabbbbabcbcdddd####abaa#a##a#a#aa############a",
-"aaa#####aa#a#aaaaaaa######abccdfa#bbcddbcccdcdaaccdecbbbbbbbaabccbaaabbcccbbbccbccccddccccccddccbbbbbbcccbbbbbcccdddbabbbabaaaa########.####bba##a#aca###aaaaaaaaaaaaaabbbaabaabaaabba#######ababba.##aaaaaaaaabcdcb#aaaa#####a##########aaaaaa#a####aaaa##.##abbba#aab#aba#aa#a#####cgeaa####aa#aabfiigdccccbccccbbbbaabbbbaaaaaabccbbccccdabcbccaaaaabbbccdebdbaaaaaaaaa#a######aaaaa#########",
-"#aa#a###aaa####aa##a#####aabbbbeb#abbceeba#a####aaaba##cdbbbcccdccbbbbbbccbbabcbbbcbcddccccccddddddccdcabbbcbccbbbddcbbbbbbbaaaa#########.####aaa####a#a#aaaaaaaaaaaaaabbbbaaabaaaaaaba####a#.a##ab##.a##a##aaaabbddb##aa#####aa######.##aaaaaa#aa####a#aaa###abbb###acaacaaaa##a#####bff###a##aaa#aacghhfccbcbcbbcbbbbbbbcaaaabababbdccccddbbccccaaaaaabbccee##aaaabbacaaaa######aaa#aaaaaaa###",
-"#aaa##########aaaaa########bbbbbea#babcea#a######aaa####bccddcddedcccccccccbcbccbbbcbcddddcccbbbcccdefedcbaacbbcbbbbbbbbababaaaa############.###aa#a##aaa#aaaaaacbba##abbcbaaa#aaa#aa#########a#######a##aa#a#abbcbcc#a############aa####aaaaaaaaaa#######aa###aabaa##bbaaaa#a##aa######dea#####aaaaaa#behhdccbccacbbbbbbbcbbbaabbabbbcdcccdddbbbba#aaaaabbddb#######bcaaaaaa######aaaabbbaaaaaa",
-"aa#aa##########aaa########aabbbbbedbaabddcb#aaaa#aaaa####cccaacdeeggecccccccbbabbbbbbbbccddcccbbbbcbcddeedcbaaabbabbbbcbbbabaaaa###########.#####aba#######aaaaaabbba#aabbbbaa###aa##a#####.#a#.#.####aa##aa#aaabccbca#aa#..########a######aaa##aaa#########aaa#aaaaaabcaaaa##a##a###a#a#bdb#aaaaaaaaaaabcfhfccccabbcbbbbcbcbbbaabaabbabcddcdcccbba##a#a#abddb########aaaaa#aaa####aaaaaaaabbaaa",
-"aaa#aa##########aa#a#a#######abbabgebaabacca#ba#aaabaa#########a##bdeddeedddcbbbbbbbcbabacdddcccccbbbcdcdcdcabbbbbbababbbccbabaa###############aaabb####aa##aaaaabbbaaaa#abbbaa###aaaa###a###a##....###a##aa##aaabbbca##aa#.#######aaa##aa######aaa#########abaabaaaaaacbaaaaaa##a###a##a#afb##a##aabbbaaaaeggecebcbbbabbbcbbabaabbbbbbabbdddccccccabaaaaaaccc#####a#aaaa#a#####aaaaaaabbbaaabaa",
-"aaaaa############aa#a########.#abbcffcabbceccaaaaaaaaa###a###aa#######aaeebccccccbbbbcbbccbdddccccccbbbccbbbbbbbcbbabbbbbccbbbbaaa########.#aaa#a##aba#aa##aaabbbabbbaaa###abaaa#########aa##a############aa###aabcc#aa#aaa#######.##aaba#aaaaaa##aaaaa######baaaaaaa#aaaaaaaaaa###aaaaaa###ebaaaaaaaaaaaaabbfhgedbbbbbcbbbbbbabbbbbbbabbbbddecbcbbbbbbcbbbceaa#####aabca#a#a#a##a#aaaaaabbbbbaa",
-"aaaaaaa####aaaa#aa###########..#aabdddbbcccccaaaaaaaaaa##a##aaa###aa#####eddedddcddccbccbccccbbcbbcedbbcccccbbbbbbbbababbbcbbcbaaaaa############a#a#aa#aaaaabbaabaabaaa#aaa#abaaa#######aaaa#a###########.#aab##aacc#aa####a######..##aa#aaabbaaa##aaaaaaabbaabaccbaa###aaaaaaaaaa##aaaaa##a#ccbaaaaaa###aaaadgggfeababbcbcbcbbaabbbbaaabbbccddbcbbbbbcdccccca#a#a###aaaaaaaaaaaa#aaaaaaababccba",
-"aaabaaa#a#######a#aaa####aa###.###bcdcbcbabddbaacbbababaa#a##aaaa#aa#aacdccbddddddbbbbbaa#aaa######bfggfdcccbabbbbabaaabcbccabbaaaa#########a#aaaaa#######aabaaabbabbaa####aaaabaaa##aa##aaa#b####.#########abb#aaee##a###.##.##.###..####abccccbaaaaaaaaabcdaabbccba##a#aa#aaaaa#a#aa#aaaaaaaabebaaaaa#a##aabbfghhgedaaabbbccababcccbbbaabccbcccbbcbbcdcdcaaa########aaaaaaaaaaa#aaaaaaababbccb",
-"abaaaaaaaaaa######aaa########aa####bbccbbaabceaa#cbbbbbba#a##aaaa#aa###debacb#aacabaa##aa###########.#afhgeecbccbbbabaacbcccbbbbbbaa#a#########aa#aaaa####aaaaaabbbbbbbaa###aaabbba###a##aaa###.#######ba##aaadbaabeaa##aa#..###.##########abaaabdbaaababababbaabddbaa##aaaaaaaaaaa#aaaaaaaaaaa#aecaaaaa#aa#aaabdghhhfecccbcbbabbacccccbbbbbcbbbbbcbabbdcbcba########aaabaaaa##a###aaaaaaaaaabbb",
-"baaabbaaaaaaaaaaaa###########aaa####acccbaaaabcbcabbbbbbba#####aaaba#acbcaa#aaaa#abaa############.#####.dhihgeefccbbbbaabccbbbbbbaaaa##########a#aa#aa####aaa#aabaabcbbaa####a#aaaa###a#aaa################abbeebbbdd##a#######..####.######aaaaabcbbbbbbbbbbb#abcccbaaa#aaa#aaaaaa###aaabaaaaaaa#bcbaaaaaaaaaaaabehhhfedaaabaaabbccccbabbbbccbbabccbbbdcbbaaa#######a#aabaaaaa#aabaaaaaaaaaaabb",
-"bbaaaaaaaaaaaaaaaaaaa#########a#a####bbcbaaaaabeecbbaaabbaba###a#aaa##cedb#aaabaaaaa##a#########.##.###a#bfgedeffdccccbaaacdccccbbaa###########aaa######aaba###aabaabbbaaaa#####aa#a##abbaa####.##.####aaa#acbddddfega#a#######.######.##a#aaaa#aaaaaaaabccddebaba#bcba##aaaaaaaaab#aaaaabbbcaabaaaaccaaaaaaaabaabbehhfgebaaaaaaacdcccaabbcbbcbbbbbcdcbbcaaa#a######aa#abbaaaaaa#abbaaaaa#aaaaab",
-"bbbaaaaabbbaaabaa#aaaa###.#######a####abb#aa#a#cfecaabbaaaba#######aaa#bddcdaaabaaaa#a#aa######.########ba.a####bfddcccbbacdccccccaa############aaa######adb###aaaaaaabaaaaaa###aaaa##abaaa#####..#####aaaaabbcdeedfgd#aa########.#######a##aa#aaaa#a###a#abeedecc##aaba#aaaaaaaa#bbaaaaabbbbaaaaaaaaaccbaabaaababbadgggfdb#aaaaaabcbbbbbbccccdcaabbcdcccbaaa#######aaaaaaaa##aa###aaaaaaaaaaaba",
-"bbbbaa#aaaabaaaaaaaaaba#a######.#######abbbca##acdedcaabca#a#.###a######bddcfcaabaaa##a##a#####...##aa####a####a#abbccddcbbddedccccbaa####a######aaa#####acb###aaaaaaaaaaaaaa###########aaa####.####a##aaaaacdeceeeedc##aa########..#########aaaaa##a###aaaaaabcdedcb##aa#aaaaaaaaacbaaaaabbbbaaaaaaaaadfdaabaaaabbbbcdggfebaaaaaaacccbbbbbbccdcccbbbdcecba#####a####abbaaa#######a#aaabbaabaabb",
-"bbaacbabaabaaaabbaaabbaabb#.####.#######abbcba#aabecdbaccaa#a#.##aa##a###acacecbaaaaaa##########..######..abaa#aa####aceeddceggeddccbaa##########a#aaaa##aaa##a##aaaaaaaaaaaaa#########aaa####a#aaa####aaaabbdffffgebca#ab#######.#..#aa######aa###aa####aaaa#baabbdcc##b##aaaaaaaaabaaaaaabbbbaaaaaaaabcegcabaababbbbabgfgfdaaaaaabbabbbabbbcdddbcbccccdbaaa#a##a###aaaaaaa#########abbbbccbaab",
-"baaabbaaababaabbaaaaaaaaaaa##############abbaa##aadd##abbaaaa#.##aaa##a####aabcbaaa#aaa###a######..####.#..cdcbbbaa###abdcdedfghffddcbba###########aaaaaaaaaaaaaaaaaaaaaaa#aaaa########a#aaa#####aaa#a#aabbccddghhhfcca#aa##########...##########aa#aa###aaa##aaaa#a#bb####aaaaba#a#aaaaaaaabbcbbaaabaaabbefdabaabbbbbbbbfgggfdcaaaaabbbbbbbccdbdbcbcccbcbba##aaaaaa###aa#aaaa########bbabbbbaaa",
-"aa#a#aaaaaaaaaaaaaaaaaabbabaa#######.#.####aaaaaaabdeb#aababaa####aaa#abba#####aaaaa###a##bdba##a######....acdbabbaaaa#####cddaeggffedcba##########aaaa###aaa#abaaaababaaaaaaaaa##a###abaaaa###.#bbaaaaabdcddeefhhifdda#bb#aa##aa######..########ab##a###a##a#aaaa#abaabaaa#aaaaaaaaaaaa#aaaababbbbaaaaaaabcffbbbabaabbbaacefggdba#aabbbbcbacddccecbbbcccbba##aaaaaaaaaaa#a##a#a#######aaaabaa#a",
-"ba###aaaaa#cbaaaaa#abababa#a################aabbbbbbbea#aaabbaa#####a##adc##aaaaaaba##a####a########.#####...aca###########.####cffdcdecaaa#######aaabaa##aaaaaaa#aaabbbaaaaaabaaaba##babba######accbbbbbfccdeegdgfggeb#dc#####aaa#####...#######aaaa#aa##a#aaabaaa#bbaaaaa##aaaaaaaaaaaaaaabaabbbbbaaaaababbegdbbaaababbaabffffecb#aabbbbcbbcdddecbaabcbaaba#aaaaaaaaaaaaa###a########a#abbaabc",
-"a#######a###aa#abaaaabbccba###.##############abcbcbbcbea#aaaaaaa#######.##ba#a#aa#a#a#a##a####.###########..###ba##############a#aeedbadfcdddcbb##aaaaaaa#aa#aaaa#aaccbbbaabbbbbabcbbcdccb######abcdbddeeefddddb#afdcfebdca#####aaa######.#####aaca####abaa#aa#abcb#accaaaa##aa#aabbaaaaaaaaaaaabbbaaaaaaabbbbbgdbaaabbbbaaaccffgfdcaabbccccccddddfcbaaaaaaaaa#aaabbaaaaaa#a#aab####aa##aaa#bcc#",
-"aa###########aa#aaaaabbabbaaaa##..###########abdcccccbcdcaaaaaa#a##########aabb#abaa##########...#.########.######################.bfdaaccefddddbaaaaaaaaaaaaaa#aaababcccbbbbbccbbcddcabca####aaacdcabeggfdda.##.#cc#aefdbaaa###aaa###.##.####aaaaa#a###abd##a###ababbdc#aa#aaaaaaaabaaaaaaaaaaabbcbbaaaaaaabbbbgfbaaabbbbaabbbcefffddbabbcdccccedcabaaaaaaaaaaaaaaaaaaaaaaaaaaa#####aaa#aaaaaaa",
-"aaaa##########a######.#a#abbaa##########a####abdedcccccccba##########a######aaaa#abaaaaa#######..################aa#aa###############ddabedcgededbbbaabbabaaaaaaaaaaabbccccccbccdddba###abacbbcccba####aaaaaaaa##.###acfcaaa##aa#a############aa#####a#a##aea#aaa#aabbcda##aaa#aa#aaaaaaabaaaaaaababcbaaaaaaaabbbgfbabbbabaabcdcbdefffdbbcccccccdda#aaaaaaa##abaabbaaaaaaaabbbaaaa####a##aaaabaa",
-"aaaaabaa#######a###a##.###abbaa###############acdeccbbccdga##########a######.#aabaaaaaaaaa#a############.###aa###aaaaa###############.cdbbdefhhhfdccccbbbaaabaaaabbbbbccccdddcdccdb#####bbcbcddba####aa####a#a#####.##aedaaaa###aaa#######..#########a###a#bbbbbaaabbbbaba#aaaaaaa#aa#aaaabbaaababbabccbaaaabaabbbggdabbbbcbbbddcbcbdffdcaccccacccd#aaaaaaaaaa#abbbaaaaaaaabbabbabaa#aa####aabaa",
-"aaaa#aaa##########a###.##aaaaaaa####.##aa#####abccdcaabccffa##########a###aa####aabaaabaa#aaa####a######..###a#####aaa############aa###bdddeeddfgfeeeddcabaaabbbbbbbbbbcdddddeeeecaa####abbaaaa#######a#a########.###aaadaaaa#####aa########.#..##.##a######aaabbba#bbca##a###aaaaaaaaaaaabbaaaabbbaabddcaaaaaaaaabfgdaaabbbabdacdbcbdfffdbbdccbc#cbaa##aaaaaaa#aaaaaababaaaa#abbaaaaa#aaaaaaa#a",
-"###a#aaaaaaa######accbaaab#####aaaa####a#######accccabacccfe##.############aa####aa###aaa#aa####.#########.##########a############abca##bfcfabbbcaafffffdbbbbbbbbbabbcccdeeedefcaaaaaa##aaaaaaaa################a#.###abbcaa#aa#aaaaa#######....########aa####a#abba#bbbbaaaaaaaaaaaaaaaaaaabcabbbbbbabeedaaaaaaaaacfgecaabbabbacdbabcffffccccdda##aaaaaaaaababaaaaaaabaaaaaaaaaabaabaa##abb####",
-"a########aaa#######cddebba########aaaaaa#######abccccbabcdefea#.########aaaaabb##aaa#####aaa##.....#.##.##############a#####.#####aabcbaabfc######.afggggcbbbcbcccbbbccceeeeffhgccbaaa#aaabbaa#a######aaa########a#.##aacdba##ab#aabb##.#.####...########aa#####aaaaaaaabbaaaaaaaaaaaaaaaaaaccbabbbbbbabefdaaaaaaaaabeffabaaababdedabbcfffecccddaaaaaaaaababaaaa#aaaabbbaaaaaaaabbaaa#aa##ba###b",
-"#####aa#####aaaabbaaaacdb.#a#########aaa########abcbbbbbcdeeeefc.######aaaabaacbaaaaa##########..#..#....##############a###########abbbba#bd#a######aabbcfedccdddccccdddeeeeefgiedeebaaaaaabaaaa#aaaaa#aaaa###########aabcca##aabaaabba#....#....##.###.#aaa#######a#abaabbaaaaaaaaaaaaaaaaaaddbbbabaabbbddaaaaaaaa##adfecbbbbacddedbbccdffdccddaaa#aaa#bbaabca##a#aaabbaaaaaaaaaaaabb#aaaa###a#",
-"####aaba######aa#abbaaaba###aa#############.####aabcabcbbdegfebc.########abbbaaaaaaaaaa#########.....#.#.######.#######aa#####.#.##aaabbbbbc##a#######..##ehfeeeedddcedeffeeeeehf#abcecccbabbbbbaabaaaaaaaa########a###aacdba#aaaabaaaaa#..##..##.#..####aaa##a####aa#aaaabaaaaaaaaaaa#aaaaaabeeccbababbbbbaaaaaaaaaaaabcffbbbbcdccdcbbbcdfgfedcabaaaa##bbababa#####abbaaaaaaaaaaaaaaaa#aaaaaa##",
-"#a###aabaaaa###ba###ab##ba###a#############..###aaabcaabbdedefgb####aaa###aaaaaaaaabaaaa###########...#.############################aabbbadcaaa#####.######bfhhgggffffffffeeeefhhcaa##acfffeedddbaabaaaabaa########a####abebaaaa#a#a#aa############.###..#aa##a###aba##aaaaba#aaaaaaaaaaaaaaaaccdcdcbbbbabbbaaaaaaaaaaaaacfeaabbbbccdabccbdfffed#aaaaabaaaaaa#aa###aaaaabaaaaaaaaaaaaaaaaaaaaa##",
-"###aaa#aaaa#a##.a##a#aba#aa###########.#.#....####abcbbbbccdffegb...##aa###abaaaaaaaa#a#aa#######aaa###.####.#####################a##abbcfda#aaa###########.#acfhihhhijiiiihgfhhgcaaaa#..acccddccecccbaaabcb#######aa###abcdbaaaaa#aaa#aa##########.##########aa##aaa#aaaa########aaaaaabaaabbaaababaacbbabbbaaaaaabaaaaa#cefdabbbabbcbbbccdfggeb#aaaaaa###aaa#a###aabbaaaaaaaaa#aaaaaaaaaaaaaa#",
-"#aaaaaaaaaa##aaaaaaaa#aaaaaa##.###aa###.###...####aabdbbabbcfeced.#########aaaba#aaaaaa##ca#######aaaa######.########.########a#####aaabdhgfeaaaa#############.#aaba#addfghiiiiheb###aaaa###.####bdbcdcdcbbca##a##a##a##aabbdbaa####aaaaaaa#############a#.##aaaaaaaaa##aaa##a#a#acbaabbabbbaaaaaaaabbbbbaabbbaaaabaaaaa#a#bfgebaaababbbbbbbcggfeaaaaaaaaaaaaaaaa####aabaaaba###aaaabaaaaaaaaaaa",
-"a##ba#abaaaaaaaa####aa###bbaa##.#######b#####.#.###aacbbaabcdeccc##.########aabbba#a##aaa#bba######aaaaa#################.######aa##aabbfhhihdabaa##############aa######.##a#bgfb###aaaaaa########cbacccdfeecaa###aa##a#aaabcdbab##ababaaaaa##########aaa#####aaaaaaaa#a#aaba##aabfdaa#aaaaabbbabaaababdbbbbbbbbbbbbbaaaaaaa#dffcbaabbbbbbbbbcefgdba#abaaaaaaaaa#aa##abbbaaacba##a###aaaaaa##aaa",
-"aaaaaaaaaaaaaaaaaa#####a##aaaa########ab##.####..###aadccbbacdcaa###.######aabaaabb#aaaa###############aa#####a#####.##############aabbbehhhfcaaaa#####.########aaaa##aaa##a#.#caa####aa##########cdbbbbbcedefdcbbaa##aaaababbdbaaaaaaaaa#aba#########aa######aaaaaa#a#aa##aaa##addbbaaaaa#aaaaabaaaaaaccccdcbbabbbcbaabaaaaa#cfgdbabbbbabbbbbcfgedda#aaaaaaaaaab#a##aabbbaaaba#aa###a#aaaaaa#aa",
-"aaaaaabaaaaaaaa#accb#########babaa###aaa##.##a##.####abcbccabdeaaab#..######aaaaaaa#####################aaa####a#####.############aaaabdgihgcbaaa################aaaaaaaaa#aa###a######a##########dbaaaaaaaacbcefgfddcccddegdcbdbaabaaaaaaaaaaa######aaa####aaaaaaaaa#############aaaaaaaaaaaacaaaaaaaaabbbbdeccdccbbbbaabaaaaabefecbbbabbbbcbcegededcaabaaaabaaaaaa##aabbbaaaa#aa#aaa#bbaaaaa#a",
-"a##a#aaaaaa###aa#bbcbaa##aaa#aaaca##abb########a#####aacbbccbdeaaaba#########aaa##a#a####.################ba#########.##..######.bbabaaehhhgbaaaa#################aab#aabaa#aa###a##########a.###.ab#aa#abababbbcbcdcaacecccdefdc##abaaaaa##aa########aaba#aaa#a#aaaaba#a#aa#a##.##abaaaaaaaaabbabbaaaaaaaaaaccbbbcdbbbbaaabbbabbdgfdbbbabcbcccdddeeedcaaaaaaaabaaaaa##aabbaaaaa##aa####aaaaaaa#",
-"####aaaaaaa######abbcca##aaaaa##abbabba#a#####aaa######aabccedfaaaab#########aaa###.#######################b########.#ba#...##.#acbccccfgggebaaaa##a###############aababaaaa#a##a#a####a##a########c#aaaaaaaabbaaaaabccdebabbbdgeaaabbbaaaaa##a#######aaab##a##aaaaaabaaa###aaaa####ba#a##aaaaaabbaaaaabbaaaaacbbbcbbbcbbaaabbbbcbcfgecbcbbbccddccceddccaaaaaa#bbaaaaaaaaaaaa#aaa##a#aa#a#aa####",
-"##a###aaaaa#######aaaaaaaaaaaaa#aabbcaaaaa#a###aa########aabeeea###aaa#######aabb#####a######.#######aa##.######aaaabedccbbb##bbbbaabbbbccdeaa##a##a########aaa#####aabbbba#a#aaa#a####a###########caba###ababbbaabbabcdcddcbabehcaaaaaaaaaa############ab##aaaaaaaaaaaaaa#baaaaa###bb#a##aaaabbbbbaaaaabbbaabbbbcccbabbbaaaabbccccbfffcccbccccbccccddeedaab#aaaabaaabaaabaaa###aaa###bb##a#####",
-"aaaa##aaaaa#aa#######a#abbaaaab######aaaaa#aaaa#aa#######aabdefb#aaa#bc#######abcb#####a#################aa#a..###aabcdfffggfdcbbbbbaaaaaabdeaaa###########aaaa#####aabbbbbaaa#aaa#####aa#a##.#####aaaaaa##abaabcbbbaaabaabbbbcdefaaaabaaaaaa##a######aaa######aaaaa#aaaaaa##aaaa###aa#aaabbbabbaabbaaaaaaaabbbbbacccbaaaaaabbccdccdefegffdccecbccccdeeddcbaaaaaaabbbcbaaabaaaaaa#######aa######",
-"#aaaa##aaaa#############abaaaaaba##aaaaaaaabaaaaaba#####a##abdgca#aaadeb########bba#####aa#aaaaaa###aaa#ab#aa#.###.#acfhfddgccbaa#aaaaaa#abcfaaaa#######aaabbaaa#####aaaaaaaaa#aaaaa#aaaa##########aaaa#aa##aaa#acccabaaba#a###acdbaaaaaaaaaaa###a##.##aaaa###a###aaaaaaaaa###aaaa#abb#aaaabbbbbbbabaaaaaaaaaacbbbccbbbbaabaaacccccdfdbdfgeefcddabccbcedddccbbaaaaaabbbababbaa#aaaa#a##ab##a####",
-"##aaaa#############aa#####abaaabda##abaaaababbaaaaba####aa#abbdeaaaaaadf###############a#aaabbbbba#aa#aaaa#baba.#accbffffgddcbbaa#####aa##acfeabaaaaa###aabcdcbba######aaaaaaaaaaaaaaa#aaa##########dbaa########bbdcaab#abaaa##abceaaaa#a#aaaaaa#a###.######a#####aabaabb#aa#####a#bcbaaaaa#aaaabbbbbaaaaaaaaaaccccbccabacaaaabceeeeggdcdfffccccca#bbcbddeccccca#abbbbbbbaaabaaa#a#aaaaab#######",
-"##aaaa####.##########baaa##aaaaabda#aaaabbaaccbaaaa#####aaaaabbcbbaaabdgfe###aaa#######a##aaabbabbb#a#a#aabdceeedcabcaeddcfhecdb#########aacdhcbccbbbbbbbbdehhedba##aaaabbbbbaaaaaabbaaaaaaa########cba#######a#abbda#aabcbaa##aabceaaa######aaa##aa########aaa##aaaaaa#aaa###.###aabaaa#aaa#aa##abbbaa#baaaaaaabbbbbbdbbabaaaacaddacbbbbddccccbbda#cbbcdcddeccccbaabbbbca#aabaaaaaaaaaaaaa#####",
-"#aa###a####.##########aa#a##aaabaccaba#aabbaccbaaaaaaaaaaaaaabbccabaabeffeebbcb#.####.#aaabbaabbccccccccdddcec.#aaaaaaadccbbcccca.#######aabdhecdddeeeddeefecbbeedcaaaaabbbbbbabbbbcbbaaaaaaaaaba##aba####a####aacdccaa#ccbbaa##aabcdaa########a##aa########aaaa##aaaaa##aaa#########aaa##aa#aba#aabbbaaaaaa#aaaaaabaaaccbaaaaabccababbbb###bcbcbbecabbccdcddcdcccaaababbbbaaaaaaaa#aaaaaaaaa###",
-"#aa#aa##########a######a#####aaaaabc#abaaaabbcbbaa#a##aa#baaabbbbbabbcfffgghebdcbbacacbbbbbbbcbccdccfdaaabdedcaaabaaaaacccbbbbbbcb########abcfgedeffeeeegfcbbcbadgdddaabbbbbbbbbbcccccbbaabababbbaacbaa#########abcccbabccbbbaa##aabcb#a#######aa######a#a##abbbbabaa###a#aa########.bbaaa#aaaaaa#aaabbbccbaaaaabbbbbbbaaaaaaaaabbbccccaaa###bcdbabcbbbabcdddcbddccbbaaaabcccabaaaa#aabaaaaaaba#",
-"#aaaaa#######a####a###aa##.###aaaaabc#abaaabbcbba###aa####a#aaabbbaabcdcdeccdecccccba##aaabbaaaaaa##beaaabacfdeaabdecb#bdcbbbbbbaca#######abcdegeeeeffgfdabbccddeehhhfdbbbddeeccdcccdccbbbbbbcccbcca##a###a########aa#.aceccbbaa#aa#acb###.#####aa#####aba###abcdcbcbaaaaaaa#####a###bc#abaaaa#aaa#ababbbbccbaaaaabbcccbcbaaaaaabccdacccb#a###abddbbbbbbabbcebcbbdcccbbaabbabcabaaaaabcbaaaa#aaa",
-"aaaaaaaaaaa####aa#####aaaaa.###a#aaaccaaabaabccaa##aa#######aaaaaaaaadc##abaaaaa###a#######a#########cb#aaaacdddb#bbdda#becbbbbbbac#######abceffhffffda##babcccdeeddbddeecdcdebdeeccdddeddcccdeba#b###aa##a#########a###bedbbbbaa#a##aca###.#####aa####aaa####bbcdddbaaaaaaaaa#######adbbabaaa##aaaaaaacbabbccbaabaabbccccaaabbcbdcbcecccaa#a#a#adcabbbbbcbbcbccaabccdcbbbbcacbaabbaabcbaaaabaab",
-"bdbaaaabbaaaa#aa##a#aba#############abcaabababcba##aa#########aaaaaaabdb##aaaaaa###a##################b####aaccdeaabcbbaaeddbabbbabb#######bdfhghhgda###aabbcccecbbbdcccefdbbcbcb#eefgghggfeegdaa##a###aa#######aaa#####bedcabbaa#####acb##########a##aaaa####acbccccaaabaabbbba####a##dbba#aaaaa##aaaabdababbccbabaabbcddcbacbbccdacdbba#####aaaabcbbbbbbbccbbababbcddcbabbbabaaabcaaabaaacabaa",
-"aacdbaa##.##a##aa#aa#aba###.#########abca##aabbbca#..###########aaa##aab######aaaa#########aaa#a###aa#######aaccdfbabbaaaeeddbbcbbbdbaa#abcdfhjigca######abccbadb###cfbcbbecabbba#begfhggddcggdbbaaa##############a#aa#.cddccbaaaa#####ab##########aaaaaba####accbbbbaaabaabbbabb#######aba###aaa#aa#aaabcaaaaabccbabbcccdedcbdbbacdcdccaa##a#aaaaabcbbbbbacccbaaaabaccccbaaaaaaaabbbbaaaaababba",
-"aababbaa#####a##a##a###a####.##########aba###abbbbba####.#.#######a###aab######aa#a#########aaa#####aaaaa#####bbceebbbba#ceedccedcegdcbcddedbcbed#######aabccdbdda##adeeb##abbaaaaacbadeddfdghdcbbbaaa###########abbbcdbbdcbbca##aa#####bd###.#.###aaaaaaaba##abbbbbbbaaaaaaaabbaaa#######aa###aaa#aaaaaabcaabb##abcbbaabcedccdcbaaccccba####a#aaababcbaaaabbccbbaaababccbaa##aa##aaabaaaaaaabaa",
-"aabaaaaa#a#####a###aa##########..######aaba####aaaabb#.###############aaab##.###a#a#######aaaaaaaaa#a#aa###a##aacdceddfgfcfffgdccdeeefggdbaabbbbdcaa###aaabbcddeb##a#adfeaaaaaaaaa#bbaaccbeedhecbabbaaa#########.adccbcdbdbbcbba#######a#cda########abbaaaba##abbacbbaabaaaaabaaaaaa########aba##aaaaaaaaabcaaa#a##abca#aaabdefecbaadbbbaa##aa#aaaaaabdcbaaaaabcbaa#aaaabbbaaaaaaaaaaaaaaaaaaaaa",
-"aaabbaaa#########a##aaa###########.##.##aaaa#####aa#cba################abcb.####aaaaaa##aaaabbabaabbbaaa##aaaaaccgghggecdfihhg#a####a#a#abbccccacdcabbbbbacccdfeba#####aaaaaaa###a#ababbccadcgedccbaaa############ccbabccbcacabaa#####a#bacd###.####aaaaaaa###aaabbccaaaaaabbabbaaaa###.##..#bbb###aaaa#aaaaaaa########a#aabccceecbbdbbbbaa#aaaaaabbaadccbaabaabba#####aaaabaabaaa##aaba#aaa#aaa",
-"aaaa#aa##############bba##########..#.############aaaaaa#####.##########abca..####abaaaaabbbcccbbccddbbabbbbbcdefebdfd##a#.bedaa#########aabbbcbcddddcbbbcdeffd#########aaaaaaaa#aa#baaabcbacegedbbaaa##########bcdbaabbcccbbbaaaaa#####abbcca####.##aaa####aaabbcccdbaaaaaaabaaaaaaaa####.###abba##aaaa#aa##a############aaaa##cfebdcabcb###a##aaaabbabacbaaaaaba#a####aaa#aaaaaaa####aaaaaaaaa",
-"abbaaaa####a##########aa###################aaa####abaa#a################aabc#.#####aaaabbbcdddcdfffefgffeddfgdcdcb####aaaa###bb#######a##aabacdcddbdccacdefecc#a##a#####aaaaaaaaaa##aaaaabbbabfgdcbaa########aaacbbbbabbbbcdaba##a#####a#abccda####aaaaa#aaa#abaaaccbbbaaaababbaa##aaa#########bbba##abaa#####aa#a##aaa#a###aaa##defdcabbbaa##aa#aaaabbbaaccaaaaab######aaba#aaaaab####abaaaaaaa",
-"aaabaaa#################abba###############aaaaa##aaaaa#a###############aacaca.#####aabbbbccddfda#adeca#####b###aa#aa#aaaa##aaba#a####aa#aabccdccedebaacccb####aaaa###a###abaaabaaaaa#aaaaaababdgdbb##########cabbdbbbaaaaaccaaaaaaa##aaa##acdc#.#aaaaa##a##aabaa#ccaaabaabbaaacbb##abaa######..abca##aaaa#####aa#aaaaaa######abaabdggcaaa#aaaaaaaaaaacba##bbaaaabba#aa#aaaaa##aaaba###aa#aaaaa#",
-"#########.#################aaaa#.#.##aaa###aaa##aaa##a##aa###############abbbba#.##.#aabbbbcefc####...#####aa#####aa###aa####aa#######a#aaacbacbbdddbbccdfecbcc###aa####aa#aaaaaa###aaaaaaa##aaacfdaaa#####aaaabbabbbbaaabbabbaaa###aaaaaaa#abce..##ababc####aaaaabdaabbbbbbaaabbbaaa#a##.#######abaa#aaaba##aaaaa#a##aaa###aaa##ababehcaaaa##aaaaaaaadc####abaaaaaba###aaaaaaa###aaaaa#aaa#####",
-"####a######################aab#....##aacaaa#aabbaaaaa#####a##############aabbbcb##.###abbcceca###################aaaaaa#a#aa##a#aaaaaabaabbbbbacaaabbabaafddcbcb###aaa#aab##aaaa######a#######a##cfeaaa#####abcbbbbaaaaaabbabba###aaaaa#aaaabaaee#.##ddaaa####aaaaacaaabdcbbbbaabaaba#aa##.#######aaaa#aaabaaaaaaa##aaa#a##a#aaaaaaabbcgebbba#aaaaabaabbaba###aaaaabbaaaaaaaa#aaa##aa#a##baa#a##",
-"####a##aa##################aabda#.#####bcaa#abaabaaaaaa###################aaabcdb.####bbbdea##########.###########aaaaa##aaaaa##aaabbbbcbccbbaaaaaaaabbbaaaacdcbbbaaaaaaaabaa#aaa################abecaa####aadcabcaaaaaaabbaab#####aab#aaaaabaaade#..#ca.#a####abcbbb#abbccaaabbbabbbb#a############aa#aaaaaaaaaacaa##aaa##a#aaaaaacabccfebbbbaaaaabbbbaaba####ababacbaaabaaaa##a#aaaaaa##aaa###",
-"#####aaaa###.#a######a#######aab##..####abbbbbbbbaaa#aaa####aaaaa##########aabddea.###abda#################a#########a#####aaa###aaabbcdcbdbbaaaaaaaaabbbaaaaacddcbaaaa###abaa######..############abeda###ababbbccbaa#aaaaaabaa##a###ab#aa#aaaaaacec##ab.########babbaaaabbababababbcda###############a#aa###aaabcbbaaaaa###aaaa#ababbcdcdecaabaaababbaaa#######aaabbbbaaaaaabaaaa######a#aaaaa#",
-"a#######aa#a######aa#a#aaa###aaac#########abddccbbaaaaaaa####aa#aa########.abehghhc##abca##aaa##################################a#aabccb#aabaaaaaabbbaaaaaabaaabbbdba#aa###aaa##################aa#abefccaabbbcbabbaaaa#aaaaaaaa#aa###abaa##aaaabbcfdaba.#a######bacc##aaaabaababaabcbca##.#####a#####a#aaa#####aaaaab##aa##aaaa#aaaabccebbffbaaaaaabcaa###a#####bbbbbbbaaaaabaa#aa######aa#aa#a",
-"#baa#aaaaa###a#a#aaaaaaa####b#aaba#########aacbdcccaaa##a###aaa#aa##########bbfikjicacc###aa#aaaa#############a###################aaabccca##aaaaaabbaaaaabbbbaa#aabcbbaa####a#################a#aabaabdfbdcccbbbbbbbbaaaaaaaabbaaaaa#a#aaa#aaaaaabbcfdbb#######a#aaac##a#ababaaaabbcdaaaa##########a#aaaa#a#aa##a#aaaaaa#aaaaaaaaaaabbccdcaaegcbaaaaacaa#####a####bbbbbbbaaaabba##a###aaaaaa####",
-"####aa#aaaa##a#aaaaaaaaa##a#####aba##########aadcbbba####a####a#aa##########abcdfhiigc#a##aaaaaaaa#aa#####################a#######aadccccaba##aa#abaaaabbbcaabaaba#aaaaaa####a###a#a###.#####acbbcbaabcehfdccccbbbbbbbaaaaaaabaaaaaabaaaa###a#aaaabbcddca####.#####aa##aaacbabbbbaabcba#bc############aaa##aa##aaaaa#baaaaaa#aaaaaaaabccdeba#cgfbaaabca#a###aa#a###bcbbbbbbaabbba##b###aaaa#a###",
-"###a#aaaaa#aa######aaaaaaaa######aaaa#######a##aaaa####.###aaaaa#a###########abacdhiiga##abbaaaaaaaa##############a########a##a##abbcabc#abbaaaaaaaaaaaaaacaaabaa###a###aa###a###aaa########bbbbcbbbbddceihebbcbbbbbabbaaaaaaaa#aaaaaab#a#####aaaabbcccfb#.########aa##abaaaaaaabbaaaabbcbc#####a######ba##aaa###aa###aa##abbaa#aaaabbbdcccbbabdhebcbaaaaa####a#####accbbbbcbaacba#aa###a#aaa###",
-"#a####a#aaaaa#aaaaaaaaaaaaaa#######aba#######a####ab########aaaa##a#a##.#..#####aehhjihb#abacba#aaaaaa############a#a########aa#aabdcc####abaa##a##aaaaaa#ababa#a##aaaa#######a#aaaaaaaa##aacaabcccbcbabbcghgdbbabbbccba##aaaaaaaaaaaabaaa####aaaabcbcdccaa#########.##aaaaaaaaabababbabaa#######a#a##abbba#a######a###aa#aaaaaabbaabbcdbbbbabbadffbbaaaaaa#a##a####aabcbbbccabbabaaaba##baaaa##",
-"##aa###a#aaa#a##aaabbaaaaaaaaa##aa###a#############bba#.###aa#aaaaaa#######.####adfehjif###aaaaaaaabbaaa#a########aaa###a######abbbbcca.###a###########a###aa###a#############aaabbbbbaaceb#aaabbbccbaaabbbdggdcbbabbbbaa###aaaaaaaaaaba#aa#a###aabbbbcdc#####aa#######aaaabbbaaabbbbbbba#aa#######a##aabbaa#######aa###aa#aaaaaabbbbbccaaccbbbccdfgedaaaaaaaaaaaa##aaaccbcccbbccba##aa##abaaa##",
-"########a#aaaaa#aaaaaaaaaaaaa#aa#ba###########a####aaaaa#.##aaaaaaa##a#a########bbceeijfc####bbababaaaaaaa#########aa##a#aaaaabbadcccba####.############aaa#aa#############a##abbabbbaa##ceaaa#aaaabbbaaaaabbdgfbbbbbabba####aaaaaa#aaaaa#####a#aabbbccdccca#aaaa######aaaaababbaaabcabba##ba##a##a#aaaaaaaaa#######a#a##aaaaaaaabbbcccaabbddcaabbabdffdbbbaaa#aa####aabbccbbcbbddbaaa####acbaa#",
-"#######aa#a#aabbaaaaabaaaaaaaaaa##aa#a#############abaaaa####abb###aaa#a########babcfhiiea###acbbabbaaaaaaaaa####aaba#aaaaa#aaabaccbcbaa###############aaaa###a##############aabaaaaaa####bbbabaaaabbbbaaaabbbcffbbbbbbbbaa##aa##a###aaaa####aa##aabccefcadda##aaaabb#aaaaaaaaaabbbbbbbba##abb######aaaabbba###############aa#aabbcccbabbaabdccccaabacfggccbaaaaaa##a#aabccbbcaabdbacba####bbaaa",
-"aaa####aaaaaaaaaaaaababaaaaaaaaaaa#aa##############abbbbaaaaa##bbbaaaaaaa######ab#bccehiic###abcaabbbaaaa#aaaaaaaa#aaaaaaaaabcbccacba########.##########aa###############a#aaa#aa#a##a#####acbddcbaaabbbbbaaaabbefcbbbabaaaaaaaa######aaa###aa#####abcdghedcbbbbbcccdcbbaaaaaaaabbbbbbabaa#.acca#a###aaaaaaa########a##a###aaabbcdcaaaaaabbaccddaaaaacaadggfdbaaaaa#aaaaaabccbbaacbaababaaaabbaa",
-"aaa#a#####aaaaaabaaaabbbaaa#aaaaaaa###aa#######.#a###abbbaabbbbaaaaaaaaaaaa####a##ababchie###aabbbaaaaaa#aaaaa#aaaaaaaaaaaabccccbccb####a#############aa######.###########aa###aa#aaaa#a###abcccdbbbbaaaabbaaaabbceebbaabbaaaaa#########aaa##aa#####acdfdefebcddcbbdffdcbaabbaabbbbbcdbbaaa##abca#####aaaa#a##a#aa####a#a##aabbdedaaaaaa#aaccbeda#aabbaaaacefgfdbaaaa#aaaaabcccbccabaaabbaaaacc#",
-"##a##aa###aaabbbaaaaabcbaaa#aaaaaaa#a##########a#####aabbaaabaabaaaaaabcccca########aaacfhc##aaabccba#aaaaaabbaaa##abbababbcccbeecba#####a########a####a#a#####.##########b######a##a##aa###aababaaabbaaaaabaaaaaabdfcababbaaaa##############.#######bddcbdeffcbbba##dihdcbaaaaacaabbbdcaaabaa#aba#####aaa######aa##a###aa#abcdccdb#aa###aaaccdcbaaaaaaabbaaabehhebaaaaaaabaccbcbbbaaaaaaaaaaacb",
-"a##aa#####aaaabbbaaaaaababaaa#abaaa#############.###aaaabcaabaaaabbbbacdedaaaa######a##bccdccaaaaaacdcaaababbbaababbbccbcbbcdcceedc####a##a###########a#aaa######..####.####.###aa######abbaaaabaaaaaaaaaaaaaaaaaaaacfeedbbaa############.######aaaa#abbaaaaccbabaaa###igdccbbbaaaaaaabcbabcbcb##a######a####a#aaaaa####aaaacb#abdcaaa#a###a#acddcbaabaaaaaaaaadfhhedaaabbabbcccbbaaaaaaaaaaaaaa",
-"ba##a##a#aaaaa#aaabaaaaaaacaabcbaaaa#aa#########.#########aaaaaa##ababdefcab#aa########aabdfgbaaaaaacdcaaabaaaaabbbbabbcbbbcccddaaaa####aa#aa########a#aa#########..##.##..###.###aaba###aaaaa#abaaaaaaa#aa#aaaaaa#aaaegdcbbbaa###########.######aaa##aaaaab#abaaaaaa#.febaaabcccbcbbcbbaaadbcecbaa#####a#aaaaa###aaa#aaaaabaaaabccaaaaaa#aa###adbbbcbbaaaabaaaabbchifbabcccabbccaacbaaa##a#aaba",
-"#ba########a###aaaaaaa#a#aaa#abaaaaabaa##a#aa###############aab####aaaaabccaaa##a#.#####abcdfb#aaaaaaaaabaabbbcbbbbbababbcdddfedcb#a##aaa#aaaaa###aaaa##aaa##.######.###.###########a#########aaaabbaaaaaaa###aaa##a###bfedcbbaaa############a####a######a#aaabcbbbaaa#gdaaa###bcddcecccca#addefgfddca###a##aaaaaaa##aabaacb####bbdcaaaaaa#aa###ccbbbccbaaaaaaaaabaadhieabaabbccdcbabbaa#####aaa",
-"#aab####aa###aaaaaaaaaaaaaaaa#aaaaaaa#####aaa#a##.############aa#abaaaaaaabaaaaa########abccdfcaaaaaaabbbaa#abbcbbaacabbbbcddecdcc####aaa#aaaaa#aaaaaaa##aaaa###..######.#####a########aaa#a####aaaaa#aaaaa########aa####dedbbbaaa##############a###a#####ababccbaaaaa#gcaaaa####bdebbbbbca#bddcbaabccaa##a##aa#aaaaaaabbaca####abdbaaaaaaaaaa#a#ccbbbbbbbaaabbaabba#adhgcbaccccccdccba######aaa",
-"a##aa#a###aaaaaaaaaaaaaaaaaaaaaaaaa#aa###aaaaa###.#############a##abababbaaaaaba######aaabbcddhcaaab##baaababaabaaabbabbbbcdddffeeb###aaabcaaaaaaaa###aaa#aa####.######a#######b#####aaacb#######ababaa#aaa##aa########a#aaeecbbbaa##################a##a##bbaabb#aaaa#cd#aaaaaaaace.aaa#bdccdcaaabcacbaba###aaaaaaaabaabccaa#aaabbd#aaaaaaaaaaa#bcccbbbcbbaaaaaaabbaabbhidbbcccbdeddaaa#aa#aa#a",
-"aaaa#aaaa##aaaaaaaaaa#aaaaaaaaaaa######aa#aaa####..#########.###aaabbbcbbbaaaaaaba#####aabbcccegcbaaaaaaaacbaabbaaabaaaabcccdeeffddaaaaabcbbbcfffecdcba#abb#############aa#a##acbbcba#bbaa########aabba###a##########aa#aaa#eedccbaaa#####a#a###########aaa#aaa#bcaaaaaafaaaaaaaaacfa##a#aaaba#abaaccbcbbccbaaaaaaabbbbbbaaaa#a#abccc#aaaaabaaaaaadcbbbcbcabbbbaaaaabaaccfjgbccbcccccaa##aabaa#a",
-"#a#aa#aabbaa#aaaaaa##abaaaaaaaaa##aaabaa##aa#a###.#.##############aabbbcacbaca#aaca#####aabbccdeedbaabbaaaabbabababaaaabbccdddffedffb###bbccefebccbdeda#aaabbaaa#######aaaaa###aabcca#adaaa#####aba#aaaa##aa################.cedcbbbbaaaaaaaaa##a######aa####aa#bbaaaaaadc#aaaaaabbee####abaaa#aa##abaaabbabdcccdcbbaccbcb##aaaaabbcdbaaaaababaaaacbccbbccbaaabbbbaabababadjiedccccbbbaaaa#aa#a#",
-"aaaaa###aaaa##aaaaa####abaa#aaa#a###aaaa######aa#################a##abbbcccbbbaaabba##.#aabbbbddedd#aacb#aaaaaaaaaaaaabbbccdddggffghecbbaabbbddabaa#aaaabaaa#bbbaaaaa##a##aba###aaabb##bbaa####aaaa###########a########.#####aaeecbaabbaaaaaaaaaaaaaa###aaa##a##aa###aaabeabaaaaaabchca###a#aa#a###a##aa####bca#abdecbcdbaaba#aaabbdcaaaaaaaabbaaaaccbbbccdbabaaabbbabbbabacjkjgfdccbaaaabbaaa##",
-"#a#aaaa###caa#####aaadb#aaa#aaaa#aaa##aaa###aaaa#a####a##a######a#a##aabbbbabba##aabaa##aaaabacdececaaaba#aaaabaaaa#aaaaccdeeefgeeefbcbbbcbbbcbaaaaaaabaaaaaa##abba##a#####aaa###aaaa##.#ba##.###aa############.##.#############dedcbaabbaaaaaaabaa###a###aa##aa#aaaaaaa#dbbbbbbbaacgg#b####a####a##aaabaaabbcaa#abacdcaaaabaaaaabbccaaaaaaaabbbbcbabcacccccbabbaabbbabcbbaaejklhfcbcbbaaaa#aaaa",
-"####aaaaa##aaaaabaaaaabbaaa##aaaa###aabbaa###aa#aaaa###aa#######aa#a##bcccaaabbaa#acaa###aaaabbcdcdcbaabaaaaaabaa##aaaabbccdfffghffdaabbaabccddbabaaaaaaaaaaaaaaaaa##a#######a####aaa###.aba######a#################a############bfedbaabbbbbaaaaabaa##a#########abbbba##dcbabbbaaabcgdc#####aabaa###a#bbbbbbbbbbaaabbcbbabbbaaaabbbdebaabbbaabcbbbbacbabbabbbbabbbaababbbbbghillgcbbbbbaabbaaa#",
-"###aaaaaaccdcaaaaaaba##aaaaa##aabaabaaab########aaaba####a###a##aaaaaabccbba##bbba#bca###aaaaabdcddcda#abaaabaaaaccaaabbbccefgfghffaaaabbaaabefbcbaaaaaaaaaaaabaaaa##aa#########a########aaa###a##############.##.#.############a#abdebabcdcbbcbaabba############acdea#abecbaabbbaabbdfc##aaaa#a#aaa##abbbcaba#adebaecabbaccdcbbabbcbdddbabbbabccccbbacbbbbbabccbbbbbaaaabcbcfijjkjfddcbabdebaaa",
-"db#bdccbbcb##aabbbbaa###aaabbbbaccaaaabca####.#####baba##a#aaaaa#aba#accbbbbaaaaaaaacbaaaaaaaaacccdccc##abaabbaaabdbabbcccdffffhggbaaaaabdbaaaababbaaaaa#a#a#aaaaba#a#a################aabaaaaa###########.#####...#####.##.####aaaa#bedcccaaaaabbaaaaa##a#####aaaaddaabdebabbbbbabbbbgcaa#a#aaaa###aaabdaddabaadcfdfgdacbaabcbbbcccbdcdffdacdcedccbbbacbbbbcccccbbbbabacabbdgigbbgjjedcbbbccaaa",
-"#bbbaaaaaabaaabbbea#aaa#abbbbabaaaaaaaaba#############b####aaaaaabaa###abbbbbaaaaaaaacbaaaaaaabbcccccdd##cbcbcaaaaaaabcdeffgggiigabbbbbaabcaaaaaaaaaaaaaa#aaa##aaaaaaa################aaba###baaaa#######.#####....#########.#a##aa##a#adfca###abbaaaaaaa#####a####bdbacfdaaaaaabbaacedfa#aa#########abefeddcccdebccfggfedaaccbacddecdccdeddccefddcccccccabaabbabaabbaabacbbhijgdbacfkjeedcba#a#",
-"###aaaaa#abbaaaaaaa#a####bcaaaba###a#aaaa######a####aa######aaababaaaa##aabbaaaaaaaaabcaabbaaaaabcbccccbcbaaaaababbcccdefgfgghkgbaabbcbccbaaaaaabaaaaaaaa#aaaa#aaaaaaaaa####a########aaabba#aaaa#####a#.###.######.#####.####.##a#abaaa#aaddaaabbaaaaaaaa#########aabgggfbaaaaaabbbabbcfea#a#####aa##afghhfggghhgccddffhfffcccbccdfgeeeceec#aabcddcdddccebaaabaaabaaacbbbb#ejhjgbbceceikibbceba#",
-"aaa##a#aabbabbaaaaaaab####bc#aaaa#aaaaaa#ab##aaaa##a#aa######aa#baaaaaaaaaaaaaaaa#aaaaacbaabaaaabbcccccdbaaaabbbbccddeeefeegjheb#a#aabaccdcaaaaaaabbabaa#aa##aaaaaaaaaaaa#######a###aaaabba#abaa####..###.###.####..#####.#######aa##ba#####bcbaaabbaaaaaa########abdfggebabaaaaaabbbbbchfaaa######abbfegggefgghgffeecefggfhheecdddeeefdcefcabaabccbaabcbcbaaaaaaabbabbbbbbfghggdbcbcbbgkjfbbecb",
-"#aa#a###aababbbaaaaaaac###.acaaaba#aba####ac#aba###aaaaaaa#aa##a#a########aaaaa#aaaaabbbbbaabbaaabbbccccebaaaabbccddddedegggfhbaaa##aaabcccaaa#aaabbbbcbaaa#####aaaaaa#aaaaa#####a###aaaaaabbdaaa########...##.###..########.#####aa#aba###a#accbaaaaaaa#######aaaaabccdeeccbbaabaabbbbegfgeca#####adefffefgggfghggfeeccegihijigedbccfeceddfeaaabcacbbaaabbaaabaaaabbbbbcbchgghfgdabbaa#bgkjgcdd",
-"d#a#a####aaaabbbabaaaaaa####abaabaaaaaaa###acdbaa#a###aaaaaaaa###########aa#a####aaa#abbbbbaabaaaaaabcbccdaaaaabccddeefefhgefgbaaaaaaabaabbaa##ababbaaabcca#aa#aaaaaa##aabaaa####a####aacba#bcb#aa#.####.#...##.##..################a########a#adbaaaabaa#aa##aaaaabbbcdeddddcbabebbcbbffeefdec##adeeefeffefghgghghhgfedfheabfghhfdcegecbbbbccaaaabcaaaaaabaaabaabbbbabbcdfffgffffabbbbbcabgkjec",
-"cdaa##aa#aaababbbaabbaaaa####bbabcaaaaaaa##.acaaaaaaaa#aaaaa#ba###########aaa#a###aaaababbaabaaaaaaaabcccdgbbbccccddeffefgfeffbaa###a#aaaaaa#aaaaaaabbbccaaabaaaaa##a###aaabfd#####aaaabbaba#aa########.###.##.###############################bacedcbbbbabaaaaaaaaabcccccddedddbbdeecdefeededdeeffdegffeddefgfgggggcb##abbca###bbefeefeddcdcbeeaaaaab#a###babbbbbababcbccfgfeeefegcbaaabbca#afkh",
-"gdcbaaaaaabbbaaabaaabbbbaaa###bbcbaa#aaaa#####a###aaaaaa#aaa#aaaaa##a#####a#aa#aa#a#aaaabbaaacaaabaaaabccdfgddddddccdfhhffddfbaaa####aaaaaaa##a#aaaaaabbdb#aaaaba#a#######aacegdbaa#aaabaabbb########.#.##.##..#...####.#######################babedededcbaaaaaaaaabccddeedefecfffeeffddddddeddeeeddeggfddeeffbaaaaaaaabdb#baa#a##cbdfeaaabbcdfbaaaaa####a##abbbbaabbbbdcgfgeeedeefabba#aaaaaabg",
-"gjgccbaaaaabbbbbbbbaacbaaaaa###aaaaaaaaaaa####aaa#####aaa##aaa#a#a#######aaaaaa##aaaaaaaabba#acaacbaaa#acccfgdefefcdecfhhddbcaaa#a#####aaa#aa###aaaaaaabbeebaaaaaaa####.###aaacdcbaaaa#aaabba#############.#.#.#...###########..###############aacddeeededceeedccefggfgggfedggghfdfecdddccccddeeeeefddfffddddbabbbaaaaabefcdb#aa##aaabcaaaaa#bdgb#abaa#######ba#bbaabaaeegfgfeeeecfcaaa#aa#aaaa#",
-"#bgifcbaaabbbcbbbbaabbbaba#a#aa##aaaaaaaa######aaaa##a#aabaaaaaaaaabaaaba##aaba###aaaaaaaaabbabbabaa#a#abcceffeecb#cddeeggcdb##a##aa##aa#########aaaaaaa#bedaaaaaa##########abaa#aaaaaa#aaabaa#####a####################..######.#a##.#########aabcccbcda##afgggffdbbbabdhheghifedddeecbccdcdefffeeffdfggfdbaaaaa#aababbacdddb#bb#aaa#a####ababbdebbbaaa####a#babbaaacddfgffeefeeddcbabbaaaa#aaa",
-"a##ehiecbbbccdccbbbbaabbaaa#aaa##aabaaaaaaa####aaaa#####aaba#aabcbbbaabbba##abaaa######aa#abbacbaaaaaaaaabcccdfcaa##bbbbceabaa######aa##a##aa####aaaaaaaa#abaaaaaa###a######abbbaba##aaa#a####aaa###a############.########################a####aa#dcddcdb#a#dedeedcaa#baacgegiifedddddddcdddefeffggfgeedbba#aaaabbaabaaaaabceebbdaaaaa######aaaaabdddb#aaaaaabacbbbaabdfffgfgfeeeeddgcbaaaaa####",
-"#b##adiifdbcefedccccbaabaaaa#aaaaaaaaaaaaaaaa##abaa######aabbaabbcbbaaaaaaa#abaaa#######aaaaabcca#aaa##aaaabbccc#########a###aa##a###aa########aaa##aaa#aaa#aa#aba##a#######aabbabcaa#ababbca##aa####a#####a.#########################a###a##acba.ddeecccba#cfeeedcaaaaabccbaigfeeeddddcbcdcddfeffggeedaabaaaabaaabbabaaaaa##cffedeaa#a#aaa#aaaaaa#abfebabaaaaaacadcaaffecffffgfffeeggaaabaa####",
-"#caaa#.ahjgffefgggffecbbbabaaaaaaaa#aaaaaaaaababaa#aa#a#aaaabaaaacccaaaaaa#a#aaabaa######aaababaaaaaaaaa#aaaabccb####aaa##ab###aa#####a#a####.#aabaaaa########a##aba########acbbaaaaaaaaaabbbaaa################a###a####aa############aaccb#adcbbdddccbcdebdedccba#a#aabdcbaggeeddedcbbbccdeeffffhggfcbaaaabbbcaabaaaba####a#debceea#aaabaaaaaba#aaa#cfgcaa##aabcbcbdffedfeeeefefeedhcaaaa#a###",
-"####aa##.behhgfeeeddefedbbbbaaabaaaaabaaaaaaaabaaaa#aaaa#a#abbaaabbcbbaaaaaaaaaaaba####aa#aaabaaaa##a#aa#a#aaabbcc.##ab##aabca##aaaa############aabaaaaa#a#a#####aaa#bb#.####bccbaa##aaaa###aaaaa######a#######bbabba####bb###a#a###a###bcccccdcdccddcbbabcdcddccba####bdddb#bdcecdedcbbbbbcceeeeehhcdaaaababcbcaaaaabaaa#####ab#aabb###bb##abcaa###a##adfeba###aabaaefefffedddeedefefhbaaa###.#",
-"#####aaaa###chikjiigedcegcccbabbaaaaaabbaaaaabaa#aaa#a#a##aaaaaaaaabaa#aaaaaaabbbaa######aaaaabaaaaaa##aaba##aaabab.###aaaaaabaa#aa#a#############a###aaba########aa#cbb####abcbaaa##aaa#a######a#.####aa###bbccbbdccbaaabb###a#aaaaa###cbbbaccccbbcccaaaabbccccbbaaa#accdcb##bacgeeedccccbccdeeefggebdaaaaabbbbbbaaabaa#####a#a#aa#####aaaa##ca#####a####beeca#b#abadgefffedeedfdcffeff#a#a###.",
-"..######a#aaadd#acdhihecdgecbcaa#aa####ba#aaa##aa##aaa###aaaaaaa##ababaaa#aaaaabbbaa######aaaaaaaabaaaa##baa##a#a#b######aaaaaaaaa#################a#aa#bcb#####aba##a######bbbcbaabcaa#################a#abcdbdefededcbcbaa##aaa#a###bcbababbccbbbbbcaaaaabcccbaabaaaabcdbba###bhhfhgeddccbccddfhhhfbbaaaaaabbbccaaaabaa####aa#a#####b####aa#aa#ab###a##aaabefd#a#abbfgfeeeeeedeeddefggbaaa####",
-"##.######aaba#abaaaabeiiebceddcbaaaaa###aaba#########a##aaaaaaaa###aaaaaaaaabaabbbbaaa###aaaaabbbaaabbaaaaa###a###bb#####aa###########a######a#####aa#baaaba##abcedcbaa##a##bcccbaaaddccaa##############a##bbceffgfededdedcbaa#a#aaa#bcabaaabbbccbbbbbbaaaabbcbbbbaaaaabbcda#a##ehgfeeeeecddbcddfhhgcbbbbbbaaaabcbbbaaaaa###.#a#a#a####aaa###aa##a########aabbbedbacfegggfeeefeddccddgihdaaa####",
-"##.###a####aaaa#bacbaa#chidccdfdbbabaaa#ababaaa###a###aa#aaaaaaaaaba#aaaabccccbcccccabb###aabaabbbcbaabaa########aaab.####aaa##################a####b##aaaabb#aacdddcbb#######bccaaaabdbba#####aa#a#########abccccccddcffhigcbaaa#aa#acaabaabbbbaaabbbbbaaaabbbbaaaaaabcccdda#a#higheddefedeecdffffeeaaabbbbaaabcbaabaaaa#########a####aaaa######a#######aaabdcbadgfdeddegfgfeedcccccehigaaa####",
-"###########aa#####aacdb##ejgcbbfedcaaaaaacbabaa#####aaaa#aaaaaaaaaaa##abbbbbbaaabbcddddbccdcccbababaaaaaab#########aba..####aa###################aa########aa##aaaabbbba##a####ccaababdaa#aa#####aa##########aaaaabbccdfgjjihdcaa#aaaacbaabbababbaabbbabaabbbbbbbbbbbbbcccddebadhggfffeeffffeeeffdccddaaaabaaabbabbbbaaaa######..######aaaaaa#a###a#aaa###aaaccc#ceggedddcffffedcbabccdfgebaa###",
-"#########aabaaa####a#aabbachjgbacdedcccbabaaaaaaa#####aa#######aaaaaa#aaaaaaabaaaabbccdccddcbbbabaaaaaabbaa########aabb.#######a##################aaa##########aa##abaaaaa######bbaaaaba#a#a#.##.#a#aa###aa###aaaaaabcddgijijjigeba#abdcbbcdcabbbbaabbabaaabbbbaaabbbbbcacddee#dfeeeffeccdghhfffebccccaaaaababbbbaaabba#a########.###a##aaaa##aa##aaaaa####aababbddceggfedcdffedcbaabcdeeffaaaa#",
-"#######a#aaaaaa#a#####aaaabcdiibaaacecddcbaaaaaaaaaa##aaa########a#aa###aaaaaaaaaaaaabcccbbaaaaaaaaabaabbaaa######aaaaca.###.##a#a####a########aaaaaaa##...###a###a##a#aaaa#####bdaaaaaa########a########a##a##aaaaabbbbegfeedeghgeccddeeefgcbbaaaabbbbaaaabbbaababbbbcccbceeebegdddeffedbdeiihecbcbdbaabaaababcbbaaabaaa#a#.############aaaa##b#a##aaaaa##aabbbbccdceghgeddefedcaaaaccdedfaaaa#",
-"########bcaaaaa##########aaaa#gidaaabedcccbbbaabdbaa####aba#a#############aaaa###aaaaaaacbbaaaaabbabbbbbcbbabaa######aabb..##.####aa#aaa######aaaaaaa####a#.####aa##ba#aaaba#####dbaaaaa######aaa#aa######aa###aaa#aaabccebabaabbdfhhhgfghggdbaaabbcaaabbaaabaaaaaaabccccccedchigdcdddcedccabghdbaaabcaaabaaaaabbbbcbbaa##a########a##.#aaaaaaaaa#aaaaaaaca#acbbbbbcccdefeddeecdcbaababcfdfeaa##",
-"########baaaaba#aaaa#####a####aciib#aacdddbabbaabbb#aa#####aa#############aaaa##aaaabaaaabaa##aabababbbbccbbbcb#######aaaa#...##.#####aa########aaaaa######a############a#aaaab##abbaaaa#######cb############aa#aa#aaaaabaaa#######bfhigihhfbaabaaaaaabaaaabbaaaabaaaccbccdcchiihhdbcddcddccbbeeaaaabbbaaaababaabbbeeeaa#####.###.aaaa#aaaaaa#aaa#aaaaaa#bbadccbbbbccccbcddddcbcccbaaaaddddge###",
-"########a##abbaaa#########a#aaabcfjhaaabcdecaabaaaaaaa#######a########a#aa#abaa#####aaabaabaa##ba#abbccbaccaaca########abcb..######################aa###ceb#######aaa#####a#aaa###acaa#aa#######b############a#a##aaaaaabaa########abacfhhfcbbaaaabaaabaaaaccaaaaaaaacbcbbcffgfgcegeddeddcdccbcd#aaababbbaaababcaabaaccba########a#abaa##aaaa##aaaaaaaaaababcbbbaccbbcbccdddcbbbcbbcbbadcdeehd##",
-"########bb####aaba#########a####aabfjfbbcbcfdbabaaaaaaba######aa######aaaaaaaaa##a#####aaa######aaaabacbbaaabaa#########aadc...#######.##########aaaaaa#ddeb#a####aaaabeb######a###bbaaaa##b####aa#.##########a#a#a#aaaabaaa##b###.adbaabeecbaaaaaababaaaaabcabaaaabbbbbcdcfgeddgbbggeedddcccccc####aabaaaaabbaabaaa#acda############aaaaaa#aaabaaaaaaaaaabcbabbbabcbbbbcddccbcbbbabbbbccdfggf#a",
-"aaaa####bc##a#aaaaaaa###.#####.####aciiecccbceebaabbabbb######a#a####a##aaaaaaa########aaa#######aaabcbbabbaaaaa#########acfc..####.#.###.###aa###a#a#aaabcaaaa###aaaa##########a##bdcaaaa#ba###baa##########aaa####aaa#bbababdcbaacbbbaaaabbaaa##aaaaaaa#aabbbaaabbbbbbcdcccddcdec#adfedddcccbe#####aaaaaaaaaabbbaaa#bdb##.#######.####aaaaa###aaaaa##aaabccbbbaababbbbbcdccccbcbbbcbbbdcefghc#",
-"########a#####aa#bbaaaba######...####adhifegfddfdcabccbaa###aaaaaaa######aaaa##aa##a###b##########aa#aaaaaabaaa######a###abdfb..#######.##.#####aaa#a###baaa####aaa#########a####a#bddcbaaaa####aaaa####ad##aaaaaa#######abadddccccdcba##a#ababa###aaaaaaaaabaaabbbbbcbbcbbccdccbaba##afedddccbfa######a#aaaaaabbabaaaaab#####.##..#..a###aaaaa#aabbaaaaaabcccbbbabbbbbbbbddccbbcbbbcbbcfdeeffha",
-"##############aababaaaa##########.##.#..chjjhjifffdeccdbaa#aaa###aa#####.##aa#######.#######a#########aaaaaaaaaac########acchc.....#..###########aa##aa#abaaa##aba##a######aaaa##a##bdcbaaaa#####a#aa###bd###aaaa#aa##a####adgdcbbcddbb###aaa#a#####aaa##aaa##abbaabbbbcbbbcccddeccc#a#bhggfedaec##########aa#aaababaaaaaa#####.##.##.####aaaaaaaaaaaaaaaabdcbbbababbabbbabddcbbbbbbccbbdifdefge",
-"a###a##########abb#aaab#a#######...#####.##a#acgkigfeefdcaaa##aa#aaba####..######.#a###a#aa#aa##.#######aaaaaa##ba#####aaabbeha...###.###.#######a##aaa#aaa#a#aaaa###aa#a###aa###a###cdcaaa######a#####abb####aaaaa####a####deebbbccdbba##aaa#aa####aabaa#a#aabbbaaaaabcbcbbccbcedbba###cdffffeefba###########aaaaaabcaba#####.####.#######a#aaaaaaaaaaaaacdccabbababbabbaabcccbbbbbbbccdeeedefh",
-"f#######aa##a##aaa#aa#bba#########..############afkjgfgfeeeba#aaa##a#######.####.#.#####abbbaa##########aaaa##a#a#######abbcdhe#...######.##a####aa#a###aa#a#aaaaa######aaa###########bdbbaaa####a######aa##.##aaab####aabdecdcbaabbbaba##aaa#########abaaa##abbbaaaaabbbcdbaccbcebaa####adghfedeeba#############aaaaabbcb##########.######aa#aaaaaaa###bcdccbbabbbacbaabbbbbbdcccbbbbbcccccddeh",
-"hc#####aa######aa####aaaa#####a###.......##aa##a###gijhhhggeb##baaaa####...#####.#..a###acccaaa##########aa#####aaa####aacdddhf#..###.#..####aaaaaaaaaa###a#aa#aaaaa#####aabb##########cecaaa####a##############aabb##aabacddbcbbabbbaaaaaaaa##a#######baaaaa#abbaaa#abbbabcbbbcdgd####a##adcgfecdeb######a########aaaa#baaba########.######aaaaabbbbbbcbccbbbbbbbbbaaaaabbbbbbccbcbbbbcccccdeed",
-"egb##baaaaa####a##aa#aaa#a#######.#..###.###########adfilkhfca#abaaa#####..##....#....###bbccaa##a##aa####aaaaa##a##a##abbcfhjfb#..#####.######aaaaaaa######aa##a#abbbba###aba#aa#######cecaaaa###a#.#######aa##aa#aa###aaabcbcbbcbbaaabb##aaaaa#######abaaaaaabbaaa#abbbbbabbabdfeaaaa##a#ca#eecccfcaaaaaaaaa#a#a######aaaaabca########a####aaaabababbbbbbbbbbbbbbbaaaaaaabababccccbcccdccbdffd",
-"cfhd#acaaaa##a#######a#a##a###a##.....######.##########bddjkidca#########..###....######acaacbbb#a###ab##aaaaaaaaaaaaa#aabcfgejfa#.###a######a##aaaa#aaa#a###aa##a#abbcba#####aa####a###aeedbaaa##aa####...#aaaa#bcaccbaaaabcdccabcbbbaaca#aaaaa#########aaaaaaabaaaaabbbbbbbaaabbecbbcaaaaaa#adecccedcaaaaaaaaa##a###########abaa######a####aaaabdbbbbbbbaabbbbbabbaaaaaaaabbaabccbccbccdccdefg",
-"fedfea#a####a##a#a#######a####a#.##..#.####...########aaaaaeikhea#####################aaacbabbdfdbbaa#aaabbcbbaabaaaaaaabcdfbbeica..#a########aabaaaaaba#a###aa#######aaa#####aaa#.aa###adffdbaaa##ca####.#########abbcdeeeefcdcbabbbbbaacbbaaaaaa##a##a##baa##aa###aaaabbabbaabaadfb#bbbbbaa###feccbeecbbabaabaaaaaaa#aa###a####a########a##aaaaabbbbbbcbabbaaaaaabbbaaaaaaabbbabccccccddddeeee",
-"fggehdaaa######a##########aaaaa#.##.####..#..##.#######aabbaadjljgda.#################aaaccbccddcccccccccccccdcbbccbcbaabbcfdcbgf#...#aa######abcbaaaaabaaaaa############.##aa##a########dffedcbaa#cc##########a####bbbbcdffeedaaabbbbbcbabbaaaaaaa#######abaaaaaaaaaaaabbabbaa#a#bdcbbbaaaaa###cfeeehhecabbbbbbaaaaaa##aaa##a###a########aa#aaaa#bbcbbbabbbbaaaaabbbbbabaaaaaaaabbbbbcccddddeee",
-"edehhg#aaa######a#a#####a##abbaa###.###################aaabbcaacjllkhbaa#######a######bbaefddddcbbbaaaababefeedddccffdccdfgeeeefec#...#ab#.####abccbbba#aaaaaa###########..###a##########bfdfdccaaacfb.######aababaaaccccbdffebbbbcbbaacccbabbabaaaa######aaaaaaaaab#aaabaaaabaaaabbeffcaaaa####aeeeefiihfcabbbbbbabaaaaaaaa##a######aaaa####abbabbabcbaaaaccbbbbbbbbcbcaaaaaaaaaaaacbbcdddddede",
-"eefgghcaa#######a##aa######abbbcc#.############.###a#aaaaaaaaccbafjllkjecbaaaaaaaa##aabcccgefeecccbba#aaaa.acffffffcacdccbbbfffefda#.##########aabcedba##aa#a#####a#####..#####aa###.####bceecccbaabdfa##aabbbaabbbbdcbbccdcceebabbbaaabcdcbbbbbaaaa######a##aaaaaaacaaaaabbaba###acdeegcbbb#####aeffgfgijkgcbbbbbbbbabbaaaaa##a#aaa#abaaaa##aacdbabbccbaaa#bbbbaabaabccbaaaabbaaaaabbbccdeedddd",
-"deeffdfd#####a######a#######aaaca#a############bdca###aca##aaaceddfijjnligdcbbcbaaaaabcddchgedddbccaaa#aaaaa##accfbbbaa####bdhfedhd#.###########bbcccdba###aaa#####a##a#.#####a####.####.#abedebdcbbcfe#####adcbcddbbdbaaacbcbccbbbaaa#bbcbbbbbbaba#a############aaaaaaaaaabaaaaaaabdfcccbbba#####aceffgiijihedccbbbbbabbaaaaaaaaaaaaaaaaa#####aabaaabbbaaaaaabbaabbbbbcabaaaaaaaaabbbbcccdddddd",
-"ddddecbdca###a###a##baa#aa##abaaba#a###.#####.#aabaaa#aaa##aa#acdhilmklmlmkheegecbbbbccbcefgedcdcbbbbaaaaa#aba#a#cdabcbaaa#achihggfa############abdb#bcaa##aaa#########a###.######..########beddecbcdffc###.#acdfffdabcca#aabacbbbbbaa#abbbbbbbbbaa#############a#aaa#baaaaaba###aaadfd#babacababbbcegfhhiihgfdddcccbbbaabbaaaaaaaaaaba#aaa###a#aaaaaaaaaaaabbabbaabaaabcbbbaaaaaaababbccdddddcd",
-"deddddcacaba###a####aaaaaa#aaaa#aaa###aa#########a##aa#aaa##aba#.cfehhjkjllmllihfedcccbbdefgdcccecbbbccbaaaaaaaaabdbbbcbaaaabhjjhggea#.####a##a#accaa#cdaa#aaa#.#############a##a##.###a####.cedccccefbbaa#####deffeaacdaaaa#aabbbbbaaaaaabbaaabbaba#####a.###a###a#a#aaaaaaa#a##aaacdecaaaabaa#aa#bdgfeeefhhfdccccddcbbaaababaaa##aaaaaaaaa###aaaaaaaaaaaaaaaabbaaababbbbabbbaaaaaabbbbcdcdccdd",
-"dddcccdbbbcba#bb#aa###aa##a##a####a##.####aaa##a#aa##a#a#ba######.fffkjlhkkljmmmlieeddccefaeeeccdedbcdccbcbaaaaaabaccbccaaaabeijjigieba.#######aacbaa#accaaaaa##########a#a###aaa#############decabdeeeaba###..adeddcaabcbba##aabbbaaaaaaaaaaaaaaaaa#####a###########aa#abaaaa##a#abbcdeba#b#aa#####cefedcbbdeedcccdddcbbbaabbaaaaaaaaaaabaaa###aaaa#aaaaa###aaaaaaaaaabbbaabbcbaaaaaabcccccccdd",
-"ddccbcccbcedaddaaaaaaaaaa#aa#a######...###########aaaaaaaaaa####..cfhjjkmlmklkklmnjfeedeefebdeddegheeedddccbbbaaabbccbcbbaabbbgjkjjhifda.#######aaaaa###abaaaa####aaa###########aa##########..adccaddcecbabbaa##dedddcbabcbca#aaaabbaaaaaaaaaaaaaaaaaa###############aabaa##a####aacbcddebaaa########cffecdcbceeefdddddcbbbaabbbaaaabaaaaaaaaaa###aaa#a#aaaaaaaaaaaaaaaabbbaaaacbbaaabbbbcdcdccb",
-"cdcccccbbcdbaacbbbbbbaaa#aa#aaaa#####..#..##.#####a#aaa####aa######eigfcfgijjjlmmmmnlhfhiggdddeefgegfgffdeddcdcbaaccccbcbaaabbcfjkkkijgfb#######a#aa######a#############a###aaaaaba############abcc#ddcccbdecdcaddddddecbbbccaa###aabaaabaaaaaa#aaa#########.####a##a##a#aa#a######abccdgbb#ba#a######cffgfdefffehgdddeccccbaabbbaaabbabaaaaaaaaa###aa##aaaaaaaaaaaaaaaaaaaaaaaabbba#aabbacddccc",
-"cddcccbbcccaabbabaacbaaaaa#aa#aa#.#...#...#..###a###a#########aa##adeaaa#abedefijlkmnnlkkjdddfdcebb#degfaefgfeddcbdcddbacbbbbbbdjjklkkihgc#aa#####aa################aaa##a#aaabaaaaa###########aabdbedcabdddeeddddedcccddccbbbca###aaaaabba#a#####a#a###aaa###.###a#######aaaaa###aabbbbcdaaabaa##a####aeghhhggghhhfedddcccccbbbbbbbbbbbbbbaaaaaa####aaba#aca#aaaaaaaaaaaaaaaaaaaaabaaaaabbbcddd",
-"dddcccbbdedaabdaaaabbabbbbaaaaaa#.##.##.#.#####################aaaddbbaa#aa##a##aceejnllkkhfhfccfbbaaaabafabdeffgfcdddcabbbbabacgjkkllkhjhbaa#####aa############a##aaaa###aaa#aa#a#####.####a##aa#deedcabdeeeedeeddeedbccdcccdcb####aaabbbaaa#####a##a##a####################aa####aabbbcdea##a########aaabehiiiiiihfedfdccccccbacbbabbbcbbbbaaaaaaaa##ab##bbaaaaaaaaaabaaaaaaaabbbaaaaaabbbbbdd",
-"ddccdbcbedcaabbbbaaaaaabbababbaa#################a##########a###a#ecbaababaaaa#####abkllllljgbaaccbababbabaaaa#cedfheedcabbbbbbbchkkkklkhggeba###aba####.####a####a##aa##aaaaaaa##aa####.####a####dfdcba#bdeeeeeefedddcbbcdbbadcba###abaaacaaa###a##a###aa#####.####a######.##a####abbbbccbbc#ab##a#aa#ca###cfggihhihffffedcccccbbabccccdccbbbaaaaaaa#aa#aa#aaababaaabbaaaaaaaaaaaaaa#aa#abbcccc",
-"dedcccbcecaaacbababbbaabbbbbcbaaa#..###.#########a##############.cdabbbbbbbba###aabcddilmmljeaaabcbbbbbbbbbbbabaabcefgfecbbbbbbcdfjjkkkmkhfgecbaaabb########a######aaaaa####aaa###################befcbaabbadfeeeeffededcbbccabccccaa#aaa#abaa#######a########...###########.##..###abbbbcbbf#aa###abaa#a#####acfgffgfggefddcccccbbabcecbbbcbbaaaaaaaa##aa#aaaaababbbabbbbbcbbabaaaaa##aaaaabbcc",
-"cddecccccdcaaaaaabbbbaaaabbbbaaaa########.####################..aaababaaacbba#abddbcdfeejmllf#aabbbaabbbbbbaaaaaaa#afffdedcbbbddffjfijjkkkhgfed####aba#######a####aaaa#aa#####a######a############adffddcaa#befefedeeddccccbcbaacbaabbaa###aba####a###############.###########.######aabcddcefbb###bbaaaaaabba#cffffghhgfffedccccccbcbbebbbbbbbaaaaaaaa####aaba#aaaabbbbbbcbaaaaabbcbaaaaaaaabcc",
-"dddddfebdfeba##aaaaaaabbbbabaaaa####.#########################.abbaaaaaaaaabbaaabba##aceeilmme#aaaaaaaabbbbaaaaabbbbbefgeddcddddegiighiiggjggfdba##aaaa##############ba#b###aaaa#######a##a#aaa####dfgffgcaabefeeededccccdddcbbbbbaaacbab###aaaaaa########a#a########.#########..####aaabdcdecbdc#aa###aabbcccaacegggfgghggfeeeddddcccbccbbbbaaaaaaaaaaba#aaaabaaaaaaaaaaaaaaaaaaabbaaaaabbabbbc",
-"bcdeeeeedeeda##aaaaaaaccbbaaaaaaa####..##.#########a##########aaaaaaaaaaaaababba#aa####abbdhkmgbbbaaaaabbabaaaaababbbaehfcdeeeegghkkjjigdeehfeccaaaabcba########a####aaa#####aa####a####aa###baba##adfgfffdeeffdcddddddbcccdccbbbbbbb##bdb###aadb#a##############.##.######.##########abcdcedecegdb#a#aaabbcddaa#adfghfghgffefeefeeddcccccbbcbaaaaaaaaaaa#aa###aaaaaa#aaaab##aaaabbbabaaaabaaabb",
-"cbceeeefffffd#aaaaaaaaaddbaaaaaaaa#############.#############cbbaabaaaaaaabaaaaaaaaa###aaa#achlkigdaabbabbbbaabcaacaababccdbbdedcdfehkkjgeceheccda#aabbba###.######a#aaa#####aa######.#a#aa##aa#aa##adgggfeeggffdcccddcccbbcbccbbbaaa####ca##abcba#aa##########.#####a######.#.#######abbcbddbdfhgeaaa##abbcdcaaa##aaceghdfgffffffeeddddcccbbbaaaaaaaaaaaa##aa#aaaaaaaaaaab##a#baabbabbbaaaababb",
-"ccddefgfefffd#a##aaaaaabccbabaabaaa##########...############acbaabaabaaaaaaa#aaa#aabaaaa#aaaabgkjiifbabbabbaaaabaaabbabaaaaaaabcc#####cgkmjgfhfcbcaaaabcbaa########a#aa###a###########.####a######aa##bghfefgeddeccbbbccccccbcdcaaa#a##a#aa#a#aaaacbaa##.############aa########.#######bbbccddddggfbaa###abbcbaaaa#aaabeeeeggghgggffeedcccbbbbbcbaaaaaaaaaa###aaaba#aaaabbaa#a#abbbbbbabdbbaaaab",
-"bcceddefhgfcbaa#a#aaa###aaabbbaaaaa#######################aababaaaaa#aaaaaaaaaaa#aaaaaaaa#aa###cefllgabaaaaabbbaaaaabaaabbabaaa#ba######bfjljhghcac##aaacaa########a###############aa#.##a#############afgfgfedcccccbbccccccddcccaa##a####aa#aaaaaabaa#################a#a##.#########aaabccccddeegfbaa###abbaaa#aaaaaabdfceghhhhhhgfedddcbbbbbbbbaaaaaaaaaa###a##aaaaaaabbbaaacbbabbbbbcccdaaaa",
-"bbcccdefhiea###a##aaa######aaaa#aacb##############a####aaabcbbabbaaaaabaaaaaaaaa##a#aaabaaaaaaaaabekljbaaabbaabaabaaaaaaaabbaaaa#a#aa#####aekkhhiba###aabbbb#####a.#########a#a#####a#######aa####.#aba##gggfeedccbbbbbbcbaabccbcbaa##a###aa##abaaa#aa###..###########.###a##.#######aaaabbbcdddcefgaaaaa##abaabaaaabbaabdeffghighhgfffeeccbababbbbbaaaaa#aaaa#a####aaaaaabbaabbbbbbbcccbcccdbaa",
-"bcccccdefgeaaaaaaaaa#a#a#a##aaa#a#aba#######a#.###aa######bcaaaaaaaaaaabaaaaaaaa###aaaaaabbaa#aaabbchkkc#aaaaaaaaaaaaaaaaaaaaa#a#aaa#a#######dkklibca#aaabcdca#a#aa#################a######aaaa######aab#cghhgfddcbbbbaabaaaaabbca##a##abaaa##abaaba#a#aa############...##.###.#..####aaacbbcdccdcdedbaaa#a#acbaaa#aaaaaaabcffffghhhfggfeddbcbbbaaaabbaaaaaaaaaaa#aa#aa#aaabbbcccbbbbbbbbbbcdccb",
-"bbbccccdfcec##aaaaaa####a####aa#aa#aca##a####baa#######a##bbbaaaaaaaabbbbbaaaa#aaaa##aaaaabbba#aaaaaadijgaabaabbaaaaaa###aaaaaaaaaaaaaa#######behlidcdbaaabbcecaa######a###aaa###########a####a#######aaacghihgfedcbaaaaaaaaaababbbaa###aaa####a#aba##a#a#####..######......#...#.#.####aaccbcccdcdehhdaa####bcba###aaaaaaabaaadfeeegihgecdedcbcbaaaabbaaabaaaaaaa##aaaa#aaabcbbbccbbbbbbbbbcbbb",
-"babbcdddddde######aaa###########aaaabda##a####abaaa#####abbaaaaaaaaaaaaaaabbbaaa#aa##aaaaaaaaabaaaaaabcdkib#aaaabbaaaaaa####aaaaa#aaaaaa##a##a##acgjhfgefcbbacccbaa####a######aaaa########a#############bfffhjigedddbaaaaaabaabbbbccaa####aa###a##aa#################a##.....#..#########aabbbbcccddfheaaa####bba####abba#aaaa##bca.#bghfedecbccbbbaaaaaabaaaaaaaaa#a#aaaaabbbbbbbbbbbbbbbbbbaba",
-"bbabbdcdddcec#####aaaa#a####a###abaaaaaa##bda##aaa######aaaaa#######aabbbaaaaaa##a##aa#a#aaaaaaaabaabacbdjjbaaaaaabaaaaaa##########a#aa##aaa##a#a##cfhhededabbdcbcca##########aaaaa############a######a##dffgjiiheedcbaa###bbaabbbddba#########aaa####################a###..###..##..###aaaabbbbcbcfffebaaaa#aabaa##a#aaaaaaa#####aa#.bdegfeccbbaabbaaaaaaaaaaaaaa#aaaaaaaababccbcbaabbbbbbcbbab",
-"dbbbbcdcdcdcea###a####a#aab#aaaa##aaaaaaa##a####aaa###.##aa###########aaaabaa#aaaaaaaaaaaaa#aaaaaaabbaabbbhkfcaaaaabbaaaaa##########aaa###aaba######.ekjgddbabbaabccbba########aaa####.#######aa##aaa#####dgfgghgggedcbbaaa#aabbbcbedba#######aaa#a####################aa#.......##..####aabbbbcbcdefeebb#aaa#aaa##ab###aaa#######a###.##cgefdccbbabbbaaaaaaa#aaaa#a#aaaabbccbbcbbbaabbbbcbccbbb",
-"bcabbcceffabbc########aaa#aaaaaaba#aaaaaaaa########.#####aa######aa####aabbbaaaaaaa##aaaaaa###aa#aa#aaaaabbfkjhdaaaabaaa#aa##aa#####aa#a#a#aaaa######aikjjhbaaabbaacbaaa###############.###################bfhggggggfedcabaaaaabbcdeccaa########aa##########aa######a#a##a##..#.#...#####aabbbbbcccecdgccb##a####a##a############aaa######agfedccccbbaaaababaaaaaaa####aabbaaaaabbababbbccccbbcb",
-"ababbccdffdbbbba###aa#aaaaaaa#baaaaaaaaaaaa#########.####ab###########aaaaaaabcbbbaa###aaaa#ba###aaa###abbbbflljeaaaaaaaaa###########aa##aaaaa#######.afikkiba#abbaaba##########a############################ehffgggfeedcccbaabababcccbaa######aa##aa###.###aa####...#########...########abbbbcbbbcdecfgdaa#######################aa##a####bfeeddccbbbbbaaaaaabaaa#abaaaaaaaaabaaaabbbbbbccccccc",
-"adbbbbcdddecbaba#a#######a#a##aaaaaaaaa#aa##########.###aac##########a##aa#aaaabcbbaaaa##aaa####aa#aaba#abbbbdillhcaaaaa####aa####aa#aaaa##aa#########.#chkli#aaaaabbaaa########a#aa###a###############.###aa#fggffgffedeecbbbaaabbbbcbaaa#####aa###a############################.######aababbcbbbccedcfccaaaaaaaa###############.####a#####bffeddccbbaaaaaaaabaaa###aabaaaaaaaaaaababbbbbbbcccc",
-"ccbbccddeeeccaaca##a####aaaaaa##aaaaa#a#aaaa#########.###ab####.#a###aaa##aaa#aaaabbaaaaaaaaaaba#abaaaaaaaaaaachkklfbaaaa##########a##abaaa############..#bimiaaaaaabaaba##########aa#babaa##############.##a##aegfcbdeedfedbbbabbabbcbbbaa#####a#####aa######################.#########aabbbbbcbbacddddccaaa#aaaaaa###a#####################afgeecdccbaaaaaaa#abccbaaaaaaa#aaaaaaaaaaaabbbccbcc",
-"ccedcdddeeeccbbbcba#a###aaa#a#a#aaa#####aa#a#############ab#####.#####aa#a#aabaaaabbbbabbba##aa###acb#aaaaaaaaacfihkida##a#a###.####aaaaaaaa##a###aa######.ahljc#abaaaaaaa###.####a######abaaa############.#####.bababeedegdcbccbcbabaaabba#a##aa####aba#aba#a###################.####a##ababbbcbbbcdddedea#aaa#a####aa#######.###.######a##a##fgfedddbbaaaa#bcdccbbba####aaaaaaaabbabbbbbbbcbbc",
-"cddeddddeefddcbbcc#a#aa#aaaaaaa#aaaa####aaa######aa######ab#a########aa#a#aaaaaaaaaaabbaabba#aab###abb######aaabbcfheihc######a#####aa#aaaaaaa####aaaaaa###.aikjcaaaaaaaa#################aaccbaa#a################aaaaaaabdddcbccbaaaaaaaaaaa##b####abbcccb##.###a#############..###aaaaaabbbbbccbbccccddecaaa#aaaa###a########################effedccaabbaccbbaaaacc####a#aaaa#aabbbbbbbbbbbcc",
-"dcdcdcdeddfecdcbcdaa#aaa##a###a###aa##############aaaa###aba#############aaaabaaabaaaabbabbaaa#aba####a##a###aaabccefadhhb##aaa#####aaaaa#aa#a##aaa#aaa#####.aflkcaaaabaa####################ddcbaaa#################a#aaa#bdddbbcbaaaabaaaaaaa#a####a#baa####a###a###aa#############aaaabccccbcccbbcdcdedefb##a###aa##aa###############a##aa####efddcbcecbccabbaa#aacc###a##aa#aaaabbababbbbccc",
-"ccdddcbcfhfddcdcbbc#####a#aaa##a########a#a#aaa#####aaa##abaaa##.#######aabbaabbaaaaaaaababbaaa#aaaaa###a#a#a#aaabccdha#diga##aba#####ca##aa####aaaaa#a#######acildaababbaa###########a#######abccbaa#########.#########a###cdedbbdcbbabba#aaa###a####aaaa#aab###a##a#aa######aaa######aabbccccccccccddddeddfca#aa##aaa#aaa#####a####.###aa#a##a#cfeddedacaaabcaa###aacc###########aaaaaabbbbbcc",
-"ccccddccdeffdcccdccb########aa##########a#aaabaa#####aa##ab#aa###########aaaaaaababaaaaaaaabaabcabba############aaabcffb.afjfa#aba####a#a########a#a########aa#abhjb#aaaba#a##########a#######aabcccbb####.#..###aba#########abddbcecbbcbba#aaa########aaaa#a#a###aaa########aaaaa#####aabccdcddccccccccddedcec###ba#a####a#a##########.######aa#adedcbbaabaaabbaa###aabca##aaa#a##aaaaaaabbbbbc",
-"cccccdcedcddfebbdcbdb#######################abcbba#######bbaa######.######aaaaaabbabaaaa##aaabababaaaaa########aaaabbcfiea#bgjeaaa######aa#a#############a####a#acgigaaabb##########.##a#######aaa#adcba##########ba#a#a#####a#adfcddbcccbaa#aaa######aaaaaa##aa#aabbab#aa####aaaa#####aaabbccdddcdcbbbbcccddegd##baaaaa#########a################abbcccbbbbabbbba#####abca##aaa####aa#aaabbbbbb",
-"bbbccddcdcddefdbcdadcaaa#####################aabbbba#a#aabba#aa##########aaaaaabbaaaaaaaaa#a#aaabbbbbaaaa###a#aaaaaaaabfifa##ejgbaaa########a##################acbcfigba#aa###########a#########a#aaabbbba#######.#a#a#######aaaaffddccbccba##aaa##########a######aabaaa#.####aa######aaabbbccdeeefggecdedcdfedcbaacbaaaa##a#a####a############a##aa#accdcbcbbbbbba#####aaca#aaaaaaa###a#aaabaab",
-"bbbbcccccddddfecbccbdc#a############a###aaaa#aaa#aa##aabcccc###########aa#aaaaaabaaaaaaaaaa#aaa#aaabbbbbbaa###a#aabaaabbbhie#.bfhfbaaaa###aaaaaaaaa#######a####aaabdhifbaa########aabaa###a######aa#####bccaa#####.#####a########afgeddccdcba###aa########a#a#######aa######.##########aabcbcccdffghihgdcddcbacbbeabaaaaaa#a###################a##aaaa#bcddcdcbbbab##a##aaaba#aabcaa####a#aaaaba",
-"bbbbbbcccccdefedbbcacdc####aa##a#.##a#.##abb######a##aabbccc###########aa#aaaabbbbaaabaaaaaaaaaaaaaaabbbccbaa##aaabaabba##diic##adhebaaaa#aaa#aa##aa##########aabaaagjjf#a######a#aaaaaaa#a#######aa#a###bdddaa#a###.#a###########adcdddddcba#aaaaa#a###a##a##ba#b###aa####.###aa#####a#abcdcbbcdghihhgdcaaaaaabcfdccaaaaa#aa###################a##a#a##acbcdcbbcba#a#####aaba##abaaaa###aaaaaaa",
-"aaaaabbbbbcddeedccebaccb###a####a####a#..aba##########aaaaccb.############aaaabbaabbaabbaaaaaaaaaa#baaaccbbaaaa#aaaaaaaa####fjfb###egebaabcb##aaa##############aaa#achkjbaa######aaaaaba#a#aa###a###########abba###################abaceddcbaaaaaaaa#####a#####a####a##a######.###a##abaaccddedeeffdghfaaaaaaaabbdfcabbaaaaa###############.#########a###bccbedcbdaa######a#abaaaba########a#aaa",
-"#a#aaaabbbbbbcdedcccbabbb##aa######.######ba#############abcc##############aaaaababaaaaabbaaaaaaaaaaaaabbcbbccba#aaaaaaaaaaa#beihb##afgdbbcba#aaaaa######a######aa#abcilheba#####aaaaabaaaaaa#########a####a##a#aaa###############a#aaadedbbaaaaaaaaa##aa##a#######a##aab######.##aaaababceefcddcb#.#gfaaa#aaaaabcfgcaaaaaba########.#####################aabddcbcabaa##a##aaabaaaa######a######",
-"##a#aaaabbaabbccdcbcbbbacb###a###########.aba#######aa###aacf#######.#######aaaaaabcaaa#acaabbaaaaaaaaabababbbcdcbaabba#abaaaaabfje#a#aehdaaaaaaaaba#####ab#a####aabaabijiebaa##aaaaaabaaaba##aa#####a#a###########a###a###########aaaaaabbbaaaaaabaaa#aaaaa#####a##abaaaaaa########abbabcdgeba##.##.bdaaa#a#aaaacfgcaaaaaa########.a########.#######a#aa###abccbbbaaaa#aa#abbab#abaa####aa#####",
-"#####aaabbaaaabcbccccbbbcca###a############a#########aa##aaacb###.#.########aaaaaaaaabcbaaabaaaaaaaabaaaaaaaaaabcaaaaabaaaaabaabaejhbaa#aggcaaaaaaaaa####abb#a###aa##aabhigddbababba#acbabaaa###aa####a#c#a#############a#a########aaaaaaaabbaaaaaaaaaa#aa##a#####aaaaaa###aaa######aabbabege##b#######aa#a##aaaaaceecbaaa############################aaaa##aaacbbbaaa##aaa#aaaaa##aa#####a#####",
-"####aaaaaaaabbabbdcbcdccbbba#aa####a##a####a######..##aaaaabab###.###########aaaaaaabbbbbbaaaaa#aaaabcbaabaaabbaaaaaaabbaaabbabab#bghcaba#dhfaabaaaaaa#aa###aa##aaaaaaaabeegbccbaaabcbbbaababa######aa#aaaaa##aa#.######aaa#########b#aaaaaabaaaaaaaaaaa#a##aa#aaa#aaabbab##a####ab#aabbbbcfhaaca##############abbabddbbaa####################.###a##a#aaaaa#aabbbbbaaaaaa###aaaaaaaa#######a###",
-"#####aaaaaabbbbbccdbccdcbcca##########a#####aa##a######a#aaaabc###############aaacaabbabbbbbaaaaaaabccbbaaaaaaababcaa#bbaaaaaaaa#ba#eiebabaafhb#aaa###a#a####aaabbaa#baabbbigcebaaabcbbcdbbbcca#a##a###acbbaa#ab##########aaaa########aababbbaaaaabaaaaa##a###a#aa###aaaca##a#aa.bc#abbdccbdga#####.###########abbbbcdebaa##a##a##########a####.###a#aa###aaa##aabbabbba#a#####aaaaaa########aa#",
-"#####bbbabbbabbcddddcccbbbcca#a##aa###a#################aaaaabb#a####.########aaaacaaaaaacaaaaabcaaabbcdcbbbcbabbbabbaaaaaaaaa####aa#cijdbababhfa#aa###aa##a##a#aaaaa#aabbbflggfaabacbaabbbaacbba##aa#abccbbaa###aaa#####a#aaaba###a#aaaaabbacbaaaaaaaaaaaa###aaaaaaaaaacaaaa#bbab#abbcccccbdc#################aabdceedebaa#########################b#####aa#####bbbabbaa#a####a#aa##ba########a",
-"aa##aaabbbbccbbcccddcdccabbdfa####a###########aa######a#a#aacc#######.#########aaabababbaaaabbaaaaaaaabbbbaaaaaaabaabbbaaabaaaaacba#a#beijbaaaaehfa###########aa#abaaaabbbbdhjghffedccaaabaabaabbaaaacbcbcccbaa#aaaaaaaa#aaaaaaaa####aaaabbaadebbaaaaaaaaaaa###aaabaa#a#aaaaabbbbbbbabcdcccefe####.##.#######.##a#aacccccaa#aa#####.###############aaa###.#a###a##bbbbbaa#a########aaaaa##a#####",
-"###ab#ababbccbcbccdddccccbbbeda##aaa######aa###abaa####a###abdb#a###.######aaa#aaabbbaaaaaa#abbbaa#aaaaabdaabbcbabb#aaaaaaaabaaacbcba####ejdbbbacgjd##aa#aa#####aaabbaabaabbejiiiihhggfbaabbbaabcba#bcdcdddddcaabbbbcbaaaaabaaaaaaa##aaabbbbcdedbcbaaaaabbaa#aa#aabbaaaaaaabccbbbbbcdccddffebb####################aabccccca###########.#########a####aaa####a##aa#abbaaaaaa########aaa####a#####",
-"#aaaaabbbabbcccccdedccccedccdebabaa#aa###########baa##.##aaa#aca#######.#####aaa#aaabaaaaaabaaaacbaaaaaaabaaaabcbaabaa##aaabaaaaabaaaa###.cjgcbbbadiib##aaaaa####aaabbaaaaabdhlijjiiihfefcbaabbbbbbababdedfddedccbccdccbccdccccbaa#aaaaababcccdddcccbaaabbaaba#aaaabbaabbaccdddcdefffedeeed..################.######abcbdfbab#a###########################a#a#####aaaaaaaa##aaaa######a##.#a####",
-"###aaaaabcbabccccdcddcccccbbccebaaaa##############a#a####aaa##abb##############aabaaababaaabaaaabbaaaaaaaaaaaaaabbcbabbaabaaaaaaaaaaaa####.afhdbbaabfihb.#aa###aa###aaba#aaacclljjiijigddecbaabccbabbbdbadcbeffffeffgghhhighgfhgffcaaababdbbbbcfddddcbbbbbccabaaaaaaababddehggfegjiedaaaa#a####a##############.######bcdcddbaaa##a###################a#a#####aa####aaaa#aaa#a########a#######aaa",
-"aa##aaaabaaabbbdddccdbcddcccccdd##a#aa##aa########a######aaba###ab##############abaaaaacbaaaabaaaaaaaaaaaaaabbaabbaccbaaaaaaaaaaaaaa#########bfgbaabbdije.######aa#abbaaaaaaabellkkkkllkiiigfdcdcbabbcbcdcbcgijkjhhhhijjic#dcbcbddghffeeeihiggfgddedcccbcdcdcbcbcbabadeeffghhhebegdddb#########a#a####################babbbcbbb##a##################aa##a####aa#a###aa#a#aaa##a#######aaaaa##aa#",
-"a#aaaaabaaaaaabcdcceccefcadgeceebba###a#aaa########a#####aabaa#aabda########a####aaaaaaabbaaaabaaaaaabbaaaabbbbaaaaaabbcbaaaabaaaaaaa#aa######.eiebbbbcfihc#.###abaaa#aa##aaaabellkjlkjklmnnmlkgfccbbdddeefghjijkkllkhd#cfeabcbbcbbdgjjhgecccehieeededccceeedddddefcdffcedbacdec#bbaba#########aaaba#########.#######aaaacccdbbaa####################aa##a####aaaaa#aaaaa#a####aa######aa#aa##aa",
-"a#aaaabaaaaaaaabcccdddggedbdfccecaaa###aaba#a#######aa#.##aabba#aabc###########aaaaabcbaaaabaabaabbbabaaaaaabbcccaaaabbbbbbaaabaaaaaa#aa#aba###.bigbbbccdilid.##aaaaaa####aabbbcekmljgdfiijikmlmnkgdeefeeegieeddgdcghgdbabcfdebcccceffggfcbbbbbcefgedddcceeefdedcbccefgb####babedcaa##aa#######aabcda##.#############aaaaabcdcdbaa#########a########a###a###aabbbbaa#aa#aaaaa##aa######aaa##aaa#",
-"##aaaaabbaaaaaaabcdceeffedccfgedcaaa##aaaa###a#a#####aa..##abaaaabbd#########aaaaa#a#bbbbbbaaaaaaabbbbbaaaaaabccbbaaabaabbbbab#aaaaaaaaa#aaaaa###ahibbcdccgjkg####a#aa####aabbcddegkhddgihhghiibdilmljjjjiiihfaaa##aeeedcbbdghfdbbdfedfedccbbbbdbffhfededeefhhfc#####cea#####aaabdfda.a######.##abdfb##########.###a##aaaabadefecb#a##########aaa####a##aa####acbbbaa##aaaaaaaaaaa#####a######a#",
-"a##aaaaaabaaaaaabacddeddfdccefffd#aaaaabbaa#a#####a#.aaa###aaaa#abbdb########aaaaba#aaaaababbaabbbbbbbbbaaaaaaa#abcbaaababbbbcb#aa#abaaa###########fhdcccdcehihb###aa######a#bccdefggiglkjjhiihba#cglkjhiihgebcaaaaaa#aacdbbdefhfdbbeedbccbbbabdcbgjifefedeggfgfa#aa#a.aa######aaaacffba####.###abdeca######a###########aabbegffgedaaa##########aa####a##aaa#####aaaab#aaa##aaa#aa######a#######",
-"##aaaaa#aaaaaaaaabbcdddceddeeecdfbaaaaabbbaa#####ab#########aaaaaabbc########aababbaaaaaaaabbbaaaabcbbabbaaabaaaaaaabbbbaaabaabbbcaaaaaaa##########.bhfcccdddefigc#abaa#aaaaaacccdegeiihkihhjhbbaa#.#a##a#..##aaaaaaaaaaaacaabaacefedefbbedcbaccdbcfgiihhfdec.addb#ba###aa######aaaaadgeca#######aceaaa#################aaabdgeeghffb########a######aa####abaa#####a#aaaaaaa#aa###a#.######aaaa#",
-"a##a####aa#aaaaaaabccbccdedefebbef#baaaaaabaa#####a#aaa####aaa##aaaada########aaabbbaaaaabbaaaaccbbcabbbbaaaabaaaaaaaabbbbabbbbaabcb#a##a#########a##bifdccdddefgjeaaabaaaa##accbbcddfhehijhdb#aaaaa#a####a#abaa#aa##aa#aaaaaabbbaabefigffefdbcccdcbaacbbdhhfeaacbabb##a##########aaaaadhgb#####aabecaa########a###########baegfefgfeca##a#######a##aaaaa#aaaaa####aa#aabbaa#aaa###a#.#####a#aaa",
-"#aa#####a#a#aaaaaaacccbbccdcdedbcfcaaabbbaaaaa####a###a###abdb####aaeda######a#aa#aabbbabbaaaaacddbaaaaabaaaaaaabcbaabbbaabbbbbbababa####aa###aaa#####dihecccdedeejgaabcbaaaaabcbbbcdeheggeabaaa####aa########aa###aaaaaaaaaaaaaaccbaabdegedddddddccbbbba#abaabcbbaaaa##a##.#.#####a#a#abefb#####abdfaaa#####aaaa#a########aaadfeeffffc#######a######aa#aaaaaaa#aa##aa#aaabaaaaaa#######.###a#aa",
-"aaaaaa#aaaaaabaaaaabbcbbabbbcceedffdbaabcaaaa##abaa##aa###acefa####abdaa###.####a##aabbbcbcbaaaaabba##aaabaaaabaabbbaabbbaabbbbabbcbba#a##aa###aaa#####bhjgccdddefdhheabbaaababcbbabcdehfcaaaaaaaaa#aaaa#######aa###a##aaaaaabcdaabbbbabbbefedeccddcbbbaababbbcccca#a####aa#############aaceda###aabfebaa####aaaaa##########aaadefedegca########aaa##aaa#aaaaaaa##aaa##aaaaaaa#bcba#########aa##",
-"#aaa#aaa#aaaababcbbbbccbaaabbbbdgffgbaabbbaaaa#aaa####a##abbgea##aa##bca#########a#a#bcbabbbbaaaaaaaa##aabaababbbaabaabbbbbbbbbaaaabbaa##a#####aaa######adhidddddfhdfigbcba#aaaaaaaacbcfdabaaaaaa#aaaaaaa#######bb#####aaa##aabccaaabdcaaaeeefeddefcbbbbaaaabcbbbcdba#####a####..#######a##abdb#aabcefdaa####a#aaaaa#######aaaaaabacefc#########a###aaaaaa##aaaaaaaaaaaaabaaaa##aaaa###.#####aa#",
-"#############aabaaaabcbbaaaabbcceeeeeaaabbaa##a###ab#####abddb#####a##cb#######aa#a##aabbbbbbbaaaaabaaa##bbabbbaaabaabbbacbcbbbcbbbbaaa###a######aa##a#baaagkecdeegfeehfcbba##aaaaaaaaccdcbaccbaaaa#aaa##aaa#########a##a###aaabcaaaadeddbbdcdeigfdbcccbaa##cbabcbcdaaa####aaa######.######aa#debaacfdcaa#####aaaabaa########a##aabccdd#############aaaaaaa###aaaaaaaaaaaaaa###aaaaaa#########aa",
-"#############aabbbcbbccbaaaabbccddeedca#abaaa#aa###a##.##aaaa#######aaaca############aaaaaabaabaaaaaa##a#aaaaabbaaaaabbbabbbcbbccbccbaba##########a##aaabaabejfddddehddhgdbbba##aaaaabbbcccaabaaaaa#a#a##a#aaa###############aabcaaaaaegeddcecacdghfdccbaaa#cbabcbac#######bba#################bcdcbeebaaa###aaaa#aa#a###a####abaabdcdcba#a##a####aa###aaaaa##aaaa#aaaaaaaaaaa#aaa##aa#########a",
-"aca##########a#aaabdbcccbaaaabbccddeedbaaaaaa#aa#########abca#######a#aca############aaaaaaaaaaaaaaaaaaaaaaaaabbabaabbbbbabbbcbbbbcabbbba##########aa###aabbbeidbbccehefhhcbbaaa#aaabbaaabbcaaa#abcaaaaaaaaaaaaa#####.########aaabaacbedfdbbbdccccfhebaabaaa##a#acaba######daa###.######a####aa##acfdfdaa####aaaaaaaa###aca#aaaabaabccdeaaa###aa#aaaa##a#aaaaaa#abaaaaaaaabaaa##############.aab",
-"aa#bb#####.######aaabcccbbaaaabbbcddeebaaaa########.#####abca##########abaa####a#####aaaaaaaaaaaaaa#aaaaaaaaabcbbaaaaaaaabbbbbbbbbccabbaa#a#########a#####aaaachdbccdefehgiebbbaaaaabaaabccacbaaaacbaaaaaaa#aaaaaa#############a#baaaaceddbaabcbebbefdcaaaaa###ba#baa#####.aba##############a#a##aacfghdcaaaa#abaaaaaa######acbababbbdbaa###aaa#aaaa#a#aa#aa#aa##abaaaaaaabaaaaa##############ba",
-"a#aa#a#####.###a#aaabbcccbbbaabbbccccge#aa#######.#######abbba#######aaabbaa####bba###aaaaaaaaaaaaa#######aaaaabbbbabaabbaabbbbcbbbcbabbbaaa#a##a##########aaaabeccccddfgefhgaccaa#abbabbbbabbbba#aa#aaaaaaaaaaaaa#######a#####aaaaaabacdccabbbcecaacdfecbbaaaa#aaabaaa#####aa########aaab####a###aabeggbaaaaaaaaaaaaa#a##a###aaaabcccccaa###aaaaaaa#aa#aaaaaaaa#abaaaabaaaaaaa#a###########a#aa",
-"###aaaa###a######aaaacccbbbbbbbabccccehb#a########..#####abbca#######aaaacaa####cca###aaaaaaaaaaaaa#######aaaabaaaacdbaaabbbbbbbaabbbbcbccaa############a#aaaaabaccbdccegeccffbbaa######.#abaabbbaaaaaaaa#aaa#aaaaaaa#a##########aaaabbcc#abbabaabaddcbceebbba#aaaaaba######a############aba###a##aaaccggbaaaaaaabaaaaabaaaaa#a#bbabbccdb#aa###aa#aa#aaa#a#aaabaaaaab###abbabaaa###a#a########aa",
-"###aa#a######.######aacccbbbbbabbbccccfheaaaa#############bbcaa#######aaabcaa#####aa####aaaaaabaaaaa#aaa##aaabaaaaaacdcbaabcbbcbbbabbaabbbbca#a######aaa##a##a#aaacabccdeggacge.#aa####a#baaaabbabaaaaababbaaaaaaaaaaaa#########aaaaaaabda#aaabbbacbcdbbcdeca#a#aaaaa#a#aa#aa#############aa#####a#aaabcfgcabaaaaabaaaa#aaa#####babbbcccc##aa#a#aa#aaaa###aa#aaaaaaaaaaa#aabbaaaa###a#a#####abba",
-"###aa##aa##########a#acbcccbbbbbbbbbcceffebaa#############accbaaa######a#bdcaaa####aa##aaaaaaaaabaaaaaaaa#abbbaaaababcddccbcccccbaabaaabbbbbca####a######aaaaa##a##bbabcbdgefeed########a#a###ab#aabbbaaaaaaaaaaabaaabba#####a#.#a##aaaabca##abbbaccbbdcbcdedb#aaaaabaaa###aaa#########aa#aaaaaaaaaaaaabceecc##aaaaaa#a#aa########abbacccc##aaa#aa##aaaa###aabaaaaabaaaaaaabaaaa####aa#####a#a#a",
-"b###aaaaa#######.##a##abbdcbaabbbbaabccdegea########a#####abcbba###aa####acccaa######a#####aaaacbbbabbccbbaaccaaaaabbbcccbcbccbbaaaababaaaaabc###a#aa#####a#aa#a#aabdaaacbbafhgbfa.#####aaaaaaaaa#aabaaaaaaaaaaaabbbaaba###a###########baba##aaaabacaabccbccdeeaaaa#aaab####.########.##aabbbaaaaaaaaaaabccaccba##abbaa###a##a###a#aabbccca#aaa#a#abaaaaaaaaacaaaa#aaaabbaaaaa#aaaa#a#######a##a",
-"baabaa#######aaa#####aabbccbbaaabbaaabccdfeba#######aaa###abcabbaa##aaa####ddbaa######a###aaaaaaaaaabbcbbbbbccaaaaaabbbbbcccccbbbaaaaaaaaaa#abca##a#aaaaaa##aaaaaaabcaaaabaabgicce##.#a##aa#a#aaaaabaccbaabaaaaaaaaabbbaaa#aabb##########aa#aaaaaaaaaaabccccddfebaaaaabbaa################bbbbbbaaaaaaaabbbc##acbbaaaaaa####a#####aabbbcccb###aaaaaabbaaaa#a##aa####aba#bbaaaaaaabaaa#######a##a",
-"baaaaa#######aa#######aabccbabaabbbaabbbcdgdb#a########a##abdbbaaaa##aaa##abdcbaa#############aaaabbbbbbbbbabccaaaaaaaacbbbcccbccccbbaaaaaaaabbca#aaa#a#aaaaaacbabaa#aaaaaccbbjgabc###bb######abaaabbcccbabbbaaaaaaaaaaaaa##aaaaaa#######aa###aabcbaaaabbbccdeeefebaccbbbbb#.####a####.###abaabbbbbcbaa#aaabca.##acccbaaaa########aaababbcba##abaaaaaaaaaaaaaaaa#aaa#baaababa#bbaaaaaaa#######aa",
-"aa##aaa###############a#abcbabbaaaabaabbbcffcaa##aa##aaaa#abbbbaaaaaaa##a##abdbaa##############aaaaabbaacbabbbcaaaaaaaabbbaaabacbccbbbaaa#aaa#aabb#aaaaaaaaaaabbbbaaaa##aabbbadiabbc.##c#######aaaaaabbccbbabbaaababaaaaaaaaaa##aa#######a#####aabbaaaabcbbbcddcefhgceeaabba##############abbbbbbcbaa###.###aca####aacdba#a#a######aaaabbcbbaa##aaaaaaaaaaaa#aaaaaaaaaaaaaa#bababaaaabaaaaaaa#ab",
-"cb####aa################abcbbbaaaaabbaabbbdgdb##a#aa#aaaaa#abaabaaa#bba####aaddba#######a#########a#abbaaccccccbaaaaabaabccbbabaabcbbbbaaa#aa###acda####aaaabaaabbcbbaaaaa#bcbcebbccd#.aba######aaa#a#acbaaabbbbbaaabbdbbca##ba###abc.#.####.##a#bbaaaaaaccccdecdefghgfccccb#.####.#...###aaaabbabddba###...##bb#####a#bcba##########aaabbccaa###aaaaaaaaaaaaa##a#aa#aaaaaaaa##ababbaabaaaaaaaab",
-"ec##########a##aa#.#####abbcbbaaa#aa#ababccfffcaaa#aabaaaaaabbaaaaa#aba###aabbfdaa###.#############a#aaabbccbbccaabbaabbbbbbbbabaaabbbbbaaa#a###aacdba##aa#abbacbbcbbbaabaaabbceabccde.#c#aa######aaa#aaa#aaababbabaabbdefecd#aaaaaaec#.#########aaaaaa#aacdcbdbabdfegddffdba##.#.###.###aabbbbabbccbba###.#.##bc#######abbba########aaabbbddcaa##aaa##aaaaaaaaaa#aaa#aaaa#aaaaaababaabbaaaa##ab",
-"bca######.#####aa#######abbbbac#a##aa##abcdcehfaaaabbbaa#abcbbbaaa#aaba#####acegdaa####.############aaaaabbbbccccbabababcbbbbbaabbcbbabaa##aaa###aacebba###bffcdbcbbcbbcaaaabbbhbabbcee.##aa##aaa#acaabbaaaaaaabccaaaaaabdefge##aaaacea###########a######abdfdabaaaaababaceeb###.#...#.##aaabbbabbbaabaaa###..##bea###a##a#aca#a#a#####aaababb####aaaa##aaaaaaaaaaaabaaaaa#aaaaaababaaaaaaa###ab",
-".#a###########.b########aacaaaacaaaaaaa##acdffgbaaabaaa##aaehdbaaaa#aaaa#####acfgbaa#########.########aaaabbabcdecbaabbabbbbbbbaaababaaaa######a##aaddbaaaaab##a##abccccccbbaabfhaababgd.######aa#aaaaaaaaaaaaabacdddbaaaaaaddeda#aa#ba######..##a########abdcaaaaababcabbbcddb#a###..#.##aaabccbbaaaaa#########abed#########cb#a#a####a#aaaaacb###a#aaa##aaaaaaaaaaaabaa#aaaaabaaaababaaa######",
-"#########aaa###a########abbaaaaaaa#a#aaaaaacdegeaabaaccbaa#acefcaa###aabba###aadfdbbaa####.#############ababaaabcccaaaaabbbbbbbabaaabbbbaaa#####aaaabdeaabbba########aabdedcbabbffaababhd########a#aaaaaaaaaaaaaaacedbabaaba#bfggcaaa#########..#.########aabcb#aaaaaabaababccddba#..##.####aaabbaaaaaa##...#####acecb########abba#aa#a#aaaaabbca##aa#aa#aabbaaaaaaaaaaaaaaaaaaabaaaaaabaaa#aa##",
-"##########aa###a#####aaaaaaa##aaaacc#a###aabbcefbabbcfcddddbabgfa#a#aaaadbaa##abdedcaaaaaa#############a#aaaabbbbaacbbabbaabbaaababbaabababa##a##aaaaaccbbbb########.###abbacdcccgbabbbcida####aa#a#baaaaaaaa##aaabccaaaaaacbbabggb#a#####aa##..##aa######aabbcbaaaaaaaba#aabbcccca#.########aaaaaaaaa###...#######abdec########abb#aaaaaaaaaaabcbaaa#####aabbbb#aaaaaa#abba#aaaaaabaaaaaaaaabb#",
-"###########aaaaba###aaaaaa####aaabdebca###aabbcfgfbacdccdeheaadgea###a##dcabaaaabdedcbaa##################aaaaabbbccbaabcbaabbbbabbabbbaaabaa#####aa#abddbcb##a########a##.##accdeedbcccejcbaa####aaaaaa#a#aaaa###aabbbbaa#bdbb#chfa####a########.###########babbaaaaaabaa#aaaaabbcdc#..######aa#aaaaaa###.#..#####a#abdeba#######bbbbaaa#aaaaaabcca#aaaa#aaaabbbaabaaaaaaaba#aa#bbaabbaaaa#####",
-"######a##a###a#aaaaa#aabaaa##aaacddbbcaa##aaaabdifdadeeddfffaabdddbaaaaabd#aaaaaacfedcaa#################aa###aaaacccbbabbbbaaabbbbbbbbbaaaaa######a#aaacdddaaa#########a######aabbicceedghcbb##aa#aaaaaa#aaa#a####aaabbaa#adffbafgd####aa###################aaaaaaaaaaaaa#ababaaabbbcb#.####aaaa#a#a#a##..########a#aabbcdd#.###a##bbaaaaaaaaabbbbba######aaaacbb#abaaabaa#a#aaaabaabbbabaa####",
-"######aaaaa####aaaaba#abaaa###a#bddccaaa######abcfgghhhfdfffcacbabdecca#bca#aba##aeffeba##############.########aaaaccbbbabcbbbaaaababbbbbbbaaaa######aaaabeeaa#aaa######a###a#aaaabfgdbbddhhccb###aaaaaabaaa###aa##aaaaaaaa#bffgd#cda##a#a######a#a###########aaaa#aaaaabb#abaaaa#aaaabbca####aa#aaaa####.#############aaabcdc#####a#abba###aaabababc#aaa##aaabcaaaaabaaaaaaacaaaabaabbbbbaaa###",
-"a######aaaa##a#aabbaaaaacba##a##acccddbaa#a##aaaaacccdefefefdacaaaacgebcdb#a##aacbbegfdba#aba##############aa###aaabcdbccbbabcbbbbbbbaabbabaaa###a###aaaabcdb#baa#a###########aaabddgcdcbbcfidbcb#aaaaabaaa#a#a#abaa###a#aa##dfffeaa#####a#####aa##b.######.###aaaaaaaaaacbacaabaaaa#aaaacccaa####################a########abceca###aa#abaa#aaabaaaacda#aa###aacaaaaaabaaa#aaabaaaacbbbbacaaaaaa",
-"aa##a###aaaa#a##aaaaabbbbbbba####bbbacbaaaa##aaaaaabccbdedcefaccaaa#accccaa##aaabcddfgefeeffea################aaaaaabbcbcbbcbabbbaabbaacaaaa#a#######a#aaaacfcaaa##a############aacdee#a####eifccc#aaa#ccaa###aaa#ba###a###a#befffd######aaab###aa############aaaaaaaaaabbcbcdbbaa###abbaaabccdca...#######aa#a####a######aaaabcdc######aaaaaaaaaaabbcdbaaa##aababaa##aabaaaaaabaa#abbbbaaba#aaa",
-"#aaaaa##a#.###a#aaaaaceccbbbab##aaaaaaaaaba#aaaa#aaabccbcdddgfdaaaa######aa##a#aaaeggihgeefeddeca###############aaaaababcbbbbaabaaaaabacbaaa##a#####ba#aaabadgeaa#a##a####a##a##aabbeeaa#####bhibaca##aadbaaaaaca###########aadfddfda###abaabb#aaba#####a######baa#aaaa#abdc#bccbaaaa###ba#aaabdfeec#########aa#aaaa####aa#aaaaabde###a###aaaaba#aaaabbccbaaaaaaaaaa#a#aaabaaabbaaaababbbbaabaaa",
-"##aa####a#####aaaaabcccbbbcbbaa##aaaaaaaaabb#baa##aaabbcccdefgiecbaaa##aabba###a#affghihfccdddddeca################aaabaaaabaaaaaaaaa#aaaabaa########aaaabaabcgcaaaadda#aa#######aacdde#######aegbbdbaa#adbbaabcaa#aa#########acfeeecaaaaaaaabbaaaba###########aaaaaaaaabddfbaaababaaaaaaa##aba#acefgca###aa#####abb######aaaaaaabcfa##a###aaaabdaaaabbbbdb###aa#aaaaaaaaaabcbbbbbbabaabbbbbbaa#",
-"####aaaa#a#####aaabccccbaabcbcca##aaababbabbabaaaaaabcccbacddefffdccabccdedaaaabdeeffgggeccddccdcdca#a##############aaacaaaabaabaaaaaaaaaaaaaaaa###aa###aaaaacdgcaaabaaa#######a##abdchaa######.cfcbcb#a.bffcbbbab###aaaa###a###ceedddabcbaaaabbabbaaaa##..#####aa##aaaa#acecbbcbaaaaabaaaa##aba#aecbccdcabaaa##abbaa#a##aaaa##aaaabdd##aa##aaa#aaababbbbbdb#a##aabaaaaaaaaaaaaabbbbbbcbbbbcbbaa",
-"aaabaaaa####aaaacccbbcbbbaaaabdaaaaabcaabcbbbbbaa##abcddcbcdefedffedbdccdeec#aafffdddeffcccbcdcccccccaa#############aaaab##aacaaaaaaaaaaaaaaaaaaa###aba#aaababdefaaaaaaa##a###aaaaabccgcaa#######bgcdeca##bhgbabaac##a#aaa##a###befddfdddbddbaacabbbbaa####.#######a#aaaaaacbaabbbaa##ababa##aa##acaaaabbcb#aa#a#aaa##aa#####a#a#aaaabeca#aaaaaaaaabaabbbbbdb#aaa#abaaaaaaaaaaaaaaaaaabcbaababaa",
-"aaaaaa#aa#####abbbcbbabcccbbaaabbccccdbabccbbbbbaaabbcddcbceeeddeggddfbcdeec###dffedddeddcccedccccbbcdb#################aa#aaabaaaa#baabaaa#aaa######aaaaaaaabbcdfaaaaaaa#a####a#aaaabge##########bhcbccaabdeeaaaa###a###aaaaaabceedefeeedeeccabbabcbbaaaaa##.#.#######aaaabbb#aaaaaaaaaabaa##a##aaa#acbcabca###aa####aa#########a##aaaedb#abaaaaaaabbabababccb#aaaaba#aaaaaaaaaaaaaaaaabbbbbaaa",
-"aaabaaaaaa###aaabbbbbaaaacbbbbbcccddefdaabbbbccbbbbabbccbcdddddeeeffefcedffedbabeeecddcbcccbdbbbabbbabba#aaaaa##a######aa#a##aaaaa#a##aaaaaaaaa###aa##aa###aaabbdedaaaaab#a####aaaaabbgha#a########becaccdfgddda#aa#aaaabaaa#a#addeecdcdfeeeddcacbbbcbbaaaaaa###########aabacbaaaaabaaba#baba#aa##bbbdbacaabcb##aaaaaaaaaa#########a#aaabddbaaaaababbbbbaaabcccbabaaaabaaaaaaaaaabaaabaaaabbbbaa",
-"abbabbaaaaaaaaaaaabbabaaaaabbcbbcdedfggccbaaabbbbccccbccddeddccdddcddecddeffddecddccacbaacbbbbaabaabaaaaaaaaaaaaaba####a###ba#ba#aa#####aa#aaaaa############aabbcdebbbaaaa########ababdhf#a#########afecfffebceaa###aaa#aaaaa##abeeddddeegffdcfdbbabcccbaaaaba###########aaaabaaaabbaaabbbaabbaaaaacdcaacaaaabca##aaa#aa#aa#aa#######aaaaacee#bbaababbbbbbbbbccdcaaaabbaaaabbbaaaaaaaaaabaaaaaab",
-"babbaaabaaa#aaa#aaaaaaaaaaaabbbbcdbadccdbbbaabbbbbcbbccdeeedeabcccccccccdeedfddcccdbcbaaaaaaabbbaaaaaaaaaccaaa#aa##aaaabbaab#a####aa####aa##aaa###############abcdedbcba#####aaaa#aabbdhie.#####a#####fgffececeda###aaa#aaaaaa#cddecddcddefeegefeccbccccbaa##aaa#.#####.##aaaabaa#aaaaa#aab#bcccbbccbbaab#aaaabcbbaa#aaaa#a#a######aaa##aaabdfdbbbbabbbbbbbbbbccccaaaaaaaaaaabbbbbaaaaaaaaaaba#b",
-"bbaaabbaaaaaaaaaaabaabbbaaaabbabcedcbbabccaaaaabbbaabbceffcccbbcbbbbbbbbddcdddbbbabbbbaa####aaabaaaaa##aacfeaa######a##aaabbbaaa##aa#a#####bcca#a##aab##aaa#aaaacccgdbbb#######aaaaabbbdhhb###########aeifddbbceda#aaa##aaabaabefffcdddccdeeeedeffefeddccbaa##aaa###.###..aa##aba##aaa#aaabaaabccddcccaabaababaabcca###aa#aaaaa####aa#####aaacffbbbbbbbbbbbbbbbbcdcaaaabbaaaaaabbaacbaaaaaabbbab",
-"babbbabbaaaaaaaaaaaaabbbaaaaabbbceddcbaaabbbbbaaaaaaabcdffdcabbccbbaaaabbbbbbbbaaaaaabaaa#a##aaaaaaa####aadd######a########abbaaaa##a#####a#aa########aaaaaa#aabbbbdgcaaa###aa##aaaaabadfgb######aa###aadidcdbaceca#aaaaaa#abcdeeeccdeddccddeadeefffffffecbaba#######.###.##aa#abaaaaaaaaabcaaabaabcbd#abaabbbbaaabdba#a#a##a###aaaa#########aacefdbbbbbbbbbbbbcbcccaaaabaaabbaabaaccaaabbaabbaa",
-"baababbbbabaaaa#a##aaabbbaaaaabccehdbaaaaaaabbaaaa##aabdgieccccbcbaaaaabaaaaaaaaaabaaaaaaaaabaaaaa###a###aaa################aaaaaacba######a#a##########aaaa#abbbbbcdhb##a####aaaaaaaacbfe.##aaaaa#####aadhcbbaaefbdb##aaccddfgedbddccccbbcdedceceggfeefefdcbaaaa#####.###.###aaaaaaaaa##aba#aaaaababdb#aa#aaabaa###bcbaa#######aa#############abdffcabbbabbcbbcbcbcdcbbaaabbbbbbbaacabaaaaaaaaa",
-"bbbbabbbbbbbaaaaabdcabdcaaaaaabbcdffcbaabaaabbbaaaaa##bcgjfbbbcdddcbbbbbbbbbaaabaabbbaaaaaaaaaaaba#########a#a###############aaaaaabaa#######a######aa#a##aaaabcbabbcceda#aaaaaaaaaaabbbec.a#aaaaaaa####aadhcabbbeecbaaadefggfeddcddcccccbccdccdddeghggeeeddcbaaaaa############abbaabaa#aaaaaaaaba#ba#aaaa#abaaaaa##aabbb###aa#a#a##a##########abbcffdcabbcbbbcccbbccccbaaaaaabbbbaabbabaaaaabba",
-"bbbbbbbbbbbbbbaaabfdcccbcbaaaaacdceebaa####aaabbbbaa##bdghfcbaaacdddccccccccccbbababbbaaaaaaabbbaa#a##aa#a#b##a#aa###a#######abaa###aaaa##a################aaaaabbbcbbcffaaa#cbaaaaaaaacec.#####aadea##a#aabgdababdfda#adfggeddccccbbbaccbbcbcddddgghigffffbabbaaaa##########ab#aaaaaaaaaaaaa####aaaabaaaaaaaaaa####a##aaca##a######a#########acbbbbcdefdabbaabccbbbbccccbcbaaabbbaaaababaaaabcc",
-"bcbbbbbbbbbcbbbbbcecccbaccedaaabddcaaa#######aabcbbbaabdfhfdcaa###acdcabdfeeedcccccbbcbbaaaaaaacbaa###aaaa#aaa#####a#aa##aa###ba###aaaaaaaba############aa#aaaaaaaaaabbbfgaa#adbaaa#aaaaehaa###aa#adea#a#aaabgbabacefdb#dfffedccbbaaaaaaccbbcdecdggihihhfdffcbbaaaa###aa###..#aa####baaabaaaaaa#####aaaaaaaa#aba#a###abaa#cbaa##.##aa####aa##aa#baaaacccefdbbabbcccbbbdccdbaabbbbbbbaaabbaaaaabc",
-"cabaabbbbbbcbcccccddb##abaccbabbdbcaa#a##a####aabdcdbbcdddghcbaaa####bcacigggecbbbcbcbbabcaaaaaabaaa#a##abb#########a##aaaaaaaaaa###aaaaaaa########aa##aaaa#####aaaaa#acegfaaa#aac##aaaachfc###aa###aabb###a#bbabccddefdceffedbcaaaaa#aaabbbbcdegihhhhgggdcffecabaaaa##a##.###abca#aaa##aaaaaaaa######a###b###baa####aaaaaaaaabca###############aaaabbbbbbdfebbabcccbcdcbbdcbbaababbabaabaaaabbb",
-"febaaaabbbbcdcccccb#####abbabbcccbbaaa####aa#a#abdeccbddeeehgcaa#a#aa#addhifdddbbccbcccbbbbaaaaaababaaa#aaba####a##a#a##aaaa#aaaaa#a##baaaaaaa#####b###aaaaaa##a##aaaabcefihefc##aaaaaabbdha####aaaa#ab######aaaabbccdefegffdcccaa#a##aaaaaabbehhhhffffcddbdcdbbba#ac######..###bb###a#abaaaaaabba#####aaa######a#aa#####a#####bbca###########a##aaabbbaaaabdfdbaccbccbcbbccdcbbbbaaaabaaaaaaabb",
-"dedbbbbbbccbcdccddb#####bbbaacccacbaaaa###aaaaaaacfdcbcdegghigbaa#aaaaaadfhgedcccccbbbbbbbbbbbbbbbbaaaaaabbba########aa#aaaa#abaaa####aaaaaa############aaaaaaa###aaaabcfghgihfbcb#abaaabbge####aaaaab######a#aaaaaaccdeeddfdbcbaaa##a##aabaafhgggfedccccdccbaaabaaaaaa#########a#####a##aabaabcaa#aaa#a#####.####a###########a#aaaba##a####a#aba#aaaabbaaaaabdeecccbbcbbccccdcbabaaabbbaaaabbba",
-"bccdcbbbcccccbcdfda#####acbabcbaabaaa#a###aa#aabbbefedcdffiihhcaaaaaaaabacfffefedcbbbbbaaaabbbbbbbbcaaaaaabaaa####a###a##aaaaaaaaba#####aabaa###########a#a####a###baabccghfhiieaa##aaaaabdga##a#a#aaaa######aabbaaabbbcddegdcbbaa##aaaaaaabbfedfddecbbbbbbaabbabbaaaaaaaaaa####aa####a#a#aaaabcbaaaaaaaa##############.######a#a#aabbba#a####a#aaaabaaabaaabbabcfedcbbbcbccccccbabbabaaaaabbccb",
-"bbccccbbcccccdddeca####aabbccca##aaaa##a#####abbbbeeffeeccfjjifbaabaaabbbcdecdeffdbcbbbaabbbccccbbdcbaaaaa###########a#a#aaaaaba#a######aaabcaaabaa###aa#aaa######acedbcdfihfhifba####aaaadhc###aaa###########a#bbaaabbccccfecaaacca##aaaaaccffdfccedbbab#a#aaaabbaaabababaa###########aaa###bbaa#aaa#abaa##########.########aa####a#aabba#a###a###aaaaabaabaaabbbcdfedbcccbcccccabbbbbbabbbbbbc",
-"bcdcbbcccccddddddba####abbbbdca#a###a###aa####aaabcededcbbgiijjhcabbaaaaaccddddcceedddddddeeefedbbcbcccbbbbaaa#a###aaaaa###aaaacaaa##a###a##acca############acaaaaa#abbccdghccggfcaba#aaaacggdaaa###############abbbaabbdeefedbaaaadda##aabbchedeefedbaaab#####aabbaabacbabaaaa########aa#a###aa####aaabba##a##.#############a#a####aaa##abdba#########aabbaabbabbaabdeddcbbbcccccbbbbaabbbccbba",
-"bbddccbccdccdcebcbb#####abccbcd######aa##a######abcddcdddeggiihhhdaaaabcccceedccbbcbbccbccdeeeggfeddccdeccbbaaaaaaa#a##aaa###aaaba#a##aa######a#####a######aaaaaaabaaababcehb#adcbdbba#aaabdceaa#################abbbbbacgeeecca###bedcaa#adfhccdffbbbba###a####aaaaabbbbaaaba###aaaa##########aa#.##aaaaa#aa#b######a#######aaaa##aaaa###abcdb######a#aabcbaabaabbaaabcdedbbbcddcbbbbcabbbccbbb",
-"bcdfdddcccdddcecbb####a#aabccabaa#####aaaaa#####abbccdedeedcijfggfabaabbbbccddccbbbabaaaaaaaaabbbgihihffedccbbbbbbbba#a#aa####aaaaaaa##aa#######a###aaaa########abaabbbbaccega#cdaaabaaaaabbfea#a#################abbbbbaeedddcbaaabacceccefihdccedcbaa##########aaaaaaabbbaaaa#####aaa##a############aa####aaaa######a#####aa##a##aaa###aaa#a#abc#aa###aabcaaaabbbbbbbbbbcddcbccddcbbbbabcccdcc",
-"ccbcffhfdddddccadbaa#####aabbaaba##########a##aaabbaacdddfeehjifgha#aabcbacddccbbbbbabbaaa#aabcccefgdddeffeecdedbbbbcba###aa####a##aaaaa##a###aa###aba#aa######a#aaabbba#abbfcbcccccbaaa#abbfjg#aa###########aaabbaaabbcbdedcdbbaaabbbcceghhiiedcedbbaa######a###aaaa#abaaaaaaaa##aaa##a##############aa####aaaaa#####ab#####aa##a###aa#aa#a#####aaaa##aaaaabbbbabbbbbbbbbbbbdddccddccbcbbbcccdd",
-"eecbdggfdddedcacda####a###abbaaca######aa##aaa#aabcababcdeeedgigdfgbbcbbbbbcccbbbbbaaaaaaaaaccddddefdecccbbcbbddcbccddedcaaa#a#aa##########a########adbaa#########aabbbcbcabbdcdcbbbcbaa##abbfiaaa##############baaabbbbccedcccbaa#abbbbbefgihfdcccbaaaa###a######aaba#abaaaaaabaa#aaaaaa######...#a#.#####aa#aaaa########a##aaa###a###aa#aa#aaaa#aabbabaaaaabcbbbbbbbbbbbbbbbccdeddcccbdccccdde",
-"eedfhhfcba#abb##a#####a#aabcaaccbc#####a#aa#aa###ccbbbabcdfffhgifehfebbbabbcccbbbbbbbbaaaa#ccdcddfghfeccccbbbbabcddegcbccdcaaaaaa###a###a######a#a##accba#########aaaabbccbbcbcehb###cbba##bdehe###############aa##aabbbccdcbccba##aacccbcceffedcbbaaa#####a######aaba##aaaa#ababcbbbbcbaa########.#.##a####a####aa######aaa###aa####a###a##a#aaa####aaadbbaaacccbbbbbbccbcbcccbcceeeeededcdbccd",
-"dgghigdb##a#a########baaa#abbcbdbbb#####aa#aaaaaaabaababcdegiihdggffdcbaabbbbabbbbbabaaaaa#ccdccdegedccbbbbbbcbbbbaadbabaacdb###aa###############aaaab#aa##a#######aaaaababbbabbfieaaaa#aaa#chke.#########..#aaaaaaaaababbccbbcbaa#aabbcbabcdeedcba###a#####a#a##.###baabbaaaaaaaabbaaba#########....#.#######ab#a#######a######a#########a##aabba###aaabbbbbbacdcbbbbcbcccccbdddeededegeddddcdc",
-"dhghhfa##a######a######aabaacccedaaa#######aaaaaaaababbbccdghgfedgfgcabaaaaaaabababaabaaaaabdcceeeecdbbbababbbbccbbbbbabdbabcba#a############aa##aaaaab#aa###########aababcbbaabeggh######aaagj##############aa#####abbaabbbbbabbbabcabbaaaabcddccba#######.###########ccaaa###aa##aaaa###a###..##....#.aa##a############aaa#####a#####a###aaa#aaaa#aaacaabbbbbbeccccbbccddccdegghhgfeegd#bddccc",
-"ffhhhe###########a#####b#bcadddcbaaaa#####abcca#aaaaaaaaabdhihgddfgfgcaaaaaaabbbabbbaabaaaabedcefecbbbbbbabbbaaabbacdca#aaa#bbdb#aaa#########aa####aa#a###a#####.###aaaaadbbaabaddcggbaaaa#bbdia#a##########aaa###aaabaaaabbbbbbaacefebaa#aaaabcccbaaaa###########.#.##ad#####.##aaa#aa#aa#####...#...###ab#ba######a###a##ab#####a###aaa##aa#aaaaaaaabbbbbbbbbbceddeeccbccccddfhijjhggghb#bba##",
-"#afhgcaa###########a#a##aabcddca###aa######abbbabaaaaabaaaeiiihgbbgeddaaaaaaaaabbaabbbaaaaabdcccddddccabbbbacaaaaabbbaaabaa##acdd###a######..a#a#####a#aa##a########a##aaecb#abbbcccfgaaaaaaaeia#a#a##############aabbaaaababbababdgeca####aaaaabcbbba#####a####.#######da##############aaaa#######.##.#.#ba########.#a#aa##abba##aa#aa#aa###aaaaaaaaaabbbbbcbccccefgeeccbccbbbbdfiihgggeb#aaaa#",
-"##bhgd###############ab#ababcdd###aaaa####aaaaaaaaababaaaadhhigebabfddcaaaaaaaaaaaabaaaaaaabcbbbcbbcecbbbabbbaaaabbaaaaaba###abadea#########.#a##########aa#a###a###a####aabbabbaadccghbbbaaabfi#a##a###aa####a##a#aaabaaaaaaaabbacfdba##a#aaa#aaaabbb######a######.##a#######aa#a##a#a####aa#####a#.#a####aa#########aaaaa##aaa###aa#aaaaa#aaaaabaaaabcbbbbccccceeceeeefedddcbbceeffhgfebaa####",
-"##.dhdb#########ab###bdababaddc######a###.#a######aabacaaaadghfdbbabecdba###aaa#aaaaccabaaacababbbbbbbcbcbbcbaaaaababaaaba####abbcfbaa#aaa###.###ab#####aaaa##a######aa#ba#aabbbabdcabefbcaababhe#a##aa##aa###a#####aabba#aaaaabbbefcba###aaaa#aaaaaaaa#########a#.##############aa#bb#aaa##a####.###########aaaaa#######aaaa###a####a##aabaabaaaaaaaaaabbbcccddebbbbdedefdcccccbceeghgfdaaba#aa",
-"aa#aeea##########c####ba###aca#####aba#############abcabaa#acdefccbacdbdc##aaaaa###aabdbaaabbcccbbbbbbbccbabcabaabbabbaaaaa###addbcdba#a################a####aaaa#aaaaaaaa#aaacbabdcbbbehca#abbeh#aa######aa######aa#aacfbaaaaaabbdgdbaa###aaaa#aaaa########.###aa#a.###########aaa#bbaaaaaa####a#.##.#######aba#####a#############a#aaaaabbba#bbbbaaaaabbcddddddbaabcedccbaadfdcceeggdbaaaaaaa#",
-"aa##ada#a########aaaa###a###a######abaa#########aa#abbbaaaabbcddeeebcdbabb#aaaaaa####aaaabcccbccbaabbbabccbaaaaaaaabbaaaaaaa##aabcccfeb##############a####ab#aaa##aaabbaacababaaaabcdbccffc##abeh.##aa###a#########aaaaacbabaaaccddfgdbaaa##aaaaaaa#######.##.#######.#########aaabaab########a#a##.#########aaa#####aa##a#aa###bdaaba#aa#aabaaaabbbabbbbcddefecbcbaabbdcbaabcecccefgcaaaaaaaaa#",
-"aaa#aaaa#aaaaa#####aaaaaa###########a#####a##ab#a##aacabaaabcccbdhedfdbbabc#aaaaaaaba##aaaeheaaaaaaabbbacddbbaaabbbaaaaaaabc#aa#a###cfgb#a#########aa###aaaccaaaaaaaacbabcdaacbaaabcddcccgfcaabeg.#a#aa#a###aaaa####aaaaabaaaaaaceefhfdbaa###aaaaaa########.####.###.####.####aa#abcbaaa####aaa#############aaaaaaaa#aaaa#ba#babffb#acb#aaaabaaabbccabbcccfgdaa##bcbbaaacbcbacebbbcddbbaaa#a####",
-"accccedaa#aa#aaa##a#aabda#################a#a#a##aaaabbbabbcccdcccfcfecbaaceca#aacdbcccba#ahgabaaaaababbbccccbaabbbbbbbaaabcb###aca#aabcc##a##########a###a#abaaa#aaabbddddbbbcbaaaaabcdddhecccg######ba#a##.#a###aaceca#cbaaaaacdefhgfcaaa#aaaabba#########..#####...#.#######aaabccbaaa####aa########.####abb##aa#aaa#a#ba#abbefba##bbbaaaaaabbccc#ccddeffcaaaa#baaaaabebbbbcbbbbcbbbbbaa##a##",
-"#abeeebaaa###aa###aa###aaa###################aa###a#aabbbbcddddccefegfcca#adhbaacccaaabcbcdecaaa##aaacabdabdcbaabbabbaaababbcb#aabb#aa##dea##aa#######aaa##a##aabaaaacacdfebbbbbbabccccfeddfgfed...#a##aa###########acdbabbb#aa#acddegfecbaaaaaaabaa#########...#####.#########a#abbbabba##aa#####.##....#####a##aaaaaaaa#baaaceeebaaaaeedbbbabbbccb#cedddcccbaaaaaaabaa#bebbbbbbbbbbbbbaaaa####",
-"##aadba#aa##a#######abbda################a#######aaaa#ababccdeeddffhhgccbaabefdbbaaa#aabcbbabca#aaaababbbbcccbaaacaabaaabaaaabbaaaab#aaaaefaaaaaaa#.###a#a#a######bbbaabccabbdcbabbcbcdbbaaaefeiiffa####a#######a##aaaaabbcba#baabdddefffdcaaaaaaaaaa##########...##############aabbbbbdabaaa###.....########aaaaaaaaaaaaabcccbdfebaaaaaacfdccbcddc##baabcbabaaaaaaaaabaaaedbcbcccccbbccbaaaaaaa",
-"a##aba#a####.######a##bgb#######a########aa#######aaa##aabbcceedddeghiebaaabccebaaaaaaaabaabaaabbaaabbaaabbbbbaaabbaaaaaaaaabbccbbcba#####cfebbabbbacaaaaaa#aaaa###acbbbbbbbbcbaabbbccbaaab#.aceffdfghfa#a####aa#aa##acbacbbbaaaaabcedcddedbaaabaaaaaa#######..#.################aabccccdbbb####.#..#..#.#..########aa#aaa#aaabdddbcababbbdeddedeeb####aaaaaa#ba#aababcbbbaeccbcbcbcbbbbaaaa###a",
-"ba#a#####a#############cb#########aa##a###a####ab#aabaaaabbbbedcdccehihcbbbbbbccaaa#a#aaaaabbaaaabbbcbbaaabbbccaaabbaaaaaaaaaabbbbacda####aaedbaaabddba#aaab###aa####aaddcceebabbbcbcdca#aaba#aaabaabfmka##aabaaaaaa#abbabbbbaaa#acccdddccedbbbbaaaaaaaa##a####.#.###############aabddcbbcaaa####.#......aa###aa####aaaa#aa##aacccccbbbabbcdedddea####a##aa#a#bccbccbcbbaaaadddccbbbbbbaa#aa####",
-"ab##aaaa######a##########aa###b##aaaaa##a#a#####ababbbaababbbccccdcdgjifbbabbcccca#aaaaaaaaacaaaaabcccbaaa#bbbcaaaaaaaaaaaaaaaaccbaabbaa#a#a#bcbbaa##a###aaba######aaaaaaddfhgccddddacacaaaaa#aaaaaaabhnk.aabbb##aa####aa#acaabb#aabccddeecccbbbabaa##aa###aa#######.######a###aaaabdddcdedda#########...#####aaaaaaaaa##a###aabcbbccbbbbcddeeefc##a####aaaaaacdccbbaababaaabccdccccbbbbaa#a####",
-"#####a#aaaaa###aaa######ba###aa#bba#aa#abca##bb#abaabbbbbbaabbbbdccceihgecbcdccbcd#ababa##aaabaaaaaabccbaabbddbbaa#aaaaaaaaaaaaaccbaaa#a######aabdcb##aaa##a#a#####aaaa##aabffebccddcb#aa#######aaaaaadlnd#aabbabaaaaa##aaaa####aaaabccdeedbb#aa##a###############.##..#.#####aaaaabccdeecdaa#####.########.###aaa#aa###aaaa#aaabcbccccbbccddeef##aaaaa####aaaccbaabaaaaaaaaba#bcddcbbbbbb#aaa#a",
-"abaa###aaaaa##a#a##a#############a#a#ababda#aaaaaaaabbaabbbbcbbbddbddgifhedbcccbbcc##aabbaa#aaaaaaabaabbbccccdebaa##aa#aaaaaaaaaabedaaaa##########becaaaaa#a#########aaa##abceffdccb##aa########a#abbabilk#a#a######ab#aa#aa#####aaabbcddedbaa#a######a#####################a#aaaaaabdddfgfc##########...a#a###aaa#a#aa##a###aaaabbbbbcbbbcceghfaaaaaaaabbabccbbbaaaaaaaa#abba#aacedcccbaaaaa#aa",
-"bbaa##aa#aaaa#aaaaaaaaa#aaa##########abaaaa#baaaaabbbbbabbbbccccddbddggghhfdbbcaabbbbbaabbaaaa#aaabbaaabbb#bbbaaa#####a#aaaaaaaaaabb##aa##########aabdcbabaaaa####aa###aa#abbcdhhcaba#baaa#######aaaaabhlmc#a#####aaaaa#a##abba#aabaaabcdgfbb################################aabbaabbccdhigca#########.########aaa########aa#a##aaabbbbccbccdgfha#caaa.##fedbbcbaaaaaaaaa#aaa###aaadecccbbaaaaaa",
-"#aa###aaa#a#aaabbbbbcbaa##a#######aaabaababaa#aaaaabbbbbaaababccdecdfhhiihgfdbccbbcbabaaaaaadca##abbaaaaaaa#bb##aaa####aa#aaa#aaaabbda.##########aaaabddcbbaa#a##aa#aaa##aaabbdecca#a#aa#a########aaaaaeili##a######abaa###aaaaaacfeaabddcdbaa##############################aaabbbbbbcdfgjieba####.#####aa#aa############aaaaa###aaabcbbcbbcefggcbbfeedbedbcbabbaaaaaaaaaaaaaaa#aaa#cdcddcbbaaaa",
-"aa#a###aa#a##a#aaaabbccaa#aaa########bacbaaaaaaaaaaaabcbbbbbbcedcdccfhfhkhggfdbbccbbabaabaabdda###aaa#aaaaaaacb#########aaaaaa#aaaabec##########aaaaaaabddcbaaaaaaaaaaaa##aabacbaaaba#####a##a######aaabgklbaaa#####aaaaaaaaaaabbbfdaacddeddcbaaa#########aaab##########a##aaaabbcbbbbeffhjifdcb#####.##acbb#aaaa###########aaaa#aaacbcbbcbcegfaccgghgffdcbbaabbbaaa#aaaaaaaaaba#aaaabeecccbaaaa",
-"aaaa########aaaabbabbbbcbbbaaaa#####.##aaaaaaaaaaaaabbbbaaaaadedcdccegijkifddebccbbccaabaaa##aa######aaaaaaba#aa#########aaaaaaaaa#bccda#######aaaaabbaaabddcba#aaaaaaaaaaaaabcdaaaaa##abaaa#a#a#a##aaaafhlg.aa#a#a###ba##b#acaabcdfaaaccdccedba##########adcbca#########a#aaabbcddccbdefggiigecb########aaaa#abba###########aaaaaa#bdbccbccef#abdeddeeddccba#bbbbbaaaaaaaaaaabcaaaaaa#eedccbbba",
-"aa#aaaaa###aaaaaaaaabbbbbbbbaaaa#######aabaaaaaaaaaabbaaaaabbbfeccccdfiljigcdeccccbccbccbbaaaa#######a#aa##aaa#####..#..#aaabaaaaaaabacb######aaaaaaabbaaaacddcbaaa##cbabaaaaabcbaaaaa###a##a####a##aababchl#.###a#####aaaaaa#aabbdeaaacbbbbdfdccbabb####a#ddbbbba##########abbbccdcccddefghhfcaaa######aab#abaaddaa########ab###aaaacccccdefd#dbgebcccdcaabbbaaaaaaababbbaaabacaaaaaba#eeddcbba",
-"aa#aaaaba#a#a##aaababbccbabbbbba########aa#a#aaaaaaaababbaaaaadcccaddfhkjigdcdecccbbcdcecbaaaa######aca####aa#####a#####.#aaaaa#aabababb######aaaaaabbabaaaaabcdcbaaaaaaaaaabbbcaaaa#a####aa####a#aaaaaababjh.####a#####aaa##aaaabdabaaaabbabdeeeddddcb#.##debaaabaaaba####aaabbccdcccddeffgfgcaa##aa###aaaaaccaddca########a#a###aaaccbbceffbaacgeaabbbbabaaaaaaaaaaabaaaabbcaaabaaaabbbccdedcb",
-"ba#a#aaaaa####aaaaaaaaaaccbcbbaa#######aaaa###aa##aaaaaaaabbbabbcbbefffhjihfcbfcbcbbbcfhgcaaa#####a#deaa##aaaa###############a##a###aaaaa###aaaabbaaaababbbbbbbbedcbaa#abbbbbcccaa##a######aa##aaa##abaa#aabja##.#######a#a###aaabecaaaaaaacccbcaaaabbdddefedcbaa###aaaa#aaaabbbcccccccddfggghdba####aababababcbbddba###a###a#aaa##aabbcccegfbaabcaaaaaaabbaaaaabbaabaacaabbbabbadbaaaaabba#aefc",
-"ba#a#aa#######aaaaaaabaabbebdbbb######aa####a###a####aaaabbaabcabcccddffjhfdbaefcdbbbbdjkjebaa#####bccb##baba#####aa######a###a#a####aaaaa##a##aabaaaaaaabbbbbbabefdbbcbbbcbbbcbaa####aa#######aaaaadaaaaabbdg###a#a####a#aa#aabccccaaaaaabcdbccaaaaabbdeeedcdcba###aa#aabaaabbbcbcccddddeffffdbaa####abccbb#bbccdbccaa###a#aaaa#a#aabbdcdfgdaaaccaaaaaa#aaaaababbaaabbbbbabbbbbcbcbaaaabaa###be",
-"fcb#############aa#aaaaaaadegdacbaa###aa####aaa#a####aaaabbaaabaabddccehieabaabecccbbbbbikkgca####acbb###baba#####aa####aaaaaaaa######aa###aaaaaaabaaaaaaaacbbbbbbeffedccbcddddbaaa##aaaa###a##aaa#adba#aaabbie.#.#aa##aaaaaaacecaaaba###a##aabdb#a#aaccccccccbbba###aaa###aaabbbbcccdddedegcddcbbaaaabbabbabbaabbaaddbaa#####aa##aaabbddefgcabagbaaaaaaaaaaaabbaaacabaaaaabbbbabbaaaaaaaaaaaa#a",
-"bdeba#########aaaaa###aaaaacfebbbbaa###aa#####aa########aaababaacbdeccehhbaaaaaddcbbbbbcgijhea####acb########a##aa#a##a#aaaaabaaaa####aaab###aaaaaaaaaababbccbbbbacbedffedcdeeaaaab#aaa#aa##a##aa#a###aa#aabackc.#.##aaaaaabdefb#a#aaaaa#a####abc####abcbbeecbbaaabb#aaaaaaaabbbbcbcdededdefdcaccbca##aaaa###aaaaabaaeccaaa###aaa#aaabcccdffbbacfc#a#a#aaaaaaabbaaaaeabcbbabbbbcbbabb#aaaaaaa#aa",
-"##aba######aaaaaaaa##a#aaa#fdaabbccb###################a#aaaabbabccccdehibabbbbcfdcbbbabgihc#a####abbaa##a###aa##a#aaaa##aaa##aaaaba###daaa###abcaaabaaabbbbbccbcbcdcdddggfedbcbaaaaa##a#####aaaa#aa#####abbbbdjb.a##aaaaabeecabba##aabda######aa####aaabbdcdcbaa#bcbbaaaaaaaabbbcccddedefffdcbccbab####a#####a#aaabaabeeba######aaacbcddegebbacccba##a#aaaaaaaaaaaaccbbbbbabaaa#aaabbaaaaaaaaaa",
-"aa##baa####aaabaaaaa#####aacaababbccbaa##################aaaaaaaabbccbegifaaaabbcecbbbbaadgb#####aeeabc#.######aa##aaaaa#aaaaa###abaa##edaaaa##aabbaaaabbbbbbbccbbdccccdddehhdabbaaaaaa##a###aaaabb######cebcbcgj#aa##abdfggcbbbaaaabdfea####aaaaa##aa###aaa#aaaa#aaabbaaaaaaaabbccddeeddeffeeeefcabaa#aa#####aa#aabbbacccbaaaaaaaabcccdegfbbbceaacb#####aaaaaaaaaaaacccabaaaaa#a#abbccaabbaaaa#",
-"#aaa#daaaaaaaabbbaaaa####abbaabaabcbbbbb##aa################aaaaabbbddehecacbaaaabecbbbbabaa#####adcca#########a#a##daaaaacaaaaaa###aa#aca#aa##aaaabbbaabccbbbbcddaccdeddecfhgcabaaa#ab#a####a####aaa#aaaabbbcbcijdchihgighedbcbbcdfdabbbbccaaaaaa###caa#aaaa#a#a##aaaaaaaaaaaaabcccdddddeeedeeeffbaaaaaa##aa###aaabbbabcdeabaaaabbbbcdegibabbfaabca####a#acca#aaaaaaababbbaaaa##aaababbaaabaaaa",
-"#####adcbbbaabbbaaaa#a#a#####aaaabbaaabcbaa#################aa#aaaaabddgeadbcaaaaabccbbbbba#####a#a##aaaaa###aa#aa#bccaabaac#aaa#####a#..#####aaaaaabcbaaabbbbcdccdcddedceefgfccbaaaaaa#aa###aa##accaaaaaaaabbbbdjkfdfgjjhgfeeeeeedcaabaabaaaaa#####ab#a#aaaa###a####aaaaaaaaaaabbccddccccdccdeeegfbcbcaaa#aaba#aaabdcbbbababbbaabbcccdghg#aadbaabbaa###a##acdaaa#a#aa#baaaaaaaaa#a#aaaccbaabaaa",
-"a##a#aaedbbcbabaaaa##a##aa####aaaababbaabacaaa###a#######a####aaaaaaaccehbbbbcbaaaaacdbbbcb#a#a#a#.####aaa##a#aaaaaaabaaaaab##aaaaaaaa#####aaa##aa##abbaaabbbccbccbcdcdcddeffcaabaaaabba#aa####a##bcbaaaabababbbbejib#abccdcbbccba##a##aaaa##a######a##aaaaa#a###a#####aaaaaaaaabbccccccccccccdeegfcdabbaaaaaaa#aaaabccbbbaccbabbbcddefedea#cd##a#aaab#aaa##bcb###aaa##abaaaa#####aaaaabbcbaabbb",
-"aa##aa#bhgccbbccbbaaaaa########aaaaabcbaaaabbaaaa###aa#####a#a#aaaabbbbcega##acbabababecccdabaa##########aaaaaaaaaaaaaabaaa####aaaaaaaa##.##abaaa#aaaaabbbbbbbbcdbbccddcdcegeaaaab#aaaaaaaaa####aabbabbcbbbcaaabbcegiaaaaaa##abbcbca##.###aaaaa####aaa##abbaa#aaaaa####aaaabbaaabbbbccccbcccdddedfddcaaaaaaaaaaaaabbccdbbbcecbbccdefged#a###fa######aaaaaaaabaa#######aab#aaaa#aa#aaaaaabcccabaa",
-"aa##aadafhhfeccbbbaa#aaa##a####a#aaaaaaaaaaaaaaaaabaaaabaa#aa###aaaaaabbcfd#a#acbaaaaabeecdcc#############abbaaaaaaaababbba###aaaaaaa#a#####aa#aaaaaa#aaaabbbabcccehgeecdegebaaaaaaaaa#aaa#aa###aaaaababccbbaa#aabceggaaaaaa#aaaabcb####a###aaba######a#a#####aaaaba#####aabbaaaabcbbbbcbbacceeddeebabdbabbaaaaaababcdccdccdcbbccefecb#####cc#########aaaaaaaaaa##ba#aaaaabbbbaaa#aaaaaabcccdgdb",
-"##aaacdggggghgdbbbbbaaaaa#aa###a###aa##aaaaaaaaaaaaabcbbaaaaaa#aaaaaaabbbdfd#aaacdaaaaaadgefc#######a#a###abb##a#aaabaaaaaa#######aaa#a########aaaaa##aabbbbbbbbccefhfeeegfbbba#aaaaaaaaaaaa####aa##abbcdacbaa##aabcehfaaaa###aaababa##.##a#aaaca#a#aaaaaa#aaaa#aabcc#####aaaabbbbbadcabbbbbbceedefcaabcecaaabaaababccdcdddccbbcceda#####baeaa#aaa#####ab##aaaaa##aaa##abbbbbbbbaaaaaaaaabbbagig",
-"f#aaaehhfffeffhfbccbbaaaaaaa####a#aaaaa###aaa#a#abaabccabcbabbbbabbaabbbbcehdaaaaaaaaaab#dgeaa##a###########aa####aaaaaaa######a####aaaa###a###aaaaa###aabbbbbacccdedddfgebcbaaaaabbbaabaaba#########abcbdabaaa#aabcdeibaaa######aaaca######aabbb####aaaaaaaaaaa##bbdb####aabbbbaaaacdcaabbbbcceddeccccaba#aaabaaaabccddddddceddeec#aca#aabebaaa#######aaaba#######aaaaabbbabbbbbaaaaaaaaaba#dii",
-"hd#aaejiedefeeddedccbaaaaaa########aaa#######a#a#aaaabbaacbbababccbbabbbbbceidbaaaaaaaacbcgeca#############aaaaaaaaaaaba######.a############a##aaaaaaaaaaaacbbbccccedbcfcbbbbaaabbbbaaaaaaababaaa#baaaabababbabaaaaabdfhaaaaa#aa##b#bbaa#####abb##a##aaaabbba#aaaaaacda#####abbbbaa####a#abaabccbdecdbbaaaaaaaaaaaabccceeedcdfgffeba#aa#aa#bcaaa##########aa##a####aaaaa#aaabbbbaaaaabbbcbbbeefh",
-"ggecdhjkiefeeddcdefdababaaa########aa##a########abaabaabcdabbcdccbcbabbbbccchiecaa#abbbaaaadeca#####a#######aabaaaaaabba###a##.#############a##aaaaaaaaaaabbbccdddbbeccdbbcbbbabbbbbbcbbaaaabccaaaabaabcabbabaaaabaabcefeabaaaaa####aaccb####aaa###a###aabbab#a#aaa##aaa#####acbba#a######aaaabbbbfefdaaaacaaaaaaaabbbcefffeefbed########a##dbaaa#######a#############a########aaaaaaaaaccfgfhdf",
-"efddegijmkfeeeddccdgdbcccbaaa####a#aaa#####a####a###aabbcbabacccdccbbbbbcbbdfijhbaaaaabb###cedbaa###aaa#####aabbccbaaaaa###accb###a##########aaaaaaaaaaaabcbbccddddcddaaaabbbabbbbbbcbaabbbbbaaaabbaaaaabbbbaaa#ccaabbddheabaaaaa####abca#####ba##a####abcaaaaaaaaaa#aaaa#####bbaaa##aaaa##aaabbaaadfdbaabcbaaaaaaabbacehhhhcaaaa#####a#ab##ccaa########aa#############ba#a#aaaa#aaabdaaeffghgff",
-"eddcbcdefijgeedcccbbdeccccbaaaaaaaaaa#a#########aaa##a#abcaacccccccbcbbccccdefikibaaaaaaaabbdddca#a#a#aa####aaabbbaaaa##a##aaaba##aa##a######aaaaaaaaaaabbbbbccccddddaabbaabcdbbbccbacbabcbbccbaa#aaaa###baaaaa#a#aaabcdfjb#aaaaaa####abaa.####a##aa####bcbbaaaaaaaa#####aa##abaaa#a##aaaaaaaaaaaaabecbaababaaaaabbbcbcehhcaaa##aaa#######b#.cbabaa#####aa##a#####a#########aa#a#aaabdefffggfefe",
-"ddcaaabdefhihecdbbbbacdecccbbaaaaaaaa############aa##aa#ababbcbcbbbababccdceeegijgaaaaaba###bfcdc##aaaaa######aaaaaaaaa#aaaaaacba#aaa#a#ba#aa#aaaaaaaababcbbbbbcedabbaabbaaabbbabbdccbbbaabbbbbaaa#aaaaa##aaaaaa#####abcehka##aaa#####aaaa###..a#aba#####abcaaaaaaa#a##a##a###ba########aaaa####aa#deaaa#aaaaaaabbbbbccefcbaba##abaaaa.#a#ba##dc#a#a####abaabb#a##aa##a###a###aaaaabaceecddhhedd",
-"cccbabbcdfffhheccbbbbbcdfccbbbbaaaaaa###############a##aaaabacbbbbaaaacccddcdefhjjhbaaaabaa##dfbbc###aa#aa######aabaabaabbbbbabdb#aa#a###bba#a##aaaabbabbbbbcbbcedbaaaaaaaaabbbbbcbccbcebbbbaaaaaaaaaa#####aaa####aa#aabdegj.############a##a##a#aba####a##baaaaaa#a###aa#aa########a##a#aaaa####a#eeaa###aaaaaaaaabbcdgfdbaa####aabbcb#aabc###cda#aa##aababcbb#a#aa###a##aab#aaaaababdecbcdheed",
-"cbbaccbcddeffeedcbbbbbbccffdbbcbabbaaa#aa########a###ca#abaabbbabaaaaabcccddcdgiikjgbaaaaba##afcacba###aa########abbbbaabbbbbbbcbbbb#aa#a###aa##aaaaababbbbcbccdca#a##aaaaabaaabcccbbcbcbaabba##aaaaaba#####aa####aabbbddcdjd.#########.#..#######aba######aaaaaba########aa#######aaa#aba#aaa###aacaaaa##aabaaaaaaabbcefcbbaaaaa##aaacabaaaa###bca#####aaaaacaa#a###a##a#aaa#a#aabbbbcddcccegdd",
-"cbbabbbbccddeedddcbbbbbbbbdfheccccbaaaa###########aa#bd##baaaabaaaaaababcddcccggijjjbaaabbaa##bcbabba##aa#######aaaaaaabbbbbbbbbcccaaaa##a##aaa##aaaabbbdbcbbcdfbaaa#aaabbbbbbbbbcccbccdedaaa#aaaabbaaaa#a#aa####a#abcccdccfi###########....#######aa##aaaaaaaaaaa##########a###a##aa#aa#aaa#####aaa#aaaa##abbbaaaaabcdefbbaaaaabaa####aa####a#a#dba#####bb##b###########aaaaa#aaabbaabbbccddede",
-"baabbbbbccccdeedcccbbccbcbbcdiheccbbbaaaaa#aab##aa###aa###aaaacbaaaaaababccccdfhjjjl#abbbaaba#abeaabb######a#####bbaa#aaaabbbcbbabbaa###aa####a###aaaabacdcccdceaaaaaaaaaababbbbbbbcbbbcbdba###aabbbaaa#aa##########aabbabccgb.###.#########.########a#aaaa#abaa#########a##aa#####bcaabaaba###aaaaaaaa#####aaaaaabbbdhidabaaaaaaaa###########a###ebbb###aaa####a###aa#aabcaabbaaababaaabbbbbdcb",
-"abcbbbbbbbccbbcddbcbbbbbbbbbcfeghfccbbabaaaaabaaaa####a#b##aaaabbaa#aaaaabccbceefhegdedaaaaaaa#abdaaba#aa##a#####aaaabaaaaaaabbbaacc###aa#aa####a#aaaaaaabcccddfbba#aaaaaabbbbabbccccccbcbdaa#####ac#####a##########aa#aabcbdh..#########.#####.####aaa#aaa###abb###########accaa###a##aaabbbba#a##a#abba####aaaaaccegcbbaaaaaaa#aa###.##a########aeaaaa###a#a######aaa##aaaaaaaabbaabbaacaacced",
-"cadbbbbbbcbccbbacbbbbbbbbabccdeehgffccbcbaaabaaaaaa###a####aaa#aaaaaaaaaaabccbdeeffeehgcaabaaa##adb#aca##aaa#####aaabaaaaaaaaaabaacdb##aaaaaaa#abbaaabbbabbdecffbaaaaaaaaaaaaaabbaccbcbcccdcaa#############aabb######aaaaabbbehd..###d#.#.######.####adbaaaa##abba########aaaaaaaaaaaaa#aaaaaaa#a#aa#abaaa####aaacdeheaaaaaaaaa##aa#aa#####a####a#.cdaa######a##a###########aa##aabb#aabaaabbadf",
-"cabdabbbabcccdccbccbbbbbbaabdcdefdcfgccbbbbaabcbaaa###aa##aca####aaa##aabbbccccddffhihhfbaba#c###bdaaagaaa#a######aabaabaaaaaaaa#a#aa####aaaa#aabbaaaabbbbbcddfeca###aaaaabbaabbabbcbccbbbccdada###aa######aaba####a###abaabcafjlf..defe##...#########bbaaa###aab#a#######aaabcb#aaaaaca##aaaa####a##aab###a##aabdfiida###aaaaa##ca#aa#####a####a###ecaaa########a##a#####a####a###aaaaaaaaaabab",
-"ccbbbbabbaaabccdcbbbbbbaaaabcdbbbeeadgeccbbbbabbbaaa##aa#abedbaa####a####bbbcbccddehhhfdaa###da#a#ddaabhaa###########a#abaabbaa######a####aaaaaaaaaabbbbbbcbdeefcb###aaaaaaaaaabbbbccccbbaabbcaaa############aacbaabaaaaaaabccbdejkbd..bgccdcba########aa######aaa#a#######aaaccaba#bcaaba#a##aaa#####abba#aa#aabdgkjkihgdb#.cedcbb#.###dc########b##ebaaaa#########################aaa#aaaaaaba",
-"abeecbbaababbbabbdbabbbbbaaabcccbdcb#ehedccbbaabbbaaa#abaaaedba###########acbbbcceeeggdaaa#bacaa#aadabbdf#######.#######aaaaaa######bca###aaaaaaaaaabbbbbbbccfffbaaaa#aaaaa#aaaabbccabbcccbbbbaaaaa#######a#aa#acaaaaaaaaaaaabccceglh.#....#baacca..####ab########aaa####a##ababbbba#ceaaaaaa###a######aa##acbbbbchgcddfgjihddigefegfffba#affeecbbaaabda#aa######a#a################aaaa#aaaaaab",
-"babfdcbcbabaabababbbaaaaaaaabcccdbaaaacifddcbbbbbbbabaabaacecabaaaaa######aaabbcdeeedifba#adcbaaba#bcabbfe#aa####aaa###a#abaaaa######aaaac#aaaaaaaabbbdbbbbcceebbba##aaaaaaa#aaabbbbbbcccdcabaaaaab##a#aaaaaaa######abaaaaa#abbbbddei#####a####.#ee######aa######aaaba######abaaaa#a##bc##aa#a####a###a#aaaabcbbbceecbbcbdeffgfdccccdefeefgffedcefeb##cdbcba########a###########a###aaaabaaaaaaa"
-};
-SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 384 NAXIS2 = 384 HISTORY Written by XV 3.10a END 3"3wUD3D3"3""3"3"333""""""""3DDDU3""""DªwUUD3333333"3""3""DfD"3""""""""33DUfffUªw3""UD3""3"3D"33wf"""""""3""""""""D""""""""333U3333DDff333"""""""""""333333DDDUD"3"""""3"""""""""3""""""3333UUfª"
diff --git a/gtk/parent b/gtk/parent
deleted file mode 100644
index 94fee61231..0000000000
--- a/gtk/parent
+++ /dev/null
@@ -1,10 +0,0 @@
- gdk_window_show (widget->window);
- gdk_window_clear_area (widget->window,
- widget->allocation.x,
- widget->allocation.y,
- widget->allocation.width,
- widget->allocation.height);
- gdk_window_hide (widget->window);
- if (GTK_WIDGET_VISIBLE (widget->parent))
- if (GTK_WIDGET_REALIZED (widget->parent) &&
- if (GTK_WIDGET_MAPPED (widget->parent) &&
diff --git a/gtk/runelisp b/gtk/runelisp
deleted file mode 100644
index 115080cf08..0000000000
--- a/gtk/runelisp
+++ /dev/null
@@ -1,6 +0,0 @@
-#! /bin/sh
-if test $# -lt 1; then
- echo >&2 "usage: $0 file.el"
- exit 1
-fi
-exec emacs --no-init-file --no-site-file --batch --load $*
diff --git a/gtk/simple.c b/gtk/simple.c
deleted file mode 100644
index 47893772f7..0000000000
--- a/gtk/simple.c
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <gtk/gtk.h>
-#include <gdk/gdkprivate.h>
-
-
-void
-hello ()
-{
- g_print ("hello world\n");
-}
-
-int
-main (int argc, char *argv[])
-{
- GtkWidget *window;
- GtkWidget *button;
-
- gdk_progclass = g_strdup ("XTerm");
- gtk_init (&argc, &argv);
-
- window = gtk_widget_new (gtk_window_get_type (),
- "GtkObject::user_data", NULL,
- "GtkWindow::type", GTK_WINDOW_TOPLEVEL,
- "GtkWindow::title", "hello world",
- "GtkWindow::allow_grow", FALSE,
- "GtkWindow::allow_shrink", FALSE,
- "GtkContainer::border_width", 10,
- NULL);
- button = gtk_widget_new (gtk_button_get_type (),
- "GtkButton::label", "hello world",
- "GtkObject::signal::clicked", hello, NULL,
- "GtkWidget::parent", window,
- "GtkWidget::visible", TRUE,
- NULL);
- gtk_widget_show (window);
-
- gtk_main ();
-
- return 0;
-}
diff --git a/gtk/test.xpm b/gtk/test.xpm
deleted file mode 100644
index 9b0d2efdb2..0000000000
--- a/gtk/test.xpm
+++ /dev/null
@@ -1,92 +0,0 @@
-/* XPM */
-static char *openfile[] = {
-/* width height num_colors chars_per_pixel */
-" 20 19 66 2",
-/* colors */
-".. c None",
-".# c #000000",
-".a c #dfdfdf",
-".b c #7f7f7f",
-".c c #006f6f",
-".d c #00efef",
-".e c #009f9f",
-".f c #004040",
-".g c #00bfbf",
-".h c #ff0000",
-".i c #ffffff",
-".j c #7f0000",
-".k c #007070",
-".l c #00ffff",
-".m c #00a0a0",
-".n c #004f4f",
-".o c #00cfcf",
-".p c #8f8f8f",
-".q c #6f6f6f",
-".r c #a0a0a0",
-".s c #7f7f00",
-".t c #007f7f",
-".u c #5f5f5f",
-".v c #707070",
-".w c #00f0f0",
-".x c #009090",
-".y c #ffff00",
-".z c #0000ff",
-".A c #00afaf",
-".B c #00d0d0",
-".C c #00dfdf",
-".D c #005f5f",
-".E c #00b0b0",
-".F c #001010",
-".G c #00c0c0",
-".H c #000f0f",
-".I c #00007f",
-".J c #005050",
-".K c #002f2f",
-".L c #dfcfcf",
-".M c #dfd0d0",
-".N c #006060",
-".O c #00e0e0",
-".P c #00ff00",
-".Q c #002020",
-".R c #dfc0c0",
-".S c #008080",
-".T c #001f1f",
-".U c #003f3f",
-".V c #007f00",
-".W c #00000f",
-".X c #000010",
-".Y c #00001f",
-".Z c #000020",
-".0 c #00002f",
-".1 c #000030",
-".2 c #00003f",
-".3 c #000040",
-".4 c #00004f",
-".5 c #000050",
-".6 c #00005f",
-".7 c #000060",
-".8 c #00006f",
-".9 c #000070",
-"#. c #7f7f80",
-"## c #9f9f9f",
-/* pixels */
-"........................................",
-"........................................",
-"........................................",
-".......................#.#.#............",
-".....................#.......#...#......",
-"...............................#.#......",
-".......#.#.#.................#.#.#......",
-".....#.y.i.y.#.#.#.#.#.#.#..............",
-".....#.i.y.i.y.i.y.i.y.i.#..............",
-".....#.y.i.y.i.y.i.y.i.y.#..............",
-".....#.i.y.i.y.#.#.#.#.#.#.#.#.#.#.#....",
-".....#.y.i.y.#.s.s.s.s.s.s.s.s.s.#......",
-".....#.i.y.#.s.s.s.s.s.s.s.s.s.#........",
-".....#.y.#.s.s.s.s.s.s.s.s.s.#..........",
-".....#.#.s.s.s.s.s.s.s.s.s.#............",
-".....#.#.#.#.#.#.#.#.#.#.#..............",
-"........................................",
-"........................................",
-"........................................"
-};
diff --git a/gtk/testgtk.c b/gtk/testgtk.c
deleted file mode 100644
index 9ceb305a6d..0000000000
--- a/gtk/testgtk.c
+++ /dev/null
@@ -1,5478 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include "gtk.h"
-#include "../gdk/gdk.h"
-#include "../gdk/gdkx.h"
-
-#include "circles.xbm"
-
-/* Variables used by the Drag/Drop and Shape Window demos */
-static GtkWidget *modeller = NULL;
-static GtkWidget *sheets = NULL;
-static GtkWidget *rings = NULL;
-void create_shapes(void);
-
-
-/* macro, structure and variables used by tree window demos */
-#define DEFAULT_NUMBER_OF_ITEM 3
-#define DEFAULT_RECURSION_LEVEL 3
-
-struct {
- GSList* selection_mode_group;
- GtkWidget* single_button;
- GtkWidget* browse_button;
- GtkWidget* multiple_button;
- GtkWidget* draw_line_button;
- GtkWidget* view_line_button;
- GtkWidget* no_root_item_button;
- GtkWidget* nb_item_spinner;
- GtkWidget* recursion_spinner;
-} sTreeSampleSelection;
-
-typedef struct sTreeButtons {
- guint nb_item_add;
- GtkWidget* add_button;
- GtkWidget* remove_button;
-} sTreeButtons;
-/* end of tree section */
-
-void
-destroy_window (GtkWidget *widget,
- GtkWidget **window)
-{
- *window = NULL;
-}
-
-static void
-destroy_tooltips (GtkWidget *widget, GtkWindow **window)
-{
- GtkTooltips *tt = gtk_object_get_data (GTK_OBJECT (*window), "tooltips");
- gtk_object_unref (GTK_OBJECT (tt));
-
- *window = NULL;
-}
-
-static void
-button_window (GtkWidget *widget,
- GtkWidget *button)
-{
- if (!GTK_WIDGET_VISIBLE (button))
- gtk_widget_show (button);
- else
- gtk_widget_hide (button);
-}
-
-static void
-create_buttons ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *table;
- GtkWidget *button[10];
- GtkWidget *separator;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC (gtk_true),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "buttons");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- table = gtk_table_new (3, 3, FALSE);
- gtk_table_set_row_spacings (GTK_TABLE (table), 5);
- gtk_table_set_col_spacings (GTK_TABLE (table), 5);
- gtk_container_border_width (GTK_CONTAINER (table), 10);
- gtk_box_pack_start (GTK_BOX (box1), table, TRUE, TRUE, 0);
- gtk_widget_show (table);
-
-
- button[0] = gtk_button_new_with_label ("button1");
- button[1] = gtk_button_new_with_label ("button2");
- button[2] = gtk_button_new_with_label ("button3");
- button[3] = gtk_button_new_with_label ("button4");
- button[4] = gtk_button_new_with_label ("button5");
- button[5] = gtk_button_new_with_label ("button6");
- button[6] = gtk_button_new_with_label ("button7");
- button[7] = gtk_button_new_with_label ("button8");
- button[8] = gtk_button_new_with_label ("button9");
-
- gtk_signal_connect (GTK_OBJECT (button[0]), "clicked",
- GTK_SIGNAL_FUNC(button_window),
- button[1]);
-
- gtk_table_attach (GTK_TABLE (table), button[0], 0, 1, 0, 1,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (button[0]);
-
- gtk_signal_connect (GTK_OBJECT (button[1]), "clicked",
- GTK_SIGNAL_FUNC(button_window),
- button[2]);
-
- gtk_table_attach (GTK_TABLE (table), button[1], 1, 2, 1, 2,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (button[1]);
-
- gtk_signal_connect (GTK_OBJECT (button[2]), "clicked",
- GTK_SIGNAL_FUNC(button_window),
- button[3]);
- gtk_table_attach (GTK_TABLE (table), button[2], 2, 3, 2, 3,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (button[2]);
-
- gtk_signal_connect (GTK_OBJECT (button[3]), "clicked",
- GTK_SIGNAL_FUNC(button_window),
- button[4]);
- gtk_table_attach (GTK_TABLE (table), button[3], 0, 1, 2, 3,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (button[3]);
-
- gtk_signal_connect (GTK_OBJECT (button[4]), "clicked",
- GTK_SIGNAL_FUNC(button_window),
- button[5]);
- gtk_table_attach (GTK_TABLE (table), button[4], 2, 3, 0, 1,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (button[4]);
-
- gtk_signal_connect (GTK_OBJECT (button[5]), "clicked",
- GTK_SIGNAL_FUNC(button_window),
- button[6]);
- gtk_table_attach (GTK_TABLE (table), button[5], 1, 2, 2, 3,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (button[5]);
-
- gtk_signal_connect (GTK_OBJECT (button[6]), "clicked",
- GTK_SIGNAL_FUNC(button_window),
- button[7]);
- gtk_table_attach (GTK_TABLE (table), button[6], 1, 2, 0, 1,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (button[6]);
-
- gtk_signal_connect (GTK_OBJECT (button[7]), "clicked",
- GTK_SIGNAL_FUNC(button_window),
- button[8]);
- gtk_table_attach (GTK_TABLE (table), button[7], 2, 3, 1, 2,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (button[7]);
-
- gtk_signal_connect (GTK_OBJECT (button[8]), "clicked",
- GTK_SIGNAL_FUNC(button_window),
- button[0]);
- gtk_table_attach (GTK_TABLE (table), button[8], 0, 1, 1, 2,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (button[8]);
-
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button[9] = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button[9]), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button[9], TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button[9], GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button[9]);
- gtk_widget_show (button[9]);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-static void
-create_toggle_buttons ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *button;
- GtkWidget *separator;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "toggle buttons");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_toggle_button_new_with_label ("button1");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- button = gtk_toggle_button_new_with_label ("button2");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- button = gtk_toggle_button_new_with_label ("button3");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-static void
-create_check_buttons ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *button;
- GtkWidget *separator;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "check buttons");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_check_button_new_with_label ("button1");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- button = gtk_check_button_new_with_label ("button2");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- button = gtk_check_button_new_with_label ("button3");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-static void
-create_radio_buttons ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *button;
- GtkWidget *separator;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "radio buttons");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_radio_button_new_with_label (NULL, "button1");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- button = gtk_radio_button_new_with_label (
- gtk_radio_button_group (GTK_RADIO_BUTTON (button)),
- "button2");
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE);
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- button = gtk_radio_button_new_with_label (
- gtk_radio_button_group (GTK_RADIO_BUTTON (button)),
- "button3");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-static void
-bbox_widget_destroy (GtkWidget* widget, GtkWidget* todestroy)
-{
-}
-
-static void
-create_bbox_window (gint horizontal,
- char* title,
- gint pos,
- gint spacing,
- gint child_w,
- gint child_h,
- gint layout)
-{
- GtkWidget* window;
- GtkWidget* box1;
- GtkWidget* bbox;
- GtkWidget* button;
-
- /* create a new window */
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title (GTK_WINDOW (window), title);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(bbox_widget_destroy), window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(bbox_widget_destroy), window);
-
- if (horizontal)
- {
- gtk_widget_set_usize (window, 550, 60);
- gtk_widget_set_uposition (window, 150, pos);
- box1 = gtk_vbox_new (FALSE, 0);
- }
- else
- {
- gtk_widget_set_usize (window, 150, 400);
- gtk_widget_set_uposition (window, pos, 200);
- box1 = gtk_vbox_new (FALSE, 0);
- }
-
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
- if (horizontal)
- bbox = gtk_hbutton_box_new();
- else
- bbox = gtk_vbutton_box_new();
- gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), layout);
- gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), spacing);
- gtk_button_box_set_child_size (GTK_BUTTON_BOX (bbox), child_w, child_h);
- gtk_widget_show (bbox);
-
- gtk_container_border_width (GTK_CONTAINER(box1), 25);
- gtk_box_pack_start (GTK_BOX (box1), bbox, TRUE, TRUE, 0);
-
- button = gtk_button_new_with_label ("OK");
- gtk_container_add (GTK_CONTAINER(bbox), button);
-
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(bbox_widget_destroy), window);
-
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Cancel");
- gtk_container_add (GTK_CONTAINER(bbox), button);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Help");
- gtk_container_add (GTK_CONTAINER(bbox), button);
- gtk_widget_show (button);
-
- gtk_widget_show (window);
-}
-
-static void
-test_hbbox ()
-{
- create_bbox_window (TRUE, "Spread", 50, 40, 85, 28, GTK_BUTTONBOX_SPREAD);
- create_bbox_window (TRUE, "Edge", 200, 40, 85, 25, GTK_BUTTONBOX_EDGE);
- create_bbox_window (TRUE, "Start", 350, 40, 85, 25, GTK_BUTTONBOX_START);
- create_bbox_window (TRUE, "End", 500, 15, 30, 25, GTK_BUTTONBOX_END);
-}
-
-static void
-test_vbbox ()
-{
- create_bbox_window (FALSE, "Spread", 50, 40, 85, 25, GTK_BUTTONBOX_SPREAD);
- create_bbox_window (FALSE, "Edge", 250, 40, 85, 28, GTK_BUTTONBOX_EDGE);
- create_bbox_window (FALSE, "Start", 450, 40, 85, 25, GTK_BUTTONBOX_START);
- create_bbox_window (FALSE, "End", 650, 15, 30, 25, GTK_BUTTONBOX_END);
-}
-
-static void
-create_button_box ()
-{
- static GtkWidget* window = NULL;
- GtkWidget* bbox;
- GtkWidget* button;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title (GTK_WINDOW (window),
- "Button Box Test");
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window), &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window), &window);
-
- gtk_container_border_width (GTK_CONTAINER (window), 20);
-
- /*
- *these 15 lines are a nice and easy example for GtkHButtonBox
- */
- bbox = gtk_hbutton_box_new ();
- gtk_container_add (GTK_CONTAINER (window), bbox);
- gtk_widget_show (bbox);
-
- button = gtk_button_new_with_label ("Horizontal");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(test_hbbox), 0);
- gtk_container_add (GTK_CONTAINER (bbox), button);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Vertical");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(test_vbbox), 0);
- gtk_container_add (GTK_CONTAINER (bbox), button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-static GtkWidget*
-new_pixmap (char *filename,
- GdkWindow *window,
- GdkColor *background)
-{
- GtkWidget *wpixmap;
- GdkPixmap *pixmap;
- GdkBitmap *mask;
-
- pixmap = gdk_pixmap_create_from_xpm (window, &mask,
- background,
- "test.xpm");
- wpixmap = gtk_pixmap_new (pixmap, mask);
-
- return wpixmap;
-}
-
-static void
-set_toolbar_horizontal (GtkWidget *widget,
- gpointer data)
-{
- gtk_toolbar_set_orientation (GTK_TOOLBAR (data), GTK_ORIENTATION_HORIZONTAL);
-}
-
-static void
-set_toolbar_vertical (GtkWidget *widget,
- gpointer data)
-{
- gtk_toolbar_set_orientation (GTK_TOOLBAR (data), GTK_ORIENTATION_VERTICAL);
-}
-
-static void
-set_toolbar_icons (GtkWidget *widget,
- gpointer data)
-{
- gtk_toolbar_set_style (GTK_TOOLBAR (data), GTK_TOOLBAR_ICONS);
-}
-
-static void
-set_toolbar_text (GtkWidget *widget,
- gpointer data)
-{
- gtk_toolbar_set_style (GTK_TOOLBAR (data), GTK_TOOLBAR_TEXT);
-}
-
-static void
-set_toolbar_both (GtkWidget *widget,
- gpointer data)
-{
- gtk_toolbar_set_style (GTK_TOOLBAR (data), GTK_TOOLBAR_BOTH);
-}
-
-static void
-set_toolbar_small_space (GtkWidget *widget,
- gpointer data)
-{
- gtk_toolbar_set_space_size (GTK_TOOLBAR (data), 5);
-}
-
-static void
-set_toolbar_big_space (GtkWidget *widget,
- gpointer data)
-{
- gtk_toolbar_set_space_size (GTK_TOOLBAR (data), 10);
-}
-
-static void
-set_toolbar_enable (GtkWidget *widget,
- gpointer data)
-{
- gtk_toolbar_set_tooltips (GTK_TOOLBAR (data), TRUE);
-}
-
-static void
-set_toolbar_disable (GtkWidget *widget,
- gpointer data)
-{
- gtk_toolbar_set_tooltips (GTK_TOOLBAR (data), FALSE);
-}
-
-static void
-create_toolbar (void)
-{
- static GtkWidget *window = NULL;
- GtkWidget *toolbar;
- GtkWidget *entry;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title (GTK_WINDOW (window), "Toolbar test");
- gtk_window_set_policy (GTK_WINDOW (window), FALSE, TRUE, TRUE);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC (destroy_window),
- &window);
-
- gtk_container_border_width (GTK_CONTAINER (window), 0);
- gtk_widget_realize (window);
-
- toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
-
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Horizontal", "Horizontal toolbar layout", "Toolbar/Horizontal",
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_horizontal, toolbar);
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Vertical", "Vertical toolbar layout", "Toolbar/Vertical",
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_vertical, toolbar);
-
- gtk_toolbar_append_space (GTK_TOOLBAR(toolbar));
-
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Icons", "Only show toolbar icons", "Toolbar/IconsOnly",
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_icons, toolbar);
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Text", "Only show toolbar text", "Toolbar/TextOnly",
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_text, toolbar);
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Both", "Show toolbar icons and text", "Toolbar/Both",
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_both, toolbar);
-
- gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
-
- entry = gtk_entry_new ();
- gtk_widget_show(entry);
- gtk_toolbar_append_widget (GTK_TOOLBAR (toolbar), entry, "This is an unusable GtkEntry ;)", "Hey don't click me!!!");
-
- gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
-
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Small", "Use small spaces", "Toolbar/Small",
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_small_space, toolbar);
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Big", "Use big spaces", "Toolbar/Big",
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_big_space, toolbar);
-
- gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
-
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Enable", "Enable tooltips", NULL,
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_enable, toolbar);
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Disable", "Disable tooltips", NULL,
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_disable, toolbar);
-
- gtk_container_add (GTK_CONTAINER (window), toolbar);
- gtk_widget_show (toolbar);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-static GtkWidget*
-make_toolbar (GtkWidget *window)
-{
- GtkWidget *toolbar;
-
- if (!GTK_WIDGET_REALIZED (window))
- gtk_widget_realize (window);
-
- toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
-
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Horizontal", "Horizontal toolbar layout", NULL,
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_horizontal, toolbar);
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Vertical", "Vertical toolbar layout", NULL,
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_vertical, toolbar);
-
- gtk_toolbar_append_space (GTK_TOOLBAR(toolbar));
-
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Icons", "Only show toolbar icons", NULL,
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_icons, toolbar);
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Text", "Only show toolbar text", NULL,
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_text, toolbar);
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Both", "Show toolbar icons and text", NULL,
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_both, toolbar);
-
- gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
-
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Small", "Use small spaces", NULL,
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_small_space, toolbar);
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Big", "Use big spaces", "Toolbar/Big",
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_big_space, toolbar);
-
- gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
-
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Enable", "Enable tooltips", NULL,
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_enable, toolbar);
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Disable", "Disable tooltips", NULL,
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_disable, toolbar);
-
- return toolbar;
-}
-
-static guint statusbar_counter = 1;
-
-static void
-statusbar_push (GtkWidget *button,
- GtkStatusbar *statusbar)
-{
- gchar text[1024];
-
- sprintf (text, "something %d", statusbar_counter++);
-
- gtk_statusbar_push (statusbar, 1, text);
-}
-
-static void
-statusbar_pop (GtkWidget *button,
- GtkStatusbar *statusbar)
-{
- gtk_statusbar_pop (statusbar, 1);
-}
-
-static void
-statusbar_steal (GtkWidget *button,
- GtkStatusbar *statusbar)
-{
- gtk_statusbar_remove (statusbar, 1, 4);
-}
-
-static void
-statusbar_popped (GtkStatusbar *statusbar,
- guint context_id,
- const gchar *text)
-{
- if (!statusbar->messages)
- statusbar_counter = 1;
-}
-
-static void
-statusbar_contexts (GtkWidget *button,
- GtkStatusbar *statusbar)
-{
- gchar *string;
-
- string = "any context";
- g_print ("GtkStatusBar: context=\"%s\", context_id=%d\n",
- string,
- gtk_statusbar_get_context_id (statusbar, string));
-
- string = "idle messages";
- g_print ("GtkStatusBar: context=\"%s\", context_id=%d\n",
- string,
- gtk_statusbar_get_context_id (statusbar, string));
-
- string = "some text";
- g_print ("GtkStatusBar: context=\"%s\", context_id=%d\n",
- string,
- gtk_statusbar_get_context_id (statusbar, string));
-
- string = "hit the mouse";
- g_print ("GtkStatusBar: context=\"%s\", context_id=%d\n",
- string,
- gtk_statusbar_get_context_id (statusbar, string));
-
- string = "hit the mouse2";
- g_print ("GtkStatusBar: context=\"%s\", context_id=%d\n",
- string,
- gtk_statusbar_get_context_id (statusbar, string));
-}
-
-static void
-statusbar_dump_stack (GtkWidget *button,
- GtkStatusbar *statusbar)
-{
- GSList *list;
-
- for (list = statusbar->messages; list; list = list->next)
- {
- GtkStatusbarMsg *msg;
-
- msg = list->data;
- g_print ("context_id: %d, message_id: %d, status_text: \"%s\"\n",
- msg->context_id,
- msg->message_id,
- msg->text);
- }
-}
-
-static void
-create_statusbar ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *button;
- GtkWidget *separator;
- GtkWidget *statusbar;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (gtk_widget_destroyed),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC (gtk_true),
- NULL);
-
- gtk_window_set_title (GTK_WINDOW (window), "statusbar");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
- statusbar = gtk_statusbar_new ();
- gtk_box_pack_end (GTK_BOX (box1), statusbar, TRUE, TRUE, 0);
- gtk_widget_show (statusbar);
- gtk_signal_connect (GTK_OBJECT (statusbar),
- "text_popped",
- GTK_SIGNAL_FUNC (statusbar_popped),
- NULL);
-
- button = gtk_widget_new (gtk_button_get_type (),
- "GtkButton::label", "push something",
- "GtkWidget::visible", TRUE,
- "GtkWidget::parent", box2,
- "GtkObject::signal::clicked", statusbar_push, statusbar,
- NULL);
-
- button = gtk_widget_new (gtk_button_get_type (),
- "GtkButton::label", "pop",
- "GtkWidget::visible", TRUE,
- "GtkWidget::parent", box2,
- "GtkObject::signal::clicked", statusbar_pop, statusbar,
- NULL);
-
- button = gtk_widget_new (gtk_button_get_type (),
- "GtkButton::label", "steal #4",
- "GtkWidget::visible", TRUE,
- "GtkWidget::parent", box2,
- "GtkObject::signal::clicked", statusbar_steal, statusbar,
- NULL);
-
- button = gtk_widget_new (gtk_button_get_type (),
- "GtkButton::label", "dump stack",
- "GtkWidget::visible", TRUE,
- "GtkWidget::parent", box2,
- "GtkObject::signal::clicked", statusbar_dump_stack, statusbar,
- NULL);
-
- button = gtk_widget_new (gtk_button_get_type (),
- "GtkButton::label", "test contexts",
- "GtkWidget::visible", TRUE,
- "GtkWidget::parent", box2,
- "GtkObject::signal::clicked", statusbar_contexts, statusbar,
- NULL);
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-static void
-handle_box_child_signal (GtkHandleBox *hb,
- GtkWidget *child,
- const gchar *action)
-{
- printf ("%s: child <%s> %sed\n",
- gtk_type_name (GTK_OBJECT_TYPE (hb)),
- gtk_type_name (GTK_OBJECT_TYPE (child)),
- action);
-}
-
-/* funtions used by tree window demos */
-static guint
-cb_tree_delete_event(GtkWidget* w)
-{
- return TRUE;
-}
-
-static void
-cb_tree_destroy_event(GtkWidget* w)
-{
- sTreeButtons* tree_buttons;
-
- /* free buttons structure associate at this tree */
- tree_buttons = gtk_object_get_user_data(GTK_OBJECT(w));
- free(tree_buttons);
-}
-static void
-cb_add_new_item(GtkWidget* w, GtkTree* tree)
-{
- sTreeButtons* tree_buttons;
- GList* selected_list;
- GtkWidget* selected_item;
- GtkWidget* subtree;
- GtkWidget* item_new;
- char buffer[255];
-
- tree_buttons = gtk_object_get_user_data(GTK_OBJECT(tree));
-
- selected_list = GTK_TREE_SELECTION(tree);
-
- if(selected_list == NULL)
- {
- /* there is no item in tree */
- subtree = GTK_WIDGET(tree);
- }
- else
- {
- /* list can have only one element */
- selected_item = GTK_WIDGET(selected_list->data);
-
- subtree = GTK_TREE_ITEM_SUBTREE(selected_item);
-
- if(subtree == NULL)
- {
- /* current selected item have not subtree ... create it */
- subtree = gtk_tree_new();
- gtk_tree_item_set_subtree(GTK_TREE_ITEM(selected_item),
- subtree);
- }
- }
-
- /* at this point, we know which subtree will be used to add new item */
- /* create a new item */
- sprintf(buffer, "item add %d", tree_buttons->nb_item_add);
- item_new = gtk_tree_item_new_with_label(buffer);
- gtk_tree_append(GTK_TREE(subtree), item_new);
- gtk_widget_show(item_new);
-
- tree_buttons->nb_item_add++;
-}
-
-static void
-cb_remove_item(GtkWidget*w, GtkTree* tree)
-{
- GList* selected_list;
- GList* clear_list;
-
- selected_list = GTK_TREE_SELECTION(tree);
-
- clear_list = NULL;
-
- while (selected_list)
- {
- clear_list = g_list_prepend (clear_list, selected_list->data);
- selected_list = selected_list->next;
- }
-
- clear_list = g_list_reverse (clear_list);
- gtk_tree_remove_items(tree, clear_list);
-
- g_list_free (clear_list);
-}
-
-static void
-cb_tree_changed(GtkTree* tree)
-{
- sTreeButtons* tree_buttons;
- GList* selected_list;
- guint nb_selected;
-
- tree_buttons = gtk_object_get_user_data(GTK_OBJECT(tree));
-
- selected_list = GTK_TREE_SELECTION(tree);
- nb_selected = g_list_length(selected_list);
-
- if(nb_selected == 0)
- {
- if(tree->children == NULL)
- gtk_widget_set_sensitive(tree_buttons->add_button, TRUE);
- else
- gtk_widget_set_sensitive(tree_buttons->add_button, FALSE);
- gtk_widget_set_sensitive(tree_buttons->remove_button, FALSE);
- }
- else
- {
- gtk_widget_set_sensitive(tree_buttons->remove_button, TRUE);
- gtk_widget_set_sensitive(tree_buttons->add_button, (nb_selected == 1));
- }
-}
-
-static void
-create_subtree(GtkWidget* item, guint level, guint nb_item_max, guint recursion_level_max)
-{
- GtkWidget* item_subtree;
- GtkWidget* item_new;
- guint nb_item;
- char buffer[255];
- int no_root_item;
-
- if(level == recursion_level_max) return;
-
- if(level == -1)
- {
- /* query with no root item */
- level = 0;
- item_subtree = item;
- no_root_item = 1;
- }
- else
- {
- /* query with no root item */
- /* create subtree and associate it with current item */
- item_subtree = gtk_tree_new();
- no_root_item = 0;
- }
-
- for(nb_item = 0; nb_item < nb_item_max; nb_item++)
- {
- sprintf(buffer, "item %d-%d", level, nb_item);
- item_new = gtk_tree_item_new_with_label(buffer);
- gtk_tree_append(GTK_TREE(item_subtree), item_new);
- create_subtree(item_new, level+1, nb_item_max, recursion_level_max);
- gtk_widget_show(item_new);
- }
-
- if(!no_root_item)
- gtk_tree_item_set_subtree(GTK_TREE_ITEM(item), item_subtree);
-}
-
-static void
-create_tree_sample(guint selection_mode,
- guint draw_line, guint view_line, guint no_root_item,
- guint nb_item_max, guint recursion_level_max)
-{
- GtkWidget* window;
- GtkWidget* box1;
- GtkWidget* box2;
- GtkWidget* separator;
- GtkWidget* button;
- GtkWidget* scrolled_win;
- GtkWidget* root_tree;
- GtkWidget* root_item;
- sTreeButtons* tree_buttons;
-
- /* create tree buttons struct */
- if((tree_buttons = g_malloc(sizeof(sTreeButtons))) == NULL)
- {
- g_error("can't allocate memory for tree structure !\n");
- return;
- }
- tree_buttons->nb_item_add = 0;
-
- /* create top level window */
- window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title(GTK_WINDOW(window), "Tree Sample");
- gtk_signal_connect(GTK_OBJECT (window), "delete_event",
- (GtkSignalFunc) cb_tree_delete_event, NULL);
- gtk_signal_connect(GTK_OBJECT(window), "destroy",
- (GtkSignalFunc) cb_tree_destroy_event, NULL);
- gtk_object_set_user_data(GTK_OBJECT(window), tree_buttons);
-
- box1 = gtk_vbox_new(FALSE, 0);
- gtk_container_add(GTK_CONTAINER(window), box1);
- gtk_widget_show(box1);
-
- /* create tree box */
- box2 = gtk_vbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(box1), box2, TRUE, TRUE, 0);
- gtk_container_border_width(GTK_CONTAINER(box2), 5);
- gtk_widget_show(box2);
-
- /* create scrolled window */
- scrolled_win = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_box_pack_start (GTK_BOX (box2), scrolled_win, TRUE, TRUE, 0);
- gtk_widget_set_usize (scrolled_win, 200, 200);
- gtk_widget_show (scrolled_win);
-
- /* create root tree widget */
- root_tree = gtk_tree_new();
- gtk_signal_connect(GTK_OBJECT(root_tree), "selection_changed",
- (GtkSignalFunc)cb_tree_changed,
- (gpointer)NULL);
- gtk_object_set_user_data(GTK_OBJECT(root_tree), tree_buttons);
- gtk_container_add(GTK_CONTAINER(scrolled_win), root_tree);
- gtk_tree_set_selection_mode(GTK_TREE(root_tree), selection_mode);
- gtk_tree_set_view_lines(GTK_TREE(root_tree), draw_line);
- gtk_tree_set_view_mode(GTK_TREE(root_tree), !view_line);
- gtk_widget_show(root_tree);
-
- if ( no_root_item )
- {
- /* set root tree to subtree function with root item variable */
- root_item = GTK_WIDGET(root_tree);
- }
- else
- {
- /* create root tree item widget */
- root_item = gtk_tree_item_new_with_label("root item");
- gtk_tree_append(GTK_TREE(root_tree), root_item);
- gtk_widget_show(root_item);
- }
- create_subtree(root_item, -no_root_item, nb_item_max, recursion_level_max);
-
- box2 = gtk_vbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(box1), box2, FALSE, FALSE, 0);
- gtk_container_border_width(GTK_CONTAINER(box2), 5);
- gtk_widget_show(box2);
-
- button = gtk_button_new_with_label("Add Item");
- gtk_widget_set_sensitive(button, FALSE);
- gtk_signal_connect(GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) cb_add_new_item,
- (gpointer)root_tree);
- gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 0);
- gtk_widget_show(button);
- tree_buttons->add_button = button;
-
- button = gtk_button_new_with_label("Remove Item(s)");
- gtk_widget_set_sensitive(button, FALSE);
- gtk_signal_connect(GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) cb_remove_item,
- (gpointer)root_tree);
- gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 0);
- gtk_widget_show(button);
- tree_buttons->remove_button = button;
-
- /* create separator */
- separator = gtk_hseparator_new();
- gtk_box_pack_start(GTK_BOX(box1), separator, FALSE, FALSE, 0);
- gtk_widget_show(separator);
-
- /* create button box */
- box2 = gtk_vbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(box1), box2, FALSE, FALSE, 0);
- gtk_container_border_width(GTK_CONTAINER(box2), 5);
- gtk_widget_show(box2);
-
- button = gtk_button_new_with_label("Close");
- gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 0);
- gtk_signal_connect_object(GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) gtk_widget_destroy,
- GTK_OBJECT(window));
- gtk_widget_show(button);
-
- gtk_widget_show(window);
-}
-
-static void
-cb_create_tree(GtkWidget* w)
-{
- guint selection_mode;
- guint view_line;
- guint draw_line;
- guint no_root_item;
- guint nb_item;
- guint recursion_level;
-
- /* get selection mode choice */
- if(GTK_TOGGLE_BUTTON(sTreeSampleSelection.single_button)->active)
- selection_mode = GTK_SELECTION_SINGLE;
- else
- if(GTK_TOGGLE_BUTTON(sTreeSampleSelection.browse_button)->active)
- selection_mode = GTK_SELECTION_BROWSE;
- else
- if(GTK_TOGGLE_BUTTON(sTreeSampleSelection.multiple_button)->active)
- selection_mode = GTK_SELECTION_MULTIPLE;
-
- /* get options choice */
- draw_line = GTK_TOGGLE_BUTTON(sTreeSampleSelection.draw_line_button)->active;
- view_line = GTK_TOGGLE_BUTTON(sTreeSampleSelection.view_line_button)->active;
- no_root_item = GTK_TOGGLE_BUTTON(sTreeSampleSelection.no_root_item_button)->active;
-
- /* get levels */
- nb_item = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(sTreeSampleSelection.nb_item_spinner));
- recursion_level = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(sTreeSampleSelection.recursion_spinner));
-
- create_tree_sample(selection_mode, draw_line, view_line, no_root_item, nb_item, recursion_level);
-}
-
-void
-create_tree_mode_window(void)
-{
- static GtkWidget* window;
- GtkWidget* box1;
- GtkWidget* box2;
- GtkWidget* box3;
- GtkWidget* box4;
- GtkWidget* box5;
- GtkWidget* button;
- GtkWidget* frame;
- GtkWidget* separator;
- GtkWidget* label;
- GtkWidget* spinner;
- GtkAdjustment *adj;
-
- if (!window)
- {
- /* create toplevel window */
- window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title(GTK_WINDOW(window), "Tree Mode Selection Window");
- gtk_signal_connect(GTK_OBJECT (window), "delete_event",
- (GtkSignalFunc) gtk_main_quit, NULL);
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window), &window);
- box1 = gtk_vbox_new(FALSE, 0);
- gtk_container_add(GTK_CONTAINER(window), box1);
- gtk_widget_show(box1);
-
- /* create upper box - selection box */
- box2 = gtk_vbox_new(FALSE, 5);
- gtk_box_pack_start(GTK_BOX(box1), box2, TRUE, TRUE, 0);
- gtk_container_border_width(GTK_CONTAINER(box2), 5);
- gtk_widget_show(box2);
-
- box3 = gtk_hbox_new(FALSE, 5);
- gtk_box_pack_start(GTK_BOX(box2), box3, TRUE, TRUE, 0);
- gtk_widget_show(box3);
-
- /* create selection mode frame */
- frame = gtk_frame_new("Selection Mode");
- gtk_box_pack_start(GTK_BOX(box3), frame, TRUE, TRUE, 0);
- gtk_widget_show(frame);
-
- box4 = gtk_vbox_new(FALSE, 0);
- gtk_container_add(GTK_CONTAINER(frame), box4);
- gtk_container_border_width(GTK_CONTAINER(box4), 5);
- gtk_widget_show(box4);
-
- /* create radio button */
- button = gtk_radio_button_new_with_label(NULL, "SINGLE");
- gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0);
- gtk_widget_show(button);
- sTreeSampleSelection.single_button = button;
-
- button = gtk_radio_button_new_with_label(gtk_radio_button_group (GTK_RADIO_BUTTON (button)),
- "BROWSE");
- gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0);
- gtk_widget_show(button);
- sTreeSampleSelection.browse_button = button;
-
- button = gtk_radio_button_new_with_label(gtk_radio_button_group (GTK_RADIO_BUTTON (button)),
- "MULTIPLE");
- gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0);
- gtk_widget_show(button);
- sTreeSampleSelection.multiple_button = button;
-
- sTreeSampleSelection.selection_mode_group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
-
- /* create option mode frame */
- frame = gtk_frame_new("Options");
- gtk_box_pack_start(GTK_BOX(box3), frame, TRUE, TRUE, 0);
- gtk_widget_show(frame);
-
- box4 = gtk_vbox_new(FALSE, 0);
- gtk_container_add(GTK_CONTAINER(frame), box4);
- gtk_container_border_width(GTK_CONTAINER(box4), 5);
- gtk_widget_show(box4);
-
- /* create check button */
- button = gtk_check_button_new_with_label("Draw line");
- gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0);
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), TRUE);
- gtk_widget_show(button);
- sTreeSampleSelection.draw_line_button = button;
-
- button = gtk_check_button_new_with_label("View Line mode");
- gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0);
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), TRUE);
- gtk_widget_show(button);
- sTreeSampleSelection.view_line_button = button;
-
- button = gtk_check_button_new_with_label("Without Root item");
- gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0);
- gtk_widget_show(button);
- sTreeSampleSelection.no_root_item_button = button;
-
- /* create recursion parameter */
- frame = gtk_frame_new("Size Parameters");
- gtk_box_pack_start(GTK_BOX(box2), frame, TRUE, TRUE, 0);
- gtk_widget_show(frame);
-
- box4 = gtk_hbox_new(FALSE, 5);
- gtk_container_add(GTK_CONTAINER(frame), box4);
- gtk_container_border_width(GTK_CONTAINER(box4), 5);
- gtk_widget_show(box4);
-
- /* create number of item spin button */
- box5 = gtk_hbox_new(FALSE, 5);
- gtk_box_pack_start(GTK_BOX(box4), box5, FALSE, FALSE, 0);
- gtk_widget_show(box5);
-
- label = gtk_label_new("Number of Item");
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
- gtk_box_pack_start (GTK_BOX (box5), label, FALSE, TRUE, 0);
- gtk_widget_show(label);
-
- adj = (GtkAdjustment *) gtk_adjustment_new ((gfloat)DEFAULT_NUMBER_OF_ITEM, 1.0, 255.0, 1.0,
- 5.0, 0.0);
- spinner = gtk_spin_button_new (adj, 0, 0);
- gtk_box_pack_start (GTK_BOX (box5), spinner, FALSE, TRUE, 0);
- gtk_widget_show(spinner);
- sTreeSampleSelection.nb_item_spinner = spinner;
-
- /* create recursion level spin button */
- box5 = gtk_hbox_new(FALSE, 5);
- gtk_box_pack_start(GTK_BOX(box4), box5, FALSE, FALSE, 0);
- gtk_widget_show(box5);
-
- label = gtk_label_new("Depth Level");
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
- gtk_box_pack_start (GTK_BOX (box5), label, FALSE, TRUE, 0);
- gtk_widget_show(label);
-
- adj = (GtkAdjustment *) gtk_adjustment_new ((gfloat)DEFAULT_RECURSION_LEVEL, 0.0, 255.0, 1.0,
- 5.0, 0.0);
- spinner = gtk_spin_button_new (adj, 0, 0);
- gtk_box_pack_start (GTK_BOX (box5), spinner, FALSE, TRUE, 0);
- gtk_widget_show(spinner);
- sTreeSampleSelection.recursion_spinner = spinner;
-
- /* create horizontal separator */
- separator = gtk_hseparator_new();
- gtk_box_pack_start(GTK_BOX(box1), separator, FALSE, FALSE, 0);
- gtk_widget_show(separator);
-
- /* create bottom button box */
- box2 = gtk_hbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(box1), box2, FALSE, FALSE, 0);
- gtk_container_border_width(GTK_CONTAINER(box2), 5);
- gtk_widget_show(box2);
-
- button = gtk_button_new_with_label("Create Tree Sample");
- gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 0);
- gtk_signal_connect(GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) cb_create_tree, NULL);
- gtk_widget_show(button);
-
- button = gtk_button_new_with_label("Close");
- gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 0);
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_widget_show(button);
-
- }
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-/* end of function used by tree demos */
-
-static void
-create_handle_box ()
-{
- static GtkWidget* window = NULL;
- GtkWidget *hbox;
- GtkWidget *toolbar;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title (GTK_WINDOW (window),
- "Handle Box Test");
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window), &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window), &window);
-
- gtk_container_border_width (GTK_CONTAINER (window), 20);
-
- hbox = gtk_handle_box_new ();
- gtk_container_add (GTK_CONTAINER (window), hbox);
- gtk_signal_connect (GTK_OBJECT (hbox),
- "child_attached",
- GTK_SIGNAL_FUNC (handle_box_child_signal),
- "attached");
- gtk_signal_connect (GTK_OBJECT (hbox),
- "child_detached",
- GTK_SIGNAL_FUNC (handle_box_child_signal),
- "detached");
- gtk_widget_show (hbox);
-
- toolbar = make_toolbar (window);
- gtk_container_add (GTK_CONTAINER (hbox), toolbar);
- gtk_widget_show (toolbar);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-
-static void
-reparent_label (GtkWidget *widget,
- GtkWidget *new_parent)
-{
- GtkWidget *label;
-
- label = gtk_object_get_user_data (GTK_OBJECT (widget));
-
- gtk_widget_reparent (label, new_parent);
-}
-
-static void
-set_parent_signal (GtkWidget *child,
- GtkWidget *old_parent,
- gpointer func_data)
-{
- g_print ("set_parent for \"%s\": new parent: \"%s\", old parent: \"%s\", data: %d\n",
- gtk_type_name (GTK_OBJECT_TYPE (child)),
- child->parent ? gtk_type_name (GTK_OBJECT_TYPE (child->parent)) : "NULL",
- old_parent ? gtk_type_name (GTK_OBJECT_TYPE (old_parent)) : "NULL",
- (gint) func_data);
-}
-
-static void
-create_reparent ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *box3;
- GtkWidget *frame;
- GtkWidget *button;
- GtkWidget *label;
- GtkWidget *separator;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "buttons");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- box2 = gtk_hbox_new (FALSE, 5);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- label = gtk_label_new ("Hello World");
-
- frame = gtk_frame_new ("Frame 1");
- gtk_box_pack_start (GTK_BOX (box2), frame, TRUE, TRUE, 0);
- gtk_widget_show (frame);
-
- box3 = gtk_vbox_new (FALSE, 5);
- gtk_container_border_width (GTK_CONTAINER (box3), 5);
- gtk_container_add (GTK_CONTAINER (frame), box3);
- gtk_widget_show (box3);
-
- button = gtk_button_new_with_label ("switch");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(reparent_label),
- box3);
- gtk_object_set_user_data (GTK_OBJECT (button), label);
- gtk_box_pack_start (GTK_BOX (box3), button, FALSE, TRUE, 0);
- gtk_widget_show (button);
-
- gtk_box_pack_start (GTK_BOX (box3), label, FALSE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT (label),
- "parent_set",
- GTK_SIGNAL_FUNC (set_parent_signal),
- (GtkObject*) 42);
- gtk_widget_show (label);
-
-
- frame = gtk_frame_new ("Frame 2");
- gtk_box_pack_start (GTK_BOX (box2), frame, TRUE, TRUE, 0);
- gtk_widget_show (frame);
-
- box3 = gtk_vbox_new (FALSE, 5);
- gtk_container_border_width (GTK_CONTAINER (box3), 5);
- gtk_container_add (GTK_CONTAINER (frame), box3);
- gtk_widget_show (box3);
-
- button = gtk_button_new_with_label ("switch");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(reparent_label),
- box3);
- gtk_object_set_user_data (GTK_OBJECT (button), label);
- gtk_box_pack_start (GTK_BOX (box3), button, FALSE, TRUE, 0);
- gtk_widget_show (button);
-
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-static void
-create_pixmap ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *box3;
- GtkWidget *button;
- GtkWidget *label;
- GtkWidget *separator;
- GtkWidget *pixmapwid;
- GdkPixmap *pixmap;
- GdkBitmap *mask;
- GtkStyle *style;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "pixmap");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
- gtk_widget_realize(window);
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
- button = gtk_button_new ();
- gtk_box_pack_start (GTK_BOX (box2), button, FALSE, FALSE, 0);
- gtk_widget_show (button);
-
- style=gtk_widget_get_style(button);
-
- pixmap = gdk_pixmap_create_from_xpm (window->window, &mask,
- &style->bg[GTK_STATE_NORMAL],
- "test.xpm");
- pixmapwid = gtk_pixmap_new (pixmap, mask);
-
- label = gtk_label_new ("Pixmap\ntest");
- box3 = gtk_hbox_new (FALSE, 0);
- gtk_container_border_width (GTK_CONTAINER (box3), 2);
- gtk_container_add (GTK_CONTAINER (box3), pixmapwid);
- gtk_container_add (GTK_CONTAINER (box3), label);
- gtk_container_add (GTK_CONTAINER (button), box3);
- gtk_widget_show (pixmapwid);
- gtk_widget_show (label);
- gtk_widget_show (box3);
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-static gint
-tips_query_widget_selected (GtkObject *object,
- GtkWidget *widget,
- const gchar *tip_text,
- const gchar *tip_private,
- GdkEventButton *event,
- gpointer func_data)
-{
- if (widget)
- g_print ("Help \"%s\" requested for <%s>\n",
- tip_private ? tip_private : "None",
- gtk_type_name (widget->object.klass->type));
-
- return TRUE;
-}
-
-static void
-create_tooltips ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *box3;
- GtkWidget *button;
- GtkWidget *frame;
- GtkWidget *tips_query;
- GtkWidget *separator;
- GtkTooltips *tooltips;
-
- if (!window)
- {
- window =
- gtk_widget_new (gtk_window_get_type (),
- "GtkWindow::type", GTK_WINDOW_TOPLEVEL,
- "GtkContainer::border_width", 0,
- "GtkWindow::title", "Tooltips",
- "GtkWindow::allow_shrink", TRUE,
- "GtkWindow::allow_grow", FALSE,
- "GtkWindow::auto_shrink", TRUE,
- "GtkWidget::width", 200,
- NULL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (destroy_tooltips),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC (gtk_true),
- &window);
-
- tooltips=gtk_tooltips_new();
- gtk_object_set_data (GTK_OBJECT (window), "tooltips", tooltips);
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_toggle_button_new_with_label ("button1");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- gtk_tooltips_set_tip (tooltips,button,"This is button 1", "ContextHelp/buttons/1");
-
- button = gtk_toggle_button_new_with_label ("button2");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- gtk_tooltips_set_tip (tooltips,button,"This is button 2", "ContextHelp/buttons/2");
-
- button = gtk_toggle_button_new_with_label ("button3");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- gtk_tooltips_set_tip (tooltips,
- button,
- "This is button 3. This is also a really long tooltip which probably won't fit on a single line and will therefore need to be wrapped. Hopefully the wrapping will work correctly.",
- "ContextHelp/buttons/3_long");
-
- box3 =
- gtk_widget_new (gtk_vbox_get_type (),
- "GtkBox::homogeneous", FALSE,
- "GtkBox::spacing", 5,
- "GtkContainer::border_width", 5,
- "GtkWidget::visible", TRUE,
- NULL);
-
- tips_query = gtk_tips_query_new ();
-
- button =
- gtk_widget_new (gtk_button_get_type (),
- "GtkButton::label", "[?]",
- "GtkWidget::visible", TRUE,
- "GtkWidget::parent", box3,
- "GtkObject::object_signal::clicked", gtk_tips_query_start_query, tips_query,
- NULL);
- gtk_box_set_child_packing (GTK_BOX (box3), button, FALSE, FALSE, 0, GTK_PACK_START);
- gtk_tooltips_set_tip (tooltips,
- button,
- "Start the Tooltips Inspector",
- "ContextHelp/buttons/?");
-
-
- gtk_widget_set (tips_query,
- "GtkWidget::visible", TRUE,
- "GtkWidget::parent", box3,
- "GtkTipsQuery::caller", button,
- "GtkObject::signal::widget_selected", tips_query_widget_selected, NULL,
- NULL);
-
- frame =
- gtk_widget_new (gtk_frame_get_type (),
- "GtkFrame::label", "ToolTips Inspector",
- "GtkFrame::label_xalign", (double) 0.5,
- "GtkContainer::border_width", 0,
- "GtkWidget::visible", TRUE,
- "GtkWidget::parent", box2,
- "GtkContainer::child", box3,
- NULL);
- gtk_box_set_child_packing (GTK_BOX (box2), frame, TRUE, TRUE, 10, GTK_PACK_START);
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
-
- gtk_tooltips_set_tip (tooltips, button, "Push this button to close window", "ContextHelp/buttons/Close");
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-static GtkWidget*
-create_menu (int depth)
-{
- GtkWidget *menu;
- GtkWidget *menuitem;
- GSList *group;
- char buf[32];
- int i, j;
-
- if (depth < 1)
- return NULL;
-
- menu = gtk_menu_new ();
- group = NULL;
-
- for (i = 0, j = 1; i < 5; i++, j++)
- {
- sprintf (buf, "item %2d - %d", depth, j);
- menuitem = gtk_radio_menu_item_new_with_label (group, buf);
- group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menuitem));
- if (depth % 2)
- gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (menuitem), TRUE);
- gtk_menu_append (GTK_MENU (menu), menuitem);
- gtk_widget_show (menuitem);
-
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (depth - 1));
- }
-
- return menu;
-}
-
-static void
-create_menus ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *button;
- GtkWidget *menu;
- GtkWidget *menubar;
- GtkWidget *menuitem;
- GtkWidget *optionmenu;
- GtkWidget *separator;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "menus");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- menubar = gtk_menu_bar_new ();
- gtk_box_pack_start (GTK_BOX (box1), menubar, FALSE, TRUE, 0);
- gtk_widget_show (menubar);
-
- menu = create_menu (2);
-
- menuitem = gtk_menu_item_new_with_label ("test\nline2");
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);
- gtk_menu_bar_append (GTK_MENU_BAR (menubar), menuitem);
- gtk_widget_show (menuitem);
-
- menuitem = gtk_menu_item_new_with_label ("foo");
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (3));
- gtk_menu_bar_append (GTK_MENU_BAR (menubar), menuitem);
- gtk_widget_show (menuitem);
-
- menuitem = gtk_menu_item_new_with_label ("bar");
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (4));
- gtk_menu_item_right_justify (GTK_MENU_ITEM (menuitem));
- gtk_menu_bar_append (GTK_MENU_BAR (menubar), menuitem);
- gtk_widget_show (menuitem);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- optionmenu = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), create_menu (1));
- gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), 4);
- gtk_box_pack_start (GTK_BOX (box2), optionmenu, TRUE, TRUE, 0);
- gtk_widget_show (optionmenu);
-
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-/*
- * GtkScrolledWindow
- */
-static void
-create_scrolled_windows ()
-{
- static GtkWidget *window;
- GtkWidget *scrolled_window;
- GtkWidget *table;
- GtkWidget *button;
- char buffer[32];
- int i, j;
-
- if (!window)
- {
- window = gtk_dialog_new ();
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "dialog");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
-
- scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_container_border_width (GTK_CONTAINER (scrolled_window), 10);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox),
- scrolled_window, TRUE, TRUE, 0);
- gtk_widget_show (scrolled_window);
-
- table = gtk_table_new (20, 20, FALSE);
- gtk_table_set_row_spacings (GTK_TABLE (table), 10);
- gtk_table_set_col_spacings (GTK_TABLE (table), 10);
- gtk_container_add (GTK_CONTAINER (scrolled_window), table);
- gtk_widget_show (table);
-
- for (i = 0; i < 20; i++)
- for (j = 0; j < 20; j++)
- {
- sprintf (buffer, "button (%d,%d)\n", i, j);
- button = gtk_toggle_button_new_with_label (buffer);
- gtk_table_attach_defaults (GTK_TABLE (table), button,
- i, i+1, j, j+1);
- gtk_widget_show (button);
- }
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
- button, TRUE, TRUE, 0);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-/*
- * GtkEntry
- */
-
-static void
-entry_toggle_editable (GtkWidget *checkbutton,
- GtkWidget *entry)
-{
- gtk_entry_set_editable(GTK_ENTRY(entry),
- GTK_TOGGLE_BUTTON(checkbutton)->active);
-}
-
-static void
-create_entry ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *editable_check;
- GtkWidget *entry, *cb;
- GtkWidget *button;
- GtkWidget *separator;
- GList *cbitems = NULL;
-
- if (!window)
- {
- cbitems = g_list_append(cbitems, "item1");
- cbitems = g_list_append(cbitems, "item2");
- cbitems = g_list_append(cbitems, "and item3");
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "entry");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
- entry = gtk_entry_new ();
- gtk_entry_set_text (GTK_ENTRY (entry), "hello world");
- gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1);
- gtk_box_pack_start (GTK_BOX (box2), entry, TRUE, TRUE, 0);
- gtk_widget_show (entry);
-
- cb = gtk_combo_new ();
- gtk_combo_set_popdown_strings (GTK_COMBO (cb), cbitems);
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO(cb)->entry), "hello world");
- gtk_editable_select_region (GTK_EDITABLE (GTK_COMBO(cb)->entry),
- 0, -1);
- gtk_box_pack_start (GTK_BOX (box2), cb, TRUE, TRUE, 0);
- gtk_widget_show (cb);
-
- editable_check = gtk_check_button_new_with_label("Editable");
- gtk_box_pack_start (GTK_BOX (box2), editable_check, FALSE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT(editable_check), "toggled",
- GTK_SIGNAL_FUNC(entry_toggle_editable), entry);
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(editable_check), TRUE);
- gtk_widget_show (editable_check);
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-GtkWidget *spinner1;
-
-static void
-toggle_snap (GtkWidget *widget, GtkSpinButton *spin)
-{
- if (GTK_TOGGLE_BUTTON (widget)->active)
- gtk_spin_button_set_update_policy (spin, GTK_UPDATE_ALWAYS
- | GTK_UPDATE_SNAP_TO_TICKS);
- else
- gtk_spin_button_set_update_policy (spin, GTK_UPDATE_ALWAYS);
-}
-
-static void
-change_digits (GtkWidget *widget, GtkSpinButton *spin)
-{
- gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spinner1),
- gtk_spin_button_get_value_as_int (spin));
-}
-
-static void
-create_spins ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *frame;
- GtkWidget *hbox;
- GtkWidget *main_vbox;
- GtkWidget *vbox;
- GtkWidget *vbox2;
- GtkWidget *spinner2;
- GtkWidget *spinner;
- GtkWidget *button;
- GtkWidget *label;
- GtkAdjustment *adj;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC (destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "GtkSpinButton");
-
- main_vbox = gtk_vbox_new (FALSE, 5);
- gtk_container_border_width (GTK_CONTAINER (main_vbox), 10);
- gtk_container_add (GTK_CONTAINER (window), main_vbox);
-
- frame = gtk_frame_new ("Not accelerated");
- gtk_box_pack_start (GTK_BOX (main_vbox), frame, TRUE, TRUE, 0);
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_border_width (GTK_CONTAINER (vbox), 5);
- gtk_container_add (GTK_CONTAINER (frame), vbox);
-
- /* Day, month, year spinners */
-
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 5);
-
- vbox2 = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, TRUE, 5);
-
- label = gtk_label_new ("Day :");
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
- gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
-
- adj = (GtkAdjustment *) gtk_adjustment_new (1.0, 1.0, 31.0, 1.0,
- 5.0, 0.0);
- spinner = gtk_spin_button_new (adj, 0, 0);
- gtk_box_pack_start (GTK_BOX (vbox2), spinner, FALSE, TRUE, 0);
-
- vbox2 = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, TRUE, 5);
-
- label = gtk_label_new ("Month :");
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
- gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
-
- adj = (GtkAdjustment *) gtk_adjustment_new (1.0, 1.0, 12.0, 1.0,
- 5.0, 0.0);
- spinner = gtk_spin_button_new (adj, 0, 0);
- gtk_box_pack_start (GTK_BOX (vbox2), spinner, FALSE, TRUE, 0);
-
- vbox2 = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, TRUE, 5);
-
- label = gtk_label_new ("Year :");
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
- gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
-
- adj = (GtkAdjustment *) gtk_adjustment_new (1998.0, 0.0, 2100.0,
- 1.0, 100.0, 0.0);
- spinner = gtk_spin_button_new (adj, 0, 0);
- gtk_widget_set_usize (spinner, 55, 0);
- gtk_box_pack_start (GTK_BOX (vbox2), spinner, FALSE, TRUE, 0);
-
- frame = gtk_frame_new ("Accelerated");
- gtk_box_pack_start (GTK_BOX (main_vbox), frame, TRUE, TRUE, 0);
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_border_width (GTK_CONTAINER (vbox), 5);
- gtk_container_add (GTK_CONTAINER (frame), vbox);
-
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 5);
-
- vbox2 = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, TRUE, 5);
-
- label = gtk_label_new ("Value :");
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
- gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
-
- adj = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.0, 10000.0,
- 1.0, 100.0, 0.0);
- spinner1 = gtk_spin_button_new (adj, 1.0, 3);
- gtk_widget_set_usize (spinner1, 120, 0);
- gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (spinner1),
- GTK_UPDATE_ALWAYS);
- gtk_box_pack_start (GTK_BOX (vbox2), spinner1, FALSE, TRUE, 0);
-
- vbox2 = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, TRUE, 0);
-
- label = gtk_label_new ("Digits :");
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
- gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
-
- adj = (GtkAdjustment *) gtk_adjustment_new (3.0, 0.0, 8.0,
- 1.0, 3.0, 0.0);
- spinner2 = gtk_spin_button_new (adj, 0.0, 0);
- gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
- GTK_SIGNAL_FUNC (change_digits),
- (gpointer) spinner2);
- gtk_box_pack_start (GTK_BOX (vbox2), spinner2, FALSE, TRUE, 0);
-
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 5);
-
- button = gtk_check_button_new_with_label ("Snap to ticks");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (toggle_snap),
- spinner1);
- gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE);
-
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, TRUE, 0);
-
- button = gtk_button_new_with_label ("Close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show_all (window);
- else
- gtk_widget_destroy (window);
-}
-
-/*
- * GtkList
- */
-static void
-list_add (GtkWidget *widget,
- GtkWidget *list)
-{
- static int i = 1;
- gchar buffer[64];
- GtkWidget *list_item;
-
- sprintf (buffer, "added item %d", i++);
- list_item = gtk_list_item_new_with_label (buffer);
- gtk_widget_show (list_item);
- gtk_container_add (GTK_CONTAINER (list), list_item);
-}
-
-static void
-list_remove (GtkWidget *widget,
- GtkWidget *list)
-{
- GList *tmp_list;
- GList *clear_list;
-
- tmp_list = GTK_LIST (list)->selection;
- clear_list = NULL;
-
- while (tmp_list)
- {
- clear_list = g_list_prepend (clear_list, tmp_list->data);
- tmp_list = tmp_list->next;
- }
-
- clear_list = g_list_reverse (clear_list);
-
- gtk_list_remove_items (GTK_LIST (list), clear_list);
-
- g_list_free (clear_list);
-}
-
-static void
-list_clear (GtkWidget *widget,
- GtkWidget *list)
-{
- gtk_list_clear_items (GTK_LIST (list), 3 - 1, 5 - 1);
-}
-
-static void
-create_list ()
-{
- static GtkWidget *window = NULL;
- static char *list_items[] =
- {
- "hello",
- "world",
- "blah",
- "foo",
- "bar",
- "argh",
- "spencer",
- "is a",
- "wussy",
- "programmer",
- };
- static int nlist_items = sizeof (list_items) / sizeof (list_items[0]);
-
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *scrolled_win;
- GtkWidget *list;
- GtkWidget *list_item;
- GtkWidget *button;
- GtkWidget *separator;
- int i;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "list");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- scrolled_win = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_box_pack_start (GTK_BOX (box2), scrolled_win, TRUE, TRUE, 0);
- gtk_widget_show (scrolled_win);
-
- list = gtk_list_new ();
- gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_MULTIPLE);
- gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_BROWSE);
- gtk_container_add (GTK_CONTAINER (scrolled_win), list);
- gtk_widget_show (list);
-
- for (i = 0; i < nlist_items; i++)
- {
- list_item = gtk_list_item_new_with_label (list_items[i]);
- gtk_container_add (GTK_CONTAINER (list), list_item);
- gtk_widget_show (list_item);
- }
-
- button = gtk_button_new_with_label ("add");
- GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS);
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(list_add),
- list);
- gtk_box_pack_start (GTK_BOX (box2), button, FALSE, TRUE, 0);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("clear items 3 - 5");
- GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS);
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(list_clear),
- list);
- gtk_box_pack_start (GTK_BOX (box2), button, FALSE, TRUE, 0);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("remove");
- GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS);
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(list_remove),
- list);
- gtk_box_pack_start (GTK_BOX (box2), button, FALSE, TRUE, 0);
- gtk_widget_show (button);
-
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-/*
- * GtkCList
- */
-#define TESTGTK_CLIST_COLUMNS 7
-static gint clist_rows = 0;
-static gint clist_selected_row = 0;
-
-static void
-add1000_clist (GtkWidget *widget, gpointer data)
-{
- gint i, row;
- char text[TESTGTK_CLIST_COLUMNS][50];
- char *texts[TESTGTK_CLIST_COLUMNS];
- GdkBitmap *mask;
- GdkPixmap *pixmap;
-
- pixmap = gdk_pixmap_create_from_xpm (GTK_CLIST (data)->clist_window,
- &mask,
- &GTK_WIDGET (data)->style->white,
- "test.xpm");
-
- for (i = 0; i < TESTGTK_CLIST_COLUMNS; i++)
- {
- texts[i] = text[i];
- sprintf (text[i], "Column %d", i);
- }
-
- texts[3] = NULL;
- sprintf (text[1], "Right");
- sprintf (text[2], "Center");
-
- gtk_clist_freeze (GTK_CLIST (data));
- for (i = 0; i < 1000; i++)
- {
- sprintf (text[0], "Row %d", clist_rows++);
- row = gtk_clist_append (GTK_CLIST (data), texts);
- gtk_clist_set_pixtext (GTK_CLIST (data), row, 3, "Testing", 5, pixmap, mask);
- }
- gtk_clist_thaw (GTK_CLIST (data));
-
- gdk_pixmap_unref (pixmap);
- gdk_bitmap_unref (mask);
-}
-
-static void
-add10000_clist (GtkWidget *widget, gpointer data)
-{
- gint i;
- char text[TESTGTK_CLIST_COLUMNS][50];
- char *texts[TESTGTK_CLIST_COLUMNS];
-
- for (i = 0; i < TESTGTK_CLIST_COLUMNS; i++)
- {
- texts[i] = text[i];
- sprintf (text[i], "Column %d", i);
- }
-
- sprintf (text[1], "Right");
- sprintf (text[2], "Center");
-
- gtk_clist_freeze (GTK_CLIST (data));
- for (i = 0; i < 10000; i++)
- {
- sprintf (text[0], "Row %d", clist_rows++);
- gtk_clist_append (GTK_CLIST (data), texts);
- }
- gtk_clist_thaw (GTK_CLIST (data));
-
-}
-
-void
-clear_clist (GtkWidget *widget, gpointer data)
-{
- gtk_clist_clear (GTK_CLIST (data));
- clist_rows = 0;
-}
-
-void
-remove_row_clist (GtkWidget *widget, gpointer data)
-{
- gtk_clist_remove (GTK_CLIST (data), clist_selected_row);
- clist_rows--;
-}
-
-void
-show_titles_clist (GtkWidget *widget, gpointer data)
-{
- gtk_clist_column_titles_show (GTK_CLIST (data));
-}
-
-void
-hide_titles_clist (GtkWidget *widget, gpointer data)
-{
- gtk_clist_column_titles_hide (GTK_CLIST (data));
-}
-
-void
-select_clist (GtkWidget *widget,
- gint row,
- gint column,
- GdkEventButton * bevent)
-{
- gint i;
- guint8 spacing;
- gchar *text;
- GdkPixmap *pixmap;
- GdkBitmap *mask;
- GList *list;
-
- g_print ("GtkCList Selection: row %d column %d button %d\n",
- row, column, bevent ? bevent->button : 0);
-
- for (i = 0; i < TESTGTK_CLIST_COLUMNS; i++)
- {
- switch (gtk_clist_get_cell_type (GTK_CLIST (widget), row, i))
- {
- case GTK_CELL_TEXT:
- g_print ("CELL %d GTK_CELL_TEXT\n", i);
- gtk_clist_get_text (GTK_CLIST (widget), row, i, &text);
- g_print ("TEXT: %s\n", text);
- break;
-
- case GTK_CELL_PIXMAP:
- g_print ("CELL %d GTK_CELL_PIXMAP\n", i);
- gtk_clist_get_pixmap (GTK_CLIST (widget), row, i, &pixmap, &mask);
- g_print ("PIXMAP: %d\n", (int) pixmap);
- g_print ("MASK: %d\n", (int) mask);
- break;
-
- case GTK_CELL_PIXTEXT:
- g_print ("CELL %d GTK_CELL_PIXTEXT\n", i);
- gtk_clist_get_pixtext (GTK_CLIST (widget), row, i, &text, &spacing, &pixmap, &mask);
- g_print ("TEXT: %s\n", text);
- g_print ("SPACING: %d\n", spacing);
- g_print ("PIXMAP: %d\n", (int) pixmap);
- g_print ("MASK: %d\n", (int) mask);
- break;
-
- default:
- break;
- }
- }
-
- /* print selections list */
- g_print ("\nSelected Rows:");
- list = GTK_CLIST (widget)->selection;
- while (list)
- {
- g_print (" %d ", (gint) list->data);
- list = list->next;
- }
-
- g_print ("\n\n\n");
-
- clist_selected_row = row;
-}
-
-void
-unselect_clist (GtkWidget *widget,
- gint row,
- gint column,
- GdkEventButton * bevent)
-{
- gint i;
- guint8 spacing;
- gchar *text;
- GdkPixmap *pixmap;
- GdkBitmap *mask;
- GList *list;
-
- g_print ("GtkCList Unselection: row %d column %d button %d\n",
- row, column, bevent ? bevent->button : 0);
-
- for (i = 0; i < TESTGTK_CLIST_COLUMNS; i++)
- {
- switch (gtk_clist_get_cell_type (GTK_CLIST (widget), row, i))
- {
- case GTK_CELL_TEXT:
- g_print ("CELL %d GTK_CELL_TEXT\n", i);
- gtk_clist_get_text (GTK_CLIST (widget), row, i, &text);
- g_print ("TEXT: %s\n", text);
- break;
-
- case GTK_CELL_PIXMAP:
- g_print ("CELL %d GTK_CELL_PIXMAP\n", i);
- gtk_clist_get_pixmap (GTK_CLIST (widget), row, i, &pixmap, &mask);
- g_print ("PIXMAP: %d\n", (int) pixmap);
- g_print ("MASK: %d\n", (int) mask);
- break;
-
- case GTK_CELL_PIXTEXT:
- g_print ("CELL %d GTK_CELL_PIXTEXT\n", i);
- gtk_clist_get_pixtext (GTK_CLIST (widget), row, i, &text, &spacing, &pixmap, &mask);
- g_print ("TEXT: %s\n", text);
- g_print ("SPACING: %d\n", spacing);
- g_print ("PIXMAP: %d\n", (int) pixmap);
- g_print ("MASK: %d\n", (int) mask);
- break;
-
- default:
- break;
- }
- }
-
- /* print selections list */
- g_print ("\nSelected Rows:");
- list = GTK_CLIST (widget)->selection;
- while (list)
- {
- g_print (" %d ", (gint) list->data);
- list = list->next;
- }
-
- g_print ("\n\n\n");
-
- clist_selected_row = row;
-}
-
-void
-insert_row_clist (GtkWidget *widget, gpointer data)
-{
- static char *text[] =
- {
- "This",
- "is",
- "a",
- "inserted",
- "row",
- "la la la la la",
- "la la la la"
- };
-
- gtk_clist_insert (GTK_CLIST (data), clist_selected_row, text);
- clist_rows++;
-}
-
-void
-create_clist ()
-{
- gint i;
- static GtkWidget *window = NULL;
-
- static char *titles[] =
- {
- "Title 0",
- "Title 1",
- "Title 2",
- "Title 3",
- "Title 4",
- "Title 5",
- "Title 6"
- };
-
- char text[TESTGTK_CLIST_COLUMNS][50];
- char *texts[TESTGTK_CLIST_COLUMNS];
-
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *clist;
- GtkWidget *button;
- GtkWidget *separator;
-
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "clist");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- box2 = gtk_hbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
- gtk_widget_show (box2);
-
- /* create GtkCList here so we have a pointer to throw at the
- * button callbacks -- more is done with it later */
- clist = gtk_clist_new_with_titles (TESTGTK_CLIST_COLUMNS, titles);
- /*clist = gtk_clist_new (TESTGTK_CLIST_COLUMNS);*/
-
- /* control buttons */
- button = gtk_button_new_with_label ("Add 1,000 Rows With Pixmaps");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
-
- gtk_signal_connect (GTK_OBJECT (button),
- "clicked",
- (GtkSignalFunc) add1000_clist,
- (gpointer) clist);
-
- gtk_widget_show (button);
-
-
- button = gtk_button_new_with_label ("Add 10,000 Rows");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
-
- gtk_signal_connect (GTK_OBJECT (button),
- "clicked",
- (GtkSignalFunc) add10000_clist,
- (gpointer) clist);
-
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Clear List");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
-
- gtk_signal_connect (GTK_OBJECT (button),
- "clicked",
- (GtkSignalFunc) clear_clist,
- (gpointer) clist);
-
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Remove Row");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
-
- gtk_signal_connect (GTK_OBJECT (button),
- "clicked",
- (GtkSignalFunc) remove_row_clist,
- (gpointer) clist);
-
- gtk_widget_show (button);
-
- /* second layer of buttons */
- box2 = gtk_hbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
- gtk_widget_show (box2);
-
- button = gtk_button_new_with_label ("Insert Row");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
-
- gtk_signal_connect (GTK_OBJECT (button),
- "clicked",
- (GtkSignalFunc) insert_row_clist,
- (gpointer) clist);
-
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Show Title Buttons");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
-
- gtk_signal_connect (GTK_OBJECT (button),
- "clicked",
- (GtkSignalFunc) show_titles_clist,
- (gpointer) clist);
-
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Hide Title Buttons");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
-
- gtk_signal_connect (GTK_OBJECT (button),
- "clicked",
- (GtkSignalFunc) hide_titles_clist,
- (gpointer) clist);
-
- gtk_widget_show (button);
-
- /* vbox for the list itself */
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
- /*
- * the rest of the clist configuration
- */
- gtk_clist_set_row_height (GTK_CLIST (clist), 20);
-
- gtk_signal_connect (GTK_OBJECT (clist),
- "select_row",
- (GtkSignalFunc) select_clist,
- NULL);
-
- gtk_signal_connect (GTK_OBJECT (clist),
- "unselect_row",
- (GtkSignalFunc) unselect_clist,
- NULL);
-
- gtk_clist_set_column_width (GTK_CLIST (clist), 0, 100);
-
- for (i = 1; i < TESTGTK_CLIST_COLUMNS; i++)
- gtk_clist_set_column_width (GTK_CLIST (clist), i, 80);
-
- gtk_clist_set_selection_mode (GTK_CLIST (clist), GTK_SELECTION_BROWSE);
- gtk_clist_set_policy (GTK_CLIST (clist),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
-
- gtk_clist_set_policy (GTK_CLIST (clist), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-
- gtk_clist_set_column_justification (GTK_CLIST (clist), 1, GTK_JUSTIFY_RIGHT);
- gtk_clist_set_column_justification (GTK_CLIST (clist), 2, GTK_JUSTIFY_CENTER);
-
- for (i = 0; i < TESTGTK_CLIST_COLUMNS; i++)
- {
- texts[i] = text[i];
- sprintf (text[i], "Column %d", i);
- }
-
- sprintf (text[1], "Right");
- sprintf (text[2], "Center");
-
- for (i = 0; i < 100; i++)
- {
- sprintf (text[0], "Row %d", clist_rows++);
- gtk_clist_append (GTK_CLIST (clist), texts);
- }
-
- gtk_container_border_width (GTK_CONTAINER (clist), 5);
- gtk_box_pack_start (GTK_BOX (box2), clist, TRUE, TRUE, 0);
- gtk_widget_show (clist);
-
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
-
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
-
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- {
- clist_rows = 0;
- gtk_widget_destroy (window);
- }
-
-}
-
-/*
- * GtkColorSelect
- */
-void
-color_selection_ok (GtkWidget *w,
- GtkColorSelectionDialog *cs)
-{
- GtkColorSelection *colorsel;
- gdouble color[4];
-
- colorsel=GTK_COLOR_SELECTION(cs->colorsel);
-
- gtk_color_selection_get_color(colorsel,color);
- gtk_color_selection_set_color(colorsel,color);
-}
-
-void
-color_selection_changed (GtkWidget *w,
- GtkColorSelectionDialog *cs)
-{
- GtkColorSelection *colorsel;
- gdouble color[4];
-
- colorsel=GTK_COLOR_SELECTION(cs->colorsel);
- gtk_color_selection_get_color(colorsel,color);
-}
-
-void
-create_color_selection ()
-{
- static GtkWidget *window = NULL;
-
- if (!window)
- {
- gtk_preview_set_install_cmap (TRUE);
- gtk_widget_push_visual (gtk_preview_get_visual ());
- gtk_widget_push_colormap (gtk_preview_get_cmap ());
-
- window = gtk_color_selection_dialog_new ("color selection dialog");
-
- gtk_color_selection_set_opacity (
- GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (window)->colorsel),
- TRUE);
-
- gtk_color_selection_set_update_policy(
- GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (window)->colorsel),
- GTK_UPDATE_CONTINUOUS);
-
- gtk_window_position (GTK_WINDOW (window), GTK_WIN_POS_MOUSE);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_signal_connect (
- GTK_OBJECT (GTK_COLOR_SELECTION_DIALOG (window)->colorsel),
- "color_changed",
- GTK_SIGNAL_FUNC(color_selection_changed),
- window);
-
- gtk_signal_connect (
- GTK_OBJECT (GTK_COLOR_SELECTION_DIALOG (window)->ok_button),
- "clicked",
- GTK_SIGNAL_FUNC(color_selection_ok),
- window);
-
- gtk_signal_connect_object (
- GTK_OBJECT (GTK_COLOR_SELECTION_DIALOG (window)->cancel_button),
- "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
-
- gtk_widget_pop_colormap ();
- gtk_widget_pop_visual ();
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-void
-file_selection_hide_fileops (GtkWidget *widget,
- GtkFileSelection *fs)
-{
- gtk_file_selection_hide_fileop_buttons (fs);
-}
-
-void
-file_selection_ok (GtkWidget *w,
- GtkFileSelection *fs)
-{
- g_print ("%s\n", gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs)));
- gtk_widget_destroy (GTK_WIDGET (fs));
-}
-
-void
-create_file_selection ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *button;
-
- if (!window)
- {
- window = gtk_file_selection_new ("file selection dialog");
-
- gtk_file_selection_hide_fileop_buttons (GTK_FILE_SELECTION (window));
-
- gtk_window_position (GTK_WINDOW (window), GTK_WIN_POS_MOUSE);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (window)->ok_button),
- "clicked", GTK_SIGNAL_FUNC(file_selection_ok),
- window);
- gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (window)->cancel_button),
- "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
-
- button = gtk_button_new_with_label ("Hide Fileops");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) file_selection_hide_fileops,
- (gpointer) window);
- gtk_box_pack_start (GTK_BOX (GTK_FILE_SELECTION (window)->action_area),
- button, FALSE, FALSE, 0);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Show Fileops");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) gtk_file_selection_show_fileop_buttons,
- (gpointer) window);
- gtk_box_pack_start (GTK_BOX (GTK_FILE_SELECTION (window)->action_area),
- button, FALSE, FALSE, 0);
- gtk_widget_show (button);
-
-
-
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-
-/*
- * GtkDialog
- */
-static GtkWidget *dialog_window = NULL;
-
-void
-label_toggle (GtkWidget *widget,
- GtkWidget **label)
-{
- if (!(*label))
- {
- *label = gtk_label_new ("Dialog Test");
- gtk_signal_connect (GTK_OBJECT (*label),
- "destroy",
- GTK_SIGNAL_FUNC (gtk_widget_destroyed),
- label);
- gtk_misc_set_padding (GTK_MISC (*label), 10, 10);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_window)->vbox),
- *label, TRUE, TRUE, 0);
- gtk_widget_show (*label);
- }
- else
- gtk_widget_destroy (*label);
-}
-
-void
-create_dialog ()
-{
- static GtkWidget *label;
- GtkWidget *button;
-
- if (!dialog_window)
- {
- dialog_window = gtk_dialog_new ();
-
- gtk_signal_connect (GTK_OBJECT (dialog_window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &dialog_window);
- gtk_signal_connect (GTK_OBJECT (dialog_window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &dialog_window);
-
- gtk_window_set_title (GTK_WINDOW (dialog_window), "dialog");
- gtk_container_border_width (GTK_CONTAINER (dialog_window), 0);
-
- button = gtk_button_new_with_label ("OK");
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_window)->action_area),
- button, TRUE, TRUE, 0);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Toggle");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (label_toggle),
- &label);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_window)->action_area),
- button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- label = NULL;
- }
-
- if (!GTK_WIDGET_VISIBLE (dialog_window))
- gtk_widget_show (dialog_window);
- else
- gtk_widget_destroy (dialog_window);
-}
-
-
-/*
- * GtkRange
- */
-void
-create_range_controls ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *button;
- GtkWidget *scrollbar;
- GtkWidget *scale;
- GtkWidget *separator;
- GtkObject *adjustment;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "range controls");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- adjustment = gtk_adjustment_new (0.0, 0.0, 101.0, 0.1, 1.0, 1.0);
-
- scale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment));
- gtk_widget_set_usize (GTK_WIDGET (scale), 150, 30);
- gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
- gtk_scale_set_digits (GTK_SCALE (scale), 1);
- gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
- gtk_box_pack_start (GTK_BOX (box2), scale, TRUE, TRUE, 0);
- gtk_widget_show (scale);
-
- scrollbar = gtk_hscrollbar_new (GTK_ADJUSTMENT (adjustment));
- gtk_range_set_update_policy (GTK_RANGE (scrollbar),
- GTK_UPDATE_CONTINUOUS);
- gtk_box_pack_start (GTK_BOX (box2), scrollbar, TRUE, TRUE, 0);
- gtk_widget_show (scrollbar);
-
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-
-/*
- * GtkRulers
- */
-void
-create_rulers ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *table;
- GtkWidget *ruler;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "rulers");
- gtk_widget_set_usize (window, 300, 300);
- gtk_widget_set_events (window,
- GDK_POINTER_MOTION_MASK
- | GDK_POINTER_MOTION_HINT_MASK);
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
- table = gtk_table_new (2, 2, FALSE);
- gtk_container_add (GTK_CONTAINER (window), table);
- gtk_widget_show (table);
-
- ruler = gtk_hruler_new ();
- gtk_ruler_set_range (GTK_RULER (ruler), 5, 15, 0, 20);
-
- gtk_signal_connect_object (
- GTK_OBJECT (window),
- "motion_notify_event",
- GTK_SIGNAL_FUNC(
- GTK_WIDGET_CLASS (GTK_OBJECT (ruler)->klass)->motion_notify_event),
- GTK_OBJECT (ruler));
-
- gtk_table_attach (GTK_TABLE (table), ruler, 1, 2, 0, 1,
- GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
- gtk_widget_show (ruler);
-
-
- ruler = gtk_vruler_new ();
- gtk_ruler_set_range (GTK_RULER (ruler), 5, 15, 0, 20);
-
- gtk_signal_connect_object (
- GTK_OBJECT (window),
- "motion_notify_event",
- GTK_SIGNAL_FUNC (GTK_WIDGET_CLASS (GTK_OBJECT (ruler)->klass)->motion_notify_event),
- GTK_OBJECT (ruler));
-
- gtk_table_attach (GTK_TABLE (table), ruler, 0, 1, 1, 2,
- GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (ruler);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-
-static void
-text_toggle_editable (GtkWidget *checkbutton,
- GtkWidget *text)
-{
- gtk_text_set_editable(GTK_TEXT(text),
- GTK_TOGGLE_BUTTON(checkbutton)->active);
-}
-
-/*
- * GtkText
- */
-void
-create_text ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *button;
- GtkWidget *editable_check;
- GtkWidget *separator;
- GtkWidget *table;
- GtkWidget *hscrollbar;
- GtkWidget *vscrollbar;
- GtkWidget *text;
-
- FILE *infile;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_widget_set_name (window, "text window");
- gtk_widget_set_usize (window, 500, 500);
- gtk_window_set_policy (GTK_WINDOW(window), TRUE, TRUE, FALSE);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "test");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- table = gtk_table_new (2, 2, FALSE);
- gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
- gtk_table_set_col_spacing (GTK_TABLE (table), 0, 2);
- gtk_box_pack_start (GTK_BOX (box2), table, TRUE, TRUE, 0);
- gtk_widget_show (table);
-
- text = gtk_text_new (NULL, NULL);
- gtk_text_set_editable (GTK_TEXT (text), TRUE);
- gtk_table_attach (GTK_TABLE (table), text, 0, 1, 0, 1,
- GTK_EXPAND | GTK_SHRINK | GTK_FILL,
- GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
- gtk_widget_show (text);
-
- hscrollbar = gtk_hscrollbar_new (GTK_TEXT (text)->hadj);
- gtk_table_attach (GTK_TABLE (table), hscrollbar, 0, 1, 1, 2,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_FILL, 0, 0);
- gtk_widget_show (hscrollbar);
-
- vscrollbar = gtk_vscrollbar_new (GTK_TEXT (text)->vadj);
- gtk_table_attach (GTK_TABLE (table), vscrollbar, 1, 2, 0, 1,
- GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
- gtk_widget_show (vscrollbar);
-
- gtk_text_freeze (GTK_TEXT (text));
-
- gtk_widget_realize (text);
-
- infile = fopen("testgtk.c", "r");
-
- if (infile)
- {
- char buffer[1024];
- int nchars;
-
- while (1)
- {
- nchars = fread(buffer, 1, 1024, infile);
- gtk_text_insert (GTK_TEXT (text), NULL, NULL,
- NULL, buffer, nchars);
-
- if (nchars < 1024)
- break;
- }
-
- fclose (infile);
- }
-
- gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
- "And even ", -1);
- gtk_text_insert (GTK_TEXT (text), NULL, &text->style->bg[GTK_STATE_NORMAL], NULL,
- "colored", -1);
- gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
- "text", -1);
-
- gtk_text_thaw (GTK_TEXT (text));
-
- editable_check = gtk_check_button_new_with_label("Editable");
- gtk_box_pack_start (GTK_BOX (box2), editable_check, FALSE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT(editable_check), "toggled",
- GTK_SIGNAL_FUNC(text_toggle_editable), text);
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(editable_check), TRUE);
- gtk_widget_show (editable_check);
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-
-/*
- * GtkNotebook
- */
-
-GdkPixmap *book_open;
-GdkPixmap *book_closed;
-GdkBitmap *book_open_mask;
-GdkBitmap *book_closed_mask;
-
-static char * book_open_xpm[] = {
-"16 16 4 1",
-" c None s None",
-". c black",
-"X c #808080",
-"o c white",
-" ",
-" .. ",
-" .Xo. ... ",
-" .Xoo. ..oo. ",
-" .Xooo.Xooo... ",
-" .Xooo.oooo.X. ",
-" .Xooo.Xooo.X. ",
-" .Xooo.oooo.X. ",
-" .Xooo.Xooo.X. ",
-" .Xooo.oooo.X. ",
-" .Xoo.Xoo..X. ",
-" .Xo.o..ooX. ",
-" .X..XXXXX. ",
-" ..X....... ",
-" .. ",
-" "};
-
-static char * book_closed_xpm[] = {
-"16 16 6 1",
-" c None s None",
-". c black",
-"X c red",
-"o c yellow",
-"O c #808080",
-"# c white",
-" ",
-" .. ",
-" ..XX. ",
-" ..XXXXX. ",
-" ..XXXXXXXX. ",
-".ooXXXXXXXXX. ",
-"..ooXXXXXXXXX. ",
-".X.ooXXXXXXXXX. ",
-".XX.ooXXXXXX.. ",
-" .XX.ooXXX..#O ",
-" .XX.oo..##OO. ",
-" .XX..##OO.. ",
-" .X.#OO.. ",
-" ..O.. ",
-" .. ",
-" "};
-
-static void
-page_switch (GtkWidget *widget, GtkNotebookPage *page, gint page_num)
-{
- GtkNotebookPage *oldpage;
- GtkWidget *pixwid;
-
- oldpage = GTK_NOTEBOOK (widget)->cur_page;
-
- if (page == oldpage)
- return;
-
- pixwid = ((GtkBoxChild*)(GTK_BOX (page->tab_label)->children->data))->widget;
- gtk_pixmap_set (GTK_PIXMAP (pixwid), book_open, book_open_mask);
- pixwid = ((GtkBoxChild*) (GTK_BOX (page->menu_label)->children->data))->widget;
- gtk_pixmap_set (GTK_PIXMAP (pixwid), book_open, book_open_mask);
-
- if (oldpage)
- {
- pixwid = ((GtkBoxChild*) (GTK_BOX
- (oldpage->tab_label)->children->data))->widget;
- gtk_pixmap_set (GTK_PIXMAP (pixwid), book_closed, book_closed_mask);
- pixwid = ((GtkBoxChild*) (GTK_BOX (oldpage->menu_label)->children->data))->widget;
- gtk_pixmap_set (GTK_PIXMAP (pixwid), book_closed, book_closed_mask);
- }
-}
-
-static void
-create_pages (GtkNotebook *notebook, gint start, gint end)
-{
- GtkWidget *child = NULL;
- GtkWidget *label;
- GtkWidget *entry;
- GtkWidget *box;
- GtkWidget *hbox;
- GtkWidget *label_box;
- GtkWidget *menu_box;
- GtkWidget *button;
- GtkWidget *pixwid;
- gint i;
- char buffer[32];
-
- for (i = start; i <= end; i++)
- {
- sprintf (buffer, "Page %d", i);
-
- switch (i%4)
- {
- case 3:
- child = gtk_button_new_with_label (buffer);
- gtk_container_border_width (GTK_CONTAINER(child), 10);
- break;
- case 2:
- child = gtk_label_new (buffer);
- break;
- case 1:
- child = gtk_frame_new (buffer);
- gtk_container_border_width (GTK_CONTAINER (child), 10);
-
- box = gtk_vbox_new (TRUE,0);
- gtk_container_border_width (GTK_CONTAINER (box), 10);
- gtk_container_add (GTK_CONTAINER (child), box);
-
- label = gtk_label_new (buffer);
- gtk_box_pack_start (GTK_BOX(box), label, TRUE, TRUE, 5);
-
- entry = gtk_entry_new ();
- gtk_box_pack_start (GTK_BOX(box), entry, TRUE, TRUE, 5);
-
- hbox = gtk_hbox_new (TRUE,0);
- gtk_box_pack_start (GTK_BOX(box), hbox, TRUE, TRUE, 5);
-
- button = gtk_button_new_with_label ("Ok");
- gtk_box_pack_start (GTK_BOX(hbox), button, TRUE, TRUE, 5);
-
- button = gtk_button_new_with_label ("Cancel");
- gtk_box_pack_start (GTK_BOX(hbox), button, TRUE, TRUE, 5);
- break;
- case 0:
- child = gtk_frame_new (buffer);
- gtk_container_border_width (GTK_CONTAINER (child), 10);
-
- label = gtk_label_new (buffer);
- gtk_container_add (GTK_CONTAINER (child), label);
- break;
- }
-
- gtk_widget_show_all (child);
-
- label_box = gtk_hbox_new (FALSE, 0);
- pixwid = gtk_pixmap_new (book_closed, book_closed_mask);
- gtk_box_pack_start (GTK_BOX (label_box), pixwid, FALSE, TRUE, 0);
- gtk_misc_set_padding (GTK_MISC (pixwid), 3, 1);
- label = gtk_label_new (buffer);
- gtk_box_pack_start (GTK_BOX (label_box), label, FALSE, TRUE, 0);
- gtk_widget_show_all (label_box);
-
- menu_box = gtk_hbox_new (FALSE, 0);
- pixwid = gtk_pixmap_new (book_closed, book_closed_mask);
- gtk_box_pack_start (GTK_BOX (menu_box), pixwid, FALSE, TRUE, 0);
- gtk_misc_set_padding (GTK_MISC (pixwid), 3, 1);
- label = gtk_label_new (buffer);
- gtk_box_pack_start (GTK_BOX (menu_box), label, FALSE, TRUE, 0);
- gtk_widget_show_all (menu_box);
-
- gtk_notebook_append_page_menu (notebook, child, label_box, menu_box);
- }
-}
-
-static void
-rotate_notebook (GtkButton *button,
- GtkNotebook *notebook)
-{
- gtk_notebook_set_tab_pos (notebook, (notebook->tab_pos + 1) % 4);
-}
-
-static void
-standard_notebook (GtkButton *button,
- GtkNotebook *notebook)
-{
- gint i;
-
- gtk_notebook_set_show_tabs (notebook, TRUE);
- gtk_notebook_set_scrollable (notebook, FALSE);
- if (g_list_length (notebook->children) == 15)
- for (i = 0; i < 10; i++)
- gtk_notebook_remove_page (notebook, 5);
-}
-
-static void
-notabs_notebook (GtkButton *button,
- GtkNotebook *notebook)
-{
- gint i;
-
- gtk_notebook_set_show_tabs (notebook, FALSE);
- if (g_list_length (notebook->children) == 15)
- for (i = 0; i < 10; i++)
- gtk_notebook_remove_page (notebook, 5);
-}
-
-static void
-scrollable_notebook (GtkButton *button,
- GtkNotebook *notebook)
-{
- gtk_notebook_set_show_tabs (notebook, TRUE);
- gtk_notebook_set_scrollable (notebook, TRUE);
- if (g_list_length (notebook->children) == 5)
- create_pages (notebook, 6, 15);
-}
-
-static void
-notebook_popup (GtkToggleButton *button,
- GtkNotebook *notebook)
-{
- if (button->active)
- gtk_notebook_popup_enable (notebook);
- else
- gtk_notebook_popup_disable (notebook);
-}
-
-static void
-create_notebook ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *button;
- GtkWidget *separator;
- GtkWidget *notebook;
- GtkWidget *omenu;
- GtkWidget *menu;
- GtkWidget *submenu;
- GtkWidget *menuitem;
- GSList *group;
- GdkColor transparent;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "notebook");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
-
- notebook = gtk_notebook_new ();
- gtk_signal_connect (GTK_OBJECT (notebook), "switch_page",
- GTK_SIGNAL_FUNC (page_switch), NULL);
- gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP);
- gtk_box_pack_start (GTK_BOX (box1), notebook, TRUE, TRUE, 0);
- gtk_container_border_width (GTK_CONTAINER (notebook), 10);
-
- gtk_widget_realize (notebook);
- book_open = gdk_pixmap_create_from_xpm_d (notebook->window,
- &book_open_mask,
- &transparent,
- book_open_xpm);
- book_closed = gdk_pixmap_create_from_xpm_d (notebook->window,
- &book_closed_mask,
- &transparent,
- book_closed_xpm);
-
- create_pages (GTK_NOTEBOOK (notebook), 1, 5);
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 10);
-
- box2 = gtk_hbox_new (TRUE, 5);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
-
- omenu = gtk_option_menu_new ();
- menu = gtk_menu_new ();
- submenu = NULL;
- group = NULL;
-
- menuitem = gtk_radio_menu_item_new_with_label (group, "Standard");
- gtk_signal_connect_object (GTK_OBJECT (menuitem), "activate",
- GTK_SIGNAL_FUNC (standard_notebook),
- GTK_OBJECT (notebook));
- group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menuitem));
- gtk_menu_append (GTK_MENU (menu), menuitem);
- gtk_widget_show (menuitem);
- menuitem = gtk_radio_menu_item_new_with_label (group, "w/o Tabs");
- gtk_signal_connect_object (GTK_OBJECT (menuitem), "activate",
- GTK_SIGNAL_FUNC (notabs_notebook),
- GTK_OBJECT (notebook));
- group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menuitem));
- gtk_menu_append (GTK_MENU (menu), menuitem);
- gtk_widget_show (menuitem);
- menuitem = gtk_radio_menu_item_new_with_label (group, "Scrollable");
- gtk_signal_connect_object (GTK_OBJECT (menuitem), "activate",
- GTK_SIGNAL_FUNC (scrollable_notebook),
- GTK_OBJECT (notebook));
- group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menuitem));
- gtk_menu_append (GTK_MENU (menu), menuitem);
- gtk_widget_show (menuitem);
-
- gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
- gtk_box_pack_start (GTK_BOX (box2), omenu, FALSE, FALSE, 0);
- button = gtk_check_button_new_with_label ("enable popup menu");
- gtk_box_pack_start (GTK_BOX (box2), button, FALSE, FALSE, 0);
- gtk_signal_connect (GTK_OBJECT(button), "clicked",
- GTK_SIGNAL_FUNC (notebook_popup),
- GTK_OBJECT (notebook));
-
- box2 = gtk_hbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
-
- button = gtk_button_new_with_label ("next");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (gtk_notebook_next_page),
- GTK_OBJECT (notebook));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
-
- button = gtk_button_new_with_label ("prev");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (gtk_notebook_prev_page),
- GTK_OBJECT (notebook));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
-
- button = gtk_button_new_with_label ("rotate");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (rotate_notebook),
- notebook);
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show_all (window);
- else
- gtk_widget_destroy (window);
-}
-
-
-/*
- * GtkPanes
- */
-void
-create_panes ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *frame;
- GtkWidget *hpaned;
- GtkWidget *vpaned;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "Panes");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
- vpaned = gtk_vpaned_new ();
- gtk_container_add (GTK_CONTAINER (window), vpaned);
- gtk_container_border_width (GTK_CONTAINER(vpaned), 5);
- gtk_widget_show (vpaned);
-
- hpaned = gtk_hpaned_new ();
- gtk_paned_add1 (GTK_PANED (vpaned), hpaned);
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
- gtk_widget_set_usize (frame, 60, 60);
- gtk_paned_add1 (GTK_PANED (hpaned), frame);
- gtk_widget_show (frame);
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
- gtk_widget_set_usize (frame, 80, 60);
- gtk_paned_add2 (GTK_PANED (hpaned), frame);
- gtk_widget_show (frame);
-
- gtk_widget_show (hpaned);
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
- gtk_widget_set_usize (frame, 60, 80);
- gtk_paned_add2 (GTK_PANED (vpaned), frame);
- gtk_widget_show (frame);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-
-/*
- * Drag -N- Drop
- */
-
-gboolean
-dnd_drop_destroy_popup (GtkWidget *widget, GtkWindow **window)
-{
- if(GTK_IS_BUTTON(widget)) /* I.e. they clicked the close button */
- gtk_widget_destroy(GTK_WIDGET(*window));
- else {
- gtk_grab_remove(GTK_WIDGET(*window));
- *window = NULL;
- }
- return TRUE;
-}
-
-void
-dnd_drop (GtkWidget *button, GdkEvent *event)
-{
- static GtkWidget *window = NULL;
- GtkWidget *vbox, *lbl, *btn;
- gchar *msg;
-
- window = gtk_window_new(GTK_WINDOW_DIALOG);
- gtk_container_border_width (GTK_CONTAINER(window), 10);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(dnd_drop_destroy_popup),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(dnd_drop_destroy_popup),
- &window);
-
- vbox = gtk_vbox_new(FALSE, 5);
-
- /* Display message that we got from drop source */
- msg = g_malloc(strlen(event->dropdataavailable.data)
- + strlen(event->dropdataavailable.data_type) + 100);
- sprintf(msg, "Drop data of type %s was:\n\n%s",
- event->dropdataavailable.data_type,
- (char *)event->dropdataavailable.data);
- lbl = gtk_label_new(msg);
- gtk_label_set_justify(GTK_LABEL(lbl), GTK_JUSTIFY_FILL);
- g_free(msg);
- gtk_widget_show(lbl);
- gtk_box_pack_start_defaults(GTK_BOX(vbox), lbl);
-
- /* Provide an obvious way out of this heinousness */
- btn = gtk_button_new_with_label("Continue with life in\nspite of this oppression");
- gtk_signal_connect (GTK_OBJECT (btn), "clicked",
- GTK_SIGNAL_FUNC(dnd_drop_destroy_popup),
- &window);
- gtk_widget_show(btn);
- gtk_box_pack_start_defaults(GTK_BOX(vbox), btn);
-
- gtk_container_add(GTK_CONTAINER(window), vbox);
-
- gtk_widget_show(vbox);
- gtk_grab_add(window);
- gtk_widget_show(window);
-}
-
-void
-dnd_drag_request (GtkWidget *button, GdkEvent *event)
-{
-#define DND_STRING "Bill Gates demands royalties for\nyour use of his innovation."
- gtk_widget_dnd_data_set (button, event, DND_STRING, strlen(DND_STRING) + 1);
-}
-
-void
-create_dnd ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *box3;
- GtkWidget *frame;
- GtkWidget *button;
- GtkWidget *separator;
-
- /* For clarity... */
- char *possible_drag_types[] = {"text/plain"};
- char *accepted_drop_types[] = {"text/plain"};
-
- if(!modeller)
- create_shapes();
-
- if (!window)
- {
- GdkPoint hotspot = {5,5};
- gdk_dnd_set_drag_shape(modeller->window,
- &hotspot,
- rings->window,
- &hotspot);
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "Drag -N- Drop");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
- box2 = gtk_hbox_new (FALSE, 5);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
- frame = gtk_frame_new ("Drag");
- gtk_box_pack_start (GTK_BOX (box2), frame, TRUE, TRUE, 0);
- gtk_widget_show (frame);
-
- box3 = gtk_vbox_new (FALSE, 5);
- gtk_container_border_width (GTK_CONTAINER (box3), 5);
- gtk_container_add (GTK_CONTAINER (frame), box3);
- gtk_widget_show (box3);
-
- /*
- * FROM Button
- */
- button = gtk_button_new_with_label ("Drag me!");
- gtk_box_pack_start (GTK_BOX (box3), button, FALSE, TRUE, 0);
- gtk_widget_show (button);
-
- /*
- * currently, the widget has to be realized to
- * set dnd on it, this needs to change
- */
- gtk_widget_realize (button);
- gtk_signal_connect (GTK_OBJECT (button),
- "drag_request_event",
- GTK_SIGNAL_FUNC(dnd_drag_request),
- button);
-
- gtk_widget_dnd_drag_set (button, TRUE, possible_drag_types, 1);
-
-
- frame = gtk_frame_new ("Drop");
- gtk_box_pack_start (GTK_BOX (box2), frame, TRUE, TRUE, 0);
- gtk_widget_show (frame);
-
- box3 = gtk_vbox_new (FALSE, 5);
- gtk_container_border_width (GTK_CONTAINER (box3), 5);
- gtk_container_add (GTK_CONTAINER (frame), box3);
- gtk_widget_show (box3);
-
-
- /*
- * TO Button
- */
- button = gtk_button_new_with_label ("To");
- gtk_box_pack_start (GTK_BOX (box3), button, FALSE, TRUE, 0);
- gtk_widget_show (button);
-
- gtk_widget_realize (button);
- gtk_signal_connect (GTK_OBJECT (button),
- "drop_data_available_event",
- GTK_SIGNAL_FUNC(dnd_drop),
- button);
-
- gtk_widget_dnd_drop_set (button, TRUE, accepted_drop_types, 1, FALSE);
-
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
-
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
-
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- gtk_widget_hide(modeller); gtk_widget_hide(rings);
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-/*
- * Shaped Windows
- */
-static GdkWindow *root_win = NULL;
-
-typedef struct _cursoroffset {gint x,y;} CursorOffset;
-
-static void
-shape_pressed (GtkWidget *widget, GdkEventButton *event)
-{
- CursorOffset *p;
-
- /* ignore double and triple click */
- if (event->type != GDK_BUTTON_PRESS)
- return;
-
- p = gtk_object_get_user_data (GTK_OBJECT(widget));
- p->x = (int) event->x;
- p->y = (int) event->y;
-
- gtk_grab_add (widget);
- gdk_pointer_grab (widget->window, TRUE,
- GDK_BUTTON_RELEASE_MASK |
- GDK_BUTTON_MOTION_MASK |
- GDK_POINTER_MOTION_HINT_MASK,
- NULL, NULL, 0);
-}
-
-
-static void
-shape_released (GtkWidget *widget)
-{
- gtk_grab_remove (widget);
- gdk_pointer_ungrab (0);
-}
-
-static void
-shape_motion (GtkWidget *widget,
- GdkEventMotion *event)
-{
- gint xp, yp;
- CursorOffset * p;
- GdkModifierType mask;
-
- p = gtk_object_get_user_data (GTK_OBJECT (widget));
-
- /*
- * Can't use event->x / event->y here
- * because I need absolute coordinates.
- */
- gdk_window_get_pointer (root_win, &xp, &yp, &mask);
- gtk_widget_set_uposition (widget, xp - p->x, yp - p->y);
-}
-
-GtkWidget *
-shape_create_icon (char *xpm_file,
- gint x,
- gint y,
- gint px,
- gint py,
- gint window_type)
-{
- GtkWidget *window;
- GtkWidget *pixmap;
- GtkWidget *fixed;
- CursorOffset* icon_pos;
- GdkGC* gc;
- GdkBitmap *gdk_pixmap_mask;
- GdkPixmap *gdk_pixmap;
- GtkStyle *style;
-
- style = gtk_widget_get_default_style ();
- gc = style->black_gc;
-
- /*
- * GDK_WINDOW_TOPLEVEL works also, giving you a title border
- */
- window = gtk_window_new (window_type);
-
- fixed = gtk_fixed_new ();
- gtk_widget_set_usize (fixed, 100,100);
- gtk_container_add (GTK_CONTAINER (window), fixed);
- gtk_widget_show (fixed);
-
- gtk_widget_set_events (window,
- gtk_widget_get_events (window) |
- GDK_BUTTON_MOTION_MASK |
- GDK_POINTER_MOTION_HINT_MASK |
- GDK_BUTTON_PRESS_MASK);
-
- gtk_widget_realize (window);
- gdk_pixmap = gdk_pixmap_create_from_xpm (window->window, &gdk_pixmap_mask,
- &style->bg[GTK_STATE_NORMAL],
- xpm_file);
-
- pixmap = gtk_pixmap_new (gdk_pixmap, gdk_pixmap_mask);
- gtk_fixed_put (GTK_FIXED (fixed), pixmap, px,py);
- gtk_widget_show (pixmap);
-
- gtk_widget_shape_combine_mask (window, gdk_pixmap_mask, px,py);
-
-
- gtk_signal_connect (GTK_OBJECT (window), "button_press_event",
- GTK_SIGNAL_FUNC (shape_pressed),NULL);
- gtk_signal_connect (GTK_OBJECT (window), "button_release_event",
- GTK_SIGNAL_FUNC (shape_released),NULL);
- gtk_signal_connect (GTK_OBJECT (window), "motion_notify_event",
- GTK_SIGNAL_FUNC (shape_motion),NULL);
-
- icon_pos = g_new (CursorOffset, 1);
- gtk_object_set_user_data(GTK_OBJECT(window), icon_pos);
-
- gtk_widget_set_uposition (window, x, y);
- gtk_widget_show (window);
-
- return window;
-}
-
-void
-create_shapes ()
-{
- root_win = gdk_window_foreign_new (GDK_ROOT_WINDOW ());
-
- if (!modeller)
- {
- modeller = shape_create_icon ("Modeller.xpm",
- 440, 140, 0,0, GTK_WINDOW_POPUP);
-
- gtk_signal_connect (GTK_OBJECT (modeller), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &modeller);
- gtk_signal_connect (GTK_OBJECT (modeller), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &modeller);
- }
- else
- gtk_widget_destroy (modeller);
-
- if (!sheets)
- {
- sheets = shape_create_icon ("FilesQueue.xpm",
- 580, 170, 0,0, GTK_WINDOW_POPUP);
-
- gtk_signal_connect (GTK_OBJECT (sheets), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &sheets);
- gtk_signal_connect (GTK_OBJECT (sheets), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &sheets);
-
- }
- else
- gtk_widget_destroy (sheets);
-
- if (!rings)
- {
- rings = shape_create_icon ("3DRings.xpm",
- 460, 270, 25,25, GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (rings), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &rings);
- gtk_signal_connect (GTK_OBJECT (rings), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &rings);
- }
- else
- gtk_widget_destroy (rings);
-}
-
-void
-create_wmhints ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *label;
- GtkWidget *separator;
- GtkWidget *button;
- GtkWidget *box1;
- GtkWidget *box2;
-
- GdkBitmap *circles;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "WM Hints");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
- gtk_widget_realize (window);
-
- circles = gdk_bitmap_create_from_data (window->window,
- circles_bits,
- circles_width,
- circles_height);
- gdk_window_set_icon (window->window, NULL,
- circles, circles);
-
- gdk_window_set_icon_name (window->window, "WMHints Test Icon");
-
- gdk_window_set_decorations (window->window, GDK_DECOR_ALL | GDK_DECOR_MENU);
- gdk_window_set_functions (window->window, GDK_FUNC_ALL | GDK_FUNC_RESIZE);
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
- label = gtk_label_new ("Try iconizing me!");
- gtk_widget_set_usize (label, 150, 50);
- gtk_box_pack_start (GTK_BOX (box1), label, TRUE, TRUE, 0);
- gtk_widget_show (label);
-
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
-
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
-
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-/*
- * Progress Bar
- */
-static int progress_timer = 0;
-
-gint
-progress_timeout (gpointer data)
-{
- gfloat new_val;
-
- new_val = GTK_PROGRESS_BAR (data)->percentage;
- if (new_val >= 1.0)
- new_val = 0.0;
- new_val += 0.02;
-
- gtk_progress_bar_update (GTK_PROGRESS_BAR (data), new_val);
-
- return TRUE;
-}
-
-void
-destroy_progress (GtkWidget *widget,
- GtkWidget **window)
-{
- destroy_window (widget, window);
- gtk_timeout_remove (progress_timer);
- progress_timer = 0;
-}
-
-void
-create_progress_bar ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *button;
- GtkWidget *vbox;
- GtkWidget *pbar;
- GtkWidget *label;
-
- if (!window)
- {
- window = gtk_dialog_new ();
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_progress),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_progress),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "dialog");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
-
- vbox = gtk_vbox_new (FALSE, 5);
- gtk_container_border_width (GTK_CONTAINER (vbox), 10);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox),
- vbox, TRUE, TRUE, 0);
- gtk_widget_show (vbox);
-
- label = gtk_label_new ("progress...");
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
- gtk_widget_show (label);
-
- pbar = gtk_progress_bar_new ();
- gtk_widget_set_usize (pbar, 200, 20);
- gtk_box_pack_start (GTK_BOX (vbox), pbar, TRUE, TRUE, 0);
- gtk_widget_show (pbar);
-
- progress_timer = gtk_timeout_add (100, progress_timeout, pbar);
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
- button, TRUE, TRUE, 0);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-
-/*
- * Color Preview
- */
-static int color_idle = 0;
-
-gint
-color_idle_func (GtkWidget *preview)
-{
- static int count = 1;
- guchar buf[768];
- int i, j, k;
-
- for (i = 0; i < 256; i++)
- {
- for (j = 0, k = 0; j < 256; j++)
- {
- buf[k+0] = i + count;
- buf[k+1] = 0;
- buf[k+2] = j + count;
- k += 3;
- }
-
- gtk_preview_draw_row (GTK_PREVIEW (preview), buf, 0, i, 256);
- }
-
- count += 1;
-
- gtk_widget_draw (preview, NULL);
-
- return TRUE;
-}
-
-void
-color_preview_destroy (GtkWidget *widget,
- GtkWidget **window)
-{
- gtk_idle_remove (color_idle);
- color_idle = 0;
-
- destroy_window (widget, window);
-}
-
-void
-create_color_preview ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *preview;
- guchar buf[768];
- int i, j, k;
-
- if (!window)
- {
- gtk_widget_push_visual (gtk_preview_get_visual ());
- gtk_widget_push_colormap (gtk_preview_get_cmap ());
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(color_preview_destroy),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(color_preview_destroy),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "test");
- gtk_container_border_width (GTK_CONTAINER (window), 10);
-
- preview = gtk_preview_new (GTK_PREVIEW_COLOR);
- gtk_preview_size (GTK_PREVIEW (preview), 256, 256);
- gtk_container_add (GTK_CONTAINER (window), preview);
- gtk_widget_show (preview);
-
- for (i = 0; i < 256; i++)
- {
- for (j = 0, k = 0; j < 256; j++)
- {
- buf[k+0] = i;
- buf[k+1] = 0;
- buf[k+2] = j;
- k += 3;
- }
-
- gtk_preview_draw_row (GTK_PREVIEW (preview), buf, 0, i, 256);
- }
-
- color_idle = gtk_idle_add ((GtkFunction) color_idle_func, preview);
-
- gtk_widget_pop_colormap ();
- gtk_widget_pop_visual ();
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-
-/*
- * Gray Preview
- */
-static int gray_idle = 0;
-
-gint
-gray_idle_func (GtkWidget *preview)
-{
- static int count = 1;
- guchar buf[256];
- int i, j;
-
- for (i = 0; i < 256; i++)
- {
- for (j = 0; j < 256; j++)
- buf[j] = i + j + count;
-
- gtk_preview_draw_row (GTK_PREVIEW (preview), buf, 0, i, 256);
- }
-
- count += 1;
-
- gtk_widget_draw (preview, NULL);
-
- return TRUE;
-}
-
-void
-gray_preview_destroy (GtkWidget *widget,
- GtkWidget **window)
-{
- gtk_idle_remove (gray_idle);
- gray_idle = 0;
-
- destroy_window (widget, window);
-}
-
-void
-create_gray_preview ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *preview;
- guchar buf[256];
- int i, j;
-
- if (!window)
- {
- gtk_widget_push_visual (gtk_preview_get_visual ());
- gtk_widget_push_colormap (gtk_preview_get_cmap ());
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(gray_preview_destroy),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(gray_preview_destroy),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "test");
- gtk_container_border_width (GTK_CONTAINER (window), 10);
-
- preview = gtk_preview_new (GTK_PREVIEW_GRAYSCALE);
- gtk_preview_size (GTK_PREVIEW (preview), 256, 256);
- gtk_container_add (GTK_CONTAINER (window), preview);
- gtk_widget_show (preview);
-
- for (i = 0; i < 256; i++)
- {
- for (j = 0; j < 256; j++)
- buf[j] = i + j;
-
- gtk_preview_draw_row (GTK_PREVIEW (preview), buf, 0, i, 256);
- }
-
- gray_idle = gtk_idle_add ((GtkFunction) gray_idle_func, preview);
-
- gtk_widget_pop_colormap ();
- gtk_widget_pop_visual ();
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-
-/*
- * Selection Test
- */
-void
-selection_test_received (GtkWidget *list, GtkSelectionData *data)
-{
- GdkAtom *atoms;
- GtkWidget *list_item;
- GList *item_list;
- int i, l;
-
- if (data->length < 0)
- {
- g_print ("Selection retrieval failed\n");
- return;
- }
- if (data->type != GDK_SELECTION_TYPE_ATOM)
- {
- g_print ("Selection \"TARGETS\" was not returned as atoms!\n");
- return;
- }
-
- /* Clear out any current list items */
-
- gtk_list_clear_items (GTK_LIST(list), 0, -1);
-
- /* Add new items to list */
-
- atoms = (GdkAtom *)data->data;
-
- item_list = NULL;
- l = data->length / sizeof (GdkAtom);
- for (i = 0; i < l; i++)
- {
- char *name;
- name = gdk_atom_name (atoms[i]);
- if (name != NULL)
- {
- list_item = gtk_list_item_new_with_label (name);
- g_free (name);
- }
- else
- list_item = gtk_list_item_new_with_label ("(bad atom)");
-
- gtk_widget_show (list_item);
- item_list = g_list_append (item_list, list_item);
- }
-
- gtk_list_append_items (GTK_LIST (list), item_list);
-
- return;
-}
-
-void
-selection_test_get_targets (GtkWidget *widget, GtkWidget *list)
-{
- static GdkAtom targets_atom = GDK_NONE;
-
- if (targets_atom == GDK_NONE)
- targets_atom = gdk_atom_intern ("TARGETS", FALSE);
-
- gtk_selection_convert (list, GDK_SELECTION_PRIMARY, targets_atom,
- GDK_CURRENT_TIME);
-}
-
-void
-create_selection_test ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *button;
- GtkWidget *vbox;
- GtkWidget *scrolled_win;
- GtkWidget *list;
- GtkWidget *label;
-
- if (!window)
- {
- window = gtk_dialog_new ();
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "Selection Test");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
- /* Create the list */
-
- vbox = gtk_vbox_new (FALSE, 5);
- gtk_container_border_width (GTK_CONTAINER (vbox), 10);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), vbox,
- TRUE, TRUE, 0);
- gtk_widget_show (vbox);
-
- label = gtk_label_new ("Gets available targets for current selection");
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
- gtk_widget_show (label);
-
- scrolled_win = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_box_pack_start (GTK_BOX (vbox), scrolled_win, TRUE, TRUE, 0);
- gtk_widget_set_usize (scrolled_win, 100, 200);
- gtk_widget_show (scrolled_win);
-
- list = gtk_list_new ();
- gtk_container_add (GTK_CONTAINER (scrolled_win), list);
-
- gtk_signal_connect (GTK_OBJECT(list), "selection_received",
- GTK_SIGNAL_FUNC (selection_test_received), NULL);
- gtk_widget_show (list);
-
- /* .. And create some buttons */
- button = gtk_button_new_with_label ("Get Targets");
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
- button, TRUE, TRUE, 0);
-
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (selection_test_get_targets), list);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Quit");
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
- button, TRUE, TRUE, 0);
-
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-
-/*
- * Gamma Curve
- */
-void
-create_gamma_curve ()
-{
- static GtkWidget *window = NULL, *curve;
- static int count = 0;
- gfloat vec[256];
- gint max;
- gint i;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title (GTK_WINDOW (window), "test");
- gtk_container_border_width (GTK_CONTAINER (window), 10);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- curve = gtk_gamma_curve_new ();
- gtk_container_add (GTK_CONTAINER (window), curve);
- gtk_widget_show (curve);
- }
-
- max = 127 + (count % 2)*128;
- gtk_curve_set_range (GTK_CURVE (GTK_GAMMA_CURVE (curve)->curve),
- 0, max, 0, max);
- for (i = 0; i < max; ++i)
- vec[i] = (127 / sqrt (max)) * sqrt (i);
- gtk_curve_set_vector (GTK_CURVE (GTK_GAMMA_CURVE (curve)->curve),
- max, vec);
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else if (count % 4 == 3)
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- ++count;
-}
-
-static int scroll_test_pos = 0.0;
-static GdkGC *scroll_test_gc = NULL;
-
-static gint
-scroll_test_expose (GtkWidget *widget, GdkEventExpose *event,
- GtkAdjustment *adj)
-{
- gint i,j;
- gint imin, imax, jmin, jmax;
-
- imin = (event->area.x) / 10;
- imax = (event->area.x + event->area.width + 9) / 10;
-
- jmin = ((int)adj->value + event->area.y) / 10;
- jmax = ((int)adj->value + event->area.y + event->area.height + 9) / 10;
-
- gdk_window_clear_area (widget->window,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
-
- for (i=imin; i<imax; i++)
- for (j=jmin; j<jmax; j++)
- if ((i+j) % 2)
- gdk_draw_rectangle (widget->window,
- widget->style->black_gc,
- TRUE,
- 10*i, 10*j - (int)adj->value, 1+i%10, 1+j%10);
-
- return TRUE;
-}
-
-static void
-scroll_test_configure (GtkWidget *widget, GdkEventConfigure *event,
- GtkAdjustment *adj)
-{
- adj->page_increment = 0.9 * widget->allocation.height;
- adj->page_size = widget->allocation.height;
-
- gtk_signal_emit_by_name (GTK_OBJECT (adj), "changed");
-}
-
-static void
-scroll_test_adjustment_changed (GtkAdjustment *adj, GtkWidget *widget)
-{
- gint source_min = (int)adj->value - scroll_test_pos;
- gint source_max = source_min + widget->allocation.height;
- gint dest_min = 0;
- gint dest_max = widget->allocation.height;
- GdkRectangle rect;
- GdkEvent *event;
-
- scroll_test_pos = adj->value;
-
- if (!GTK_WIDGET_DRAWABLE (widget))
- return;
-
- if (source_min < 0)
- {
- rect.x = 0;
- rect.y = 0;
- rect.width = widget->allocation.width;
- rect.height = -source_min;
- if (rect.height > widget->allocation.height)
- rect.height = widget->allocation.height;
-
- source_min = 0;
- dest_min = rect.height;
- }
- else
- {
- rect.x = 0;
- rect.y = 2*widget->allocation.height - source_max;
- if (rect.y < 0)
- rect.y = 0;
- rect.width = widget->allocation.width;
- rect.height = widget->allocation.height - rect.y;
-
- source_max = widget->allocation.height;
- dest_max = rect.y;
- }
-
- if (source_min != source_max)
- {
- if (scroll_test_gc == NULL)
- {
- scroll_test_gc = gdk_gc_new (widget->window);
- gdk_gc_set_exposures (scroll_test_gc, TRUE);
- }
-
- gdk_draw_pixmap (widget->window,
- scroll_test_gc,
- widget->window,
- 0, source_min,
- 0, dest_min,
- widget->allocation.width,
- source_max - source_min);
-
- /* Make sure graphics expose events are processed before scrolling
- * again */
-
- while ((event = gdk_event_get_graphics_expose (widget->window)) != NULL)
- {
- gtk_widget_event (widget, event);
- if (event->expose.count == 0)
- {
- gdk_event_free (event);
- break;
- }
- gdk_event_free (event);
- }
- }
-
-
- if (rect.height != 0)
- gtk_widget_draw (widget, &rect);
-}
-
-
-void
-create_scroll_test ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *hbox;
- GtkWidget *drawing_area;
- GtkWidget *scrollbar;
- GtkWidget *button;
- GtkAdjustment *adj;
-
- if (!window)
- {
- window = gtk_dialog_new ();
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "Scroll Test");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), hbox,
- TRUE, TRUE, 0);
- gtk_widget_show (hbox);
-
- drawing_area = gtk_drawing_area_new ();
- gtk_drawing_area_size (GTK_DRAWING_AREA (drawing_area), 200, 200);
- gtk_box_pack_start (GTK_BOX (hbox), drawing_area, TRUE, TRUE, 0);
- gtk_widget_show (drawing_area);
-
- gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK);
-
- adj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 1000.0, 1.0, 180.0, 200.0));
- scroll_test_pos = 0.0;
-
- scrollbar = gtk_vscrollbar_new (adj);
- gtk_box_pack_start (GTK_BOX (hbox), scrollbar, FALSE, FALSE, 0);
- gtk_widget_show (scrollbar);
-
- gtk_signal_connect (GTK_OBJECT (drawing_area), "expose_event",
- GTK_SIGNAL_FUNC (scroll_test_expose), adj);
- gtk_signal_connect (GTK_OBJECT (drawing_area), "configure_event",
- GTK_SIGNAL_FUNC (scroll_test_configure), adj);
-
-
- gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
- GTK_SIGNAL_FUNC (scroll_test_adjustment_changed),
- drawing_area);
-
- /* .. And create some buttons */
-
- button = gtk_button_new_with_label ("Quit");
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
- button, TRUE, TRUE, 0);
-
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-/*
- * Timeout Test
- */
-static int timer = 0;
-
-void
-timeout_test (GtkWidget *label)
-{
- static int count = 0;
- static char buffer[32];
-
- sprintf (buffer, "count: %d", ++count);
- gtk_label_set (GTK_LABEL (label), buffer);
-}
-
-void
-start_timeout_test (GtkWidget *widget,
- GtkWidget *label)
-{
- if (!timer)
- {
- timer = gtk_timeout_add (100, (GtkFunction) timeout_test, label);
- }
-}
-
-void
-stop_timeout_test (GtkWidget *widget,
- gpointer data)
-{
- if (timer)
- {
- gtk_timeout_remove (timer);
- timer = 0;
- }
-}
-
-void
-destroy_timeout_test (GtkWidget *widget,
- GtkWidget **window)
-{
- destroy_window (widget, window);
- stop_timeout_test (NULL, NULL);
-}
-
-void
-create_timeout_test ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *button;
- GtkWidget *label;
-
- if (!window)
- {
- window = gtk_dialog_new ();
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_timeout_test),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_timeout_test),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "Timeout Test");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
- label = gtk_label_new ("count: 0");
- gtk_misc_set_padding (GTK_MISC (label), 10, 10);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox),
- label, TRUE, TRUE, 0);
- gtk_widget_show (label);
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
- button, TRUE, TRUE, 0);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("start");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(start_timeout_test),
- label);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
- button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("stop");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(stop_timeout_test),
- NULL);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
- button, TRUE, TRUE, 0);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-
-/*
- * Idle Test
- */
-static int idle = 0;
-
-gint
-idle_test (GtkWidget *label)
-{
- static int count = 0;
- static char buffer[32];
-
- sprintf (buffer, "count: %d", ++count);
- gtk_label_set (GTK_LABEL (label), buffer);
-
- return TRUE;
-}
-
-void
-start_idle_test (GtkWidget *widget,
- GtkWidget *label)
-{
- if (!idle)
- {
- idle = gtk_idle_add ((GtkFunction) idle_test, label);
- }
-}
-
-void
-stop_idle_test (GtkWidget *widget,
- gpointer data)
-{
- if (idle)
- {
- gtk_idle_remove (idle);
- idle = 0;
- }
-}
-
-void
-destroy_idle_test (GtkWidget *widget,
- GtkWidget **window)
-{
- destroy_window (widget, window);
- stop_idle_test (NULL, NULL);
-}
-
-void
-create_idle_test ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *button;
- GtkWidget *label;
-
- if (!window)
- {
- window = gtk_dialog_new ();
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_idle_test),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_idle_test),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "Idle Test");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
- label = gtk_label_new ("count: 0");
- gtk_misc_set_padding (GTK_MISC (label), 10, 10);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox),
- label, TRUE, TRUE, 0);
- gtk_widget_show (label);
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
- button, TRUE, TRUE, 0);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("start");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(start_idle_test),
- label);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
- button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("stop");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(stop_idle_test),
- NULL);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
- button, TRUE, TRUE, 0);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-void
-test_destroy (GtkWidget *widget,
- GtkWidget **window)
-{
- destroy_window (widget, window);
- gtk_main_quit ();
-}
-
-/*
- * Basic Test
- */
-void
-create_test ()
-{
- static GtkWidget *window = NULL;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(test_destroy),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(test_destroy),
- &window);
-
-
- gtk_window_set_title (GTK_WINDOW (window), "test");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- {
- gtk_widget_show (window);
-
- g_print ("create_test: start\n");
- gtk_main ();
- g_print ("create_test: done\n");
- }
- else
- gtk_widget_destroy (window);
-}
-
-
-/*
- * Main Window and Exit
- */
-void
-do_exit (GtkWidget *widget, GtkWidget *window)
-{
- gtk_widget_destroy (window);
- gtk_main_quit ();
-}
-
-void
-create_main_window ()
-{
- struct {
- char *label;
- void (*func) ();
- } buttons[] =
- {
- { "buttons", create_buttons },
- { "toggle buttons", create_toggle_buttons },
- { "check buttons", create_check_buttons },
- { "radio buttons", create_radio_buttons },
- { "button box", create_button_box },
- { "toolbar", create_toolbar },
- { "handle box", create_handle_box },
- { "statusbar", create_statusbar },
- { "reparent", create_reparent },
- { "pixmap", create_pixmap },
- { "tooltips", create_tooltips },
- { "menus", create_menus },
- { "scrolled windows", create_scrolled_windows },
- { "drawing areas", NULL },
- { "entry", create_entry },
- { "spinbutton", create_spins },
- { "list", create_list },
- { "clist", create_clist},
- { "tree", create_tree_mode_window},
- { "color selection", create_color_selection },
- { "file selection", create_file_selection },
- { "dialog", create_dialog },
- { "miscellaneous", NULL },
- { "range controls", create_range_controls },
- { "rulers", create_rulers },
- { "text", create_text },
- { "notebook", create_notebook },
- { "panes", create_panes },
- { "shapes", create_shapes },
- { "dnd", create_dnd },
- { "WM hints", create_wmhints },
- { "progress bar", create_progress_bar },
- { "preview color", create_color_preview },
- { "preview gray", create_gray_preview },
- { "gamma curve", create_gamma_curve },
- { "test scrolling", create_scroll_test },
- { "test selection", create_selection_test },
- { "test timeout", create_timeout_test },
- { "test idle", create_idle_test },
- { "test", create_test },
- };
- int nbuttons = sizeof (buttons) / sizeof (buttons[0]);
- GtkWidget *window;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *scrolled_window;
- GtkWidget *button;
- GtkWidget *label;
- gchar buffer[64];
- GtkWidget *separator;
- int i;
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_widget_set_name (window, "main window");
- gtk_widget_set_usize (window, 200, 400);
- gtk_widget_set_uposition (window, 20, 20);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(gtk_main_quit),
- NULL);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(gtk_main_quit),
- NULL);
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
- if (gtk_micro_version > 0)
- sprintf (buffer,
- "Gtk+ v%d.%d.%d",
- gtk_major_version,
- gtk_minor_version,
- gtk_micro_version);
- else
- sprintf (buffer,
- "Gtk+ v%d.%d",
- gtk_major_version,
- gtk_minor_version);
-
- label = gtk_label_new (buffer);
- gtk_widget_show (label);
- gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);
-
- scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_container_border_width (GTK_CONTAINER (scrolled_window), 10);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_box_pack_start (GTK_BOX (box1), scrolled_window, TRUE, TRUE, 0);
- gtk_widget_show (scrolled_window);
-
- box2 = gtk_vbox_new (FALSE, 0);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_container_add (GTK_CONTAINER (scrolled_window), box2);
- gtk_widget_show (box2);
-
- for (i = 0; i < nbuttons; i++)
- {
- button = gtk_button_new_with_label (buttons[i].label);
- if (buttons[i].func)
- gtk_signal_connect (GTK_OBJECT (button),
- "clicked",
- GTK_SIGNAL_FUNC(buttons[i].func),
- NULL);
- else
- gtk_widget_set_sensitive (button, FALSE);
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
- }
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (do_exit),
- window);
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
-
- gtk_widget_show (window);
-}
-
-int
-main (int argc, char *argv[])
-{
- gtk_set_locale ();
-
- gtk_init (&argc, &argv);
-
-#ifdef HAVE_LIBGLE
- gle_init (&argc, &argv);
-#endif /* !HAVE_LIBGLE */
-
- gtk_rc_parse ("testgtkrc");
-
- create_main_window ();
-
- gtk_main ();
-
- return 0;
-}
diff --git a/gtk/testgtkrc b/gtk/testgtkrc
deleted file mode 100644
index 566c663831..0000000000
--- a/gtk/testgtkrc
+++ /dev/null
@@ -1,77 +0,0 @@
-# pixmap_path "<dir 1>:<dir 2>:<dir 3>:..."
-#
-# style <name> [= <name>]
-# {
-# <option>
-# }
-#
-# widget <widget_set> style <style_name>
-# widget_class <widget_class_set> style <style_name>
-
-pixmap_path "."
-
-style "default"
-{
- fontset = "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*,*"
-# base[NORMAL] = { 0.8, 0.8, 1.0 }
-}
-
-style "window"
-{
-# bg_pixmap[NORMAL] = "warning.xpm"
-}
-
-style "scale"
-{
- fg[NORMAL] = { 1.0, 0, 0 }
- bg_pixmap[NORMAL] = "<parent>"
-}
-
-style "button"
-{
-# fg[PRELIGHT] = { 1.0, 1.0, 1.0 }
-# bg[PRELIGHT] = { 0, 0, 0.75 }
-}
-
-style 'main_button' = 'button'
-{
- font = "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*"
- bg[PRELIGHT] = { 0, 0.75, 0x00 }
-}
-
-style "toggle_button" = "button"
-{
- fg[NORMAL] = { 1.0, 0, 0 }
- fg[ACTIVE] = { 1.0, 0, 0 }
- bg_pixmap[NORMAL] = "<parent>"
-}
-
-style "text"
-{
- bg_pixmap[NORMAL] = "marble.xpm"
- text[NORMAL] = { 1.0, 1.0, 1.0 }
- base[NORMAL] = { 0.0, 0.0, 0.0 }
-}
-
-style "ruler"
-{
- font = '-adobe-helvetica-medium-r-normal--*-80-*-*-*-*-*-*'
-}
-
-style "curve"
-{
- fg[NORMAL] = { 58000, 0, 0 } # red
-}
-
-widget_class "GtkWindow" style "window"
-widget_class "GtkDialog" style "window"
-widget_class "GtkFileSelection" style "window"
-widget_class "*Gtk*Scale" style "scale"
-widget_class "*GtkCheckButton*" style "toggle_button"
-widget_class "*GtkRadioButton*" style "toggle_button"
-widget_class "*GtkButton*" style "button"
-widget_class "*Ruler" style "ruler"
-widget_class "*GtkText" style "text"
-widget_class "*" style "default"
-widget "main window.*GtkButton*" style "main_button"
-widget "*GtkCurve" style "curve"
diff --git a/gtk/testinput.c b/gtk/testinput.c
deleted file mode 100644
index 218e5ca769..0000000000
--- a/gtk/testinput.c
+++ /dev/null
@@ -1,393 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "gtk.h"
-
-/* Backing pixmap for drawing area */
-
-static GdkPixmap *pixmap = NULL;
-
-/* Information about cursor */
-
-static gint need_cursor = FALSE;
-static gint cursor_proximity = TRUE;
-static gdouble cursor_x;
-static gdouble cursor_y;
-
-/* Unique ID of current device */
-static guint32 current_device = GDK_CORE_POINTER;
-
-/* Check to see if we need to draw a cursor for current device */
-static void
-check_cursor ()
-{
- GList *tmp_list;
-
- /* gdk_input_list_devices returns an internal list, so we shouldn't
- free it afterwards */
- tmp_list = gdk_input_list_devices();
-
- while (tmp_list)
- {
- GdkDeviceInfo *info = (GdkDeviceInfo *)tmp_list->data;
-
- if (info->deviceid == current_device)
- {
- need_cursor = !info->has_cursor;
- break;
- }
-
- tmp_list = tmp_list->next;
- }
-}
-
-/* Erase the old cursor, and/or draw a new one, if necessary */
-static void
-update_cursor (GtkWidget *widget, gdouble x, gdouble y)
-{
- static gint cursor_present = 0;
- gint state = need_cursor && cursor_proximity;
-
- if (pixmap != NULL)
- {
- if (cursor_present && (cursor_present != state ||
- x != cursor_x || y != cursor_y))
- {
- gdk_draw_pixmap(widget->window,
- widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
- pixmap,
- cursor_x - 5, cursor_y - 5,
- cursor_x - 5, cursor_y - 5,
- 10, 10);
- }
-
- cursor_present = state;
- cursor_x = x;
- cursor_y = y;
-
- if (cursor_present)
- {
- gdk_draw_rectangle (widget->window,
- widget->style->black_gc,
- TRUE,
- cursor_x - 5, cursor_y -5,
- 10, 10);
- }
- }
-}
-
-/* Create a new backing pixmap of the appropriate size */
-static gint
-configure_event (GtkWidget *widget, GdkEventConfigure *event)
-{
- if (pixmap)
- gdk_pixmap_unref (pixmap);
- pixmap = gdk_pixmap_new(widget->window,
- widget->allocation.width,
- widget->allocation.height,
- -1);
- gdk_draw_rectangle (pixmap,
- widget->style->white_gc,
- TRUE,
- 0, 0,
- widget->allocation.width,
- widget->allocation.height);
-
- return TRUE;
-}
-
-/* Refill the screen from the backing pixmap */
-static gint
-expose_event (GtkWidget *widget, GdkEventExpose *event)
-{
- gdk_draw_pixmap(widget->window,
- widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
- pixmap,
- event->area.x, event->area.y,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
-
- return FALSE;
-}
-
-/* Draw a rectangle on the screen, size depending on pressure,
- and color on the type of device */
-static void
-draw_brush (GtkWidget *widget, GdkInputSource source,
- gdouble x, gdouble y, gdouble pressure)
-{
- GdkGC *gc;
- GdkRectangle update_rect;
-
- switch (source)
- {
- case GDK_SOURCE_MOUSE:
- gc = widget->style->dark_gc[GTK_WIDGET_STATE (widget)];
- break;
- case GDK_SOURCE_PEN:
- gc = widget->style->black_gc;
- break;
- case GDK_SOURCE_ERASER:
- gc = widget->style->white_gc;
- break;
- default:
- gc = widget->style->light_gc[GTK_WIDGET_STATE (widget)];
- }
-
- update_rect.x = x - 10 * pressure;
- update_rect.y = y - 10 * pressure;
- update_rect.width = 20 * pressure;
- update_rect.height = 20 * pressure;
- gdk_draw_rectangle (pixmap, gc, TRUE,
- update_rect.x, update_rect.y,
- update_rect.width, update_rect.height);
- gtk_widget_draw (widget, &update_rect);
-}
-
-static guint32 motion_time;
-
-static gint
-button_press_event (GtkWidget *widget, GdkEventButton *event)
-{
- if (event->deviceid != current_device)
- {
- current_device = event->deviceid;
- check_cursor ();
- }
-
- cursor_proximity = TRUE;
-
- if (event->button == 1 && pixmap != NULL)
- {
- draw_brush (widget, event->source, event->x, event->y,
- event->pressure);
- motion_time = event->time;
- }
-
- update_cursor (widget, event->x, event->y);
-
- return TRUE;
-}
-
-static gint
-key_press_event (GtkWidget *widget, GdkEventKey *event)
-{
- if ((event->keyval >= 0x20) && (event->keyval <= 0xFF))
- printf("I got a %c\n", event->keyval);
- else
- printf("I got some other key\n");
-
- return TRUE;
-}
-
-static gint
-motion_notify_event (GtkWidget *widget, GdkEventMotion *event)
-{
- GdkTimeCoord *coords;
- int nevents;
- int i;
-
- if (event->deviceid != current_device)
- {
- current_device = event->deviceid;
- check_cursor ();
- }
-
- cursor_proximity = TRUE;
-
- if (event->state & GDK_BUTTON1_MASK && pixmap != NULL)
- {
- coords = gdk_input_motion_events (event->window, event->deviceid,
- motion_time, event->time,
- &nevents);
- motion_time = event->time;
- if (coords)
- {
- for (i=0; i<nevents; i++)
- draw_brush (widget, event->source, coords[i].x, coords[i].y,
- coords[i].pressure);
- g_free (coords);
- }
- else
- {
- if (event->is_hint)
- gdk_input_window_get_pointer (event->window, event->deviceid,
- NULL, NULL, NULL, NULL, NULL, NULL);
- draw_brush (widget, event->source, event->x, event->y,
- event->pressure);
- }
- }
- else
- {
- gdk_input_window_get_pointer (event->window, event->deviceid,
- &event->x, &event->y,
- NULL, NULL, NULL, NULL);
- }
-
- update_cursor (widget, event->x, event->y);
-
- return TRUE;
-}
-
-/* We track the next two events to know when we need to draw a
- cursor */
-
-static gint
-proximity_out_event (GtkWidget *widget, GdkEventProximity *event)
-{
- cursor_proximity = FALSE;
- update_cursor (widget, cursor_x, cursor_y);
- return TRUE;
-}
-
-static gint
-leave_notify_event (GtkWidget *widget, GdkEventCrossing *event)
-{
- cursor_proximity = FALSE;
- update_cursor (widget, cursor_x, cursor_y);
- return TRUE;
-}
-
-void
-input_dialog_destroy (GtkWidget *w, gpointer data)
-{
- *((GtkWidget **)data) = NULL;
-}
-
-void
-create_input_dialog ()
-{
- static GtkWidget *inputd = NULL;
-
- if (!inputd)
- {
- inputd = gtk_input_dialog_new();
-
- gtk_signal_connect (GTK_OBJECT(inputd), "destroy",
- (GtkSignalFunc)input_dialog_destroy, &inputd);
- gtk_signal_connect_object (GTK_OBJECT(GTK_INPUT_DIALOG(inputd)->close_button),
- "clicked",
- (GtkSignalFunc)gtk_widget_hide,
- GTK_OBJECT(inputd));
- gtk_widget_hide ( GTK_INPUT_DIALOG(inputd)->save_button);
-
- gtk_signal_connect (GTK_OBJECT(inputd), "enable_device",
- (GtkSignalFunc)check_cursor, NULL);
- gtk_widget_show (inputd);
- }
- else
- {
- if (!GTK_WIDGET_MAPPED(inputd))
- gtk_widget_show(inputd);
- else
- gdk_window_raise(inputd->window);
- }
-}
-
-void
-quit ()
-{
- gtk_exit (0);
-}
-
-int
-main (int argc, char *argv[])
-{
- GtkWidget *window;
- GtkWidget *drawing_area;
- GtkWidget *vbox;
-
- GtkWidget *button;
-
- gtk_init (&argc, &argv);
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_widget_set_name (window, "Test Input");
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), vbox);
- gtk_widget_show (vbox);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (quit), NULL);
-
- /* Create the drawing area */
-
- drawing_area = gtk_drawing_area_new ();
- gtk_drawing_area_size (GTK_DRAWING_AREA (drawing_area), 200, 200);
- gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0);
-
- gtk_widget_show (drawing_area);
-
- /* Signals used to handle backing pixmap */
-
- gtk_signal_connect (GTK_OBJECT (drawing_area), "expose_event",
- (GtkSignalFunc) expose_event, NULL);
- gtk_signal_connect (GTK_OBJECT(drawing_area),"configure_event",
- (GtkSignalFunc) configure_event, NULL);
-
- /* Event signals */
-
- gtk_signal_connect (GTK_OBJECT (drawing_area), "motion_notify_event",
- (GtkSignalFunc) motion_notify_event, NULL);
- gtk_signal_connect (GTK_OBJECT (drawing_area), "button_press_event",
- (GtkSignalFunc) button_press_event, NULL);
- gtk_signal_connect (GTK_OBJECT (drawing_area), "key_press_event",
- (GtkSignalFunc) key_press_event, NULL);
-
- gtk_signal_connect (GTK_OBJECT (drawing_area), "leave_notify_event",
- (GtkSignalFunc) leave_notify_event, NULL);
- gtk_signal_connect (GTK_OBJECT (drawing_area), "proximity_out_event",
- (GtkSignalFunc) proximity_out_event, NULL);
-
- gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK
- | GDK_LEAVE_NOTIFY_MASK
- | GDK_BUTTON_PRESS_MASK
- | GDK_KEY_PRESS_MASK
- | GDK_POINTER_MOTION_MASK
- | GDK_POINTER_MOTION_HINT_MASK
- | GDK_PROXIMITY_OUT_MASK);
-
- /* The following call enables tracking and processing of extension
- events for the drawing area */
- gtk_widget_set_extension_events (drawing_area, GDK_EXTENSION_EVENTS_ALL);
-
- gtk_widget_grab_focus (drawing_area);
-
- /* .. And create some buttons */
- button = gtk_button_new_with_label ("Input Dialog");
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
-
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (create_input_dialog), NULL);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Quit");
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
-
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_widget_show (button);
-
- gtk_widget_show (window);
-
- gtk_main ();
-
- return 0;
-}
diff --git a/gtk/testselection.c b/gtk/testselection.c
deleted file mode 100644
index 6a05929131..0000000000
--- a/gtk/testselection.c
+++ /dev/null
@@ -1,468 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <string.h>
-#include "gtk.h"
-
-typedef enum {
- SEL_TYPE_NONE,
- APPLE_PICT,
- ATOM,
- ATOM_PAIR,
- BITMAP,
- C_STRING,
- COLORMAP,
- COMPOUND_TEXT,
- DRAWABLE,
- INTEGER,
- PIXEL,
- PIXMAP,
- SPAN,
- STRING,
- TEXT,
- WINDOW,
- LAST_SEL_TYPE
-} SelType;
-
-GdkAtom seltypes[LAST_SEL_TYPE];
-
-typedef struct _Target {
- gchar *target_name;
- SelType type;
- GdkAtom target;
- gint format;
- GtkSelectionFunction *handler;
-} Target;
-
-/* The following is a list of all the selection targets defined
- in the ICCCM */
-
-static Target targets[] = {
- { "ADOBE_PORTABLE_DOCUMENT_FORMAT", STRING, 0, 8, NULL },
- { "APPLE_PICT", APPLE_PICT, 0, 8, NULL },
- { "BACKGROUND", PIXEL, 0, 32, NULL },
- { "BITMAP", BITMAP, 0, 32, NULL },
- { "CHARACTER_POSITION", SPAN, 0, 32, NULL },
- { "CLASS", TEXT, 0, 8, NULL },
- { "CLIENT_WINDOW", WINDOW, 0, 32, NULL },
- { "COLORMAP", COLORMAP, 0, 32, NULL },
- { "COLUMN_NUMBER", SPAN, 0, 32, NULL },
- { "COMPOUND_TEXT", COMPOUND_TEXT, 0, 8, NULL },
- /* { "DELETE", "NULL", 0, ?, NULL }, */
- { "DRAWABLE", DRAWABLE, 0, 32, NULL },
- { "ENCAPSULATED_POSTSCRIPT", STRING, 0, 8, NULL },
- { "ENCAPSULATED_POSTSCRIPT_INTERCHANGE", STRING, 0, 8, NULL },
- { "FILE_NAME", TEXT, 0, 8, NULL },
- { "FOREGROUND", PIXEL, 0, 32, NULL },
- { "HOST_NAME", TEXT, 0, 8, NULL },
- /* { "INSERT_PROPERTY", "NULL", 0, ? NULL }, */
- /* { "INSERT_SELECTION", "NULL", 0, ? NULL }, */
- { "LENGTH", INTEGER, 0, 32, NULL },
- { "LINE_NUMBER", SPAN, 0, 32, NULL },
- { "LIST_LENGTH", INTEGER, 0, 32, NULL },
- { "MODULE", TEXT, 0, 8, NULL },
- /* { "MULTIPLE", "ATOM_PAIR", 0, 32, NULL }, */
- { "NAME", TEXT, 0, 8, NULL },
- { "ODIF", TEXT, 0, 8, NULL },
- { "OWNER_OS", TEXT, 0, 8, NULL },
- { "PIXMAP", PIXMAP, 0, 32, NULL },
- { "POSTSCRIPT", STRING, 0, 8, NULL },
- { "PROCEDURE", TEXT, 0, 8, NULL },
- { "PROCESS", INTEGER, 0, 32, NULL },
- { "STRING", STRING, 0, 8, NULL },
- { "TARGETS", ATOM, 0, 32, NULL },
- { "TASK", INTEGER, 0, 32, NULL },
- { "TEXT", TEXT, 0, 8 , NULL },
- { "TIMESTAMP", INTEGER, 0, 32, NULL },
- { "USER", TEXT, 0, 8, NULL },
-};
-
-static int num_targets = sizeof(targets)/sizeof(Target);
-
-static int have_selection = FALSE;
-
-GtkWidget *selection_text;
-GtkWidget *selection_button;
-GString *selection_string = NULL;
-
-static void
-init_atoms ()
-{
- int i;
-
- seltypes[SEL_TYPE_NONE] = GDK_NONE;
- seltypes[APPLE_PICT] = gdk_atom_intern ("APPLE_PICT",FALSE);
- seltypes[ATOM] = gdk_atom_intern ("ATOM",FALSE);
- seltypes[ATOM_PAIR] = gdk_atom_intern ("ATOM_PAIR",FALSE);
- seltypes[BITMAP] = gdk_atom_intern ("BITMAP",FALSE);
- seltypes[C_STRING] = gdk_atom_intern ("C_STRING",FALSE);
- seltypes[COLORMAP] = gdk_atom_intern ("COLORMAP",FALSE);
- seltypes[COMPOUND_TEXT] = gdk_atom_intern ("COMPOUND_TEXT",FALSE);
- seltypes[DRAWABLE] = gdk_atom_intern ("DRAWABLE",FALSE);
- seltypes[INTEGER] = gdk_atom_intern ("INTEGER",FALSE);
- seltypes[PIXEL] = gdk_atom_intern ("PIXEL",FALSE);
- seltypes[PIXMAP] = gdk_atom_intern ("PIXMAP",FALSE);
- seltypes[SPAN] = gdk_atom_intern ("SPAN",FALSE);
- seltypes[STRING] = gdk_atom_intern ("STRING",FALSE);
- seltypes[TEXT] = gdk_atom_intern ("TEXT",FALSE);
- seltypes[WINDOW] = gdk_atom_intern ("WINDOW",FALSE);
-
- for (i=0; i<num_targets; i++)
- targets[i].target = gdk_atom_intern (targets[i].target_name, FALSE);
-}
-
-void
-selection_toggled (GtkWidget *widget)
-{
- if (GTK_TOGGLE_BUTTON(widget)->active)
- {
- have_selection = gtk_selection_owner_set (widget,
- GDK_SELECTION_PRIMARY,
- GDK_CURRENT_TIME);
- if (!have_selection)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(widget), FALSE);
- }
- else
- {
- if (have_selection)
- {
- if (gdk_selection_owner_get (GDK_SELECTION_PRIMARY) == widget->window)
- gtk_selection_owner_set (NULL, GDK_SELECTION_PRIMARY,
- GDK_CURRENT_TIME);
- have_selection = FALSE;
- }
- }
-}
-
-void
-selection_handle (GtkWidget *widget,
- GtkSelectionData *selection_data, gpointer data)
-{
- guchar *buffer;
- gint len;
-
- if (!selection_string)
- {
- buffer = NULL;
- len = 0;
- }
- else
- {
- buffer = selection_string->str;
- len = selection_string->len;
- }
-
- gtk_selection_data_set (selection_data,
- selection_data->target == seltypes[COMPOUND_TEXT] ?
- seltypes[COMPOUND_TEXT] : seltypes[STRING],
- 8, buffer, len);
-}
-
-gint
-selection_clear (GtkWidget *widget, GdkEventSelection *event)
-{
- have_selection = FALSE;
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(widget), FALSE);
-
- return TRUE;
-}
-
-gchar *
-stringify_atom (guchar *data, gint *position)
-{
- gchar *str = gdk_atom_name (*(GdkAtom *)(data+*position));
- *position += sizeof(GdkAtom);
-
- return str;
-}
-
-gchar *
-stringify_text (guchar *data, gint *position)
-{
- gchar *str = g_strdup ((gchar *)(data+*position));
- *position += strlen (str) + 1;
-
- return str;
-}
-
-gchar *
-stringify_xid (guchar *data, gint *position)
-{
- gchar buffer[20];
- gchar *str;
-
- sprintf(buffer,"0x%x",*(guint32 *)(data+*position));
- str = g_strdup (buffer);
-
- *position += sizeof(guint32);
-
- return str;
-}
-
-gchar *
-stringify_integer (guchar *data, gint *position)
-{
- gchar buffer[20];
- gchar *str;
-
- sprintf(buffer,"%d",*(int *)(data+*position));
- str = g_strdup (buffer);
-
- *position += sizeof(int);
-
- return str;
-}
-
-gchar *
-stringify_span (guchar *data, gint *position)
-{
- gchar buffer[42];
- gchar *str;
-
- sprintf(buffer,"%d - %d",((int *)(data+*position))[0],
- ((int *)(data+*position))[1]);
- str = g_strdup (buffer);
-
- *position += 2*sizeof(int);
-
- return str;
-}
-
-void
-selection_received (GtkWidget *widget, GtkSelectionData *data)
-{
- int position;
- int i;
- SelType seltype;
- char *str;
-
- if (data->length < 0)
- {
- g_print("Error retrieving selection\n");
- return;
- }
-
- seltype = SEL_TYPE_NONE;
- for (i=0; i<LAST_SEL_TYPE; i++)
- {
- if (seltypes[i] == data->type)
- {
- seltype = i;
- break;
- }
- }
-
- if (seltype == SEL_TYPE_NONE)
- {
- char *name = gdk_atom_name (data->type);
- g_print("Don't know how to handle type: %s (%ld)\n",
- name?name:"<unknown>",
- data->type);
- return;
- }
-
- if (selection_string != NULL)
- g_string_free (selection_string, TRUE);
-
- selection_string = g_string_new (NULL);
-
- gtk_text_freeze (GTK_TEXT (selection_text));
- gtk_text_set_point (GTK_TEXT (selection_text), 0);
- gtk_text_forward_delete (GTK_TEXT (selection_text),
- gtk_text_get_length (GTK_TEXT (selection_text)));
-
- position = 0;
- while (position < data->length)
- {
- switch (seltype)
- {
- case ATOM:
- str = stringify_atom (data->data, &position);
- break;
- case COMPOUND_TEXT:
- case STRING:
- case TEXT:
- str = stringify_text (data->data, &position);
- break;
- case BITMAP:
- case DRAWABLE:
- case PIXMAP:
- case WINDOW:
- case COLORMAP:
- str = stringify_xid (data->data, &position);
- break;
- case INTEGER:
- case PIXEL:
- str = stringify_integer (data->data, &position);
- break;
- case SPAN:
- str = stringify_span (data->data, &position);
- break;
- default:
- {
- char *name = gdk_atom_name (data->type);
- g_print("Can't convert type %s (%ld) to string\n",
- name?name:"<unknown>",
- data->type);
- position = data->length;
- continue;
- }
- }
- gtk_text_insert (GTK_TEXT (selection_text), NULL,
- &selection_text->style->black,
- NULL, str, -1);
- gtk_text_insert (GTK_TEXT (selection_text), NULL,
- &selection_text->style->black,
- NULL, "\n", -1);
- g_string_append (selection_string, str);
- g_free (str);
- }
- gtk_text_thaw (GTK_TEXT (selection_text));
-}
-
-void
-paste (GtkWidget *widget, GtkWidget *entry)
-{
- char *name;
- GdkAtom atom;
-
- name = gtk_entry_get_text (GTK_ENTRY(entry));
- atom = gdk_atom_intern (name, FALSE);
-
- if (atom == GDK_NONE)
- {
- g_print("Could not create atom: \"%s\"\n",name);
- return;
- }
-
- gtk_selection_convert (selection_button, GDK_SELECTION_PRIMARY, atom,
- GDK_CURRENT_TIME);
-}
-
-void
-quit ()
-{
- gtk_exit (0);
-}
-
-int
-main (int argc, char *argv[])
-{
- GtkWidget *dialog;
- GtkWidget *button;
- GtkWidget *table;
- GtkWidget *label;
- GtkWidget *entry;
- GtkWidget *hscrollbar;
- GtkWidget *vscrollbar;
- GtkWidget *hbox;
-
- gtk_init (&argc, &argv);
-
- init_atoms();
-
- dialog = gtk_dialog_new ();
- gtk_widget_set_name (dialog, "Test Input");
- gtk_container_border_width (GTK_CONTAINER(dialog), 0);
-
- gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
- GTK_SIGNAL_FUNC (quit), NULL);
-
- table = gtk_table_new (4, 2, FALSE);
- gtk_container_border_width (GTK_CONTAINER(table), 10);
-
- gtk_table_set_row_spacing (GTK_TABLE (table), 0, 5);
- gtk_table_set_row_spacing (GTK_TABLE (table), 1, 2);
- gtk_table_set_row_spacing (GTK_TABLE (table), 2, 2);
- gtk_table_set_col_spacing (GTK_TABLE (table), 0, 2);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG(dialog)->vbox),
- table, TRUE, TRUE, 0);
- gtk_widget_show (table);
-
- selection_button = gtk_toggle_button_new_with_label ("Claim Selection");
- gtk_table_attach (GTK_TABLE (table), selection_button, 0, 2, 0, 1,
- GTK_EXPAND | GTK_FILL, 0, 0, 0);
- gtk_widget_show (selection_button);
-
- gtk_signal_connect (GTK_OBJECT(selection_button), "toggled",
- GTK_SIGNAL_FUNC (selection_toggled), NULL);
- gtk_signal_connect (GTK_OBJECT(selection_button), "selection_clear_event",
- GTK_SIGNAL_FUNC (selection_clear), NULL);
- gtk_signal_connect (GTK_OBJECT(selection_button), "selection_received",
- GTK_SIGNAL_FUNC (selection_received), NULL);
-
- gtk_selection_add_handler (selection_button, GDK_SELECTION_PRIMARY,
- seltypes[STRING], selection_handle, NULL);
-
- gtk_selection_add_handler (selection_button, GDK_SELECTION_PRIMARY,
- seltypes[TEXT], selection_handle, NULL);
-
- gtk_selection_add_handler (selection_button, GDK_SELECTION_PRIMARY,
- seltypes[COMPOUND_TEXT],
- selection_handle, NULL);
-
- selection_text = gtk_text_new (NULL, NULL);
- gtk_table_attach_defaults (GTK_TABLE (table), selection_text, 0, 1, 1, 2);
- gtk_widget_show (selection_text);
-
- hscrollbar = gtk_hscrollbar_new (GTK_TEXT (selection_text)->hadj);
- gtk_table_attach (GTK_TABLE (table), hscrollbar, 0, 1, 2, 3,
- GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
- gtk_widget_show (hscrollbar);
-
- vscrollbar = gtk_vscrollbar_new (GTK_TEXT (selection_text)->vadj);
- gtk_table_attach (GTK_TABLE (table), vscrollbar, 1, 2, 1, 2,
- GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (vscrollbar);
-
- hbox = gtk_hbox_new (FALSE, 2);
- gtk_table_attach (GTK_TABLE (table), hbox, 0, 2, 3, 4,
- GTK_EXPAND | GTK_FILL, 0, 0, 0);
- gtk_widget_show (hbox);
-
- label = gtk_label_new ("Target:");
- gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0);
- gtk_widget_show (label);
-
- entry = gtk_entry_new ();
- gtk_box_pack_start (GTK_BOX(hbox), entry, TRUE, TRUE, 0);
- gtk_widget_show (entry);
-
- /* .. And create some buttons */
- button = gtk_button_new_with_label ("Paste");
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG(dialog)->action_area),
- button, TRUE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (paste), entry);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Quit");
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG(dialog)->action_area),
- button, TRUE, TRUE, 0);
-
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (dialog));
- gtk_widget_show (button);
-
- gtk_widget_show (dialog);
-
- gtk_main ();
-
- return 0;
-}
diff --git a/gtk/tree_minus.xbm b/gtk/tree_minus.xbm
deleted file mode 100644
index 0290a34b6e..0000000000
--- a/gtk/tree_minus.xbm
+++ /dev/null
@@ -1,5 +0,0 @@
-#define tree_minus_width 9
-#define tree_minus_height 9
-static char tree_minus_bits[] = {
- 0xff,0xff,0x01,0xff,0x01,0xff,0x01,0xff,0x7d,0xff,0x01,0xff,0x01,0xff,0x01,
- 0xff,0xff,0xff};
diff --git a/gtk/tree_minus.xpm b/gtk/tree_minus.xpm
deleted file mode 100644
index cce0679102..0000000000
--- a/gtk/tree_minus.xpm
+++ /dev/null
@@ -1,18 +0,0 @@
-/* XPM */
-static char *tree_minus[] = {
-/* width height num_colors chars_per_pixel */
-" 9 9 2 1",
-/* colors */
-". c #000000",
-"# c #f8fcf8",
-/* pixels */
-".........",
-".#######.",
-".#######.",
-".#######.",
-".#.....#.",
-".#######.",
-".#######.",
-".#######.",
-"........."
-};
diff --git a/gtk/tree_plus.xbm b/gtk/tree_plus.xbm
deleted file mode 100644
index e512116d82..0000000000
--- a/gtk/tree_plus.xbm
+++ /dev/null
@@ -1,5 +0,0 @@
-#define tree_plus_width 9
-#define tree_plus_height 9
-static char tree_plus_bits[] = {
- 0xff,0xff,0x01,0xff,0x11,0xff,0x11,0xff,0x7d,0xff,0x11,0xff,0x11,0xff,0x01,
- 0xff,0xff,0xff};
diff --git a/gtk/tree_plus.xpm b/gtk/tree_plus.xpm
deleted file mode 100644
index d0ba80ca25..0000000000
--- a/gtk/tree_plus.xpm
+++ /dev/null
@@ -1,18 +0,0 @@
-/* XPM */
-static char *tree_plus[] = {
-/* width height num_colors chars_per_pixel */
-" 9 9 2 1",
-/* colors */
-". c #000000",
-"# c #f8fcf8",
-/* pixels */
-".........",
-".#######.",
-".###.###.",
-".###.###.",
-".#.....#.",
-".###.###.",
-".###.###.",
-".#######.",
-"........."
-};
diff --git a/install-sh b/install-sh
deleted file mode 100755
index 89fc9b098b..0000000000
--- a/install-sh
+++ /dev/null
@@ -1,238 +0,0 @@
-#! /bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.
-#
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-tranformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd="$cpprog"
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd="$stripprog"
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "install: no input file specified"
- exit 1
-else
- true
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d $dst ]; then
- instcmd=:
- else
- instcmd=mkdir
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f $src -o -d $src ]
- then
- true
- else
- echo "install: $src does not exist"
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "install: no destination specified"
- exit 1
- else
- true
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d $dst ]
- then
- dst="$dst"/`basename $src`
- else
- true
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
-'
-IFS="${IFS-${defaultIFS}}"
-
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp="${pathcomp}${1}"
- shift
-
- if [ ! -d "${pathcomp}" ] ;
- then
- $mkdirprog "${pathcomp}"
- else
- true
- fi
-
- pathcomp="${pathcomp}/"
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd $dst &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename $dst`
- else
- dstfile=`basename $dst $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename $dst`
- else
- true
- fi
-
-# Make a temp file name in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd $src $dsttmp &&
-
- trap "rm -f ${dsttmp}" 0 &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
-
-# Now rename the file to the real destination.
-
- $doit $rmcmd -f $dstdir/$dstfile &&
- $doit $mvcmd $dsttmp $dstdir/$dstfile
-
-fi &&
-
-
-exit 0
diff --git a/ltconfig b/ltconfig
deleted file mode 100755
index 6140ca7c6c..0000000000
--- a/ltconfig
+++ /dev/null
@@ -1,1418 +0,0 @@
-#! /bin/sh
-
-# ltconfig - Create a system-specific libtool.
-# Generated automatically from ltconfig.in by configure.
-# Copyright (C) 1996, 1997, Free Software Foundation, Inc.
-# Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
-#
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# A lot of this script is taken from autoconf-2.10.
-
-# The name of this program.
-progname=`echo "$0" | sed 's%^.*/%%'`
-
-# Constants:
-PROGRAM=ltconfig
-PACKAGE=libtool
-VERSION=1.0f
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.c $LIBS 1>&5'
-rm="rm -f"
-
-help="Try \`$progname --help' for more information."
-
-# Sed substitution that helps us do robust quoting. It backslashifies
-# metacharacters that are still active within double-quoted strings.
-sed_quote_subst='s/\([\\"$\\\\]\)/\\\1/g'
-
-# Same as above, but don't quote variable references.
-double_quote_subst='s/\([\\"\\\\]\)/\\\1/g'
-
-# Global variables:
-can_build_shared=yes
-enable_shared=yes
-# All known linkers require a `.a' archive for static linking.
-enable_static=yes
-ltmain=
-silent=
-srcdir=
-ac_config_guess=
-ac_config_sub=
-host=
-nonopt=
-verify_host=yes
-with_gcc=no
-with_gnu_ld=no
-
-old_AR="$AR"
-old_CC="$CC"
-old_CFLAGS="$CFLAGS"
-old_CPPFLAGS="$CPPFLAGS"
-old_LD="$LD"
-old_LN_S="$LN_S"
-old_NM="$NM"
-old_RANLIB="$RANLIB"
-
-# Parse the command line options.
-args=
-prev=
-for option
-do
- case "$option" in
- -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) optarg= ;;
- esac
-
- # If the previous option needs an argument, assign it.
- if test -n "$prev"; then
- eval "$prev=\$option"
- prev=
- continue
- fi
-
- case "$option" in
- --help) cat <<EOM
-Usage: $progname [OPTION]... LTMAIN [HOST]
-
-Generate a system-specific libtool script.
-
- --disable-shared do not build shared libraries
- --disable-static do not build static libraries
- --help display this help and exit
- --no-verify do not verify that HOST is a valid host type
- --quiet same as \`--silent'
- --silent don't print informational messages
- --srcdir=DIR find \`config.guess' in DIR
- --version output version information and exit
- --with-gcc assume that the GNU C compiler will be used
- --with-gnu-ld assume that the C compiler uses the GNU linker
-
-LTMAIN is the \`ltmain.sh' shell script fragment that provides basic libtool
-functionality.
-
-HOST is the canonical host system name [default=guessed].
-EOM
- exit 0
- ;;
-
- --disable-shared) enable_shared=no ;;
-
- --disable-static) enable_static=no ;;
-
- --quiet | --silent) silent=yes ;;
-
- --srcdir) prev=srcdir ;;
- --srcdir=*) srcdir="$optarg" ;;
-
- --no-verify) verify_host=no ;;
-
- --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION"; exit 0 ;;
-
- --with-gcc) with_gcc=yes ;;
- --with-gnu-ld) with_gnu_ld=yes ;;
-
- -*)
- echo "$progname: unrecognized option \`$option'" 1>&2
- echo "$help" 1>&2
- exit 1
- ;;
-
- *)
- if test -z "$ltmain"; then
- ltmain="$option"
- elif test -z "$host"; then
-# FIXME This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1
-# if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then
-# echo "$progname: warning \`$option' is not a valid host type" 1>&2
-# fi
- host="$option"
- else
- echo "$progname: too many arguments" 1>&2
- echo "$help" 1>&2
- exit 1
- fi ;;
- esac
-done
-
-if test -z "$ltmain"; then
- echo "$progname: you must specify a LTMAIN file" 1>&2
- echo "$help" 1>&2
- exit 1
-fi
-
-if test -f "$ltmain"; then :
-else
- echo "$progname: warning: \`$ltmain' does not exist" 1>&2
-fi
-
-# Quote any args containing shell metacharacters.
-ltconfig_args=
-for arg
-do
- case "$arg" in
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ltconfig_args="$ltconfig_args '$arg'" ;;
- *) ltconfig_args="$ltconfig_args $arg" ;;
- esac
-done
-
-# A relevant subset of AC_INIT.
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 5 compiler messages saved in config.log
-# 6 checking for... messages and results
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
-fi
-exec 5>>./config.log
-
-# NLS nuisances.
-# Only set LANG and LC_ALL to C if already set.
-# These must not be set unconditionally because not all systems understand
-# e.g. LANG=C (notably SCO).
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
- fi
-else
- ac_n= ac_c='\c' ac_t=
-fi
-
-if test -z "$srcdir"; then
- # Assume the source directory is the same one as the path to ltmain.sh.
- srcdir=`echo "$ltmain" | sed 's%/[^/]*$%%'`
- test "$srcdir" = "$ltmain" && srcdir=.
-fi
-
-trap "$rm conftest*; exit 1" 1 2 15
-if test "$verify_host" = yes; then
- # Check for config.guess and config.sub.
- ac_aux_dir=
- for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/config.guess; then
- ac_aux_dir=$ac_dir
- break
- fi
- done
- if test -z "$ac_aux_dir"; then
- echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2
- echo "$help" 1>&2
- exit 1
- fi
- ac_config_guess=$ac_aux_dir/config.guess
- ac_config_sub=$ac_aux_dir/config.sub
-
- # Make sure we can run config.sub.
- if $ac_config_sub sun4 >/dev/null 2>&1; then :
- else
- echo "$progname: cannot run $ac_config_sub" 1>&2
- echo "$help" 1>&2
- exit 1
- fi
-
- echo $ac_n "checking host system type""... $ac_c" 1>&6
-
- host_alias=$host
- case "$host_alias" in
- "")
- if host_alias=`$ac_config_guess`; then :
- else
- echo "$progname: cannot guess host type; you must specify one" 1>&2
- echo "$help" 1>&2
- exit 1
- fi ;;
- esac
- host=`$ac_config_sub $host_alias`
- echo "$ac_t$host" 1>&6
-
- # Make sure the host verified.
- test -z "$host" && exit 1
-
-elif test -z "$host"; then
- echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2
- echo "$help" 1>&2
- exit 1
-else
- host_alias=$host
-fi
-
-# Transform *-*-linux* to *-*-linux-gnu*, to support old configure scripts.
-case "$host" in
-*-*-linux-gnu*) ;;
-*-*-linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
-esac
-
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-
-case "$host_os" in
-aix*)
- # AIX sometimes has problems with the GCC collect2 program. For some
- # reason, if we set the COLLECT_NAMES environment variable, the problems
- # vanish in a puff of smoke.
- if test "${COLLECT_NAMES+set}" != set; then
- COLLECT_NAMES=
- export COLLECT_NAMES
- fi
- ;;
-esac
-
-# Determine commands to create old-style static archives.
-old_archive_cmds='$AR cru $oldlib$oldobjs'
-old_postinstall_cmds='chmod 644 $oldlib'
-
-# Set a sane default for `AR'.
-test -z "$AR" && AR=ar
-
-# If RANLIB is not set, then run the test.
-if test "${RANLIB+set}" != "set"; then
- result=no
-
- echo $ac_n "checking for ranlib... $ac_c" 1>&6
- IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
- for dir in $PATH; do
- test -z "$dir" && dir=.
- if test -f $dir/ranlib; then
- RANLIB="ranlib"
- result="ranlib"
- break
- fi
- done
- IFS="$save_ifs"
-
- echo "$ac_t$result" 1>&6
-fi
-
-if test -n "$RANLIB"; then
- old_archive_cmds="$old_archive_cmds;\$RANLIB \$oldlib"
- old_postinstall_cmds="$old_postinstall_cmds;\$RANLIB \$oldlib"
-fi
-
-# Check to see if we are using GCC.
-if test "$with_gcc" != yes || test -z "$CC"; then
- # If CC is not set, then try to find GCC or a usable CC.
- if test -z "$CC"; then
- echo $ac_n "checking for gcc... $ac_c" 1>&6
- IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
- for dir in $PATH; do
- IFS="$save_ifs"
- test -z "$dir" && dir=.
- if test -f $dir/gcc; then
- CC="gcc"
- break
- fi
- done
- IFS="$save_ifs"
-
- if test -n "$CC"; then
- echo "$ac_t$CC" 1>&6
- else
- echo "$ac_t"no 1>&6
- fi
- fi
-
- # Not "gcc", so try "cc", rejecting "/usr/ucb/cc".
- if test -z "$CC"; then
- echo $ac_n "checking for cc... $ac_c" 1>&6
- IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
- cc_rejected=no
- for dir in $PATH; do
- test -z "$dir" && dir=.
- if test -f $dir/cc; then
- if test "$dir/cc" = "/usr/ucb/cc"; then
- cc_rejected=yes
- continue
- fi
- CC="cc"
- break
- fi
- done
- IFS="$save_ifs"
- if test $cc_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $CC
- shift
- if test $# -gt 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same name, so the bogon will be chosen
- # first if we set CC to just the name; use the full file name.
- shift
- set dummy "$dir/cc" "$@"
- shift
- CC="$@"
- fi
- fi
-
- if test -n "$CC"; then
- echo "$ac_t$CC" 1>&6
- else
- echo "$ac_t"no 1>&6
- fi
-
- if test -z "$CC"; then
- echo "$progname: error: no acceptable cc found in \$PATH" 1>&2
- exit 1
- fi
- fi
-
- # Now see if the compiler is really GCC.
- with_gcc=no
- echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6
- echo "$progname:394: checking whether we are using GNU C" >&5
-
- $rm conftest.c
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
- if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:402: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- with_gcc=yes
- fi
- $rm conftest.c
- echo "$ac_t$with_gcc" 1>&6
-fi
-
-# Allow CC to be a program name with arguments.
-set dummy $CC
-compiler="$2"
-
-echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6
-pic_flag=
-profile_flag_pattern=
-special_shlib_compile_flags=
-wl=
-link_static_flag=
-no_builtin_flag=
-
-if test "$with_gcc" = yes; then
- profile_flag_pattern='-pg?'
- wl='-Wl,'
- link_static_flag='-static'
- no_builtin_flag=' -fno-builtin'
-
- case "$host_os" in
- aix3* | aix4* | irix5* | irix6* | osf3* | osf4*)
- # PIC is the default for these OSes.
- ;;
- os2*)
- # We can build DLLs from non-PIC.
- ;;
- *)
- pic_flag='-fPIC'
- ;;
- esac
-else
- # PORTME Check for PIC flags for the system compiler.
- case "$host_os" in
- aix3* | aix4*)
- # All AIX code is PIC.
- link_static_flag='-bnso -bI:/lib/syscalls.exp'
- ;;
-
- hpux9* | hpux10*)
- # Is there a better link_static_flag that works with the bundled CC?
- wl='-Wl,'
- link_static_flag='${wl}-a ${wl}archive'
- pic_flag='+Z'
- ;;
-
- irix5* | irix6*)
- wl='-Wl,'
- link_static_flag='-non_shared'
- # PIC (with -KPIC) is the default.
- ;;
-
- os2*)
- # We can build DLLs from non-PIC.
- ;;
-
- osf3* | osf4*)
- # All OSF/1 code is PIC.
- wl='-Wl,'
- link_static_flag='-non_shared'
- ;;
-
- sco3.2v5*)
- pic_flag='-Kpic'
- link_static_flag='-dn'
- special_shlib_compile_flags='-belf'
- ;;
-
- solaris2*)
- pic_flag='-KPIC'
- link_static_flag='-Bstatic'
- wl='-Wl,'
- ;;
-
- sunos4*)
- pic_flag='-PIC'
- link_static_flag='-Bstatic'
- wl='-Qoption ld '
- ;;
-
- uts4*)
- pic_flag='-pic'
- link_static_flag='-Bstatic'
- ;;
-
- *)
- can_build_shared=no
- ;;
- esac
-fi
-
-if test -n "$pic_flag"; then
- echo "$ac_t$pic_flag" 1>&6
-
- # Check to make sure the pic_flag actually works.
- echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6
- $rm conftest*
- echo > conftest.c
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $pic_flag -DPIC"
- echo "$progname:507: checking if $compiler PIC flag $pic_flag works" >&5
- if { (eval echo $progname:508: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then
- # Append any errors to the config.log.
- cat conftest.err 1>&5
-
- # On HP-UX, the stripped-down bundled CC doesn't accept +Z, but also
- # reports no error. So, we need to grep stderr for (Bundled).
- if grep '(Bundled)' conftest.err >/dev/null; then
- echo "$ac_t"no 1>&6
- can_build_shared=no
- pic_flag=
- else
- echo "$ac_t"yes 1>&6
- pic_flag=" $pic_flag"
- fi
- else
- # Append any errors to the config.log.
- cat conftest.err 1>&5
- can_build_shared=no
- pic_flag=
- echo "$ac_t"no 1>&6
- fi
- CFLAGS="$save_CFLAGS"
- $rm conftest*
-else
- echo "$ac_t"none 1>&6
-fi
-
-# Check for any special shared library compilation flags.
-if test -n "$special_shlib_compile_flags"; then
- echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2
- if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then :
- else
- echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2
- can_build_shared=no
- fi
-fi
-
-echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6
-$rm conftest*
-echo 'main(){return(0);}' > conftest.c
-save_LDFLAGS="$LDFLAGS"
-LDFLAGS="$LDFLAGS $link_static_flag"
-echo "$progname:550: checking if $compiler static flag $link_static_flag works" >&5
-if { (eval echo $progname:551: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- echo "$ac_t$link_static_flag" 1>&6
-else
- echo "$ac_t"none 1>&6
- link_static_flag=
-fi
-LDFLAGS="$save_LDFLAGS"
-$rm conftest*
-
-if test -z "$LN_S"; then
- # Check to see if we can use ln -s, or we need hard links.
- echo $ac_n "checking whether ln -s works... $ac_c" 1>&6
- $rm conftestdata
- if ln -s X conftestdata 2>/dev/null; then
- $rm conftestdata
- LN_S="ln -s"
- else
- LN_S=ln
- fi
- if test "$LN_S" = "ln -s"; then
- echo "$ac_t"yes 1>&6
- else
- echo "$ac_t"no 1>&6
- fi
-fi
-
-# Make sure LD is an absolute path.
-if test -z "$LD"; then
- ac_prog=ld
- if test "$with_gcc" = yes; then
- # Check if gcc -print-prog-name=ld gives a path.
- echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6
- echo "$progname:583: checking for ld used by GCC" >&5
- ac_prog=`($CC -print-prog-name=ld) 2>&5`
- case "$ac_prog" in
- # Accept absolute paths.
- /*)
- test -z "$LD" && LD="$ac_prog"
- ;;
- "")
- # If it fails, then pretend we aren't using GCC.
- ac_prog=ld
- ;;
- *)
- # If it is relative, then search for the first ld in PATH.
- with_gnu_ld=unknown
- ;;
- esac
- elif test "$with_gnu_ld" = yes; then
- echo $ac_n "checking for GNU ld... $ac_c" 1>&6
- echo "$progname:601: checking for GNU ld" >&5
- else
- echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
- echo "$progname:604: checking for non-GNU ld" >&5
- fi
-
- if test -z "$LD"; then
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f "$ac_dir/$ac_prog"; then
- LD="$ac_dir/$ac_prog"
- # Check to see if the program is GNU ld. I'd rather use --version,
- # but apparently some GNU ld's only accept -v.
- # Break only if it was the GNU/non-GNU ld that we prefer.
- if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
- test "$with_gnu_ld" != no && break
- else
- test "$with_gnu_ld" != yes && break
- fi
- fi
- done
- IFS="$ac_save_ifs"
- fi
-
- if test -n "$LD"; then
- echo "$ac_t$LD" 1>&6
- else
- echo "$ac_t"no 1>&6
- fi
-
- if test -z "$LD"; then
- echo "$progname: error: no acceptable ld found in \$PATH" 1>&2
- exit 1
- fi
-fi
-
-# Check to see if it really is or isn't GNU ld.
-echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6
-# I'd rather use --version here, but apparently some GNU ld's only accept -v.
-if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
- with_gnu_ld=yes
-else
- with_gnu_ld=no
-fi
-echo "$ac_t$with_gnu_ld" 1>&6
-
-# See if the linker supports building shared libraries.
-echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6
-
-allow_undefined_flag=
-archive_cmds=
-old_archive_from_new_cmds=
-export_dynamic_flag_spec=
-hardcode_libdir_flag_spec=
-hardcode_libdir_separator=
-hardcode_direct=no
-hardcode_minus_L=no
-hardcode_runpath_var=no
-hardcode_shlibpath_var=unsupported
-runpath_var=
-
-ld_shlibs=yes
-if test "$with_gnu_ld" = yes; then
- # See if GNU ld supports shared libraries.
-
- case "$host_os" in
- sunos4*)
- ld_shlibs=yes
- hardcode_direct=yes
- hardcode_shlibpath_var=no
- ;;
-
- *)
- if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
- runpath_var=LD_RUN_PATH
- hardcode_runpath_var=yes
- ld_shlibs=yes
- else
- ld_shlibs=no
- fi
- ;;
- esac
-
- if test "$ld_shlibs" = yes; then
- archive_cmds='$CC -shared ${wl}-soname $wl$soname -o $lib$libobjs$deplibs'
- hardcode_libdir_flag_spec='${wl}-rpath $wl$libdir'
- export_dynamic_flag_spec='${wl}-export-dynamic'
- fi
-else
- # PORTME fill in a description of your system's linker (not GNU ld)
- case "$host_os" in
- aix3*)
- allow_undefined_flag=unsupported
- archive_cmds='$NM$libobjs | $global_symbol_pipe | sed '"'s/.* //'"' > $lib.exp;$LD -o $objdir/$soname$libobjs -bE:$lib.exp -T512 -H512 -bM:SRE$deplibs;$AR cru $lib $objdir/$soname'
- # Note: this linker hardcodes the directories in LIBPATH if there
- # are no directories specified by -L.
- hardcode_minus_L=yes
- if test "$with_gcc" = yes && test -z "$link_static_flag"; then
- # Neither direct hardcoding nor static linking is supported with a
- # broken collect2.
- hardcode_direct=unsupported
- fi
- ;;
-
- aix4*)
- allow_undefined_flag=unsupported
- archive_cmds='$NM$libobjs | $global_symbol_pipe | sed '"'s/.* //'"' > $lib.exp;$CC -o $objdir/$soname$libobjs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry$deplibs;$AR cru $lib $objdir/$soname'
- hardcode_direct=yes
- hardcode_minus_L=yes
- ;;
-
- # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
- # support. Future versions do this automatically, but an explicit c++rt0.o
- # doesn't break anything, and helps significantly (at the cost of a little
- # extra space).
- freebsd2.2*)
- archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs /usr/lib/c++rt0.o'
- hardcode_direct=yes
- hardcode_minus_L=yes
- hardcode_shlibpath_var=no
- ;;
-
- # Unfortunately, older versions of FreeBSD 2 don't have this feature.
- freebsd2*)
- archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs'
- hardcode_direct=yes
- hardcode_minus_L=yes
- hardcode_shlibpath_var=no
- ;;
-
- # FreeBSD 3, at last, uses gcc -shared to do shared libraries.
- freebsd3*)
- archive_cmds='$CC -shared -o $lib$libobjs$deplibs'
- hardcode_libdir_flag_spec='-R$libdir'
- hardcode_direct=yes
- hardcode_minus_L=yes
- hardcode_shlibpath_var=no
- ;;
-
- hpux9*)
- archive_cmds='$rm $objdir/$soname;$LD -b +s +b $install_libdir -o $objdir/$soname$libobjs$deplibs;mv $objdir/$soname $lib'
- hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
- hardcode_direct=yes
- hardcode_minus_L=yes
- ;;
-
- hpux10*)
- archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib$libobjs$deplibs'
- hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
- hardcode_direct=yes
- hardcode_minus_L=yes
- ;;
-
- irix5* | irix6*)
- archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs$deplibs'
- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
- ;;
-
- netbsd*)
- # Tested with NetBSD 1.2 ld
- archive_cmds='$LD -Bshareable -o $lib$libobjs'
- hardcode_libdir_flag_spec='-R$libdir'
- hardcode_direct=yes
- hardcode_shlibpath_var=no
- ;;
-
- openbsd*)
- archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs'
- hardcode_libdir_flag_spec='-R$libdir'
- hardcode_direct=yes
- hardcode_shlibpath_var=no
- ;;
-
- os2*)
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_minus_L=yes
- allow_undefined_flag=unsupported
- archive_cmds='echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def;echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def;echo DATA >> $objdir/$libname.def;echo " SINGLE NONSHARED" >> $objdir/$libname.def;echo EXPORTS >> $objdir/$libname.def;emxexp$libobjs >> $objdir/$libname.def;$CC -Zdll -Zcrtdll -o $lib$libobjs $objdir/$libname.def'
- old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def'
- ;;
-
- osf3* | osf4*)
- allow_undefined_flag=' -expect_unresolved \*'
- archive_cmds='$LD -shared${allow_undefined_flag} -o $lib -soname $soname -set_version $verstring$libobjs$deplibs'
- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
- hardcode_libdir_separator=:
- ;;
-
- sco3.2v5*)
- archive_cmds='$LD -G -o $lib$libobjs$deplibs'
- hardcode_direct=yes
- ;;
-
- solaris2*)
- case "$host_cpu" in
- i386) archive_cmds='$LD -G -h $soname -o $lib$libobjs$deplibs' ;;
- *) archive_cmds='$LD -G -z text -h $soname -o $lib$libobjs$deplibs' ;;
- esac
- hardcode_libdir_flag_spec='-R$libdir'
- hardcode_shlibpath_var=no
- ;;
-
- sunos4*)
- archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs'
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_direct=yes
- hardcode_minus_L=yes
- hardcode_shlibpath_var=no
- ;;
-
- uts4*)
- archive_cmds='$LD -G -h $soname -o $lib$libobjs$deplibs'
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_direct=no
- hardcode_minus_L=no
- hardcode_shlibpath_var=no
- ;;
-
- *)
- ld_shlibs=no
- can_build_shared=no
- ;;
- esac
-fi
-echo "$ac_t$ld_shlibs" 1>&6
-
-if test -z "$NM"; then
- echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6
- case "$NM" in
- /*) ;; # Let the user override the test with a path.
- *)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in /usr/ucb $PATH /bin; do
- test -z "$ac_dir" && dir=.
- if test -f $ac_dir/nm; then
- # Check to see if the nm accepts a BSD-compat flag.
- if ($ac_dir/nm -B /dev/null 2>&1; exit 0) | grep /dev/null >/dev/null; then
- NM="$ac_dir/nm -B"
- elif ($ac_dir/nm -p /dev/null 2>&1; exit 0) | grep /dev/null >/dev/null; then
- NM="$ac_dir/nm -p"
- else
- NM="$ac_dir/nm"
- fi
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$NM" && NM=nm
- ;;
- esac
- echo "$ac_t$NM" 1>&6
-fi
-
-# Check for command to grab the raw symbol name followed by C symbol from nm.
-echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6
-
-# These are sane defaults that work on at least a few old systems.
-# [They come from Ultrix. What could be older than Ultrix?!! ;)]
-
-# Character class describing NM global symbol codes.
-symcode='[BCDEGRSTU]'
-
-# Regexp to match symbols that can be accessed directly from C.
-sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
-
-# Transform the above into a raw symbol and a C symbol.
-symxfrm='\1 \1'
-
-# Define system-specific variables.
-case "$host_os" in
-aix*)
- symcode='[BCDTU]'
- ;;
-solaris2*)
- symcode='[BDTU]'
- ;;
-esac
-
-# If we're using GNU nm, then use its standard symbol codes.
-if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
- symcode='[ABCDGISTUW]'
-fi
-
-# Write the raw and C identifiers.
-global_symbol_pipe="sed -n -e 's/^.* $symcode $sympat$/$symxfrm/p'"
-
-# Check to see that the pipe works correctly.
-pipe_works=no
-$rm conftest*
-cat > conftest.c <<EOF
-#ifdef __cplusplus
-extern "C" {
-#endif
-char nm_test_var;
-void nm_test_func(){}
-#ifdef __cplusplus
-}
-#endif
-main(){nm_test_var='a';nm_test_func();return(0);}
-EOF
-
-echo "$progname:900: checking if global_symbol_pipe works" >&5
-if { (eval echo $progname:901: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.o; then
- # Now try to grab the symbols.
- nlist=conftest.nm
- if { echo "$progname:904: eval \"$NM conftest.o | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.o | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then
-
- # Try sorting and uniquifying the output.
- if sort "$nlist" | uniq > "$nlist"T; then
- mv -f "$nlist"T "$nlist"
- wcout=`wc "$nlist" 2>/dev/null`
- count=`echo "$wcout" | sed 's/^[ ]*\([0-9][0-9]*\).*$/\1/'`
- (test "$count" -ge 0) 2>/dev/null || count=-1
- else
- rm -f "$nlist"T
- count=-1
- fi
-
- # Make sure that we snagged all the symbols we need.
- if egrep ' nm_test_var$' "$nlist" >/dev/null; then
- if egrep ' nm_test_func$' "$nlist" >/dev/null; then
- cat <<EOF > conftest.c
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-EOF
- # Now generate the symbol file.
- sed 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> conftest.c
-
- cat <<EOF >> conftest.c
-#if defined (__STDC__) && __STDC__
-# define __ptr_t void *
-#else
-# define __ptr_t char *
-#endif
-
-/* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
-int dld_preloaded_symbol_count = $count;
-
-/* The mapping between symbol names and symbols. */
-struct {
- char *name;
- __ptr_t address;
-}
-dld_preloaded_symbols[] =
-{
-EOF
- sed 's/^\(.*\) \(.*\)$/ {"\1", \&\2},/' < "$nlist" >> conftest.c
- cat <<\EOF >> conftest.c
- {0},
-};
-
-#ifdef __cplusplus
-}
-#endif
-EOF
- # Now try linking the two files.
- mv conftest.o conftestm.o
- save_LIBS="$LIBS"
- save_CFLAGS="$CFLAGS"
- LIBS='conftestm.o'
- CFLAGS="$CFLAGS$no_builtin_flag"
- if { (eval echo $progname:962: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- pipe_works=yes
- else
- echo "$progname: failed program was:" >&5
- cat conftest.c >&5
- fi
- LIBS="$save_LIBS"
- else
- echo "cannot find nm_test_func in $nlist" >&5
- fi
- else
- echo "cannot find nm_test_var in $nlist" >&5
- fi
- else
- echo "cannot run $global_symbol_pipe" >&5
- fi
-else
- echo "$progname: failed program was:" >&5
- cat conftest.c >&5
-fi
-$rm conftest*
-
-# Don't use the global_symbol_pipe unless it works.
-echo "$ac_t$pipe_works" 1>&6
-test "$pipe_works" = yes || global_symbol_pipe=
-
-# Check hardcoding attributes.
-echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6
-hardcode_action=
-if test -n "$hardcode_libdir_flag_spec" || \
- test "$hardcode_runpath_var" = yes; then
-
- # We can hardcode non-existant directories.
- if test "$hardcode_direct" != no && \
- test "$hardcode_minus_L" != no && \
- test "$hardcode_shlibpath_var" != no; then
-
- # Linking always hardcodes the temporary library directory.
- hardcode_action=relink
- else
- # We can link without hardcoding, and we can hardcode nonexisting dirs.
- hardcode_action=immediate
- fi
-elif test "$hardcode_direct" != yes && \
- test "$hardcode_minus_L" != yes && \
- test "$hardcode_shlibpath_var" != yes; then
- # We can't hardcode anything.
- hardcode_action=unsupported
-else
- # We can only hardcode existing directories.
- hardcode_action=relink
-fi
-echo "$ac_t$hardcode_action" 1>&6
-test "$hardcode_action" = unsupported && can_build_shared=no
-
-
-reload_flag=
-reload_cmds='$LD$reload_flag -o $output$reload_objs'
-echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6
-# PORTME Some linker may need a different reload flag.
-reload_flag='-r'
-echo "$ac_t$reload_flag"
-test -n "$reload_flag" && reload_flag=" $reload_flag"
-
-# PORTME Fill in your ld.so characteristics
-library_names_spec=
-libname_spec='lib$name'
-soname_spec=
-postinstall_cmds=
-finish_cmds=
-shlibpath_var=
-version_type=none
-dynamic_linker="$host_os ld.so"
-
-echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6
-case "$host_os" in
-aix3* | aix4*)
- version_type=linux
- library_names_spec='$libname.so.$versuffix $libname.a'
- shlibpath_var=LIBPATH
-
- # AIX has no versioning support, so we append a major version to the name.
- soname_spec='$libname.so.$major'
- ;;
-
-freebsd2* | freebsd3*)
- version_type=sunos
- library_names_spec='$libname.so.$versuffix $libname.so'
- finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-gnu*)
- version_type=sunos
- library_names_spec='$libname.so.$versuffix'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-hpux9* | hpux10*)
- # Give a soname corresponding to the major version so that dld.sl refuses to
- # link against other versions.
- dynamic_linker="$host_os dld.sl"
- version_type=sunos
- shlibpath_var=SHLIB_PATH
- library_names_spec='$libname.sl.$versuffix $libname.sl.$major $libname.sl'
- soname_spec='$libname.sl.$major'
- # HP-UX runs *really* slowly unless shared libraries are mode 555.
- postinstall_cmds='chmod 555 $lib'
- ;;
-
-irix5* | irix6*)
- version_type=osf
- soname_spec='$libname.so'
- library_names_spec='$libname.so.$versuffix $libname.so'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-# No shared lib support for Linux oldld, aout, or coff.
-linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
- dynamic_linker=no
- ;;
-
-# This must be Linux ELF.
-linux-gnu*)
- version_type=linux
- library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
- soname_spec='$libname.so.$major'
- finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
- shlibpath_var=LD_LIBRARY_PATH
-
- if test -f /lib/ld.so.1; then
- dynamic_linker='GNU ld.so'
- else
- # Only the GNU ld.so supports shared libraries on MkLinux.
- case "$host_cpu" in
- powerpc*) dynamic_linker=no ;;
- *) dynamic_linker='Linux ld.so' ;;
- esac
- fi
- ;;
-
-netbsd* | openbsd*)
- version_type=sunos
- library_names_spec='$libname.so.$versuffix'
- finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-os2*)
- version_type=none
- libname_spec='$name'
- library_names_spec='$libname.dll $libname.a'
- dynamic_linker='OS/2 ld.exe'
- shlibpath_var=LIBPATH
- ;;
-
-osf3* | osf4*)
- version_type=osf
- soname_spec='$libname.so'
- library_names_spec='$libname.so.$versuffix $libname.so'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-sco3.2v5*)
- version_type=osf
- soname_spec='$libname.so.$major'
- library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-solaris2*)
- version_type=linux
- library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
- soname_spec='$libname.so.$major'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-sunos4*)
- version_type=sunos
- library_names_spec='$libname.so.$versuffix'
- finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-uts4*)
- version_type=linux
- library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
- soname_spec='$libname.so.$major'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-*)
- dynamic_linker=no
- ;;
-esac
-echo "$ac_t$dynamic_linker"
-test "$dynamic_linker" = no && can_build_shared=no
-
-# FIXME add checks for striplib and old_striplib here.
-# strip -x works for most platforms, though not for static libraries on NetBSD
-# HP-UX requires "-r" for library stripping
-striplib=
-old_striplib=
-
-# Report the final consequences.
-echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6
-
-echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6
-test "$can_build_shared" = "no" && enable_shared=no
-
-# On AIX, shared libraries and static libraries use the same namespace, and
-# are all built from PIC.
-case "$host_os" in
-aix*)
- test "$enable_shared" = yes && enable_static=no
- if test -n "$RANLIB"; then
- archive_cmds="$archive_cmds;\$RANLIB \$lib"
- postinstall_cmds='$RANLIB $lib'
- fi
- ;;
-esac
-
-echo "$ac_t$enable_shared" 1>&6
-
-# Make sure either enable_shared or enable_static is yes.
-test "$enable_shared" = yes || enable_static=yes
-
-echo "checking whether to build static libraries... $enable_static" 1>&6
-
-echo $ac_n "checking for objdir... $ac_c" 1>&6
-rm -f .libs 2>/dev/null
-mkdir .libs 2>/dev/null
-if test -d .libs; then
- objdir=.libs
-else
- # MS-DOS does not allow filenames that begin with a dot.
- objdir=_libs
-fi
-rmdir .libs 2>/dev/null
-echo "$ac_t$objdir" 1>&6
-
-# Now quote all the things that may contain metacharacters.
-for var in old_CC old_CFLAGS old_CPPFLAGS old_LD old_NM old_RANLIB \
- old_LN_S AR CC LD LN_S NM reload_flag reload_cmds wl pic_flag \
- link_static_flag no_builtin_flag export_dynamic_flag_spec \
- profile_flag_pattern libname_spec library_names_spec soname_spec RANLIB \
- old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
- archive_cmds postinstall_cmds \
- allow_undefined_flag finish_cmds global_symbol_pipe \
- striplib old_striplib \
- hardcode_libdir_flag_spec hardcode_libdir_separator; do
-
- case "$var" in
- reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
- old_postinstall_cmds | archive_cmds | postinstall_cmds | finish_cmds)
- # Double-quote double-evaled strings.
- eval "$var=\`echo \"\$$var\" | sed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\"\`"
- ;;
- *)
- eval "$var=\`echo \"\$$var\" | sed \"\$sed_quote_subst\"\`"
- ;;
- esac
-done
-
-ofile=libtool
-trap "$rm $ofile; exit 1" 1 2 15
-echo creating $ofile
-$rm $ofile
-cat <<EOF > $ofile
-#! /bin/sh
-
-# libtool - Provide generalized library-building support services.
-#
-# Generated automatically by $PROGRAM - GNU $PACKAGE $VERSION
-# This program was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# CC="$old_CC" CFLAGS="$old_CFLAGS" CPPFLAGS="$old_CPPFLAGS" \\
-# LD="$old_LD" NM="$old_NM" RANLIB="$old_RANLIB" LN_S="$old_LN_S" \\
-# $0$ltconfig_args
-#
-# Compiler and other test output produced by $progname, useful for
-# debugging $progname, is in ./config.log if it exists.
-
-# The version of $progname that generated this script.
-LTCONFIG_VERSION="$VERSION"
-
-# Shell to use when invoking shell scripts.
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-# Whether or not to build libtool libraries.
-build_libtool_libs=$enable_shared
-
-# Whether or not to build old-style libraries.
-build_old_libs=$enable_static
-
-# The host system.
-host_alias="$host_alias"
-host="$host"
-
-# The archiver.
-AR="$AR"
-
-# The default C compiler.
-CC="$CC"
-
-# The linker used to build libraries.
-LD="$LD"
-
-# Whether we need hard or soft links.
-LN_S="$LN_S"
-
-# A BSD-compatible nm program.
-NM="$NM"
-
-# The name of the directory that contains temporary libtool files.
-objdir="$objdir"
-
-# How to create reloadable object files.
-reload_flag="$reload_flag"
-reload_cmds="$reload_cmds"
-
-# How to pass a linker flag through the compiler.
-wl="$wl"
-
-# Additional compiler flags for building library objects.
-pic_flag="$pic_flag"
-
-# Compiler flag to prevent dynamic linking.
-link_static_flag="$link_static_flag"
-
-# Compiler flag to turn off builtin functions.
-no_builtin_flag="$no_builtin_flag"
-
-# Compiler flag to allow reflexive dlopens.
-export_dynamic_flag_spec="$export_dynamic_flag_spec"
-
-# Pattern to match compiler flags for creating libNAME_p libraries:
-profile_flag_pattern="$profile_flag_pattern"
-
-# Library versioning type.
-version_type=$version_type
-
-# Format of library name prefix.
-libname_spec="$libname_spec"
-
-# List of archive names. First name is the real one, the rest are links.
-# The last name is the one that the linker finds with -lNAME.
-library_names_spec="$library_names_spec"
-
-# The coded name of the library, if different from the real name.
-soname_spec="$soname_spec"
-
-# Commands used to build and install an old-style archive.
-RANLIB="$RANLIB"
-old_archive_cmds="$old_archive_cmds"
-old_postinstall_cmds="$old_postinstall_cmds"
-
-# Create an old-style archive from a shared archive.
-old_archive_from_new_cmds="$old_archive_from_new_cmds"
-
-# Commands used to build and install a shared archive.
-archive_cmds="$archive_cmds"
-postinstall_cmds="$postinstall_cmds"
-
-# Flag that allows shared libraries with undefined symbols to be built.
-allow_undefined_flag="$allow_undefined_flag"
-
-# Commands used to finish a libtool library installation in a directory.
-finish_cmds="$finish_cmds"
-
-# Take the output of nm and produce a listing of raw symbols and C names.
-global_symbol_pipe="$global_symbol_pipe"
-
-# How to strip a library file.
-striplib="$striplib"
-old_striplib="$old_striplib"
-
-# This is the shared library runtime path variable.
-runpath_var=$runpath_var
-
-# This is the shared library path variable.
-shlibpath_var=$shlibpath_var
-
-# How to hardcode a shared library path into an executable.
-hardcode_action=$hardcode_action
-
-# Flag to hardcode \$libdir into a binary during linking.
-# This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec="$hardcode_libdir_flag_spec"
-
-# Whether we need a single -rpath flag with a separated argument.
-hardcode_libdir_separator="$hardcode_libdir_separator"
-
-# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
-# resulting binary.
-hardcode_direct=$hardcode_direct
-
-# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
-# resulting binary.
-hardcode_minus_L=$hardcode_minus_L
-
-# Set to yes if using RUNPATH_VAR=DIR during linking hardcodes DIR into the
-# resulting binary.
-hardcode_runpath_var=$hardcode_runpath_var
-
-# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
-# the resulting binary.
-hardcode_shlibpath_var=$hardcode_shlibpath_var
-
-EOF
-
-case "$host_os" in
-aix*)
- cat <<\EOF >> $ofile
-# AIX sometimes has problems with the GCC collect2 program. For some
-# reason, if we set the COLLECT_NAMES environment variable, the problems
-# vanish in a puff of smoke.
-if test "${COLLECT_NAMES+set}" != set; then
- COLLECT_NAMES=
- export COLLECT_NAMES
-fi
-
-EOF
- ;;
-esac
-
-# Detect if we are using a relative or absolute path to ltmain.sh.
-case "$ltmain" in
-/*) cat <<EOF >> $ofile
-# Execute the libtool backend.
-. $ltmain
-EOF
- ;;
-*) cat <<EOF >> $ofile
-# Find the path to this script.
-thisdir=\`echo "\$0" | sed -e 's%/[^/]*\$%%'\`
-test "X\$0" = "X\$thisdir" && thisdir=.
-
-# Execute the libtool backend.
-. \$thisdir/$ltmain
-EOF
- ;;
-esac
-
-echo 'exit 1' >> $ofile
-
-chmod +x $ofile
-exit 0
-
-# Local Variables:
-# mode:shell-script
-# sh-indentation:2
-# End:
diff --git a/ltmain.sh b/ltmain.sh
deleted file mode 100644
index cb46c84987..0000000000
--- a/ltmain.sh
+++ /dev/null
@@ -1,2372 +0,0 @@
-# ltmain.sh - Provide generalized library-building support services.
-# Generated automatically from ltmain.in by configure.
-# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
-# Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-#FIXME: echo=echo
-echo='printf %s\n'
-if test "X`$echo '\t'`" = 'X\t'; then :
-else
- # The Solaris and AIX default echo program unquotes backslashes.
- # This makes it impossible to quote backslashes using
- # echo "$something" | sed 's/\\/\\\\/g'
- # So, we emulate echo with printf '%s\n'
- echo='printf %s\n'
- if test "X`$echo '\t'`" = 'X\t'; then :
- else
- # Oops. We have no working printf. Try to find a not-so-buggy echo.
- echo=echo
- IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
- save_PATH="$PATH"
- PATH="$PATH":/usr/ucb
- for dir in $PATH; do
- if test -f $dir/echo && test "X`$dir/echo '\t'`" = 'X\t'; then
- echo="$dir/echo"
- break
- fi
- done
- IFS="$save_ifs"
- PATH="$save_PATH"
- fi
-fi
-
-# The name of this program.
-progname=`$echo "$0" | sed 's%^.*/%%'`
-
-# Constants.
-PROGRAM=ltmain.sh
-PACKAGE=libtool
-VERSION=1.0f
-
-default_mode=
-help="Try \`$progname --help' for more information."
-magic="%%%MAGIC variable%%%"
-mkdir="mkdir"
-mv="mv -f"
-rm="rm -f"
-
-# Sed substitution that helps us do robust quoting. It backslashifies
-# metacharacters that are still active within double-quoted strings.
-sed_quote_subst='s/\([\\"$\\\\]\)/\\\1/g'
-
-# NLS nuisances.
-# Only set LANG and LC_ALL to C if already set.
-# These must not be set unconditionally because not all systems understand
-# e.g. LANG=C (notably SCO).
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-
-if test "$LTCONFIG_VERSION" != "$VERSION"; then
- $echo "$progname: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
- $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
- exit 1
-fi
-
-if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
- $echo "$progname: not configured to build any kind of library" 1>&2
- $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
- exit 1
-fi
-
-# Global variables.
-mode=$default_mode
-nonopt=
-prev=
-prevopt=
-run=
-show="$echo"
-show_help=
-execute_dlfiles=
-
-# Parse our command line options once, thoroughly.
-while test $# -gt 0
-do
- arg="$1"
- shift
-
- case "$arg" in
- -*=*) optarg=`$echo "$arg" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) optarg= ;;
- esac
-
- # If the previous option needs an argument, assign it.
- if test -n "$prev"; then
- case "$prev" in
- execute_dlfiles)
- eval "$prev=\"\$$prev \$arg\""
- ;;
- *)
- eval "$prev=\$arg"
- ;;
- esac
-
- prev=
- prevopt=
- continue
- fi
-
- # Have we seen a non-optional argument yet?
- case "$arg" in
- --help)
- show_help=yes
- ;;
-
- --version)
- $echo "$PROGRAM (GNU $PACKAGE) $VERSION"
- exit 0
- ;;
-
- --dry-run | -n)
- run=:
- ;;
-
- --features)
- $echo "host: $host"
- if test "$build_libtool_libs" = yes; then
- $echo "enable shared libraries"
- else
- $echo "disable shared libraries"
- fi
- if test "$build_old_libs" = yes; then
- $echo "enable static libraries"
- else
- $echo "disable static libraries"
- fi
- exit 0
- ;;
-
- --finish) mode="finish" ;;
-
- --mode) prevopt="--mode" prev=mode ;;
- --mode=*) mode="$optarg" ;;
-
- --quiet | --silent)
- show=:
- ;;
-
- -dlopen)
- prevopt="-dlopen"
- prev=execute_dlfiles
- ;;
-
- -*)
- $echo "$progname: unrecognized option \`$arg'" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
-
- *)
- nonopt="$arg"
- break
- ;;
- esac
-done
-
-if test -n "$prevopt"; then
- $echo "$progname: option \`$prevopt' requires an argument" 1>&2
- $echo "$help" 1>&2
- exit 1
-fi
-
-if test -z "$show_help"; then
-
- # Infer the operation mode.
- if test -z "$mode"; then
- case "$nonopt" in
- *cc | *++)
- mode=link
- for arg
- do
- case "$arg" in
- -c)
- mode=compile
- break
- ;;
- esac
- done
- ;;
- *db | *dbx)
- mode=execute
- ;;
- *install*|cp)
- mode=install
- ;;
- *rm)
- mode=uninstall
- ;;
- *)
- # If we have no mode, but dlfiles were specified, then do execute mode.
- test -n "$execute_dlfiles" && mode=execute
-
- # Just use the default operation mode.
- if test -z "$mode"; then
- if test -n "$nonopt"; then
- $echo "$progname: warning: cannot infer operation mode from \`$nonopt'" 1>&2
- else
- $echo "$progname: warning: cannot infer operation mode without MODE-ARGS" 1>&2
- fi
- fi
- ;;
- esac
- fi
-
- # Only execute mode is allowed to have -dlopen flags.
- if test -n "$execute_dlfiles" && test "$mode" != execute; then
- $echo "$progname: unrecognized option \`-dlopen'" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- # Change the help message to a mode-specific one.
- generic_help="$help"
- help="Try \`$progname --help --mode=$mode' for more information."
-
- # These modes are in order of execution frequency so that they run quickly.
- case "$mode" in
- # libtool compile mode
- compile)
- progname="$progname: compile"
- # Get the compilation command and the source file.
- base_compile=
- lastarg=
- srcfile="$nonopt"
- suppress_output=
-
- for arg
- do
- # The only flag that cannot be specified is the output filename.
- if test "X$arg" = "X-o"; then
- $echo "$progname: you cannot specify the output filename with \`-o'" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- # Accept the current argument as the source file.
- lastarg="$srcfile"
- srcfile="$arg"
-
- # Aesthetically quote the previous argument.
-
- # Backslashify any backslashes, double quotes, and dollar signs.
- # These are the only characters that are still specially
- # interpreted inside of double-quoted scrings.
- lastarg=`$echo "$lastarg" | sed "$sed_quote_subst"`
-
- # Double-quote args containing other shell metacharacters.
- # Many Bourne shells cannot handle close brackets correctly in scan
- # sets, so we specify it separately.
- case "$lastarg" in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- lastarg="\"$lastarg\""
- ;;
- esac
-
- # Add the previous argument to base_compile.
- if test -z "$base_compile"; then
- base_compile="$lastarg"
- else
- base_compile="$base_compile $lastarg"
- fi
- done
-
- # Get the name of the library object.
- libobj=`$echo "$srcfile" | sed -e 's%^.*/%%'`
-
- # Recognize several different file suffixes.
- xform='[cCFSfm]'
- case "$libobj" in
- *.c++) xform=c++ ;;
- *.cc) xform=cc ;;
- *.cpp) xform=cpp ;;
- *.cxx) xform=cxx ;;
- *.f90) xform=f90 ;;
- *.for) xform=for ;;
- esac
-
- libobj=`$echo "$libobj" | sed -e "s/\.$xform$/.lo/"`
-
- case "$libobj" in
- *.lo) obj=`$echo "$libobj" | sed -e 's/\.lo$/.o/'` ;;
- *)
- $echo "$progname: cannot determine name of library object from \`$srcfile'" 1>&2
- exit 1
- ;;
- esac
-
- if test -z "$base_compile"; then
- $echo "$progname: you must specify a compilation command" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- # Delete any leftover library objects.
- if test "$build_old_libs" = yes; then
- $run $rm $obj $libobj
- trap "$run $rm $obj $libobj; exit 1" 1 2 15
- else
- $run $rm $libobj
- trap "$run $rm $libobj; exit 1" 1 2 15
- fi
-
- # Only build a PIC object if we are building libtool libraries.
- if test "$build_libtool_libs" = yes; then
- # Without this assignment, base_compile gets emptied.
- fbsd_hideous_sh_bug=$base_compile
-
- # All platforms use -DPIC, to notify preprocessed assembler code.
- $show "$base_compile$pic_flag -DPIC $srcfile"
- if $run eval "$base_compile\$pic_flag -DPIC \$srcfile"; then :
- else
- test -n "$obj" && $run $rm $obj
- exit 1
- fi
-
- # If we have no pic_flag, then copy the object into place and finish.
- if test -z "$pic_flag"; then
- $show "$LN_S $obj $libobj"
- $run $LN_S $obj $libobj
- exit $?
- fi
-
- # Just move the object, then go on to compile the next one
- $show "$mv $obj $libobj"
- $run $mv $obj $libobj || exit 1
-
- # Allow error messages only from the first compilation.
- suppress_output=' >/dev/null 2>&1'
- fi
-
- # Only build a position-dependent object if we build old libraries.
- if test "$build_old_libs" = yes; then
- # Suppress compiler output if we already did a PIC compilation.
- $show "$base_compile $srcfile$suppress_output"
- if $run eval "$base_compile \$srcfile$suppress_output"; then :
- else
- $run $rm $obj $libobj
- exit 1
- fi
- fi
-
- # Create an invalid libtool object if no PIC, so that we don't accidentally
- # link it into a program.
- if test "$build_libtool_libs" != yes; then
- $show "$echo timestamp > $libobj"
- $run eval "\$echo timestamp > \$libobj" || exit $?
- fi
-
- exit 0
- ;;
-
- # libtool link mode
- link)
- progname="$progname: link"
- CC="$nonopt"
- allow_undefined=no
- compile_command="$CC"
- finalize_command="$CC"
-
- compile_shlibpath=
- finalize_shlibpath=
- deplibs=
- dlfiles=
- dlprefiles=
- export_dynamic=no
- hardcode_libdirs=
- libobjs=
- link_against_libtool_libs=
- ltlibs=
- objs=
- prev=
- prevarg=
- rpath=
- perm_rpath=
- temp_rpath=
- vinfo=
-
- # We need to know -static, to get the right output filenames.
- for arg
- do
- case "$arg" in
- -all-static | -static)
- if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
- $echo "$progname: warning: complete static linking is impossible in this configuration" 1>&2
- fi
- build_libtool_libs=no
- build_old_libs=yes
- break
- ;;
- esac
- done
-
- # See if our shared archives depend on static archives.
- test -n "$old_archive_from_new_cmds" && build_old_libs=yes
-
- # Go through the arguments, transforming them on the way.
- for arg
- do
- # If the previous option needs an argument, assign it.
- if test -n "$prev"; then
- case "$prev" in
- output)
- compile_command="$compile_command @OUTPUT@"
- finalize_command="$finalize_command @OUTPUT@"
- ;;
- esac
-
- case "$prev" in
- dlfiles|dlprefiles)
- case "$arg" in
- *.la | *.lo) ;; # We handle these cases below.
- *)
- dlprefiles="$dlprefiles $arg"
- test "$prev" = dlfiles && dlfiles="$dlfiles $arg"
- prev=
- ;;
- esac
- ;;
- rpath)
- rpath="$rpath $arg"
- prev=
- continue
- ;;
- *)
- eval "$prev=\"\$arg\""
- prev=
- continue
- ;;
- esac
- fi
-
- prevarg="$arg"
-
- case "$arg" in
- -all-static)
- if test -n "$link_static_flag"; then
- compile_command="$compile_command $link_static_flag"
- finalize_command="$finalize_command $link_static_flag"
- fi
- continue
- ;;
-
- -allow-undefined)
- allow_undefined=yes
- continue
- ;;
-
- -dlopen)
- prev=dlfiles
- continue
- ;;
-
- -dlpreopen)
- prev=dlprefiles
- continue
- ;;
-
- -export-dynamic)
- if test "$export_dynamic" != yes; then
- export_dynamic=yes
- if test -n "$export_dynamic_flag_spec"; then
- arg=`eval \\$echo "$export_dynamic_flag_spec"`
- else
- arg=
- fi
-
- # Add the symbol object into the linking commands.
- compile_command="$compile_command @SYMFILE@"
- finalize_command="$finalize_command @SYMFILE@"
- fi
- ;;
-
- -L*)
- dir=`$echo "$arg" | sed 's%^-L\(.*\)$%\1%'`
- case "$dir" in
- /*)
- # Add the corresponding hardcode_libdir_flag, if it is not identical.
- ;;
- *)
- $echo "$progname: \`-L$dir' cannot specify a relative directory" 1>&2
- exit 1
- ;;
- esac
- deplibs="$deplibs $arg"
- ;;
-
- -l*) deplibs="$deplibs $arg" ;;
-
- -o) prev=output ;;
-
- -rpath)
- prev=rpath
- continue
- ;;
-
- -static)
- # If we have no pic_flag, then this is the same as -all-static.
- if test -z "$pic_flag" && test -n "$link_static_flag"; then
- compile_command="$compile_command $link_static_flag"
- finalize_command="$finalize_command $link_static_flag"
- fi
- continue
- ;;
-
- -version-info)
- prev=vinfo
- continue
- ;;
-
- # Some other compiler flag.
- -* | +*)
- # Unknown arguments in both finalize_command and compile_command need
- # to be aesthetically quoted because they are evaled later.
- arg=`$echo "$arg" | sed "$sed_quote_subst"`
- case "$arg" in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- arg="\"$arg\""
- ;;
- esac
- ;;
-
- *.o | *.a)
- # A standard object.
- objs="$objs $arg"
- ;;
-
- *.lo)
- # A library object.
- if test "$prev" = dlfiles; then
- dlfiles="$dlfiles $arg"
- if test "$build_libtool_libs" = yes; then
- prev=
- continue
- else
- # If libtool objects are unsupported, then we need to preload.
- prev=dlprefiles
- fi
- fi
-
- if test "$prev" = dlprefiles; then
- # Preload the old-style object.
- dlprefiles="$dlprefiles "`$echo "$arg" | sed 's/\.lo$/\.o/'`
- prev=
- fi
- libobjs="$libobjs $arg"
- ;;
-
- *.la)
- # A libtool-controlled library.
-
- dlname=
- libdir=
- library_names=
- old_library=
-
- # Check to see that this really is a libtool archive.
- if egrep '^# Generated by ltmain.sh' $arg >/dev/null 2>&1; then :
- else
- $echo "$progname: \`$arg' is not a valid libtool archive" 1>&2
- exit 1
- fi
-
- # If there is no directory component, then add one.
- case "$arg" in
- */*) . $arg ;;
- *) . ./$arg ;;
- esac
-
- if test -z "$libdir"; then
- $echo "$progname: \`$arg' contains no -rpath information" 1>&2
- exit 1
- fi
-
- # Get the name of the library we link against.
- linklib=
- for l in $old_library $library_names; do
- linklib="$l"
- done
-
- if test -z "$linklib"; then
- $echo "$progname: cannot find name of link library for \`$arg'" 1>&2
- exit 1
- fi
-
- # Find the relevant object directory and library name.
- name=`$echo "$arg" | sed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
- dir=`$echo "$arg" | sed 's%/[^/]*$%%'`
- if test "X$dir" = "X$arg"; then
- dir="$objdir"
- else
- dir="$dir/$objdir"
- fi
-
- # This library was specified with -dlopen.
- if test "$prev" = dlfiles; then
- dlfiles="$dlfiles $arg"
- if test -z "$dlname"; then
- # If there is no dlname, we need to preload.
- prev=dlprefiles
- else
- # We should not create a dependency on this library.
- prev=
- continue
- fi
- fi
-
- # The library was specified with -dlpreopen.
- if test "$prev" = dlprefiles; then
- # Prefer using a static library (so that no silly _DYNAMIC symbols
- # are required to link).
- if test -n "$old_library"; then
- dlprefiles="$dlprefiles $dir/$old_library"
- else
- dlprefiles="$dlprefiles $dir/$linklib"
- fi
- prev=
- fi
-
- if test "$build_libtool_libs" = yes && test -n "$library_names"; then
- link_against_libtool_libs="$link_against_libtool_libs $arg"
- if test -n "$shlibpath_var"; then
- # Make sure the rpath contains only unique directories.
- case "$temp_rpath " in
- *" $dir "*) ;;
- *) temp_rpath="$temp_rpath $dir" ;;
- esac
- fi
-
- # This is the magic to use -rpath.
- if test -n "$hardcode_libdir_flag_spec"; then
- if test -n "$hardcode_libdir_separator"; then
- if test -z "$hardcode_libdirs"; then
- # Put the magic libdir with the hardcode flag.
- hardcode_libdirs="$libdir"
- libdir="@HARDCODE_LIBDIRS@"
- else
- # Just accumulate the unique libdirs.
- case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
- *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- libdir=
- fi
- fi
-
- if test -n "$libdir"; then
- flag=`eval \\$echo \"$hardcode_libdir_flag_spec\"`
-
- compile_command="$compile_command $flag"
- finalize_command="$finalize_command $flag"
- fi
- elif test "$hardcode_runpath_var" = yes; then
- # Do the same for the permanent run path.
- case "$perm_rpath " in
- *" $libdir "*) ;;
- *) perm_rpath="$perm_rpath $libdir" ;;
- esac
- fi
-
-
- case "$hardcode_action" in
- immediate)
- if test "$hardcode_direct" = no; then
- compile_command="$compile_command $dir/$linklib"
- elif test "$hardcode_minus_L" = no; then
- compile_command="$compile_command -L$dir -l$name"
- elif test "$hardcode_shlibpath_var" = no; then
- compile_shlibpath="$compile_shlibpath$dir:"
- compile_command="$compile_command -l$name"
- fi
- ;;
-
- relink)
- # We need an absolute path.
- case "$dir" in
- /*) ;;
- *)
- absdir=`cd "$dir" && pwd`
- if test -z "$absdir"; then
- $echo "$progname: cannot determine absolute directory name of \`$dir'" 1>&2
- exit 1
- fi
- dir="$absdir"
- ;;
- esac
-
- if test "$hardcode_direct" = yes; then
- compile_command="$compile_command $dir/$linklib"
- elif test "$hardcode_minus_L" = yes; then
- compile_command="$compile_command -L$dir -l$name"
- elif test "$hardcode_shlibpath_var" = yes; then
- compile_shlibpath="$compile_shlibpath$dir:"
- compile_command="$compile_command -l$name"
- fi
- ;;
-
- *)
- $echo "$progname: \`$hardcode_action' is an unknown hardcode action" 1>&2
- exit 1
- ;;
- esac
-
- # Finalize command for both is simple: just hardcode it.
- if test "$hardcode_direct" = yes; then
- finalize_command="$finalize_command $libdir/$linklib"
- elif test "$hardcode_minus_L" = yes; then
- finalize_command="$finalize_command -L$libdir -l$name"
- elif test "$hardcode_shlibpath_var" = yes; then
- finalize_shlibpath="$finalize_shlibpath$libdir:"
- finalize_command="$finalize_command -l$name"
- else
- # We can't seem to hardcode it, guess we'll fake it.
- finalize_command="$finalize_command -L$libdir -l$name"
- fi
- else
- # Transform directly to old archives if we don't build new libraries.
- if test -n "$pic_flag" && test -z "$old_library"; then
- $echo "$progname: cannot find static library for \`$arg'" 1>&2
- exit 1
- fi
-
- # Here we assume that one of hardcode_direct or hardcode_minus_L
- # is not unsupported. This is valid on all known static and
- # shared platforms.
- if test "$hardcode_direct" != unsupported; then
- test -n "$old_library" && linklib="$old_library"
- compile_command="$compile_command $dir/$linklib"
- finalize_command="$finalize_command $dir/$linklib"
- else
- compile_command="$compile_command -L$dir -l$name"
- finalize_command="$finalize_command -L$dir -l$name"
- fi
- fi
- continue
- ;;
-
- # Some other compiler argument.
- *)
- # Unknown arguments in both finalize_command and compile_command need
- # to be aesthetically quoted because they are evaled later.
- arg=`$echo "$arg" | sed "$sed_quote_subst"`
- case "$arg" in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- arg="\"$arg\""
- ;;
- esac
- ;;
- esac
-
- # Now actually substitute the argument into the commands.
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- done
-
- if test -n "$prev"; then
- $echo "$progname: the \`$prevarg' option requires an argument" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- oldlib=
- oldobjs=
- case "$output" in
- "")
- $echo "$progname: you must specify an output file" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
-
- */*)
- $echo "$progname: output file \`$output' must have no directory components" 1>&2
- exit 1
- ;;
-
- *.la)
- # Make sure we only generate libraries of the form `libNAME.la'.
- case "$output" in
- lib*) ;;
- *)
- $echo "$progname: libtool library \`$arg' must begin with \`lib'" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
- esac
-
- name=`$echo "$output" | sed -e 's/\.la$//' -e 's/^lib//'`
- libname=`eval \\$echo \"$libname_spec\"`
-
- # All the library-specific variables (install_libdir is set above).
- library_names=
- old_library=
- dlname=
- current=0
- revision=0
- age=0
-
- if test -n "$objs"; then
- $echo "$progname: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
- exit 1
- fi
-
- # How the heck are we supposed to write a wrapper for a shared library?
- if test -n "$link_against_libtool_libs"; then
- $echo "$progname: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2
- exit 1
- fi
-
- # Add libc to deplibs on all systems.
- deplibs="$deplibs -lc"
-
- if test -n "$dlfiles$dlprefiles"; then
- $echo "$progname: warning: \`-dlopen' is ignored while creating libtool libraries" 1>&2
- # Nullify the symbol file.
- compile_command=`$echo "$compile_command" | sed "s% @SYMFILE@%%"`
- finalize_command=`$echo "$finalize_command" | sed "s% @SYMFILE@%%"`
- fi
-
- if test -z "$rpath"; then
- $echo "$progname: you must specify an installation directory with \`-rpath'" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- set dummy $rpath
- if test $# -gt 2; then
- $echo "$progname: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
- fi
- install_libdir="$2"
-
- # Parse the version information argument.
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
- set dummy $vinfo
- IFS="$save_ifs"
-
- if test -n "$5"; then
- $echo "$progname: too many parameters to \`-version-info'" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- test -n "$2" && current="$2"
- test -n "$3" && revision="$3"
- test -n "$4" && age="$4"
-
- # Check that each of the things are valid numbers.
- case "$current" in
- 0 | [1-9] | [1-9][0-9]*) ;;
- *)
- $echo "$progname: CURRENT \`$current' is not a nonnegative integer" 1>&2
- $echo "$progname: \`$vinfo' is not valid version information" 1>&2
- exit 1
- ;;
- esac
-
- case "$revision" in
- 0 | [1-9] | [1-9][0-9]*) ;;
- *)
- $echo "$progname: REVISION \`$revision' is not a nonnegative integer" 1>&2
- $echo "$progname: \`$vinfo' is not valid version information" 1>&2
- exit 1
- ;;
- esac
-
- case "$age" in
- 0 | [1-9] | [1-9][0-9]*) ;;
- *)
- $echo "$progname: AGE \`$age' is not a nonnegative integer" 1>&2
- $echo "$progname: \`$vinfo' is not valid version information" 1>&2
- exit 1
- ;;
- esac
-
- if test $age -gt $current; then
- $echo "$progname: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
- $echo "$progname: \`$vinfo' is not valid version information" 1>&2
- exit 1
- fi
-
- # Calculate the version variables.
- version_vars="version_type current age revision"
- case "$version_type" in
- none) ;;
-
- linux)
- version_vars="$version_vars major versuffix"
- major=`expr $current - $age`
- versuffix="$major.$age.$revision"
- ;;
-
- osf)
- version_vars="$version_vars versuffix verstring"
- major=`expr $current - $age`
- versuffix="$current.$age.$revision"
- verstring="$versuffix"
-
- # Add in all the interfaces that we are compatible with.
- loop=$age
- while test $loop != 0; do
- iface=`expr $current - $loop`
- loop=`expr $loop - 1`
- verstring="$verstring:${iface}.0"
- done
-
- # Make executables depend on our current version.
- verstring="$verstring:${current}.0"
- ;;
-
- sunos)
- version_vars="$version_vars major versuffix"
- major="$current"
- versuffix="$current.$revision"
- ;;
-
- *)
- $echo "$progname: unknown library version type \`$version_type'" 1>&2
- $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
- exit 1
- ;;
- esac
-
- # Create the output directory, or remove our outputs if we need to.
- if test -d $objdir; then
- $show "$rm $objdir/$output $objdir/$libname.*"
- $run $rm $objdir/$output $objdir/$libname.*
- else
- $show "$mkdir $objdir"
- $run $mkdir $objdir
- status=$?
- if test $status -eq 0 || test -d $objdir; then :
- else
- exit $status
- fi
- fi
-
- # Check to see if the archive will have undefined symbols.
- if test "$allow_undefined" = yes; then
- if test "$allow_undefined_flag" = unsupported; then
- $echo "$progname: warning: undefined symbols not allowed in $host shared libraries" 1>&2
- build_libtool_libs=no
- build_old_libs=yes
- fi
- else
- # Clear the flag.
- allow_undefined_flag=
- fi
-
- if test "$build_libtool_libs" = yes; then
- # Get the real and link names of the library.
- library_names=`eval \\$echo \"$library_names_spec\"`
- set dummy $library_names
- realname="$2"
- shift; shift
-
- if test -n "$soname_spec"; then
- soname=`eval \\$echo \"$soname_spec\"`
- else
- soname="$realname"
- fi
-
- lib="$objdir/$realname"
- for link
- do
- linknames="$linknames $link"
- done
-
- # Use standard objects if they are PIC.
- test -z "$pic_flag" && libobjs=`$echo "$libobjs " | sed -e 's/\.lo /.o /g' -e 's/ $//g'`
-
- # Do each of the archive commands.
- cmds=`eval \\$echo \"$archive_cmds\"`
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
-
- # Create links to the real library.
- for link in $linknames; do
- $show "(cd $objdir && $LN_S $realname $link)"
- $run eval '(cd $objdir && $LN_S $realname $link)' || exit $?
- done
-
- # If -export-dynamic was specified, set the dlname.
- if test "$export_dynamic" = yes; then
- # On all known operating systems, these are identical.
- dlname="$soname"
- fi
- fi
- ;;
-
- *.lo | *.o)
- if test -n "$link_against_libtool_libs"; then
- $echo "$progname: error: cannot link libtool libraries into reloadable objects" 1>&2
- exit 1
- fi
-
- if test -n "$deplibs"; then
- $echo "$progname: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2
- fi
-
- if test -n "$dlfiles$dlprefiles"; then
- $echo "$progname: warning: \`-dlopen' is ignored while creating objects" 1>&2
- # Nullify the symbol file.
- compile_command=`$echo "$compile_command" | sed "s% @SYMFILE@%%"`
- finalize_command=`$echo "$finalize_command" | sed "s% @SYMFILE@%%"`
- fi
-
- if test -n "$rpath"; then
- $echo "$progname: warning: \`-rpath' is ignored while creating objects" 1>&2
- fi
-
- if test -n "$vinfo"; then
- $echo "$progname: warning: \`-version-info' is ignored while creating objects" 1>&2
- fi
-
- case "$output" in
- *.lo)
- if test -n "$objs"; then
- $echo "$progname: cannot build library object \`$output' from non-libtool objects" 1>&2
- exit 1
- fi
- libobj="$output"
- obj=`$echo "$output" | sed 's/\.lo$/.o/'`
- ;;
- *)
- libobj=
- obj="$output"
- ;;
- esac
-
- # Delete the old objects.
- $run $rm $obj $libobj
-
- # Create the old-style object.
- reload_objs="$objs"`$echo "$libobjs " | sed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
-
- output="$obj"
- cmds=`eval \\$echo \"$reload_cmds\"`
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
-
- # Exit if we aren't doing a library object file.
- test -z "$libobj" && exit 0
-
- if test "$build_libtool_libs" != yes; then
- # Create an invalid libtool object if no PIC, so that we don't
- # accidentally link it into a program.
- $show "$echo timestamp > $libobj"
- $run eval "\$echo timestamp > $libobj" || exit $?
- exit 0
- fi
-
- if test -n "$pic_flag"; then
- # Only do commands if we really have different PIC objects.
- reload_objs="$libobjs"
- output="$libobj"
- cmds=`eval \\$echo \"$reload_cmds\"`
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- else
- # Just create a symlink.
- $show "$LN_S $obj $libobj"
- $run $LN_S $obj $libobj || exit 1
- fi
-
- exit 0
- ;;
-
- *)
- if test -n "$vinfo"; then
- $echo "$progname: warning: \`-version-info' is ignored while linking programs" 1>&2
- fi
-
- if test -n "$rpath"; then
- # If the user specified any rpath flags, then add them.
- for libdir in $rpath; do
- if test -n "$hardcode_libdir_flag_spec"; then
- if test -n "$hardcode_libdir_separator"; then
- if test -z "$hardcode_libdirs"; then
- # Put the magic libdir with the hardcode flag.
- hardcode_libdirs="$libdir"
- libdir="@HARDCODE_LIBDIRS@"
- else
- # Just accumulate the unique libdirs.
- case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
- *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- libdir=
- fi
- fi
-
- if test -n "$libdir"; then
- flag=`eval \\$echo \"$hardcode_libdir_flag_spec\"`
-
- compile_command="$compile_command $flag"
- finalize_command="$finalize_command $flag"
- fi
- elif test "$hardcode_runpath_var" = yes; then
- case "$perm_rpath " in
- *" $libdir "*) ;;
- *) perm_rpath="$perm_rpath $libdir" ;;
- esac
- fi
- done
- fi
-
- # Substitute the hardcoded libdirs into the compile commands.
- if test -n "$hardcode_libdir_separator"; then
- compile_command=`$echo "$compile_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
- finalize_command=`$echo "$finalize_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
- fi
-
- if test -n "$libobjs" && test "$build_old_libs" = yes; then
- # Transform all the library objects into standard objects.
- compile_command=`$echo "$compile_command " | sed -e 's/\.lo /.o /g' -e 's/ $//'`
- finalize_command=`$echo "$finalize_command " | sed -e 's/\.lo /.o /g' -e 's/ $//'`
- fi
-
- if test "$export_dynamic" = yes && test -n "$NM" && test -n "$global_symbol_pipe"; then
- dlsyms="${output}S.c"
- else
- dlsyms=
- fi
-
- if test -n "$dlsyms"; then
- # Add our own program objects to the preloaded list.
- dlprefiles=`$echo "$objs$dlprefiles " | sed -e 's/\.lo /.o /g' -e 's/ $//'`
-
- # Discover the nlist of each of the dlfiles.
- nlist="$objdir/${output}.nm"
-
- if test -d $objdir; then
- $show "$rm $nlist ${nlist}T"
- $run $rm "$nlist" "${nlist}T"
- else
- $show "$mkdir $objdir"
- $run $mkdir $objdir
- status=$?
- if test $status -eq 0 || test -d $objdir; then :
- else
- exit $status
- fi
- fi
-
- for arg in $dlprefiles; do
- $show "extracting global C symbols from \`$arg'"
- $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
- done
-
- # Parse the name list into a source file.
- $show "creating $objdir/$dlsyms"
- if test -z "$run"; then
- # Make sure we at least have an empty file.
- test -f "$nlist" || : > "$nlist"
-
- # Try sorting and uniquifying the output.
- if sort "$nlist" | uniq > "$nlist"T; then
- mv -f "$nlist"T "$nlist"
- wcout=`wc "$nlist" 2>/dev/null`
- count=`$echo "$wcout" | sed 's/^[ ]*\([0-9][0-9]*\).*$/\1/'`
- (test "$count" -ge 0) 2>/dev/null || count=-1
- else
- $rm "$nlist"T
- count=-1
- fi
-
- case "$dlsyms" in
- "") ;;
- *.c)
- cat <<EOF > "$objdir/$dlsyms"
-/* $dlsyms - symbol resolution table for \`$output' dlsym emulation. */
-/* Generated by $PROGRAM - GNU $PACKAGE $VERSION */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Prevent the only kind of declaration conflicts we can make. */
-#define dld_preloaded_symbol_count some_other_symbol
-#define dld_preloaded_symbols some_other_symbol
-
-/* External symbol declarations for the compiler. */
-EOF
- if test -f "$nlist"; then
- sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$objdir/$dlsyms"
- else
- $echo '/* NONE */' >> "$objdir/$dlsyms"
-EOF
- fi
-
- cat <<EOF >> "$objdir/$dlsyms"
-
-#undef dld_preloaded_symbol_count
-#undef dld_preloaded_symbols
-
-#if defined (__STDC__) && __STDC__
-# define __ptr_t void *
-#else
-# define __ptr_t char *
-#endif
-
-/* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
-int dld_preloaded_symbol_count = $count;
-
-/* The mapping between symbol names and symbols. */
-struct {
- char *name;
- __ptr_t address;
-}
-dld_preloaded_symbols[] =
-{
-EOF
-
- if test -f "$nlist"; then
- sed 's/^\(.*\) \(.*\)$/ {"\1", \&\2},/' < "$nlist" >> "$objdir/$dlsyms"
- fi
-
- cat <<\EOF >> "$objdir/$dlsyms"
- {0},
-};
-
-#ifdef __cplusplus
-}
-#endif
-EOF
- ;;
-
- *)
- echo "$progname: unknown suffix for \`$dlsyms'" 1>&2
- exit 1
- ;;
- esac
- fi
-
- # Now compile the dynamic symbol file.
- $show "(cd $objdir && $CC -c$no_builtin_flag \"$dlsyms\")"
- $run eval '(cd $objdir && $CC -c$no_builtin_flag "$dlsyms")' || exit $?
-
- # Transform the symbol file into the correct name.
- compile_command=`$echo "$compile_command" | sed "s%@SYMFILE@%$objdir/${output}S.o%"`
- finalize_command=`$echo "$finalize_command" | sed "s%@SYMFILE@%$objdir/${output}S.o%"`
- elif test "$export_dynamic" != yes; then
- test -n "$dlfiles$dlprefiles" && $echo "$progname: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2
- else
- # We keep going just in case the user didn't refer to
- # dld_preloaded_symbols. The linker will fail if global_symbol_pipe
- # really was required.
- $echo "$progname: not configured to extract global symbols from dlpreopened files" 1>&2
-
- # Nullify the symbol file.
- compile_command=`$echo "$compile_command" | sed "s% @SYMFILE@%%"`
- finalize_command=`$echo "$finalize_command" | sed "s% @SYMFILE@%%"`
- fi
-
- if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
- # Replace the output file specification.
- compile_command=`$echo "$compile_command" | sed 's%@OUTPUT@%'"$output"'%g'`
- finalize_command=`$echo "$finalize_command" | sed 's%@OUTPUT@%'"$output"'%g'`
-
- # We have no uninstalled library dependencies, so finalize right now.
- $show "$compile_command"
- $run eval "$compile_command"
- exit $?
- fi
-
- # Replace the output file specification.
- compile_command=`$echo "$compile_command" | sed 's%@OUTPUT@%'"$objdir/$output"'%g'`
- finalize_command=`$echo "$finalize_command" | sed 's%@OUTPUT@%'"$objdir/$output"'T%g'`
-
- # Create the binary in the object directory, then wrap it.
- if test -d $objdir; then :
- else
- $show "$mkdir $objdir"
- $run $mkdir $objdir || exit $?
- fi
-
- if test -n "$shlibpath_var"; then
- # We should set the shlibpath_var
- rpath=
- for dir in $temp_rpath; do
- case "$dir" in
- /*)
- # Absolute path.
- rpath="$rpath$dir:"
- ;;
- *)
- # Relative path: add a thisdir entry.
- rpath="$rpath\$thisdir/$dir:"
- ;;
- esac
- done
- temp_rpath="$rpath"
- fi
-
- # Delete the old output file.
- $run $rm $output
-
- if test -n "$compile_shlibpath"; then
- compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command"
- fi
- if test -n "$finalize_shlibpath"; then
- finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
- fi
-
- if test -n "$perm_rpath"; then
- # We should set the runpath_var.
- rpath=
- for dir in $perm_rpath; do
- rpath="$rpath$dir:"
- done
- compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command"
- finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command"
- fi
-
- case "$hardcode_action" in
- relink)
- # AGH! Flame the AIX and HP-UX people for me, will ya?
- $echo "$progname: warning: using a buggy system linker" 1>&2
- $echo "$progname: relinking will be required before \`$output' can be installed" 1>&2
- ;;
- esac
-
- $show "$compile_command"
- $run eval "$compile_command" || exit $?
-
- # Now create the wrapper script.
- $show "creating $output"
-
- # Quote the finalize command for shipping.
- finalize_command=`$echo "$finalize_command" | sed "$sed_quote_subst"`
-
- # Only actually do things if our run command is non-null.
- if test -z "$run"; then
- $rm $output
- trap "$rm $output; exit 1" 1 2 15
-
- cat > $output <<EOF
-#! /bin/sh
-
-# $output - temporary wrapper script for $objdir/$output
-# Generated by ltmain.sh - GNU $PACKAGE $VERSION
-#
-# The $output program cannot be directly executed until all the libtool
-# libraries that it depends on are installed.
-#
-# This wrapper script should never be moved out of \``pwd`'.
-# If it is, it will not operate correctly.
-
-# This environment variable determines our operation mode.
-if test "\$libtool_install_magic" = "$magic"; then
- # install mode needs the following variables:
- link_against_libtool_libs='$link_against_libtool_libs'
- finalize_command="$finalize_command"
-else
- # When we are sourced in execute mode, \$file and \$echo are already set.
- if test "\$libtool_execute_magic" = "$magic"; then :
- else
- echo='$echo'
- file="\$0"
- fi
-
- # Find the directory that this script lives in.
- thisdir=\`\$echo "\$file" | sed 's%/[^/]*$%%'\`
- test "x\$thisdir" = "x\$file" && thisdir=.
-
- # Follow symbolic links until we get to the real thisdir.
- file=\`ls -ld "\$file" | sed -n 's/.*-> //p'\`
- while test -n "\$file"; do
- destdir=\`\$echo "\$file" | sed 's%/[^/]*\$%%'\`
-
- # If there was a directory component, then change thisdir.
- if test "x\$destdir" != "x\$file"; then
- case "\$destdir" in
- /*) thisdir="\$destdir" ;;
- *) thisdir="\$thisdir/\$destdir" ;;
- esac
- fi
-
- file=\`\$echo "\$file" | sed 's%^.*/%%'\`
- file=\`ls -ld "\$thisdir/\$file" | sed -n 's/.*-> //p'\`
- done
-
- # Try to get the absolute directory name.
- absdir=\`cd "\$thisdir" && pwd\`
- test -n "\$absdir" && thisdir="\$absdir"
-
- progdir="\$thisdir/$objdir"
- program='$output'
-
- if test -f "\$progdir/\$program"; then
-EOF
-
- # Export our shlibpath_var if we have one.
- if test -n "$shlibpath_var" && test -n "$temp_rpath"; then
- cat >> $output <<EOF
- # Add our own library path to $shlibpath_var
- $shlibpath_var="$temp_rpath\$$shlibpath_var"
-
- # Some systems cannot cope with colon-terminated $shlibpath_var
- $shlibpath_var=\`\$echo \$$shlibpath_var | sed -e 's/:*\$//'\`
-
- export $shlibpath_var
-
-EOF
- fi
-
- cat >> $output <<EOF
- if test "\$libtool_execute_magic" != "$magic"; then
- # Run the actual program with our arguments.
- args=
- for arg
- do
- # Quote arguments (to preserve shell metacharacters).
- sed_quote_subst='$sed_quote_subst'
- arg=\`\$echo "\$arg" | sed "\$sed_quote_subst"\`
- args="\$args \\"\$arg\\""
- done
-
- # Export the path to the program.
- PATH="\$progdir:\$PATH"
- export PATH
-
- eval "exec \$program \$args"
-
- \$echo "\$0: cannot exec \$program \$args"
- exit 1
- fi
- else
- # The program doesn't exist.
- \$echo "\$0: error: \$progdir/\$program does not exist" 1>&2
- \$echo "This script is just a wrapper for \$program." 1>&2
- \$echo "See the $PACKAGE documentation for more information." 1>&2
- exit 1
- fi
-fi
-EOF
- chmod +x $output
- fi
- exit 0
- ;;
- esac
-
-
- # See if we need to build an old-fashioned archive.
- if test "$build_old_libs" = "yes"; then
- # Now set the variables for building old libraries.
- oldlib="$objdir/$libname.a"
-
- # Transform .lo files to .o files.
- oldobjs="$objs"`$echo "$libobjs " | sed -e 's/[^ ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
-
- if test -d "$objdir"; then
- $show "$rm $oldlib"
- $run $rm $oldlib
- else
- $show "$mkdir $objdir"
- $run $mkdir $objdir
- fi
-
- # Do each command in the archive commands.
- if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
- cmds=`eval \\$echo \"$old_archive_from_new_cmds\"`
- else
- cmds=`eval \\$echo \"$old_archive_cmds\"`
- fi
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- fi
-
- # Now create the libtool archive.
- case "$output" in
- *.la)
- old_library=
- test "$build_old_libs" = yes && old_library="$libname.a"
-
- $show "creating $output"
-
- # Only create the output if not a dry run.
- if test -z "$run"; then
- cat > $output <<EOF
-# $output - a libtool library file
-# Generated by ltmain.sh - GNU $PACKAGE $VERSION
-
-# The name that we can dlopen(3).
-dlname='$dlname'
-
-# Names of this library.
-library_names='$library_names'
-
-# The name of the static archive.
-old_library='$old_library'
-
-# Version information for $libname.
-current=$current
-age=$age
-revision=$revision
-
-# Directory that this library needs to be installed in:
-libdir='$install_libdir'
-EOF
- fi
-
- # Do a symbolic link so that the libtool archive can be found in
- # LD_LIBRARY_PATH before the program is installed.
- $show "(cd $objdir && $LN_S ../$output $output)"
- $run eval "(cd $objdir && $LN_S ../$output $output)" || exit 1
- ;;
- esac
- exit 0
- ;;
-
- # libtool install mode
- install)
- progname="$progname: install"
-
- # There may be an optional /bin/sh argument at the beginning of
- # install_prog (especially on Windows NT).
- if test "$nonopt" = "$SHELL"; then
- # Aesthetically quote it.
- arg=`$echo "$nonopt" | sed "$sed_quote_subst"`
- case "$arg" in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- arg="\"$arg\""
- ;;
- esac
- install_prog="$arg "
- arg="$1"
- shift
- else
- install_prog=
- arg="$nonopt"
- fi
-
- # The real first argument should be the name of the installation program.
- # Aesthetically quote it.
- arg=`$echo "$arg" | sed "$sed_quote_subst"`
- case "$arg" in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- arg="\"$arg\""
- ;;
- esac
- install_prog="$install_prog$arg"
-
- # We need to accept at least all the BSD install flags.
- dest=
- files=
- opts=
- prev=
- install_type=
- isdir=
- stripme=
- for arg
- do
- if test -n "$dest"; then
- files="$files $dest"
- dest="$arg"
- continue
- fi
-
- case "$arg" in
- -d) isdir=yes ;;
- -f) prev="-f" ;;
- -g) prev="-g" ;;
- -m) prev="-m" ;;
- -o) prev="-o" ;;
- -s)
- stripme=" -s"
- continue
- ;;
- -*) ;;
-
- *)
- # If the previous option needed an argument, then skip it.
- if test -n "$prev"; then
- prev=
- else
- dest="$arg"
- continue
- fi
- ;;
- esac
-
- # Aesthetically quote the argument.
- arg=`$echo "$arg" | sed "$sed_quote_subst"`
- case "$arg" in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- arg="\"$arg\""
- ;;
- esac
- install_prog="$install_prog $arg"
- done
-
- if test -z "$install_prog"; then
- $echo "$progname: you must specify an install program" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- if test -n "$prev"; then
- $echo "$progname: the \`$prev' option requires an argument" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- if test -z "$files"; then
- if test -z "$dest"; then
- $echo "$progname: no file or destination specified" 1>&2
- else
- $echo "$progname: you must specify a destination" 1>&2
- fi
- $echo "$help" 1>&2
- exit 1
- fi
-
- # Strip any trailing slash from the destination.
- dest=`$echo "$dest" | sed 's%/$%%'`
-
- # Check to see that the destination is a directory.
- test -d "$dest" && isdir=yes
- if test -n "$isdir"; then
- destdir="$dest"
- destname=
- else
- destdir=`$echo "$dest" | sed 's%/[^/]*$%%'`
- test "X$destdir" = "X$dest" && destdir=.
- destname=`$echo "$dest" | sed 's%^.*/%%'`
-
- # Not a directory, so check to see that there is only one file specified.
- set dummy $files
- if test $# -gt 2; then
- $echo "$progname: \`$dest' is not a directory" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
- fi
- case "$destdir" in
- /*) ;;
- *)
- for file in $files; do
- case "$file" in
- *.lo) ;;
- *)
- $echo "$progname: \`$destdir' must be an absolute directory name" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
- esac
- done
- ;;
- esac
-
- # This variable tells wrapper scripts just to set variables rather
- # than running their programs.
- libtool_install_magic="$magic"
-
- staticlibs=
- future_libdirs=
- current_libdirs=
- for file in $files; do
-
- # Do each installation.
- case "$file" in
- *.a)
- # Do the static libraries later.
- staticlibs="$staticlibs $file"
- ;;
-
- *.la)
- # Check to see that this really is a libtool archive.
- if egrep '^# Generated by ltmain.sh' $file >/dev/null 2>&1; then :
- else
- $echo "$progname: \`$file' is not a valid libtool archive" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- library_names=
- old_library=
- # If there is no directory component, then add one.
- case "$file" in
- */*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Add the libdir to current_libdirs if it is the destination.
- if test "X$destdir" = "X$libdir"; then
- case "$current_libdirs " in
- *" $libdir "*) ;;
- *) current_libdirs="$current_libdirs $libdir" ;;
- esac
- else
- # Note the libdir as a future libdir.
- case "$future_libdirs " in
- *" $libdir "*) ;;
- *) future_libdirs="$future_libdirs $libdir" ;;
- esac
- fi
-
- dir="`$echo "$file" | sed 's%/[^/]*$%%'`/"
- test "X$dir" = "X$file/" && dir=
- dir="$dir$objdir"
-
- # See the names of the shared library.
- set dummy $library_names
- if test -n "$2"; then
- realname="$2"
- shift
- shift
-
- # Install the shared library and build the symlinks.
- $show "$install_prog $dir/$realname $destdir/$realname"
- $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
- test "X$dlname" = "X$realname" && dlname=
-
- # Support stripping libraries.
- if test -n "$stripme"; then
- if test -n "$striplib"; then
- $show "$striplib $destdir/$realname"
- $run $striplib $destdir/$realname || exit $?
- else
- $echo "$progname: warning: no library stripping program" 1>&2
- fi
- fi
-
- if test $# -gt 0; then
- # Delete the old symlinks.
- rmcmd="$rm"
- for linkname
- do
- rmcmd="$rmcmd $destdir/$linkname"
- done
- $show "$rmcmd"
- $run $rmcmd
-
- # ... and create new ones.
- for linkname
- do
- test "X$dlname" = "X$linkname" && dlname=
- $show "(cd $destdir && $LN_S $realname $linkname)"
- $run eval "(cd $destdir && $LN_S $realname $linkname)"
- done
- fi
-
- if test -n "$dlname"; then
- # Install the dynamically-loadable library.
- $show "$install_prog $dir/$dlname $destdir/$dlname"
- $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $?
- fi
-
- # Do each command in the postinstall commands.
- lib="$destdir/$realname"
- cmds=`eval \\$echo \"$postinstall_cmds\"`
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- fi
-
- # Install the pseudo-library for information purposes.
- name=`$echo "$file" | sed 's%^.*/%%'`
- $show "$install_prog $file $destdir/$name"
- $run eval "$install_prog $file $destdir/$name" || exit $?
-
- # Maybe install the static library, too.
- test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
- ;;
-
- *.lo)
- # Install (i.e. copy) a libtool object.
-
- # Figure out destination file name, if it wasn't already specified.
- if test -n "$destname"; then
- destfile="$destdir/$destname"
- else
- destfile=`$echo "$file" | sed 's%^.*/%%'`
- destfile="$destdir/$destfile"
- fi
-
- # Deduce the name of the destination old-style object file.
- case "$destfile" in
- *.lo)
- staticdest=`$echo "$destfile" | sed 's/\.lo$/\.o/'`
- ;;
- *.o)
- staticdest="$destfile"
- destfile=
- ;;
- *)
- $echo "$progname: cannot copy a libtool object to \`$destfile'" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
- esac
-
- # Install the libtool object if requested.
- if test -n "$destfile"; then
- $show "$install_prog $file $destfile"
- $run eval "$install_prog $file $destfile" || exit $?
- fi
-
- # Install the old object if enabled.
- if test "$build_old_libs" = yes; then
- # Deduce the name of the old-style object file.
- staticobj=`$echo "$file" | sed 's/\.lo$/\.o/'`
-
- $show "$install_prog $staticobj $staticdest"
- $run eval "$install_prog \$staticobj \$staticdest" || exit $?
- fi
- exit 0
- ;;
-
- *)
- # Do a test to see if this is really a libtool program.
- if egrep '^# Generated by ltmain.sh' $file >/dev/null 2>&1; then
- link_against_libtool_libs=
- finalize_command=
-
- # If there is no directory component, then add one.
- case "$file" in
- */*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Check the variables that should have been set.
- if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then
- $echo "$progname: invalid libtool wrapper script \`$file'" 1>&2
- exit 1
- fi
-
- finalize=yes
- for lib in $link_against_libtool_libs; do
- # Check to see that each library is installed.
- libdir=
- if test -f "$lib"; then
- # If there is no directory component, then add one.
- case "$lib" in
- */*) . $lib ;;
- *) . ./$lib ;;
- esac
- fi
- libfile="$libdir/`$echo "$lib" | sed 's%^.*/%%g'`"
- if test -z "$libdir"; then
- $echo "$progname: warning: \`$lib' contains no -rpath information" 1>&2
- elif test -f "$libfile"; then :
- else
- $echo "$progname: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
- finalize=no
- fi
- done
-
- if test "$hardcode_action" = relink; then
- if test "$finalize" = yes; then
- $echo "$progname: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
- $show "$finalize_command"
- if $run eval "$finalize_command"; then :
- else
- $echo "$progname: error: relink \`$file' with the above command before installing it" 1>&2
- continue
- fi
- file="$objdir/$file"T
- else
- $echo "$progname: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
- fi
- else
- # Install the binary that we compiled earlier.
- file=`$echo "$file" | sed "s%\([^/]*\)$%$objdir/\1%"`
- fi
- fi
-
- $show "$install_prog$stripme $file $dest"
- $run eval "$install_prog\$stripme \$file \$dest" || exit $?
- ;;
- esac
- done
-
- for file in $staticlibs; do
- name=`$echo "$file" | sed 's%^.*/%%'`
-
- # Set up the ranlib parameters.
- oldlib="$destdir/$name"
-
- $show "$install_prog $file $oldlib"
- $run eval "$install_prog \$file \$oldlib" || exit $?
-
- # Support stripping libraries.
- if test -n "$stripme"; then
- if test -n "$old_striplib"; then
- $show "$old_striplib $oldlib"
- $run $old_striplib $oldlib || exit $?
- else
- $echo "$progname: warning: no static library stripping program" 1>&2
- fi
- fi
-
- # Do each command in the postinstall commands.
- cmds=`eval \\$echo \"$old_postinstall_cmds\"`
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- done
-
- if test -n "$future_libdirs"; then
- $echo "$progname: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
- fi
-
- if test -n "$current_libdirs"; then
- # Maybe just do a dry run.
- test -n "$run" && current_libdirs=" -n$current_libdirs"
- exec $SHELL $0 --finish$current_libdirs
- exit 1
- fi
-
- exit 0
- ;;
-
- # libtool finish mode
- finish)
- progname="$progname: finish"
- libdirs="$nonopt"
-
- if test -n "$finish_cmds" && test -n "$libdirs"; then
- for dir
- do
- libdirs="$libdirs $dir"
- done
-
- for libdir in $libdirs; do
- # Do each command in the postinstall commands.
- cmds=`eval \\$echo \"$finish_cmds\"`
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd"
- done
- IFS="$save_ifs"
- done
- fi
-
- $echo "To link against installed libraries in LIBDIR, users may have to:"
- if test -n "$shlibpath_var"; then
- $echo " - add LIBDIR to their \`$shlibpath_var' environment variable"
- fi
- $echo " - use the \`-LLIBDIR' linker flag"
- exit 0
- ;;
-
- # libtool execute mode
- execute)
- progname="$progname: execute"
-
- # The first argument is the command name.
- cmd="$nonopt"
- if test -z "$cmd"; then
- $echo "$progname: you must specify a COMMAND" 1>&2
- $echo "$help"
- exit 1
- fi
-
- # Handle -dlopen flags immediately.
- for file in $execute_dlfiles; do
- if test -f "$file"; then :
- else
- $echo "$progname: \`$file' is not a file" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- dir=
- case "$file" in
- *.la)
- # Check to see that this really is a libtool archive.
- if egrep '^# Generated by ltmain.sh' $file >/dev/null 2>&1; then :
- else
- $echo "$progname: \`$lib' is not a valid libtool archive" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- # Read the libtool library.
- dlname=
- library_names=
-
- # If there is no directory component, then add one.
- case "$file" in
- */*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Skip this library if it cannot be dlopened.
- if test -z "$dlname"; then
- # Warn if it was a shared library.
- test -n "$library_names" && $echo "$progname: warning: \`$file' was not linked with \`-export-dynamic'"
- continue
- fi
-
- dir=`$echo "$file" | sed 's%/[^/]*$%%'`
- test "X$dir" = "X$file" && dir=.
-
- if test -f "$dir/$objdir/$dlname"; then
- dir="$dir/$objdir"
- else
- $echo "$progname: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
- exit 1
- fi
- ;;
-
- *.lo)
- # Just add the directory containing the .lo file.
- dir=`$echo "$file" | sed 's%/[^/]*$%%'`
- test "X$dir" = "X$file" && dir=.
- ;;
-
- *)
- $echo "$progname: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
- continue
- ;;
- esac
-
- # Get the absolute pathname.
- absdir=`cd "$dir" && pwd`
- test -n "$absdir" && dir="$absdir"
-
- # Now add the directory to shlibpath_var.
- if eval "test -z \"\$$shlibpath_var\""; then
- eval "$shlibpath_var=\"\$dir\""
- else
- eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
- fi
- done
-
- # This variable tells wrapper scripts just to set shlibpath_var
- # rather than running their programs.
- libtool_execute_magic="$magic"
-
- # Check if any of the arguments is a wrapper script.
- args=
- for file
- do
- case "$file" in
- -*) ;;
- *)
- if egrep '^# Generated by ltmain.sh' $file >/dev/null 2>&1; then
- # If there is no directory component, then add one.
- case "$file" in
- */*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Transform arg to wrapped name.
- file="$progdir/$program"
- fi
- ;;
- esac
- # Quote arguments (to preserve shell metacharacters).
- file=`$echo "$file" | sed "$sed_quote_subst"`
- args="$args \"$file\""
- done
-
- if test -z "$run"; then
- # Export the shlibpath_var.
- eval "export $shlibpath_var"
-
- # Now actually exec the command.
- eval "exec \$cmd$args"
-
- $echo "$progname: cannot exec \$cmd$args"
- exit 1
- else
- # Display what would be done.
- eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
- $echo "export $shlibpath_var"
- $echo "$cmd$args"
- exit 0
- fi
- ;;
-
- # libtool uninstall mode
- uninstall)
- progname="$progname: uninstall"
- rm="$nonopt"
- files=
-
- for arg
- do
- case "$arg" in
- -*) rm="$rm $arg" ;;
- *) files="$files $arg" ;;
- esac
- done
-
- if test -z "$rm"; then
- $echo "$progname: you must specify an RM program" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- for file in $files; do
- dir=`$echo "$file" | sed -e 's%/[^/]*$%%'`
- test "X$dir" = "X$file" && dir=.
- name=`$echo "$file" | sed -e 's%^.*/%%'`
-
- rmfiles="$file"
-
- case "$name" in
- *.la)
- # Possibly a libtool archive, so verify it.
- if egrep '^# Generated by ltmain.sh' $file >/dev/null 2>&1; then
- . $dir/$name
-
- # Delete the libtool libraries and symlinks.
- for n in $library_names; do
- rmfiles="$rmfiles $dir/$n"
- test "X$n" = "X$dlname" && dlname=
- done
- test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
- test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
-
- # FIXME: should reinstall the best remaining shared library.
- fi
- ;;
-
- *.lo)
- if test "$build_old_libs" = yes; then
- oldobj=`$echo "$name" | sed 's/\.lo$/\.o/'`
- rmfiles="$rmfiles $dir/$oldobj"
- fi
- ;;
- esac
-
- $show "$rm $rmfiles"
- $run $rm $rmfiles
- done
- exit 0
- ;;
-
- "")
- $echo "$progname: you must specify a MODE" 1>&2
- $echo "$generic_help" 1>&2
- exit 1
- ;;
- esac
-
- $echo "$progname: invalid operation mode \`$mode'" 1>&2
- $echo "$generic_help" 1>&2
- exit 1
-fi # test -z "$show_help"
-
-# We need to display help for each of the modes.
-case "$mode" in
-"") cat <<EOF
-Usage: $progname [OPTION]... [MODE-ARG]...
-
-Provide generalized library-building support services.
-
--n, --dry-run display commands without modifying any files
- --features display configuration information and exit
- --finish same as \`--mode=finish'
- --help display this help message and exit
- --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
- --quiet same as \`--silent'
- --silent don't print informational messages
- --version print version information
-
-MODE must be one of the following:
-
- compile compile a source file into a libtool object
- execute automatically set library path, then run a program
- finish complete the installation of libtool libraries
- install install libraries or executables
- link create a library or an executable
- uninstall remove libraries from an installed directory
-
-MODE-ARGS vary depending on the MODE. Try \`$progname --help --mode=MODE' for
-a more detailed description of MODE.
-EOF
- ;;
-
-compile)
- cat <<EOF
-Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
-
-Compile a source file into a libtool library object.
-
-COMPILE-COMMAND is a command to be used in creating a \`standard' object file
-from the given SOURCEFILE.
-
-The output file name is determined by removing the directory component from
-SOURCEFILE, then substituting the C source code suffix \`.c' with the
-library object suffix, \`.lo'.
-EOF
- ;;
-
-execute)
- cat <<EOF
-Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
-
-Automatically set library path, then run a program.
-
-This mode accepts the following additional options:
-
- -dlopen FILE add the directory containing FILE to the library path
-
-This mode sets the library path environment variable according to \`-dlopen'
-flags.
-
-If any of the ARGS are libtool executable wrappers, then they are translated
-into their corresponding uninstalled binary, and any of their required library
-directories are added to the library path.
-
-Then, COMMAND is executed, with ARGS as arguments.
-EOF
- ;;
-
-finish)
- cat <<EOF
-Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
-
-Complete the installation of libtool libraries.
-
-Each LIBDIR is a directory that contains libtool libraries.
-
-The commands that this mode executes may require superuser privileges. Use
-the \`--dry-run' option if you just want to see what would be executed.
-EOF
- ;;
-
-install)
- cat <<EOF
-Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
-
-Install executables or libraries.
-
-INSTALL-COMMAND is the installation command. The first component should be
-either the \`install' or \`cp' program.
-
-The rest of the components are interpreted as arguments to that command (only
-BSD-compatible install options are recognized).
-EOF
- ;;
-
-link)
- cat <<EOF
-Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
-
-Link object files or libraries together to form another library, or to
-create an executable program.
-
-LINK-COMMAND is a command using the C compiler that you would use to create
-a program from several object files.
-
-The following components of LINK-COMMAND are treated specially:
-
- -all-static do not do any dynamic linking at all
- -allow-undefined allow a libtool library to reference undefined symbols
- -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
- -dlpreopen FILE link in FILE and add its symbols to dld_preloaded_symbols
- -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
- -LLIBDIR search LIBDIR for required installed libraries
- -lNAME OUTPUT-FILE requires the installed library libNAME
- -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
- -rpath LIBDIR the created library will eventually be installed in LIBDIR
- -static do not do any dynamic linking of libtool libraries
- -version-info CURRENT[:REVISION[:AGE]]
- specify library version info [each variable defaults to 0]
-
-All other options (arguments beginning with \`-') are ignored.
-
-Every other argument is treated as a filename. Files ending in \`.la' are
-treated as uninstalled libtool libraries, other files are standard or library
-object files.
-
-If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only
-library objects (\`.lo' files) may be specified, and \`-rpath' is required.
-
-If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar'
-and \`ranlib'.
-
-If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is
-created, otherwise an executable program is created.
-EOF
- ;;
-
-uninstall)
- cat <<EOF
-Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
-
-Remove libraries from an installation directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, all the files associated with it are deleted.
-Otherwise, only FILE itself is deleted using RM.
-EOF
- ;;
-
-*)
- $echo "$progname: invalid operation mode \`$mode'" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
-esac
-
-$echo
-$echo "Try \`$progname --help' for more information about other modes."
-
-exit 0
-
-# Local Variables:
-# mode:shell-script
-# sh-indentation:2
-# End:
diff --git a/makecopyright b/makecopyright
deleted file mode 100755
index 5e17fd329e..0000000000
--- a/makecopyright
+++ /dev/null
@@ -1,124 +0,0 @@
-#!/bin/sh
-
-
-copyright_glib ()
-{
- cat << EOF
-/* GLIB - Library of useful routines for C programming
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-EOF
-}
-
-copyright_gdk ()
-{
- cat << EOF
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-EOF
-}
-
-copyright_gtk ()
-{
- cat << EOF
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-EOF
-}
-
-copyright_interp ()
-{
- cat << EOF
-/* GTK Interp - The GTK Interpreter
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-EOF
-}
-
-
-exclude_files="./glib/gconfig.h"
-
-for file in `find . -name "*.[ch]" -print`; do
- exclude=`echo $exclude_files | grep $file`
-
- if test "x$exclude" = "x"; then
- dir=`dirname $file`
- if test "x$dir" != "x."; then
- subdir=`basename $dir`
-
- grepout=`grep Copyright $file`
- if test "x$grepout" = "x"; then
- backup_dir="$dir/bak"
- if test ! -d $backup_dir; then
- echo "making directory: $backup_dir"
- mkdir $backup_dir
- fi
-
- echo $file
-
- filename=`basename $file`
- cp $file $backup_dir/$filename
- copyright_$subdir > $file
- cat $backup_dir/$filename >> $file
- fi
- fi
- fi
-done
diff --git a/missing b/missing
deleted file mode 100755
index e4b838ca92..0000000000
--- a/missing
+++ /dev/null
@@ -1,134 +0,0 @@
-#! /bin/sh
-# Common stub for a few missing GNU programs while installing.
-# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
-# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
-if test $# -eq 0; then
- echo 1>&2 "Try \`$0 --help' for more information"
- exit 1
-fi
-
-case "$1" in
-
- -h|--h|--he|--hel|--help)
- echo "\
-$0 [OPTION]... PROGRAM [ARGUMENT]...
-
-Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
-error status if there is no known handling for PROGRAM.
-
-Options:
- -h, --help display this help and exit
- -v, --version output version information and exit
-
-Supported PROGRAM values:
- aclocal touch file \`aclocal.m4'
- autoconf touch file \`configure'
- autoheader touch file \`config.h.in'
- automake touch all \`Makefile.in' files
- bison touch file \`y.tab.c'
- makeinfo touch the output file
- yacc touch file \`y.tab.c'"
- ;;
-
- -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
- echo "missing - GNU libit 0.0"
- ;;
-
- -*)
- echo 1>&2 "$0: Unknown \`$1' option"
- echo 1>&2 "Try \`$0 --help' for more information"
- exit 1
- ;;
-
- aclocal)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. It should be needed only if
- you modified \`acinclude.m4' or \`configure.in'. You might want
- to install the \`Automake' and \`Perl' packages. Grab them from
- any GNU archive site."
- touch aclocal.m4
- ;;
-
- autoconf)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. It should be needed only if
- you modified \`configure.in'. You might want to install the
- \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
- archive site."
- touch configure
- ;;
-
- autoheader)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. It should be needed only if
- you modified \`acconfig.h' or \`configure.in'. You might want
- to install the \`Autoconf' and \`GNU m4' packages. Grab them
- from any GNU archive site."
- touch config.h.in
- ;;
-
- automake)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. It should be needed only if
- you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
- You might want to install the \`Automake' and \`Perl' packages.
- Grab them from any GNU archive site."
- find . -type f -name Makefile.am -print \
- | sed 's/^\(.*\).am$/touch \1.in/' \
- | sh
- ;;
-
- bison|yacc)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. It should be needed only if
- your modified any \`.y' file. For being effective, your
- modifications might require the \`Bison' package. Grab it from
- any GNU archive site."
- touch y.tab.c
- ;;
-
- makeinfo)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. It should be needed only if
- you modified a \`.texi' or \`.texinfo' file, or any other file
- indirectly affecting the aspect of the manual. The spurious
- call might also be the consequence of using a buggy \`make' (AIX,
- DU, IRIX). You might want to install the \`Texinfo' package or
- the \`GNU make' package. Grab either from any GNU archive site."
- file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
- if test -z "$file"; then
- file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
- file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
- fi
- touch $file
- ;;
-
- *)
- echo 1>&2 "\
-WARNING: \`$1' is needed, and you do not seem to have it handy on your
- system. You might have modified some files without having the
- proper tools for further handling them. Check the \`README' file,
- it often tells you about the needed prerequirements for installing
- this package. You may also peek at any GNU archive site, in case
- some other package would contain this missing \`$1' program."
- exit 1
- ;;
-esac
-
-exit 0
diff --git a/mkinstalldirs b/mkinstalldirs
deleted file mode 100755
index fef1eb9418..0000000000
--- a/mkinstalldirs
+++ /dev/null
@@ -1,36 +0,0 @@
-#! /bin/sh
-# mkinstalldirs --- make directory hierarchy
-# Author: Noah Friedman <friedman@prep.ai.mit.edu>
-# Created: 1993-05-16
-# Last modified: 1994-03-25
-# Public domain
-
-errstatus=0
-
-for file in ${1+"$@"} ; do
- set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
- shift
-
- pathcomp=
- for d in ${1+"$@"} ; do
- pathcomp="$pathcomp$d"
- case "$pathcomp" in
- -* ) pathcomp=./$pathcomp ;;
- esac
-
- if test ! -d "$pathcomp"; then
- echo "mkdir $pathcomp" 1>&2
- mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$?
- fi
-
- if test ! -d "$pathcomp"; then
- errstatus=$lasterr
- fi
-
- pathcomp="$pathcomp/"
- done
-done
-
-exit $errstatus
-
-# mkinstalldirs ends here
diff --git a/stamp-h.in b/stamp-h.in
deleted file mode 100644
index 9788f70238..0000000000
--- a/stamp-h.in
+++ /dev/null
@@ -1 +0,0 @@
-timestamp
diff --git a/tests/3DRings.xpm b/tests/3DRings.xpm
deleted file mode 100644
index 1ca75da752..0000000000
--- a/tests/3DRings.xpm
+++ /dev/null
@@ -1,116 +0,0 @@
-/* XPM */
-static char * DRings_xpm[] = {
-"48 48 65 1",
-" c None",
-". c #104010404103",
-"X c #1040208130C2",
-"o c #104014515144",
-"O c #000010402081",
-"+ c #1040104030C2",
-"@ c #208120815144",
-"# c #28A241035965",
-"$ c #30C230C26185",
-"% c #208130C24103",
-"& c #104010402081",
-"* c #104000002081",
-"= c #000010401040",
-"- c #492441036185",
-"; c #596559659E79",
-": c #30C220815144",
-"> c #0820186128A2",
-", c #000000001040",
-"< c #2081104030C2",
-"1 c #514459659658",
-"2 c #514455556185",
-"3 c #104000001040",
-"4 c #000008200000",
-"5 c #618569A6AEBA",
-"6 c #618569A69658",
-"7 c #410345148E38",
-"8 c #104020814103",
-"9 c #79E782079658",
-"0 c #208120814103",
-"q c #596571C69E79",
-"w c #4103514471C6",
-"e c #2081208130C2",
-"r c #6185618571C6",
-"t c #28A228A25965",
-"y c #596561858617",
-"u c #96589E79BEFB",
-"i c #28A230C271C6",
-"p c #38E345145144",
-"a c #79E78207A699",
-"s c #30C2492469A6",
-"d c #410330C25965",
-"f c #410351446185",
-"g c #AEBAAAAAD75C",
-"h c #38E338E34103",
-"j c #EFBEEBADEFBE",
-"k c #208130C25144",
-"l c #9658A289DF7D",
-"z c #208110404103",
-"x c #28A228A26185",
-"c c #8E388A28BEFB",
-"v c #208118612081",
-"b c #38E3451479E7",
-"n c #4924618579E7",
-"m c #86178617B6DA",
-"M c #30C220814103",
-"N c #104030C25144",
-"B c #4103410371C6",
-"V c #86178A28D75C",
-"C c #DF7DDB6CE79D",
-"Z c #BEFBC30BD75C",
-"A c #410330C271C6",
-"S c #30C228A230C2",
-"D c #082008201861",
-"F c #186130C238E3",
-"G c #0000208130C2",
-" .Xo ",
-" O+O@#$% ",
-" &*=+X-;: ",
-" >&=,=<11#2 ",
-" +O34,X567& ",
-" 8X+=,90q9w. ",
-" +e<>3r tyu-& ",
-" Xi%.= paus+ ",
-" Od-@= fga$h ",
-" @y7X, Xrjak ",
-" 2:eaw+ $ag;@ ",
-" .X@8@k@o@X+ +pl9tO ",
-" +zX@x$$isikt8o02crv ",
-" 8@%ip7757ywbs$Ohn6#. ",
-" &0%$p7r215ybw1pzp2-0= ",
-" 8tk$#yw21665n;1+%-p$O ",
-" O<e7pbryq5am9ay6XMpM>3& ",
-" 9.NtpBw16amclVcm1t%kX*88 ",
-" +&etd7r6y9ulgglm6>e>3s@83 ",
-" +0k$y-y69cgCCCZVam%+#ik8X ",
-" O&oi$d725amgCjCZu962ybtx8+p ",
-" &X0x$sBym9VZCCCZca;yBbi%08& ",
-" =++@sApMy5muZZgum6y2wds:>+& ",
-" #tp;1;yB#i25cVucma5;w-pti@8& ",
-" .#2alumnBp:@1r59y9y6ywBS$%0X+= ",
-" %$wmZVu;#tX8X07r1656y2wbp$k@%@OD ",
-" 0Byc9a;h%0>&D&hBrr2r1bwB-AF:0<&*= ",
-" kBf;yr#@X+&<%MkhsBwBwpsB#Bktkt8+Oh ",
-" xt7B-t8*,3O.X00:$i#dBd#bptFek0X.+* ",
-" Xt#b#@=, =&O+X0Ft%ibsp$p$ki%l5sX&= ",
-" &<kvX&4 +O*&<X0e:%$pAti%:edugn0= ",
-" +X@&+, V,O&>+Xt>tktktv0%@k;Cls+ ",
-" =+O*4*X:p;9cy3&&8ve0FMtt$ee0>z7cZ6k ",
-" D=D4,=.k$sBs$ee=+X0Fk%-#t%0X&O0nu9bG ",
-" ,,434*&ze@F<eeeeee><tdhdSMe<&&XAaawx ",
-" 4,4,=+><peeeeee&=<%M%$hSF0X&O&kw5r%Z ",
-" D&vSFMF<>&D =0S-2i& ",
-" +>puB> >0h7s. ",
-" SM5VqM &0t#$8 ",
-" XpVV70 &0kMk. ",
-" XdyB%z *X<%@+ ",
-" &k$b0X+=8X08o ",
-" &e:e+=*X.X+& ",
-" +X.O+X0O.=, ",
-" +>&+0>3&* ",
-" &X0k+O, ",
-" >v,3 ",
-" "};
diff --git a/tests/FilesQueue.xpm b/tests/FilesQueue.xpm
deleted file mode 100644
index 586d27ec43..0000000000
--- a/tests/FilesQueue.xpm
+++ /dev/null
@@ -1,98 +0,0 @@
-/* XPM */
-static char * FilesQueue_xpm[] = {
-"44 31 64 1",
-" c None",
-". c #E79DE38DDF7D",
-"X c #CF3CC71BCF3C",
-"o c #71C675D671C6",
-"O c #B6DAB2CAB6DA",
-"+ c #CF3CD34CCF3C",
-"@ c #DF7DE38DE79D",
-"# c #FFFFFBEEFFFF",
-"$ c #EFBEEFBEEFBE",
-"% c #DF7DDB6CDF7D",
-"& c #BEFBBAEAC71B",
-"* c #BEFBBAEABEFB",
-"= c #BEFBC30BC71B",
-"- c #71C66DB671C6",
-"; c #D75CD34CD75C",
-": c #9E799A699E79",
-"> c #E79DE38DE79D",
-", c #CF3CCB2BC71B",
-"< c #B6DAB2CABEFB",
-"1 c #BEFBBAEAB6DA",
-"2 c #B6DAB6DAB6DA",
-"3 c #618561856185",
-"4 c #C71BBAEABEFB",
-"5 c #AEBAAAAAAEBA",
-"6 c #965892488E38",
-"7 c #A699A699A699",
-"8 c #38E338E338E3",
-"9 c #F7DEF7DEF7DE",
-"0 c #E79DEFBEEFBE",
-"q c #DF7DE38DDF7D",
-"w c #C71BC71BC71B",
-"e c #C71BC30BBEFB",
-"r c #BEFBC30BBEFB",
-"t c #B6DAAAAAAEBA",
-"y c #410345144103",
-"u c #D75CDB6CD75C",
-"i c #C71BCB2BC71B",
-"p c #BEFBCB2BBEFB",
-"a c #9E79A289A699",
-"s c #86178E388E38",
-"d c #CF3CCF3CD75C",
-"f c #CF3CD75CCF3C",
-"g c #C71BC30BCF3C",
-"h c #28A22CB228A2",
-"j c #000000000000",
-"k c #D75CD34CDF7D",
-"l c #10400C300820",
-"z c #E79DEBADEFBE",
-"x c #DF7DDB6CD75C",
-"c c #514459655965",
-"v c #8617861779E7",
-"b c #DF7DD34CD75C",
-"n c #CF3CCB2BCF3C",
-"m c #618555555965",
-"M c #861786178617",
-"N c #30C234D330C2",
-"B c #EFBEEBADE79D",
-"V c #DF7DDB6CE79D",
-"C c #D75CE38DD75C",
-"Z c #514449245144",
-"A c #186120812081",
-"S c #79E77DF779E7",
-"D c #6185659569A6",
-"F c #9E7992489E79",
-" .XoOX+ ",
-" @#$%&*=-o;: ",
-" @>,=O<12*&:-<3X ",
-" >%&1*4*2*OO**56758790 ",
-" 9qX+we=r*&e<<<251t5555yu9 ",
-" $qu++;ipi=p*=p**2tOOO27a5s<- ",
-" #9udfXi;,gi&**4**4r*Ot5t55tehj ",
-" 0qku+u;+d,gg=*=r*&**&<255t<*yl1 ",
-" $$zq@%xk%uf;,w,i=i=e**r=12tO1=8cvj ",
-" $@%>.%.%%%xbkx,w+ni,wwrwe*4*1=;8mMNj ",
-" zz@Bz>>>V%%%C+u;;dfnnfwggi&=&X+yZsNll ",
-" af#9@B0>q>qqq>xk.;;;kfX+XnXw=g,fycMhhN5 ",
-" al5#9$$>qzBV.%x%%b;x+fnf+,X,iiqym6NAo-j ",
-" #roS%#$zz>>V%%xkk%f;;+df,XnwnVZD:8AS-j* ",
-" D-9Oy*9$Bz>q%qx%%u;x;;dknX+d>Zm:hhSDjr ",
-" a3o+>S3z#90@@z.%>qCC%uu;ff%@Zm:NhMoj= ",
-" wlvvo#:3599$>B>q>%%%%+f;fk$ymaalMvjr ",
-" 0.a--S49mct9$z@.qkkqC;xu%@Zm5AlvSj* ",
-" ohu%3:Z:9@y609q@@>..>Cx>$Zm5NhMvjr ",
-" -j797Zv5705y=#$0>>V.%>#Z378AMMj* ",
-" Zj9Xo-McBXDv%90.%%#9cc78AsMj* ",
-" 8hM#M-DSF96cvz0>z#c35Nhs6j1 ",
-" jl9#o63vx#-D###mmt8N66j* ",
-" 5jc@fZF3o%+ZFDm<8A6FjO ",
-" :j50sSay<$ss2Nh:FjO ",
-" 6880&SDMF.rNNFFj1 ",
-" 8jr#:SFScA6ajO ",
-" Alr$DSysajO ",
-" >jy#51:jO ",
-" %Dy*gjO ",
-" alla "};
diff --git a/tests/Modeller.xpm b/tests/Modeller.xpm
deleted file mode 100644
index 62e27f9853..0000000000
--- a/tests/Modeller.xpm
+++ /dev/null
@@ -1,117 +0,0 @@
-/* XPM */
-static char * InterfaceModeller_app_2_Tile_xpm[] = {
-"48 48 66 1",
-" c None",
-". c #86174D344103",
-"X c #69A651445144",
-"o c #8617410330C2",
-"O c #69A6410338E3",
-"+ c #30C218611861",
-"@ c #AEBA6DB66185",
-"# c #71C638E328A2",
-"$ c #69A634D328A2",
-"% c #30C228A228A2",
-"& c #79E73CF330C2",
-"* c #BEFB9E799E79",
-"= c #8E3869A66185",
-"- c #514424921861",
-"; c #A699A289B6DA",
-": c #A6999E79A699",
-"> c #71C65D756185",
-", c #9E799A69A699",
-"< c #8E3882078E38",
-"1 c #861779E78617",
-"2 c #A6999A69AEBA",
-"3 c #8E388A289658",
-"4 c #71C675D679E7",
-"5 c #96588A289E79",
-"6 c #30C230C238E3",
-"7 c #C71BC71BC71B",
-"8 c #9E79A289AEBA",
-"9 c #AEBAAAAABEFB",
-"0 c #96589248A699",
-"q c #A699AAAAB6DA",
-"w c #AEBAAAAAB6DA",
-"e c #D75CD34CD75C",
-"r c #EFBEE79DEFBE",
-"t c #BEFBB6DABEFB",
-"y c #B6DABAEAC71B",
-"u c #AEBAAEBAB6DA",
-"i c #E79DDB6CDF7D",
-"p c #96588E389658",
-"a c #596559656185",
-"s c #AEBA8E388E38",
-"d c #CF3CCB2BCF3C",
-"f c #9E799A699E79",
-"g c #86177DF78E38",
-"h c #69A6659571C6",
-"j c #AEBAAEBABEFB",
-"k c #96589E799E79",
-"l c #B6DAA699A699",
-"z c #E79DC71BC71B",
-"x c #B6DAB6DAB6DA",
-"c c #861786179658",
-"v c #B6DAB2CABEFB",
-"b c #BEFBAAAAAEBA",
-"n c #C71BBEFBC71B",
-"m c #514441034103",
-"M c #41033CF34103",
-"N c #492428A228A2",
-"B c #AEBAA289B6DA",
-"V c #618530C22081",
-"C c #69A630C228A2",
-"Z c #69A630C22081",
-"A c #596528A22081",
-"S c #492428A22081",
-"D c #618528A22081",
-"F c #596520811861",
-"G c #69A628A22081",
-"H c #FFFF14514103",
-" .X ",
-" .oO+ ",
-" @.o#++ ",
-" @.o$%+ ",
-" @.&#++ ",
-" @.o#++ ",
-" @.o$++ ",
-" @.&#++ ",
-" .O#++ ",
-" *=-$++ ",
-" ;:>+++ ",
-" ;,<1% ",
-" 2,34 ",
-" 2;,51 ",
-" 2,,,,6 ",
-" 7777 28888,6 ",
-" 77777777 2829,,,06 ",
-" 9qwwe7rrrrr77rr 828,9tyt,6 ",
-" uuwriirrieiiieii77pa< 82,8,,,8,06 ",
-" s=1ttiieeeeded77eufgh>j,8,8,k,0,6 ",
-" =@lzieeeeee77eeex:fpcg4>9,,,,qjv6 ",
-" =O=blt7eeee7deenw:ffp<gha:t979;06 ",
-" =OO@=@zieeee7ex:::fffff0,v72444h6 ",
-" =OOo&Osst7iee7wkf:f:ff;t721444ham ",
-" =#&&&&OO@di7eu:ff:fferiv114444hmMX ",
-" =O&&&..o.sdp33fff:errrii7cc1hhh6mmNX= ",
-" =O&&&@.o.@sberrrrrriiuxuxnB;44aMmVCO#OX ",
-" =O&&o@..o.zrrrie777nnxtuxx:x;n:>mV##&&O$mX ",
-" =O&&o....zrrieieuxunx7txx:nnfwpMmVZ#$ZZZVVN ",
-" =O&oooo.*rrde77ewxnxxtnw:f4M%M%+NA#$Z$ZZVmN> ",
-" =Oo&ooo@iree7inxn7nnuuff4h%M>m%S-AZ$CCZDZmSX ",
-" =O&o.o.@rrn7eulun7xxuwp4mm6ahM%--AZCCZDDDANX ",
-" =Ooooo.*rixenuwwn7nxupph%M>>h6mAADVVZVVDDANX ",
-" =O&o.o.zrexwwnwuxxnughX%mahhmMN-AZCCVVDDAAN> ",
-" *XOoo.*iin7n777xxxtphaM+ama>MSNFVCZZVVDAAAS> ",
-" 1O..izewxux7nuuux4%++%hha>%N-DDCZZVDAAAASX ",
-" 1.=ituu:uButnxxuX%>hh>M%++NADZZZVDADAA--X ",
-" :e7f::lnn7*ppnx6ahm6++mNN-ADCZVDDAAAA-SX ",
-" 7nupp:wxxg%MMau6%++NmmmADADVVVVVDAA---NX ",
-" 7uBgh1wwxg6h>m%:MmmVNAVDZVZCVZZDAAAAF-S+X ",
-" nfgaM%pnwhX6%mXb6$DVVZC$C#C$ZZDVAAA---+NX ",
-" 27a%MaM47:mN.OoolmODGZ####$$ZZVDDA-----SSX ",
-" 2gmg<m6p7wmmOo...O$GZ####$$CZVVDAAA----++X ",
-" qBcaM <gxgmXmo.@.o&$$##$$$CZZZDADA-A-++-NX ",
-" M6> paMa HX.@@@oZ$###$$CZVDDAAAA---SS+X ",
-" 43 p=&@@&&$##$CCCVVVAAA--+S+S+%X ",
-" k =o@.##$VVmmmNNNSSSSSS%XXXX ",
-" s>OSSNmN>>aaa177777 "};
diff --git a/tests/circles.xbm b/tests/circles.xbm
deleted file mode 100644
index d82f655848..0000000000
--- a/tests/circles.xbm
+++ /dev/null
@@ -1,46 +0,0 @@
-#define circles_width 64
-#define circles_height 64
-static unsigned char circles_bits[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
- 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xfc, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
- 0xff, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00,
- 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff,
- 0xff, 0xff, 0x01, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00,
- 0x00, 0xfe, 0xff, 0x01, 0xf0, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x3f, 0x00,
- 0x80, 0xff, 0x1f, 0x00, 0x80, 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x3f, 0x00,
- 0x80, 0xff, 0x03, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0xc0, 0xff, 0x01, 0x00,
- 0x00, 0xf0, 0x7f, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x00,
- 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x80, 0xff, 0x01, 0xf0, 0x1f, 0x00, 0x00,
- 0x00, 0x00, 0xff, 0x01, 0xf8, 0x1f, 0x00, 0x20, 0x00, 0x00, 0xff, 0x03,
- 0xf8, 0x0f, 0x00, 0xff, 0x07, 0x00, 0xfe, 0x03, 0xfc, 0x07, 0xc0, 0xff,
- 0x1f, 0x00, 0xfc, 0x07, 0xfc, 0x07, 0xf0, 0xff, 0x7f, 0x00, 0xfc, 0x07,
- 0xfc, 0x03, 0xf8, 0xff, 0xff, 0x00, 0xf8, 0x07, 0xfe, 0x03, 0xfc, 0xff,
- 0xff, 0x01, 0xf8, 0x0f, 0xfe, 0x01, 0xfe, 0x8f, 0xff, 0x03, 0xf0, 0x0f,
- 0xfe, 0x01, 0xfe, 0x01, 0xfc, 0x03, 0xf0, 0x0f, 0xff, 0x01, 0xff, 0x00,
- 0xf8, 0x07, 0xf0, 0x1f, 0xff, 0x00, 0x7f, 0x00, 0xf0, 0x07, 0xe0, 0x1f,
- 0xff, 0x80, 0x3f, 0x00, 0xe0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00,
- 0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f,
- 0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x0f, 0x00,
- 0x80, 0x0f, 0xe0, 0x1f, 0xff, 0xc0, 0x0f, 0x00, 0x80, 0x1f, 0xe0, 0x1f,
- 0xff, 0x80, 0x0f, 0x00, 0x80, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00,
- 0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f,
- 0xff, 0x80, 0x1f, 0x00, 0xc0, 0x0f, 0xe0, 0x1f, 0xff, 0x81, 0x3f, 0x00,
- 0xe0, 0x0f, 0xf0, 0x1f, 0xfe, 0x01, 0x7f, 0x00, 0xf0, 0x07, 0xf0, 0x0f,
- 0xfe, 0x01, 0xff, 0x00, 0xf8, 0x07, 0xf0, 0x0f, 0xfe, 0x03, 0xfe, 0x01,
- 0xfc, 0x03, 0xf8, 0x0f, 0xfc, 0x03, 0xfe, 0x8f, 0xff, 0x03, 0xf8, 0x07,
- 0xfc, 0x07, 0xfc, 0xff, 0xff, 0x01, 0xfc, 0x07, 0xfc, 0x07, 0xf8, 0xff,
- 0xff, 0x00, 0xfc, 0x07, 0xf8, 0x0f, 0xf0, 0xff, 0x7f, 0x00, 0xfe, 0x03,
- 0xf8, 0x1f, 0xc0, 0xff, 0x1f, 0x00, 0xff, 0x03, 0xf0, 0x1f, 0x00, 0xff,
- 0x07, 0x00, 0xff, 0x01, 0xf0, 0x3f, 0x00, 0x20, 0x00, 0x80, 0xff, 0x01,
- 0xe0, 0x7f, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x00, 0xc0, 0xff, 0x01, 0x00,
- 0x00, 0xf0, 0x7f, 0x00, 0x80, 0xff, 0x03, 0x00, 0x00, 0xf8, 0x3f, 0x00,
- 0x80, 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0xff, 0x3f, 0x00,
- 0x80, 0xff, 0x1f, 0x00, 0x00, 0xfe, 0xff, 0x01, 0xf0, 0xff, 0x0f, 0x00,
- 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xf0, 0xff, 0xff,
- 0xff, 0xff, 0x01, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
- 0x00, 0xc0, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
- 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x07, 0x00, 0x00,
- 0x00, 0x00, 0xe0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
- 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/tests/marble.xpm b/tests/marble.xpm
deleted file mode 100644
index 1ef2607610..0000000000
--- a/tests/marble.xpm
+++ /dev/null
@@ -1,408 +0,0 @@
-/* XPM */
-static char *granite07[] = {
-/* width height num_colors chars_per_pixel */
-" 384 384 16 1",
-/* colors */
-". c #000000",
-"# c #111111",
-"a c #222222",
-"b c #333333",
-"c c #444444",
-"d c #555555",
-"e c #666666",
-"f c #777777",
-"g c #888888",
-"h c #999999",
-"i c #aaaaaa",
-"j c #bbbbbb",
-"k c #cccccc",
-"l c #dddddd",
-"m c #eeeeee",
-"n c #ffffff",
-/* pixels */
-"aacfedbbcbbaaaaaaaaabaabaaaaabcbcbbbabbchfdcccbbabbbaaabaabcbaa#aa#######a#aaaabcddeefhec##dgbabbaaadabbcfbaa##########aaabbaaa#a#####a#aa###a#aaabbbbcbbbccdedaaaaa#aaaaa#a#abaaabbabbbeddbbaaaaaca##a#aaaba########aaaadcababbabdehd.##.a######.cgdcb###b##.##.##aaaaa####abcba######a##aac#a##a####aa#aa##babbbcfccbbbcdccccecbbbcbbbcdccddcbcdfeecbhhjihhgffc.aaa####.#######aaaaaaaabbaaaaa",
-"aaacedccbbcbaaaaaa#bbaabbbaaaabcaabbbbbbafhfccbbbbbbabacbacbaaaaa##########a###abbcdeghhhcagb#ababaaccbacdfca#a####aa###aaaaabaaa#####aca#aabaababbcccccccbcdfdaaaa###aaaaaaaaaaabbbbbbccccccbbcbcaaa##aaaaabaaaa###abdaccceebaaaabehja####a######..#aeec#bb##########aa#####abba#########aaca########aa#aa###aaaabddbbbbbbbbbbccbbabbbbabbabbabcbcbcefhfeddccefhhijheecb#...a####aaaaaaaabaaaaa",
-"aaabccccccdbabcbaaa#aaaaaaaaaaabbabbbbbccabefdccabcbbabacccbaaabaa######a######aaabceiiiihije#bbabbaaeaabcedcaabaa########aaaabaa##a###ab#aabcababbccccccdeeeecc#a##a##aaaaaaaaaabbbbbbbcccbbbdcbbcdaa#a#aabbaaaaa###acbaa#bccaa#abcfig.#######.#######acddgefdda#######a########a#######aaaaaa#a######aaaa#####aaacdcbabbaaabbbcaaaaaaaaabbbaaabbaabbbcbcbabbabcdeefghjkjgc#..####aaaaaaaaaaaa#",
-"#aaaaaacbccbcabbbaaaaaabcaaaaabbbbbbabbbcbaabffccbccbccbbcbaaaabaaaa#aa#aa##a#aaaaabbikkjhijicabbbcc#faaacdebcbda#########aaaaaaaaa####aa##cacccabcccdccccdddfdcbaa##a##abbbabccbbcbbbccccaaa#abbaaba#a##abbbbbaaaaaaaaaaccaaca##aabcfic.###aa#######a####bddeeddb####.##.###aaa#########aaaa###aa####aaaa#######aabdbbbbcabbbaaaa#aaaaaaaaabaaabbbaabbbbdbbaaabccccccdcefhhkhda##aaaa#a#aaaaa##",
-"#aaabaabcecbaa##bcaaaaaaaababbabaaabbabbaabb#chhfdccccbcbecaaabaaaaaaaaaa####aaaaaaabdgjkkijijdabbdcabfaabcecbbec###########a#aaaabaa#######abbaaaadddedddeeefeccaa###a#aabcccdcbcbbbbccbbbbaaaaa#aabbaaaabbbbbbaaaaaaabbbbbaaa####acegha##a#aabbb####a##adccdedbcc#######.###a###a#######aaa#a#aa##..#aa#########abdbaabbabbbaa###aaaaaaaaaaaaacbaaababbdbabbabcbbcbcbccbbdegjkgb#aa#aa#aaaaaaa",
-"##aa#aabccccaaaaaaaa#aaaaaabbaabbbaaaaabbbcbbcfhhgfcccbbbbccbaabbaaaaaaabaa#aaaabaaaabbcehkljjdabacccbgbaaccdb#adea#########aa#abaaaaa#####ac#ba##accdedddefffeaba##a#aaaaacccccccbbbcccaabaaaaaaaaa#aaaaabcbbaaa#bbbbaaefccdbaaa#aaacdei##aa##aabbbaaa#a#cdcccccbcea.#########bbaaa######a###a#aaaa.#aaba####.###abcbaaabaabbbaa###aaaaaaaaaaaabbaaaaaaaaaaababcbbcbbaabbbdddeghheba##ab#abaa##",
-"#####bbaaaaabaaaaa##aa#adccaabaaabbbbabbabbbabccbccfdbccbbbbbcaabcaabaaabbaaaaaaaaaaaabbbcglli#accbbbddgabcddbbaacea#a##########aaa#aaa##aaaa####aabcddeeefffgdbbaaaa###baabbbbbbcdabdcbcaaabaaaaaaa#aaaaaabcbbbbadfbbbaejhhebbccaaaaaccfi.aba##abaaaba####ecbbccba#fc.####.##.bba#a#######aaaaaaaaaaa##aaaa######abcdaa#aaaabaaa###aaaaabaaabbbaaba##aaababcbbcbbbbbcbaaabbccccddgggeb#aadca###",
-"#####bcaaaaaabcbaaa#aaaabcccaaaaaaabaaabbbbbbbaacbabeeddddccbcbbcccbabaaaabaabaaaaaaaaabbbbglmdbcbaabebdgdbcecbbaabdbaa#########aabbaaaa#aa#a##a#aabbdceeedccdcbbaaaaa##aaabbcbbbabaaabbababbaaaa#aaaaaaaabcdccbbbabcbbbcfijfbcdcabb#abcbif#abb##aaabaaaa##fcccbbcaa#db#..##.##.aaa#########ab#aaaaaa#aabaaaaa#####abdbbaaaabbaaaa###b#a#aaaabaaaaaaaaaaaaaabbabbbbaabbbaaaabbbbbbbceffecccbaa##",
-"#####abaaaaa#accbbbbaaabaaaaaaaaaaadcbaabbabbbabbdcaacgfddddcdddcadfcaaaabcbbabaaaaaabcabbbdjliacbababcbdfcdeeaaaaaabba########a##aa#aabaa##a######abddeggca#bcbaaaaaa####aaaaaabbbbbcbbbbbaaa##a#aaaaaaaabcbccbbaaaabaabfgfiecccccbbaaaccicbbbcbaaabaaabb#ceccccdca##aacdb######aaa###a###aabaaaaaa#aabca#abba#####abca##aaaaaaaaa##a##aaaaaaabaaaaaaabaaaacbcbacdbaaabaaaaaabaaaaabbcddccbaa##",
-"####aa#aaaaaaabccbabbaaaaaaaaaaaaabfaaabbcbbbbbabdebaabdffddedefedccecccdcbbbbbccbccbbbbbbccekldaabaaabccbfaaaaaaaaaaaba########aaaaaaaaba##aaa###aabbccfgfaababbbaaaaa#aabbaabaaccaabcccbcbaa##aaaaaabaabbbccbbbaabbbbbbdddghdbbbcccb#abcdebcccbaabbbabbcbaecddddbaa##.#acdeca#######a#aaaaaaaaaaaaaaabba##abba####aacba##aaaaaaaaaaaaa##aba#abaaaaaaabaaaabbbbbbcbabbaabbaaaaabaaaaaaaaccbaa##",
-".####aa#aabaa##bccbaabbbba#aaaaabbaefdaabbbbccbbbaddaaabadeeffhhhffdedddeecbbbbcccbbabcbabbcfjjlkeaaaaacdadcaa#aaaaaaa#ab######ba#aaabbabcaa#aa###babcddcedba##acbaaaaaa#ababbbacbbbcccdfffbaa#aaaacbaabcbabccbbcbbbbbbcbbccedbbbccdccbaabcgb#bccbbbababbbcccdededcb#a####...addcba##aabbbbbbbbaaaaabba#aaa##abba####abbaa###a#aa#aa##aaa#a##abaaaaaaaaabababbcdbcb#baaaaaaaaaaaaaaaaaa#aaaaa###",
-"######a##aaaaaa#accbaaabbbaaa#aaababdcaaabbbbcccbbbdbabbbacdccgecadbbbcdccddeddcccccbaabcbbcgjhhjgeb#aacdcccaa#aa#aaa#a#aaa##aaaaa#aaabbaabb#aa###aabccddeccbbbaabcbbbcbbb#aacbbadbabcccddbaaa#aaaaabbbbabbbbcdbbbabbcddcbbbccaabbbccbbaaaadi##abbbbbbbaabbbacdeedbd######aa####bceda#aabbabaaaaaaaaba#aaaaa#aabaaa###acaaaa####aa##aaaaaaaa#aaaaaaaaaaababaaaaabcaaaaaaabbcbaaaaaaaaa###aaaa###",
-"##########aabaa#accbbabbbbbba##aaaabbcbbbbbbbbcbaaabdbbbbbbddccbbbbaaaabbabbbbcefefdcbaadbcddje#debgfbabecdc####aa##a###a#aa#aa##a##aaabbcabbaa###aabbcceedbcbaaaabdcccbabaaabbbbabbccbbaaaaaa#aaaaaaaabbbbbcbccabcccccdcccbbbbabbababbba#abfe#aaaaaaaabccbbaaaedddc######adcaaaa##dfcaaaaaaaaaa#aaaaa##aabcaaabbaa#aaab###aa###aaaaaaaaaaaa##aaaaaaaaaabaaabaaabcabaaaaaaabcbaabaaa##a###aa####",
-"#########aaaaaaabbcbbbbabcbaacbaa##aaabaaabccccccbaabecabbbcddbacdeba#aaaaabaaabbdfgedcbaccdcgica#aadghdbddd#aa#aaa#a###aaaabaa#####aaaaabbbbbba#aaabccceecbddbaa#bbccabcbbbbbacccdbbdabbaaaaaaa#aaaa#aabbbbcccdcbcbbccccccbcaababbdbabbba#bbgaabaaa#aaacccdcddbeedba#a##a#aba#aaaa##decbaaba#aaa###a#a###abba#bba###aaba####a####aaaaaaaaaaaa#aaabbbaaabbaabbaabbaaa#aa#a#abbaabbbaaa#aaaa#####",
-"############aaaaaaacbbbbbbbaa#aaa#a##aaaaaaaacbbbbbbabdcabbbcdbaccdba#aaaaaababbcbbdddedccddefihaa#aaahiiiffd#aaaa#abaa##aaaaacaa##a#bcaaaabbbcaaaabccdddecabaaaaacbbbabbccccccbbdbdfdaabbaaa###a#aaaaaaaabbbbbbbaaabdcddccbbbbabbbccaabbbaabfdaaabaa#aa##aabbbbbddba##aa#a#aa##aaaaaabcdbbaaa##aa#####a#aaabbaaaaa##abb######aa###aaaaaaaaaaaaaaaaabaaaaaaaabbbbaaabaaa#aaaaaaabbbaaaaaaaaa####",
-"###########aa#aa#aaaccabbaaaaaaabb#######a#aaabcbbbabbaeebbccbcbacdaaa##a#aabbbbccbbcbcdegifdfgifba##aaaagigha#aaaaabbaaaaaaaaabaaa##acaaaaabbbbbbabcdddefeba####abbaabccccbbbcbadcbcbaabba#aaaa#aaaaaababacccbaadbabbccedcccbbccbbabaaaaa##ade###abba#aa##abbba#cebb.#a####.#a#aaaaaaaaacfca#aaa###aa###abaabaaaaaaaabbaa#######aaaaa#aa#aaaaaaaaaaababdaaabbbbbababaaaaaa#aaaaaabbaaabaaaaa###",
-"##########a#aaabaaaaccaaaaaaabaaaaaaba###a##abaaabbababaccbcbbcccaaba#a###aaabbccdccccccdeegggfigaabb#aaa#fffcba#abbaaaaaaaaaaa#abba##aaa##aabbbcbbbbcdeegfeb####aabaabacbbbcbccaabbabaaaaaaa##aa#aaaaababbabbcbcdbbcccbddcdcccabcbbababba###afba#aabba#acaaabbbbaddb##aa####.####aabbaaaabffcaaaaaa##a##bcabbaaaaaaabbbc#a#a#######aaaaa#####a##ababbbbbaaaabbcbaaaaaaaaaaa#aaaaaabaaababaaaaa#",
-"#######a#####a#aaaaabcbaaaaaa#aabaaaaaa###abbabaaaaaccaaabdbccbccbaaca#####accddcccccccddeeefikjeabcca#a#abfifbaa#abbbbbaaaaaaaaa#bbba#bcaaaaaaaccbcccceffeccaa##aaabbbcabbacbddbbaabdbaaaaaaaaaaaaaaabbbaabbbbbbbbbcbbccccdcdcccabbbbbaaba###dcaaaabbaaabaabcbccaadba#aaa########aaaa##aaaacgdbaaaa####cfffda#a#aaaabbdbaa#aaa########aaaa#aa##aaabbabbbaaabbbaaaaaabaaaaaaaa#aaaaabaaaaaaaaa#a",
-"a###########aaaaaaaabbaabaaa###abaaa#a##a###a#aaaaabacaaabccbbbcbbbcbb####a#bdfbbccccccdefecdgiiddaabbaaaabacfeaaaaaabcccbaaaaaaabaaacaa##aaaaaaabccddcfgfgbabaaa#aaabbcccbccbcddbbacabbbbbbbbaaacbaaaabcbabbbbbcbbcbccbccdccdccdcbaabbbaabaaade#aa#baaabaa##abbcbacdb#.#abbccc#.##aaa####aa#aeeaaaaaaabbabddfgfba#aabcd#aaaa########aa##a##aaaaaababbaabbbbbabccbababaaaaaaa##a#aaaabbaaaaaaaa#",
-"#a###a######aaaaaaaacdaaaaaaaa#aaaaaaaaaa#####a###abbbbaaaaccbbbcbbbbaa#aaaaaeecabcccbccdedcdfgigeaaaacbaaabaacbaaaaaaabcbbbaaaaaaaaabccaaaaaaaaaacccceffffbabb#a####aaaabcccccddcdedbbbbaabcabbbccbccbcbcbbbbbbbbbcecbccccceccccdccbbaaaaaaabce#bbaaa###aaa##ababcacda#abb##a#######a#########bfdca#abcbaabaabcffddbabdc#aaaaa##########aa####aaaaaaabbabbbbbbbcbbbcbaaaaaaaa#aa#aaaaaabaa##b##",
-"##a#########aabaaaabcdbabaaaaa##aaaaabaaba######a##ababbbbbabbbbcbcdddbbaa#abceecabccccccdddfedgjgdbaaabaaabbbaaba#aabaabaccaaaaaaaabbccbbbaaabaaabcddefgfebbbb#aa####aaaabbcccccbbfeccbbbaaababbbbbbbccba#abbbabbcdccdcbddcddcccdcddcbaaaaaabcfbadaa#######a#abbacbbcc###a#a########a######a##aabdcabccbbababaaaacdfededbbaa#aa##aa######ba#aa#aaabbabaababcbbcbcbbbabbaaaaaaaa##aaabaaacba#a##",
-"##########a#abaaaaabbbcbbbcaa###a#aaaaa##aba#######aaaaaabbdccbaabccdddecaaaabccdbbacccddcdefdfgiifcba#bbaaabbaaaababbbbbbbabbaabaaaacbbbcbbaaaaaaaceeeefffbaaaa###a##aaaabbcbbbddcddddcbcbbaaabbbbababbabaaabababbbbcccdccddcddccccdecaaaa#abccfbbaaa#######aabbaacabe###a#aa#a#a##.aa#######a#aa#cfeecdcccccabbbabacggcabbaaabbaaaa####aabb#aaaabbababbbbbbcccbbbbbcccbbbaaaa#aaaaaababbaaaa##",
-"######a####abcbaaaaabbccbcbaa###a##aaa##a###aa######aaaaaabdgebaaabbbccacbaaaaabbbaaabccddcdeeffgigbaaaaaabaabcaaababbbbaabbacbaaabbaaaababccbabbabbdffefhdcaaa###aaabba#aababcbdeeccceccccbababbbbabbabbaaaaaabbaabbcbcccccdcddddccccdcaaaababcdeaba#####.###aaabaab#b####a####a##aa#b########aaaaabedddcccccaaaabbcabeaaaabbccbaaa#abbaaabbbaaaabbbaaacbcbcbbdccbaabbacbbbbbaaaaaaaaabbaa#####",
-"######aaa#abbcbaaaaabdccbbaaa#######aaa#####aaa##a#a##aaaababcbbaaaaabdebbbaaa##aaaaaaaabccddeefggieaaaaaaaacabaabbbabbbbaaaabbaaaaaaabbbabbccbaabbbdfgghebbbaa#####abba#aabbbcbccdcbbbcddcccbbbabbabbbabbabaaaaaaacbbabcbbccccddddccbcccaaaaaabbdcbc##########aaacbbaa####a####aa###a#aa###aaa###abbceddedcccbaaaacccdca##a#abbbabaaaabaaabbba#aabbbbbbccbbbbaaacccbbcbbaaabbbbbbabaaabaaaa####",
-"#######aa#aaccabbabaabdecbb#a########aaaa####aaa#aba##a#aaaaaaabbdcaabdcbcaacb####abb#abaabccdeffghfdabaaaa#acbbbbcbabcabcbaaaabbbabaaaabbbbbcccbbbccdfedccbbb#########aaaababbacccbcbbbddbdcccccbbbbaaaabbaabbaaaaabaabbbbccdcceedccccacbaaaabbbbddb####aa######aabbaa####a####aa#aa###a#####aa#aabbddeccddccbbbabbbbceb###aa#aaaaaa##aa####aaaa#abbbbbccacccbaa#accbbbbbaaababbabaaaaaaaaa####",
-"##a#####aaaaaabbbbabacdddccaa########aa#a#####aaa#aa#aaaaaaaaaaaabcabbcbbbbababa###baaaaaaabccdeeehifbabaaa###abbcbbcaccbcbbbaabbbbabaaabbbbbbbbcccccddbccbbbbba#######aaabbbaabbcccbdcbbdbbddcdcccbabaabaaaaaaaaaaaaaaaabbcccddecccbbacccbbbaabbbceca############aaaaa#############a#############aaaaabccddcbbbabbbbbbba#####a##a####aaa#######aaa#babaabbcbaaa##abbbaabbcbbbbaaaaaaaabbaaa####",
-"#########abaaabbabbbbbddeccca##aa######a#aa####bbaaaaaaaaaaaaaaaaaabccbcccebacfdb#####aaaaaaabcdddcfgfccbaa##a##abcbbcbbdcccccabbabaababbbbbbbbbbcdccddbabbbbbba########aaababbbacdccccaabcbbcabddddbbaaabbabbbaaaaaaaaabbbddcddecbccbbbdcbabbbaabbcda#############abaaaa############a####bb##a####aaaaabcffdcccbbbbbbbb#######aaa###aaaa#######aabaaaabbcbaaaaaaaa#aaaaaabbccbbaaaaaabbbaaa####",
-"#########aaabbabcbbbbbdddcbaaaaa###############aabaaaa#aaaaaaaaaaabbabbdefffccbba###aa##aaaaaabcdceecggdcbbaa##aa#aacbb#bcdddddabbbbbabbbabbbbbbbccfeedbbbbbbcbba#a#####a#acababbbdcbcbabbabaabaabeedcaaaaaaaabcbbaaaaaaabbcdfdddccbbbbcbccbabbbaaabcda########a#aaaaaaa#aa#####aaabaaaaaaacb##aaa#aaababbcdefddbbcbccbaa#####aaaaaaaab##a########aa#abbcccbaaaaaa###aaaaabaabccbbbaaaaaaaaa####",
-"########aaaaaaabbbbbbcdedbbbbabaa##########aa###bbb###a##aaaaaaabbaabbbdfeedb##a#a##aa###aaabbbbccdefbfecbbbaaa####a#adb#acdecdfcbaabcbbbbcbbbbbbcdeffbcccabbcdbbba#a###a#aabaaaaaccccbaaaaabbbbaabdfedaaaababbbbbaaaaaaababbcedcccbbbbaccccbaaaccbbabeb######aaaaa#aaa###a######aaaaaaabacbca#aaaaaabbbbccdegfeccccccbcbaaa#####aaaa#aaaaa###a###aaaabbbcccb##a#aaa#aaaaaaaabbdeddcbabaaaaa####",
-"#########a#aabbbbbbbbdddccbbba#aaaa##aa##a####a#bba#a#a#aaaabaabbbabbeedeeefdaaaa#####bb##aaabbabcddehgifffdcbaaaa#aa#aaaaaccdeddcabbbcbbbccbabbccdceeecdcaaaabbcccaaaaaaaaaaaaaabacdddbaabaabbbbcccccfdbaabbaabbcaaaaaaababbcccccbbbbbbbccbcca#acbbbbbda#####aaaa####ab##a######aaaaaaabaccbaaaaabbbbbbccceffcdeedcbbbbaaaa#aaaaaaaaa#aaabaaaaaa##aaaabbbcbbcbaa#####aaaaaabbbcccddcbbaaaaa####",
-"##########a#aabbcbcbbcecccbbbabaaaaaa#####a#aaaabbaa##ba#acaaababbbbbbbcdcfgdbbbaa####aba##aaaabbbccdfefhfgedecaaa##abaaaaacbabebbbbbbbbcccbcbbbbddbedbddcaaaaaabdccaaba#aaaaaa#bbbbbaddccaaabcbbdcbbcbddabbbbbbbccaaaaaaaaabcddcbbbbbbbbbbbbbbaaaabbaabe#########a####bb#aa#####aa#aaaabccdbbbbabbcbbbccccdccbaaeffdbca#aaaa#aaaaaaa#aaaaabaaaa#aaaabaabbccbbcceb#bcaaaaaaaabbbbcdcbbbaaaaa####",
-"#######aa#aaaaabbccbbcdccddcabaaaaaaaaa###aaa#aabcaaa#bba#aabaabbbbbbabcccdfedcaa##aaa######aaaabbbbcdddghhgfedcbaaaa#aaaaabcbbbccbbbbbbbcbccdcccccbeebccbbbaaaaaccccccba#aaaaaaabaaabbbddbbbbcccbcccbaceeacbbbcbccbaaabbabbbbceccbbbbbabbbbbbbab#aabbbbcc#.######a####.bcbcba####aaaa#bedccbbbbbbbaabccddedaaaaa##beeda#aaaaaaaaaaaaaaaaaaaaabba##babbabbbbcbbbccccbbaaaaabbabaabddcbbbaaaa####",
-"##########aaaabbbbccccbcddddbaaaa##a#a#a###aaaa#baabbaaaaaaaabbbabcbaabccbddfebaaba#ba######aaaabbbbbcddfiiigggedbaaaaaaaaaabcbabccbbbbbbbcccddddccceecccccbbaaaabccddbbba#aaaaaaaaabcbbbcccdccbcbabcbabceecbabbbbbbaaaabaabbbcddbbbbbbbbaabbbcbbbbaaabcbdc########..####ccccba#abbaaaabddbabbbcabbbbcccceeca###aaa##aaa##a#aaaaaaaaaaaaaaaaaaaaa##aabcbbbbbbbccbbbbcddaaaaacbaaaabddbbaaaaaa###",
-"############aaabbabcddccdbcdcbcbbbaaaaa##a##aaaa##abaaabaaaaaaabbaacaabddabcefc#aabaaa###a####aaabbbbbbddgihhfffgeaaaaaaaaaaaaabbbcbbbbbbbbbcddeeedceccdcccccaaaaabcbddbaa#a#ab#aaacbbbbbbddebbbbccbbbabbbedbaaaaaaaaaaaabbabbccecbbbbccbbbbaabbbbcc#aaabbcc######a#####.bccabbacbababaabdcabbbabbabbbcbdecabaa##aaaa####aaaaba##aaaaabaaababa##aa#aaabbbbbbbbcbbbbacbedbaaa#bbaaaabcbbbbaaaa#aa",
-"#######a####aaaaabaabbcccbabbbbbbbcbaaa######a#aa######aaaa#aaa#acbbbabeeebabddbaaabaa####aa#a#aababbbbbcehhgeeffdca##aaaaaaaaaabbbbabbbbbbcdcdddfgfhcbbcbbbcbaaaaabcccdbba###baaaabcbbaabcdeecaaabbbbbbaabddecaaaaaaaabbbbbbbccfcbcbbbbbbbaaaaabbbcca#aabacc#######a####acdcbbbbbbaaaabbccaabbbbbbbabbceecabb#aa#aaaa#######aaa##aaaaaaabbaaaaaaaaaaaabbbaabccbbcbaaacgdaaaa#aababbbabbbbaaaaa#",
-"###a#####a#aaaaaabcbacbbddcaaabbbbbbbaaaaaa##a#####a####aaaaa#aaabdbcbbedefcaaabaaaaabaaa#a##abaaaaababbbcfgggfeefea##aaaaaaaaaaabcbbbbbbbbcdcdddefgeabbbbaabccaabaaceddeeaaa##aaaaaabbbabbcdedbabbbaaaaaaaacfecaaaaabaabbbbbbcdfdbccbbbbbaaaaaabbbcdbaa#aabdb#########a#acdcccbaaab#aabccbbbbbbabbbceedccbcbbaaaa#baa#a###a#a##aa###aaaabaaaaaaaa##aaaabbaaabcbbbbbabbdfeaaaa#ababbcbbaabaaaaaa",
-"#####a#####aaaaaabbbbbbbcddcbabccaaabbaaaaa#a##a##a######aaaaaabaaaaacbbbffeaaaababbabbbbbaa##bbaaaabbbbcccghghgeffbaaabbaaaaaabbabccbbbbbbcdddefggecccbabaaabbbacbabbdddecbaa####aabaababbcccdcabaa#aaa###abceedcaaaaabbbbccddefdccdccbcbbaaaaabbccdccdb#abbd###a#####a#a#cddcccaaaaaaaaabccbbbbdeefbba##aabaaa#aaaaaa#aa###aaa##a####aaaaaaaaaaaa##aaaabacbabbbbbcbbbbcfgbaaa#aa#abbab#aaaabba",
-"##########abaaabbbbbcbcdcccdcbbbcbbbbbba#aaaaa#a############aa#aaaaaaababbdeaaaacbbbbbddcbaaa##abaaaabbbbcccghhhedecababcbaaaaaababcbbbbbccbddceggffecccbbbaaabca#aaaadddedcb#a##aaaabbbabbbbcccdd###aaaa#aa##bcefeddcddccefdddfdcccccccccbbaaaaaabccccdddaabbda########ab##bbbddcbbaa#aaaabcbbbcdddccaaaaa#abaaaaaaaaaa#aa#aaaabaa#####aaaaaaaa#######aabaacbabbbbbbcbbbbdfbbaaaa###baabaabaaba",
-"###########aaaabbcbbbcccbddbcdccbbbbcabbaaaaaaaaa###a##aa###aaaabaaababbccbbdb#abccabddbbbba#aaaabdbbaabbbbcdehihbaabbbbcdcbbbbaababbedcbbaccdddeeefedabbabaaa#aaa#aa#beeeeffca###aaabbbcbbbbbbcced#a###a##aaa#abffgfedcccfhcbdebcbccdccccbbaaaaaabbcccccddbaabdcb#.#aa#aaa##abdddcbbbaaababbbbbcbdbabbbbbb##ababbbaaaaa#aa#aa##aaa######ababaaa#####a#aabcbbbabbbbbbcccbbbeabcbba###aaaaaaaaaab",
-"b#########aaaaababbbbabbbbdebcccccbbbabaaaaaaaaaaaa########aa#abbaaabbabbdbcbbbaaadcbcbdbabba##aa##abcb#aaabcdcfhgdabbbccdcbcbbbbbbabcgdcbdbbdedeeehfgdbbbbbaaaa#aaa#abddddgeedcaaaaaabbbdccccccbceeaa###a###aaaacfghhgedccggefbccccccccccbbbbbbaabbcccccccdaabaaccb#aaa###a##adedccbcbaaabbbbcbbcddbaaabbbbaadbbaabbaaa##abaaa#aaaaaaaa#aaabaa########abbadccaaabbbcccccbbdcbcbbba###aaaaaaaabb",
-"aa##########aaabbbbbbbaabbaccbceeebbaabbaabaaabbbbaaa###aaaba#aabaaaaababbccggcbaabccbbbccbca##aaaabdbbabbabbcdddghbabbccddcbbbcbbbbbccgfcbccceddddeddedddcbababaaaaaa#accdeffedbaaaaaaaacccccbbbccffb#a#####aaaaabfhgghhhhgghecbccbccccccccbbbbaaabbbbcbbbcdcbbabbcb#####abca#abccccccabbbbbbbbbdddbaaaaabab#cdba#aabaaaaaaaa#aaa#a#aa#####aaaa#######aabbbbccbbbabbdeddcbbeaabbcb###aaaaaaaaab",
-"baaa######a#aaabaabdbbcbabbaccccedaaaaaaaaaaaaaaadbaa#aaaa##aaaaaaaaabbbcbcccdbaaaaabdcbacbcdcaaaaaaaabaaccbbccdddhgcabcccdecbcbbcbbabadedbbcdedcddeeccdddeeedcbbcbaabbbabbcddddec#aaaaaabbcccccbccdffc##a##a#aaaaaafheffhgeccefcbbcbcccccccbbbbaaabbbbccbbddedbabbcc.##a##abc###cdcccbcbbbabbbaddccababbbaaabaddba##aaaaaa#aaa#a#aaaaa##aa##aaaa#######abbbbccbcbbbbdefeeccecaaaaa####aabaaaaaa",
-"bb#a########aabbbaaababcccdaacdbbaba#aaaaaa#aaa##acaa###aa#aaaaaaaaaaabcdcccaaaaaaaaadbcbbbbacc###aaaaaaaacbbccdcdfggbbbcccdecccddcbbbacdfdbcdebbbcccdcccccdcbefccbaaaaabcbbccabdfcaaaaaaabbdddccccccefe##a##aaaaaaaadfghhhdbbcccccbcbbccdccbbbcaaaabbbbdccddeeba#bbda######.acabbddccabcbbbbbbbddccaaaaaaaaaaabdca#a#aaa#aaaaa##a#aaaaa##aa##aaa#a##a##abbbbccbbdbbccefffeccd#a########abaaaaaa",
-"aa##########aaaaabaabbaaccdcaacbbaab####aaaa#aaaaaa#a####abaaaaaaabcaaabddcacda#aaabacbbbbddddcbaaa##aaaaa#abbdcccdegfbbcdcdefccddccccbcbbfdccecabccbcbbbcdddcbffdcccb#aacbaabcbbeecaa#aaaabcedddccccddfeb#####aaaaaabbehhfcccbcccccbbccccccbcbcbbaaabbbcdcceddcbbabba########bcbbcdcbbbbbbbbaacccccaaaaaaaaaaaabcba####aba##aaaaaa#aaaaaa##a#aaaaaaa#aaabaabbcbbbbbbbdffffeeeaa########aabcaaaa",
-"aba#a#aa####aaaaabbabbabbaccaaabaaaa#######a####aaaaa####aaa#bbaaaabaaacbddcbccaaaaaaaaaaacdeabcbba#a###a#aaabccccdeegfcbcdddeedcdccddccccfedddcbbccbbbbbbccddedecccdca#aaaaaaabacedcddcbabaabccccccccceccd####aaaaaabaacdghhfecccccbbccccccccbcbbbaabbbcccccddcddceaca########cdccdccbbbbbbbbbccbcdcaaaaaaaaaaaaaaba#####aaaaaaa###aaaaa##a####aaaa###aabbbbbbccbdbbbcdefffgaa#a#######aabaaaaa",
-"aa#####aa###aaababbccccbbbbcbaaababa#######a#aabaaaaaa####aa#abbaaaabbaabbdcbbcdbbbbaaaaaabcddbcbba#####a#aaabcdccceefhgbbdcceeeeccccccddeefeeecccacccbcbabbccdefdbcebaaaabaababbbcdcdfffdabbbbbcccccccecade#aa#aabaaaabaackijkidbbbcbccccccccbcbbbbaabbccccccccddegfdaa#######ceedcbbcaacccccbcccccbaaaaaaaaaabaaaaaaaaa####aaa.baa######aaaa####baaa#aaaabbbbbccdcbbcddedfgfb##########abbaaa#",
-"#a########aaaaaaccbbcdcccbbbba#aaaaaa#####aa#aaab#aaaa#.###aa#aabababcbabaccbccdedaaaa#aaaaabccacbaa#a######aacbcccdffhigeccccdeedddccbcddffdefcbabbbcdecbabbbbcddecddbbaaabbabbbcccddeeffabbabbbbcccccdecdedb#a#aaabbaaaaahifgikfcbcccccccccccbbaaabbcbbbccbbbbcccdhea#a#####aedfebccccbbcbcccccccbaaaaaabaa#aaaaaaaaaba#b###aaa#b#######a####aa##abbbabaaabbbbbcdecbbcdedefghc#########abcedcb",
-"a############a#abcbbbcddccbbbcaaaaaa#a####a#a###ba#aa#######aaba#bbbbbccaabcccddeebaaaa##aaaabaaabaaaa#####a#aaaabcbdeggihfccccdddffdcbcccdfcbcbbbbbbccbbbbabaabcdfebcbbca##aabbbbcdcdfffeeaabbbccbbcccdeeddeed##aaabaaaaachgcccfijebbcccccccccbbaaaaabbbaabbaabbcbbcfecaaa#aaadcddbbdcccabbcccbbbabbaaaa#aaa###aaaaaaaaaaaaa##aaaaba######a######a#abbbbbbabbcbbbddcabcddddefgfa########aacedcc",
-"#######aaa#####aaaccccddcdcccbbaaaaa####a####a#aaaa#aa#######abaaabbccacdaadccdddccba#aa#bbaaabaaabaaaaaa#aaaaaababbbdeffiiebcccdddeedcccdcfbcbbbbaabcbbbbbbaaaabcdeefeeddedbaaabcbdccefffffabbbbbbbbbcdcdddddefbaabbbbabaeidccddcejgbbccccccccbbbbaaabaaaaabaaabccccdffebaabbaaddcc#cdccabcccccbbbbbaaaaa#aaaa##aa#aaaaaaaaabaaaba#b##a####a#a#a##a#aabbabbaabbbbddecbbdcccddeega.##.#a##aab###",
-"#########a#####ababccbbbdcccccabbb##aaaaaa#aaaaa##aaaaaa#..###aaaaaaccbbdcbbccdbccdaa##a#a#aaaaaa#ba###a#a#aaaaaaabbbcdeefhgeccedbbcdedeedgebbbbbbbbcdcbbbaabaaabacccddccccbdcaabbadddeefffgfbabbbbccccccccdddbggbaabbbbabhefcccddddihdccccccccbbbababaaa###aa#aabbbcdeeffa.##abcfedabccbcccabcbbbbbbabaaaaa###aaaaaaaabaaaaaaaaaaaaba#######aaab#####aaabaaaabbbaceffecbccddccdec#####.##aa#aa#",
-"#aa########a####abbccbbccdcccbbbbba#a##aaaaabaa#aa####aaba#.##baaaabccdabdbabbbbbcccbaa####aaaaaaa#aaaa######aaaabbabccdfeehihfggfdbceedddeddfdccbbcbbbbbbbbbbaaabaccccbbccdddecababedefffffhgdaaabccbcccccdddbfhfbbbcbbackdeeccdddccfhgbccccbbbaabaaabba#####a#aabbbdeddeda.###aeddcbaaccccccccbbbbbabaaaaaaaaaa##aba##abbaaaaaaaaaab######aa##aa###aaabbbaaaaabbbeffffdcdcdeffda######.###aaa#",
-"#aaa############aabcdcbcdcfedeecbbaba##aaaaabaa###b#a##aaaa####abaaacdcaacdaacbcaaaaaaaabc##aaaabaaaaaa######aaaaabbbdddeddfhhhhhhfcccffffdbaabcbdbabbbbbbbbbbaaaaabbcccbbbbcfdedbbadeddeefdefhffecbbcbcccccceddgibbbbbbdecccbbccccddddhidccccbbaacaaabba########aabccedddeda####cdcecbccccddddcbbbbbabbaaa#a#####a#######abaaaaaaa#aaaa#a##aaaa#a####aabaaaaaaaaabccddfgfddefge################",
-"##aaaaa#aa######aaabdccbccdeefebbaccb###aaabcbaa########aa######aaba#bdbbbcabbbbbbaaba##aba#####ababaaa##a#a##aaaabbcddedddeeefhghfddccdhecbbbaaaababbbabbabcbaaaaaabbccbbbbbbeefdbbbddbddffdggihiebbbcbbcccccedeicbcbbcdccccccccddddddcfifccbbbbabbabbbaaa####aa#aabcedddefeb##.bdcdeccbcccdddcbabbbbaaaaaa#aa############abaa#aaaaa#aaaaaaaaaa#######aabaaaaaaaabbabbcefgecbcc############a#a#",
-"##aaaa####aa##a##aaabcdcbbccdcdccbcaba##aaaabbbaa#aa#a####a######aabaaabaaaaaaaabbba#aa###a##a###abbbaa#aaaa#a##aabbcededddddeghggcdfedffddcbbbaaabbbbbccabbbbbcaaaaabccbbbbbbeccefdbcdbcbcefefhgghdbbcbcccccccdcefedbadccbbcccccddddddddeggcbbbaacaabbbaaa######aaaabdcdeedefbaa#deddcdcbbcdedccbbbcbaaaaaa##################aaaaa#aa##abaaaa#aaa#aa##aaaaaaaaaabaabbacdbacbaaba###############",
-"##a#aaa####aa##a##aaabbbbbcdeccbbaaaaabbaaabbaabaa###aaaa#########aaab#aaaaaaaaabbaaaa#a#a#aa#a#aabaaaa###abb##aaaaabcdeeddefghhhebbbfebbdddccbbbbbaaabdcbcbcbacbaaabbabcbbcccddbbcefecdcbbbcddehgggcbbcbcccccccdddffbbdbbbbbccccddddddddddegcbbaabaaabbbaaa######aaabbbcdefdeca#ddedcdddbacadedccbbbbbabaaaa###############.####aaa##a###a##aaa#aaa#abaabaaaaaaaaaaaaabcdbaaaa#a########a##a###",
-"a##a#aaaa#####aaaaaaabcccbbcdebbaaba#a#bbaaabbaaaa####aaa#####aa#abaaaaaaaabaaaaaabbbaaaaaa#aaaaaababaaa####aaaaaaaabcddddefedhhgbbbbcefbcdedcedabbbababbbcbbbbbbaaabbaabbbbbcbcddbbbcdcebbbbdcabehhebbbbcccccccceddhfddbbbbbccccddddddddddcdfdaaaaaababbaaaaaaaaaaabbbbccddcdfededffddddcbcabcddccbbcbbaaaaa#####################aa##a#a#######aa###aaaaaa###aaaaaaaaaabbccaabaaaa######a######",
-"aaaabaa##aa####aaaaaabbccccbcccaabbba#a##aaaabbb######aaaaba##aaaaababb##aaaaaa#aabaaaa#aaa#aabaaaaaacbaa####aaaaaaabcdeddefefhheabbbbbdfgfgedcfaaabbbbbbaaaaaacabaa#baaabbabaabbdeeeccabdccbbbcaachifbbbcccccbcccddejkeabbbbccccddddddddddccceebabbaabaaaaaaa#aaaabbbcbbcccddefgedfedddcccbaabcdcccbcbcaabaaaa########.##.########aa###a########aaaaa#a###a###aaaaaaaaababccaabaa#########aa#a#",
-"##aaaacb########aaaaabbbbcccbdcddbbcbc#aaaca##a#aba######abca#aaaa#aa###aa###aaaaaabbaaa#a###aaaaaaa##bcbba###a#aaaabbceedddehgfdaaabaccbfhiihffcaaaaccbaaaaaaacabaaabbaabcbbbbbbbcbdeffedfdb#acaabafjgbbcbcccbccccdefiicbbbbacccddddddddccccbbcfbbbbbabaaaaaaaaaabbbcbbbbccccdegfecfdbaabdabbbbcccdcccbbbbaaaa###################a#aa##a#a##a####a#aaaaa###########aaaaaabbbbbaabaa#######aa###",
-"###aaacba#######abaabbdcbbcdcbbefcbabcbbaaaaa####aa#a#a#a#a##aaab###a#aa####abb#a#aacbaa####aaaaaaa#aaabdcbaaaaaaaaabaceefeeffffbaaabbabccehigfeeddefdbabaaaaabbbabaabaaaaabbbbbbabccbabdedda##aaabbachhbbcbccccbbcccdeghebbbaccddddddddddccccbacecbabaaaaaa#aaaaabbbccbbbbcccdcdgfdfebbbbbcccbcbcddccccccbbaaaaa################aabbaaaa####aa###a##aba#############aaaaabbbddbbaba##########.#",
-"####aaaba#######aaaaabdfdbbcccbbdebbaaaab#aaa#a###aa###aaa###aba#####aaa#####aba#aaa#baaa#####aaaaa###aabcccaabbbbbcbbbdfffgeccebaaabbbbcbbeffedccfghhebaaaaaabbaaaaaaaabaabbabbbbbacbbbbcbdda####abbabghabbbccccbbccddddghdaabcddddeedddddcccbbabdfdaaaaa##aaaaaabccccccbbccddcbefdffdcbbbcdccbbccddcccccbbbaaaa################bbccbaabaa#aaaaaa#aabba##a#########a#aaaaabbccbcabaa###########",
-"#####aaaba#######aaacccefcccbcdccbcbbaaaaa#abcba#########aaaaaaa######aaaa####aa##aaa#aaaaaaa##aaaaa##aaaccddcccdddddcceeffdccdccbaaaaabbbbcfggdddfffggfebaaaaaaaaaabaaabccbbbbbbbabccbbbbbcbdb###aabbbbghbacccccccccccdddfigdbcddddddeddddcccbbbabbfeabaa#####aaaabcccccbcbdddecegfffcccabbccccbbccdcccccbbbbaaaa############a#aaaababaaaaaaa#aaa##aaaa#aaa##########aaaaaabbcccbbdba#########.",
-"#####aaaaa######aaabddefcccbabdccccbaaaaaa###aaa######aaabaabbba#######aaaa####a###aaaaaa#a##a#aaaaaaaaaabcddddcdeeedefgfefecdaabbaaaaabbbbbadfebcfdfgffeeecaaaaaaabaaacabdbaaabbbcdcbbbbbbbbccb#a###abbaegcabccccdcccccdddcfihfdccdddddddddcccbaaaaaddbaa######aaabccccbcbccdddhfcfgecccbbbbcbccbccbccbcccbbbbaaaa#a##########aaaaaabccbcba#aa#aa#aaaaa#aaaaa###########aaaabbaddedaa##a#.#####",
-"####aaaaaa#######cffdabcbcdcbbadfbcbbaa###a#aaa#aaaaaaabaaaababaa#######a##a#########aaa##aa##aa#aaaaaaaaabdeddccddddddffeeeec#a#aaabbbaaabbbcggdcfeeeeegfdccbabccbbaaabbbcaaaaabbbcdbbbbccbbbdbaaa###abbccebabbccccbcccccddcdfhjhedddddddddccbbaaaaaabdda#######aaabbddccbbdddedccdgeeedccbbccdccbccbcbccccbbbaaaaa#########.##aaabbaabbbcbaaa###aaaaaaa#a#a#a########aaaaabbaccddeb###########",
-"########aaa######acddbabcbbcccabcddcaabbaaa##aaaaaabbbcaaaabbaaaaaba########aaa#aa###aaa###aa##abaaaaaacbbbcdffeddeccdffffeddbaaaa#abbaaaabaabegebdfeddeffeddddcdddcabbacbcbccbaabbacccbcdbbbcdb#aa##aabbbbbffbbccccbccccccdddedfkkidddddddcccbbaaaaabbabdb#a#####abcccdbccccddfcccdfgeedccbbbcbccccbbabbcccbbbbbbaaa############a#a#aaaacacbaaa####aaa#aa###a##a######aaabaabbbbbbdfa##########",
-"#################abbcbaacccccbccaacbcaaaaaaaaaaaaaaabccabbbbaaab##bb######a#aba##aa##aaaaa##a#a#acabbbacdcbcddffffdgeefefeddcb#a##aaaaabaaaaaaddfdcfdccccccdcbcbcccecbbabccdddddcbbbbccccccbbbceb#aa###aaaabbfgbacccbcccdcdddeedgjkihccddcccccbbaaaabaabaadca####aabbcccbcddccefdcdeeeedddcacbccccccbabaaabbbbbbbaaaa###########.#####aaaabacbba##aaaaaaa####a####a######abbabbcbcbcdb###a##.##.",
-"###########aa#####bdbaaaaccddbbdcba#bbaa##aa#aaaabbbbbbaaabaaaaba##aa.####aaa##a#aaaaaabbbaa#####abaabbbbbccdddeefeffddefdccaa####aaaaaaaaaabaeefdedeccbabbbdddbbccccabbbbbbbbcdcccbcccccccccbaaaa#a####aaaabacgcabbcccdddefffedgijfehdcccccccbbbaa#aaaaaaabcbaaaaaabbccdcdddefgecddeefedccbbbabccbbbbaaaaaabbbbaaaaaa################aaabcbabbaa#aaaaa#aaa###a####a####aaabaabcbbbcbba###aa####",
-"############a#####abaaaaaabddccbcdddbaaaa###aaaabaaabbbaaaabbabba###b######aa######a##aacbcbba##a##babbccccdddddeeefgfeedccdb####a#aaaaaaaaaaadefedecbabbbbbcddddbcddcaabaaaaaabbbbbaabbccdcccbbbcb#a##aa#aaabbbfdbbccddddeffffefggeedjhedcdcccbbaaaaaaaaaaabbcaaaaabbcdcccdeefgdcccdefeccbbbbbbbccbbbbaaaaaaabbbaaaaa#######aa######aaabbbcab#a#aaaaaaaa#a##a#####abaaa#abaabbbbbbdccc####aa#.#",
-"###aaa###a#a#a####aabaaaaaabdbbbcecdcbaaaaaaaa#aaaaaaaaaaaaabccbb###a########a#a#aaaaa##aaaabca#a##aabbccccccdcccbbbbcbcabbbb#a#a#a#aaaabaaaabbeffddeabcbbbbcccccdccbbbaaaaa#abaaaaaaaaaababbbbbcbb#a##a##a#aaaabefcbdeeddeffffffeddfbchjieccccbbbaaaaaaaaaaaacfcabbbbcdddcdehggffeeddgfecbbccbbbccbcbbaaaaaaaaabaaa######a##aaa####aaaaaaabbaa##aaaaaaa#aaaa#####aabbaaaabbbbbbccccddbaaaa####.",
-"####aaaaa#aaaa#aaaaaaabbaaabccbbbcddbbdcbaaaaaabaaaaaabbbbaaaaabaaa###############aaaaa##a#aaaaaaaaaaabbccccdcbbbaaaaaaaabaaa#######aaaaabbbabaacffffbbbbbbbbbbbbccccbaaaaaaaaaaaa##aaaaaaabbccca#######aa###aaaabcgfcdeeefgggggggeffcbbehkjebbcbbaa##aaaa#aaaadheabbbcdddcegfbccdfffgggedccccbbbbbabbbaaaaaaaaabaaaaaa######aaaaa#aa##aaaabaaaaaaaaaaaaa##aaa##aaa#acbaaabababbcccdecbaaaa###a#",
-"#######a###abaaaaaaaaaaabbdccccbbbceefebcaaaaaa#aaaaaabbbcccaabaaa###aaa#######a###aaaba##aaaaaaa#aaaabccccccbbbaaaaaaaaabaa###a###a#aaaaacbababa#eeedbbbbcddbcbccbccccaaaaaaaa#a#aaaaaaaabbbbcba########aa####aabbbghdeeegggggghggfedbbbcdikgbbbbbaa#aaaaaaaaaabheaabccddegdccccdddccfffddbbabbbcbbbbbbbbbbbaaaaaaaa########a###aaaa#a#abaaaaaaaaaaabbabaaaaaaa#a##ccaaaaaaaaaabcccbacaaabaa###",
-"##a#aa#####aaaaaaaaaa#aabbbabbcbbabcdeedcbbbaaaaaaabbbccdddccccbbccbdcbcca########aa####aa##a#aaa###aabbccdccbbbaaaaaabaaaaa#########aaaaabcaaabaa#dfcccbcccbcccccdccccdbbaaaaaa###aaaaaaabbbcb######aa###aaaa###abbcfheeffghhghhijifcbbbbbehjhcbbba##aaaa##aaa##afgdbbcefecdcdccddddddeedcbabbcbbabbcbbbaaaaaaaabaa######a#a#a###aaaa#aaabaaaaa#aaaaaaaaaaaaaaaa#a#bcaaaaabaaaaabbcccbcabbbaaa#",
-"aaaaaaaaaa#aaaaaaaaaaaa#abaa#aaaaaaaaabcbbaabbbabbbbccddddddefdbcdccdecddcaa##aab######baaaa##ab###aaaabbbcccbbaaaaaaaaaaaaaa########aaaaaacdbaabaa#dcabccdddcccccdeeddddddbaaaaaa###aaaaabbbca#a#########a###a##aaabcegefgfhhggiiihddbbccbbfegihfb###aaaaa#aaaa##adgfefecbddccccddcedccefdcbabcdcaabbbbbbbaaaaaaaaaa#a####aaa#aa###aaaabaaaa#aaaaaaa#aaa##aaabaa##abcbaaa#aaaaaaabbbbdddbbbaaaa",
-"aaaabbabaaaaabaaaaa#a#aaa#abaaaaabaaaaaaaaababbbbccdddeeefdfffedccbbbbcccccaaaaacb#abaab#aaba#aaa###a#aaaabccbaaaa##aaa#abaa###a##a#aa#aaaaacca#abaaadbabddddfededcbbcaaabcddcaaaaaa###aabbbcdca######a####aa##aaaaabbcdkgghhhhhgiigecabbbccffedgiida#aaaaaaa#aaaaaabfecbccccbbbabbbddddddccbaaacdcbbcbbbbbbbaaaaaaaaa##################baaaaaaaa######aa#aaaaa#a##abbbbaaaaabbaaaababbddcbbbbaa",
-"aaaaabcccbbbaabaaaaa#aaaaa#aaaaaaaaaaaaabaaabaaabbbcdffefgffdcccdddcccccbaabaaacbab#aa##aaabb#a#a##aaaaaaabbbcaaa###aaaa#aaa#a###aaa#abaaaaaacccbaaaabcbaaccbbdccbbbababba#abccbaaaaaaaaaabdeabaa##########aa####aaaabbceghghhihiihhgcbbbbbbegdcdedhhdd#aaaaaaaaaaaaabdccccccaaabbbbcddddfeffdbbabcbbbbbbbbbaaaaaa###a#########aa#######acbaaa#####aaaa##aaaaaaaaa#a#aaaaaaaaaabbbbaabbccddbbbba",
-"aaaababbbccbbcbaaaaaa#aaabba#aaaaabaaaaababbbbbaaaaaa#aabbcaaabbbbbbbbbcbaaaaaabaaaa####a##aaaa######aaaaaabbbbb#######a#aaa#a###a##a#aaa#aaacbbcbabbabcabbbcddbaaabbaaaa##aaaabbaaaaaaaabbcdbaaa###########a####aaaaabbbcfihghhhihhhdabbbbbbeeccccbdehfaa##aaaa#aaaaaabedccbaaaabcdcddcbfeffddeedccbbbbbbabbaaaaa#############aa########ababaa###aaaaa###aaaaaaaaa##abaaaaabbbbbbbbbbbbcdffabaa",
-"aaaaabbacbbbabaaaa#aaa#aaaacba###aaabaaaaaababaaaaaaaaaa##aaaaaaaaababbccc###aabaaaa##a##aaaaa#aa##aa#abaaaacccb##a#a#a#aaaaa####aaaa###a#aa#ababdbbbabcbabbbbbbbbbcbbaaaaaaaaaaba#a###aaacbcdaaaa#########.#####aaaaaabbccfkjgfhhifdfdaaababbffcbbbbbacgda#aaaaaaaaaaaaaddcba#aabccccdbbdeefeddfdfecbbacaaaabbaa##############aaaaa#######a#aa###aaa####aaaaaabaaaaaaaba#aaababbbcccddddgihcabb",
-"baaaaababccccbbaaa##aaaaaaa#cddb#####aabbbbaaaaaaaaaaa#####aaa##aa#aabadedca#abbaaaaaa####aaaa#a#aaaaa##aababcbca#aaaa#####aa###a#aa##aaaaa#a#aaacbaabbbcbabcccbbbbcbabba#aaaaaaaa#bbaaaaabbadb###################aaaaaabacbgkkihhggfedaaaaaaaceecbaaaaabffgeca#aaaaaa###acdca#aaacbbccbcbeeefffdabdfecabaaababbaa#a##########aaaaaa#######abaa##aaaa#####aaaaaaaaaaaaaabaaabaabbbbbcdegghffdabb",
-"bbaaaaaabbcccccbbaaaaaaabaaaabccca###aabcceebaaaaaaaaaaa#a##a#####aa#aaaddbbaaabaaaaaaaaaaaaabb##abb#aaaaaaabcbba##aaa###aaa#########a#aaaaaaaaaaaaaabbbccbaabccbcbbbbbaaaaaaaaa##aaabaaaaccbed#################.##aaa#aaaaacekljihhhdbaaaaaaabdeedbaaaaaabceffdaaaaa#####abdd##abbbbccccbcedfeddbbbbdddbbaaababaaa#################aa#aa.###aa##ba##aa###aaaaaaabaaaaabaaaaababbabbbdfhjifeecba",
-"bbbaaababaabbcccbaaaaaa#aaaaa#aaba##aaabcbbccbaaaaaaaaaaaaa#aa####aaaaaabccbaaa#aaaabaabaaaa#abdca#acaaaaabaabbaba#aaaaaaabba##aaaaaaaaaaaa##a#aabbbbbbbccbbbacbcbabbbbbaaa#aaa##aaaaaacbccccdbbba#a########a#.####aaaaabaaaaafklljhfcaaaaaaaa#dcgfcbbaaabccccdggcbaaaaa#aaaacdaabbbbbbbbcbddeeddccccbbcecbaaaaaaaa#a##############aaa##a####aa##b###aa#aaaaaaaaaaaaaa#aabaaaaaabaabbdggghhfbdeb",
-"bbabbaaaaaabbcbccbabba#aaaa##a#aaa#a#aaabbabbbaaaaaabbabaaaa#a#####aaaaaadcba###aaaaaaaaaaaaaaabbaa#abaaaabbbcbaa#aaaaaaaaaaaa#aaaaaaaaaa#aaaaaaaabbbbbbbcbababbbcbbbbaaaa###a###aaaaaaaccddcddbaaba#aaaa####a#.#.#aaaaabbaaa##djlljc#aaaaaaaa#afdfebaaaabccccddegfdbaabbbbbbabddbbbbbbbbbadceedcdcccbbabdebaaaa#aaa#############aaaaaa#ab####a##ba#####aaaaaaaaaaaaaaaaaaaaaaaaaabcdfebbbabbbcc",
-"ecabbaaaaababcdcccbbbcdbaaaabbaa#aaaa##aabcbbbaabaaabbaabaaa#aa###aaaaaabecbaa#a#a#aaaaaaaaaa#aaaaaaaaaaaabbcbaa###aaaaabaaaaaaa#a####aaa#aabaaaaaabbbbbbdcbbabbbcbbaaaaa####aaa#aa###aaabcccccbaabbba##a####aa#####aaaabaaaaa##ahlkfa#aaaaaaa##fbbecaaaabccbcdddceghecbbccccbbbccddbbabaa#ccedddddccbbaaacfbaa#a##a############a##aaaaaaaaa##a###ca#aa###aaaaaaaaabaaaacabbaaabbbbddea###aaaabc",
-"abbcbbbbaaaabbccbbbbaaaa#a#aaaabcaaaaaa#aabbbbaabaaccbbabaaaaaaaaaaaabbabdcbaaaaa###aaaaaaaa#aaaaaabbbaabbbabaa#aaaaaa#aaacbbaaa##aa##aaaaabcbaaaaabacbccccabaabaacbcbaaa####aaaaa####aaaabdccdba#abbaaa#######a######aaaaaba#####dljfa#aaaaaaa#ddaadcbccbbbbccccdccehihfddccccccbbdfaaaabbbceefedddcbbbbaaaecaaaaa##a###a####a##a##aaaaaa####a###ba#aa###aaaaaaaaabbbbacbbbbbaaacccdd#####aaaab",
-"babbbcccbbbaacdbccbbbaaaaa######aaaaaaaa##abbbbabaaabbaaaaaaaaaaaa##abbbdcccbaa#aa#####aa#aaaaaaaaaaabcbabbabaa##aaaaaab#accbaaaaa#aaaaaaabcddbaaaaabbbccccbaabbbbaabbbbaa###aaaaa#####a#abceeeaaa#aaaaba#######a#######aaaaaaa###.cgjgb#aaaaaaaafcaacdcdcbcbbcbbccdeefeeghfeccccbcddc#aabaaaeffeccccbbbbbaaacdcaaba##aa##a#aa#aaaa#aa###a####a####b#a##aaaaaaaaaaaaabbbbcababbbbcdddeb#a#####aa",
-"bacbbcddcbbbbacddccbabbaaaaaa#a##aaaaaa####aabbaaaaaaabaaaaabaaaaaaaaabbcccbbabaaaaa#a#aaaaaaaaaaaaaaaabbccbbba##aaa#aaaaaabbbaaaa#aaa##abbaabbcbaabbcccccbbbbbabbbabbbbaa#############aaabbcedbaaaaaa#aaa######a########a#aaaa##a##adhjc#aaaaaaacdb##bddcbbbbaabbccefgecceffgfcbceccedabbaaacffdccbbbbbbbbbaabccbbaaa#aa####a###aaaaa#a##bb##a###ab##a###aaaaaaaaaaabaaabbbcbcbbbcefeb#####aa#a",
-"aaccbcddcbbabcbcddcbbbcbaaaaaaaa#aaaabaa##a#aaaa##aaaaaaaaaaaaaa#aaaaaaaaabbccaaaaaaa#aaabbaaaaaaaaaa##aabccccbaa#aaaa#abaaaaaaaaaaaaaabbbbaabbaccbddedcbbbbbabbbcbcbbcaaaa############a#aacbcba##aaaaaa#aaa#a###########a###aaaaa####adid#aaaaa##eca##addcbbaaaabbcddefddefddgiedccccffbaaaaaefeccbbbbbbbbbaabacdbbba####aa#a##a##aaaaaaccbba###.aa#aa#ba#a#aa#aaaaabbabcbccbcbcccegc######ba#a",
-"abcbbccdedcbbbabdddcbabbbbbaa##aa#aaabaa######aaaaaaaaaaaaaaa#aa#######aa#aabcbbaaaaaaaaabcaaa###abaaa#aaabcbcb#aa##aa#abbaaaaaaaabbcaaaaaabbgecbbbbccbbbbbabcabbcbbbbaaaaa##############aaabaaaa#aaba#######a###########ba#aaa#aaa###aabffcaaaaaabeb####cdcbaaaaaaabbccdeffeeegihfddddffcaaaabefeccaabbbbbbbaaaabdba#aa####aaaaa###aaaacccbbba#######aaaa#aa#a##aabbbbbbbccccccccddgf#aa##a#aaa",
-"aabcdddddddbbbccabcdccbaaaaaa#####bbaaaa#######aaaaaaa###a#####a#########aaaacbbbaaaa#accdddba#a#aaaaaaaaabbbcbaaaaa#aaaabaaaaabba#bdaaaaabeecbbcbcbccbbbbabbbbbbbabbbbaa#aa####a########aaaaacaabaabaa#######aa########abbbbaa##aaaa###aaegfb#aa##dcaaaabddbaaa##a##aaabcdfgffgiggfffedefea#aabffccbaaabbaaabaaaaacbaaaaaaa####a##aaaaaabbabaaa##aa##aaaaa######aabcbaabbccccbbddedeeaaaaa#baaa",
-"aabbdeedeedddaccbbbcbcccbaaaaaabbaccaaa#a#aa###aa#aaaa#########aa#a#####a##babbbbbcbbcfdccccbbaabaaaaabaabbbccbbaaaaaaaaaabaaaaaaaaacfcaaabcbbaaababbcaabbbabbbbbaaacbabaaa####a##.########a#abd##baaaaaa##.###aa#######abbadb#a#########aaeiib####bca#aabadcba########aabccdgghgfeddddeedegdaaabdedbbaaabbabbaaaaa#cbaaaaaaaa#a##a#aaa#abbbbaaa#aa##aaaaaaa#####aaabaabbbbccbbbcdecef######acaa",
-"baabcccddedddbacccbccdcbbbbaa####aa##aaa###a###aaaa#a#####aaaa#a#aaa###aaaaabbbbbabcgjfdccbbbaaaaaaaaaaaabbacccba###aaaaaaab##aaaabbbdfdbaabdecbbbabaabbbbbbbbbbbbababbaaaaaa######.########a#acdb#aaaaaaa######aa######abbccb####aa######afiifa###bca#aaaabcbba#a######aaabcdeefcbcedccccceffaaaaacdbaaabbbaabbabaaabcbbaaaaaaaaa##a#a##abbaaaa#ba##aaa###a####aaaaaaaaaaccbbbcccdeff.######aaa",
-"a#aabbbcdeddcccbcccccdcbbabaaaa##a###aa#a#a#####aa##a###a##aaa####aa#a#a#aaabbaabbbbbffdccbbbabbaaaabbbbbabcbbbaaa##aaaaaaaaa###aabcbbcdfdaacebbbbbaaabbbbbbbbbaaaaabbabaaaa###aa############abcdcaaaabbaaa######aa#####abbbdc#############adghf###cdaa##aaaabbaa##.##.##aaabcdecedbbcdecbbbccebaabacdaaaaabbbbbbbaaaaabdcbaaabaaaaa##aa#aaabaaa#bcaaaaaa###aa#a#a#aaaaaaaaababccdceec##########",
-"###bbbbcdeddddcccccbccbccbbbaaa#####.#a##aa######a##aaaa###aaaaa##a###aaaaaabbbbbbbccddcdcbbbbbcdbbbadecccccbcb###a###aaaabaaaa###accbbccfhcacbbbabbabbbbbbbbaaabbbaabbbaa####aa#########.####aabcbaaaabbaaaa#####a#####aabacfb###############dhhc.ddb###a###bbca#.#....##aaabcdccecbbccedbbcccedbabbdcbaaaaaaaabaaabaaaacccaabaaaaaaaaaaa#abaaabbcaaaaaa###########aaaaaaababbbceeda.#####a###a",
-"#baaabbcdeddddddddbbcccbcbbbbaaaa################aaababba####aaaaaa###aaaaaaabbaabbdecbccccccbbbccccbcbbbcbbddeeca###aaaabccaaaaaa##abbbbcdedbbabbaaaaabbbbbbbbaaaaaaabbaa#######aaa##########aabbbaaabbaabaaa########aaaaaabdfb####aa#########cghhceba###a##aabaa#.....###aaabcdceebbbbbddcbccbcdcabcedbbaaaaaaaabaaaaaa#cddbbbaaaaaaaaaaaaaaaaccbaaaaaba#a#a######a##a#aaaaaaccdeed####aa####a",
-"aaabaabccceeddeedcabbbcbbcbbbbbbaaaaa#########a##aaaaabbcbaa#aa#aaaaa#aaaaaaaaaaabbcddcbbbbbbbbbbbbbabbbbbbaabbdgfba#aaaaabbaaa##aaaaaabbbcceedaaaaabbabbbabbbbbbaaaaaabba#######aba#########a##abbcaabcbaabbba########aabbaabddca#aaaaa#########adjhaaa#aa#####aaa#...####aaabbcccfdabbbbbddcccbbccacffccbaaaaaaaaababaaa##bccccbabaaaaaa#aaaaabdcaabbaaaaa#########a#a#aaa###bcddhga####aa####",
-"##aabbbbcdffeddeebdcbbbbbcbbcbcbaaaaaa##.##aa######aabbbbaaaa#aaaaaaa##aaabb#aaaaacddfbcbabbccbccbbbaabbaaba#abadfdbbaaaabcaaaaaaaaabbbababbceedaaaabbabbbbbbbbbbaaaaaaaaa##.#####aa#########aaa#aacdabbbaaaaaaaa#######bbbbccdcddbaabbaaa####aa###bhgea#######.##aaa#####aaaababbbcebababbabdeccbbbceffeecbaaaaaaaaabaaaaaaa#bcccbbbbaaaaaaababbbbbaaaabaaa#######a##a#aa#aaaaabddhg###########",
-"#a#aaabcdddffdddeeedbbbbbcbbbbcbbbaabaaa#a##a##aacaaaaaaaaaa#a##aaaaacdaaaabaaaa#accdeaaaaabbbbccbbbbaaaaabbbababcdddcccbbaaaa#aaaabbbaaaaaabdeeeaaaaaababbbbbbaaaaaaaaaaaa###a####ba####a####aaaaaabecaa######aaa#####a#ababccccbcbabaaaaaaa###a####dijdb########a#a###aa##a#abbbbddbaaaaabbabdddcfeffffeccbbaaaaa#aaaaaaaaaa#abccbcabaaaaaaaabbaaababaaaaa#aaaa###aaa#aaaaaaaaabchga#####aaa##",
-"#a#a###abccdddefdeeecbbbbbbaabbbbbbbbba#########abaa#aaaaaaa##a#aaaaaccbaaabbabbcbbccfbcaaaababbbbbaaaaaaaaaaaabbbabbabaabaaa#aaaaaabbabaaa#abcdfea#aaaabbbbaaaaaaaaaaaaaaaa#######bba##########aaaabcedbb#######aa#####a##abdcbbccbaaaaaa#aaaaa#aa###bgjjga#######aba#aadba##aabbbccbaaaaabbaaabedffeffffdcbbaaaaaaaaaaaaaaaa#aaaccbbbaaaaaaaaaaaababbbaaaa#aaa#####aaaaaaaaaaabbbghc#####aaaaa",
-"a##a#aa#aabccbdfgeefeccababbbaabaabbbaa#a##.######aaaaaaabba##aa##abbbcbcbbccacbbdedgheccbbabbaaaaaaaaabbaaaaaaaaaaaaaaaaaacbbba#ababbbbaaaaaaabdeeca#aabcbaaaaaaaa#aaabaaaaa####.##ba###########aaabbceeba########a#########cbbbabbbaaa#aa#aaaaaaaaa###djkjb#b#..#abbcaaabcba##aaabbcaaa#aaaaabaacfffffedffccbaaaaaaaaaaaaaaaaaaaabcbbaaaaaa##aaaaabaaabaa#aaaaaaa#a#a#a#aaaabbbbccgc######aaa#",
-"##aaaaaa##aaccbaeihfgggcbabbbaaaaacbbceceeca########aaaaaabaaaaaaaabbbdcccdebbcbbabacedecbbbabaa#aaaaaabbbbaaaaaaaaaa#aaaaa#abbbbacbbbbbbaaaaaaaccddbbbbbbbaaaaaaaaa##aaa#a##a#####aa#############aaabbceeea########a########aaaaaaaabbaa###a###aaa######agjkhgfb.#aabddaaaaaaa###aabdb##b###aaaaa#cffffeeeeeccbaaaaa#aaaaaaaaaaaaaabcbaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaabbbbbdfeba####aaa#",
-"#a#aaaaa###aacca#cjjhhjebcbaa##a##acegebdcbdb#.#cbcaaaaaaaaaaaaaaaaaabbcdgiecbbaaabbbcbcdcbbbbbaaaa#aabaabcbaaaaa#aa#aa#aaa###aaaaaa####a###aaaabcddbcbbbaaaaaaa#aaaa#aaaaa##a#####baa#.#######a##aabbcdddffa##.####aa##.####aaaaaaaaaabaaa###########a####chhiihc..ceffbabaaabaaaaabccaacc###aaccbbegfffededdccbaa#a#aaaaaaaaaaaaaaaabcbbaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaabcccefeaaa###aa#a",
-"aaa#abaaaa##aaba##eiiikhccbddefeeffgecccdccdeffefddc#aaaba#aaabaabbaaaabcdhfbbbbaaacdecbbaabbbcbbbbaaaabbbbbbaaaaaa#######a###aaa#aaaaa######aaaaaccbcbaaaaaaa####aa##aaaaa#####a##############a##aaabcccccdfb##.#####a######aaa#aaaaaaaaaaa##########aaa##.#aejjifb#cffacbbbaaa#acbbcc##ddda##cddeefgfffeedddcabbaa#aaaaaaaaaaaaaaaaaaacbbaaaaaaabbabbbcaabaaaabbabbbbabbbbbbbbbbbdfc####a##aa#",
-"#aaa#a#a##a####b###dgkkjgccfiifdfdeeccddddcdcccccbca#aa##aa#aaaaabbbaababeggdbaaaaadfcbbbbbbcccbabcbaaaaabcabbbcbaaaaaa##########a#a########aa##a#accbbaaa#########aa###aaaa###aaa####.#########b##aabcbbcddfb###############aaaa###abbaaba#aaa#########aa#####djjjifbcebccdcba#bbacbcb##addccdcdeeefgfffeecbccbbbaaaaaaaa#aaaaaaaaaaaaaabbaaaaaaabaabbbbbaabababbbbbbbbbccccbbbbcced####a###aa#",
-"a##aaaaaaaaa#a#ba..#agkgfecfikgddcccdcccbcccbcbcbbdba##bccaaa#bbccccbaabbefffcaaaabdfbbbbbbbbccaaabaaaaaaabcbbbabbbbaaaa#######aaa############aa###abbaaa####a############a####a#######.#####a##aaa####aaaacfa#######..######aaaa###a#cdcbbbabcbaa#aab#########.chiiihfcddeghhgdccdabdaa#addcddceefeeffeeeedbbcccbbaaaaa#aaaaaaaaaaaaaaaaabbbbaaaaaaabaabbaaaababbbbbbbcccdccdcbbceea####aa###aa",
-"a####aaaabaaabbab#.#aaeecdhfijfcccddcccbbbbccbbbccaaa###.a#abccccbcbcbbbbbff#a###abcebabbbbccbcaabbaaaaabccbbbbbbbbbbbaaa#aa####aa##############aaaa#ababaa##############a#a######a####################aabbcacaaab#####.#.##abbaa###aaabcacbcaaaaaaa#aa#########.bgihiifcdgijjjiidaaabe#a#bdcbccccddddddecdecbbbccbbaaaaa##aabbaaaaaaaaaaabbbbbabbbaaaabbbbbaaabbbbbbbccdddedddefeffa####a#####a",
-"#######aaaaaaaaaa#.#abcdaahkkjgbbcccbbbbbcbbcbbbbaaaa#a######abddedccccbbacffcbb##acccacdcabbdccdbabaaaa#abbbbbaabbbbcba###a############.##.###########ababaa##################a##a###.################aaabcbcdbbbaa##.#.#.#aabaa###abcdcaabaa####aa#aabbb###a###.#bgjhacegijjjjjjhedfgea##cbbbccbbbcccccdcccbbbccaabaaaaaaaaaaaaaaaaaaaaaabcbabaaabaaabbbbbaababbbbbbccddddedffceedb######aa###",
-"aaa#a####a##aaa##a.##acda#cejjfdbbbbbabcbaabbcbbaa#aaa##a#a###baecbdfedddefhhgefea#cedbafecbbcbecbbccbbbbabbbbbbbccabbcdcaa####################.#######aaaaca##########################.########a######aaaaccccbbca#a########aaaa####bedcaabaa##aaaabaaabc########..#figefhikjihhhhiijiihd##bbcdbcccbcccddebcbbbbcdbaaaaaaaaaaaaaaaa#aaaaaabbcbbbbbbbabbbbbbbabbbbbccddedeedffa###a#####aaaaaaa#",
-"###aa############a#.##bccbbbbehhaabbbaaabbabbcbaba#aaa#######becdda#fgecddeehghegdabdecaabedbcaacbbddbbbbbbcbbbbbbdbaaccccba#########a################aaaaabcaba###############################a#####.###aaaabccbcb##a######aab##a###accbca#b#####aaaaaaaaa###.####...diihiiihfgeffeffhijid##ddcdccccccddddccbbaabddcaaaaaaabaaaaaaaaaaaaaaabbcbbabbababbbbbbbabbcbccdddedefc.##########aa#aaaa#",
-"#aaaaa#aaa##a######.#abbccaaaabgfb#ababa#aaaacbaaaaabbbab####edeefeccgedcddehhfacebadecaaaabcccbbbbcbabbbbbcbbcbccccccabccdb#######abb###a##############aaaacbccba##########a######.########a###a#########aabcceccb###a#####aaaa##aaaaacbb##ac######aaaaa##aaa#######..diihffffffdeddddefiigaaeddddbbcdddccdccbaaabcedbbbaababaaaaaaaaaaaaaaaabdcbaabbababbbbbbbbbbbbcceeegc.#############aaaaaa",
-"aabcbbaaaaaaaa########bbcdbaaaaaffa#aaaaa#aaabbaaaabcdeddabaefcdddefcgfddddeghcccffddbaaabbbbbccbccdbcbabbbbbbcbbbbbdcabbbddb########bca#a#######a##a###aaaaaaabdbaa#aaa####aca##...###aa####a##a########aaabbbdecc##aaa############aa#abba##a#########aa#aaaaa########.bgiedcccdccccccccdhigdeeeeedcdddccbcebaaaaaaceebbbbbbbababaaaaaaaaaaaabcccccfedcbbbbbbbbbbbbabcfffe############a###aaaaa",
-"a#aaedbbbbaaa#a#######abddca#aaaadcaa##aa####aabababbbccccfggcbcccccfgeccccdddffedfecddcbbbbccbbccdcddbbbbbbcbbbaabbcc#abaacba########aa##..#######aa####aaaaa###bbaaa#aaaaa#cc###a.####aa##aaa#########aaabbbbadcdaaabba##########a#aa#bbaa##a#######a#aa#aaaaaa#######.ageccbbbbbbbbbbbcbehigffeedddddccbcccbbaaa#accdcbbbbbbaaaaaaaaaaaaaabbcbccdbaadfdcbbbbbbbcbcefccba#################aaa#",
-"#aaacbaabbcbbbaa#######abcca##aaabbcba########abbaaabaabccdcbabbbccbcedccccccccccccedbbcdbbbccbcbbcbcbbbbbbbbbbabbbbcccbbaaaaaa##a####a#aa####.#####aa##a#aaaaa##abbcaaaabbbabcaaa#.#.###aa#a##a########aaabccabbddbaabaa####.##.aaaaaa##bba##############aaaa##a########.#bddbbbbbbbbbaaaaabfhhgfeedddccbccbdabaaabbbccddcbbbbbbaaaaaaaaaaabacbbcceb#a#babcbbbbbbcbce##.####################aa#",
-"aaaaaa#aaaababba#######abcccb#a#aaacddb######aaaaa#aaaaabbbbbbbcbbbbcdcbcbccbccccddbababcccccccccbbbbaaabbbbccbdcbbbbabcbbaa######aa#aaa############aa#####aaaaa#acbabaa#baabbcb#a##.#####baaa#########aaaabcdcccccbaaaa##########abaaa###aa##############a####aaa########.##dcbbbbbbbaaaaaaaabghgffedccccccbbcabbaaabbcbdedbbbbbbaaaaaaaaaabaaabccdecbcabbbcbbbbbcbeea###aa####################",
-"aaaaaaaaaaaaaa##########acceeba###bbbcda#######a####aaaaabbbabbabbbbbcccccccccbcbbcdcbaabbcbcccccbbbbbcabbbbddegebbbbbbbcaaaaa#########a######aba#####aa#####abaaaabcbb#aa##abaaba#####a##aaaaa######aaaaaaacccccbccaa##a#######aa#aabaa##aaa####aa########a#aaaaaa###########addcbbbaaaaaaaaaa#fieeeddcccbbbbbaaabaabbaaabdedcccbaaaabaaaaabbaabbbcdebaaccbbdddcbbcdc#aaaa###########.########b",
-"aaaaa#aaa#aa#############abcdfdaaaabcdf###aaaa##a#####aaaaabbccabbaaaabbbcccccbcbabbccbbbbbbbbbbbccbbcccbbbcdcdedecabbbbaaaaaaa########abb##aa#aaabaa#aba###a#aa#aabcccbabb###aa#aaa######aa##aa######aaaaaaaccccdaba###########aaa#aaba#aaaa#aa##a########aca##aaa######a######cffaaaaaaaaaaaaa#ehfeeedcbbbbbbcbaabbbbbbbaadeeefedcbaabbabbccbabbdcbcaabdcccccceedffb##aa####################a#",
-"aaaaa###aaaaaa#####.####aabccfgbaabbcfeda##aaabaaaaaa#aaaaaaaccbccbaaabcccbbccbbbbbbcbbbbbbbcbbbbbcabcccbababccdeccbabbbbaaaaa#aa########aaaaaaaabedaa##a#aaabaaaaabaccbaaaca###aaaaaa#####a###aa###a##aaa#aaaccbbabaa############aaaaaaaaaaaaa#########a##acdaabaaaa############acecaaaaaaaaaaaaafhffeddcbbabbcbbabbbbbbbbaabbdeddfeddbabbbdcabbabbababbbcbcbccddffcdaaaa##a###################",
-"aa#a#####aa#aaaa#########abcdcfeaaacbdccfcbbbdddbbbbbaaaaa#aaaabcbaabbbcccbbbcbbcccccccccbbcbcccbbbbbcccbbabbacddedcaabbabaaaaa##aa########cb##aa#cfdaa##aaababbbbaaaabbbbaabaaa#abaaa#####a#bbaaaa##a##aaaaaabbccdaaaaa#####bb#####aa##aaaaaaaa############aabbbbaaaa##aa##########deaaa###aaaaabcgiggddccccccccabbbbbabbaba#aabcaacccccbbcdbaacbbabbbbabcbcdddd####abaa#a##a#a#aa############a",
-"aaa#####aa#a#aaaaaaa######abccdfa#bbcddbcccdcdaaccdecbbbbbbbaabccbaaabbcccbbbccbccccddccccccddccbbbbbbcccbbbbbcccdddbabbbabaaaa########.####bba##a#aca###aaaaaaaaaaaaaabbbaabaabaaabba#######ababba.##aaaaaaaaabcdcb#aaaa#####a##########aaaaaa#a####aaaa##.##abbba#aab#aba#aa#a#####cgeaa####aa#aabfiigdccccbccccbbbbaabbbbaaaaaabccbbccccdabcbccaaaaabbbccdebdbaaaaaaaaa#a######aaaaa#########",
-"#aa#a###aaa####aa##a#####aabbbbeb#abbceeba#a####aaaba##cdbbbcccdccbbbbbbccbbabcbbbcbcddccccccddddddccdcabbbcbccbbbddcbbbbbbbaaaa#########.####aaa####a#a#aaaaaaaaaaaaaabbbbaaabaaaaaaba####a#.a##ab##.a##a##aaaabbddb##aa#####aa######.##aaaaaa#aa####a#aaa###abbb###acaacaaaa##a#####bff###a##aaa#aacghhfccbcbcbbcbbbbbbbcaaaabababbdccccddbbccccaaaaaabbccee##aaaabbacaaaa######aaa#aaaaaaa###",
-"#aaa##########aaaaa########bbbbbea#babcea#a######aaa####bccddcddedcccccccccbcbccbbbcbcddddcccbbbcccdefedcbaacbbcbbbbbbbbababaaaa############.###aa#a##aaa#aaaaaacbba##abbcbaaa#aaa#aa#########a#######a##aa#a#abbcbcc#a############aa####aaaaaaaaaa#######aa###aabaa##bbaaaa#a##aa######dea#####aaaaaa#behhdccbccacbbbbbbbcbbbaabbabbbcdcccdddbbbba#aaaaabbddb#######bcaaaaaa######aaaabbbaaaaaa",
-"aa#aa##########aaa########aabbbbbedbaabddcb#aaaa#aaaa####cccaacdeeggecccccccbbabbbbbbbbccddcccbbbbcbcddeedcbaaabbabbbbcbbbabaaaa###########.#####aba#######aaaaaabbba#aabbbbaa###aa##a#####.#a#.#.####aa##aa#aaabccbca#aa#..########a######aaa##aaa#########aaa#aaaaaabcaaaa##a##a###a#a#bdb#aaaaaaaaaaabcfhfccccabbcbbbbcbcbbbaabaabbabcddcdcccbba##a#a#abddb########aaaaa#aaa####aaaaaaaabbaaa",
-"aaa#aa##########aa#a#a#######abbabgebaabacca#ba#aaabaa#########a##bdeddeedddcbbbbbbbcbabacdddcccccbbbcdcdcdcabbbbbbababbbccbabaa###############aaabb####aa##aaaaabbbaaaa#abbbaa###aaaa###a###a##....###a##aa##aaabbbca##aa#.#######aaa##aa######aaa#########abaabaaaaaacbaaaaaa##a###a##a#afb##a##aabbbaaaaeggecebcbbbabbbcbbabaabbbbbbabbdddccccccabaaaaaaccc#####a#aaaa#a#####aaaaaaabbbaaabaa",
-"aaaaa############aa#a########.#abbcffcabbceccaaaaaaaaa###a###aa#######aaeebccccccbbbbcbbccbdddccccccbbbccbbbbbbbcbbabbbbbccbbbbaaa########.#aaa#a##aba#aa##aaabbbabbbaaa###abaaa#########aa##a############aa###aabcc#aa#aaa#######.##aaba#aaaaaa##aaaaa######baaaaaaa#aaaaaaaaaa###aaaaaa###ebaaaaaaaaaaaaabbfhgedbbbbbcbbbbbbabbbbbbbabbbbddecbcbbbbbbcbbbceaa#####aabca#a#a#a##a#aaaaaabbbbbaa",
-"aaaaaaa####aaaa#aa###########..#aabdddbbcccccaaaaaaaaaa##a##aaa###aa#####eddedddcddccbccbccccbbcbbcedbbcccccbbbbbbbbababbbcbbcbaaaaa############a#a#aa#aaaaabbaabaabaaa#aaa#abaaa#######aaaa#a###########.#aab##aacc#aa####a######..##aa#aaabbaaa##aaaaaaabbaabaccbaa###aaaaaaaaaa##aaaaa##a#ccbaaaaaa###aaaadgggfeababbcbcbcbbaabbbbaaabbbccddbcbbbbbcdccccca#a#a###aaaaaaaaaaaa#aaaaaaababccba",
-"aaabaaa#a#######a#aaa####aa###.###bcdcbcbabddbaacbbababaa#a##aaaa#aa#aacdccbddddddbbbbbaa#aaa######bfggfdcccbabbbbabaaabcbccabbaaaa#########a#aaaaa#######aabaaabbabbaa####aaaabaaa##aa##aaa#b####.#########abb#aaee##a###.##.##.###..####abccccbaaaaaaaaabcdaabbccba##a#aa#aaaaa#a#aa#aaaaaaaabebaaaaa#a##aabbfghhgedaaabbbccababcccbbbaabccbcccbbcbbcdcdcaaa########aaaaaaaaaaa#aaaaaaababbccb",
-"abaaaaaaaaaa######aaa########aa####bbccbbaabceaa#cbbbbbba#a##aaaa#aa###debacb#aacabaa##aa###########.#afhgeecbccbbbabaacbcccbbbbbbaa#a#########aa#aaaa####aaaaaabbbbbbbaa###aaabbba###a##aaa###.#######ba##aaadbaabeaa##aa#..###.##########abaaabdbaaababababbaabddbaa##aaaaaaaaaaa#aaaaaaaaaaa#aecaaaaa#aa#aaabdghhhfecccbcbbabbacccccbbbbbcbbbbbcbabbdcbcba########aaabaaaa##a###aaaaaaaaaabbb",
-"baaabbaaaaaaaaaaaa###########aaa####acccbaaaabcbcabbbbbbba#####aaaba#acbcaa#aaaa#abaa############.#####.dhihgeefccbbbbaabccbbbbbbaaaa##########a#aa#aa####aaa#aabaabcbbaa####a#aaaa###a#aaa################abbeebbbdd##a#######..####.######aaaaabcbbbbbbbbbbb#abcccbaaa#aaa#aaaaaa###aaabaaaaaaa#bcbaaaaaaaaaaaabehhhfedaaabaaabbccccbabbbbccbbabccbbbdcbbaaa#######a#aabaaaaa#aabaaaaaaaaaaabb",
-"bbaaaaaaaaaaaaaaaaaaa#########a#a####bbcbaaaaabeecbbaaabbaba###a#aaa##cedb#aaabaaaaa##a#########.##.###a#bfgedeffdccccbaaacdccccbbaa###########aaa######aaba###aabaabbbaaaa#####aa#a##abbaa####.##.####aaa#acbddddfega#a#######.######.##a#aaaa#aaaaaaaabccddebaba#bcba##aaaaaaaaab#aaaaabbbcaabaaaaccaaaaaaaabaabbehhfgebaaaaaaacdcccaabbcbbcbbbbbcdcbbcaaa#a######aa#abbaaaaaa#abbaaaaa#aaaaab",
-"bbbaaaaabbbaaabaa#aaaa###.#######a####abb#aa#a#cfecaabbaaaba#######aaa#bddcdaaabaaaa#a#aa######.########ba.a####bfddcccbbacdccccccaa############aaa######adb###aaaaaaabaaaaaa###aaaa##abaaa#####..#####aaaaabbcdeedfgd#aa########.#######a##aa#aaaa#a###a#abeedecc##aaba#aaaaaaaa#bbaaaaabbbbaaaaaaaaaccbaabaaababbadgggfdb#aaaaaabcbbbbbbccccdcaabbcdcccbaaa#######aaaaaaaa##aa###aaaaaaaaaaaba",
-"bbbbaa#aaaabaaaaaaaaaba#a######.#######abbbca##acdedcaabca#a#.###a######bddcfcaabaaa##a##a#####...##aa####a####a#abbccddcbbddedccccbaa####a######aaa#####acb###aaaaaaaaaaaaaa###########aaa####.####a##aaaaacdeceeeedc##aa########..#########aaaaa##a###aaaaaabcdedcb##aa#aaaaaaaaacbaaaaabbbbaaaaaaaaadfdaabaaaabbbbcdggfebaaaaaaacccbbbbbbccdcccbbbdcecba#####a####abbaaa#######a#aaabbaabaabb",
-"bbaacbabaabaaaabbaaabbaabb#.####.#######abbcba#aabecdbaccaa#a#.##aa##a###acacecbaaaaaa##########..######..abaa#aa####aceeddceggeddccbaa##########a#aaaa##aaa##a##aaaaaaaaaaaaa#########aaa####a#aaa####aaaabbdffffgebca#ab#######.#..#aa######aa###aa####aaaa#baabbdcc##b##aaaaaaaaabaaaaaabbbbaaaaaaaabcegcabaababbbbabgfgfdaaaaaabbabbbabbbcdddbcbccccdbaaa#a##a###aaaaaaa#########abbbbccbaab",
-"baaabbaaababaabbaaaaaaaaaaa##############abbaa##aadd##abbaaaa#.##aaa##a####aabcbaaa#aaa###a######..####.#..cdcbbbaa###abdcdedfghffddcbba###########aaaaaaaaaaaaaaaaaaaaaaa#aaaa########a#aaa#####aaa#a#aabbccddghhhfcca#aa##########...##########aa#aa###aaa##aaaa#a#bb####aaaaba#a#aaaaaaaabbcbbaaabaaabbefdabaabbbbbbbbfgggfdcaaaaabbbbbbbccdbdbcbcccbcbba##aaaaaa###aa#aaaa########bbabbbbaaa",
-"aa#a#aaaaaaaaaaaaaaaaaabbabaa#######.#.####aaaaaaabdeb#aababaa####aaa#abba#####aaaaa###a##bdba##a######....acdbabbaaaa#####cddaeggffedcba##########aaaa###aaa#abaaaababaaaaaaaaa##a###abaaaa###.#bbaaaaabdcddeefhhifdda#bb#aa##aa######..########ab##a###a##a#aaaa#abaabaaa#aaaaaaaaaaaa#aaaababbbbaaaaaaabcffbbbabaabbbaacefggdba#aabbbbcbacddccecbbbcccbba##aaaaaaaaaaa#a##a#a#######aaaabaa#a",
-"ba###aaaaa#cbaaaaa#abababa#a################aabbbbbbbea#aaabbaa#####a##adc##aaaaaaba##a####a########.#####...aca###########.####cffdcdecaaa#######aaabaa##aaaaaaa#aaabbbaaaaaabaaaba##babba######accbbbbbfccdeegdgfggeb#dc#####aaa#####...#######aaaa#aa##a#aaabaaa#bbaaaaa##aaaaaaaaaaaaaaabaabbbbbaaaaababbegdbbaaababbaabffffecb#aabbbbcbbcdddecbaabcbaaba#aaaaaaaaaaaaa###a########a#abbaabc",
-"a#######a###aa#abaaaabbccba###.##############abcbcbbcbea#aaaaaaa#######.##ba#a#aa#a#a#a##a####.###########..###ba##############a#aeedbadfcdddcbb##aaaaaaa#aa#aaaa#aaccbbbaabbbbbabcbbcdccb######abcdbddeeefddddb#afdcfebdca#####aaa######.#####aaca####abaa#aa#abcb#accaaaa##aa#aabbaaaaaaaaaaaabbbaaaaaaabbbbbgdbaaabbbbaaaccffgfdcaabbccccccddddfcbaaaaaaaaa#aaabbaaaaaa#a#aab####aa##aaa#bcc#",
-"aa###########aa#aaaaabbabbaaaa##..###########abdcccccbcdcaaaaaa#a##########aabb#abaa##########...#.########.######################.bfdaaccefddddbaaaaaaaaaaaaaa#aaababcccbbbbbccbbcddcabca####aaacdcabeggfdda.##.#cc#aefdbaaa###aaa###.##.####aaaaa#a###abd##a###ababbdc#aa#aaaaaaaabaaaaaaaaaaabbcbbaaaaaaabbbbgfbaaabbbbaabbbcefffddbabbcdccccedcabaaaaaaaaaaaaaaaaaaaaaaaaaaa#####aaa#aaaaaaa",
-"aaaa##########a######.#a#abbaa##########a####abdedcccccccba##########a######aaaa#abaaaaa#######..################aa#aa###############ddabedcgededbbbaabbabaaaaaaaaaaabbccccccbccdddba###abacbbcccba####aaaaaaaa##.###acfcaaa##aa#a############aa#####a#a##aea#aaa#aabbcda##aaa#aa#aaaaaaabaaaaaaababcbaaaaaaaabbbgfbabbbabaabcdcbdefffdbbcccccccdda#aaaaaaa##abaabbaaaaaaaabbbaaaa####a##aaaabaa",
-"aaaaabaa#######a###a##.###abbaa###############acdeccbbccdga##########a######.#aabaaaaaaaaa#a############.###aa###aaaaa###############.cdbbdefhhhfdccccbbbaaabaaaabbbbbccccdddcdccdb#####bbcbcddba####aa####a#a#####.##aedaaaa###aaa#######..#########a###a#bbbbbaaabbbbaba#aaaaaaa#aa#aaaabbaaababbabccbaaaabaabbbggdabbbbcbbbddcbcbdffdcaccccacccd#aaaaaaaaaa#abbbaaaaaaaabbabbabaa#aa####aabaa",
-"aaaa#aaa##########a###.##aaaaaaa####.##aa#####abccdcaabccffa##########a###aa####aabaaabaa#aaa####a######..###a#####aaa############aa###bdddeeddfgfeeeddcabaaabbbbbbbbbbcdddddeeeecaa####abbaaaa#######a#a########.###aaadaaaa#####aa########.#..##.##a######aaabbba#bbca##a###aaaaaaaaaaaabbaaaabbbaabddcaaaaaaaaabfgdaaabbbabdacdbcbdfffdbbdccbc#cbaa##aaaaaaa#aaaaaababaaaa#abbaaaaa#aaaaaaa#a",
-"###a#aaaaaaa######accbaaab#####aaaa####a#######accccabacccfe##.############aa####aa###aaa#aa####.#########.##########a############abca##bfcfabbbcaafffffdbbbbbbbbbabbcccdeeedefcaaaaaa##aaaaaaaa################a#.###abbcaa#aa#aaaaa#######....########aa####a#abba#bbbbaaaaaaaaaaaaaaaaaaabcabbbbbbabeedaaaaaaaaacfgecaabbabbacdbabcffffccccdda##aaaaaaaaababaaaaaaabaaaaaaaaaabaabaa##abb####",
-"a########aaa#######cddebba########aaaaaa#######abccccbabcdefea#.########aaaaabb##aaa#####aaa##.....#.##.##############a#####.#####aabcbaabfc######.afggggcbbbcbcccbbbccceeeeffhgccbaaa#aaabbaa#a######aaa########a#.##aacdba##ab#aabb##.#.####...########aa#####aaaaaaaabbaaaaaaaaaaaaaaaaaaccbabbbbbbabefdaaaaaaaaabeffabaaababdedabbcfffecccddaaaaaaaaababaaaa#aaaabbbaaaaaaaabbaaa#aa##ba###b",
-"#####aa#####aaaabbaaaacdb.#a#########aaa########abcbbbbbcdeeeefc.######aaaabaacbaaaaa##########..#..#....##############a###########abbbba#bd#a######aabbcfedccdddccccdddeeeeefgiedeebaaaaaabaaaa#aaaaa#aaaa###########aabcca##aabaaabba#....#....##.###.#aaa#######a#abaabbaaaaaaaaaaaaaaaaaaddbbbabaabbbddaaaaaaaa##adfecbbbbacddedbbccdffdccddaaa#aaa#bbaabca##a#aaabbaaaaaaaaaaaabb#aaaa###a#",
-"####aaba######aa#abbaaaba###aa#############.####aabcabcbbdegfebc.########abbbaaaaaaaaaa#########.....#.#.######.#######aa#####.#.##aaabbbbbc##a#######..##ehfeeeedddcedeffeeeeehf#abcecccbabbbbbaabaaaaaaaa########a###aacdba#aaaabaaaaa#..##..##.#..####aaa##a####aa#aaaabaaaaaaaaaaa#aaaaaabeeccbababbbbbaaaaaaaaaaaabcffbbbbcdccdcbbbcdfgfedcabaaaa##bbababa#####abbaaaaaaaaaaaaaaaa#aaaaaa##",
-"#a###aabaaaa###ba###ab##ba###a#############..###aaabcaabbdedefgb####aaa###aaaaaaaaabaaaa###########...#.############################aabbbadcaaa#####.######bfhhgggffffffffeeeefhhcaa##acfffeedddbaabaaaabaa########a####abebaaaa#a#a#aa############.###..#aa##a###aba##aaaaba#aaaaaaaaaaaaaaaaccdcdcbbbbabbbaaaaaaaaaaaaacfeaabbbbccdabccbdfffed#aaaaabaaaaaa#aa###aaaaabaaaaaaaaaaaaaaaaaaaaa##",
-"###aaa#aaaa#a##.a##a#aba#aa###########.#.#....####abcbbbbccdffegb...##aa###abaaaaaaaa#a#aa#######aaa###.####.#####################a##abbcfda#aaa###########.#acfhihhhijiiiihgfhhgcaaaa#..acccddccecccbaaabcb#######aa###abcdbaaaaa#aaa#aa##########.##########aa##aaa#aaaa########aaaaaabaaabbaaababaacbbabbbaaaaaabaaaaa#cefdabbbabbcbbbccdfggeb#aaaaaa###aaa#a###aabbaaaaaaaaa#aaaaaaaaaaaaaa#",
-"#aaaaaaaaaa##aaaaaaaa#aaaaaa##.###aa###.###...####aabdbbabbcfeced.#########aaaba#aaaaaa##ca#######aaaa######.########.########a#####aaabdhgfeaaaa#############.#aaba#addfghiiiiheb###aaaa###.####bdbcdcdcbbca##a##a##a##aabbdbaa####aaaaaaa#############a#.##aaaaaaaaa##aaa##a#a#acbaabbabbbaaaaaaaabbbbbaabbbaaaabaaaaa#a#bfgebaaababbbbbbbcggfeaaaaaaaaaaaaaaaa####aabaaaba###aaaabaaaaaaaaaaa",
-"a##ba#abaaaaaaaa####aa###bbaa##.#######b#####.#.###aacbbaabcdeccc##.########aabbba#a##aaa#bba######aaaaa#################.######aa##aabbfhhihdabaa##############aa######.##a#bgfb###aaaaaa########cbacccdfeecaa###aa##a#aaabcdbab##ababaaaaa##########aaa#####aaaaaaaa#a#aaba##aabfdaa#aaaaabbbabaaababdbbbbbbbbbbbbbaaaaaaa#dffcbaabbbbbbbbbcefgdba#abaaaaaaaaa#aa##abbbaaacba##a###aaaaaa##aaa",
-"aaaaaaaaaaaaaaaaaa#####a##aaaa########ab##.####..###aadccbbacdcaa###.######aabaaabb#aaaa###############aa#####a#####.##############aabbbehhhfcaaaa#####.########aaaa##aaa##a#.#caa####aa##########cdbbbbbcedefdcbbaa##aaaababbdbaaaaaaaaa#aba#########aa######aaaaaa#a#aa##aaa##addbbaaaaa#aaaaabaaaaaaccccdcbbabbbcbaabaaaaa#cfgdbabbbbabbbbbcfgedda#aaaaaaaaaab#a##aabbbaaaba#aa###a#aaaaaa#aa",
-"aaaaaabaaaaaaaa#accb#########babaa###aaa##.##a##.####abcbccabdeaaab#..######aaaaaaa#####################aaa####a#####.############aaaabdgihgcbaaa################aaaaaaaaa#aa###a######a##########dbaaaaaaaacbcefgfddcccddegdcbdbaabaaaaaaaaaaa######aaa####aaaaaaaaa#############aaaaaaaaaaaacaaaaaaaaabbbbdeccdccbbbbaabaaaaabefecbbbabbbbcbcegededcaabaaaabaaaaaa##aabbbaaaa#aa#aaa#bbaaaaa#a",
-"a##a#aaaaaa###aa#bbcbaa##aaa#aaaca##abb########a#####aacbbccbdeaaaba#########aaa##a#a####.################ba#########.##..######.bbabaaehhhgbaaaa#################aab#aabaa#aa###a##########a.###.ab#aa#abababbbcbcdcaacecccdefdc##abaaaaa##aa########aaba#aaa#a#aaaaba#a#aa#a##.##abaaaaaaaaabbabbaaaaaaaaaaccbbbcdbbbbaaabbbabbdgfdbbbabcbcccdddeeedcaaaaaaaabaaaaa##aabbaaaaa##aa####aaaaaaa#",
-"####aaaaaaa######abbcca##aaaaa##abbabba#a#####aaa######aabccedfaaaab#########aaa###.#######################b########.#ba#...##.#acbccccfgggebaaaa##a###############aababaaaa#a##a#a####a##a########c#aaaaaaaabbaaaaabccdebabbbdgeaaabbbaaaaa##a#######aaab##a##aaaaaabaaa###aaaa####ba#a##aaaaaabbaaaaabbaaaaacbbbcbbbcbbaaabbbbcbcfgecbcbbbccddccceddccaaaaaa#bbaaaaaaaaaaaa#aaa##a#aa#a#aa####",
-"##a###aaaaa#######aaaaaaaaaaaaa#aabbcaaaaa#a###aa########aabeeea###aaa#######aabb#####a######.#######aa##.######aaaabedccbbb##bbbbaabbbbccdeaa##a##a########aaa#####aabbbba#a#aaa#a####a###########caba###ababbbaabbabcdcddcbabehcaaaaaaaaaa############ab##aaaaaaaaaaaaaa#baaaaa###bb#a##aaaabbbbbaaaaabbbaabbbbcccbabbbaaaabbccccbfffcccbccccbccccddeedaab#aaaabaaabaaabaaa###aaa###bb##a#####",
-"aaaa##aaaaa#aa#######a#abbaaaab######aaaaa#aaaa#aa#######aabdefb#aaa#bc#######abcb#####a#################aa#a..###aabcdfffggfdcbbbbbaaaaaabdeaaa###########aaaa#####aabbbbbaaa#aaa#####aa#a##.#####aaaaaa##abaabcbbbaaabaabbbbcdefaaaabaaaaaa##a######aaa######aaaaa#aaaaaa##aaaa###aa#aaabbbabbaabbaaaaaaaabbbbbacccbaaaaaabbccdccdefegffdccecbccccdeeddcbaaaaaaabbbcbaaabaaaaaa#######aa######",
-"#aaaa##aaaa#############abaaaaaba##aaaaaaaabaaaaaba#####a##abdgca#aaadeb########bba#####aa#aaaaaa###aaa#ab#aa#.###.#acfhfddgccbaa#aaaaaa#abcfaaaa#######aaabbaaa#####aaaaaaaaa#aaaaa#aaaa##########aaaa#aa##aaa#acccabaaba#a###acdbaaaaaaaaaaa###a##.##aaaa###a###aaaaaaaaa###aaaa#abb#aaaabbbbbbbabaaaaaaaaaacbbbccbbbbaabaaacccccdfdbdfgeefcddabccbcedddccbbaaaaaabbbababbaa#aaaa#a##ab##a####",
-"##aaaa#############aa#####abaaabda##abaaaababbaaaaba####aa#abbdeaaaaaadf###############a#aaabbbbba#aa#aaaa#baba.#accbffffgddcbbaa#####aa##acfeabaaaaa###aabcdcbba######aaaaaaaaaaaaaaa#aaa##########dbaa########bbdcaab#abaaa##abceaaaa#a#aaaaaa#a###.######a#####aabaabb#aa#####a#bcbaaaaa#aaaabbbbbaaaaaaaaaaccccbccabacaaaabceeeeggdcdfffccccca#bbcbddeccccca#abbbbbbbaaabaaa#a#aaaaab#######",
-"##aaaa####.##########baaa##aaaaabda#aaaabbaaccbaaaa#####aaaaabbcbbaaabdgfe###aaa#######a##aaabbabbb#a#a#aabdceeedcabcaeddcfhecdb#########aacdhcbccbbbbbbbbdehhedba##aaaabbbbbaaaaaabbaaaaaaa########cba#######a#abbda#aabcbaa##aabceaaa######aaa##aa########aaa##aaaaaa#aaa###.###aabaaa#aaa#aa##abbbaa#baaaaaaabbbbbbdbbabaaaacaddacbbbbddccccbbda#cbbcdcddeccccbaabbbbca#aabaaaaaaaaaaaaa#####",
-"#aa###a####.##########aa#a##aaabaccaba#aabbaccbaaaaaaaaaaaaaabbccabaabeffeebbcb#.####.#aaabbaabbccccccccdddcec.#aaaaaaadccbbcccca.#######aabdhecdddeeeddeefecbbeedcaaaaabbbbbbabbbbcbbaaaaaaaaaba##aba####a####aacdccaa#ccbbaa##aabcdaa########a##aa########aaaa##aaaaa##aaa#########aaa##aa#aba#aabbbaaaaaa#aaaaaabaaaccbaaaaabccababbbb###bcbcbbecabbccdcddcdcccaaababbbbaaaaaaaa#aaaaaaaaa###",
-"#aa#aa##########a######a#####aaaaabc#abaaaabbcbbaa#a##aa#baaabbbbbabbcfffgghebdcbbacacbbbbbbbcbccdccfdaaabdedcaaabaaaaacccbbbbbbcb########abcfgedeffeeeegfcbbcbadgdddaabbbbbbbbbbcccccbbaabababbbaacbaa#########abcccbabccbbbaa##aabcb#a#######aa######a#a##abbbbabaa###a#aa########.bbaaa#aaaaaa#aaabbbccbaaaaabbbbbbbaaaaaaaaabbbccccaaa###bcdbabcbbbabcdddcbddccbbaaaabcccabaaaa#aabaaaaaaba#",
-"#aaaaa#######a####a###aa##.###aaaaabc#abaaabbcbba###aa####a#aaabbbaabcdcdeccdecccccba##aaabbaaaaaa##beaaabacfdeaabdecb#bdcbbbbbbaca#######abcdegeeeeffgfdabbccddeehhhfdbbbddeeccdcccdccbbbbbbcccbcca##a###a########aa#.aceccbbaa#aa#acb###.#####aa#####aba###abcdcbcbaaaaaaa#####a###bc#abaaaa#aaa#ababbbbccbaaaaabbcccbcbaaaaaabccdacccb#a###abddbbbbbbabbcebcbbdcccbbaabbabcabaaaaabcbaaaa#aaa",
-"aaaaaaaaaaa####aa#####aaaaa.###a#aaaccaaabaabccaa##aa#######aaaaaaaaadc##abaaaaa###a#######a#########cb#aaaacdddb#bbdda#becbbbbbbac#######abceffhffffda##babcccdeeddbddeecdcdebdeeccdddeddcccdeba#b###aa##a#########a###bedbbbbaa#a##aca###.#####aa####aaa####bbcdddbaaaaaaaaa#######adbbabaaa##aaaaaaacbabbccbaabaabbccccaaabbcbdcbcecccaa#a#a#adcabbbbbcbbcbccaabccdcbbbbcacbaabbaabcbaaaabaab",
-"bdbaaaabbaaaa#aa##a#aba#############abcaabababcba##aa#########aaaaaaabdb##aaaaaa###a##################b####aaccdeaabcbbaaeddbabbbabb#######bdfhghhgda###aabbcccecbbbdcccefdbbcbcb#eefgghggfeegdaa##a###aa#######aaa#####bedcabbaa#####acb##########a##aaaa####acbccccaaabaabbbba####a##dbba#aaaaa##aaaabdababbccbabaabbcddcbacbbccdacdbba#####aaaabcbbbbbbbccbbababbcddcbabbbabaaabcaaabaaacabaa",
-"aacdbaa##.##a##aa#aa#aba###.#########abca##aabbbca#..###########aaa##aab######aaaa#########aaa#a###aa#######aaccdfbabbaaaeeddbbcbbbdbaa#abcdfhjigca######abccbadb###cfbcbbecabbba#begfhggddcggdbbaaa##############a#aa#.cddccbaaaa#####ab##########aaaaaba####accbbbbaaabaabbbabb#######aba###aaa#aa#aaabcaaaaabccbabbcccdedcbdbbacdcdccaa##a#aaaaabcbbbbbacccbaaaabaccccbaaaaaaaabbbbaaaaababba",
-"aababbaa#####a##a##a###a####.##########aba###abbbbba####.#.#######a###aab######aa#a#########aaa#####aaaaa#####bbceebbbba#ceedccedcegdcbcddedbcbed#######aabccdbdda##adeeb##abbaaaaacbadeddfdghdcbbbaaa###########abbbcdbbdcbbca##aa#####bd###.#.###aaaaaaaba##abbbbbbbaaaaaaaabbaaa#######aa###aaa#aaaaaabcaabb##abcbbaabcedccdcbaaccccba####a#aaababcbaaaabbccbbaaababccbaa##aa##aaabaaaaaaabaa",
-"aabaaaaa#a#####a###aa##########..######aaba####aaaabb#.###############aaab##.###a#a#######aaaaaaaaa#a#aa###a##aacdceddfgfcfffgdccdeeefggdbaabbbbdcaa###aaabbcddeb##a#adfeaaaaaaaaa#bbaaccbeedhecbabbaaa#########.adccbcdbdbbcbba#######a#cda########abbaaaba##abbacbbaabaaaaabaaaaaa########aba##aaaaaaaaabcaaa#a##abca#aaabdefecbaadbbbaa##aa#aaaaaabdcbaaaaabcbaa#aaaabbbaaaaaaaaaaaaaaaaaaaaa",
-"aaabbaaa#########a##aaa###########.##.##aaaa#####aa#cba################abcb.####aaaaaa##aaaabbabaabbbaaa##aaaaaccgghggecdfihhg#a####a#a#abbccccacdcabbbbbacccdfeba#####aaaaaaa###a#ababbccadcgedccbaaa############ccbabccbcacabaa#####a#bacd###.####aaaaaaa###aaabbccaaaaaabbabbaaaa###.##..#bbb###aaaa#aaaaaaa########a#aabccceecbbdbbbbaa#aaaaaabbaadccbaabaabba#####aaaabaabaaa##aaba#aaa#aaa",
-"aaaa#aa##############bba##########..#.############aaaaaa#####.##########abca..####abaaaaabbbcccbbccddbbabbbbbcdefebdfd##a#.bedaa#########aabbbcbcddddcbbbcdeffd#########aaaaaaaa#aa#baaabcbacegedbbaaa##########bcdbaabbcccbbbaaaaa#####abbcca####.##aaa####aaabbcccdbaaaaaaabaaaaaaaa####.###abba##aaaa#aa##a############aaaa##cfebdcabcb###a##aaaabbabacbaaaaaba#a####aaa#aaaaaaa####aaaaaaaaa",
-"abbaaaa####a##########aa###################aaa####abaa#a################aabc#.#####aaaabbbcdddcdfffefgffeddfgdcdcb####aaaa###bb#######a##aabacdcddbdccacdefecc#a##a#####aaaaaaaaaa##aaaaabbbabfgdcbaa########aaacbbbbabbbbcdaba##a#####a#abccda####aaaaa#aaa#abaaaccbbbaaaababbaa##aaa#########bbba##abaa#####aa#a##aaa#a###aaa##defdcabbbaa##aa#aaaabbbaaccaaaaab######aaba#aaaaab####abaaaaaaa",
-"aaabaaa#################abba###############aaaaa##aaaaa#a###############aacaca.#####aabbbbccddfda#adeca#####b###aa#aa#aaaa##aaba#a####aa#aabccdccedebaacccb####aaaa###a###abaaabaaaaa#aaaaaababdgdbb##########cabbdbbbaaaaaccaaaaaaa##aaa##acdc#.#aaaaa##a##aabaa#ccaaabaabbaaacbb##abaa######..abca##aaaa#####aa#aaaaaa######abaabdggcaaa#aaaaaaaaaaacba##bbaaaabba#aa#aaaaa##aaaba###aa#aaaaa#",
-"#########.#################aaaa#.#.##aaa###aaa##aaa##a##aa###############abbbba#.##.#aabbbbcefc####...#####aa#####aa###aa####aa#######a#aaacbacbbdddbbccdfecbcc###aa####aa#aaaaaa###aaaaaaa##aaacfdaaa#####aaaabbabbbbaaabbabbaaa###aaaaaaa#abce..##ababc####aaaaabdaabbbbbbaaabbbaaa#a##.#######abaa#aaaba##aaaaa#a##aaa###aaa##ababehcaaaa##aaaaaaaadc####abaaaaaba###aaaaaaa###aaaaa#aaa#####",
-"####a######################aab#....##aacaaa#aabbaaaaa#####a##############aabbbcb##.###abbcceca###################aaaaaa#a#aa##a#aaaaaabaabbbbbacaaabbabaafddcbcb###aaa#aab##aaaa######a#######a##cfeaaa#####abcbbbbaaaaaabbabba###aaaaa#aaaabaaee#.##ddaaa####aaaaacaaabdcbbbbaabaaba#aa##.#######aaaa#aaabaaaaaaa##aaa#a##a#aaaaaaabbcgebbba#aaaaabaabbaba###aaaaabbaaaaaaaa#aaa##aa#a##baa#a##",
-"####a##aa##################aabda#.#####bcaa#abaabaaaaaa###################aaabcdb.####bbbdea##########.###########aaaaa##aaaaa##aaabbbbcbccbbaaaaaaaabbbaaaacdcbbbaaaaaaaabaa#aaa################abecaa####aadcabcaaaaaaabbaab#####aab#aaaaabaaade#..#ca.#a####abcbbb#abbccaaabbbabbbb#a############aa#aaaaaaaaaacaa##aaa##a#aaaaaacabccfebbbbaaaaabbbbaaba####ababacbaaabaaaa##a#aaaaaa##aaa###",
-"#####aaaa###.#a######a#######aab##..####abbbbbbbbaaa#aaa####aaaaa##########aabddea.###abda#################a#########a#####aaa###aaabbcdcbdbbaaaaaaaaabbbaaaaacddcbaaaa###abaa######..############abeda###ababbbccbaa#aaaaaabaa##a###ab#aa#aaaaaacec##ab.########babbaaaabbababababbcda###############a#aa###aaabcbbaaaaa###aaaa#ababbcdcdecaabaaababbaaa#######aaabbbbaaaaaabaaaa######a#aaaaa#",
-"a#######aa#a######aa#a#aaa###aaac#########abddccbbaaaaaaa####aa#aa########.abehghhc##abca##aaa##################################a#aabccb#aabaaaaaabbbaaaaaabaaabbbdba#aa###aaa##################aa#abefccaabbbcbabbaaaa#aaaaaaaa#aa###abaa##aaaabbcfdaba.#a######bacc##aaaabaababaabcbca##.#####a#####a#aaa#####aaaaab##aa##aaaa#aaaabccebbffbaaaaaabcaa###a#####bbbbbbbaaaaabaa#aa######aa#aa#a",
-"#baa#aaaaa###a#a#aaaaaaa####b#aaba#########aacbdcccaaa##a###aaa#aa##########bbfikjicacc###aa#aaaa#############a###################aaabccca##aaaaaabbaaaaabbbbaa#aabcbbaa####a#################a#aabaabdfbdcccbbbbbbbbaaaaaaaabbaaaaa#a#aaa#aaaaaabbcfdbb#######a#aaac##a#ababaaaabbcdaaaa##########a#aaaa#a#aa##a#aaaaaa#aaaaaaaaaaabbccdcaaegcbaaaaacaa#####a####bbbbbbbaaaabba##a###aaaaaa####",
-"####aa#aaaa##a#aaaaaaaaa##a#####aba##########aadcbbba####a####a#aa##########abcdfhiigc#a##aaaaaaaa#aa#####################a#######aadccccaba##aa#abaaaabbbcaabaaba#aaaaaa####a###a#a###.#####acbbcbaabcehfdccccbbbbbbbaaaaaaabaaaaaabaaaa###a#aaaabbcddca####.#####aa##aaacbabbbbaabcba#bc############aaa##aa##aaaaa#baaaaaa#aaaaaaaabccdeba#cgfbaaabca#a###aa#a###bcbbbbbbaabbba##b###aaaa#a###",
-"###a#aaaaa#aa######aaaaaaaa######aaaa#######a##aaaa####.###aaaaa#a###########abacdhiiga##abbaaaaaaaa##############a########a##a##abbcabc#abbaaaaaaaaaaaaaacaaabaa###a###aa###a###aaa########bbbbcbbbbddceihebbcbbbbbabbaaaaaaaa#aaaaaab#a#####aaaabbcccfb#.########aa##abaaaaaaabbaaaabbcbc#####a######ba##aaa###aa###aa##abbaa#aaaabbbdcccbbabdhebcbaaaaa####a#####accbbbbcbaacba#aa###a#aaa###",
-"#a####a#aaaaa#aaaaaaaaaaaaaa#######aba#######a####ab########aaaa##a#a##.#..#####aehhjihb#abacba#aaaaaa############a#a########aa#aabdcc####abaa##a##aaaaaa#ababa#a##aaaa#######a#aaaaaaaa##aacaabcccbcbabbcghgdbbabbbccba##aaaaaaaaaaaabaaa####aaaabcbcdccaa#########.##aaaaaaaaabababbabaa#######a#a##abbba#a######a###aa#aaaaaabbaabbcdbbbbabbadffbbaaaaaa#a##a####aabcbbbccabbabaaaba##baaaa##",
-"##aa###a#aaa#a##aaabbaaaaaaaaa##aa###a#############bba#.###aa#aaaaaa#######.####adfehjif###aaaaaaaabbaaa#a########aaa###a######abbbbcca.###a###########a###aa###a#############aaabbbbbaaceb#aaabbbccbaaabbbdggdcbbabbbbaa###aaaaaaaaaaba#aa#a###aabbbbcdc#####aa#######aaaabbbaaabbbbbbba#aa#######a##aabbaa#######aa###aa#aaaaaabbbbbccaaccbbbccdfgedaaaaaaaaaaaa##aaaccbcccbbccba##aa##abaaa##",
-"########a#aaaaa#aaaaaaaaaaaaa#aa#ba###########a####aaaaa#.##aaaaaaa##a#a########bbceeijfc####bbababaaaaaaa#########aa##a#aaaaabbadcccba####.############aaa#aa#############a##abbabbbaa##ceaaa#aaaabbbaaaaabbdgfbbbbbabba####aaaaaa#aaaaa#####a#aabbbccdccca#aaaa######aaaaababbaaabcabba##ba##a##a#aaaaaaaaa#######a#a##aaaaaaaabbbcccaabbddcaabbabdffdbbbaaa#aa####aabbccbbcbbddbaaa####acbaa#",
-"#######aa#a#aabbaaaaabaaaaaaaaaa##aa#a#############abaaaa####abb###aaa#a########babcfhiiea###acbbabbaaaaaaaaa####aaba#aaaaa#aaabaccbcbaa###############aaaa###a##############aabaaaaaa####bbbabaaaabbbbaaaabbbcffbbbbbbbbaa##aa##a###aaaa####aa##aabccefcadda##aaaabb#aaaaaaaaaabbbbbbbba##abb######aaaabbba###############aa#aabbcccbabbaabdccccaabacfggccbaaaaaa##a#aabccbbcaabdbacba####bbaaa",
-"aaa####aaaaaaaaaaaaababaaaaaaaaaaa#aa##############abbbbaaaaa##bbbaaaaaaa######ab#bccehiic###abcaabbbaaaa#aaaaaaaa#aaaaaaaaabcbccacba########.##########aa###############a#aaa#aa#a##a#####acbddcbaaabbbbbaaaabbefcbbbabaaaaaaaa######aaa###aa#####abcdghedcbbbbbcccdcbbaaaaaaaabbbbbbabaa#.acca#a###aaaaaaa########a##a###aaabbcdcaaaaaabbaccddaaaaacaadggfdbaaaaa#aaaaaabccbbaacbaababaaaabbaa",
-"aaa#a#####aaaaaabaaaabbbaaa#aaaaaaa###aa#######.#a###abbbaabbbbaaaaaaaaaaaa####a##ababchie###aabbbaaaaaa#aaaaa#aaaaaaaaaaaabccccbccb####a#############aa######.###########aa###aa#aaaa#a###abcccdbbbbaaaabbaaaabbceebbaabbaaaaa#########aaa##aa#####acdfdefebcddcbbdffdcbaabbaabbbbbcdbbaaa##abca#####aaaa#a##a#aa####a#a##aabbdedaaaaaa#aaccbeda#aabbaaaacefgfdbaaaa#aaaaabcccbccabaaabbaaaacc#",
-"##a##aa###aaabbbaaaaabcbaaa#aaaaaaa#a##########a#####aabbaaabaabaaaaaabcccca########aaacfhc##aaabccba#aaaaaabbaaa##abbababbcccbeecba#####a########a####a#a#####.##########b######a##a##aa###aababaaabbaaaaabaaaaaabdfcababbaaaa##############.#######bddcbdeffcbbba##dihdcbaaaaacaabbbdcaaabaa#aba#####aaa######aa##a###aa#abcdccdb#aa###aaaccdcbaaaaaaabbaaabehhebaaaaaaabaccbcbbbaaaaaaaaaaacb",
-"a##aa#####aaaabbbaaaaaababaaa#abaaa#############.###aaaabcaabaaaabbbbacdedaaaa######a##bccdccaaaaaacdcaaababbbaababbbccbcbbcdcceedc####a##a###########a#aaa######..####.####.###aa######abbaaaabaaaaaaaaaaaaaaaaaaaacfeedbbaa############.######aaaa#abbaaaaccbabaaa###igdccbbbaaaaaaabcbabcbcb##a######a####a#aaaaa####aaaacb#abdcaaa#a###a#acddcbaabaaaaaaaaadfhhedaaabbabbcccbbaaaaaaaaaaaaaa",
-"ba##a##a#aaaaa#aaabaaaaaaacaabcbaaaa#aa#########.#########aaaaaa##ababdefcab#aa########aabdfgbaaaaaacdcaaabaaaaabbbbabbcbbbcccddaaaa####aa#aa########a#aa#########..##.##..###.###aaba###aaaaa#abaaaaaaa#aa#aaaaaa#aaaegdcbbbaa###########.######aaa##aaaaab#abaaaaaa#.febaaabcccbcbbcbbaaadbcecbaa#####a#aaaaa###aaa#aaaaabaaaabccaaaaaa#aa###adbbbcbbaaaabaaaabbchifbabcccabbccaacbaaa##a#aaba",
-"#ba########a###aaaaaaa#a#aaa#abaaaaabaa##a#aa###############aab####aaaaabccaaa##a#.#####abcdfb#aaaaaaaaabaabbbcbbbbbababbcdddfedcb#a##aaa#aaaaa###aaaa##aaa##.######.###.###########a#########aaaabbaaaaaaa###aaa##a###bfedcbbaaa############a####a######a#aaabcbbbaaa#gdaaa###bcddcecccca#addefgfddca###a##aaaaaaa##aabaacb####bbdcaaaaaa#aa###ccbbbccbaaaaaaaaabaadhieabaabbccdcbabbaa#####aaa",
-"#aab####aa###aaaaaaaaaaaaaaaa#aaaaaaa#####aaa#a##.############aa#abaaaaaaabaaaaa########abccdfcaaaaaaabbbaa#abbcbbaacabbbbcddecdcc####aaa#aaaaa#aaaaaaa##aaaa###..######.#####a########aaa#a####aaaaa#aaaaa########aa####dedbbbaaa##############a###a#####ababccbaaaaa#gcaaaa####bdebbbbbca#bddcbaabccaa##a##aa#aaaaaaabbaca####abdbaaaaaaaaaa#a#ccbbbbbbbaaabbaabba#adhgcbaccccccdccba######aaa",
-"a##aa#a###aaaaaaaaaaaaaaaaaaaaaaaaa#aa###aaaaa###.#############a##abababbaaaaaba######aaabbcddhcaaab##baaababaabaaabbabbbbcdddffeeb###aaabcaaaaaaaa###aaa#aa####.######a#######b#####aaacb#######ababaa#aaa##aa########a#aaeecbbbaa##################a##a##bbaabb#aaaa#cd#aaaaaaaace.aaa#bdccdcaaabcacbaba###aaaaaaaabaabccaa#aaabbd#aaaaaaaaaaa#bcccbbbcbbaaaaaaabbaabbhidbbcccbdeddaaa#aa#aa#a",
-"aaaa#aaaa##aaaaaaaaaa#aaaaaaaaaaa######aa#aaa####..#########.###aaabbbcbbbaaaaaaba#####aabbcccegcbaaaaaaaacbaabbaaabaaaabcccdeeffddaaaaabcbbbcfffecdcba#abb#############aa#a##acbbcba#bbaa########aabba###a##########aa#aaa#eedccbaaa#####a#a###########aaa#aaa#bcaaaaaafaaaaaaaaacfa##a#aaaba#abaaccbcbbccbaaaaaaabbbbbbaaaa#a#abccc#aaaaabaaaaaadcbbbcbcabbbbaaaaabaaccfjgbccbcccccaa##aabaa#a",
-"#a#aa#aabbaa#aaaaaa##abaaaaaaaaa##aaabaa##aa#a###.#.##############aabbbcacbaca#aaca#####aabbccdeedbaabbaaaabbabababaaaabbccdddffedffb###bbccefebccbdeda#aaabbaaa#######aaaaa###aabcca#adaaa#####aba#aaaa##aa################.cedcbbbbaaaaaaaaa##a######aa####aa#bbaaaaaadc#aaaaaabbee####abaaa#aa##abaaabbabdcccdcbbaccbcb##aaaaabbcdbaaaaababaaaacbccbbccbaaabbbbaabababadjiedccccbbbaaaa#aa#a#",
-"aaaaa###aaaa##aaaaa####abaa#aaa#a###aaaa######aa#################a##abbbcccbbbaaabba##.#aabbbbddedd#aacb#aaaaaaaaaaaaabbbccdddggffghecbbaabbbddabaa#aaaabaaa#bbbaaaaa##a##aba###aaabb##bbaa####aaaa###########a########.#####aaeecbaabbaaaaaaaaaaaaaa###aaa##a##aa###aaabeabaaaaaabchca###a#aa#a###a##aa####bca#abdecbcdbaaba#aaabbdcaaaaaaaabbaaaaccbbbccdbabaaabbbabbbabacjkjgfdccbaaaabbaaa##",
-"#a#aaaa###caa#####aaadb#aaa#aaaa#aaa##aaa###aaaa#a####a##a######a#a##aabbbbabba##aabaa##aaaabacdececaaaba#aaaabaaaa#aaaaccdeeefgeeefbcbbbcbbbcbaaaaaaabaaaaaa##abba##a#####aaa###aaaa##.#ba##.###aa############.##.#############dedcbaabbaaaaaaabaa###a###aa##aa#aaaaaaa#dbbbbbbbaacgg#b####a####a##aaabaaabbcaa#abacdcaaaabaaaaabbccaaaaaaaabbbbcbabcacccccbabbaabbbabcbbaaejklhfcbcbbaaaa#aaaa",
-"####aaaaa##aaaaabaaaaabbaaa##aaaa###aabbaa###aa#aaaa###aa#######aa#a##bcccaaabbaa#acaa###aaaabbcdcdcbaabaaaaaabaa##aaaabbccdfffghffdaabbaabccddbabaaaaaaaaaaaaaaaaa##a#######a####aaa###.aba######a#################a############bfedbaabbbbbaaaaabaa##a#########abbbba##dcbabbbaaabcgdc#####aabaa###a#bbbbbbbbbbaaabbcbbabbbaaaabbbdebaabbbaabcbbbbacbabbabbbbabbbaababbbbbghillgcbbbbbaabbaaa#",
-"###aaaaaaccdcaaaaaaba##aaaaa##aabaabaaab########aaaba####a###a##aaaaaabccbba##bbba#bca###aaaaabdcddcda#abaaabaaaaccaaabbbccefgfghffaaaabbaaabefbcbaaaaaaaaaaaabaaaa##aa#########a########aaa###a##############.##.#.############a#abdebabcdcbbcbaabba############acdea#abecbaabbbaabbdfc##aaaa#a#aaa##abbbcaba#adebaecabbaccdcbbabbcbdddbabbbabccccbbacbbbbbabccbbbbbaaaabcbcfijjkjfddcbabdebaaa",
-"db#bdccbbcb##aabbbbaa###aaabbbbaccaaaabca####.#####baba##a#aaaaa#aba#accbbbbaaaaaaaacbaaaaaaaaacccdccc##abaabbaaabdbabbcccdffffhggbaaaaabdbaaaababbaaaaa#a#a#aaaaba#a#a################aabaaaaa###########.#####...#####.##.####aaaa#bedcccaaaaabbaaaaa##a#####aaaaddaabdebabbbbbabbbbgcaa#a#aaaa###aaabdaddabaadcfdfgdacbaabcbbbcccbdcdffdacdcedccbbbacbbbbcccccbbbbabacabbdgigbbgjjedcbbbccaaa",
-"#bbbaaaaaabaaabbbea#aaa#abbbbabaaaaaaaaba#############b####aaaaaabaa###abbbbbaaaaaaaacbaaaaaaabbcccccdd##cbcbcaaaaaaabcdeffgggiigabbbbbaabcaaaaaaaaaaaaaa#aaa##aaaaaaa################aaba###baaaa#######.#####....#########.#a##aa##a#adfca###abbaaaaaaa#####a####bdbacfdaaaaaabbaacedfa#aa#########abefeddcccdebccfggfedaaccbacddecdccdeddccefddcccccccabaabbabaabbaabacbbhijgdbacfkjeedcba#a#",
-"###aaaaa#abbaaaaaaa#a####bcaaaba###a#aaaa######a####aa######aaababaaaa##aabbaaaaaaaaabcaabbaaaaabcbccccbcbaaaaababbcccdefgfgghkgbaabbcbccbaaaaaabaaaaaaaa#aaaa#aaaaaaaaa####a########aaabba#aaaa#####a#.###.######.#####.####.##a#abaaa#aaddaaabbaaaaaaaa#########aabgggfbaaaaaabbbabbcfea#a#####aa##afghhfggghhgccddffhfffcccbccdfgeeeceec#aabcddcdddccebaaabaaabaaacbbbb#ejhjgbbceceikibbceba#",
-"aaa##a#aabbabbaaaaaaab####bc#aaaa#aaaaaa#ab##aaaa##a#aa######aa#baaaaaaaaaaaaaaaa#aaaaacbaabaaaabbcccccdbaaaabbbbccddeeefeegjheb#a#aabaccdcaaaaaaabbabaa#aa##aaaaaaaaaaaa#######a###aaaabba#abaa####..###.###.####..#####.#######aa##ba#####bcbaaabbaaaaaa########abdfggebabaaaaaabbbbbchfaaa######abbfegggefgghgffeecefggfhheecdddeeefdcefcabaabccbaabcbcbaaaaaaabbabbbbbbfghggdbcbcbbgkjfbbecb",
-"#aa#a###aababbbaaaaaaac###.acaaaba#aba####ac#aba###aaaaaaa#aa##a#a########aaaaa#aaaaabbbbbaabbaaabbbccccebaaaabbccddddedegggfhbaaa##aaabcccaaa#aaabbbbcbaaa#####aaaaaa#aaaaa#####a###aaaaaabbdaaa########...##.###..########.#####aa#aba###a#accbaaaaaaa#######aaaaabccdeeccbbaabaabbbbegfgeca#####adefffefgggfghggfeeccegihijigedbccfeceddfeaaabcacbbaaabbaaabaaaabbbbbcbchgghfgdabbaa#bgkjgcdd",
-"d#a#a####aaaabbbabaaaaaa####abaabaaaaaaa###acdbaa#a###aaaaaaaa###########aa#a####aaa#abbbbbaabaaaaaabcbccdaaaaabccddeefefhgefgbaaaaaaabaabbaa##ababbaaabcca#aa#aaaaaa##aabaaa####a####aacba#bcb#aa#.####.#...##.##..################a########a#adbaaaabaa#aa##aaaaabbbcdeddddcbabebbcbbffeefdec##adeeefeffefghgghghhgfedfheabfghhfdcegecbbbbccaaaabcaaaaaabaaabaabbbbabbcdfffgffffabbbbbcabgkjec",
-"cdaa##aa#aaababbbaabbaaaa####bbabcaaaaaaa##.acaaaaaaaa#aaaaa#ba###########aaa#a###aaaababbaabaaaaaaaabcccdgbbbccccddeffefgfeffbaa###a#aaaaaa#aaaaaaabbbccaaabaaaaa##a###aaabfd#####aaaabbaba#aa########.###.##.###############################bacedcbbbbabaaaaaaaaabcccccddedddbbdeecdefeededdeeffdegffeddefgfgggggcb##abbca###bbefeefeddcdcbeeaaaaab#a###babbbbbababcbccfgfeeefegcbaaabbca#afkh",
-"gdcbaaaaaabbbaaabaaabbbbaaa###bbcbaa#aaaa#####a###aaaaaa#aaa#aaaaa##a#####a#aa#aa#a#aaaabbaaacaaabaaaabccdfgddddddccdfhhffddfbaaa####aaaaaaa##a#aaaaaabbdb#aaaaba#a#######aacegdbaa#aaabaabbb########.#.##.##..#...####.#######################babedededcbaaaaaaaaabccddeedefecfffeeffddddddeddeeeddeggfddeeffbaaaaaaaabdb#baa#a##cbdfeaaabbcdfbaaaaa####a##abbbbaabbbbdcgfgeeedeefabba#aaaaaabg",
-"gjgccbaaaaabbbbbbbbaacbaaaaa###aaaaaaaaaaa####aaa#####aaa##aaa#a#a#######aaaaaa##aaaaaaaabba#acaacbaaa#acccfgdefefcdecfhhddbcaaa#a#####aaa#aa###aaaaaaabbeebaaaaaaa####.###aaacdcbaaaa#aaabba#############.#.#.#...###########..###############aacddeeededceeedccefggfgggfedggghfdfecdddccccddeeeeefddfffddddbabbbaaaaabefcdb#aa##aaabcaaaaa#bdgb#abaa#######ba#bbaabaaeegfgfeeeecfcaaa#aa#aaaa#",
-"#bgifcbaaabbbcbbbbaabbbaba#a#aa##aaaaaaaa######aaaa##a#aabaaaaaaaaabaaaba##aaba###aaaaaaaaabbabbabaa#a#abcceffeecb#cddeeggcdb##a##aa##aa#########aaaaaaa#bedaaaaaa##########abaa#aaaaaa#aaabaa#####a####################..######.#a##.#########aabcccbcda##afgggffdbbbabdhheghifedddeecbccdcdefffeeffdfggfdbaaaaa#aababbacdddb#bb#aaa#a####ababbdebbbaaa####a#babbaaacddfgffeefeeddcbabbaaaa#aaa",
-"a##ehiecbbbccdccbbbbaabbaaa#aaa##aabaaaaaaa####aaaa#####aaba#aabcbbbaabbba##abaaa######aa#abbacbaaaaaaaaabcccdfcaa##bbbbceabaa######aa##a##aa####aaaaaaaa#abaaaaaa###a######abbbaba##aaa#a####aaa###a############.########################a####aa#dcddcdb#a#dedeedcaa#baacgegiifedddddddcdddefeffggfgeedbba#aaaabbaabaaaaabceebbdaaaaa######aaaaabdddb#aaaaaabacbbbaabdfffgfgfeeeeddgcbaaaaa####",
-"#b##adiifdbcefedccccbaabaaaa#aaaaaaaaaaaaaaaa##abaa######aabbaabbcbbaaaaaaa#abaaa#######aaaaabcca#aaa##aaaabbccc#########a###aa##a###aa########aaa##aaa#aaa#aa#aba##a#######aabbabcaa#ababbca##aa####a#####a.#########################a###a##acba.ddeecccba#cfeeedcaaaaabccbaigfeeeddddcbcdcddfeffggeedaabaaaabaaabbabaaaaa##cffedeaa#a#aaa#aaaaaa#abfebabaaaaaacadcaaffecffffgfffeeggaaabaa####",
-"#caaa#.ahjgffefgggffecbbbabaaaaaaaa#aaaaaaaaababaa#aa#a#aaaabaaaacccaaaaaa#a#aaabaa######aaababaaaaaaaaa#aaaabccb####aaa##ab###aa#####a#a####.#aabaaaa########a##aba########acbbaaaaaaaaaabbbaaa################a###a####aa############aaccb#adcbbdddccbcdebdedccba#a#aabdcbaggeeddedcbbbccdeeffffhggfcbaaaabbbcaabaaaba####a#debceea#aaabaaaaaba#aaa#cfgcaa##aabcbcbdffedfeeeefefeedhcaaaa#a###",
-"####aa##.behhgfeeeddefedbbbbaaabaaaaabaaaaaaaabaaaa#aaaa#a#abbaaabbcbbaaaaaaaaaaaba####aa#aaabaaaa##a#aa#a#aaabbcc.##ab##aabca##aaaa############aabaaaaa#a#a#####aaa#bb#.####bccbaa##aaaa###aaaaa######a#######bbabba####bb###a#a###a###bcccccdcdccddcbbabcdcddccba####bdddb#bdcecdedcbbbbbcceeeeehhcdaaaababcbcaaaaabaaa#####ab#aabb###bb##abcaa###a##adfeba###aabaaefefffedddeedefefhbaaa###.#",
-"#####aaaa###chikjiigedcegcccbabbaaaaaabbaaaaabaa#aaa#a#a##aaaaaaaaabaa#aaaaaaabbbaa######aaaaabaaaaaa##aaba##aaabab.###aaaaaabaa#aa#a#############a###aaba########aa#cbb####abcbaaa##aaa#a######a#.####aa###bbccbbdccbaaabb###a#aaaaa###cbbbaccccbbcccaaaabbccccbbaaa#accdcb##bacgeeedccccbccdeeefggebdaaaaabbbbbbaaabaa#####a#a#aa#####aaaa##ca#####a####beeca#b#abadgefffedeedfdcffeff#a#a###.",
-"..######a#aaadd#acdhihecdgecbcaa#aa####ba#aaa##aa##aaa###aaaaaaa##ababaaa#aaaaabbbaa######aaaaaaaabaaaa##baa##a#a#b######aaaaaaaaa#################a#aa#bcb#####aba##a######bbbcbaabcaa#################a#abcdbdefededcbcbaa##aaa#a###bcbababbccbbbbbcaaaaabcccbaabaaaabcdbba###bhhfhgeddccbccddfhhhfbbaaaaaabbbccaaaabaa####aa#a#####b####aa#aa#ab###a##aaabefd#a#abbfgfeeeeeedeeddefggbaaa####",
-"##.######aaba#abaaaabeiiebceddcbaaaaa###aaba#########a##aaaaaaaa###aaaaaaaaabaabbbbaaa###aaaaabbbaaabbaaaaa###a###bb#####aa###########a######a#####aa#baaaba##abcedcbaa##a##bcccbaaaddccaa##############a##bbceffgfededdedcbaa#a#aaa#bcabaaabbbccbbbbbbaaaabbcbbbbaaaaabbcda#a##ehgfeeeeecddbcddfhhgcbbbbbbaaaabcbbbaaaaa###.#a#a#a####aaa###aa##a########aabbbedbacfegggfeeefeddccddgihdaaa####",
-"##.###a####aaaa#bacbaa#chidccdfdbbabaaa#ababaaa###a###aa#aaaaaaaaaba#aaaabccccbcccccabb###aabaabbbcbaabaa########aaab.####aaa##################a####b##aaaabb#aacdddcbb#######bccaaaabdbba#####aa#a#########abccccccddcffhigcbaaa#aa#acaabaabbbbaaabbbbbaaaabbbbaaaaaabcccdda#a#higheddefedeecdffffeeaaabbbbaaabcbaabaaaa#########a####aaaa######a#######aaabdcbadgfdeddegfgfeedcccccehigaaa####",
-"###########aa#####aacdb##ejgcbbfedcaaaaaacbabaa#####aaaa#aaaaaaaaaaa##abbbbbbaaabbcddddbccdcccbababaaaaaab#########aba..####aa###################aa########aa##aaaabbbba##a####ccaababdaa#aa#####aa##########aaaaabbccdfgjjihdcaa#aaaacbaabbababbaabbbabaabbbbbbbbbbbbbcccddebadhggfffeeffffeeeffdccddaaaabaaabbabbbbaaaa######..######aaaaaa#a###a#aaa###aaaccc#ceggedddcffffedcbabccdfgebaa###",
-"#########aabaaa####a#aabbachjgbacdedcccbabaaaaaaa#####aa#######aaaaaa#aaaaaaabaaaabbccdccddcbbbabaaaaaabbaa########aabb.#######a##################aaa##########aa##abaaaaa######bbaaaaba#a#a#.##.#a#aa###aa###aaaaaabcddgijijjigeba#abdcbbcdcabbbbaabbabaaabbbbaaabbbbbcacddee#dfeeeffeccdghhfffebccccaaaaababbbbaaabba#a########.###a##aaaa##aa##aaaaa####aababbddceggfedcdffedcbaabcdeeffaaaa#",
-"#######a#aaaaaa#a#####aaaabcdiibaaacecddcbaaaaaaaaaa##aaa########a#aa###aaaaaaaaaaaaabcccbbaaaaaaaaabaabbaaa######aaaaca.###.##a#a####a########aaaaaaa##...###a###a##a#aaaa#####bdaaaaaa########a########a##a##aaaaabbbbegfeedeghgeccddeeefgcbbaaaabbbbaaaabbbaababbbbcccbceeebegdddeffedbdeiihecbcbdbaabaaababcbbaaabaaa#a#.############aaaa##b#a##aaaaa##aabbbbccdceghgeddefedcaaaaccdedfaaaa#",
-"########bcaaaaa##########aaaa#gidaaabedcccbbbaabdbaa####aba#a#############aaaa###aaaaaaacbbaaaaabbabbbbbcbbabaa######aabb..##.####aa#aaa######aaaaaaa####a#.####aa##ba#aaaba#####dbaaaaa######aaa#aa######aa###aaa#aaabccebabaabbdfhhhgfghggdbaaabbcaaabbaaabaaaaaaabccccccedchigdcdddcedccabghdbaaabcaaabaaaaabbbbcbbaa##a########a##.#aaaaaaaaa#aaaaaaaca#acbbbbbcccdefeddeecdcbaababcfdfeaa##",
-"########baaaaba#aaaa#####a####aciib#aacdddbabbaabbb#aa#####aa#############aaaa##aaaabaaaabaa##aabababbbbccbbbcb#######aaaa#...##.#####aa########aaaaa######a############a#aaaab##abbaaaa#######cb############aa#aa#aaaaabaaa#######bfhigihhfbaabaaaaaabaaaabbaaaabaaaccbccdcchiihhdbcddcddccbbeeaaaabbbaaaababaabbbeeeaa#####.###.aaaa#aaaaaa#aaa#aaaaaa#bbadccbbbbccccbcddddcbcccbaaaaddddge###",
-"########a##abbaaa#########a#aaabcfjhaaabcdecaabaaaaaaa#######a########a#aa#abaa#####aaabaabaa##ba#abbccbaccaaca########abcb..######################aa###ceb#######aaa#####a#aaa###acaa#aa#######b############a#a##aaaaaabaa########abacfhhfcbbaaaabaaabaaaaccaaaaaaaacbcbbcffgfgcegeddeddcdccbcd#aaababbbaaababcaabaaccba########a#abaa##aaaa##aaaaaaaaaababcbbbaccbbcbccdddcbbbcbbcbbadcdeehd##",
-"########bb####aaba#########a####aabfjfbbcbcfdbabaaaaaaba######aa######aaaaaaaaa##a#####aaa######aaaabacbbaaabaa#########aadc...#######.##########aaaaaa#ddeb#a####aaaabeb######a###bbaaaa##b####aa#.##########a#a#a#aaaabaaa##b###.adbaabeecbaaaaaababaaaaabcabaaaabbbbbcdcfgeddgbbggeedddcccccc####aabaaaaabbaabaaa#acda############aaaaaa#aaabaaaaaaaaaabcbabbbabcbbbbcddccbcbbbabbbbccdfggf#a",
-"aaaa####bc##a#aaaaaaa###.#####.####aciiecccbceebaabbabbb######a#a####a##aaaaaaa########aaa#######aaabcbbabbaaaaa#########acfc..####.#.###.###aa###a#a#aaabcaaaa###aaaa##########a##bdcaaaa#ba###baa##########aaa####aaa#bbababdcbaacbbbaaaabbaaa##aaaaaaa#aabbbaaabbbbbbcdcccddcdec#adfedddcccbe#####aaaaaaaaaabbbaaa#bdb##.#######.####aaaaa###aaaaa##aaabccbbbaababbbbbcdccccbcbbbcbbbdcefghc#",
-"########a#####aa#bbaaaba######...####adhifegfddfdcabccbaa###aaaaaaa######aaaa##aa##a###b##########aa#aaaaaabaaa######a###abdfb..#######.##.#####aaa#a###baaa####aaa#########a####a#bddcbaaaa####aaaa####ad##aaaaaa#######abadddccccdcba##a#ababa###aaaaaaaaabaaabbbbbcbbcbbccdccbaba##afedddccbfa######a#aaaaaabbabaaaaab#####.##..#..a###aaaaa#aabbaaaaaabcccbbbabbbbbbbbddccbbcbbbcbbcfdeeffha",
-"##############aababaaaa##########.##.#..chjjhjifffdeccdbaa#aaa###aa#####.##aa#######.#######a#########aaaaaaaaaac########acchc.....#..###########aa##aa#abaaa##aba##a######aaaa##a##bdcbaaaa#####a#aa###bd###aaaa#aa##a####adgdcbbcddbb###aaa#a#####aaa##aaa##abbaabbbbcbbbcccddeccc#a#bhggfedaec##########aa#aaababaaaaaa#####.##.##.####aaaaaaaaaaaaaaaabdcbbbababbabbbabddcbbbbbbccbbdifdefge",
-"a###a##########abb#aaab#a#######...#####.##a#acgkigfeefdcaaa##aa#aaba####..######.#a###a#aa#aa##.#######aaaaaa##ba#####aaabbeha...###.###.#######a##aaa#aaa#a#aaaa###aa#a###aa###a###cdcaaa######a#####abb####aaaaa####a####deebbbccdbba##aaa#aa####aabaa#a#aabbbaaaaabcbcbbccbcedbba###cdffffeefba###########aaaaaabcaba#####.####.#######a#aaaaaaaaaaaaacdccabbababbabbaabcccbbbbbbbccdeeedefh",
-"f#######aa##a##aaa#aa#bba#########..############afkjgfgfeeeba#aaa##a#######.####.#.#####abbbaa##########aaaa##a#a#######abbcdhe#...######.##a####aa#a###aa#a#aaaaa######aaa###########bdbbaaa####a######aa##.##aaab####aabdecdcbaabbbaba##aaa#########abaaa##abbbaaaaabbbcdbaccbcebaa####adghfedeeba#############aaaaabbcb##########.######aa#aaaaaaa###bcdccbbabbbacbaabbbbbbdcccbbbbbcccccddeh",
-"hc#####aa######aa####aaaa#####a###.......##aa##a###gijhhhggeb##baaaa####...#####.#..a###acccaaa##########aa#####aaa####aacdddhf#..###.#..####aaaaaaaaaa###a#aa#aaaaa#####aabb##########cecaaa####a##############aabb##aabacddbcbbabbbaaaaaaaa##a#######baaaaa#abbaaa#abbbabcbbbcdgd####a##adcgfecdeb######a########aaaa#baaba########.######aaaaabbbbbbcbccbbbbbbbbbaaaaabbbbbbccbcbbbbcccccdeed",
-"egb##baaaaa####a##aa#aaa#a#######.#..###.###########adfilkhfca#abaaa#####..##....#....###bbccaa##a##aa####aaaaa##a##a##abbcfhjfb#..#####.######aaaaaaa######aa##a#abbbba###aba#aa#######cecaaaa###a#.#######aa##aa#aa###aaabcbcbbcbbaaabb##aaaaa#######abaaaaaabbaaa#abbbbbabbabdfeaaaa##a#ca#eecccfcaaaaaaaaa#a#a######aaaaabca########a####aaaabababbbbbbbbbbbbbbbaaaaaaabababccccbcccdccbdffd",
-"cfhd#acaaaa##a#######a#a##a###a##.....######.##########bddjkidca#########..###....######acaacbbb#a###ab##aaaaaaaaaaaaa#aabcfgejfa#.###a######a##aaaa#aaa#a###aa##a#abbcba#####aa####a###aeedbaaa##aa####...#aaaa#bcaccbaaaabcdccabcbbbaaca#aaaaa#########aaaaaaabaaaaabbbbbbbaaabbecbbcaaaaaa#adecccedcaaaaaaaaa##a###########abaa######a####aaaabdbbbbbbbaabbbbbabbaaaaaaaabbaabccbccbccdccdefg",
-"fedfea#a####a##a#a#######a####a#.##..#.####...########aaaaaeikhea#####################aaacbabbdfdbbaa#aaabbcbbaabaaaaaaabcdfbbeica..#a########aabaaaaaba#a###aa#######aaa#####aaa#.aa###adffdbaaa##ca####.#########abbcdeeeefcdcbabbbbbaacbbaaaaaa##a##a##baa##aa###aaaabbabbaabaadfb#bbbbbaa###feccbeecbbabaabaaaaaaa#aa###a####a########a##aaaaabbbbbbcbabbaaaaaabbbaaaaaaabbbabccccccddddeeee",
-"fggehdaaa######a##########aaaaa#.##.####..#..##.#######aabbaadjljgda.#################aaaccbccddcccccccccccccdcbbccbcbaabbcfdcbgf#...#aa######abcbaaaaabaaaaa############.##aa##a########dffedcbaa#cc##########a####bbbbcdffeedaaabbbbbcbabbaaaaaaa#######abaaaaaaaaaaaabbabbaa#a#bdcbbbaaaaa###cfeeehhecabbbbbbaaaaaa##aaa##a###a########aa#aaaa#bbcbbbabbbbaaaaabbbbbabaaaaaaaabbbbbcccddddeee",
-"edehhg#aaa######a#a#####a##abbaa###.###################aaabbcaacjllkhbaa#######a######bbaefddddcbbbaaaababefeedddccffdccdfgeeeefec#...#ab#.####abccbbba#aaaaaa###########..###a##########bfdfdccaaacfb.######aababaaaccccbdffebbbbcbbaacccbabbabaaaa######aaaaaaaaab#aaabaaaabaaaabbeffcaaaa####aeeeefiihfcabbbbbbabaaaaaaaa##a######aaaa####abbabbabcbaaaaccbbbbbbbbcbcaaaaaaaaaaaacbbcdddddede",
-"eefgghcaa#######a##aa######abbbcc#.############.###a#aaaaaaaaccbafjllkjecbaaaaaaaa##aabcccgefeecccbba#aaaa.acffffffcacdccbbbfffefda#.##########aabcedba##aa#a#####a#####..#####aa###.####bceecccbaabdfa##aabbbaabbbbdcbbccdcceebabbbaaabcdcbbbbbaaaa######a##aaaaaaacaaaaabbaba###acdeegcbbb#####aeffgfgijkgcbbbbbbbbabbaaaaa##a#aaa#abaaaa##aacdbabbccbaaa#bbbbaabaabccbaaaabbaaaaabbbccdeedddd",
-"deeffdfd#####a######a#######aaaca#a############bdca###aca##aaaceddfijjnligdcbbcbaaaaabcddchgedddbccaaa#aaaaa##accfbbbaa####bdhfedhd#.###########bbcccdba###aaa#####a##a#.#####a####.####.#abedebdcbbcfe#####adcbcddbbdbaaacbcbccbbbaaa#bbcbbbbbbaba#a############aaaaaaaaaabaaaaaaabdfcccbbba#####aceffgiijihedccbbbbbabbaaaaaaaaaaaaaaaaa#####aabaaabbbaaaaaabbaabbbbbcabaaaaaaaaabbbbcccdddddd",
-"ddddecbdca###a###a##baa#aa##abaaba#a###.#####.#aabaaa#aaa##aa#acdhilmklmlmkheegecbbbbccbcefgedcdcbbbbaaaaa#aba#a#cdabcbaaa#achihggfa############abdb#bcaa##aaa#########a###.######..########beddecbcdffc###.#acdfffdabcca#aabacbbbbbaa#abbbbbbbbbaa#############a#aaa#baaaaaba###aaadfd#babacababbbcegfhhiihgfdddcccbbbaabbaaaaaaaaaaba#aaa###a#aaaaaaaaaaaabbabbaabaaabcbbbaaaaaaababbccdddddcd",
-"deddddcacaba###a####aaaaaa#aaaa#aaa###aa#########a##aa#aaa##aba#.cfehhjkjllmllihfedcccbbdefgdcccecbbbccbaaaaaaaaabdbbbcbaaaabhjjhggea#.####a##a#accaa#cdaa#aaa#.#############a##a##.###a####.cedccccefbbaa#####deffeaacdaaaa#aabbbbbaaaaaabbaaabbaba#####a.###a###a#a#aaaaaaa#a##aaacdecaaaabaa#aa#bdgfeeefhhfdccccddcbbaaababaaa##aaaaaaaaa###aaaaaaaaaaaaaaaabbaaababbbbabbbaaaaaabbbbcdcdccdd",
-"dddcccdbbbcba#bb#aa###aa##a##a####a##.####aaa##a#aa##a#a#ba######.fffkjlhkkljmmmlieeddccefaeeeccdedbcdccbcbaaaaaabaccbccaaaabeijjigieba.#######aacbaa#accaaaaa##########a#a###aaa#############decabdeeeaba###..adeddcaabcbba##aabbbaaaaaaaaaaaaaaaaa#####a###########aa#abaaaa##a#abbcdeba#b#aa#####cefedcbbdeedcccdddcbbbaabbaaaaaaaaaaabaaa###aaaa#aaaaa###aaaaaaaaaabbbaabbcbaaaaaabcccccccdd",
-"ddccbcccbcedaddaaaaaaaaaa#aa#a######...###########aaaaaaaaaa####..cfhjjkmlmklkklmnjfeedeefebdeddegheeedddccbbbaaabbccbcbbaabbbgjkjjhifda.#######aaaaa###abaaaa####aaa###########aa##########..adccaddcecbabbaa##dedddcbabcbca#aaaabbaaaaaaaaaaaaaaaaaa###############aabaa##a####aacbcddebaaa########cffecdcbceeefdddddcbbbaabbbaaaabaaaaaaaaaa###aaa#a#aaaaaaaaaaaaaaaabbbaaaacbbaaabbbbcdcdccb",
-"cdcccccbbcdbaacbbbbbbaaa#aa#aaaa#####..#..##.#####a#aaa####aa######eigfcfgijjjlmmmmnlhfhiggdddeefgegfgffdeddcdcbaaccccbcbaaabbcfjkkkijgfb#######a#aa######a#############a###aaaaaba############abcc#ddcccbdecdcaddddddecbbbccaa###aabaaabaaaaaa#aaa#########.####a##a##a#aa#a######abccdgbb#ba#a######cffgfdefffehgdddeccccbaabbbaaabbabaaaaaaaaa###aa##aaaaaaaaaaaaaaaaaaaaaaaabbba#aabbacddccc",
-"cddcccbbcccaabbabaacbaaaaa#aa#aa#.#...#...#..###a###a#########aa##adeaaa#abedefijlkmnnlkkjdddfdcebb#degfaefgfeddcbdcddbacbbbbbbdjjklkkihgc#aa#####aa################aaa##a#aaabaaaaa###########aabdbedcabdddeeddddedcccddccbbbca###aaaaabba#a#####a#a###aaa###.###a#######aaaaa###aabbbbcdaaabaa##a####aeghhhggghhhfedddcccccbbbbbbbbbbbbbbaaaaaa####aaba#aca#aaaaaaaaaaaaaaaaaaaaabaaaaabbbcddd",
-"dddcccbbdedaabdaaaabbabbbbaaaaaa#.##.##.#.#####################aaaddbbaa#aa##a##aceejnllkkhfhfccfbbaaaabafabdeffgfcdddcabbbbabacgjkkllkhjhbaa#####aa############a##aaaa###aaa#aa#a#####.####a##aa#deedcabdeeeedeeddeedbccdcccdcb####aaabbbaaa#####a##a##a####################aa####aabbbcdea##a########aaabehiiiiiihfedfdccccccbacbbabbbcbbbbaaaaaaaa##ab##bbaaaaaaaaaabaaaaaaaabbbaaaaaabbbbbdd",
-"ddccdbcbedcaabbbbaaaaaabbababbaa#################a##########a###a#ecbaababaaaa#####abkllllljgbaaccbababbabaaaa#cedfheedcabbbbbbbchkkkklkhggeba###aba####.####a####a##aa##aaaaaaa##aa####.####a####dfdcba#bdeeeeeefedddcbbcdbbadcba###abaaacaaa###a##a###aa#####.####a######.##a####abbbbccbbc#ab##a#aa#ca###cfggihhihffffedcccccbbabccccdccbbbaaaaaaa#aa#aa#aaababaaabbaaaaaaaaaaaaaa#aa#abbcccc",
-"dedcccbcecaaacbababbbaabbbbbcbaaa#..###.#########a##############.cdabbbbbbbba###aabcddilmmljeaaabcbbbbbbbbbbbabaabcefgfecbbbbbbcdfjjkkkmkhfgecbaaabb########a######aaaaa####aaa###################befcbaabbadfeeeeffededcbbccabccccaa#aaa#abaa#######a########...###########.##..###abbbbcbbf#aa###abaa#a#####acfgffgfggefddcccccbbabcecbbbcbbaaaaaaaa##aa#aaaaababbbabbbbbcbbabaaaaa##aaaaabbcc",
-"cddecccccdcaaaaaabbbbaaaabbbbaaaa########.####################..aaababaaacbba#abddbcdfeejmllf#aabbbaabbbbbbaaaaaaa#afffdedcbbbddffjfijjkkkhgfed####aba#######a####aaaa#aa#####a######a############adffddcaa#befefedeeddccccbcbaacbaabbaa###aba####a###############.###########.######aabcddcefbb###bbaaaaaabba#cffffghhgfffedccccccbcbbebbbbbbbaaaaaaaa####aaba#aaaabbbbbbcbaaaaabbcbaaaaaaaabcc",
-"dddddfebdfeba##aaaaaaabbbbabaaaa####.#########################.abbaaaaaaaaabbaaabba##aceeilmme#aaaaaaaabbbbaaaaabbbbbefgeddcddddegiighiiggjggfdba##aaaa##############ba#b###aaaa#######a##a#aaa####dfgffgcaabefeeededccccdddcbbbbbaaacbab###aaaaaa########a#a########.#########..####aaabdcdecbdc#aa###aabbcccaacegggfgghggfeeeddddcccbccbbbbaaaaaaaaaaba#aaaabaaaaaaaaaaaaaaaaaaabbaaaaabbabbbc",
-"bcdeeeeedeeda##aaaaaaaccbbaaaaaaa####..##.#########a##########aaaaaaaaaaaaababba#aa####abbdhkmgbbbaaaaabbabaaaaababbbaehfcdeeeegghkkjjigdeehfeccaaaabcba########a####aaa#####aa####a####aa###baba##adfgfffdeeffdcddddddbcccdccbbbbbbb##bdb###aadb#a##############.##.######.##########abcdcedecegdb#a#aaabbcddaa#adfghfghgffefeefeeddcccccbbcbaaaaaaaaaaa#aa###aaaaaa#aaaab##aaaabbbabaaaabaaabb",
-"cbceeeefffffd#aaaaaaaaaddbaaaaaaaa#############.#############cbbaabaaaaaaabaaaaaaaaa###aaa#achlkigdaabbabbbbaabcaacaababccdbbdedcdfehkkjgeceheccda#aabbba###.######a#aaa#####aa######.#a#aa##aa#aa##adgggfeeggffdcccddcccbbcbccbbbaaa####ca##abcba#aa##########.#####a######.#.#######abbcbddbdfhgeaaa##abbcdcaaa##aaceghdfgffffffeeddddcccbbbaaaaaaaaaaaa##aa#aaaaaaaaaaab##a#baabbabbbaaaababb",
-"ccddefgfefffd#a##aaaaaabccbabaabaaa##########...############acbaabaabaaaaaaa#aaa#aabaaaa#aaaabgkjiifbabbabbaaaabaaabbabaaaaaaabcc#####cgkmjgfhfcbcaaaabcbaa########a#aa###a###########.####a######aa##bghfefgeddeccbbbccccccbcdcaaa#a##a#aa#a#aaaacbaa##.############aa########.#######bbbccddddggfbaa###abbcbaaaa#aaabeeeeggghgggffeedcccbbbbbcbaaaaaaaaaa###aaaba#aaaabbaa#a#abbbbbbabdbbaaaab",
-"bcceddefhgfcbaa#a#aaa###aaabbbaaaaa#######################aababaaaaa#aaaaaaaaaaa#aaaaaaaa#aa###cefllgabaaaaabbbaaaaabaaabbabaaa#ba######bfjljhghcac##aaacaa########a###############aa#.##a#############afgfgfedcccccbbccccccddcccaa##a####aa#aaaaaabaa#################a#a##.#########aaabccccddeegfbaa###abbaaa#aaaaaabdfceghhhhhhgfedddcbbbbbbbbaaaaaaaaaa###a##aaaaaaabbbaaacbbabbbbbcccdaaaa",
-"bbcccdefhiea###a##aaa######aaaa#aacb##############a####aaabcbbabbaaaaabaaaaaaaaa##a#aaabaaaaaaaaabekljbaaabbaabaabaaaaaaaabbaaaa#a#aa#####aekkhhiba###aabbbb#####a.#########a#a#####a#######aa####.#aba##gggfeedccbbbbbbcbaabccbcbaa##a###aa##abaaa#aa###..###########.###a##.#######aaaabbbcdddcefgaaaaa##abaabaaaabbaabdeffghighhgfffeeccbababbbbbaaaaa#aaaa#a####aaaaaabbaabbbbbbbcccbcccdbaa",
-"bcccccdefgeaaaaaaaaa#a#a#a##aaa#a#aba#######a#.###aa######bcaaaaaaaaaaabaaaaaaaa###aaaaaabbaa#aaabbchkkc#aaaaaaaaaaaaaaaaaaaaa#a#aaa#a#######dkklibca#aaabcdca#a#aa#################a######aaaa######aab#cghhgfddcbbbbaabaaaaabbca##a##abaaa##abaaba#a#aa############...##.###.#..####aaacbbcdccdcdedbaaa#a#acbaaa#aaaaaaabcffffghhhfggfeddbcbbbaaaabbaaaaaaaaaaa#aa#aa#aaabbbcccbbbbbbbbbbcdccb",
-"bbbccccdfcec##aaaaaa####a####aa#aa#aca##a####baa#######a##bbbaaaaaaaabbbbbaaaa#aaaa##aaaaabbba#aaaaaadijgaabaabbaaaaaa###aaaaaaaaaaaaaa#######behlidcdbaaabbcecaa######a###aaa###########a####a#######aaacghihgfedcbaaaaaaaaaababbbaa###aaa####a#aba##a#a#####..######......#...#.#.####aaccbcccdcdehhdaa####bcba###aaaaaaabaaadfeeegihgecdedcbcbaaaabbaaabaaaaaaa##aaaa#aaabcbbbccbbbbbbbbbcbbb",
-"babbcdddddde######aaa###########aaaabda##a####abaaa#####abbaaaaaaaaaaaaaaabbbaaa#aa##aaaaaaaaabaaaaaabcdkib#aaaabbaaaaaa####aaaaa#aaaaaa##a##a##acgjhfgefcbbacccbaa####a######aaaa########a#############bfffhjigedddbaaaaaabaabbbbccaa####aa###a##aa#################a##.....#..#########aabbbbcccddfheaaa####bba####abba#aaaa##bca.#bghfedecbccbbbaaaaaabaaaaaaaaa#a#aaaaabbbbbbbbbbbbbbbbbbaba",
-"bbabbdcdddcec#####aaaa#a####a###abaaaaaa##bda##aaa######aaaaa#######aabbbaaaaaa##a##aa#a#aaaaaaaabaabacbdjjbaaaaaabaaaaaa##########a#aa##aaa##a#a##cfhhededabbdcbcca##########aaaaa############a######a##dffgjiiheedcbaa###bbaabbbddba#########aaa####################a###..###..##..###aaaabbbbcbcfffebaaaa#aabaa##a#aaaaaaa#####aa#.bdegfeccbbaabbaaaaaaaaaaaaaa#aaaaaaaababccbcbaabbbbbbcbbab",
-"dbbbbcdcdcdcea###a####a#aab#aaaa##aaaaaaa##a####aaa###.##aa###########aaaabaa#aaaaaaaaaaaaa#aaaaaaabbaabbbhkfcaaaaabbaaaaa##########aaa###aaba######.ekjgddbabbaabccbba########aaa####.#######aa##aaa#####dgfgghgggedcbbaaa#aabbbcbedba#######aaa#a####################aa#.......##..####aabbbbcbcdefeebb#aaa#aaa##ab###aaa#######a###.##cgefdccbbabbbaaaaaaa#aaaa#a#aaaabbccbbcbbbaabbbbcbccbbb",
-"bcabbcceffabbc########aaa#aaaaaaba#aaaaaaaa########.#####aa######aa####aabbbaaaaaaa##aaaaaa###aa#aa#aaaaabbfkjhdaaaabaaa#aa##aa#####aa#a#a#aaaa######aikjjhbaaabbaacbaaa###############.###################bfhggggggfedcabaaaaabbcdeccaa########aa##########aa######a#a##a##..#.#...#####aabbbbbcccecdgccb##a####a##a############aaa######agfedccccbbaaaababaaaaaaa####aabbaaaaabbababbbccccbbcb",
-"ababbccdffdbbbba###aa#aaaaaaa#baaaaaaaaaaaa#########.####ab###########aaaaaaabcbbbaa###aaaa#ba###aaa###abbbbflljeaaaaaaaaa###########aa##aaaaa#######.afikkiba#abbaaba##########a############################ehffgggfeedcccbaabababcccbaa######aa##aa###.###aa####...#########...########abbbbcbbbcdecfgdaa#######################aa##a####bfeeddccbbbbbaaaaaabaaa#abaaaaaaaaabaaaabbbbbbccccccc",
-"adbbbbcdddecbaba#a#######a#a##aaaaaaaaa#aa##########.###aac##########a##aa#aaaabcbbaaaa##aaa####aa#aaba#abbbbdillhcaaaaa####aa####aa#aaaa##aa#########.#chkli#aaaaabbaaa########a#aa###a###############.###aa#fggffgffedeecbbbaaabbbbcbaaa#####aa###a############################.######aababbcbbbccedcfccaaaaaaaa###############.####a#####bffeddccbbaaaaaaaabaaa###aabaaaaaaaaaaababbbbbbbcccc",
-"ccbbccddeeeccaaca##a####aaaaaa##aaaaa#a#aaaa#########.###ab####.#a###aaa##aaa#aaaabbaaaaaaaaaaba#abaaaaaaaaaaachkklfbaaaa##########a##abaaa############..#bimiaaaaaabaaba##########aa#babaa##############.##a##aegfcbdeedfedbbbabbabbcbbbaa#####a#####aa######################.#########aabbbbbcbbacddddccaaa#aaaaaa###a#####################afgeecdccbaaaaaaa#abccbaaaaaaa#aaaaaaaaaaaabbbccbcc",
-"ccedcdddeeeccbbbcba#a###aaa#a#a#aaa#####aa#a#############ab#####.#####aa#a#aabaaaabbbbabbba##aa###acb#aaaaaaaaacfihkida##a#a###.####aaaaaaaa##a###aa######.ahljc#abaaaaaaa###.####a######abaaa############.#####.bababeedegdcbccbcbabaaabba#a##aa####aba#aba#a###################.####a##ababbbcbbbcdddedea#aaa#a####aa#######.###.######a##a##fgfedddbbaaaa#bcdccbbba####aaaaaaaabbabbbbbbbcbbc",
-"cddeddddeefddcbbcc#a#aa#aaaaaaa#aaaa####aaa######aa######ab#a########aa#a#aaaaaaaaaaabbaabba#aab###abb######aaabbcfheihc######a#####aa#aaaaaaa####aaaaaa###.aikjcaaaaaaaa#################aaccbaa#a################aaaaaaabdddcbccbaaaaaaaaaaa##b####abbcccb##.###a#############..###aaaaaabbbbbccbbccccddecaaa#aaaa###a########################effedccaabbaccbbaaaacc####a#aaaa#aabbbbbbbbbbbcc",
-"dcdcdcdeddfecdcbcdaa#aaa##a###a###aa##############aaaa###aba#############aaaabaaabaaaabbabbaaa#aba####a##a###aaabccefadhhb##aaa#####aaaaa#aa#a##aaa#aaa#####.aflkcaaaabaa####################ddcbaaa#################a#aaa#bdddbbcbaaaabaaaaaaa#a####a#baa####a###a###aa#############aaaabccccbcccbbcdcdedefb##a###aa##aa###############a##aa####efddcbcecbccabbaa#aacc###a##aa#aaaabbababbbbccc",
-"ccdddcbcfhfddcdcbbc#####a#aaa##a########a#a#aaa#####aaa##abaaa##.#######aabbaabbaaaaaaaababbaaa#aaaaa###a#a#a#aaabccdha#diga##aba#####ca##aa####aaaaa#a#######acildaababbaa###########a#######abccbaa#########.#########a###cdedbbdcbbabba#aaa###a####aaaa#aab###a##a#aa######aaa######aabbccccccccccddddeddfca#aa##aaa#aaa#####a####.###aa#a##a#cfeddedacaaabcaa###aacc###########aaaaaabbbbbcc",
-"ccccddccdeffdcccdccb########aa##########a#aaabaa#####aa##ab#aa###########aaaaaaababaaaaaaaabaabcabba############aaabcffb.afjfa#aba####a#a########a#a########aa#abhjb#aaaba#a##########a#######aabcccbb####.#..###aba#########abddbcecbbcbba#aaa########aaaa#a#a###aaa########aaaaa#####aabccdcddccccccccddedcec###ba#a####a#a##########.######aa#adedcbbaabaaabbaa###aabca##aaa#a##aaaaaaabbbbbc",
-"cccccdcedcddfebbdcbdb#######################abcbba#######bbaa######.######aaaaaabbabaaaa##aaabababaaaaa########aaaabbcfiea#bgjeaaa######aa#a#############a####a#acgigaaabb##########.##a#######aaa#adcba##########ba#a#a#####a#adfcddbcccbaa#aaa######aaaaaa##aa#aabbab#aa####aaaa#####aaabbccdddcdcbbbbcccddegd##baaaaa#########a################abbcccbbbbabbbba#####abca##aaa####aa#aaabbbbbb",
-"bbbccddcdcddefdbcdadcaaa#####################aabbbba#a#aabba#aa##########aaaaaabbaaaaaaaaa#a#aaabbbbbaaaa###a#aaaaaaaabfifa##ejgbaaa########a##################acbcfigba#aa###########a#########a#aaabbbba#######.#a#a#######aaaaffddccbccba##aaa##########a######aabaaa#.####aa######aaabbbccdeeefggecdedcdfedcbaacbaaaa##a#a####a############a##aa#accdcbcbbbbbba#####aaca#aaaaaaa###a#aaabaab",
-"bbbbcccccddddfecbccbdc#a############a###aaaa#aaa#aa##aabcccc###########aa#aaaaaabaaaaaaaaaa#aaa#aaabbbbbbaa###a#aabaaabbbhie#.bfhfbaaaa###aaaaaaaaa#######a####aaabdhifbaa########aabaa###a######aa#####bccaa#####.#####a########afgeddccdcba###aa########a#a#######aa######.##########aabcbcccdffghihgdcddcbacbbeabaaaaaa#a###################a##aaaa#bcddcdcbbbab##a##aaaba#aabcaa####a#aaaaba",
-"bbbbbbcccccdefedbbcacdc####aa##a#.##a#.##abb######a##aabbccc###########aa#aaaabbbbaaabaaaaaaaaaaaaaaabbbccbaa##aaabaabba##diic##adhebaaaa#aaa#aa##aa##########aabaaagjjf#a######a#aaaaaaa#a#######aa#a###bdddaa#a###.#a###########adcdddddcba#aaaaa#a###a##a##ba#b###aa####.###aa#####a#abcdcbbcdghihhgdcaaaaaabcfdccaaaaa#aa###################a##a#a##acbcdcbbcba#a#####aaba##abaaaa###aaaaaaa",
-"aaaaabbbbbcddeedccebaccb###a####a####a#..aba##########aaaaccb.############aaaabbaabbaabbaaaaaaaaaa#baaaccbbaaaa#aaaaaaaa####fjfb###egebaabcb##aaa##############aaa#achkjbaa######aaaaaba#a#aa###a###########abba###################abaceddcbaaaaaaaa#####a#####a####a##a######.###a##abaaccddedeeffdghfaaaaaaaabbdfcabbaaaaa###############.#########a###bccbedcbdaa######a#abaaaba########a#aaa",
-"#a#aaaabbbbbbcdedcccbabbb##aa######.######ba#############abcc##############aaaaababaaaaabbaaaaaaaaaaaaabbcbbccba#aaaaaaaaaaa#beihb##afgdbbcba#aaaaa######a######aa#abcilheba#####aaaaabaaaaaa#########a####a##a#aaa###############a#aaadedbbaaaaaaaaa##aa##a#######a##aab######.##aaaababceefcddcb#.#gfaaa#aaaaabcfgcaaaaaba########.#####################aabddcbcabaa##a##aaabaaaa######a######",
-"##a#aaaabbaabbccdcbcbbbacb###a###########.aba#######aa###aacf#######.#######aaaaaabcaaa#acaabbaaaaaaaaabababbbcdcbaabba#abaaaaabfje#a#aehdaaaaaaaaba#####ab#a####aabaabijiebaa##aaaaaabaaaba##aa#####a#a###########a###a###########aaaaaabbbaaaaaabaaa#aaaaa#####a##abaaaaaa########abbabcdgeba##.##.bdaaa#a#aaaacfgcaaaaaa########.a########.#######a#aa###abccbbbaaaa#aa#abbab#abaa####aa#####",
-"#####aaabbaaaabcbccccbbbcca###a############a#########aa##aaacb###.#.########aaaaaaaaabcbaaabaaaaaaaabaaaaaaaaaabcaaaaabaaaaabaabaejhbaa#aggcaaaaaaaaa####abb#a###aa##aabhigddbababba#acbabaaa###aa####a#c#a#############a#a########aaaaaaaabbaaaaaaaaaa#aa##a#####aaaaaa###aaa######aabbabege##b#######aa#a##aaaaaceecbaaa############################aaaa##aaacbbbaaa##aaa#aaaaa##aa#####a#####",
-"####aaaaaaaabbabbdcbcdccbbba#aa####a##a####a######..##aaaaabab###.###########aaaaaaabbbbbbaaaaa#aaaabcbaabaaabbaaaaaaabbaaabbabab#bghcaba#dhfaabaaaaaa#aa###aa##aaaaaaaabeegbccbaaabcbbbaababa######aa#aaaaa##aa#.######aaa#########b#aaaaaabaaaaaaaaaaa#a##aa#aaa#aaabbab##a####ab#aabbbbcfhaaca##############abbabddbbaa####################.###a##a#aaaaa#aabbbbbaaaaaa###aaaaaaaa#######a###",
-"#####aaaaaabbbbbccdbccdcbcca##########a#####aa##a######a#aaaabc###############aaacaabbabbbbbaaaaaaabccbbaaaaaaababcaa#bbaaaaaaaa#ba#eiebabaafhb#aaa###a#a####aaabbaa#baabbbigcebaaabcbbcdbbbcca#a##a###acbbaa#ab##########aaaa########aababbbaaaaabaaaaa##a###a#aa###aaaca##a#aa.bc#abbdccbdga#####.###########abbbbcdebaa##a##a##########a####.###a#aa###aaa##aabbabbba#a#####aaaaaa########aa#",
-"#####bbbabbbabbcddddcccbbbcca#a##aa###a#################aaaaabb#a####.########aaaacaaaaaacaaaaabcaaabbcdcbbbcbabbbabbaaaaaaaaa####aa#cijdbababhfa#aa###aa##a##a#aaaaa#aabbbflggfaabacbaabbbaacbba##aa#abccbbaa###aaa#####a#aaaba###a#aaaaabbacbaaaaaaaaaaaa###aaaaaaaaaacaaaa#bbab#abbcccccbdc#################aabdceedebaa#########################b#####aa#####bbbabbaa#a####a#aa##ba########a",
-"aa##aaabbbbccbbcccddcdccabbdfa####a###########aa######a#a#aacc#######.#########aaabababbaaaabbaaaaaaaabbbbaaaaaaabaabbbaaabaaaaacba#a#beijbaaaaehfa###########aa#abaaaabbbbdhjghffedccaaabaabaabbaaaacbcbcccbaa#aaaaaaaa#aaaaaaaa####aaaabbaadebbaaaaaaaaaaa###aaabaa#a#aaaaabbbbbbbabcdcccefe####.##.#######.##a#aacccccaa#aa#####.###############aaa###.#a###a##bbbbbaa#a########aaaaa##a#####",
-"###ab#ababbccbcbccdddccccbbbeda##aaa######aa###abaa####a###abdb#a###.######aaa#aaabbbaaaaaa#abbbaa#aaaaabdaabbcbabb#aaaaaaaabaaacbcba####ejdbbbacgjd##aa#aa#####aaabbaabaabbejiiiihhggfbaabbbaabcba#bcdcdddddcaabbbbcbaaaaabaaaaaaa##aaabbbbcdedbcbaaaaabbaa#aa#aabbaaaaaaabccbbbbbcdccddffebb####################aabccccca###########.#########a####aaa####a##aa#abbaaaaaa########aaa####a#####",
-"#aaaaabbbabbcccccdedccccedccdebabaa#aa###########baa##.##aaa#aca#######.#####aaa#aaabaaaaaabaaaacbaaaaaaabaaaabcbaabaa##aaabaaaaabaaaa###.cjgcbbbadiib##aaaaa####aaabbaaaaabdhlijjiiihfefcbaabbbbbbababdedfddedccbccdccbccdccccbaa#aaaaababcccdddcccbaaabbaaba#aaaabbaabbaccdddcdefffedeeed..################.######abcbdfbab#a###########################a#a#####aaaaaaaa##aaaa######a##.#a####",
-"###aaaaabcbabccccdcddcccccbbccebaaaa##############a#a####aaa##abb##############aabaaababaaabaaaabbaaaaaaaaaaaaaabbcbabbaabaaaaaaaaaaaa####.afhdbbaabfihb.#aa###aa###aaba#aaacclljjiijigddecbaabccbabbbdbadcbeffffeffgghhhighgfhgffcaaababdbbbbcfddddcbbbbbccabaaaaaaababddehggfegjiedaaaa#a####a##############.######bcdcddbaaa##a###################a#a#####aa####aaaa#aaa#a########a#######aaa",
-"aa##aaaabaaabbbdddccdbcddcccccdd##a#aa##aa########a######aaba###ab##############abaaaaacbaaaabaaaaaaaaaaaaaabbaabbaccbaaaaaaaaaaaaaa#########bfgbaabbdije.######aa#abbaaaaaaabellkkkkllkiiigfdcdcbabbcbcdcbcgijkjhhhhijjic#dcbcbddghffeeeihiggfgddedcccbcdcdcbcbcbabadeeffghhhebegdddb#########a#a####################babbbcbbb##a##################aa##a####aa#a###aa#a#aaa##a#######aaaaa##aa#",
-"a#aaaaabaaaaaabcdcceccefcadgeceebba###a#aaa########a#####aabaa#aabda########a####aaaaaaabbaaaabaaaaaabbaaaabbbbaaaaaabbcbaaaabaaaaaaa#aa######.eiebbbbcfihc#.###abaaa#aa##aaaabellkjlkjklmnnmlkgfccbbdddeefghjijkkllkhd#cfeabcbbcbbdgjjhgecccehieeededccceeedddddefcdffcedbacdec#bbaba#########aaaba#########.#######aaaacccdbbaa####################aa##a####aaaaa#aaaaa#a####aa######aa#aa##aa",
-"a#aaaabaaaaaaaabcccdddggedbdfccecaaa###aaba#a#######aa#.##aabba#aabc###########aaaaabcbaaaabaabaabbbabaaaaaabbcccaaaabbbbbbaaabaaaaaa#aa#aba###.bigbbbccdilid.##aaaaaa####aabbbcekmljgdfiijikmlmnkgdeefeeegieeddgdcghgdbabcfdebcccceffggfcbbbbbcefgedddcceeefdedcbccefgb####babedcaa##aa#######aabcda##.#############aaaaabcdcdbaa#########a########a###a###aabbbbaa#aa#aaaaa##aa######aaa##aaa#",
-"##aaaaabbaaaaaaabcdceeffedccfgedcaaa##aaaa###a#a#####aa..##abaaaabbd#########aaaaa#a#bbbbbbaaaaaaabbbbbaaaaaabccbbaaabaabbbbab#aaaaaaaaa#aaaaa###ahibbcdccgjkg####a#aa####aabbcddegkhddgihhghiibdilmljjjjiiihfaaa##aeeedcbbdghfdbbdfedfedccbbbbdbffhfededeefhhfc#####cea#####aaabdfda.a######.##abdfb##########.###a##aaaabadefecb#a##########aaa####a##aa####acbbbaa##aaaaaaaaaaa#####a######a#",
-"a##aaaaaabaaaaaabacddeddfdccefffd#aaaaabbaa#a#####a#.aaa###aaaa#abbdb########aaaaba#aaaaababbaabbbbbbbbbaaaaaaa#abcbaaababbbbcb#aa#abaaa###########fhdcccdcehihb###aa######a#bccdefggiglkjjhiihba#cglkjhiihgebcaaaaaa#aacdbbdefhfdbbeedbccbbbabdcbgjifefedeggfgfa#aa#a.aa######aaaacffba####.###abdeca######a###########aabbegffgedaaa##########aa####a##aaa#####aaaab#aaa##aaa#aa######a#######",
-"##aaaaa#aaaaaaaaabbcdddceddeeecdfbaaaaabbbaa#####ab#########aaaaaabbc########aababbaaaaaaaabbbaaaabcbbabbaaabaaaaaaabbbbaaabaabbbcaaaaaaa##########.bhfcccdddefigc#abaa#aaaaaacccdegeiihkihhjhbbaa#.#a##a#..##aaaaaaaaaaaacaabaacefedefbbedcbaccdbcfgiihhfdec.addb#ba###aa######aaaaadgeca#######aceaaa#################aaabdgeeghffb########a######aa####abaa#####a#aaaaaaa#aa###a#.######aaaa#",
-"a##a####aa#aaaaaaabccbccdedefebbef#baaaaaabaa#####a#aaa####aaa##aaaada########aaabbbaaaaabbaaaaccbbcabbbbaaaabaaaaaaaabbbbabbbbaabcb#a##a#########a##bifdccdddefgjeaaabaaaa##accbbcddfhehijhdb#aaaaa#a####a#abaa#aa##aa#aaaaaabbbaabefigffefdbcccdcbaacbbdhhfeaacbabb##a##########aaaaadhgb#####aabecaa########a###########baegfefgfeca##a#######a##aaaaa#aaaaa####aa#aabbaa#aaa###a#.#####a#aaa",
-"#aa#####a#a#aaaaaaacccbbccdcdedbcfcaaabbbaaaaa####a###a###abdb####aaeda######a#aa#aabbbabbaaaaacddbaaaaabaaaaaaabcbaabbbaabbbbbbababa####aa###aaa#####dihecccdedeejgaabcbaaaaabcbbbcdeheggeabaaa####aa########aa###aaaaaaaaaaaaaaccbaabdegedddddddccbbbba#abaabcbbaaaa##a##.#.#####a#a#abefb#####abdfaaa#####aaaa#a########aaadfeeffffc#######a######aa#aaaaaaa#aa##aa#aaabaaaaaa#######.###a#aa",
-"aaaaaa#aaaaaabaaaaabbcbbabbbcceedffdbaabcaaaa##abaa##aa###acefa####abdaa###.####a##aabbbcbcbaaaaabba##aaabaaaabaabbbaabbbaabbbbabbcbba#a##aa###aaa#####bhjgccdddefdhheabbaaababcbbabcdehfcaaaaaaaaa#aaaa#######aa###a##aaaaaabcdaabbbbabbbefedeccddcbbbaababbbcccca#a####aa#############aaceda###aabfebaa####aaaaa##########aaadefedegca########aaa##aaa#aaaaaaa##aaa##aaaaaaa#bcba#########aa##",
-"#aaa#aaa#aaaababcbbbbccbaaabbbbdgffgbaabbbaaaa#aaa####a##abbgea##aa##bca#########a#a#bcbabbbbaaaaaaaa##aabaababbbaabaabbbbbbbbbaaaabbaa##a#####aaa######adhidddddfhdfigbcba#aaaaaaaacbcfdabaaaaaa#aaaaaaa#######bb#####aaa##aabccaaabdcaaaeeefeddefcbbbbaaaabcbbbcdba#####a####..#######a##abdb#aabcefdaa####a#aaaaa#######aaaaaabacefc#########a###aaaaaa##aaaaaaaaaaaaabaaaa##aaaa###.#####aa#",
-"#############aabaaaabcbbaaaabbcceeeeeaaabbaa##a###ab#####abddb#####a##cb#######aa#a##aabbbbbbbaaaaabaaa##bbabbbaaabaabbbacbcbbbcbbbbaaa###a######aa##a#baaagkecdeegfeehfcbba##aaaaaaaaccdcbaccbaaaa#aaa##aaa#########a##a###aaabcaaaadeddbbdcdeigfdbcccbaa##cbabcbcdaaa####aaa######.######aa#debaacfdcaa#####aaaabaa########a##aabccdd#############aaaaaaa###aaaaaaaaaaaaaa###aaaaaa#########aa",
-"#############aabbbcbbccbaaaabbccddeedca#abaaa#aa###a##.##aaaa#######aaaca############aaaaaabaabaaaaaa##a#aaaaabbaaaaabbbabbbcbbccbccbaba##########a##aaabaabejfddddehddhgdbbba##aaaaabbbcccaabaaaaa#a#a##a#aaa###############aabcaaaaaegeddcecacdghfdccbaaa#cbabcbac#######bba#################bcdcbeebaaa###aaaa#aa#a###a####abaabdcdcba#a##a####aa###aaaaa##aaaa#aaaaaaaaaaa#aaa##aa#########a",
-"aca##########a#aaabdbcccbaaaabbccddeedbaaaaaa#aa#########abca#######a#aca############aaaaaaaaaaaaaaaaaaaaaaaaabbabaabbbbbabbbcbbbbcabbbba##########aa###aabbbeidbbccehefhhcbbaaa#aaabbaaabbcaaa#abcaaaaaaaaaaaaa#####.########aaabaacbedfdbbbdccccfhebaabaaa##a#acaba######daa###.######a####aa##acfdfdaa####aaaaaaaa###aca#aaaabaabccdeaaa###aa#aaaa##a#aaaaaa#abaaaaaaaabaaa##############.aab",
-"aa#bb#####.######aaabcccbbaaaabbbcddeebaaaa########.#####abca##########abaa####a#####aaaaaaaaaaaaaa#aaaaaaaaabcbbaaaaaaaabbbbbbbbbccabbaa#a#########a#####aaaachdbccdefehgiebbbaaaaabaaabccacbaaaacbaaaaaaa#aaaaaa#############a#baaaaceddbaabcbebbefdcaaaaa###ba#baa#####.aba##############a#a##aacfghdcaaaa#abaaaaaa######acbababbbdbaa###aaa#aaaa#a#aa#aa#aa##abaaaaaaabaaaaa##############ba",
-"a#aa#a#####.###a#aaabbcccbbbaabbbccccge#aa#######.#######abbba#######aaabbaa####bba###aaaaaaaaaaaaa#######aaaaabbbbabaabbaabbbbcbbbcbabbbaaa#a##a##########aaaabeccccddfgefhgaccaa#abbabbbbabbbba#aa#aaaaaaaaaaaaa#######a#####aaaaaabacdccabbbcecaacdfecbbaaaa#aaabaaa#####aa########aaab####a###aabeggbaaaaaaaaaaaaa#a##a###aaaabcccccaa###aaaaaaa#aa#aaaaaaaa#abaaaabaaaaaaa#a###########a#aa",
-"###aaaa###a######aaaacccbbbbbbbabccccehb#a########..#####abbca#######aaaacaa####cca###aaaaaaaaaaaaa#######aaaabaaaacdbaaabbbbbbbaabbbbcbccaa############a#aaaaabaccbdccegeccffbbaa######.#abaabbbaaaaaaaa#aaa#aaaaaaa#a##########aaaabbcc#abbabaabaddcbceebbba#aaaaaba######a############aba###a##aaaccggbaaaaaaabaaaaabaaaaa#a#bbabbccdb#aa###aa#aa#aaa#a#aaabaaaaab###abbabaaa###a#a########aa",
-"###aa#a######.######aacccbbbbbabbbccccfheaaaa#############bbcaa#######aaabcaa#####aa####aaaaaabaaaaa#aaa##aaabaaaaaacdcbaabcbbcbbbabbaabbbbca#a######aaa##a##a#aaacabccdeggacge.#aa####a#baaaabbabaaaaababbaaaaaaaaaaaa#########aaaaaaabda#aaabbbacbcdbbcdeca#a#aaaaa#a#aa#aa#############aa#####a#aaabcfgcabaaaaabaaaa#aaa#####babbbcccc##aa#a#aa#aaaa###aa#aaaaaaaaaaa#aabbaaaa###a#a#####abba",
-"###aa##aa##########a#acbcccbbbbbbbbbcceffebaa#############accbaaa######a#bdcaaa####aa##aaaaaaaaabaaaaaaaa#abbbaaaababcddccbcccccbaabaaabbbbbca####a######aaaaa##a##bbabcbdgefeed########a#a###ab#aabbbaaaaaaaaaaabaaabba#####a#.#a##aaaabca##abbbaccbbdcbcdedb#aaaaabaaa###aaa#########aa#aaaaaaaaaaaaabceecc##aaaaaa#a#aa########abbacccc##aaa#aa##aaaa###aabaaaaabaaaaaaabaaaa####aa#####a#a#a",
-"b###aaaaa#######.##a##abbdcbaabbbbaabccdegea########a#####abcbba###aa####acccaa######a#####aaaacbbbabbccbbaaccaaaaabbbcccbcbccbbaaaababaaaaabc###a#aa#####a#aa#a#aabdaaacbbafhgbfa.#####aaaaaaaaa#aabaaaaaaaaaaaabbbaaba###a###########baba##aaaabacaabccbccdeeaaaa#aaab####.########.##aabbbaaaaaaaaaaabccaccba##abbaa###a##a###a#aabbccca#aaa#a#abaaaaaaaaacaaaa#aaaabbaaaaa#aaaa#a#######a##a",
-"baabaa#######aaa#####aabbccbbaaabbaaabccdfeba#######aaa###abcabbaa##aaa####ddbaa######a###aaaaaaaaaabbcbbbbbccaaaaaabbbbbcccccbbbaaaaaaaaaa#abca##a#aaaaaa##aaaaaaabcaaaabaabgicce##.#a##aa#a#aaaaabaccbaabaaaaaaaaabbbaaa#aabb##########aa#aaaaaaaaaaabccccddfebaaaaabbaa################bbbbbbaaaaaaaabbbc##acbbaaaaaa####a#####aabbbcccb###aaaaaabbaaaa#a##aa####aba#bbaaaaaaabaaa#######a##a",
-"baaaaa#######aa#######aabccbabaabbbaabbbcdgdb#a########a##abdbbaaaa##aaa##abdcbaa#############aaaabbbbbbbbbabccaaaaaaaacbbbcccbccccbbaaaaaaaabbca#aaa#a#aaaaaacbabaa#aaaaaccbbjgabc###bb######abaaabbcccbabbbaaaaaaaaaaaaa##aaaaaa#######aa###aabcbaaaabbbccdeeefebaccbbbbb#.####a####.###abaabbbbbcbaa#aaabca.##acccbaaaa########aaababbcba##abaaaaaaaaaaaaaaaa#aaa#baaababa#bbaaaaaaa#######aa",
-"aa##aaa###############a#abcbabbaaaabaabbbcffcaa##aa##aaaa#abbbbaaaaaaa##a##abdbaa##############aaaaabbaacbabbbcaaaaaaaabbbaaabacbccbbbaaa#aaa#aabb#aaaaaaaaaaabbbbaaaa##aabbbadiabbc.##c#######aaaaaabbccbbabbaaababaaaaaaaaaa##aa#######a#####aabbaaaabcbbbcddcefhgceeaabba##############abbbbbbcbaa###.###aca####aacdba#a#a######aaaabbcbbaa##aaaaaaaaaaaa#aaaaaaaaaaaaaa#bababaaaabaaaaaaa#ab",
-"cb####aa################abcbbbaaaaabbaabbbdgdb##a#aa#aaaaa#abaabaaa#bba####aaddba#######a#########a#abbaaccccccbaaaaabaabccbbabaabcbbbbaaa#aa###acda####aaaabaaabbcbbaaaaa#bcbcebbccd#.aba######aaa#a#acbaaabbbbbaaabbdbbca##ba###abc.#.####.##a#bbaaaaaaccccdecdefghgfccccb#.####.#...###aaaabbabddba###...##bb#####a#bcba##########aaabbccaa###aaaaaaaaaaaaa##a#aa#aaaaaaaa##ababbaabaaaaaaaab",
-"ec##########a##aa#.#####abbcbbaaa#aa#ababccfffcaaa#aabaaaaaabbaaaaa#aba###aabbfdaa###.#############a#aaabbccbbccaabbaabbbbbbbbabaaabbbbbaaa#a###aacdba##aa#abbacbbcbbbaabaaabbceabccde.#c#aa######aaa#aaa#aaababbabaabbdefecd#aaaaaaec#.#########aaaaaa#aacdcbdbabdfegddffdba##.#.###.###aabbbbabbccbba###.#.##bc#######abbba########aaabbbddcaa##aaa##aaaaaaaaaa#aaa#aaaa#aaaaaababaabbaaaa##ab",
-"bca######.#####aa#######abbbbac#a##aa##abcdcehfaaaabbbaa#abcbbbaaa#aaba#####acegdaa####.############aaaaabbbbccccbabababcbbbbbaabbcbbabaa##aaa###aacebba###bffcdbcbbcbbcaaaabbbhbabbcee.##aa##aaa#acaabbaaaaaaabccaaaaaabdefge##aaaacea###########a######abdfdabaaaaababaceeb###.#...#.##aaabbbabbbaabaaa###..##bea###a##a#aca#a#a#####aaababb####aaaa##aaaaaaaaaaaabaaaaa#aaaaaababaaaaaaa###ab",
-".#a###########.b########aacaaaacaaaaaaa##acdffgbaaabaaa##aaehdbaaaa#aaaa#####acfgbaa#########.########aaaabbabcdecbaabbabbbbbbbaaababaaaa######a##aaddbaaaaab##a##abccccccbbaabfhaababgd.######aa#aaaaaaaaaaaaabacdddbaaaaaaddeda#aa#ba######..##a########abdcaaaaababcabbbcddb#a###..#.##aaabccbbaaaaa#########abed#########cb#a#a####a#aaaaacb###a#aaa##aaaaaaaaaaaabaa#aaaaabaaaababaaa######",
-"#########aaa###a########abbaaaaaaa#a#aaaaaacdegeaabaaccbaa#acefcaa###aabba###aadfdbbaa####.#############ababaaabcccaaaaabbbbbbbabaaabbbbaaa#####aaaabdeaabbba########aabdedcbabbffaababhd########a#aaaaaaaaaaaaaaacedbabaaba#bfggcaaa#########..#.########aabcb#aaaaaabaababccddba#..##.####aaabbaaaaaa##...#####acecb########abba#aa#a#aaaaabbca##aa#aa#aabbaaaaaaaaaaaaaaaaaaabaaaaaabaaa#aa##",
-"##########aa###a#####aaaaaaa##aaaacc#a###aabbcefbabbcfcddddbabgfa#a#aaaadbaa##abdedcaaaaaa#############a#aaaabbbbaacbbabbaabbaaababbaabababa##a##aaaaaccbbbb########.###abbacdcccgbabbbcida####aa#a#baaaaaaaa##aaabccaaaaaacbbabggb#a#####aa##..##aa######aabbcbaaaaaaaba#aabbcccca#.########aaaaaaaaa###...#######abdec########abb#aaaaaaaaaaabcbaaa#####aabbbb#aaaaaa#abba#aaaaaabaaaaaaaaabb#",
-"###########aaaaba###aaaaaa####aaabdebca###aabbcfgfbacdccdeheaadgea###a##dcabaaaabdedcbaa##################aaaaabbbccbaabcbaabbbbabbabbbaaabaa#####aa#abddbcb##a########a##.##accdeedbcccejcbaa####aaaaaa#a#aaaa###aabbbbaa#bdbb#chfa####a########.###########babbaaaaaabaa#aaaaabbcdc#..######aa#aaaaaa###.#..#####a#abdeba#######bbbbaaa#aaaaaabcca#aaaa#aaaabbbaabaaaaaaaba#aa#bbaabbaaaa#####",
-"######a##a###a#aaaaa#aabaaa##aaacddbbcaa##aaaabdifdadeeddfffaabdddbaaaaabd#aaaaaacfedcaa#################aa###aaaacccbbabbbbaaabbbbbbbbbaaaaa######a#aaacdddaaa#########a######aabbicceedghcbb##aa#aaaaaa#aaa#a####aaabbaa#adffbafgd####aa###################aaaaaaaaaaaaa#ababaaabbbcb#.####aaaa#a#a#a##..########a#aabbcdd#.###a##bbaaaaaaaaabbbbba######aaaacbb#abaaabaa#a#aaaabaabbbabaa####",
-"######aaaaa####aaaaba#abaaa###a#bddccaaa######abcfgghhhfdfffcacbabdecca#bca#aba##aeffeba##############.########aaaaccbbbabcbbbaaaababbbbbbbaaaa######aaaabeeaa#aaa######a###a#aaaabfgdbbddhhccb###aaaaaabaaa###aa##aaaaaaaa#bffgd#cda##a#a######a#a###########aaaa#aaaaabb#abaaaa#aaaabbca####aa#aaaa####.#############aaabcdc#####a#abba###aaabababc#aaa##aaabcaaaaabaaaaaaacaaaabaabbbbbaaa###",
-"a######aaaa##a#aabbaaaaacba##a##acccddbaa#a##aaaaacccdefefefdacaaaacgebcdb#a##aacbbegfdba#aba##############aa###aaabcdbccbbabcbbbbbbbaabbabaaa###a###aaaabcdb#baa#a###########aaabddgcdcbbcfidbcb#aaaaabaaa#a#a#abaa###a#aa##dfffeaa#####a#####aa##b.######.###aaaaaaaaaacbacaabaaaa#aaaacccaa####################a########abceca###aa#abaa#aaabaaaacda#aa###aacaaaaaabaaa#aaabaaaacbbbbacaaaaaa",
-"aa##a###aaaa#a##aaaaabbbbbbba####bbbacbaaaa##aaaaaabccbdedcefaccaaa#accccaa##aaabcddfgefeeffea################aaaaaabbcbcbbcbabbbaabbaacaaaa#a#######a#aaaacfcaaa##a############aacdee#a####eifccc#aaa#ccaa###aaa#ba###a###a#befffd######aaab###aa############aaaaaaaaaabbcbcdbbaa###abbaaabccdca...#######aa#a####a######aaaabcdc######aaaaaaaaaaabbcdbaaa##aababaa##aabaaaaaabaa#abbbbaaba#aaa",
-"#aaaaa##a#.###a#aaaaaceccbbbab##aaaaaaaaaba#aaaa#aaabccbcdddgfdaaaa######aa##a#aaaeggihgeefeddeca###############aaaaababcbbbbaabaaaaabacbaaa##a#####ba#aaabadgeaa#a##a####a##a##aabbeeaa#####bhibaca##aadbaaaaaca###########aadfddfda###abaabb#aaba#####a######baa#aaaa#abdc#bccbaaaa###ba#aaabdfeec#########aa#aaaa####aa#aaaaabde###a###aaaaba#aaaabbccbaaaaaaaaaa#a#aaabaaabbaaaababbbbaabaaa",
-"##aa####a#####aaaaabcccbbbcbbaa##aaaaaaaaabb#baa##aaabbcccdefgiecbaaa##aabba###a#affghihfccdddddeca################aaabaaaabaaaaaaaaa#aaaabaa########aaaabaabcgcaaaadda#aa#######aacdde#######aegbbdbaa#adbbaabcaa#aa#########acfeeecaaaaaaaabbaaaba###########aaaaaaaaabddfbaaababaaaaaaa##aba#acefgca###aa#####abb######aaaaaaabcfa##a###aaaabdaaaabbbbdb###aa#aaaaaaaaaabcbbbbbbabaabbbbbbaa#",
-"####aaaa#a#####aaabccccbaabcbcca##aaababbabbabaaaaaabcccbacddefffdccabccdedaaaabdeeffgggeccddccdcdca#a##############aaacaaaabaabaaaaaaaaaaaaaaaa###aa###aaaaacdgcaaabaaa#######a##abdchaa######.cfcbcb#a.bffcbbbab###aaaa###a###ceedddabcbaaaabbabbaaaa##..#####aa##aaaa#acecbbcbaaaaabaaaa##aba#aecbccdcabaaa##abbaa#a##aaaa##aaaabdd##aa##aaa#aaababbbbbdb#a##aabaaaaaaaaaaaaabbbbbbcbbbbcbbaa",
-"aaabaaaa####aaaacccbbcbbbaaaabdaaaaabcaabcbbbbbaa##abcddcbcdefedffedbdccdeec#aafffdddeffcccbcdcccccccaa#############aaaab##aacaaaaaaaaaaaaaaaaaaa###aba#aaababdefaaaaaaa##a###aaaaabccgcaa#######bgcdeca##bhgbabaac##a#aaa##a###befddfdddbddbaacabbbbaa####.#######a#aaaaaacbaabbbaa##ababa##aa##acaaaabbcb#aa#a#aaa##aa#####a#a#aaaabeca#aaaaaaaaabaabbbbbdb#aaa#abaaaaaaaaaaaaaaaaaabcbaababaa",
-"aaaaaa#aa#####abbbcbbabcccbbaaabbccccdbabccbbbbbaaabbcddcbceeeddeggddfbcdeec###dffedddeddcccedccccbbcdb#################aa#aaabaaaa#baabaaa#aaa######aaaaaaaabbcdfaaaaaaa#a####a#aaaabge##########bhcbccaabdeeaaaa###a###aaaaaabceedefeeedeeccabbabcbbaaaaa##.#.#######aaaabbb#aaaaaaaaaabaa##a##aaa#acbcabca###aa####aa#########a##aaaedb#abaaaaaaabbabababccb#aaaaba#aaaaaaaaaaaaaaaaabbbbbaaa",
-"aaabaaaaaa###aaabbbbbaaaacbbbbbcccddefdaabbbbccbbbbabbccbcdddddeeeffefcedffedbabeeecddcbcccbdbbbabbbabba#aaaaa##a######aa#a##aaaaa#a##aaaaaaaaa###aa##aa###aaabbdedaaaaab#a####aaaaabbgha#a########becaccdfgddda#aa#aaaabaaa#a#addeecdcdfeeeddcacbbbcbbaaaaaa###########aabacbaaaaabaaba#baba#aa##bbbdbacaabcb##aaaaaaaaaa#########a#aaabddbaaaaababbbbbaaabcccbabaaaabaaaaaaaaaabaaabaaaabbbbaa",
-"abbabbaaaaaaaaaaaabbabaaaaabbcbbcdedfggccbaaabbbbccccbccddeddccdddcddecddeffddecddccacbaacbbbbaabaabaaaaaaaaaaaaaba####a###ba#ba#aa#####aa#aaaaa############aabbcdebbbaaaa########ababdhf#a#########afecfffebceaa###aaa#aaaaa##abeeddddeegffdcfdbbabcccbaaaaba###########aaaabaaaabbaaabbbaabbaaaaacdcaacaaaabca##aaa#aa#aa#aa#######aaaaacee#bbaababbbbbbbbbccdcaaaabbaaaabbbaaaaaaaaaabaaaaaab",
-"babbaaabaaa#aaa#aaaaaaaaaaaabbbbcdbadccdbbbaabbbbbcbbccdeeedeabcccccccccdeedfddcccdbcbaaaaaaabbbaaaaaaaaaccaaa#aa##aaaabbaab#a####aa####aa##aaa###############abcdedbcba#####aaaa#aabbdhie.#####a#####fgffececeda###aaa#aaaaaa#cddecddcddefeegefeccbccccbaa##aaa#.#####.##aaaabaa#aaaaa#aab#bcccbbccbbaab#aaaabcbbaa#aaaa#a#a######aaa##aaabdfdbbbbabbbbbbbbbbccccaaaaaaaaaaabbbbbaaaaaaaaaaba#b",
-"bbaaabbaaaaaaaaaaabaabbbaaaabbabcedcbbabccaaaaabbbaabbceffcccbbcbbbbbbbbddcdddbbbabbbbaa####aaabaaaaa##aacfeaa######a##aaabbbaaa##aa#a#####bcca#a##aab##aaa#aaaacccgdbbb#######aaaaabbbdhhb###########aeifddbbceda#aaa##aaabaabefffcdddccdeeeedeffefeddccbaa##aaa###.###..aa##aba##aaa#aaabaaabccddcccaabaababaabcca###aa#aaaaa####aa#####aaacffbbbbbbbbbbbbbbbbcdcaaaabbaaaaaabbaacbaaaaaabbbab",
-"babbbabbaaaaaaaaaaaaabbbaaaaabbbceddcbaaabbbbbaaaaaaabcdffdcabbccbbaaaabbbbbbbbaaaaaabaaa#a##aaaaaaa####aadd######a########abbaaaa##a#####a#aa########aaaaaa#aabbbbdgcaaa###aa##aaaaabadfgb######aa###aadidcdbaceca#aaaaaa#abcdeeeccdeddccddeadeefffffffecbaba#######.###.##aa#abaaaaaaaaabcaaabaabcbd#abaabbbbaaabdba#a#a##a###aaaa#########aacefdbbbbbbbbbbbbcbcccaaaabaaabbaabaaccaaabbaabbaa",
-"baababbbbabaaaa#a##aaabbbaaaaabccehdbaaaaaaabbaaaa##aabdgieccccbcbaaaaabaaaaaaaaaabaaaaaaaaabaaaaa###a###aaa################aaaaaacba######a#a##########aaaa#abbbbbcdhb##a####aaaaaaaacbfe.##aaaaa#####aadhcbbaaefbdb##aaccddfgedbddccccbbcdedceceggfeefefdcbaaaa#####.###.###aaaaaaaaa##aba#aaaaababdb#aa#aaabaa###bcbaa#######aa#############abdffcabbbabbcbbcbcbcdcbbaaabbbbbbbaacabaaaaaaaaa",
-"bbbbabbbbbbbaaaaabdcabdcaaaaaabbcdffcbaabaaabbbaaaaa##bcgjfbbbcdddcbbbbbbbbbaaabaabbbaaaaaaaaaaaba#########a#a###############aaaaaabaa#######a######aa#a##aaaabcbabbcceda#aaaaaaaaaaabbbec.a#aaaaaaa####aadhcabbbeecbaaadefggfeddcddcccccbccdccdddeghggeeeddcbaaaaa############abbaabaa#aaaaaaaaba#ba#aaaa#abaaaaa##aabbb###aa#a#a##a##########abbcffdcabbcbbbcccbbccccbaaaaaabbbbaabbabaaaaabba",
-"bbbbbbbbbbbbbbaaabfdcccbcbaaaaacdceebaa####aaabbbbaa##bdghfcbaaacdddccccccccccbbababbbaaaaaaabbbaa#a##aa#a#b##a#aa###a#######abaa###aaaa##a################aaaaabbbcbbcffaaa#cbaaaaaaaacec.#####aadea##a#aabgdababdfda#adfggeddccccbbbaccbbcbcddddgghigffffbabbaaaa##########ab#aaaaaaaaaaaaa####aaaabaaaaaaaaaa####a##aaca##a######a#########acbbbbcdefdabbaabccbbbbccccbcbaaabbbaaaababaaaabcc",
-"bcbbbbbbbbbcbbbbbcecccbaccedaaabddcaaa#######aabcbbbaabdfhfdcaa###acdcabdfeeedcccccbbcbbaaaaaaacbaa###aaaa#aaa#####a#aa##aa###ba###aaaaaaaba############aa#aaaaaaaaaabbbfgaa#adbaaa#aaaaehaa###aa#adea#a#aaabgbabacefdb#dfffedccbbaaaaaaccbbcdecdggihihhfdffcbbaaaa###aa###..#aa####baaabaaaaaa#####aaaaaaaa#aba#a###abaa#cbaa##.##aa####aa##aa#baaaacccefdbbabbcccbbbdccdbaabbbbbbbaaabbaaaaabc",
-"cabaabbbbbbcbcccccddb##abaccbabbdbcaa#a##a####aabdcdbbcdddghcbaaa####bcacigggecbbbcbcbbabcaaaaaabaaa#a##abb#########a##aaaaaaaaaa###aaaaaaa########aa##aaaa#####aaaaa#acegfaaa#aac##aaaachfc###aa###aabb###a#bbabccddefdceffedbcaaaaa#aaabbbbcdegihhhhgggdcffecabaaaa##a##.###abca#aaa##aaaaaaaa######a###b###baa####aaaaaaaaabca###############aaaabbbbbbdfebbabcccbcdcbbdcbbaababbabaabaaaabbb",
-"febaaaabbbbcdcccccb#####abbabbcccbbaaa####aa#a#abdeccbddeeehgcaa#a#aa#addhifdddbbccbcccbbbbaaaaaababaaa#aaba####a##a#a##aaaa#aaaaa#a##baaaaaaa#####b###aaaaaa##a##aaaabcefihefc##aaaaaabbdha####aaaa#ab######aaaabbccdefegffdcccaa#a##aaaaaabbehhhhffffcddbdcdbbba#ac######..###bb###a#abaaaaaabba#####aaa######a#aa#####a#####bbca###########a##aaabbbaaaabdfdbaccbccbcbbccdcbbbbaaaabaaaaaaabb",
-"dedbbbbbbccbcdccddb#####bbbaacccacbaaaa###aaaaaaacfdcbcdegghigbaa#aaaaaadfhgedcccccbbbbbbbbbbbbbbbbaaaaaabbba########aa#aaaa#abaaa####aaaaaa############aaaaaaa###aaaabcfghgihfbcb#abaaabbge####aaaaab######a#aaaaaaccdeeddfdbcbaaa##a##aabaafhgggfedccccdccbaaabaaaaaa#########a#####a##aabaabcaa#aaa#a#####.####a###########a#aaaba##a####a#aba#aaaabbaaaaabdeecccbbcbbccccdcbabaaabbbaaaabbba",
-"bccdcbbbcccccbcdfda#####acbabcbaabaaa#a###aa#aabbbefedcdffiihhcaaaaaaaabacfffefedcbbbbbaaaabbbbbbbbcaaaaaabaaa####a###a##aaaaaaaaba#####aabaa###########a#a####a###baabccghfhiieaa##aaaaabdga##a#a#aaaa######aabbaaabbbcddegdcbbaa##aaaaaaabbfedfddecbbbbbbaabbabbaaaaaaaaaa####aa####a#a#aaaabcbaaaaaaaa##############.######a#a#aabbba#a####a#aaaabaaabaaabbabcfedcbbbcbccccccbabbabaaaaabbccb",
-"bbccccbbcccccdddeca####aabbccca##aaaa##a#####abbbbeeffeeccfjjifbaabaaabbbcdecdeffdbcbbbaabbbccccbbdcbaaaaa###########a#a#aaaaaba#a######aaabcaaabaa###aa#aaa######acedbcdfihfhifba####aaaadhc###aaa###########a#bbaaabbccccfecaaacca##aaaaaccffdfccedbbab#a#aaaabbaaabababaa###########aaa###bbaa#aaa#abaa##########.########aa####a#aabba#a###a###aaaaabaabaaabbbcdfedbcccbcccccabbbbbbabbbbbbc",
-"bcdcbbcccccddddddba####abbbbdca#a###a###aa####aaabcededcbbgiijjhcabbaaaaaccddddcceedddddddeeefedbbcbcccbbbbaaa#a###aaaaa###aaaacaaa##a###a##acca############acaaaaa#abbccdghccggfcaba#aaaacggdaaa###############abbbaabbdeefedbaaaadda##aabbchedeefedbaaab#####aabbaabacbabaaaa########aa#a###aa####aaabba##a##.#############a#a####aaa##abdba#########aabbaabbabbaabdeddcbbbcccccbbbbaabbbccbba",
-"bbddccbccdccdcebcbb#####abccbcd######aa##a######abcddcdddeggiihhhdaaaabcccceedccbbcbbccbccdeeeggfeddccdeccbbaaaaaaa#a##aaa###aaaba#a##aa######a#####a######aaaaaaabaaababcehb#adcbdbba#aaabdceaa#################abbbbbacgeeecca###bedcaa#adfhccdffbbbba###a####aaaaabbbbaaaba###aaaa##########aa#.##aaaaa#aa#b######a#######aaaa##aaaa###abcdb######a#aabcbaabaabbaaabcdedbbbcddcbbbbcabbbccbbb",
-"bcdfdddcccdddcecbb####a#aabccabaa#####aaaaa#####abbccdedeedcijfggfabaabbbbccddccbbbabaaaaaaaaabbbgihihffedccbbbbbbbba#a#aa####aaaaaaa##aa#######a###aaaa########abaabbbbaccega#cdaaabaaaaabbfea#a#################abbbbbaeedddcbaaabacceccefihdccedcbaa##########aaaaaaabbbaaaa#####aaa##a############aa####aaaa######a#####aa##a##aaa###aaa#a#abc#aa###aabcaaaabbbbbbbbbbcddcbccddcbbbbabcccdcc",
-"ccbcffhfdddddccadbaa#####aabbaaba##########a##aaabbaacdddfeehjifgha#aabcbacddccbbbbbabbaaa#aabcccefgdddeffeecdedbbbbcba###aa####a##aaaaa##a###aa###aba#aa######a#aaabbba#abbfcbcccccbaaa#abbfjg#aa###########aaabbaaabbcbdedcdbbaaabbbcceghhiiedcedbbaa######a###aaaa#abaaaaaaaa##aaa##a##############aa####aaaaa#####ab#####aa##a###aa#aa#a#####aaaa##aaaaabbbbabbbbbbbbbbbbdddccddccbcbbbcccdd",
-"eecbdggfdddedcacda####a###abbaaca######aa##aaa#aabcababcdeeedgigdfgbbcbbbbbcccbbbbbaaaaaaaaaccddddefdecccbbcbbddcbccddedcaaa#a#aa##########a########adbaa#########aabbbcbcabbdcdcbbbcbaa##abbfiaaa##############baaabbbbccedcccbaa#abbbbbefgihfdcccbaaaa###a######aaba#abaaaaaabaa#aaaaaa######...#a#.#####aa#aaaa########a##aaa###a###aa#aa#aaaa#aabbabaaaaabcbbbbbbbbbbbbbbbccdeddcccbdccccdde",
-"eedfhhfcba#abb##a#####a#aabcaaccbc#####a#aa#aa###ccbbbabcdfffhgifehfebbbabbcccbbbbbbbbaaaa#ccdcddfghfeccccbbbbabcddegcbccdcaaaaaa###a###a######a#a##accba#########aaaabbccbbcbcehb###cbba##bdehe###############aa##aabbbccdcbccba##aacccbcceffedcbbaaa#####a######aaba##aaaa#ababcbbbbcbaa########.#.##a####a####aa######aaa###aa####a###a##a#aaa####aaadbbaaacccbbbbbbccbcbcccbcceeeeededcdbccd",
-"dgghigdb##a#a########baaa#abbcbdbbb#####aa#aaaaaaabaababcdegiihdggffdcbaabbbbabbbbbabaaaaa#ccdccdegedccbbbbbbcbbbbaadbabaacdb###aa###############aaaab#aa##a#######aaaaababbbabbfieaaaa#aaa#chke.#########..#aaaaaaaaababbccbbcbaa#aabbcbabcdeedcba###a#####a#a##.###baabbaaaaaaaabbaaba#########....#.#######ab#a#######a######a#########a##aabba###aaabbbbbbacdcbbbbcbcccccbdddeededegeddddcdc",
-"dhghhfa##a######a######aabaacccedaaa#######aaaaaaaababbbccdghgfedgfgcabaaaaaaabababaabaaaaabdcceeeecdbbbababbbbccbbbbbabdbabcba#a############aa##aaaaab#aa###########aababcbbaabeggh######aaagj##############aa#####abbaabbbbbabbbabcabbaaaabcddccba#######.###########ccaaa###aa##aaaa###a###..##....#.aa##a############aaa#####a#####a###aaa#aaaa#aaacaabbbbbbeccccbbccddccdegghhgfeegd#bddccc",
-"ffhhhe###########a#####b#bcadddcbaaaa#####abcca#aaaaaaaaabdhihgddfgfgcaaaaaaabbbabbbaabaaaabedcefecbbbbbbabbbaaabbacdca#aaa#bbdb#aaa#########aa####aa#a###a#####.###aaaaadbbaabaddcggbaaaa#bbdia#a##########aaa###aaabaaaabbbbbbaacefebaa#aaaabcccbaaaa###########.#.##ad#####.##aaa#aa#aa#####...#...###ab#ba######a###a##ab#####a###aaa##aa#aaaaaaaabbbbbbbbbbceddeeccbccccddfhijjhggghb#bba##",
-"#afhgcaa###########a#a##aabcddca###aa######abbbabaaaaabaaaeiiihgbbgeddaaaaaaaaabbaabbbaaaaabdcccddddccabbbbacaaaaabbbaaabaa##acdd###a######..a#a#####a#aa##a########a##aaecb#abbbcccfgaaaaaaaeia#a#a##############aabbaaaababbababdgeca####aaaaabcbbba#####a####.#######da##############aaaa#######.##.#.#ba########.#a#aa##abba##aa#aa#aa###aaaaaaaaaabbbbbcbccccefgeeccbccbbbbdfiihgggeb#aaaa#",
-"##bhgd###############ab#ababcdd###aaaa####aaaaaaaaababaaaadhhigebabfddcaaaaaaaaaaaabaaaaaaabcbbbcbbcecbbbabbbaaaabbaaaaaba###abadea#########.#a##########aa#a###a###a####aabbabbaadccghbbbaaabfi#a##a###aa####a##a#aaabaaaaaaaabbacfdba##a#aaa#aaaabbb######a######.##a#######aa#a##a#a####aa#####a#.#a####aa#########aaaaa##aaa###aa#aaaaa#aaaaabaaaabcbbbbccccceeceeeefedddcbbceeffhgfebaa####",
-"##.dhdb#########ab###bdababaddc######a###.#a######aabacaaaadghfdbbabecdba###aaa#aaaaccabaaacababbbbbbbcbcbbcbaaaaababaaaba####abbcfbaa#aaa###.###ab#####aaaa##a######aa#ba#aabbbabdcabefbcaababhe#a##aa##aa###a#####aabba#aaaaabbbefcba###aaaa#aaaaaaaa#########a#.##############aa#bb#aaa##a####.###########aaaaa#######aaaa###a####a##aabaabaaaaaaaaaabbbcccddebbbbdedefdcccccbceeghgfdaaba#aa",
-"aa#aeea##########c####ba###aca#####aba#############abcabaa#acdefccbacdbdc##aaaaa###aabdbaaabbcccbbbbbbbccbabcabaabbabbaaaaa###addbcdba#a################a####aaaa#aaaaaaaa#aaacbabdcbbbehca#abbeh#aa######aa######aa#aacfbaaaaaabbdgdbaa###aaaa#aaaa########.###aa#a.###########aaa#bbaaaaaa####a#.##.#######aba#####a#############a#aaaaabbba#bbbbaaaaabbcddddddbaabcedccbaadfdcceeggdbaaaaaaa#",
-"aa##ada#a########aaaa###a###a######abaa#########aa#abbbaaaabbcddeeebcdbabb#aaaaaa####aaaabcccbccbaabbbabccbaaaaaaaabbaaaaaaa##aabcccfeb##############a####ab#aaa##aaabbaacababaaaabcdbccffc##abeh.##aa###a#########aaaaacbabaaaccddfgdbaaa##aaaaaaa#######.##.#######.#########aaabaab########a#a##.#########aaa#####aa##a#aa###bdaaba#aa#aabaaaabbbabbbbcddefecbcbaabbdcbaabcecccefgcaaaaaaaaa#",
-"aaa#aaaa#aaaaa#####aaaaaa###########a#####a##ab#a##aacabaaabcccbdhedfdbbabc#aaaaaaaba##aaaeheaaaaaaabbbacddbbaaabbbaaaaaaabc#aa#a###cfgb#a#########aa###aaaccaaaaaaaacbabcdaacbaaabcddcccgfcaabeg.#a#aa#a###aaaa####aaaaabaaaaaaceefhfdbaa###aaaaaa########.####.###.####.####aa#abcbaaa####aaa#############aaaaaaaa#aaaa#ba#babffb#acb#aaaabaaabbccabbcccfgdaa##bcbbaaacbcbacebbbcddbbaaa#a####",
-"accccedaa#aa#aaa##a#aabda#################a#a#a##aaaabbbabbcccdcccfcfecbaaceca#aacdbcccba#ahgabaaaaababbbccccbaabbbbbbbaaabcb###aca#aabcc##a##########a###a#abaaa#aaabbddddbbbcbaaaaabcdddhecccg######ba#a##.#a###aaceca#cbaaaaacdefhgfcaaa#aaaabba#########..#####...#.#######aaabccbaaa####aa########.####abb##aa#aaa#a#ba#abbefba##bbbaaaaaabbccc#ccddeffcaaaa#baaaaabebbbbcbbbbcbbbbbaa##a##",
-"#abeeebaaa###aa###aa###aaa###################aa###a#aabbbbcddddccefegfcca#adhbaacccaaabcbcdecaaa##aaacabdabdcbaabbabbaaababbcb#aabb#aa##dea##aa#######aaa##a##aabaaaacacdfebbbbbbabccccfeddfgfed...#a##aa###########acdbabbb#aa#acddegfecbaaaaaaabaa#########...#####.#########a#abbbabba##aa#####.##....#####a##aaaaaaaa#baaaceeebaaaaeedbbbabbbccb#cedddcccbaaaaaaabaa#bebbbbbbbbbbbbbaaaa####",
-"##aadba#aa##a#######abbda################a#######aaaa#ababccdeeddffhhgccbaabefdbbaaa#aabcbbabca#aaaababbbbcccbaaacaabaaabaaaabbaaaab#aaaaefaaaaaaa#.###a#a#a######bbbaabccabbdcbabbcbcdbbaaaefeiiffa####a#######a##aaaaabbcba#baabdddefffdcaaaaaaaaaa##########...##############aabbbbbdabaaa###.....########aaaaaaaaaaaaabcccbdfebaaaaaacfdccbcddc##baabcbabaaaaaaaaabaaaedbcbcccccbbccbaaaaaaa",
-"a##aba#a####.######a##bgb#######a########aa#######aaa##aabbcceedddeghiebaaabccebaaaaaaaabaabaaabbaaabbaaabbbbbaaabbaaaaaaaaabbccbbcba#####cfebbabbbacaaaaaa#aaaa###acbbbbbbbbcbaabbbccbaaab#.aceffdfghfa#a####aa#aa##acbacbbbaaaaabcedcddedbaaabaaaaaa#######..#.################aabccccdbbb####.#..#..#.#..########aa#aaa#aaabdddbcababbbdeddedeeb####aaaaaa#ba#aababcbbbaeccbcbcbcbbbbaaaa###a",
-"ba#a#####a#############cb#########aa##a###a####ab#aabaaaabbbbedcdccehihcbbbbbbccaaa#a#aaaaabbaaaabbbcbbaaabbbccaaabbaaaaaaaaaabbbbacda####aaedbaaabddba#aaab###aa####aaddcceebabbbcbcdca#aaba#aaabaabfmka##aabaaaaaa#abbabbbbaaa#acccdddccedbbbbaaaaaaaa##a####.#.###############aabddcbbcaaa####.#......aa###aa####aaaa#aa##aacccccbbbabbcdedddea####a##aa#a#bccbccbcbbaaaadddccbbbbbbaa#aa####",
-"ab##aaaa######a##########aa###b##aaaaa##a#a#####ababbbaababbbccccdcdgjifbbabbcccca#aaaaaaaaacaaaaabcccbaaa#bbbcaaaaaaaaaaaaaaaaccbaabbaa#a#a#bcbbaa##a###aaba######aaaaaaddfhgccddddacacaaaaa#aaaaaaabhnk.aabbb##aa####aa#acaabb#aabccddeecccbbbabaa##aa###aa#######.######a###aaaabdddcdedda#########...#####aaaaaaaaa##a###aabcbbccbbbbcddeeefc##a####aaaaaacdccbbaababaaabccdccccbbbbaa#a####",
-"#####a#aaaaa###aaa######ba###aa#bba#aa#abca##bb#abaabbbbbbaabbbbdccceihgecbcdccbcd#ababa##aaabaaaaaabccbaabbddbbaa#aaaaaaaaaaaaaccbaaa#a######aabdcb##aaa##a#a#####aaaa##aabffebccddcb#aa#######aaaaaadlnd#aabbabaaaaa##aaaa####aaaabccdeedbb#aa##a###############.##..#.#####aaaaabccdeecdaa#####.########.###aaa#aa###aaaa#aaabcbccccbbccddeef##aaaaa####aaaccbaabaaaaaaaaba#bcddcbbbbbb#aaa#a",
-"abaa###aaaaa##a#a##a#############a#a#ababda#aaaaaaaabbaabbbbcbbbddbddgifhedbcccbbcc##aabbaa#aaaaaaabaabbbccccdebaa##aa#aaaaaaaaaabedaaaa##########becaaaaa#a#########aaa##abceffdccb##aa########a#abbabilk#a#a######ab#aa#aa#####aaabbcddedbaa#a######a#####################a#aaaaaabdddfgfc##########...a#a###aaa#a#aa##a###aaaabbbbbcbbbcceghfaaaaaaaabbabccbbbaaaaaaaa#abba#aacedcccbaaaaa#aa",
-"bbaa##aa#aaaa#aaaaaaaaa#aaa##########abaaaa#baaaaabbbbbabbbbccccddbddggghhfdbbcaabbbbbaabbaaaa#aaabbaaabbb#bbbaaa#####a#aaaaaaaaaabb##aa##########aabdcbabaaaa####aa###aa#abbcdhhcaba#baaa#######aaaaabhlmc#a#####aaaaa#a##abba#aabaaabcdgfbb################################aabbaabbccdhigca#########.########aaa########aa#a##aaabbbbccbccdgfha#caaa.##fedbbcbaaaaaaaaa#aaa###aaadecccbbaaaaaa",
-"#aa###aaa#a#aaabbbbbcbaa##a#######aaabaababaa#aaaaabbbbbaaababccdecdfhhiihgfdbccbbcbabaaaaaadca##abbaaaaaaa#bb##aaa####aa#aaa#aaaabbda.##########aaaabddcbbaa#a##aa#aaa##aaabbdecca#a#aa#a########aaaaaeili##a######abaa###aaaaaacfeaabddcdbaa##############################aaabbbbbbcdfgjieba####.#####aa#aa############aaaaa###aaabcbbcbbcefggcbbfeedbedbcbabbaaaaaaaaaaaaaaa#aaa#cdcddcbbaaaa",
-"aa#a###aa#a##a#aaaabbccaa#aaa########bacbaaaaaaaaaaaabcbbbbbbcedcdccfhfhkhggfdbbccbbabaabaabdda###aaa#aaaaaaacb#########aaaaaa#aaaabec##########aaaaaaabddcbaaaaaaaaaaaa##aabacbaaaba#####a##a######aaabgklbaaa#####aaaaaaaaaaabbbfdaacddeddcbaaa#########aaab##########a##aaaabbcbbbbeffhjifdcb#####.##acbb#aaaa###########aaaa#aaacbcbbcbcegfaccgghgffdcbbaabbbaaa#aaaaaaaaaba#aaaabeecccbaaaa",
-"aaaa########aaaabbabbbbcbbbaaaa#####.##aaaaaaaaaaaaabbbbaaaaadedcdccegijkifddebccbbccaabaaa##aa######aaaaaaba#aa#########aaaaaaaaa#bccda#######aaaaabbaaabddcba#aaaaaaaaaaaaabcdaaaaa##abaaa#a#a#a##aaaafhlg.aa#a#a###ba##b#acaabcdfaaaccdccedba##########adcbca#########a#aaabbcddccbdefggiigecb########aaaa#abba###########aaaaaa#bdbccbccef#abdeddeeddccba#bbbbbaaaaaaaaaaabcaaaaaa#eedccbbba",
-"aa#aaaaa###aaaaaaaaabbbbbbbbaaaa#######aabaaaaaaaaaabbaaaaabbbfeccccdfiljigcdeccccbccbccbbaaaa#######a#aa##aaa#####..#..#aaabaaaaaaabacb######aaaaaaabbaaaacddcbaaa##cbabaaaaabcbaaaaa###a##a####a##aababchl#.###a#####aaaaaa#aabbdeaaacbbbbdfdccbabb####a#ddbbbba##########abbbccdcccddefghhfcaaa######aab#abaaddaa########ab###aaaacccccdefd#dbgebcccdcaabbbaaaaaaababbbaaabacaaaaaba#eeddcbba",
-"aa#aaaaba#a#a##aaababbccbabbbbba########aa#a#aaaaaaaababbaaaaadcccaddfhkjigdcdecccbbcdcecbaaaa######aca####aa#####a#####.#aaaaa#aabababb######aaaaaabbabaaaaabcdcbaaaaaaaaaabbbcaaaa#a####aa####a#aaaaaababjh.####a#####aaa##aaaabdabaaaabbabdeeeddddcb#.##debaaabaaaba####aaabbccdcccddeffgfgcaa##aa###aaaaaccaddca########a#a###aaaccbbceffbaacgeaabbbbabaaaaaaaaaaabaaaabbcaaabaaaabbbccdedcb",
-"ba#a#aaaaa####aaaaaaaaaaccbcbbaa#######aaaa###aa##aaaaaaaabbbabbcbbefffhjihfcbfcbcbbbcfhgcaaa#####a#deaa##aaaa###############a##a###aaaaa###aaaabbaaaababbbbbbbbedcbaa#abbbbbcccaa##a######aa##aaa##abaa#aabja##.#######a#a###aaabecaaaaaaacccbcaaaabbdddefedcbaa###aaaa#aaaabbbcccccccddfggghdba####aababababcbbddba###a###a#aaa##aabbcccegfbaabcaaaaaaabbaaaaabbaabaacaabbbabbadbaaaaabba#aefc",
-"ba#a#aa#######aaaaaaabaabbebdbbb######aa####a###a####aaaabbaabcabcccddffjhfdbaefcdbbbbdjkjebaa#####bccb##baba#####aa######a###a#a####aaaaa##a##aabaaaaaaabbbbbbabefdbbcbbbcbbbcbaa####aa#######aaaaadaaaaabbdg###a#a####a#aa#aabccccaaaaaabcdbccaaaaabbdeeedcdcba###aa#aabaaabbbcbcccddddeffffdbaa####abccbb#bbccdbccaa###a#aaaa#a#aabbdcdfgdaaaccaaaaaa#aaaaababbaaabbbbbabbbbbcbcbaaaabaa###be",
-"fcb#############aa#aaaaaaadegdacbaa###aa####aaa#a####aaaabbaaabaabddccehieabaabecccbbbbbikkgca####acbb###baba#####aa####aaaaaaaa######aa###aaaaaaabaaaaaaaacbbbbbbeffedccbcddddbaaa##aaaa###a##aaa#adba#aaabbie.#.#aa##aaaaaaacecaaaba###a##aabdb#a#aaccccccccbbba###aaa###aaabbbbcccdddedegcddcbbaaaabbabbabbaabbaaddbaa#####aa##aaabbddefgcabagbaaaaaaaaaaaabbaaacabaaaaabbbbabbaaaaaaaaaaaa#a",
-"bdeba#########aaaaa###aaaaacfebbbbaa###aa#####aa########aaababaacbdeccehhbaaaaaddcbbbbbcgijhea####acb########a##aa#a##a#aaaaabaaaa####aaab###aaaaaaaaaababbccbbbbacbedffedcdeeaaaab#aaa#aa##a##aa#a###aa#aabackc.#.##aaaaaabdefb#a#aaaaa#a####abc####abcbbeecbbaaabb#aaaaaaaabbbbcbcdededdefdcaccbca##aaaa###aaaaabaaeccaaa###aaa#aaabcccdffbbacfc#a#a#aaaaaaabbaaaaeabcbbabbbbcbbabb#aaaaaaa#aa",
-"##aba######aaaaaaaa##a#aaa#fdaabbccb###################a#aaaabbabccccdehibabbbbcfdcbbbabgihc#a####abbaa##a###aa##a#aaaa##aaa##aaaaba###daaa###abcaaabaaabbbbbccbcbcdcdddggfedbcbaaaaa##a#####aaaa#aa#####abbbbdjb.a##aaaaabeecabba##aabda######aa####aaabbdcdcbaa#bcbbaaaaaaaabbbcccddedefffdcbccbab####a#####a#aaabaabeeba######aaacbcddegebbacccba##a#aaaaaaaaaaaaccbbbbbabaaa#aaabbaaaaaaaaaa",
-"aa##baa####aaabaaaaa#####aacaababbccbaa##################aaaaaaaabbccbegifaaaabbcecbbbbaadgb#####aeeabc#.######aa##aaaaa#aaaaa###abaa##edaaaa##aabbaaaabbbbbbbccbbdccccdddehhdabbaaaaaa##a###aaaabb######cebcbcgj#aa##abdfggcbbbaaaabdfea####aaaaa##aa###aaa#aaaa#aaabbaaaaaaaabbccddeeddeffeeeefcabaa#aa#####aa#aabbbacccbaaaaaaaabcccdegfbbbceaacb#####aaaaaaaaaaaacccabaaaaa#a#abbccaabbaaaa#",
-"#aaa#daaaaaaaabbbaaaa####abbaabaabcbbbbb##aa################aaaaabbbddehecacbaaaabecbbbbabaa#####adcca#########a#a##daaaaacaaaaaa###aa#aca#aa##aaaabbbaabccbbbbcddaccdeddecfhgcabaaa#ab#a####a####aaa#aaaabbbcbcijdchihgighedbcbbcdfdabbbbccaaaaaa###caa#aaaa#a#a##aaaaaaaaaaaaabcccdddddeeedeeeffbaaaaaa##aa###aaabbbabcdeabaaaabbbbcdegibabbfaabca####a#acca#aaaaaaababbbaaaa##aaababbaaabaaaa",
-"#####adcbbbaabbbaaaa#a#a#####aaaabbaaabcbaa#################aa#aaaaabddgeadbcaaaaabccbbbbba#####a#a##aaaaa###aa#aa#bccaabaac#aaa#####a#..#####aaaaaabcbaaabbbbcdccdcddedceefgfccbaaaaaa#aa###aa##accaaaaaaaabbbbdjkfdfgjjhgfeeeeeedcaabaabaaaaa#####ab#a#aaaa###a####aaaaaaaaaaabbccddccccdccdeeegfbcbcaaa#aaba#aaabdcbbbababbbaabbcccdghg#aadbaabbaa###a##acdaaa#a#aa#baaaaaaaaa#a#aaaccbaabaaa",
-"a##a#aaedbbcbabaaaa##a##aa####aaaababbaabacaaa###a#######a####aaaaaaaccehbbbbcbaaaaacdbbbcb#a#a#a#.####aaa##a#aaaaaaabaaaaab##aaaaaaaa#####aaa##aa##abbaaabbbccbccbcdcdcddeffcaabaaaabba#aa####a##bcbaaaabababbbbejib#abccdcbbccba##a##aaaa##a######a##aaaaa#a###a#####aaaaaaaaabbccccccccccccdeegfcdabbaaaaaaa#aaaabccbbbaccbabbbcddefedea#cd##a#aaab#aaa##bcb###aaa##abaaaa#####aaaaabbcbaabbb",
-"aa##aa#bhgccbbccbbaaaaa########aaaaabcbaaaabbaaaa###aa#####a#a#aaaabbbbcega##acbabababecccdabaa##########aaaaaaaaaaaaaabaaa####aaaaaaaa##.##abaaa#aaaaabbbbbbbbcdbbccddcdcegeaaaab#aaaaaaaaa####aabbabbcbbbcaaabbcegiaaaaaa##abbcbca##.###aaaaa####aaa##abbaa#aaaaa####aaaabbaaabbbbccccbcccdddedfddcaaaaaaaaaaaaabbccdbbbcecbbccdefged#a###fa######aaaaaaaabaa#######aab#aaaa#aa#aaaaaabcccabaa",
-"aa##aadafhhfeccbbbaa#aaa##a####a#aaaaaaaaaaaaaaaaabaaaabaa#aa###aaaaaabbcfd#a#acbaaaaabeecdcc#############abbaaaaaaaababbba###aaaaaaa#a#####aa#aaaaaa#aaaabbbabcccehgeecdegebaaaaaaaaa#aaa#aa###aaaaababccbbaa#aabceggaaaaaa#aaaabcb####a###aaba######a#a#####aaaaba#####aabbaaaabcbbbbcbbacceeddeebabdbabbaaaaaababcdccdccdcbbccefecb#####cc#########aaaaaaaaaa##ba#aaaaabbbbaaa#aaaaaabcccdgdb",
-"##aaacdggggghgdbbbbbaaaaa#aa###a###aa##aaaaaaaaaaaaabcbbaaaaaa#aaaaaaabbbdfd#aaacdaaaaaadgefc#######a#a###abb##a#aaabaaaaaa#######aaa#a########aaaaa##aabbbbbbbbccefhfeeegfbbba#aaaaaaaaaaaa####aa##abbcdacbaa##aabcehfaaaa###aaababa##.##a#aaaca#a#aaaaaa#aaaa#aabcc#####aaaabbbbbadcabbbbbbceedefcaabcecaaabaaababccdcdddccbbcceda#####baeaa#aaa#####ab##aaaaa##aaa##abbbbbbbbaaaaaaaaabbbagig",
-"f#aaaehhfffeffhfbccbbaaaaaaa####a#aaaaa###aaa#a#abaabccabcbabbbbabbaabbbbcehdaaaaaaaaaab#dgeaa##a###########aa####aaaaaaa######a####aaaa###a###aaaaa###aabbbbbacccdedddfgebcbaaaaabbbaabaaba#########abcbdabaaa#aabcdeibaaa######aaaca######aabbb####aaaaaaaaaaa##bbdb####aabbbbaaaacdcaabbbbcceddeccccaba#aaabaaaabccddddddceddeec#aca#aabebaaa#######aaaba#######aaaaabbbabbbbbaaaaaaaaaba#dii",
-"hd#aaejiedefeeddedccbaaaaaa########aaa#######a#a#aaaabbaacbbababccbbabbbbbceidbaaaaaaaacbcgeca#############aaaaaaaaaaaba######.a############a##aaaaaaaaaaaacbbbccccedbcfcbbbbaaabbbbaaaaaaababaaa#baaaabababbabaaaaabdfhaaaaa#aa##b#bbaa#####abb##a##aaaabbba#aaaaaacda#####abbbbaa####a#abaabccbdecdbbaaaaaaaaaaaabccceeedcdfgffeba#aa#aa#bcaaa##########aa##a####aaaaa#aaabbbbaaaaabbbcbbbeefh",
-"ggecdhjkiefeeddcdefdababaaa########aa##a########abaabaabcdabbcdccbcbabbbbccchiecaa#abbbaaaadeca#####a#######aabaaaaaabba###a##.#############a##aaaaaaaaaaabbbccdddbbeccdbbcbbbabbbbbbcbbaaaabccaaaabaabcabbabaaaabaabcefeabaaaaa####aaccb####aaa###a###aabbab#a#aaa##aaa#####acbba#a######aaaabbbbfefdaaaacaaaaaaaabbbcefffeefbed########a##dbaaa#######a#############a########aaaaaaaaaccfgfhdf",
-"efddegijmkfeeeddccdgdbcccbaaa####a#aaa#####a####a###aabbcbabacccdccbbbbbcbbdfijhbaaaaabb###cedbaa###aaa#####aabbccbaaaaa###accb###a##########aaaaaaaaaaaabcbbccddddcddaaaabbbabbbbbbcbaabbbbbaaaabbaaaaabbbbaaa#ccaabbddheabaaaaa####abca#####ba##a####abcaaaaaaaaaa#aaaa#####bbaaa##aaaa##aaabbaaadfdbaabcbaaaaaaabbacehhhhcaaaa#####a#ab##ccaa########aa#############ba#a#aaaa#aaabdaaeffghgff",
-"eddcbcdefijgeedcccbbdeccccbaaaaaaaaaa#a#########aaa##a#abcaacccccccbcbbccccdefikibaaaaaaaabbdddca#a#a#aa####aaabbbaaaa##a##aaaba##aa##a######aaaaaaaaaaabbbbbccccddddaabbaabcdbbbccbacbabcbbccbaa#aaaa###baaaaa#a#aaabcdfjb#aaaaaa####abaa.####a##aa####bcbbaaaaaaaa#####aa##abaaa#a##aaaaaaaaaaaaabecbaababaaaaabbbcbcehhcaaa##aaa#######b#.cbabaa#####aa##a#####a#########aa#a#aaabdefffggfefe",
-"ddcaaabdefhihecdbbbbacdecccbbaaaaaaaa############aa##aa#ababbcbcbbbababccdceeegijgaaaaaba###bfcdc##aaaaa######aaaaaaaaa#aaaaaacba#aaa#a#ba#aa#aaaaaaaababcbbbbbcedabbaabbaaabbbabbdccbbbaabbbbbaaa#aaaaa##aaaaaa#####abcehka##aaa#####aaaa###..a#aba#####abcaaaaaaa#a##a##a###ba########aaaa####aa#deaaa#aaaaaaabbbbbccefcbaba##abaaaa.#a#ba##dc#a#a####abaabb#a##aa##a###a###aaaaabaceecddhhedd",
-"cccbabbcdfffhheccbbbbbcdfccbbbbaaaaaa###############a##aaaabacbbbbaaaacccddcdefhjjhbaaaabaa##dfbbc###aa#aa######aabaabaabbbbbabdb#aa#a###bba#a##aaaabbabbbbbcbbcedbaaaaaaaaabbbbbcbccbcebbbbaaaaaaaaaa#####aaa####aa#aabdegj.############a##a##a#aba####a##baaaaaa#a###aa#aa########a##a#aaaa####a#eeaa###aaaaaaaaabbcdgfdbaa####aabbcb#aabc###cda#aa##aababcbb#a#aa###a##aab#aaaaababdecbcdheed",
-"cbbaccbcddeffeedcbbbbbbccffdbbcbabbaaa#aa########a###ca#abaabbbabaaaaabcccddcdgiikjgbaaaaba##afcacba###aa########abbbbaabbbbbbbcbbbb#aa#a###aa##aaaaababbbbcbccdca#a##aaaaabaaabcccbbcbcbaabba##aaaaaba#####aa####aabbbddcdjd.#########.#..#######aba######aaaaaba########aa#######aaa#aba#aaa###aacaaaa##aabaaaaaaabbcefcbbaaaaa##aaacabaaaa###bca#####aaaaacaa#a###a##a#aaa#a#aabbbbcddcccegdd",
-"cbbabbbbccddeedddcbbbbbbbbdfheccccbaaaa###########aa#bd##baaaabaaaaaababcddcccggijjjbaaabbaa##bcbabba##aa#######aaaaaaabbbbbbbbbcccaaaa##a##aaa##aaaabbbdbcbbcdfbaaa#aaabbbbbbbbbcccbccdedaaa#aaaabbaaaa#a#aa####a#abcccdccfi###########....#######aa##aaaaaaaaaaa##########a###a##aa#aa#aaa#####aaa#aaaa##abbbaaaaabcdefbbaaaaabaa####aa####a#a#dba#####bb##b###########aaaaa#aaabbaabbbccddede",
-"baabbbbbccccdeedcccbbccbcbbcdiheccbbbaaaaa#aab##aa###aa###aaaacbaaaaaababccccdfhjjjl#abbbaaba#abeaabb######a#####bbaa#aaaabbbcbbabbaa###aa####a###aaaabacdcccdceaaaaaaaaaababbbbbbbcbbbcbdba###aabbbaaa#aa##########aabbabccgb.###.#########.########a#aaaa#abaa#########a##aa#####bcaabaaba###aaaaaaaa#####aaaaaabbbdhidabaaaaaaaa###########a###ebbb###aaa####a###aa#aabcaabbaaababaaabbbbbdcb",
-"abcbbbbbbbccbbcddbcbbbbbbbbbcfeghfccbbabaaaaabaaaa####a#b##aaaabbaa#aaaaabccbceefhegdedaaaaaaa#abdaaba#aa##a#####aaaabaaaaaaabbbaacc###aa#aa####a#aaaaaaabcccddfbba#aaaaaabbbbabbccccccbcbdaa#####ac#####a##########aa#aabcbdh..#########.#####.####aaa#aaa###abb###########accaa###a##aaabbbba#a##a#abba####aaaaaccegcbbaaaaaaa#aa###.##a########aeaaaa###a#a######aaa##aaaaaaaabbaabbaacaacced",
-"cadbbbbbbcbccbbacbbbbbbbbabccdeehgffccbcbaaabaaaaaa###a####aaa#aaaaaaaaaaabccbdeeffeehgcaabaaa##adb#aca##aaa#####aaabaaaaaaaaaabaacdb##aaaaaaa#abbaaabbbabbdecffbaaaaaaaaaaaaaabbaccbcbcccdcaa#############aabb######aaaaabbbehd..###d#.#.######.####adbaaaa##abba########aaaaaaaaaaaaa#aaaaaaa#a#aa#abaaa####aaacdeheaaaaaaaaa##aa#aa#####a####a#.cdaa######a##a###########aa##aabb#aabaaabbadf",
-"cabdabbbabcccdccbccbbbbbbaabdcdefdcfgccbbbbaabcbaaa###aa##aca####aaa##aabbbccccddffhihhfbaba#c###bdaaagaaa#a######aabaabaaaaaaaa#a#aa####aaaa#aabbaaaabbbbbcddfeca###aaaaabbaabbabbcbccbbbccdada###aa######aaba####a###abaabcafjlf..defe##...#########bbaaa###aab#a#######aaabcb#aaaaaca##aaaa####a##aab###a##aabdfiida###aaaaa##ca#aa#####a####a###ecaaa########a##a#####a####a###aaaaaaaaaabab",
-"ccbbbbabbaaabccdcbbbbbbaaaabcdbbbeeadgeccbbbbabbbaaa##aa#abedbaa####a####bbbcbccddehhhfdaa###da#a#ddaabhaa###########a#abaabbaa######a####aaaaaaaaaabbbbbbcbdeefcb###aaaaaaaaaabbbbccccbbaabbcaaa############aacbaabaaaaaaabccbdejkbd..bgccdcba########aa######aaa#a#######aaaccaba#bcaaba#a##aaa#####abba#aa#aabdgkjkihgdb#.cedcbb#.###dc########b##ebaaaa#########################aaa#aaaaaaba",
-"abeecbbaababbbabbdbabbbbbaaabcccbdcb#ehedccbbaabbbaaa#abaaaedba###########acbbbcceeeggdaaa#bacaa#aadabbdf#######.#######aaaaaa######bca###aaaaaaaaaabbbbbbbccfffbaaaa#aaaaa#aaaabbccabbcccbbbbaaaaa#######a#aa#acaaaaaaaaaaaabccceglh.#....#baacca..####ab########aaa####a##ababbbba#ceaaaaaa###a######aa##acbbbbchgcddfgjihddigefegfffba#affeecbbaaabda#aa######a#a################aaaa#aaaaaab",
-"babfdcbcbabaabababbbaaaaaaaabcccdbaaaacifddcbbbbbbbabaabaacecabaaaaa######aaabbcdeeedifba#adcbaaba#bcabbfe#aa####aaa###a#abaaaa######aaaac#aaaaaaaabbbdbbbbcceebbba##aaaaaaa#aaabbbbbbcccdcabaaaaab##a#aaaaaaa######abaaaaa#abbbbddei#####a####.#ee######aa######aaaba######abaaaa#a##bc##aa#a####a###a#aaaabcbbbceecbbcbdeffgfdccccdefeefgffedcefeb##cdbcba########a###########a###aaaabaaaaaaa"
-};
-SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 384 NAXIS2 = 384 HISTORY Written by XV 3.10a END 3"3wUD3D3"3""3"3"333""""""""3DDDU3""""DªwUUD3333333"3""3""DfD"3""""""""33DUfffUªw3""UD3""3"3D"33wf"""""""3""""""""D""""""""333U3333DDff333"""""""""""333333DDDUD"3"""""3"""""""""3""""""3333UUfª"
diff --git a/tests/simple.c b/tests/simple.c
deleted file mode 100644
index 47893772f7..0000000000
--- a/tests/simple.c
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <gtk/gtk.h>
-#include <gdk/gdkprivate.h>
-
-
-void
-hello ()
-{
- g_print ("hello world\n");
-}
-
-int
-main (int argc, char *argv[])
-{
- GtkWidget *window;
- GtkWidget *button;
-
- gdk_progclass = g_strdup ("XTerm");
- gtk_init (&argc, &argv);
-
- window = gtk_widget_new (gtk_window_get_type (),
- "GtkObject::user_data", NULL,
- "GtkWindow::type", GTK_WINDOW_TOPLEVEL,
- "GtkWindow::title", "hello world",
- "GtkWindow::allow_grow", FALSE,
- "GtkWindow::allow_shrink", FALSE,
- "GtkContainer::border_width", 10,
- NULL);
- button = gtk_widget_new (gtk_button_get_type (),
- "GtkButton::label", "hello world",
- "GtkObject::signal::clicked", hello, NULL,
- "GtkWidget::parent", window,
- "GtkWidget::visible", TRUE,
- NULL);
- gtk_widget_show (window);
-
- gtk_main ();
-
- return 0;
-}
diff --git a/tests/test.xpm b/tests/test.xpm
deleted file mode 100644
index 9b0d2efdb2..0000000000
--- a/tests/test.xpm
+++ /dev/null
@@ -1,92 +0,0 @@
-/* XPM */
-static char *openfile[] = {
-/* width height num_colors chars_per_pixel */
-" 20 19 66 2",
-/* colors */
-".. c None",
-".# c #000000",
-".a c #dfdfdf",
-".b c #7f7f7f",
-".c c #006f6f",
-".d c #00efef",
-".e c #009f9f",
-".f c #004040",
-".g c #00bfbf",
-".h c #ff0000",
-".i c #ffffff",
-".j c #7f0000",
-".k c #007070",
-".l c #00ffff",
-".m c #00a0a0",
-".n c #004f4f",
-".o c #00cfcf",
-".p c #8f8f8f",
-".q c #6f6f6f",
-".r c #a0a0a0",
-".s c #7f7f00",
-".t c #007f7f",
-".u c #5f5f5f",
-".v c #707070",
-".w c #00f0f0",
-".x c #009090",
-".y c #ffff00",
-".z c #0000ff",
-".A c #00afaf",
-".B c #00d0d0",
-".C c #00dfdf",
-".D c #005f5f",
-".E c #00b0b0",
-".F c #001010",
-".G c #00c0c0",
-".H c #000f0f",
-".I c #00007f",
-".J c #005050",
-".K c #002f2f",
-".L c #dfcfcf",
-".M c #dfd0d0",
-".N c #006060",
-".O c #00e0e0",
-".P c #00ff00",
-".Q c #002020",
-".R c #dfc0c0",
-".S c #008080",
-".T c #001f1f",
-".U c #003f3f",
-".V c #007f00",
-".W c #00000f",
-".X c #000010",
-".Y c #00001f",
-".Z c #000020",
-".0 c #00002f",
-".1 c #000030",
-".2 c #00003f",
-".3 c #000040",
-".4 c #00004f",
-".5 c #000050",
-".6 c #00005f",
-".7 c #000060",
-".8 c #00006f",
-".9 c #000070",
-"#. c #7f7f80",
-"## c #9f9f9f",
-/* pixels */
-"........................................",
-"........................................",
-"........................................",
-".......................#.#.#............",
-".....................#.......#...#......",
-"...............................#.#......",
-".......#.#.#.................#.#.#......",
-".....#.y.i.y.#.#.#.#.#.#.#..............",
-".....#.i.y.i.y.i.y.i.y.i.#..............",
-".....#.y.i.y.i.y.i.y.i.y.#..............",
-".....#.i.y.i.y.#.#.#.#.#.#.#.#.#.#.#....",
-".....#.y.i.y.#.s.s.s.s.s.s.s.s.s.#......",
-".....#.i.y.#.s.s.s.s.s.s.s.s.s.#........",
-".....#.y.#.s.s.s.s.s.s.s.s.s.#..........",
-".....#.#.s.s.s.s.s.s.s.s.s.#............",
-".....#.#.#.#.#.#.#.#.#.#.#..............",
-"........................................",
-"........................................",
-"........................................"
-};
diff --git a/tests/testgtk.c b/tests/testgtk.c
deleted file mode 100644
index 9ceb305a6d..0000000000
--- a/tests/testgtk.c
+++ /dev/null
@@ -1,5478 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include "gtk.h"
-#include "../gdk/gdk.h"
-#include "../gdk/gdkx.h"
-
-#include "circles.xbm"
-
-/* Variables used by the Drag/Drop and Shape Window demos */
-static GtkWidget *modeller = NULL;
-static GtkWidget *sheets = NULL;
-static GtkWidget *rings = NULL;
-void create_shapes(void);
-
-
-/* macro, structure and variables used by tree window demos */
-#define DEFAULT_NUMBER_OF_ITEM 3
-#define DEFAULT_RECURSION_LEVEL 3
-
-struct {
- GSList* selection_mode_group;
- GtkWidget* single_button;
- GtkWidget* browse_button;
- GtkWidget* multiple_button;
- GtkWidget* draw_line_button;
- GtkWidget* view_line_button;
- GtkWidget* no_root_item_button;
- GtkWidget* nb_item_spinner;
- GtkWidget* recursion_spinner;
-} sTreeSampleSelection;
-
-typedef struct sTreeButtons {
- guint nb_item_add;
- GtkWidget* add_button;
- GtkWidget* remove_button;
-} sTreeButtons;
-/* end of tree section */
-
-void
-destroy_window (GtkWidget *widget,
- GtkWidget **window)
-{
- *window = NULL;
-}
-
-static void
-destroy_tooltips (GtkWidget *widget, GtkWindow **window)
-{
- GtkTooltips *tt = gtk_object_get_data (GTK_OBJECT (*window), "tooltips");
- gtk_object_unref (GTK_OBJECT (tt));
-
- *window = NULL;
-}
-
-static void
-button_window (GtkWidget *widget,
- GtkWidget *button)
-{
- if (!GTK_WIDGET_VISIBLE (button))
- gtk_widget_show (button);
- else
- gtk_widget_hide (button);
-}
-
-static void
-create_buttons ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *table;
- GtkWidget *button[10];
- GtkWidget *separator;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC (gtk_true),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "buttons");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- table = gtk_table_new (3, 3, FALSE);
- gtk_table_set_row_spacings (GTK_TABLE (table), 5);
- gtk_table_set_col_spacings (GTK_TABLE (table), 5);
- gtk_container_border_width (GTK_CONTAINER (table), 10);
- gtk_box_pack_start (GTK_BOX (box1), table, TRUE, TRUE, 0);
- gtk_widget_show (table);
-
-
- button[0] = gtk_button_new_with_label ("button1");
- button[1] = gtk_button_new_with_label ("button2");
- button[2] = gtk_button_new_with_label ("button3");
- button[3] = gtk_button_new_with_label ("button4");
- button[4] = gtk_button_new_with_label ("button5");
- button[5] = gtk_button_new_with_label ("button6");
- button[6] = gtk_button_new_with_label ("button7");
- button[7] = gtk_button_new_with_label ("button8");
- button[8] = gtk_button_new_with_label ("button9");
-
- gtk_signal_connect (GTK_OBJECT (button[0]), "clicked",
- GTK_SIGNAL_FUNC(button_window),
- button[1]);
-
- gtk_table_attach (GTK_TABLE (table), button[0], 0, 1, 0, 1,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (button[0]);
-
- gtk_signal_connect (GTK_OBJECT (button[1]), "clicked",
- GTK_SIGNAL_FUNC(button_window),
- button[2]);
-
- gtk_table_attach (GTK_TABLE (table), button[1], 1, 2, 1, 2,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (button[1]);
-
- gtk_signal_connect (GTK_OBJECT (button[2]), "clicked",
- GTK_SIGNAL_FUNC(button_window),
- button[3]);
- gtk_table_attach (GTK_TABLE (table), button[2], 2, 3, 2, 3,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (button[2]);
-
- gtk_signal_connect (GTK_OBJECT (button[3]), "clicked",
- GTK_SIGNAL_FUNC(button_window),
- button[4]);
- gtk_table_attach (GTK_TABLE (table), button[3], 0, 1, 2, 3,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (button[3]);
-
- gtk_signal_connect (GTK_OBJECT (button[4]), "clicked",
- GTK_SIGNAL_FUNC(button_window),
- button[5]);
- gtk_table_attach (GTK_TABLE (table), button[4], 2, 3, 0, 1,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (button[4]);
-
- gtk_signal_connect (GTK_OBJECT (button[5]), "clicked",
- GTK_SIGNAL_FUNC(button_window),
- button[6]);
- gtk_table_attach (GTK_TABLE (table), button[5], 1, 2, 2, 3,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (button[5]);
-
- gtk_signal_connect (GTK_OBJECT (button[6]), "clicked",
- GTK_SIGNAL_FUNC(button_window),
- button[7]);
- gtk_table_attach (GTK_TABLE (table), button[6], 1, 2, 0, 1,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (button[6]);
-
- gtk_signal_connect (GTK_OBJECT (button[7]), "clicked",
- GTK_SIGNAL_FUNC(button_window),
- button[8]);
- gtk_table_attach (GTK_TABLE (table), button[7], 2, 3, 1, 2,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (button[7]);
-
- gtk_signal_connect (GTK_OBJECT (button[8]), "clicked",
- GTK_SIGNAL_FUNC(button_window),
- button[0]);
- gtk_table_attach (GTK_TABLE (table), button[8], 0, 1, 1, 2,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (button[8]);
-
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button[9] = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button[9]), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button[9], TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button[9], GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button[9]);
- gtk_widget_show (button[9]);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-static void
-create_toggle_buttons ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *button;
- GtkWidget *separator;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "toggle buttons");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_toggle_button_new_with_label ("button1");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- button = gtk_toggle_button_new_with_label ("button2");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- button = gtk_toggle_button_new_with_label ("button3");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-static void
-create_check_buttons ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *button;
- GtkWidget *separator;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "check buttons");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_check_button_new_with_label ("button1");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- button = gtk_check_button_new_with_label ("button2");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- button = gtk_check_button_new_with_label ("button3");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-static void
-create_radio_buttons ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *button;
- GtkWidget *separator;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "radio buttons");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_radio_button_new_with_label (NULL, "button1");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- button = gtk_radio_button_new_with_label (
- gtk_radio_button_group (GTK_RADIO_BUTTON (button)),
- "button2");
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE);
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- button = gtk_radio_button_new_with_label (
- gtk_radio_button_group (GTK_RADIO_BUTTON (button)),
- "button3");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-static void
-bbox_widget_destroy (GtkWidget* widget, GtkWidget* todestroy)
-{
-}
-
-static void
-create_bbox_window (gint horizontal,
- char* title,
- gint pos,
- gint spacing,
- gint child_w,
- gint child_h,
- gint layout)
-{
- GtkWidget* window;
- GtkWidget* box1;
- GtkWidget* bbox;
- GtkWidget* button;
-
- /* create a new window */
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title (GTK_WINDOW (window), title);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(bbox_widget_destroy), window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(bbox_widget_destroy), window);
-
- if (horizontal)
- {
- gtk_widget_set_usize (window, 550, 60);
- gtk_widget_set_uposition (window, 150, pos);
- box1 = gtk_vbox_new (FALSE, 0);
- }
- else
- {
- gtk_widget_set_usize (window, 150, 400);
- gtk_widget_set_uposition (window, pos, 200);
- box1 = gtk_vbox_new (FALSE, 0);
- }
-
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
- if (horizontal)
- bbox = gtk_hbutton_box_new();
- else
- bbox = gtk_vbutton_box_new();
- gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), layout);
- gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), spacing);
- gtk_button_box_set_child_size (GTK_BUTTON_BOX (bbox), child_w, child_h);
- gtk_widget_show (bbox);
-
- gtk_container_border_width (GTK_CONTAINER(box1), 25);
- gtk_box_pack_start (GTK_BOX (box1), bbox, TRUE, TRUE, 0);
-
- button = gtk_button_new_with_label ("OK");
- gtk_container_add (GTK_CONTAINER(bbox), button);
-
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(bbox_widget_destroy), window);
-
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Cancel");
- gtk_container_add (GTK_CONTAINER(bbox), button);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Help");
- gtk_container_add (GTK_CONTAINER(bbox), button);
- gtk_widget_show (button);
-
- gtk_widget_show (window);
-}
-
-static void
-test_hbbox ()
-{
- create_bbox_window (TRUE, "Spread", 50, 40, 85, 28, GTK_BUTTONBOX_SPREAD);
- create_bbox_window (TRUE, "Edge", 200, 40, 85, 25, GTK_BUTTONBOX_EDGE);
- create_bbox_window (TRUE, "Start", 350, 40, 85, 25, GTK_BUTTONBOX_START);
- create_bbox_window (TRUE, "End", 500, 15, 30, 25, GTK_BUTTONBOX_END);
-}
-
-static void
-test_vbbox ()
-{
- create_bbox_window (FALSE, "Spread", 50, 40, 85, 25, GTK_BUTTONBOX_SPREAD);
- create_bbox_window (FALSE, "Edge", 250, 40, 85, 28, GTK_BUTTONBOX_EDGE);
- create_bbox_window (FALSE, "Start", 450, 40, 85, 25, GTK_BUTTONBOX_START);
- create_bbox_window (FALSE, "End", 650, 15, 30, 25, GTK_BUTTONBOX_END);
-}
-
-static void
-create_button_box ()
-{
- static GtkWidget* window = NULL;
- GtkWidget* bbox;
- GtkWidget* button;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title (GTK_WINDOW (window),
- "Button Box Test");
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window), &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window), &window);
-
- gtk_container_border_width (GTK_CONTAINER (window), 20);
-
- /*
- *these 15 lines are a nice and easy example for GtkHButtonBox
- */
- bbox = gtk_hbutton_box_new ();
- gtk_container_add (GTK_CONTAINER (window), bbox);
- gtk_widget_show (bbox);
-
- button = gtk_button_new_with_label ("Horizontal");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(test_hbbox), 0);
- gtk_container_add (GTK_CONTAINER (bbox), button);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Vertical");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(test_vbbox), 0);
- gtk_container_add (GTK_CONTAINER (bbox), button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-static GtkWidget*
-new_pixmap (char *filename,
- GdkWindow *window,
- GdkColor *background)
-{
- GtkWidget *wpixmap;
- GdkPixmap *pixmap;
- GdkBitmap *mask;
-
- pixmap = gdk_pixmap_create_from_xpm (window, &mask,
- background,
- "test.xpm");
- wpixmap = gtk_pixmap_new (pixmap, mask);
-
- return wpixmap;
-}
-
-static void
-set_toolbar_horizontal (GtkWidget *widget,
- gpointer data)
-{
- gtk_toolbar_set_orientation (GTK_TOOLBAR (data), GTK_ORIENTATION_HORIZONTAL);
-}
-
-static void
-set_toolbar_vertical (GtkWidget *widget,
- gpointer data)
-{
- gtk_toolbar_set_orientation (GTK_TOOLBAR (data), GTK_ORIENTATION_VERTICAL);
-}
-
-static void
-set_toolbar_icons (GtkWidget *widget,
- gpointer data)
-{
- gtk_toolbar_set_style (GTK_TOOLBAR (data), GTK_TOOLBAR_ICONS);
-}
-
-static void
-set_toolbar_text (GtkWidget *widget,
- gpointer data)
-{
- gtk_toolbar_set_style (GTK_TOOLBAR (data), GTK_TOOLBAR_TEXT);
-}
-
-static void
-set_toolbar_both (GtkWidget *widget,
- gpointer data)
-{
- gtk_toolbar_set_style (GTK_TOOLBAR (data), GTK_TOOLBAR_BOTH);
-}
-
-static void
-set_toolbar_small_space (GtkWidget *widget,
- gpointer data)
-{
- gtk_toolbar_set_space_size (GTK_TOOLBAR (data), 5);
-}
-
-static void
-set_toolbar_big_space (GtkWidget *widget,
- gpointer data)
-{
- gtk_toolbar_set_space_size (GTK_TOOLBAR (data), 10);
-}
-
-static void
-set_toolbar_enable (GtkWidget *widget,
- gpointer data)
-{
- gtk_toolbar_set_tooltips (GTK_TOOLBAR (data), TRUE);
-}
-
-static void
-set_toolbar_disable (GtkWidget *widget,
- gpointer data)
-{
- gtk_toolbar_set_tooltips (GTK_TOOLBAR (data), FALSE);
-}
-
-static void
-create_toolbar (void)
-{
- static GtkWidget *window = NULL;
- GtkWidget *toolbar;
- GtkWidget *entry;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title (GTK_WINDOW (window), "Toolbar test");
- gtk_window_set_policy (GTK_WINDOW (window), FALSE, TRUE, TRUE);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC (destroy_window),
- &window);
-
- gtk_container_border_width (GTK_CONTAINER (window), 0);
- gtk_widget_realize (window);
-
- toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
-
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Horizontal", "Horizontal toolbar layout", "Toolbar/Horizontal",
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_horizontal, toolbar);
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Vertical", "Vertical toolbar layout", "Toolbar/Vertical",
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_vertical, toolbar);
-
- gtk_toolbar_append_space (GTK_TOOLBAR(toolbar));
-
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Icons", "Only show toolbar icons", "Toolbar/IconsOnly",
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_icons, toolbar);
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Text", "Only show toolbar text", "Toolbar/TextOnly",
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_text, toolbar);
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Both", "Show toolbar icons and text", "Toolbar/Both",
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_both, toolbar);
-
- gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
-
- entry = gtk_entry_new ();
- gtk_widget_show(entry);
- gtk_toolbar_append_widget (GTK_TOOLBAR (toolbar), entry, "This is an unusable GtkEntry ;)", "Hey don't click me!!!");
-
- gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
-
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Small", "Use small spaces", "Toolbar/Small",
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_small_space, toolbar);
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Big", "Use big spaces", "Toolbar/Big",
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_big_space, toolbar);
-
- gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
-
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Enable", "Enable tooltips", NULL,
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_enable, toolbar);
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Disable", "Disable tooltips", NULL,
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_disable, toolbar);
-
- gtk_container_add (GTK_CONTAINER (window), toolbar);
- gtk_widget_show (toolbar);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-static GtkWidget*
-make_toolbar (GtkWidget *window)
-{
- GtkWidget *toolbar;
-
- if (!GTK_WIDGET_REALIZED (window))
- gtk_widget_realize (window);
-
- toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
-
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Horizontal", "Horizontal toolbar layout", NULL,
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_horizontal, toolbar);
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Vertical", "Vertical toolbar layout", NULL,
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_vertical, toolbar);
-
- gtk_toolbar_append_space (GTK_TOOLBAR(toolbar));
-
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Icons", "Only show toolbar icons", NULL,
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_icons, toolbar);
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Text", "Only show toolbar text", NULL,
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_text, toolbar);
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Both", "Show toolbar icons and text", NULL,
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_both, toolbar);
-
- gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
-
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Small", "Use small spaces", NULL,
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_small_space, toolbar);
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Big", "Use big spaces", "Toolbar/Big",
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_big_space, toolbar);
-
- gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
-
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Enable", "Enable tooltips", NULL,
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_enable, toolbar);
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Disable", "Disable tooltips", NULL,
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_disable, toolbar);
-
- return toolbar;
-}
-
-static guint statusbar_counter = 1;
-
-static void
-statusbar_push (GtkWidget *button,
- GtkStatusbar *statusbar)
-{
- gchar text[1024];
-
- sprintf (text, "something %d", statusbar_counter++);
-
- gtk_statusbar_push (statusbar, 1, text);
-}
-
-static void
-statusbar_pop (GtkWidget *button,
- GtkStatusbar *statusbar)
-{
- gtk_statusbar_pop (statusbar, 1);
-}
-
-static void
-statusbar_steal (GtkWidget *button,
- GtkStatusbar *statusbar)
-{
- gtk_statusbar_remove (statusbar, 1, 4);
-}
-
-static void
-statusbar_popped (GtkStatusbar *statusbar,
- guint context_id,
- const gchar *text)
-{
- if (!statusbar->messages)
- statusbar_counter = 1;
-}
-
-static void
-statusbar_contexts (GtkWidget *button,
- GtkStatusbar *statusbar)
-{
- gchar *string;
-
- string = "any context";
- g_print ("GtkStatusBar: context=\"%s\", context_id=%d\n",
- string,
- gtk_statusbar_get_context_id (statusbar, string));
-
- string = "idle messages";
- g_print ("GtkStatusBar: context=\"%s\", context_id=%d\n",
- string,
- gtk_statusbar_get_context_id (statusbar, string));
-
- string = "some text";
- g_print ("GtkStatusBar: context=\"%s\", context_id=%d\n",
- string,
- gtk_statusbar_get_context_id (statusbar, string));
-
- string = "hit the mouse";
- g_print ("GtkStatusBar: context=\"%s\", context_id=%d\n",
- string,
- gtk_statusbar_get_context_id (statusbar, string));
-
- string = "hit the mouse2";
- g_print ("GtkStatusBar: context=\"%s\", context_id=%d\n",
- string,
- gtk_statusbar_get_context_id (statusbar, string));
-}
-
-static void
-statusbar_dump_stack (GtkWidget *button,
- GtkStatusbar *statusbar)
-{
- GSList *list;
-
- for (list = statusbar->messages; list; list = list->next)
- {
- GtkStatusbarMsg *msg;
-
- msg = list->data;
- g_print ("context_id: %d, message_id: %d, status_text: \"%s\"\n",
- msg->context_id,
- msg->message_id,
- msg->text);
- }
-}
-
-static void
-create_statusbar ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *button;
- GtkWidget *separator;
- GtkWidget *statusbar;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (gtk_widget_destroyed),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC (gtk_true),
- NULL);
-
- gtk_window_set_title (GTK_WINDOW (window), "statusbar");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
- statusbar = gtk_statusbar_new ();
- gtk_box_pack_end (GTK_BOX (box1), statusbar, TRUE, TRUE, 0);
- gtk_widget_show (statusbar);
- gtk_signal_connect (GTK_OBJECT (statusbar),
- "text_popped",
- GTK_SIGNAL_FUNC (statusbar_popped),
- NULL);
-
- button = gtk_widget_new (gtk_button_get_type (),
- "GtkButton::label", "push something",
- "GtkWidget::visible", TRUE,
- "GtkWidget::parent", box2,
- "GtkObject::signal::clicked", statusbar_push, statusbar,
- NULL);
-
- button = gtk_widget_new (gtk_button_get_type (),
- "GtkButton::label", "pop",
- "GtkWidget::visible", TRUE,
- "GtkWidget::parent", box2,
- "GtkObject::signal::clicked", statusbar_pop, statusbar,
- NULL);
-
- button = gtk_widget_new (gtk_button_get_type (),
- "GtkButton::label", "steal #4",
- "GtkWidget::visible", TRUE,
- "GtkWidget::parent", box2,
- "GtkObject::signal::clicked", statusbar_steal, statusbar,
- NULL);
-
- button = gtk_widget_new (gtk_button_get_type (),
- "GtkButton::label", "dump stack",
- "GtkWidget::visible", TRUE,
- "GtkWidget::parent", box2,
- "GtkObject::signal::clicked", statusbar_dump_stack, statusbar,
- NULL);
-
- button = gtk_widget_new (gtk_button_get_type (),
- "GtkButton::label", "test contexts",
- "GtkWidget::visible", TRUE,
- "GtkWidget::parent", box2,
- "GtkObject::signal::clicked", statusbar_contexts, statusbar,
- NULL);
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-static void
-handle_box_child_signal (GtkHandleBox *hb,
- GtkWidget *child,
- const gchar *action)
-{
- printf ("%s: child <%s> %sed\n",
- gtk_type_name (GTK_OBJECT_TYPE (hb)),
- gtk_type_name (GTK_OBJECT_TYPE (child)),
- action);
-}
-
-/* funtions used by tree window demos */
-static guint
-cb_tree_delete_event(GtkWidget* w)
-{
- return TRUE;
-}
-
-static void
-cb_tree_destroy_event(GtkWidget* w)
-{
- sTreeButtons* tree_buttons;
-
- /* free buttons structure associate at this tree */
- tree_buttons = gtk_object_get_user_data(GTK_OBJECT(w));
- free(tree_buttons);
-}
-static void
-cb_add_new_item(GtkWidget* w, GtkTree* tree)
-{
- sTreeButtons* tree_buttons;
- GList* selected_list;
- GtkWidget* selected_item;
- GtkWidget* subtree;
- GtkWidget* item_new;
- char buffer[255];
-
- tree_buttons = gtk_object_get_user_data(GTK_OBJECT(tree));
-
- selected_list = GTK_TREE_SELECTION(tree);
-
- if(selected_list == NULL)
- {
- /* there is no item in tree */
- subtree = GTK_WIDGET(tree);
- }
- else
- {
- /* list can have only one element */
- selected_item = GTK_WIDGET(selected_list->data);
-
- subtree = GTK_TREE_ITEM_SUBTREE(selected_item);
-
- if(subtree == NULL)
- {
- /* current selected item have not subtree ... create it */
- subtree = gtk_tree_new();
- gtk_tree_item_set_subtree(GTK_TREE_ITEM(selected_item),
- subtree);
- }
- }
-
- /* at this point, we know which subtree will be used to add new item */
- /* create a new item */
- sprintf(buffer, "item add %d", tree_buttons->nb_item_add);
- item_new = gtk_tree_item_new_with_label(buffer);
- gtk_tree_append(GTK_TREE(subtree), item_new);
- gtk_widget_show(item_new);
-
- tree_buttons->nb_item_add++;
-}
-
-static void
-cb_remove_item(GtkWidget*w, GtkTree* tree)
-{
- GList* selected_list;
- GList* clear_list;
-
- selected_list = GTK_TREE_SELECTION(tree);
-
- clear_list = NULL;
-
- while (selected_list)
- {
- clear_list = g_list_prepend (clear_list, selected_list->data);
- selected_list = selected_list->next;
- }
-
- clear_list = g_list_reverse (clear_list);
- gtk_tree_remove_items(tree, clear_list);
-
- g_list_free (clear_list);
-}
-
-static void
-cb_tree_changed(GtkTree* tree)
-{
- sTreeButtons* tree_buttons;
- GList* selected_list;
- guint nb_selected;
-
- tree_buttons = gtk_object_get_user_data(GTK_OBJECT(tree));
-
- selected_list = GTK_TREE_SELECTION(tree);
- nb_selected = g_list_length(selected_list);
-
- if(nb_selected == 0)
- {
- if(tree->children == NULL)
- gtk_widget_set_sensitive(tree_buttons->add_button, TRUE);
- else
- gtk_widget_set_sensitive(tree_buttons->add_button, FALSE);
- gtk_widget_set_sensitive(tree_buttons->remove_button, FALSE);
- }
- else
- {
- gtk_widget_set_sensitive(tree_buttons->remove_button, TRUE);
- gtk_widget_set_sensitive(tree_buttons->add_button, (nb_selected == 1));
- }
-}
-
-static void
-create_subtree(GtkWidget* item, guint level, guint nb_item_max, guint recursion_level_max)
-{
- GtkWidget* item_subtree;
- GtkWidget* item_new;
- guint nb_item;
- char buffer[255];
- int no_root_item;
-
- if(level == recursion_level_max) return;
-
- if(level == -1)
- {
- /* query with no root item */
- level = 0;
- item_subtree = item;
- no_root_item = 1;
- }
- else
- {
- /* query with no root item */
- /* create subtree and associate it with current item */
- item_subtree = gtk_tree_new();
- no_root_item = 0;
- }
-
- for(nb_item = 0; nb_item < nb_item_max; nb_item++)
- {
- sprintf(buffer, "item %d-%d", level, nb_item);
- item_new = gtk_tree_item_new_with_label(buffer);
- gtk_tree_append(GTK_TREE(item_subtree), item_new);
- create_subtree(item_new, level+1, nb_item_max, recursion_level_max);
- gtk_widget_show(item_new);
- }
-
- if(!no_root_item)
- gtk_tree_item_set_subtree(GTK_TREE_ITEM(item), item_subtree);
-}
-
-static void
-create_tree_sample(guint selection_mode,
- guint draw_line, guint view_line, guint no_root_item,
- guint nb_item_max, guint recursion_level_max)
-{
- GtkWidget* window;
- GtkWidget* box1;
- GtkWidget* box2;
- GtkWidget* separator;
- GtkWidget* button;
- GtkWidget* scrolled_win;
- GtkWidget* root_tree;
- GtkWidget* root_item;
- sTreeButtons* tree_buttons;
-
- /* create tree buttons struct */
- if((tree_buttons = g_malloc(sizeof(sTreeButtons))) == NULL)
- {
- g_error("can't allocate memory for tree structure !\n");
- return;
- }
- tree_buttons->nb_item_add = 0;
-
- /* create top level window */
- window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title(GTK_WINDOW(window), "Tree Sample");
- gtk_signal_connect(GTK_OBJECT (window), "delete_event",
- (GtkSignalFunc) cb_tree_delete_event, NULL);
- gtk_signal_connect(GTK_OBJECT(window), "destroy",
- (GtkSignalFunc) cb_tree_destroy_event, NULL);
- gtk_object_set_user_data(GTK_OBJECT(window), tree_buttons);
-
- box1 = gtk_vbox_new(FALSE, 0);
- gtk_container_add(GTK_CONTAINER(window), box1);
- gtk_widget_show(box1);
-
- /* create tree box */
- box2 = gtk_vbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(box1), box2, TRUE, TRUE, 0);
- gtk_container_border_width(GTK_CONTAINER(box2), 5);
- gtk_widget_show(box2);
-
- /* create scrolled window */
- scrolled_win = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_box_pack_start (GTK_BOX (box2), scrolled_win, TRUE, TRUE, 0);
- gtk_widget_set_usize (scrolled_win, 200, 200);
- gtk_widget_show (scrolled_win);
-
- /* create root tree widget */
- root_tree = gtk_tree_new();
- gtk_signal_connect(GTK_OBJECT(root_tree), "selection_changed",
- (GtkSignalFunc)cb_tree_changed,
- (gpointer)NULL);
- gtk_object_set_user_data(GTK_OBJECT(root_tree), tree_buttons);
- gtk_container_add(GTK_CONTAINER(scrolled_win), root_tree);
- gtk_tree_set_selection_mode(GTK_TREE(root_tree), selection_mode);
- gtk_tree_set_view_lines(GTK_TREE(root_tree), draw_line);
- gtk_tree_set_view_mode(GTK_TREE(root_tree), !view_line);
- gtk_widget_show(root_tree);
-
- if ( no_root_item )
- {
- /* set root tree to subtree function with root item variable */
- root_item = GTK_WIDGET(root_tree);
- }
- else
- {
- /* create root tree item widget */
- root_item = gtk_tree_item_new_with_label("root item");
- gtk_tree_append(GTK_TREE(root_tree), root_item);
- gtk_widget_show(root_item);
- }
- create_subtree(root_item, -no_root_item, nb_item_max, recursion_level_max);
-
- box2 = gtk_vbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(box1), box2, FALSE, FALSE, 0);
- gtk_container_border_width(GTK_CONTAINER(box2), 5);
- gtk_widget_show(box2);
-
- button = gtk_button_new_with_label("Add Item");
- gtk_widget_set_sensitive(button, FALSE);
- gtk_signal_connect(GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) cb_add_new_item,
- (gpointer)root_tree);
- gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 0);
- gtk_widget_show(button);
- tree_buttons->add_button = button;
-
- button = gtk_button_new_with_label("Remove Item(s)");
- gtk_widget_set_sensitive(button, FALSE);
- gtk_signal_connect(GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) cb_remove_item,
- (gpointer)root_tree);
- gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 0);
- gtk_widget_show(button);
- tree_buttons->remove_button = button;
-
- /* create separator */
- separator = gtk_hseparator_new();
- gtk_box_pack_start(GTK_BOX(box1), separator, FALSE, FALSE, 0);
- gtk_widget_show(separator);
-
- /* create button box */
- box2 = gtk_vbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(box1), box2, FALSE, FALSE, 0);
- gtk_container_border_width(GTK_CONTAINER(box2), 5);
- gtk_widget_show(box2);
-
- button = gtk_button_new_with_label("Close");
- gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 0);
- gtk_signal_connect_object(GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) gtk_widget_destroy,
- GTK_OBJECT(window));
- gtk_widget_show(button);
-
- gtk_widget_show(window);
-}
-
-static void
-cb_create_tree(GtkWidget* w)
-{
- guint selection_mode;
- guint view_line;
- guint draw_line;
- guint no_root_item;
- guint nb_item;
- guint recursion_level;
-
- /* get selection mode choice */
- if(GTK_TOGGLE_BUTTON(sTreeSampleSelection.single_button)->active)
- selection_mode = GTK_SELECTION_SINGLE;
- else
- if(GTK_TOGGLE_BUTTON(sTreeSampleSelection.browse_button)->active)
- selection_mode = GTK_SELECTION_BROWSE;
- else
- if(GTK_TOGGLE_BUTTON(sTreeSampleSelection.multiple_button)->active)
- selection_mode = GTK_SELECTION_MULTIPLE;
-
- /* get options choice */
- draw_line = GTK_TOGGLE_BUTTON(sTreeSampleSelection.draw_line_button)->active;
- view_line = GTK_TOGGLE_BUTTON(sTreeSampleSelection.view_line_button)->active;
- no_root_item = GTK_TOGGLE_BUTTON(sTreeSampleSelection.no_root_item_button)->active;
-
- /* get levels */
- nb_item = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(sTreeSampleSelection.nb_item_spinner));
- recursion_level = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(sTreeSampleSelection.recursion_spinner));
-
- create_tree_sample(selection_mode, draw_line, view_line, no_root_item, nb_item, recursion_level);
-}
-
-void
-create_tree_mode_window(void)
-{
- static GtkWidget* window;
- GtkWidget* box1;
- GtkWidget* box2;
- GtkWidget* box3;
- GtkWidget* box4;
- GtkWidget* box5;
- GtkWidget* button;
- GtkWidget* frame;
- GtkWidget* separator;
- GtkWidget* label;
- GtkWidget* spinner;
- GtkAdjustment *adj;
-
- if (!window)
- {
- /* create toplevel window */
- window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title(GTK_WINDOW(window), "Tree Mode Selection Window");
- gtk_signal_connect(GTK_OBJECT (window), "delete_event",
- (GtkSignalFunc) gtk_main_quit, NULL);
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window), &window);
- box1 = gtk_vbox_new(FALSE, 0);
- gtk_container_add(GTK_CONTAINER(window), box1);
- gtk_widget_show(box1);
-
- /* create upper box - selection box */
- box2 = gtk_vbox_new(FALSE, 5);
- gtk_box_pack_start(GTK_BOX(box1), box2, TRUE, TRUE, 0);
- gtk_container_border_width(GTK_CONTAINER(box2), 5);
- gtk_widget_show(box2);
-
- box3 = gtk_hbox_new(FALSE, 5);
- gtk_box_pack_start(GTK_BOX(box2), box3, TRUE, TRUE, 0);
- gtk_widget_show(box3);
-
- /* create selection mode frame */
- frame = gtk_frame_new("Selection Mode");
- gtk_box_pack_start(GTK_BOX(box3), frame, TRUE, TRUE, 0);
- gtk_widget_show(frame);
-
- box4 = gtk_vbox_new(FALSE, 0);
- gtk_container_add(GTK_CONTAINER(frame), box4);
- gtk_container_border_width(GTK_CONTAINER(box4), 5);
- gtk_widget_show(box4);
-
- /* create radio button */
- button = gtk_radio_button_new_with_label(NULL, "SINGLE");
- gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0);
- gtk_widget_show(button);
- sTreeSampleSelection.single_button = button;
-
- button = gtk_radio_button_new_with_label(gtk_radio_button_group (GTK_RADIO_BUTTON (button)),
- "BROWSE");
- gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0);
- gtk_widget_show(button);
- sTreeSampleSelection.browse_button = button;
-
- button = gtk_radio_button_new_with_label(gtk_radio_button_group (GTK_RADIO_BUTTON (button)),
- "MULTIPLE");
- gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0);
- gtk_widget_show(button);
- sTreeSampleSelection.multiple_button = button;
-
- sTreeSampleSelection.selection_mode_group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
-
- /* create option mode frame */
- frame = gtk_frame_new("Options");
- gtk_box_pack_start(GTK_BOX(box3), frame, TRUE, TRUE, 0);
- gtk_widget_show(frame);
-
- box4 = gtk_vbox_new(FALSE, 0);
- gtk_container_add(GTK_CONTAINER(frame), box4);
- gtk_container_border_width(GTK_CONTAINER(box4), 5);
- gtk_widget_show(box4);
-
- /* create check button */
- button = gtk_check_button_new_with_label("Draw line");
- gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0);
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), TRUE);
- gtk_widget_show(button);
- sTreeSampleSelection.draw_line_button = button;
-
- button = gtk_check_button_new_with_label("View Line mode");
- gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0);
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), TRUE);
- gtk_widget_show(button);
- sTreeSampleSelection.view_line_button = button;
-
- button = gtk_check_button_new_with_label("Without Root item");
- gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0);
- gtk_widget_show(button);
- sTreeSampleSelection.no_root_item_button = button;
-
- /* create recursion parameter */
- frame = gtk_frame_new("Size Parameters");
- gtk_box_pack_start(GTK_BOX(box2), frame, TRUE, TRUE, 0);
- gtk_widget_show(frame);
-
- box4 = gtk_hbox_new(FALSE, 5);
- gtk_container_add(GTK_CONTAINER(frame), box4);
- gtk_container_border_width(GTK_CONTAINER(box4), 5);
- gtk_widget_show(box4);
-
- /* create number of item spin button */
- box5 = gtk_hbox_new(FALSE, 5);
- gtk_box_pack_start(GTK_BOX(box4), box5, FALSE, FALSE, 0);
- gtk_widget_show(box5);
-
- label = gtk_label_new("Number of Item");
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
- gtk_box_pack_start (GTK_BOX (box5), label, FALSE, TRUE, 0);
- gtk_widget_show(label);
-
- adj = (GtkAdjustment *) gtk_adjustment_new ((gfloat)DEFAULT_NUMBER_OF_ITEM, 1.0, 255.0, 1.0,
- 5.0, 0.0);
- spinner = gtk_spin_button_new (adj, 0, 0);
- gtk_box_pack_start (GTK_BOX (box5), spinner, FALSE, TRUE, 0);
- gtk_widget_show(spinner);
- sTreeSampleSelection.nb_item_spinner = spinner;
-
- /* create recursion level spin button */
- box5 = gtk_hbox_new(FALSE, 5);
- gtk_box_pack_start(GTK_BOX(box4), box5, FALSE, FALSE, 0);
- gtk_widget_show(box5);
-
- label = gtk_label_new("Depth Level");
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
- gtk_box_pack_start (GTK_BOX (box5), label, FALSE, TRUE, 0);
- gtk_widget_show(label);
-
- adj = (GtkAdjustment *) gtk_adjustment_new ((gfloat)DEFAULT_RECURSION_LEVEL, 0.0, 255.0, 1.0,
- 5.0, 0.0);
- spinner = gtk_spin_button_new (adj, 0, 0);
- gtk_box_pack_start (GTK_BOX (box5), spinner, FALSE, TRUE, 0);
- gtk_widget_show(spinner);
- sTreeSampleSelection.recursion_spinner = spinner;
-
- /* create horizontal separator */
- separator = gtk_hseparator_new();
- gtk_box_pack_start(GTK_BOX(box1), separator, FALSE, FALSE, 0);
- gtk_widget_show(separator);
-
- /* create bottom button box */
- box2 = gtk_hbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(box1), box2, FALSE, FALSE, 0);
- gtk_container_border_width(GTK_CONTAINER(box2), 5);
- gtk_widget_show(box2);
-
- button = gtk_button_new_with_label("Create Tree Sample");
- gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 0);
- gtk_signal_connect(GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) cb_create_tree, NULL);
- gtk_widget_show(button);
-
- button = gtk_button_new_with_label("Close");
- gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 0);
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_widget_show(button);
-
- }
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-/* end of function used by tree demos */
-
-static void
-create_handle_box ()
-{
- static GtkWidget* window = NULL;
- GtkWidget *hbox;
- GtkWidget *toolbar;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title (GTK_WINDOW (window),
- "Handle Box Test");
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window), &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window), &window);
-
- gtk_container_border_width (GTK_CONTAINER (window), 20);
-
- hbox = gtk_handle_box_new ();
- gtk_container_add (GTK_CONTAINER (window), hbox);
- gtk_signal_connect (GTK_OBJECT (hbox),
- "child_attached",
- GTK_SIGNAL_FUNC (handle_box_child_signal),
- "attached");
- gtk_signal_connect (GTK_OBJECT (hbox),
- "child_detached",
- GTK_SIGNAL_FUNC (handle_box_child_signal),
- "detached");
- gtk_widget_show (hbox);
-
- toolbar = make_toolbar (window);
- gtk_container_add (GTK_CONTAINER (hbox), toolbar);
- gtk_widget_show (toolbar);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-
-static void
-reparent_label (GtkWidget *widget,
- GtkWidget *new_parent)
-{
- GtkWidget *label;
-
- label = gtk_object_get_user_data (GTK_OBJECT (widget));
-
- gtk_widget_reparent (label, new_parent);
-}
-
-static void
-set_parent_signal (GtkWidget *child,
- GtkWidget *old_parent,
- gpointer func_data)
-{
- g_print ("set_parent for \"%s\": new parent: \"%s\", old parent: \"%s\", data: %d\n",
- gtk_type_name (GTK_OBJECT_TYPE (child)),
- child->parent ? gtk_type_name (GTK_OBJECT_TYPE (child->parent)) : "NULL",
- old_parent ? gtk_type_name (GTK_OBJECT_TYPE (old_parent)) : "NULL",
- (gint) func_data);
-}
-
-static void
-create_reparent ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *box3;
- GtkWidget *frame;
- GtkWidget *button;
- GtkWidget *label;
- GtkWidget *separator;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "buttons");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- box2 = gtk_hbox_new (FALSE, 5);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- label = gtk_label_new ("Hello World");
-
- frame = gtk_frame_new ("Frame 1");
- gtk_box_pack_start (GTK_BOX (box2), frame, TRUE, TRUE, 0);
- gtk_widget_show (frame);
-
- box3 = gtk_vbox_new (FALSE, 5);
- gtk_container_border_width (GTK_CONTAINER (box3), 5);
- gtk_container_add (GTK_CONTAINER (frame), box3);
- gtk_widget_show (box3);
-
- button = gtk_button_new_with_label ("switch");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(reparent_label),
- box3);
- gtk_object_set_user_data (GTK_OBJECT (button), label);
- gtk_box_pack_start (GTK_BOX (box3), button, FALSE, TRUE, 0);
- gtk_widget_show (button);
-
- gtk_box_pack_start (GTK_BOX (box3), label, FALSE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT (label),
- "parent_set",
- GTK_SIGNAL_FUNC (set_parent_signal),
- (GtkObject*) 42);
- gtk_widget_show (label);
-
-
- frame = gtk_frame_new ("Frame 2");
- gtk_box_pack_start (GTK_BOX (box2), frame, TRUE, TRUE, 0);
- gtk_widget_show (frame);
-
- box3 = gtk_vbox_new (FALSE, 5);
- gtk_container_border_width (GTK_CONTAINER (box3), 5);
- gtk_container_add (GTK_CONTAINER (frame), box3);
- gtk_widget_show (box3);
-
- button = gtk_button_new_with_label ("switch");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(reparent_label),
- box3);
- gtk_object_set_user_data (GTK_OBJECT (button), label);
- gtk_box_pack_start (GTK_BOX (box3), button, FALSE, TRUE, 0);
- gtk_widget_show (button);
-
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-static void
-create_pixmap ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *box3;
- GtkWidget *button;
- GtkWidget *label;
- GtkWidget *separator;
- GtkWidget *pixmapwid;
- GdkPixmap *pixmap;
- GdkBitmap *mask;
- GtkStyle *style;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "pixmap");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
- gtk_widget_realize(window);
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
- button = gtk_button_new ();
- gtk_box_pack_start (GTK_BOX (box2), button, FALSE, FALSE, 0);
- gtk_widget_show (button);
-
- style=gtk_widget_get_style(button);
-
- pixmap = gdk_pixmap_create_from_xpm (window->window, &mask,
- &style->bg[GTK_STATE_NORMAL],
- "test.xpm");
- pixmapwid = gtk_pixmap_new (pixmap, mask);
-
- label = gtk_label_new ("Pixmap\ntest");
- box3 = gtk_hbox_new (FALSE, 0);
- gtk_container_border_width (GTK_CONTAINER (box3), 2);
- gtk_container_add (GTK_CONTAINER (box3), pixmapwid);
- gtk_container_add (GTK_CONTAINER (box3), label);
- gtk_container_add (GTK_CONTAINER (button), box3);
- gtk_widget_show (pixmapwid);
- gtk_widget_show (label);
- gtk_widget_show (box3);
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-static gint
-tips_query_widget_selected (GtkObject *object,
- GtkWidget *widget,
- const gchar *tip_text,
- const gchar *tip_private,
- GdkEventButton *event,
- gpointer func_data)
-{
- if (widget)
- g_print ("Help \"%s\" requested for <%s>\n",
- tip_private ? tip_private : "None",
- gtk_type_name (widget->object.klass->type));
-
- return TRUE;
-}
-
-static void
-create_tooltips ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *box3;
- GtkWidget *button;
- GtkWidget *frame;
- GtkWidget *tips_query;
- GtkWidget *separator;
- GtkTooltips *tooltips;
-
- if (!window)
- {
- window =
- gtk_widget_new (gtk_window_get_type (),
- "GtkWindow::type", GTK_WINDOW_TOPLEVEL,
- "GtkContainer::border_width", 0,
- "GtkWindow::title", "Tooltips",
- "GtkWindow::allow_shrink", TRUE,
- "GtkWindow::allow_grow", FALSE,
- "GtkWindow::auto_shrink", TRUE,
- "GtkWidget::width", 200,
- NULL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (destroy_tooltips),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC (gtk_true),
- &window);
-
- tooltips=gtk_tooltips_new();
- gtk_object_set_data (GTK_OBJECT (window), "tooltips", tooltips);
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_toggle_button_new_with_label ("button1");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- gtk_tooltips_set_tip (tooltips,button,"This is button 1", "ContextHelp/buttons/1");
-
- button = gtk_toggle_button_new_with_label ("button2");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- gtk_tooltips_set_tip (tooltips,button,"This is button 2", "ContextHelp/buttons/2");
-
- button = gtk_toggle_button_new_with_label ("button3");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- gtk_tooltips_set_tip (tooltips,
- button,
- "This is button 3. This is also a really long tooltip which probably won't fit on a single line and will therefore need to be wrapped. Hopefully the wrapping will work correctly.",
- "ContextHelp/buttons/3_long");
-
- box3 =
- gtk_widget_new (gtk_vbox_get_type (),
- "GtkBox::homogeneous", FALSE,
- "GtkBox::spacing", 5,
- "GtkContainer::border_width", 5,
- "GtkWidget::visible", TRUE,
- NULL);
-
- tips_query = gtk_tips_query_new ();
-
- button =
- gtk_widget_new (gtk_button_get_type (),
- "GtkButton::label", "[?]",
- "GtkWidget::visible", TRUE,
- "GtkWidget::parent", box3,
- "GtkObject::object_signal::clicked", gtk_tips_query_start_query, tips_query,
- NULL);
- gtk_box_set_child_packing (GTK_BOX (box3), button, FALSE, FALSE, 0, GTK_PACK_START);
- gtk_tooltips_set_tip (tooltips,
- button,
- "Start the Tooltips Inspector",
- "ContextHelp/buttons/?");
-
-
- gtk_widget_set (tips_query,
- "GtkWidget::visible", TRUE,
- "GtkWidget::parent", box3,
- "GtkTipsQuery::caller", button,
- "GtkObject::signal::widget_selected", tips_query_widget_selected, NULL,
- NULL);
-
- frame =
- gtk_widget_new (gtk_frame_get_type (),
- "GtkFrame::label", "ToolTips Inspector",
- "GtkFrame::label_xalign", (double) 0.5,
- "GtkContainer::border_width", 0,
- "GtkWidget::visible", TRUE,
- "GtkWidget::parent", box2,
- "GtkContainer::child", box3,
- NULL);
- gtk_box_set_child_packing (GTK_BOX (box2), frame, TRUE, TRUE, 10, GTK_PACK_START);
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
-
- gtk_tooltips_set_tip (tooltips, button, "Push this button to close window", "ContextHelp/buttons/Close");
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-static GtkWidget*
-create_menu (int depth)
-{
- GtkWidget *menu;
- GtkWidget *menuitem;
- GSList *group;
- char buf[32];
- int i, j;
-
- if (depth < 1)
- return NULL;
-
- menu = gtk_menu_new ();
- group = NULL;
-
- for (i = 0, j = 1; i < 5; i++, j++)
- {
- sprintf (buf, "item %2d - %d", depth, j);
- menuitem = gtk_radio_menu_item_new_with_label (group, buf);
- group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menuitem));
- if (depth % 2)
- gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (menuitem), TRUE);
- gtk_menu_append (GTK_MENU (menu), menuitem);
- gtk_widget_show (menuitem);
-
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (depth - 1));
- }
-
- return menu;
-}
-
-static void
-create_menus ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *button;
- GtkWidget *menu;
- GtkWidget *menubar;
- GtkWidget *menuitem;
- GtkWidget *optionmenu;
- GtkWidget *separator;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "menus");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- menubar = gtk_menu_bar_new ();
- gtk_box_pack_start (GTK_BOX (box1), menubar, FALSE, TRUE, 0);
- gtk_widget_show (menubar);
-
- menu = create_menu (2);
-
- menuitem = gtk_menu_item_new_with_label ("test\nline2");
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);
- gtk_menu_bar_append (GTK_MENU_BAR (menubar), menuitem);
- gtk_widget_show (menuitem);
-
- menuitem = gtk_menu_item_new_with_label ("foo");
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (3));
- gtk_menu_bar_append (GTK_MENU_BAR (menubar), menuitem);
- gtk_widget_show (menuitem);
-
- menuitem = gtk_menu_item_new_with_label ("bar");
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (4));
- gtk_menu_item_right_justify (GTK_MENU_ITEM (menuitem));
- gtk_menu_bar_append (GTK_MENU_BAR (menubar), menuitem);
- gtk_widget_show (menuitem);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- optionmenu = gtk_option_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), create_menu (1));
- gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), 4);
- gtk_box_pack_start (GTK_BOX (box2), optionmenu, TRUE, TRUE, 0);
- gtk_widget_show (optionmenu);
-
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-/*
- * GtkScrolledWindow
- */
-static void
-create_scrolled_windows ()
-{
- static GtkWidget *window;
- GtkWidget *scrolled_window;
- GtkWidget *table;
- GtkWidget *button;
- char buffer[32];
- int i, j;
-
- if (!window)
- {
- window = gtk_dialog_new ();
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "dialog");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
-
- scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_container_border_width (GTK_CONTAINER (scrolled_window), 10);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox),
- scrolled_window, TRUE, TRUE, 0);
- gtk_widget_show (scrolled_window);
-
- table = gtk_table_new (20, 20, FALSE);
- gtk_table_set_row_spacings (GTK_TABLE (table), 10);
- gtk_table_set_col_spacings (GTK_TABLE (table), 10);
- gtk_container_add (GTK_CONTAINER (scrolled_window), table);
- gtk_widget_show (table);
-
- for (i = 0; i < 20; i++)
- for (j = 0; j < 20; j++)
- {
- sprintf (buffer, "button (%d,%d)\n", i, j);
- button = gtk_toggle_button_new_with_label (buffer);
- gtk_table_attach_defaults (GTK_TABLE (table), button,
- i, i+1, j, j+1);
- gtk_widget_show (button);
- }
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
- button, TRUE, TRUE, 0);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-/*
- * GtkEntry
- */
-
-static void
-entry_toggle_editable (GtkWidget *checkbutton,
- GtkWidget *entry)
-{
- gtk_entry_set_editable(GTK_ENTRY(entry),
- GTK_TOGGLE_BUTTON(checkbutton)->active);
-}
-
-static void
-create_entry ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *editable_check;
- GtkWidget *entry, *cb;
- GtkWidget *button;
- GtkWidget *separator;
- GList *cbitems = NULL;
-
- if (!window)
- {
- cbitems = g_list_append(cbitems, "item1");
- cbitems = g_list_append(cbitems, "item2");
- cbitems = g_list_append(cbitems, "and item3");
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "entry");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
- entry = gtk_entry_new ();
- gtk_entry_set_text (GTK_ENTRY (entry), "hello world");
- gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1);
- gtk_box_pack_start (GTK_BOX (box2), entry, TRUE, TRUE, 0);
- gtk_widget_show (entry);
-
- cb = gtk_combo_new ();
- gtk_combo_set_popdown_strings (GTK_COMBO (cb), cbitems);
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO(cb)->entry), "hello world");
- gtk_editable_select_region (GTK_EDITABLE (GTK_COMBO(cb)->entry),
- 0, -1);
- gtk_box_pack_start (GTK_BOX (box2), cb, TRUE, TRUE, 0);
- gtk_widget_show (cb);
-
- editable_check = gtk_check_button_new_with_label("Editable");
- gtk_box_pack_start (GTK_BOX (box2), editable_check, FALSE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT(editable_check), "toggled",
- GTK_SIGNAL_FUNC(entry_toggle_editable), entry);
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(editable_check), TRUE);
- gtk_widget_show (editable_check);
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-GtkWidget *spinner1;
-
-static void
-toggle_snap (GtkWidget *widget, GtkSpinButton *spin)
-{
- if (GTK_TOGGLE_BUTTON (widget)->active)
- gtk_spin_button_set_update_policy (spin, GTK_UPDATE_ALWAYS
- | GTK_UPDATE_SNAP_TO_TICKS);
- else
- gtk_spin_button_set_update_policy (spin, GTK_UPDATE_ALWAYS);
-}
-
-static void
-change_digits (GtkWidget *widget, GtkSpinButton *spin)
-{
- gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spinner1),
- gtk_spin_button_get_value_as_int (spin));
-}
-
-static void
-create_spins ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *frame;
- GtkWidget *hbox;
- GtkWidget *main_vbox;
- GtkWidget *vbox;
- GtkWidget *vbox2;
- GtkWidget *spinner2;
- GtkWidget *spinner;
- GtkWidget *button;
- GtkWidget *label;
- GtkAdjustment *adj;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC (destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "GtkSpinButton");
-
- main_vbox = gtk_vbox_new (FALSE, 5);
- gtk_container_border_width (GTK_CONTAINER (main_vbox), 10);
- gtk_container_add (GTK_CONTAINER (window), main_vbox);
-
- frame = gtk_frame_new ("Not accelerated");
- gtk_box_pack_start (GTK_BOX (main_vbox), frame, TRUE, TRUE, 0);
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_border_width (GTK_CONTAINER (vbox), 5);
- gtk_container_add (GTK_CONTAINER (frame), vbox);
-
- /* Day, month, year spinners */
-
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 5);
-
- vbox2 = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, TRUE, 5);
-
- label = gtk_label_new ("Day :");
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
- gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
-
- adj = (GtkAdjustment *) gtk_adjustment_new (1.0, 1.0, 31.0, 1.0,
- 5.0, 0.0);
- spinner = gtk_spin_button_new (adj, 0, 0);
- gtk_box_pack_start (GTK_BOX (vbox2), spinner, FALSE, TRUE, 0);
-
- vbox2 = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, TRUE, 5);
-
- label = gtk_label_new ("Month :");
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
- gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
-
- adj = (GtkAdjustment *) gtk_adjustment_new (1.0, 1.0, 12.0, 1.0,
- 5.0, 0.0);
- spinner = gtk_spin_button_new (adj, 0, 0);
- gtk_box_pack_start (GTK_BOX (vbox2), spinner, FALSE, TRUE, 0);
-
- vbox2 = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, TRUE, 5);
-
- label = gtk_label_new ("Year :");
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
- gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
-
- adj = (GtkAdjustment *) gtk_adjustment_new (1998.0, 0.0, 2100.0,
- 1.0, 100.0, 0.0);
- spinner = gtk_spin_button_new (adj, 0, 0);
- gtk_widget_set_usize (spinner, 55, 0);
- gtk_box_pack_start (GTK_BOX (vbox2), spinner, FALSE, TRUE, 0);
-
- frame = gtk_frame_new ("Accelerated");
- gtk_box_pack_start (GTK_BOX (main_vbox), frame, TRUE, TRUE, 0);
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_border_width (GTK_CONTAINER (vbox), 5);
- gtk_container_add (GTK_CONTAINER (frame), vbox);
-
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 5);
-
- vbox2 = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, TRUE, 5);
-
- label = gtk_label_new ("Value :");
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
- gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
-
- adj = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.0, 10000.0,
- 1.0, 100.0, 0.0);
- spinner1 = gtk_spin_button_new (adj, 1.0, 3);
- gtk_widget_set_usize (spinner1, 120, 0);
- gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (spinner1),
- GTK_UPDATE_ALWAYS);
- gtk_box_pack_start (GTK_BOX (vbox2), spinner1, FALSE, TRUE, 0);
-
- vbox2 = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, TRUE, 0);
-
- label = gtk_label_new ("Digits :");
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
- gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
-
- adj = (GtkAdjustment *) gtk_adjustment_new (3.0, 0.0, 8.0,
- 1.0, 3.0, 0.0);
- spinner2 = gtk_spin_button_new (adj, 0.0, 0);
- gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
- GTK_SIGNAL_FUNC (change_digits),
- (gpointer) spinner2);
- gtk_box_pack_start (GTK_BOX (vbox2), spinner2, FALSE, TRUE, 0);
-
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 5);
-
- button = gtk_check_button_new_with_label ("Snap to ticks");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (toggle_snap),
- spinner1);
- gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE);
-
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, TRUE, 0);
-
- button = gtk_button_new_with_label ("Close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show_all (window);
- else
- gtk_widget_destroy (window);
-}
-
-/*
- * GtkList
- */
-static void
-list_add (GtkWidget *widget,
- GtkWidget *list)
-{
- static int i = 1;
- gchar buffer[64];
- GtkWidget *list_item;
-
- sprintf (buffer, "added item %d", i++);
- list_item = gtk_list_item_new_with_label (buffer);
- gtk_widget_show (list_item);
- gtk_container_add (GTK_CONTAINER (list), list_item);
-}
-
-static void
-list_remove (GtkWidget *widget,
- GtkWidget *list)
-{
- GList *tmp_list;
- GList *clear_list;
-
- tmp_list = GTK_LIST (list)->selection;
- clear_list = NULL;
-
- while (tmp_list)
- {
- clear_list = g_list_prepend (clear_list, tmp_list->data);
- tmp_list = tmp_list->next;
- }
-
- clear_list = g_list_reverse (clear_list);
-
- gtk_list_remove_items (GTK_LIST (list), clear_list);
-
- g_list_free (clear_list);
-}
-
-static void
-list_clear (GtkWidget *widget,
- GtkWidget *list)
-{
- gtk_list_clear_items (GTK_LIST (list), 3 - 1, 5 - 1);
-}
-
-static void
-create_list ()
-{
- static GtkWidget *window = NULL;
- static char *list_items[] =
- {
- "hello",
- "world",
- "blah",
- "foo",
- "bar",
- "argh",
- "spencer",
- "is a",
- "wussy",
- "programmer",
- };
- static int nlist_items = sizeof (list_items) / sizeof (list_items[0]);
-
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *scrolled_win;
- GtkWidget *list;
- GtkWidget *list_item;
- GtkWidget *button;
- GtkWidget *separator;
- int i;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "list");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- scrolled_win = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_box_pack_start (GTK_BOX (box2), scrolled_win, TRUE, TRUE, 0);
- gtk_widget_show (scrolled_win);
-
- list = gtk_list_new ();
- gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_MULTIPLE);
- gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_BROWSE);
- gtk_container_add (GTK_CONTAINER (scrolled_win), list);
- gtk_widget_show (list);
-
- for (i = 0; i < nlist_items; i++)
- {
- list_item = gtk_list_item_new_with_label (list_items[i]);
- gtk_container_add (GTK_CONTAINER (list), list_item);
- gtk_widget_show (list_item);
- }
-
- button = gtk_button_new_with_label ("add");
- GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS);
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(list_add),
- list);
- gtk_box_pack_start (GTK_BOX (box2), button, FALSE, TRUE, 0);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("clear items 3 - 5");
- GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS);
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(list_clear),
- list);
- gtk_box_pack_start (GTK_BOX (box2), button, FALSE, TRUE, 0);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("remove");
- GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS);
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(list_remove),
- list);
- gtk_box_pack_start (GTK_BOX (box2), button, FALSE, TRUE, 0);
- gtk_widget_show (button);
-
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-/*
- * GtkCList
- */
-#define TESTGTK_CLIST_COLUMNS 7
-static gint clist_rows = 0;
-static gint clist_selected_row = 0;
-
-static void
-add1000_clist (GtkWidget *widget, gpointer data)
-{
- gint i, row;
- char text[TESTGTK_CLIST_COLUMNS][50];
- char *texts[TESTGTK_CLIST_COLUMNS];
- GdkBitmap *mask;
- GdkPixmap *pixmap;
-
- pixmap = gdk_pixmap_create_from_xpm (GTK_CLIST (data)->clist_window,
- &mask,
- &GTK_WIDGET (data)->style->white,
- "test.xpm");
-
- for (i = 0; i < TESTGTK_CLIST_COLUMNS; i++)
- {
- texts[i] = text[i];
- sprintf (text[i], "Column %d", i);
- }
-
- texts[3] = NULL;
- sprintf (text[1], "Right");
- sprintf (text[2], "Center");
-
- gtk_clist_freeze (GTK_CLIST (data));
- for (i = 0; i < 1000; i++)
- {
- sprintf (text[0], "Row %d", clist_rows++);
- row = gtk_clist_append (GTK_CLIST (data), texts);
- gtk_clist_set_pixtext (GTK_CLIST (data), row, 3, "Testing", 5, pixmap, mask);
- }
- gtk_clist_thaw (GTK_CLIST (data));
-
- gdk_pixmap_unref (pixmap);
- gdk_bitmap_unref (mask);
-}
-
-static void
-add10000_clist (GtkWidget *widget, gpointer data)
-{
- gint i;
- char text[TESTGTK_CLIST_COLUMNS][50];
- char *texts[TESTGTK_CLIST_COLUMNS];
-
- for (i = 0; i < TESTGTK_CLIST_COLUMNS; i++)
- {
- texts[i] = text[i];
- sprintf (text[i], "Column %d", i);
- }
-
- sprintf (text[1], "Right");
- sprintf (text[2], "Center");
-
- gtk_clist_freeze (GTK_CLIST (data));
- for (i = 0; i < 10000; i++)
- {
- sprintf (text[0], "Row %d", clist_rows++);
- gtk_clist_append (GTK_CLIST (data), texts);
- }
- gtk_clist_thaw (GTK_CLIST (data));
-
-}
-
-void
-clear_clist (GtkWidget *widget, gpointer data)
-{
- gtk_clist_clear (GTK_CLIST (data));
- clist_rows = 0;
-}
-
-void
-remove_row_clist (GtkWidget *widget, gpointer data)
-{
- gtk_clist_remove (GTK_CLIST (data), clist_selected_row);
- clist_rows--;
-}
-
-void
-show_titles_clist (GtkWidget *widget, gpointer data)
-{
- gtk_clist_column_titles_show (GTK_CLIST (data));
-}
-
-void
-hide_titles_clist (GtkWidget *widget, gpointer data)
-{
- gtk_clist_column_titles_hide (GTK_CLIST (data));
-}
-
-void
-select_clist (GtkWidget *widget,
- gint row,
- gint column,
- GdkEventButton * bevent)
-{
- gint i;
- guint8 spacing;
- gchar *text;
- GdkPixmap *pixmap;
- GdkBitmap *mask;
- GList *list;
-
- g_print ("GtkCList Selection: row %d column %d button %d\n",
- row, column, bevent ? bevent->button : 0);
-
- for (i = 0; i < TESTGTK_CLIST_COLUMNS; i++)
- {
- switch (gtk_clist_get_cell_type (GTK_CLIST (widget), row, i))
- {
- case GTK_CELL_TEXT:
- g_print ("CELL %d GTK_CELL_TEXT\n", i);
- gtk_clist_get_text (GTK_CLIST (widget), row, i, &text);
- g_print ("TEXT: %s\n", text);
- break;
-
- case GTK_CELL_PIXMAP:
- g_print ("CELL %d GTK_CELL_PIXMAP\n", i);
- gtk_clist_get_pixmap (GTK_CLIST (widget), row, i, &pixmap, &mask);
- g_print ("PIXMAP: %d\n", (int) pixmap);
- g_print ("MASK: %d\n", (int) mask);
- break;
-
- case GTK_CELL_PIXTEXT:
- g_print ("CELL %d GTK_CELL_PIXTEXT\n", i);
- gtk_clist_get_pixtext (GTK_CLIST (widget), row, i, &text, &spacing, &pixmap, &mask);
- g_print ("TEXT: %s\n", text);
- g_print ("SPACING: %d\n", spacing);
- g_print ("PIXMAP: %d\n", (int) pixmap);
- g_print ("MASK: %d\n", (int) mask);
- break;
-
- default:
- break;
- }
- }
-
- /* print selections list */
- g_print ("\nSelected Rows:");
- list = GTK_CLIST (widget)->selection;
- while (list)
- {
- g_print (" %d ", (gint) list->data);
- list = list->next;
- }
-
- g_print ("\n\n\n");
-
- clist_selected_row = row;
-}
-
-void
-unselect_clist (GtkWidget *widget,
- gint row,
- gint column,
- GdkEventButton * bevent)
-{
- gint i;
- guint8 spacing;
- gchar *text;
- GdkPixmap *pixmap;
- GdkBitmap *mask;
- GList *list;
-
- g_print ("GtkCList Unselection: row %d column %d button %d\n",
- row, column, bevent ? bevent->button : 0);
-
- for (i = 0; i < TESTGTK_CLIST_COLUMNS; i++)
- {
- switch (gtk_clist_get_cell_type (GTK_CLIST (widget), row, i))
- {
- case GTK_CELL_TEXT:
- g_print ("CELL %d GTK_CELL_TEXT\n", i);
- gtk_clist_get_text (GTK_CLIST (widget), row, i, &text);
- g_print ("TEXT: %s\n", text);
- break;
-
- case GTK_CELL_PIXMAP:
- g_print ("CELL %d GTK_CELL_PIXMAP\n", i);
- gtk_clist_get_pixmap (GTK_CLIST (widget), row, i, &pixmap, &mask);
- g_print ("PIXMAP: %d\n", (int) pixmap);
- g_print ("MASK: %d\n", (int) mask);
- break;
-
- case GTK_CELL_PIXTEXT:
- g_print ("CELL %d GTK_CELL_PIXTEXT\n", i);
- gtk_clist_get_pixtext (GTK_CLIST (widget), row, i, &text, &spacing, &pixmap, &mask);
- g_print ("TEXT: %s\n", text);
- g_print ("SPACING: %d\n", spacing);
- g_print ("PIXMAP: %d\n", (int) pixmap);
- g_print ("MASK: %d\n", (int) mask);
- break;
-
- default:
- break;
- }
- }
-
- /* print selections list */
- g_print ("\nSelected Rows:");
- list = GTK_CLIST (widget)->selection;
- while (list)
- {
- g_print (" %d ", (gint) list->data);
- list = list->next;
- }
-
- g_print ("\n\n\n");
-
- clist_selected_row = row;
-}
-
-void
-insert_row_clist (GtkWidget *widget, gpointer data)
-{
- static char *text[] =
- {
- "This",
- "is",
- "a",
- "inserted",
- "row",
- "la la la la la",
- "la la la la"
- };
-
- gtk_clist_insert (GTK_CLIST (data), clist_selected_row, text);
- clist_rows++;
-}
-
-void
-create_clist ()
-{
- gint i;
- static GtkWidget *window = NULL;
-
- static char *titles[] =
- {
- "Title 0",
- "Title 1",
- "Title 2",
- "Title 3",
- "Title 4",
- "Title 5",
- "Title 6"
- };
-
- char text[TESTGTK_CLIST_COLUMNS][50];
- char *texts[TESTGTK_CLIST_COLUMNS];
-
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *clist;
- GtkWidget *button;
- GtkWidget *separator;
-
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "clist");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- box2 = gtk_hbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
- gtk_widget_show (box2);
-
- /* create GtkCList here so we have a pointer to throw at the
- * button callbacks -- more is done with it later */
- clist = gtk_clist_new_with_titles (TESTGTK_CLIST_COLUMNS, titles);
- /*clist = gtk_clist_new (TESTGTK_CLIST_COLUMNS);*/
-
- /* control buttons */
- button = gtk_button_new_with_label ("Add 1,000 Rows With Pixmaps");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
-
- gtk_signal_connect (GTK_OBJECT (button),
- "clicked",
- (GtkSignalFunc) add1000_clist,
- (gpointer) clist);
-
- gtk_widget_show (button);
-
-
- button = gtk_button_new_with_label ("Add 10,000 Rows");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
-
- gtk_signal_connect (GTK_OBJECT (button),
- "clicked",
- (GtkSignalFunc) add10000_clist,
- (gpointer) clist);
-
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Clear List");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
-
- gtk_signal_connect (GTK_OBJECT (button),
- "clicked",
- (GtkSignalFunc) clear_clist,
- (gpointer) clist);
-
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Remove Row");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
-
- gtk_signal_connect (GTK_OBJECT (button),
- "clicked",
- (GtkSignalFunc) remove_row_clist,
- (gpointer) clist);
-
- gtk_widget_show (button);
-
- /* second layer of buttons */
- box2 = gtk_hbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
- gtk_widget_show (box2);
-
- button = gtk_button_new_with_label ("Insert Row");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
-
- gtk_signal_connect (GTK_OBJECT (button),
- "clicked",
- (GtkSignalFunc) insert_row_clist,
- (gpointer) clist);
-
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Show Title Buttons");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
-
- gtk_signal_connect (GTK_OBJECT (button),
- "clicked",
- (GtkSignalFunc) show_titles_clist,
- (gpointer) clist);
-
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Hide Title Buttons");
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
-
- gtk_signal_connect (GTK_OBJECT (button),
- "clicked",
- (GtkSignalFunc) hide_titles_clist,
- (gpointer) clist);
-
- gtk_widget_show (button);
-
- /* vbox for the list itself */
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
- /*
- * the rest of the clist configuration
- */
- gtk_clist_set_row_height (GTK_CLIST (clist), 20);
-
- gtk_signal_connect (GTK_OBJECT (clist),
- "select_row",
- (GtkSignalFunc) select_clist,
- NULL);
-
- gtk_signal_connect (GTK_OBJECT (clist),
- "unselect_row",
- (GtkSignalFunc) unselect_clist,
- NULL);
-
- gtk_clist_set_column_width (GTK_CLIST (clist), 0, 100);
-
- for (i = 1; i < TESTGTK_CLIST_COLUMNS; i++)
- gtk_clist_set_column_width (GTK_CLIST (clist), i, 80);
-
- gtk_clist_set_selection_mode (GTK_CLIST (clist), GTK_SELECTION_BROWSE);
- gtk_clist_set_policy (GTK_CLIST (clist),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
-
- gtk_clist_set_policy (GTK_CLIST (clist), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-
- gtk_clist_set_column_justification (GTK_CLIST (clist), 1, GTK_JUSTIFY_RIGHT);
- gtk_clist_set_column_justification (GTK_CLIST (clist), 2, GTK_JUSTIFY_CENTER);
-
- for (i = 0; i < TESTGTK_CLIST_COLUMNS; i++)
- {
- texts[i] = text[i];
- sprintf (text[i], "Column %d", i);
- }
-
- sprintf (text[1], "Right");
- sprintf (text[2], "Center");
-
- for (i = 0; i < 100; i++)
- {
- sprintf (text[0], "Row %d", clist_rows++);
- gtk_clist_append (GTK_CLIST (clist), texts);
- }
-
- gtk_container_border_width (GTK_CONTAINER (clist), 5);
- gtk_box_pack_start (GTK_BOX (box2), clist, TRUE, TRUE, 0);
- gtk_widget_show (clist);
-
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
-
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
-
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- {
- clist_rows = 0;
- gtk_widget_destroy (window);
- }
-
-}
-
-/*
- * GtkColorSelect
- */
-void
-color_selection_ok (GtkWidget *w,
- GtkColorSelectionDialog *cs)
-{
- GtkColorSelection *colorsel;
- gdouble color[4];
-
- colorsel=GTK_COLOR_SELECTION(cs->colorsel);
-
- gtk_color_selection_get_color(colorsel,color);
- gtk_color_selection_set_color(colorsel,color);
-}
-
-void
-color_selection_changed (GtkWidget *w,
- GtkColorSelectionDialog *cs)
-{
- GtkColorSelection *colorsel;
- gdouble color[4];
-
- colorsel=GTK_COLOR_SELECTION(cs->colorsel);
- gtk_color_selection_get_color(colorsel,color);
-}
-
-void
-create_color_selection ()
-{
- static GtkWidget *window = NULL;
-
- if (!window)
- {
- gtk_preview_set_install_cmap (TRUE);
- gtk_widget_push_visual (gtk_preview_get_visual ());
- gtk_widget_push_colormap (gtk_preview_get_cmap ());
-
- window = gtk_color_selection_dialog_new ("color selection dialog");
-
- gtk_color_selection_set_opacity (
- GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (window)->colorsel),
- TRUE);
-
- gtk_color_selection_set_update_policy(
- GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (window)->colorsel),
- GTK_UPDATE_CONTINUOUS);
-
- gtk_window_position (GTK_WINDOW (window), GTK_WIN_POS_MOUSE);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_signal_connect (
- GTK_OBJECT (GTK_COLOR_SELECTION_DIALOG (window)->colorsel),
- "color_changed",
- GTK_SIGNAL_FUNC(color_selection_changed),
- window);
-
- gtk_signal_connect (
- GTK_OBJECT (GTK_COLOR_SELECTION_DIALOG (window)->ok_button),
- "clicked",
- GTK_SIGNAL_FUNC(color_selection_ok),
- window);
-
- gtk_signal_connect_object (
- GTK_OBJECT (GTK_COLOR_SELECTION_DIALOG (window)->cancel_button),
- "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
-
- gtk_widget_pop_colormap ();
- gtk_widget_pop_visual ();
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-void
-file_selection_hide_fileops (GtkWidget *widget,
- GtkFileSelection *fs)
-{
- gtk_file_selection_hide_fileop_buttons (fs);
-}
-
-void
-file_selection_ok (GtkWidget *w,
- GtkFileSelection *fs)
-{
- g_print ("%s\n", gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs)));
- gtk_widget_destroy (GTK_WIDGET (fs));
-}
-
-void
-create_file_selection ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *button;
-
- if (!window)
- {
- window = gtk_file_selection_new ("file selection dialog");
-
- gtk_file_selection_hide_fileop_buttons (GTK_FILE_SELECTION (window));
-
- gtk_window_position (GTK_WINDOW (window), GTK_WIN_POS_MOUSE);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (window)->ok_button),
- "clicked", GTK_SIGNAL_FUNC(file_selection_ok),
- window);
- gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (window)->cancel_button),
- "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
-
- button = gtk_button_new_with_label ("Hide Fileops");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) file_selection_hide_fileops,
- (gpointer) window);
- gtk_box_pack_start (GTK_BOX (GTK_FILE_SELECTION (window)->action_area),
- button, FALSE, FALSE, 0);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Show Fileops");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- (GtkSignalFunc) gtk_file_selection_show_fileop_buttons,
- (gpointer) window);
- gtk_box_pack_start (GTK_BOX (GTK_FILE_SELECTION (window)->action_area),
- button, FALSE, FALSE, 0);
- gtk_widget_show (button);
-
-
-
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-
-/*
- * GtkDialog
- */
-static GtkWidget *dialog_window = NULL;
-
-void
-label_toggle (GtkWidget *widget,
- GtkWidget **label)
-{
- if (!(*label))
- {
- *label = gtk_label_new ("Dialog Test");
- gtk_signal_connect (GTK_OBJECT (*label),
- "destroy",
- GTK_SIGNAL_FUNC (gtk_widget_destroyed),
- label);
- gtk_misc_set_padding (GTK_MISC (*label), 10, 10);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_window)->vbox),
- *label, TRUE, TRUE, 0);
- gtk_widget_show (*label);
- }
- else
- gtk_widget_destroy (*label);
-}
-
-void
-create_dialog ()
-{
- static GtkWidget *label;
- GtkWidget *button;
-
- if (!dialog_window)
- {
- dialog_window = gtk_dialog_new ();
-
- gtk_signal_connect (GTK_OBJECT (dialog_window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &dialog_window);
- gtk_signal_connect (GTK_OBJECT (dialog_window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &dialog_window);
-
- gtk_window_set_title (GTK_WINDOW (dialog_window), "dialog");
- gtk_container_border_width (GTK_CONTAINER (dialog_window), 0);
-
- button = gtk_button_new_with_label ("OK");
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_window)->action_area),
- button, TRUE, TRUE, 0);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Toggle");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (label_toggle),
- &label);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_window)->action_area),
- button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- label = NULL;
- }
-
- if (!GTK_WIDGET_VISIBLE (dialog_window))
- gtk_widget_show (dialog_window);
- else
- gtk_widget_destroy (dialog_window);
-}
-
-
-/*
- * GtkRange
- */
-void
-create_range_controls ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *button;
- GtkWidget *scrollbar;
- GtkWidget *scale;
- GtkWidget *separator;
- GtkObject *adjustment;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "range controls");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- adjustment = gtk_adjustment_new (0.0, 0.0, 101.0, 0.1, 1.0, 1.0);
-
- scale = gtk_hscale_new (GTK_ADJUSTMENT (adjustment));
- gtk_widget_set_usize (GTK_WIDGET (scale), 150, 30);
- gtk_range_set_update_policy (GTK_RANGE (scale), GTK_UPDATE_DELAYED);
- gtk_scale_set_digits (GTK_SCALE (scale), 1);
- gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
- gtk_box_pack_start (GTK_BOX (box2), scale, TRUE, TRUE, 0);
- gtk_widget_show (scale);
-
- scrollbar = gtk_hscrollbar_new (GTK_ADJUSTMENT (adjustment));
- gtk_range_set_update_policy (GTK_RANGE (scrollbar),
- GTK_UPDATE_CONTINUOUS);
- gtk_box_pack_start (GTK_BOX (box2), scrollbar, TRUE, TRUE, 0);
- gtk_widget_show (scrollbar);
-
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-
-/*
- * GtkRulers
- */
-void
-create_rulers ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *table;
- GtkWidget *ruler;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "rulers");
- gtk_widget_set_usize (window, 300, 300);
- gtk_widget_set_events (window,
- GDK_POINTER_MOTION_MASK
- | GDK_POINTER_MOTION_HINT_MASK);
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
- table = gtk_table_new (2, 2, FALSE);
- gtk_container_add (GTK_CONTAINER (window), table);
- gtk_widget_show (table);
-
- ruler = gtk_hruler_new ();
- gtk_ruler_set_range (GTK_RULER (ruler), 5, 15, 0, 20);
-
- gtk_signal_connect_object (
- GTK_OBJECT (window),
- "motion_notify_event",
- GTK_SIGNAL_FUNC(
- GTK_WIDGET_CLASS (GTK_OBJECT (ruler)->klass)->motion_notify_event),
- GTK_OBJECT (ruler));
-
- gtk_table_attach (GTK_TABLE (table), ruler, 1, 2, 0, 1,
- GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
- gtk_widget_show (ruler);
-
-
- ruler = gtk_vruler_new ();
- gtk_ruler_set_range (GTK_RULER (ruler), 5, 15, 0, 20);
-
- gtk_signal_connect_object (
- GTK_OBJECT (window),
- "motion_notify_event",
- GTK_SIGNAL_FUNC (GTK_WIDGET_CLASS (GTK_OBJECT (ruler)->klass)->motion_notify_event),
- GTK_OBJECT (ruler));
-
- gtk_table_attach (GTK_TABLE (table), ruler, 0, 1, 1, 2,
- GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (ruler);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-
-static void
-text_toggle_editable (GtkWidget *checkbutton,
- GtkWidget *text)
-{
- gtk_text_set_editable(GTK_TEXT(text),
- GTK_TOGGLE_BUTTON(checkbutton)->active);
-}
-
-/*
- * GtkText
- */
-void
-create_text ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *button;
- GtkWidget *editable_check;
- GtkWidget *separator;
- GtkWidget *table;
- GtkWidget *hscrollbar;
- GtkWidget *vscrollbar;
- GtkWidget *text;
-
- FILE *infile;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_widget_set_name (window, "text window");
- gtk_widget_set_usize (window, 500, 500);
- gtk_window_set_policy (GTK_WINDOW(window), TRUE, TRUE, FALSE);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "test");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- table = gtk_table_new (2, 2, FALSE);
- gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
- gtk_table_set_col_spacing (GTK_TABLE (table), 0, 2);
- gtk_box_pack_start (GTK_BOX (box2), table, TRUE, TRUE, 0);
- gtk_widget_show (table);
-
- text = gtk_text_new (NULL, NULL);
- gtk_text_set_editable (GTK_TEXT (text), TRUE);
- gtk_table_attach (GTK_TABLE (table), text, 0, 1, 0, 1,
- GTK_EXPAND | GTK_SHRINK | GTK_FILL,
- GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
- gtk_widget_show (text);
-
- hscrollbar = gtk_hscrollbar_new (GTK_TEXT (text)->hadj);
- gtk_table_attach (GTK_TABLE (table), hscrollbar, 0, 1, 1, 2,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_FILL, 0, 0);
- gtk_widget_show (hscrollbar);
-
- vscrollbar = gtk_vscrollbar_new (GTK_TEXT (text)->vadj);
- gtk_table_attach (GTK_TABLE (table), vscrollbar, 1, 2, 0, 1,
- GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
- gtk_widget_show (vscrollbar);
-
- gtk_text_freeze (GTK_TEXT (text));
-
- gtk_widget_realize (text);
-
- infile = fopen("testgtk.c", "r");
-
- if (infile)
- {
- char buffer[1024];
- int nchars;
-
- while (1)
- {
- nchars = fread(buffer, 1, 1024, infile);
- gtk_text_insert (GTK_TEXT (text), NULL, NULL,
- NULL, buffer, nchars);
-
- if (nchars < 1024)
- break;
- }
-
- fclose (infile);
- }
-
- gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
- "And even ", -1);
- gtk_text_insert (GTK_TEXT (text), NULL, &text->style->bg[GTK_STATE_NORMAL], NULL,
- "colored", -1);
- gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
- "text", -1);
-
- gtk_text_thaw (GTK_TEXT (text));
-
- editable_check = gtk_check_button_new_with_label("Editable");
- gtk_box_pack_start (GTK_BOX (box2), editable_check, FALSE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT(editable_check), "toggled",
- GTK_SIGNAL_FUNC(text_toggle_editable), text);
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(editable_check), TRUE);
- gtk_widget_show (editable_check);
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-
-/*
- * GtkNotebook
- */
-
-GdkPixmap *book_open;
-GdkPixmap *book_closed;
-GdkBitmap *book_open_mask;
-GdkBitmap *book_closed_mask;
-
-static char * book_open_xpm[] = {
-"16 16 4 1",
-" c None s None",
-". c black",
-"X c #808080",
-"o c white",
-" ",
-" .. ",
-" .Xo. ... ",
-" .Xoo. ..oo. ",
-" .Xooo.Xooo... ",
-" .Xooo.oooo.X. ",
-" .Xooo.Xooo.X. ",
-" .Xooo.oooo.X. ",
-" .Xooo.Xooo.X. ",
-" .Xooo.oooo.X. ",
-" .Xoo.Xoo..X. ",
-" .Xo.o..ooX. ",
-" .X..XXXXX. ",
-" ..X....... ",
-" .. ",
-" "};
-
-static char * book_closed_xpm[] = {
-"16 16 6 1",
-" c None s None",
-". c black",
-"X c red",
-"o c yellow",
-"O c #808080",
-"# c white",
-" ",
-" .. ",
-" ..XX. ",
-" ..XXXXX. ",
-" ..XXXXXXXX. ",
-".ooXXXXXXXXX. ",
-"..ooXXXXXXXXX. ",
-".X.ooXXXXXXXXX. ",
-".XX.ooXXXXXX.. ",
-" .XX.ooXXX..#O ",
-" .XX.oo..##OO. ",
-" .XX..##OO.. ",
-" .X.#OO.. ",
-" ..O.. ",
-" .. ",
-" "};
-
-static void
-page_switch (GtkWidget *widget, GtkNotebookPage *page, gint page_num)
-{
- GtkNotebookPage *oldpage;
- GtkWidget *pixwid;
-
- oldpage = GTK_NOTEBOOK (widget)->cur_page;
-
- if (page == oldpage)
- return;
-
- pixwid = ((GtkBoxChild*)(GTK_BOX (page->tab_label)->children->data))->widget;
- gtk_pixmap_set (GTK_PIXMAP (pixwid), book_open, book_open_mask);
- pixwid = ((GtkBoxChild*) (GTK_BOX (page->menu_label)->children->data))->widget;
- gtk_pixmap_set (GTK_PIXMAP (pixwid), book_open, book_open_mask);
-
- if (oldpage)
- {
- pixwid = ((GtkBoxChild*) (GTK_BOX
- (oldpage->tab_label)->children->data))->widget;
- gtk_pixmap_set (GTK_PIXMAP (pixwid), book_closed, book_closed_mask);
- pixwid = ((GtkBoxChild*) (GTK_BOX (oldpage->menu_label)->children->data))->widget;
- gtk_pixmap_set (GTK_PIXMAP (pixwid), book_closed, book_closed_mask);
- }
-}
-
-static void
-create_pages (GtkNotebook *notebook, gint start, gint end)
-{
- GtkWidget *child = NULL;
- GtkWidget *label;
- GtkWidget *entry;
- GtkWidget *box;
- GtkWidget *hbox;
- GtkWidget *label_box;
- GtkWidget *menu_box;
- GtkWidget *button;
- GtkWidget *pixwid;
- gint i;
- char buffer[32];
-
- for (i = start; i <= end; i++)
- {
- sprintf (buffer, "Page %d", i);
-
- switch (i%4)
- {
- case 3:
- child = gtk_button_new_with_label (buffer);
- gtk_container_border_width (GTK_CONTAINER(child), 10);
- break;
- case 2:
- child = gtk_label_new (buffer);
- break;
- case 1:
- child = gtk_frame_new (buffer);
- gtk_container_border_width (GTK_CONTAINER (child), 10);
-
- box = gtk_vbox_new (TRUE,0);
- gtk_container_border_width (GTK_CONTAINER (box), 10);
- gtk_container_add (GTK_CONTAINER (child), box);
-
- label = gtk_label_new (buffer);
- gtk_box_pack_start (GTK_BOX(box), label, TRUE, TRUE, 5);
-
- entry = gtk_entry_new ();
- gtk_box_pack_start (GTK_BOX(box), entry, TRUE, TRUE, 5);
-
- hbox = gtk_hbox_new (TRUE,0);
- gtk_box_pack_start (GTK_BOX(box), hbox, TRUE, TRUE, 5);
-
- button = gtk_button_new_with_label ("Ok");
- gtk_box_pack_start (GTK_BOX(hbox), button, TRUE, TRUE, 5);
-
- button = gtk_button_new_with_label ("Cancel");
- gtk_box_pack_start (GTK_BOX(hbox), button, TRUE, TRUE, 5);
- break;
- case 0:
- child = gtk_frame_new (buffer);
- gtk_container_border_width (GTK_CONTAINER (child), 10);
-
- label = gtk_label_new (buffer);
- gtk_container_add (GTK_CONTAINER (child), label);
- break;
- }
-
- gtk_widget_show_all (child);
-
- label_box = gtk_hbox_new (FALSE, 0);
- pixwid = gtk_pixmap_new (book_closed, book_closed_mask);
- gtk_box_pack_start (GTK_BOX (label_box), pixwid, FALSE, TRUE, 0);
- gtk_misc_set_padding (GTK_MISC (pixwid), 3, 1);
- label = gtk_label_new (buffer);
- gtk_box_pack_start (GTK_BOX (label_box), label, FALSE, TRUE, 0);
- gtk_widget_show_all (label_box);
-
- menu_box = gtk_hbox_new (FALSE, 0);
- pixwid = gtk_pixmap_new (book_closed, book_closed_mask);
- gtk_box_pack_start (GTK_BOX (menu_box), pixwid, FALSE, TRUE, 0);
- gtk_misc_set_padding (GTK_MISC (pixwid), 3, 1);
- label = gtk_label_new (buffer);
- gtk_box_pack_start (GTK_BOX (menu_box), label, FALSE, TRUE, 0);
- gtk_widget_show_all (menu_box);
-
- gtk_notebook_append_page_menu (notebook, child, label_box, menu_box);
- }
-}
-
-static void
-rotate_notebook (GtkButton *button,
- GtkNotebook *notebook)
-{
- gtk_notebook_set_tab_pos (notebook, (notebook->tab_pos + 1) % 4);
-}
-
-static void
-standard_notebook (GtkButton *button,
- GtkNotebook *notebook)
-{
- gint i;
-
- gtk_notebook_set_show_tabs (notebook, TRUE);
- gtk_notebook_set_scrollable (notebook, FALSE);
- if (g_list_length (notebook->children) == 15)
- for (i = 0; i < 10; i++)
- gtk_notebook_remove_page (notebook, 5);
-}
-
-static void
-notabs_notebook (GtkButton *button,
- GtkNotebook *notebook)
-{
- gint i;
-
- gtk_notebook_set_show_tabs (notebook, FALSE);
- if (g_list_length (notebook->children) == 15)
- for (i = 0; i < 10; i++)
- gtk_notebook_remove_page (notebook, 5);
-}
-
-static void
-scrollable_notebook (GtkButton *button,
- GtkNotebook *notebook)
-{
- gtk_notebook_set_show_tabs (notebook, TRUE);
- gtk_notebook_set_scrollable (notebook, TRUE);
- if (g_list_length (notebook->children) == 5)
- create_pages (notebook, 6, 15);
-}
-
-static void
-notebook_popup (GtkToggleButton *button,
- GtkNotebook *notebook)
-{
- if (button->active)
- gtk_notebook_popup_enable (notebook);
- else
- gtk_notebook_popup_disable (notebook);
-}
-
-static void
-create_notebook ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *button;
- GtkWidget *separator;
- GtkWidget *notebook;
- GtkWidget *omenu;
- GtkWidget *menu;
- GtkWidget *submenu;
- GtkWidget *menuitem;
- GSList *group;
- GdkColor transparent;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "notebook");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
-
- notebook = gtk_notebook_new ();
- gtk_signal_connect (GTK_OBJECT (notebook), "switch_page",
- GTK_SIGNAL_FUNC (page_switch), NULL);
- gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP);
- gtk_box_pack_start (GTK_BOX (box1), notebook, TRUE, TRUE, 0);
- gtk_container_border_width (GTK_CONTAINER (notebook), 10);
-
- gtk_widget_realize (notebook);
- book_open = gdk_pixmap_create_from_xpm_d (notebook->window,
- &book_open_mask,
- &transparent,
- book_open_xpm);
- book_closed = gdk_pixmap_create_from_xpm_d (notebook->window,
- &book_closed_mask,
- &transparent,
- book_closed_xpm);
-
- create_pages (GTK_NOTEBOOK (notebook), 1, 5);
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 10);
-
- box2 = gtk_hbox_new (TRUE, 5);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
-
- omenu = gtk_option_menu_new ();
- menu = gtk_menu_new ();
- submenu = NULL;
- group = NULL;
-
- menuitem = gtk_radio_menu_item_new_with_label (group, "Standard");
- gtk_signal_connect_object (GTK_OBJECT (menuitem), "activate",
- GTK_SIGNAL_FUNC (standard_notebook),
- GTK_OBJECT (notebook));
- group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menuitem));
- gtk_menu_append (GTK_MENU (menu), menuitem);
- gtk_widget_show (menuitem);
- menuitem = gtk_radio_menu_item_new_with_label (group, "w/o Tabs");
- gtk_signal_connect_object (GTK_OBJECT (menuitem), "activate",
- GTK_SIGNAL_FUNC (notabs_notebook),
- GTK_OBJECT (notebook));
- group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menuitem));
- gtk_menu_append (GTK_MENU (menu), menuitem);
- gtk_widget_show (menuitem);
- menuitem = gtk_radio_menu_item_new_with_label (group, "Scrollable");
- gtk_signal_connect_object (GTK_OBJECT (menuitem), "activate",
- GTK_SIGNAL_FUNC (scrollable_notebook),
- GTK_OBJECT (notebook));
- group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menuitem));
- gtk_menu_append (GTK_MENU (menu), menuitem);
- gtk_widget_show (menuitem);
-
- gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
- gtk_box_pack_start (GTK_BOX (box2), omenu, FALSE, FALSE, 0);
- button = gtk_check_button_new_with_label ("enable popup menu");
- gtk_box_pack_start (GTK_BOX (box2), button, FALSE, FALSE, 0);
- gtk_signal_connect (GTK_OBJECT(button), "clicked",
- GTK_SIGNAL_FUNC (notebook_popup),
- GTK_OBJECT (notebook));
-
- box2 = gtk_hbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
-
- button = gtk_button_new_with_label ("next");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (gtk_notebook_next_page),
- GTK_OBJECT (notebook));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
-
- button = gtk_button_new_with_label ("prev");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (gtk_notebook_prev_page),
- GTK_OBJECT (notebook));
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
-
- button = gtk_button_new_with_label ("rotate");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (rotate_notebook),
- notebook);
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show_all (window);
- else
- gtk_widget_destroy (window);
-}
-
-
-/*
- * GtkPanes
- */
-void
-create_panes ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *frame;
- GtkWidget *hpaned;
- GtkWidget *vpaned;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "Panes");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
- vpaned = gtk_vpaned_new ();
- gtk_container_add (GTK_CONTAINER (window), vpaned);
- gtk_container_border_width (GTK_CONTAINER(vpaned), 5);
- gtk_widget_show (vpaned);
-
- hpaned = gtk_hpaned_new ();
- gtk_paned_add1 (GTK_PANED (vpaned), hpaned);
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
- gtk_widget_set_usize (frame, 60, 60);
- gtk_paned_add1 (GTK_PANED (hpaned), frame);
- gtk_widget_show (frame);
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
- gtk_widget_set_usize (frame, 80, 60);
- gtk_paned_add2 (GTK_PANED (hpaned), frame);
- gtk_widget_show (frame);
-
- gtk_widget_show (hpaned);
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
- gtk_widget_set_usize (frame, 60, 80);
- gtk_paned_add2 (GTK_PANED (vpaned), frame);
- gtk_widget_show (frame);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-
-/*
- * Drag -N- Drop
- */
-
-gboolean
-dnd_drop_destroy_popup (GtkWidget *widget, GtkWindow **window)
-{
- if(GTK_IS_BUTTON(widget)) /* I.e. they clicked the close button */
- gtk_widget_destroy(GTK_WIDGET(*window));
- else {
- gtk_grab_remove(GTK_WIDGET(*window));
- *window = NULL;
- }
- return TRUE;
-}
-
-void
-dnd_drop (GtkWidget *button, GdkEvent *event)
-{
- static GtkWidget *window = NULL;
- GtkWidget *vbox, *lbl, *btn;
- gchar *msg;
-
- window = gtk_window_new(GTK_WINDOW_DIALOG);
- gtk_container_border_width (GTK_CONTAINER(window), 10);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(dnd_drop_destroy_popup),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(dnd_drop_destroy_popup),
- &window);
-
- vbox = gtk_vbox_new(FALSE, 5);
-
- /* Display message that we got from drop source */
- msg = g_malloc(strlen(event->dropdataavailable.data)
- + strlen(event->dropdataavailable.data_type) + 100);
- sprintf(msg, "Drop data of type %s was:\n\n%s",
- event->dropdataavailable.data_type,
- (char *)event->dropdataavailable.data);
- lbl = gtk_label_new(msg);
- gtk_label_set_justify(GTK_LABEL(lbl), GTK_JUSTIFY_FILL);
- g_free(msg);
- gtk_widget_show(lbl);
- gtk_box_pack_start_defaults(GTK_BOX(vbox), lbl);
-
- /* Provide an obvious way out of this heinousness */
- btn = gtk_button_new_with_label("Continue with life in\nspite of this oppression");
- gtk_signal_connect (GTK_OBJECT (btn), "clicked",
- GTK_SIGNAL_FUNC(dnd_drop_destroy_popup),
- &window);
- gtk_widget_show(btn);
- gtk_box_pack_start_defaults(GTK_BOX(vbox), btn);
-
- gtk_container_add(GTK_CONTAINER(window), vbox);
-
- gtk_widget_show(vbox);
- gtk_grab_add(window);
- gtk_widget_show(window);
-}
-
-void
-dnd_drag_request (GtkWidget *button, GdkEvent *event)
-{
-#define DND_STRING "Bill Gates demands royalties for\nyour use of his innovation."
- gtk_widget_dnd_data_set (button, event, DND_STRING, strlen(DND_STRING) + 1);
-}
-
-void
-create_dnd ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *box3;
- GtkWidget *frame;
- GtkWidget *button;
- GtkWidget *separator;
-
- /* For clarity... */
- char *possible_drag_types[] = {"text/plain"};
- char *accepted_drop_types[] = {"text/plain"};
-
- if(!modeller)
- create_shapes();
-
- if (!window)
- {
- GdkPoint hotspot = {5,5};
- gdk_dnd_set_drag_shape(modeller->window,
- &hotspot,
- rings->window,
- &hotspot);
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "Drag -N- Drop");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
- box2 = gtk_hbox_new (FALSE, 5);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
- gtk_widget_show (box2);
-
- frame = gtk_frame_new ("Drag");
- gtk_box_pack_start (GTK_BOX (box2), frame, TRUE, TRUE, 0);
- gtk_widget_show (frame);
-
- box3 = gtk_vbox_new (FALSE, 5);
- gtk_container_border_width (GTK_CONTAINER (box3), 5);
- gtk_container_add (GTK_CONTAINER (frame), box3);
- gtk_widget_show (box3);
-
- /*
- * FROM Button
- */
- button = gtk_button_new_with_label ("Drag me!");
- gtk_box_pack_start (GTK_BOX (box3), button, FALSE, TRUE, 0);
- gtk_widget_show (button);
-
- /*
- * currently, the widget has to be realized to
- * set dnd on it, this needs to change
- */
- gtk_widget_realize (button);
- gtk_signal_connect (GTK_OBJECT (button),
- "drag_request_event",
- GTK_SIGNAL_FUNC(dnd_drag_request),
- button);
-
- gtk_widget_dnd_drag_set (button, TRUE, possible_drag_types, 1);
-
-
- frame = gtk_frame_new ("Drop");
- gtk_box_pack_start (GTK_BOX (box2), frame, TRUE, TRUE, 0);
- gtk_widget_show (frame);
-
- box3 = gtk_vbox_new (FALSE, 5);
- gtk_container_border_width (GTK_CONTAINER (box3), 5);
- gtk_container_add (GTK_CONTAINER (frame), box3);
- gtk_widget_show (box3);
-
-
- /*
- * TO Button
- */
- button = gtk_button_new_with_label ("To");
- gtk_box_pack_start (GTK_BOX (box3), button, FALSE, TRUE, 0);
- gtk_widget_show (button);
-
- gtk_widget_realize (button);
- gtk_signal_connect (GTK_OBJECT (button),
- "drop_data_available_event",
- GTK_SIGNAL_FUNC(dnd_drop),
- button);
-
- gtk_widget_dnd_drop_set (button, TRUE, accepted_drop_types, 1, FALSE);
-
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
-
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
-
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- gtk_widget_hide(modeller); gtk_widget_hide(rings);
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-/*
- * Shaped Windows
- */
-static GdkWindow *root_win = NULL;
-
-typedef struct _cursoroffset {gint x,y;} CursorOffset;
-
-static void
-shape_pressed (GtkWidget *widget, GdkEventButton *event)
-{
- CursorOffset *p;
-
- /* ignore double and triple click */
- if (event->type != GDK_BUTTON_PRESS)
- return;
-
- p = gtk_object_get_user_data (GTK_OBJECT(widget));
- p->x = (int) event->x;
- p->y = (int) event->y;
-
- gtk_grab_add (widget);
- gdk_pointer_grab (widget->window, TRUE,
- GDK_BUTTON_RELEASE_MASK |
- GDK_BUTTON_MOTION_MASK |
- GDK_POINTER_MOTION_HINT_MASK,
- NULL, NULL, 0);
-}
-
-
-static void
-shape_released (GtkWidget *widget)
-{
- gtk_grab_remove (widget);
- gdk_pointer_ungrab (0);
-}
-
-static void
-shape_motion (GtkWidget *widget,
- GdkEventMotion *event)
-{
- gint xp, yp;
- CursorOffset * p;
- GdkModifierType mask;
-
- p = gtk_object_get_user_data (GTK_OBJECT (widget));
-
- /*
- * Can't use event->x / event->y here
- * because I need absolute coordinates.
- */
- gdk_window_get_pointer (root_win, &xp, &yp, &mask);
- gtk_widget_set_uposition (widget, xp - p->x, yp - p->y);
-}
-
-GtkWidget *
-shape_create_icon (char *xpm_file,
- gint x,
- gint y,
- gint px,
- gint py,
- gint window_type)
-{
- GtkWidget *window;
- GtkWidget *pixmap;
- GtkWidget *fixed;
- CursorOffset* icon_pos;
- GdkGC* gc;
- GdkBitmap *gdk_pixmap_mask;
- GdkPixmap *gdk_pixmap;
- GtkStyle *style;
-
- style = gtk_widget_get_default_style ();
- gc = style->black_gc;
-
- /*
- * GDK_WINDOW_TOPLEVEL works also, giving you a title border
- */
- window = gtk_window_new (window_type);
-
- fixed = gtk_fixed_new ();
- gtk_widget_set_usize (fixed, 100,100);
- gtk_container_add (GTK_CONTAINER (window), fixed);
- gtk_widget_show (fixed);
-
- gtk_widget_set_events (window,
- gtk_widget_get_events (window) |
- GDK_BUTTON_MOTION_MASK |
- GDK_POINTER_MOTION_HINT_MASK |
- GDK_BUTTON_PRESS_MASK);
-
- gtk_widget_realize (window);
- gdk_pixmap = gdk_pixmap_create_from_xpm (window->window, &gdk_pixmap_mask,
- &style->bg[GTK_STATE_NORMAL],
- xpm_file);
-
- pixmap = gtk_pixmap_new (gdk_pixmap, gdk_pixmap_mask);
- gtk_fixed_put (GTK_FIXED (fixed), pixmap, px,py);
- gtk_widget_show (pixmap);
-
- gtk_widget_shape_combine_mask (window, gdk_pixmap_mask, px,py);
-
-
- gtk_signal_connect (GTK_OBJECT (window), "button_press_event",
- GTK_SIGNAL_FUNC (shape_pressed),NULL);
- gtk_signal_connect (GTK_OBJECT (window), "button_release_event",
- GTK_SIGNAL_FUNC (shape_released),NULL);
- gtk_signal_connect (GTK_OBJECT (window), "motion_notify_event",
- GTK_SIGNAL_FUNC (shape_motion),NULL);
-
- icon_pos = g_new (CursorOffset, 1);
- gtk_object_set_user_data(GTK_OBJECT(window), icon_pos);
-
- gtk_widget_set_uposition (window, x, y);
- gtk_widget_show (window);
-
- return window;
-}
-
-void
-create_shapes ()
-{
- root_win = gdk_window_foreign_new (GDK_ROOT_WINDOW ());
-
- if (!modeller)
- {
- modeller = shape_create_icon ("Modeller.xpm",
- 440, 140, 0,0, GTK_WINDOW_POPUP);
-
- gtk_signal_connect (GTK_OBJECT (modeller), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &modeller);
- gtk_signal_connect (GTK_OBJECT (modeller), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &modeller);
- }
- else
- gtk_widget_destroy (modeller);
-
- if (!sheets)
- {
- sheets = shape_create_icon ("FilesQueue.xpm",
- 580, 170, 0,0, GTK_WINDOW_POPUP);
-
- gtk_signal_connect (GTK_OBJECT (sheets), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &sheets);
- gtk_signal_connect (GTK_OBJECT (sheets), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &sheets);
-
- }
- else
- gtk_widget_destroy (sheets);
-
- if (!rings)
- {
- rings = shape_create_icon ("3DRings.xpm",
- 460, 270, 25,25, GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (rings), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &rings);
- gtk_signal_connect (GTK_OBJECT (rings), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &rings);
- }
- else
- gtk_widget_destroy (rings);
-}
-
-void
-create_wmhints ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *label;
- GtkWidget *separator;
- GtkWidget *button;
- GtkWidget *box1;
- GtkWidget *box2;
-
- GdkBitmap *circles;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "WM Hints");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
- gtk_widget_realize (window);
-
- circles = gdk_bitmap_create_from_data (window->window,
- circles_bits,
- circles_width,
- circles_height);
- gdk_window_set_icon (window->window, NULL,
- circles, circles);
-
- gdk_window_set_icon_name (window->window, "WMHints Test Icon");
-
- gdk_window_set_decorations (window->window, GDK_DECOR_ALL | GDK_DECOR_MENU);
- gdk_window_set_functions (window->window, GDK_FUNC_ALL | GDK_FUNC_RESIZE);
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
- label = gtk_label_new ("Try iconizing me!");
- gtk_widget_set_usize (label, 150, 50);
- gtk_box_pack_start (GTK_BOX (box1), label, TRUE, TRUE, 0);
- gtk_widget_show (label);
-
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
-
- button = gtk_button_new_with_label ("close");
-
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
-
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-/*
- * Progress Bar
- */
-static int progress_timer = 0;
-
-gint
-progress_timeout (gpointer data)
-{
- gfloat new_val;
-
- new_val = GTK_PROGRESS_BAR (data)->percentage;
- if (new_val >= 1.0)
- new_val = 0.0;
- new_val += 0.02;
-
- gtk_progress_bar_update (GTK_PROGRESS_BAR (data), new_val);
-
- return TRUE;
-}
-
-void
-destroy_progress (GtkWidget *widget,
- GtkWidget **window)
-{
- destroy_window (widget, window);
- gtk_timeout_remove (progress_timer);
- progress_timer = 0;
-}
-
-void
-create_progress_bar ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *button;
- GtkWidget *vbox;
- GtkWidget *pbar;
- GtkWidget *label;
-
- if (!window)
- {
- window = gtk_dialog_new ();
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_progress),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_progress),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "dialog");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
-
- vbox = gtk_vbox_new (FALSE, 5);
- gtk_container_border_width (GTK_CONTAINER (vbox), 10);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox),
- vbox, TRUE, TRUE, 0);
- gtk_widget_show (vbox);
-
- label = gtk_label_new ("progress...");
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
- gtk_widget_show (label);
-
- pbar = gtk_progress_bar_new ();
- gtk_widget_set_usize (pbar, 200, 20);
- gtk_box_pack_start (GTK_BOX (vbox), pbar, TRUE, TRUE, 0);
- gtk_widget_show (pbar);
-
- progress_timer = gtk_timeout_add (100, progress_timeout, pbar);
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
- button, TRUE, TRUE, 0);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-
-/*
- * Color Preview
- */
-static int color_idle = 0;
-
-gint
-color_idle_func (GtkWidget *preview)
-{
- static int count = 1;
- guchar buf[768];
- int i, j, k;
-
- for (i = 0; i < 256; i++)
- {
- for (j = 0, k = 0; j < 256; j++)
- {
- buf[k+0] = i + count;
- buf[k+1] = 0;
- buf[k+2] = j + count;
- k += 3;
- }
-
- gtk_preview_draw_row (GTK_PREVIEW (preview), buf, 0, i, 256);
- }
-
- count += 1;
-
- gtk_widget_draw (preview, NULL);
-
- return TRUE;
-}
-
-void
-color_preview_destroy (GtkWidget *widget,
- GtkWidget **window)
-{
- gtk_idle_remove (color_idle);
- color_idle = 0;
-
- destroy_window (widget, window);
-}
-
-void
-create_color_preview ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *preview;
- guchar buf[768];
- int i, j, k;
-
- if (!window)
- {
- gtk_widget_push_visual (gtk_preview_get_visual ());
- gtk_widget_push_colormap (gtk_preview_get_cmap ());
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(color_preview_destroy),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(color_preview_destroy),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "test");
- gtk_container_border_width (GTK_CONTAINER (window), 10);
-
- preview = gtk_preview_new (GTK_PREVIEW_COLOR);
- gtk_preview_size (GTK_PREVIEW (preview), 256, 256);
- gtk_container_add (GTK_CONTAINER (window), preview);
- gtk_widget_show (preview);
-
- for (i = 0; i < 256; i++)
- {
- for (j = 0, k = 0; j < 256; j++)
- {
- buf[k+0] = i;
- buf[k+1] = 0;
- buf[k+2] = j;
- k += 3;
- }
-
- gtk_preview_draw_row (GTK_PREVIEW (preview), buf, 0, i, 256);
- }
-
- color_idle = gtk_idle_add ((GtkFunction) color_idle_func, preview);
-
- gtk_widget_pop_colormap ();
- gtk_widget_pop_visual ();
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-
-/*
- * Gray Preview
- */
-static int gray_idle = 0;
-
-gint
-gray_idle_func (GtkWidget *preview)
-{
- static int count = 1;
- guchar buf[256];
- int i, j;
-
- for (i = 0; i < 256; i++)
- {
- for (j = 0; j < 256; j++)
- buf[j] = i + j + count;
-
- gtk_preview_draw_row (GTK_PREVIEW (preview), buf, 0, i, 256);
- }
-
- count += 1;
-
- gtk_widget_draw (preview, NULL);
-
- return TRUE;
-}
-
-void
-gray_preview_destroy (GtkWidget *widget,
- GtkWidget **window)
-{
- gtk_idle_remove (gray_idle);
- gray_idle = 0;
-
- destroy_window (widget, window);
-}
-
-void
-create_gray_preview ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *preview;
- guchar buf[256];
- int i, j;
-
- if (!window)
- {
- gtk_widget_push_visual (gtk_preview_get_visual ());
- gtk_widget_push_colormap (gtk_preview_get_cmap ());
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(gray_preview_destroy),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(gray_preview_destroy),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "test");
- gtk_container_border_width (GTK_CONTAINER (window), 10);
-
- preview = gtk_preview_new (GTK_PREVIEW_GRAYSCALE);
- gtk_preview_size (GTK_PREVIEW (preview), 256, 256);
- gtk_container_add (GTK_CONTAINER (window), preview);
- gtk_widget_show (preview);
-
- for (i = 0; i < 256; i++)
- {
- for (j = 0; j < 256; j++)
- buf[j] = i + j;
-
- gtk_preview_draw_row (GTK_PREVIEW (preview), buf, 0, i, 256);
- }
-
- gray_idle = gtk_idle_add ((GtkFunction) gray_idle_func, preview);
-
- gtk_widget_pop_colormap ();
- gtk_widget_pop_visual ();
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-
-/*
- * Selection Test
- */
-void
-selection_test_received (GtkWidget *list, GtkSelectionData *data)
-{
- GdkAtom *atoms;
- GtkWidget *list_item;
- GList *item_list;
- int i, l;
-
- if (data->length < 0)
- {
- g_print ("Selection retrieval failed\n");
- return;
- }
- if (data->type != GDK_SELECTION_TYPE_ATOM)
- {
- g_print ("Selection \"TARGETS\" was not returned as atoms!\n");
- return;
- }
-
- /* Clear out any current list items */
-
- gtk_list_clear_items (GTK_LIST(list), 0, -1);
-
- /* Add new items to list */
-
- atoms = (GdkAtom *)data->data;
-
- item_list = NULL;
- l = data->length / sizeof (GdkAtom);
- for (i = 0; i < l; i++)
- {
- char *name;
- name = gdk_atom_name (atoms[i]);
- if (name != NULL)
- {
- list_item = gtk_list_item_new_with_label (name);
- g_free (name);
- }
- else
- list_item = gtk_list_item_new_with_label ("(bad atom)");
-
- gtk_widget_show (list_item);
- item_list = g_list_append (item_list, list_item);
- }
-
- gtk_list_append_items (GTK_LIST (list), item_list);
-
- return;
-}
-
-void
-selection_test_get_targets (GtkWidget *widget, GtkWidget *list)
-{
- static GdkAtom targets_atom = GDK_NONE;
-
- if (targets_atom == GDK_NONE)
- targets_atom = gdk_atom_intern ("TARGETS", FALSE);
-
- gtk_selection_convert (list, GDK_SELECTION_PRIMARY, targets_atom,
- GDK_CURRENT_TIME);
-}
-
-void
-create_selection_test ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *button;
- GtkWidget *vbox;
- GtkWidget *scrolled_win;
- GtkWidget *list;
- GtkWidget *label;
-
- if (!window)
- {
- window = gtk_dialog_new ();
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "Selection Test");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
- /* Create the list */
-
- vbox = gtk_vbox_new (FALSE, 5);
- gtk_container_border_width (GTK_CONTAINER (vbox), 10);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), vbox,
- TRUE, TRUE, 0);
- gtk_widget_show (vbox);
-
- label = gtk_label_new ("Gets available targets for current selection");
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
- gtk_widget_show (label);
-
- scrolled_win = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_box_pack_start (GTK_BOX (vbox), scrolled_win, TRUE, TRUE, 0);
- gtk_widget_set_usize (scrolled_win, 100, 200);
- gtk_widget_show (scrolled_win);
-
- list = gtk_list_new ();
- gtk_container_add (GTK_CONTAINER (scrolled_win), list);
-
- gtk_signal_connect (GTK_OBJECT(list), "selection_received",
- GTK_SIGNAL_FUNC (selection_test_received), NULL);
- gtk_widget_show (list);
-
- /* .. And create some buttons */
- button = gtk_button_new_with_label ("Get Targets");
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
- button, TRUE, TRUE, 0);
-
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (selection_test_get_targets), list);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Quit");
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
- button, TRUE, TRUE, 0);
-
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-
-/*
- * Gamma Curve
- */
-void
-create_gamma_curve ()
-{
- static GtkWidget *window = NULL, *curve;
- static int count = 0;
- gfloat vec[256];
- gint max;
- gint i;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title (GTK_WINDOW (window), "test");
- gtk_container_border_width (GTK_CONTAINER (window), 10);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- curve = gtk_gamma_curve_new ();
- gtk_container_add (GTK_CONTAINER (window), curve);
- gtk_widget_show (curve);
- }
-
- max = 127 + (count % 2)*128;
- gtk_curve_set_range (GTK_CURVE (GTK_GAMMA_CURVE (curve)->curve),
- 0, max, 0, max);
- for (i = 0; i < max; ++i)
- vec[i] = (127 / sqrt (max)) * sqrt (i);
- gtk_curve_set_vector (GTK_CURVE (GTK_GAMMA_CURVE (curve)->curve),
- max, vec);
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else if (count % 4 == 3)
- {
- gtk_widget_destroy (window);
- window = NULL;
- }
-
- ++count;
-}
-
-static int scroll_test_pos = 0.0;
-static GdkGC *scroll_test_gc = NULL;
-
-static gint
-scroll_test_expose (GtkWidget *widget, GdkEventExpose *event,
- GtkAdjustment *adj)
-{
- gint i,j;
- gint imin, imax, jmin, jmax;
-
- imin = (event->area.x) / 10;
- imax = (event->area.x + event->area.width + 9) / 10;
-
- jmin = ((int)adj->value + event->area.y) / 10;
- jmax = ((int)adj->value + event->area.y + event->area.height + 9) / 10;
-
- gdk_window_clear_area (widget->window,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
-
- for (i=imin; i<imax; i++)
- for (j=jmin; j<jmax; j++)
- if ((i+j) % 2)
- gdk_draw_rectangle (widget->window,
- widget->style->black_gc,
- TRUE,
- 10*i, 10*j - (int)adj->value, 1+i%10, 1+j%10);
-
- return TRUE;
-}
-
-static void
-scroll_test_configure (GtkWidget *widget, GdkEventConfigure *event,
- GtkAdjustment *adj)
-{
- adj->page_increment = 0.9 * widget->allocation.height;
- adj->page_size = widget->allocation.height;
-
- gtk_signal_emit_by_name (GTK_OBJECT (adj), "changed");
-}
-
-static void
-scroll_test_adjustment_changed (GtkAdjustment *adj, GtkWidget *widget)
-{
- gint source_min = (int)adj->value - scroll_test_pos;
- gint source_max = source_min + widget->allocation.height;
- gint dest_min = 0;
- gint dest_max = widget->allocation.height;
- GdkRectangle rect;
- GdkEvent *event;
-
- scroll_test_pos = adj->value;
-
- if (!GTK_WIDGET_DRAWABLE (widget))
- return;
-
- if (source_min < 0)
- {
- rect.x = 0;
- rect.y = 0;
- rect.width = widget->allocation.width;
- rect.height = -source_min;
- if (rect.height > widget->allocation.height)
- rect.height = widget->allocation.height;
-
- source_min = 0;
- dest_min = rect.height;
- }
- else
- {
- rect.x = 0;
- rect.y = 2*widget->allocation.height - source_max;
- if (rect.y < 0)
- rect.y = 0;
- rect.width = widget->allocation.width;
- rect.height = widget->allocation.height - rect.y;
-
- source_max = widget->allocation.height;
- dest_max = rect.y;
- }
-
- if (source_min != source_max)
- {
- if (scroll_test_gc == NULL)
- {
- scroll_test_gc = gdk_gc_new (widget->window);
- gdk_gc_set_exposures (scroll_test_gc, TRUE);
- }
-
- gdk_draw_pixmap (widget->window,
- scroll_test_gc,
- widget->window,
- 0, source_min,
- 0, dest_min,
- widget->allocation.width,
- source_max - source_min);
-
- /* Make sure graphics expose events are processed before scrolling
- * again */
-
- while ((event = gdk_event_get_graphics_expose (widget->window)) != NULL)
- {
- gtk_widget_event (widget, event);
- if (event->expose.count == 0)
- {
- gdk_event_free (event);
- break;
- }
- gdk_event_free (event);
- }
- }
-
-
- if (rect.height != 0)
- gtk_widget_draw (widget, &rect);
-}
-
-
-void
-create_scroll_test ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *hbox;
- GtkWidget *drawing_area;
- GtkWidget *scrollbar;
- GtkWidget *button;
- GtkAdjustment *adj;
-
- if (!window)
- {
- window = gtk_dialog_new ();
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_window),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "Scroll Test");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
- hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), hbox,
- TRUE, TRUE, 0);
- gtk_widget_show (hbox);
-
- drawing_area = gtk_drawing_area_new ();
- gtk_drawing_area_size (GTK_DRAWING_AREA (drawing_area), 200, 200);
- gtk_box_pack_start (GTK_BOX (hbox), drawing_area, TRUE, TRUE, 0);
- gtk_widget_show (drawing_area);
-
- gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK);
-
- adj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 1000.0, 1.0, 180.0, 200.0));
- scroll_test_pos = 0.0;
-
- scrollbar = gtk_vscrollbar_new (adj);
- gtk_box_pack_start (GTK_BOX (hbox), scrollbar, FALSE, FALSE, 0);
- gtk_widget_show (scrollbar);
-
- gtk_signal_connect (GTK_OBJECT (drawing_area), "expose_event",
- GTK_SIGNAL_FUNC (scroll_test_expose), adj);
- gtk_signal_connect (GTK_OBJECT (drawing_area), "configure_event",
- GTK_SIGNAL_FUNC (scroll_test_configure), adj);
-
-
- gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
- GTK_SIGNAL_FUNC (scroll_test_adjustment_changed),
- drawing_area);
-
- /* .. And create some buttons */
-
- button = gtk_button_new_with_label ("Quit");
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
- button, TRUE, TRUE, 0);
-
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-/*
- * Timeout Test
- */
-static int timer = 0;
-
-void
-timeout_test (GtkWidget *label)
-{
- static int count = 0;
- static char buffer[32];
-
- sprintf (buffer, "count: %d", ++count);
- gtk_label_set (GTK_LABEL (label), buffer);
-}
-
-void
-start_timeout_test (GtkWidget *widget,
- GtkWidget *label)
-{
- if (!timer)
- {
- timer = gtk_timeout_add (100, (GtkFunction) timeout_test, label);
- }
-}
-
-void
-stop_timeout_test (GtkWidget *widget,
- gpointer data)
-{
- if (timer)
- {
- gtk_timeout_remove (timer);
- timer = 0;
- }
-}
-
-void
-destroy_timeout_test (GtkWidget *widget,
- GtkWidget **window)
-{
- destroy_window (widget, window);
- stop_timeout_test (NULL, NULL);
-}
-
-void
-create_timeout_test ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *button;
- GtkWidget *label;
-
- if (!window)
- {
- window = gtk_dialog_new ();
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_timeout_test),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_timeout_test),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "Timeout Test");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
- label = gtk_label_new ("count: 0");
- gtk_misc_set_padding (GTK_MISC (label), 10, 10);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox),
- label, TRUE, TRUE, 0);
- gtk_widget_show (label);
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
- button, TRUE, TRUE, 0);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("start");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(start_timeout_test),
- label);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
- button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("stop");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(stop_timeout_test),
- NULL);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
- button, TRUE, TRUE, 0);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-
-/*
- * Idle Test
- */
-static int idle = 0;
-
-gint
-idle_test (GtkWidget *label)
-{
- static int count = 0;
- static char buffer[32];
-
- sprintf (buffer, "count: %d", ++count);
- gtk_label_set (GTK_LABEL (label), buffer);
-
- return TRUE;
-}
-
-void
-start_idle_test (GtkWidget *widget,
- GtkWidget *label)
-{
- if (!idle)
- {
- idle = gtk_idle_add ((GtkFunction) idle_test, label);
- }
-}
-
-void
-stop_idle_test (GtkWidget *widget,
- gpointer data)
-{
- if (idle)
- {
- gtk_idle_remove (idle);
- idle = 0;
- }
-}
-
-void
-destroy_idle_test (GtkWidget *widget,
- GtkWidget **window)
-{
- destroy_window (widget, window);
- stop_idle_test (NULL, NULL);
-}
-
-void
-create_idle_test ()
-{
- static GtkWidget *window = NULL;
- GtkWidget *button;
- GtkWidget *label;
-
- if (!window)
- {
- window = gtk_dialog_new ();
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(destroy_idle_test),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(destroy_idle_test),
- &window);
-
- gtk_window_set_title (GTK_WINDOW (window), "Idle Test");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
-
- label = gtk_label_new ("count: 0");
- gtk_misc_set_padding (GTK_MISC (label), 10, 10);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox),
- label, TRUE, TRUE, 0);
- gtk_widget_show (label);
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- GTK_OBJECT (window));
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
- button, TRUE, TRUE, 0);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("start");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(start_idle_test),
- label);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
- button, TRUE, TRUE, 0);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("stop");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC(stop_idle_test),
- NULL);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
- button, TRUE, TRUE, 0);
- gtk_widget_show (button);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
- else
- gtk_widget_destroy (window);
-}
-
-void
-test_destroy (GtkWidget *widget,
- GtkWidget **window)
-{
- destroy_window (widget, window);
- gtk_main_quit ();
-}
-
-/*
- * Basic Test
- */
-void
-create_test ()
-{
- static GtkWidget *window = NULL;
-
- if (!window)
- {
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(test_destroy),
- &window);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(test_destroy),
- &window);
-
-
- gtk_window_set_title (GTK_WINDOW (window), "test");
- gtk_container_border_width (GTK_CONTAINER (window), 0);
- }
-
- if (!GTK_WIDGET_VISIBLE (window))
- {
- gtk_widget_show (window);
-
- g_print ("create_test: start\n");
- gtk_main ();
- g_print ("create_test: done\n");
- }
- else
- gtk_widget_destroy (window);
-}
-
-
-/*
- * Main Window and Exit
- */
-void
-do_exit (GtkWidget *widget, GtkWidget *window)
-{
- gtk_widget_destroy (window);
- gtk_main_quit ();
-}
-
-void
-create_main_window ()
-{
- struct {
- char *label;
- void (*func) ();
- } buttons[] =
- {
- { "buttons", create_buttons },
- { "toggle buttons", create_toggle_buttons },
- { "check buttons", create_check_buttons },
- { "radio buttons", create_radio_buttons },
- { "button box", create_button_box },
- { "toolbar", create_toolbar },
- { "handle box", create_handle_box },
- { "statusbar", create_statusbar },
- { "reparent", create_reparent },
- { "pixmap", create_pixmap },
- { "tooltips", create_tooltips },
- { "menus", create_menus },
- { "scrolled windows", create_scrolled_windows },
- { "drawing areas", NULL },
- { "entry", create_entry },
- { "spinbutton", create_spins },
- { "list", create_list },
- { "clist", create_clist},
- { "tree", create_tree_mode_window},
- { "color selection", create_color_selection },
- { "file selection", create_file_selection },
- { "dialog", create_dialog },
- { "miscellaneous", NULL },
- { "range controls", create_range_controls },
- { "rulers", create_rulers },
- { "text", create_text },
- { "notebook", create_notebook },
- { "panes", create_panes },
- { "shapes", create_shapes },
- { "dnd", create_dnd },
- { "WM hints", create_wmhints },
- { "progress bar", create_progress_bar },
- { "preview color", create_color_preview },
- { "preview gray", create_gray_preview },
- { "gamma curve", create_gamma_curve },
- { "test scrolling", create_scroll_test },
- { "test selection", create_selection_test },
- { "test timeout", create_timeout_test },
- { "test idle", create_idle_test },
- { "test", create_test },
- };
- int nbuttons = sizeof (buttons) / sizeof (buttons[0]);
- GtkWidget *window;
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *scrolled_window;
- GtkWidget *button;
- GtkWidget *label;
- gchar buffer[64];
- GtkWidget *separator;
- int i;
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_widget_set_name (window, "main window");
- gtk_widget_set_usize (window, 200, 400);
- gtk_widget_set_uposition (window, 20, 20);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC(gtk_main_quit),
- NULL);
- gtk_signal_connect (GTK_OBJECT (window), "delete_event",
- GTK_SIGNAL_FUNC(gtk_main_quit),
- NULL);
-
- box1 = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_show (box1);
-
- if (gtk_micro_version > 0)
- sprintf (buffer,
- "Gtk+ v%d.%d.%d",
- gtk_major_version,
- gtk_minor_version,
- gtk_micro_version);
- else
- sprintf (buffer,
- "Gtk+ v%d.%d",
- gtk_major_version,
- gtk_minor_version);
-
- label = gtk_label_new (buffer);
- gtk_widget_show (label);
- gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);
-
- scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_container_border_width (GTK_CONTAINER (scrolled_window), 10);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_box_pack_start (GTK_BOX (box1), scrolled_window, TRUE, TRUE, 0);
- gtk_widget_show (scrolled_window);
-
- box2 = gtk_vbox_new (FALSE, 0);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_container_add (GTK_CONTAINER (scrolled_window), box2);
- gtk_widget_show (box2);
-
- for (i = 0; i < nbuttons; i++)
- {
- button = gtk_button_new_with_label (buttons[i].label);
- if (buttons[i].func)
- gtk_signal_connect (GTK_OBJECT (button),
- "clicked",
- GTK_SIGNAL_FUNC(buttons[i].func),
- NULL);
- else
- gtk_widget_set_sensitive (button, FALSE);
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
- }
-
- separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
- box2 = gtk_vbox_new (FALSE, 10);
- gtk_container_border_width (GTK_CONTAINER (box2), 10);
- gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
- gtk_widget_show (box2);
-
- button = gtk_button_new_with_label ("close");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (do_exit),
- window);
- gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
- gtk_widget_grab_default (button);
- gtk_widget_show (button);
-
- gtk_widget_show (window);
-}
-
-int
-main (int argc, char *argv[])
-{
- gtk_set_locale ();
-
- gtk_init (&argc, &argv);
-
-#ifdef HAVE_LIBGLE
- gle_init (&argc, &argv);
-#endif /* !HAVE_LIBGLE */
-
- gtk_rc_parse ("testgtkrc");
-
- create_main_window ();
-
- gtk_main ();
-
- return 0;
-}
diff --git a/tests/testgtkrc b/tests/testgtkrc
deleted file mode 100644
index 566c663831..0000000000
--- a/tests/testgtkrc
+++ /dev/null
@@ -1,77 +0,0 @@
-# pixmap_path "<dir 1>:<dir 2>:<dir 3>:..."
-#
-# style <name> [= <name>]
-# {
-# <option>
-# }
-#
-# widget <widget_set> style <style_name>
-# widget_class <widget_class_set> style <style_name>
-
-pixmap_path "."
-
-style "default"
-{
- fontset = "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*,*"
-# base[NORMAL] = { 0.8, 0.8, 1.0 }
-}
-
-style "window"
-{
-# bg_pixmap[NORMAL] = "warning.xpm"
-}
-
-style "scale"
-{
- fg[NORMAL] = { 1.0, 0, 0 }
- bg_pixmap[NORMAL] = "<parent>"
-}
-
-style "button"
-{
-# fg[PRELIGHT] = { 1.0, 1.0, 1.0 }
-# bg[PRELIGHT] = { 0, 0, 0.75 }
-}
-
-style 'main_button' = 'button'
-{
- font = "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*"
- bg[PRELIGHT] = { 0, 0.75, 0x00 }
-}
-
-style "toggle_button" = "button"
-{
- fg[NORMAL] = { 1.0, 0, 0 }
- fg[ACTIVE] = { 1.0, 0, 0 }
- bg_pixmap[NORMAL] = "<parent>"
-}
-
-style "text"
-{
- bg_pixmap[NORMAL] = "marble.xpm"
- text[NORMAL] = { 1.0, 1.0, 1.0 }
- base[NORMAL] = { 0.0, 0.0, 0.0 }
-}
-
-style "ruler"
-{
- font = '-adobe-helvetica-medium-r-normal--*-80-*-*-*-*-*-*'
-}
-
-style "curve"
-{
- fg[NORMAL] = { 58000, 0, 0 } # red
-}
-
-widget_class "GtkWindow" style "window"
-widget_class "GtkDialog" style "window"
-widget_class "GtkFileSelection" style "window"
-widget_class "*Gtk*Scale" style "scale"
-widget_class "*GtkCheckButton*" style "toggle_button"
-widget_class "*GtkRadioButton*" style "toggle_button"
-widget_class "*GtkButton*" style "button"
-widget_class "*Ruler" style "ruler"
-widget_class "*GtkText" style "text"
-widget_class "*" style "default"
-widget "main window.*GtkButton*" style "main_button"
-widget "*GtkCurve" style "curve"
diff --git a/tests/testinput.c b/tests/testinput.c
deleted file mode 100644
index 218e5ca769..0000000000
--- a/tests/testinput.c
+++ /dev/null
@@ -1,393 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "gtk.h"
-
-/* Backing pixmap for drawing area */
-
-static GdkPixmap *pixmap = NULL;
-
-/* Information about cursor */
-
-static gint need_cursor = FALSE;
-static gint cursor_proximity = TRUE;
-static gdouble cursor_x;
-static gdouble cursor_y;
-
-/* Unique ID of current device */
-static guint32 current_device = GDK_CORE_POINTER;
-
-/* Check to see if we need to draw a cursor for current device */
-static void
-check_cursor ()
-{
- GList *tmp_list;
-
- /* gdk_input_list_devices returns an internal list, so we shouldn't
- free it afterwards */
- tmp_list = gdk_input_list_devices();
-
- while (tmp_list)
- {
- GdkDeviceInfo *info = (GdkDeviceInfo *)tmp_list->data;
-
- if (info->deviceid == current_device)
- {
- need_cursor = !info->has_cursor;
- break;
- }
-
- tmp_list = tmp_list->next;
- }
-}
-
-/* Erase the old cursor, and/or draw a new one, if necessary */
-static void
-update_cursor (GtkWidget *widget, gdouble x, gdouble y)
-{
- static gint cursor_present = 0;
- gint state = need_cursor && cursor_proximity;
-
- if (pixmap != NULL)
- {
- if (cursor_present && (cursor_present != state ||
- x != cursor_x || y != cursor_y))
- {
- gdk_draw_pixmap(widget->window,
- widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
- pixmap,
- cursor_x - 5, cursor_y - 5,
- cursor_x - 5, cursor_y - 5,
- 10, 10);
- }
-
- cursor_present = state;
- cursor_x = x;
- cursor_y = y;
-
- if (cursor_present)
- {
- gdk_draw_rectangle (widget->window,
- widget->style->black_gc,
- TRUE,
- cursor_x - 5, cursor_y -5,
- 10, 10);
- }
- }
-}
-
-/* Create a new backing pixmap of the appropriate size */
-static gint
-configure_event (GtkWidget *widget, GdkEventConfigure *event)
-{
- if (pixmap)
- gdk_pixmap_unref (pixmap);
- pixmap = gdk_pixmap_new(widget->window,
- widget->allocation.width,
- widget->allocation.height,
- -1);
- gdk_draw_rectangle (pixmap,
- widget->style->white_gc,
- TRUE,
- 0, 0,
- widget->allocation.width,
- widget->allocation.height);
-
- return TRUE;
-}
-
-/* Refill the screen from the backing pixmap */
-static gint
-expose_event (GtkWidget *widget, GdkEventExpose *event)
-{
- gdk_draw_pixmap(widget->window,
- widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
- pixmap,
- event->area.x, event->area.y,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
-
- return FALSE;
-}
-
-/* Draw a rectangle on the screen, size depending on pressure,
- and color on the type of device */
-static void
-draw_brush (GtkWidget *widget, GdkInputSource source,
- gdouble x, gdouble y, gdouble pressure)
-{
- GdkGC *gc;
- GdkRectangle update_rect;
-
- switch (source)
- {
- case GDK_SOURCE_MOUSE:
- gc = widget->style->dark_gc[GTK_WIDGET_STATE (widget)];
- break;
- case GDK_SOURCE_PEN:
- gc = widget->style->black_gc;
- break;
- case GDK_SOURCE_ERASER:
- gc = widget->style->white_gc;
- break;
- default:
- gc = widget->style->light_gc[GTK_WIDGET_STATE (widget)];
- }
-
- update_rect.x = x - 10 * pressure;
- update_rect.y = y - 10 * pressure;
- update_rect.width = 20 * pressure;
- update_rect.height = 20 * pressure;
- gdk_draw_rectangle (pixmap, gc, TRUE,
- update_rect.x, update_rect.y,
- update_rect.width, update_rect.height);
- gtk_widget_draw (widget, &update_rect);
-}
-
-static guint32 motion_time;
-
-static gint
-button_press_event (GtkWidget *widget, GdkEventButton *event)
-{
- if (event->deviceid != current_device)
- {
- current_device = event->deviceid;
- check_cursor ();
- }
-
- cursor_proximity = TRUE;
-
- if (event->button == 1 && pixmap != NULL)
- {
- draw_brush (widget, event->source, event->x, event->y,
- event->pressure);
- motion_time = event->time;
- }
-
- update_cursor (widget, event->x, event->y);
-
- return TRUE;
-}
-
-static gint
-key_press_event (GtkWidget *widget, GdkEventKey *event)
-{
- if ((event->keyval >= 0x20) && (event->keyval <= 0xFF))
- printf("I got a %c\n", event->keyval);
- else
- printf("I got some other key\n");
-
- return TRUE;
-}
-
-static gint
-motion_notify_event (GtkWidget *widget, GdkEventMotion *event)
-{
- GdkTimeCoord *coords;
- int nevents;
- int i;
-
- if (event->deviceid != current_device)
- {
- current_device = event->deviceid;
- check_cursor ();
- }
-
- cursor_proximity = TRUE;
-
- if (event->state & GDK_BUTTON1_MASK && pixmap != NULL)
- {
- coords = gdk_input_motion_events (event->window, event->deviceid,
- motion_time, event->time,
- &nevents);
- motion_time = event->time;
- if (coords)
- {
- for (i=0; i<nevents; i++)
- draw_brush (widget, event->source, coords[i].x, coords[i].y,
- coords[i].pressure);
- g_free (coords);
- }
- else
- {
- if (event->is_hint)
- gdk_input_window_get_pointer (event->window, event->deviceid,
- NULL, NULL, NULL, NULL, NULL, NULL);
- draw_brush (widget, event->source, event->x, event->y,
- event->pressure);
- }
- }
- else
- {
- gdk_input_window_get_pointer (event->window, event->deviceid,
- &event->x, &event->y,
- NULL, NULL, NULL, NULL);
- }
-
- update_cursor (widget, event->x, event->y);
-
- return TRUE;
-}
-
-/* We track the next two events to know when we need to draw a
- cursor */
-
-static gint
-proximity_out_event (GtkWidget *widget, GdkEventProximity *event)
-{
- cursor_proximity = FALSE;
- update_cursor (widget, cursor_x, cursor_y);
- return TRUE;
-}
-
-static gint
-leave_notify_event (GtkWidget *widget, GdkEventCrossing *event)
-{
- cursor_proximity = FALSE;
- update_cursor (widget, cursor_x, cursor_y);
- return TRUE;
-}
-
-void
-input_dialog_destroy (GtkWidget *w, gpointer data)
-{
- *((GtkWidget **)data) = NULL;
-}
-
-void
-create_input_dialog ()
-{
- static GtkWidget *inputd = NULL;
-
- if (!inputd)
- {
- inputd = gtk_input_dialog_new();
-
- gtk_signal_connect (GTK_OBJECT(inputd), "destroy",
- (GtkSignalFunc)input_dialog_destroy, &inputd);
- gtk_signal_connect_object (GTK_OBJECT(GTK_INPUT_DIALOG(inputd)->close_button),
- "clicked",
- (GtkSignalFunc)gtk_widget_hide,
- GTK_OBJECT(inputd));
- gtk_widget_hide ( GTK_INPUT_DIALOG(inputd)->save_button);
-
- gtk_signal_connect (GTK_OBJECT(inputd), "enable_device",
- (GtkSignalFunc)check_cursor, NULL);
- gtk_widget_show (inputd);
- }
- else
- {
- if (!GTK_WIDGET_MAPPED(inputd))
- gtk_widget_show(inputd);
- else
- gdk_window_raise(inputd->window);
- }
-}
-
-void
-quit ()
-{
- gtk_exit (0);
-}
-
-int
-main (int argc, char *argv[])
-{
- GtkWidget *window;
- GtkWidget *drawing_area;
- GtkWidget *vbox;
-
- GtkWidget *button;
-
- gtk_init (&argc, &argv);
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_widget_set_name (window, "Test Input");
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (window), vbox);
- gtk_widget_show (vbox);
-
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (quit), NULL);
-
- /* Create the drawing area */
-
- drawing_area = gtk_drawing_area_new ();
- gtk_drawing_area_size (GTK_DRAWING_AREA (drawing_area), 200, 200);
- gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0);
-
- gtk_widget_show (drawing_area);
-
- /* Signals used to handle backing pixmap */
-
- gtk_signal_connect (GTK_OBJECT (drawing_area), "expose_event",
- (GtkSignalFunc) expose_event, NULL);
- gtk_signal_connect (GTK_OBJECT(drawing_area),"configure_event",
- (GtkSignalFunc) configure_event, NULL);
-
- /* Event signals */
-
- gtk_signal_connect (GTK_OBJECT (drawing_area), "motion_notify_event",
- (GtkSignalFunc) motion_notify_event, NULL);
- gtk_signal_connect (GTK_OBJECT (drawing_area), "button_press_event",
- (GtkSignalFunc) button_press_event, NULL);
- gtk_signal_connect (GTK_OBJECT (drawing_area), "key_press_event",
- (GtkSignalFunc) key_press_event, NULL);
-
- gtk_signal_connect (GTK_OBJECT (drawing_area), "leave_notify_event",
- (GtkSignalFunc) leave_notify_event, NULL);
- gtk_signal_connect (GTK_OBJECT (drawing_area), "proximity_out_event",
- (GtkSignalFunc) proximity_out_event, NULL);
-
- gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK
- | GDK_LEAVE_NOTIFY_MASK
- | GDK_BUTTON_PRESS_MASK
- | GDK_KEY_PRESS_MASK
- | GDK_POINTER_MOTION_MASK
- | GDK_POINTER_MOTION_HINT_MASK
- | GDK_PROXIMITY_OUT_MASK);
-
- /* The following call enables tracking and processing of extension
- events for the drawing area */
- gtk_widget_set_extension_events (drawing_area, GDK_EXTENSION_EVENTS_ALL);
-
- gtk_widget_grab_focus (drawing_area);
-
- /* .. And create some buttons */
- button = gtk_button_new_with_label ("Input Dialog");
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
-
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (create_input_dialog), NULL);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Quit");
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
-
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (window));
- gtk_widget_show (button);
-
- gtk_widget_show (window);
-
- gtk_main ();
-
- return 0;
-}
diff --git a/tests/testselection.c b/tests/testselection.c
deleted file mode 100644
index 6a05929131..0000000000
--- a/tests/testselection.c
+++ /dev/null
@@ -1,468 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <string.h>
-#include "gtk.h"
-
-typedef enum {
- SEL_TYPE_NONE,
- APPLE_PICT,
- ATOM,
- ATOM_PAIR,
- BITMAP,
- C_STRING,
- COLORMAP,
- COMPOUND_TEXT,
- DRAWABLE,
- INTEGER,
- PIXEL,
- PIXMAP,
- SPAN,
- STRING,
- TEXT,
- WINDOW,
- LAST_SEL_TYPE
-} SelType;
-
-GdkAtom seltypes[LAST_SEL_TYPE];
-
-typedef struct _Target {
- gchar *target_name;
- SelType type;
- GdkAtom target;
- gint format;
- GtkSelectionFunction *handler;
-} Target;
-
-/* The following is a list of all the selection targets defined
- in the ICCCM */
-
-static Target targets[] = {
- { "ADOBE_PORTABLE_DOCUMENT_FORMAT", STRING, 0, 8, NULL },
- { "APPLE_PICT", APPLE_PICT, 0, 8, NULL },
- { "BACKGROUND", PIXEL, 0, 32, NULL },
- { "BITMAP", BITMAP, 0, 32, NULL },
- { "CHARACTER_POSITION", SPAN, 0, 32, NULL },
- { "CLASS", TEXT, 0, 8, NULL },
- { "CLIENT_WINDOW", WINDOW, 0, 32, NULL },
- { "COLORMAP", COLORMAP, 0, 32, NULL },
- { "COLUMN_NUMBER", SPAN, 0, 32, NULL },
- { "COMPOUND_TEXT", COMPOUND_TEXT, 0, 8, NULL },
- /* { "DELETE", "NULL", 0, ?, NULL }, */
- { "DRAWABLE", DRAWABLE, 0, 32, NULL },
- { "ENCAPSULATED_POSTSCRIPT", STRING, 0, 8, NULL },
- { "ENCAPSULATED_POSTSCRIPT_INTERCHANGE", STRING, 0, 8, NULL },
- { "FILE_NAME", TEXT, 0, 8, NULL },
- { "FOREGROUND", PIXEL, 0, 32, NULL },
- { "HOST_NAME", TEXT, 0, 8, NULL },
- /* { "INSERT_PROPERTY", "NULL", 0, ? NULL }, */
- /* { "INSERT_SELECTION", "NULL", 0, ? NULL }, */
- { "LENGTH", INTEGER, 0, 32, NULL },
- { "LINE_NUMBER", SPAN, 0, 32, NULL },
- { "LIST_LENGTH", INTEGER, 0, 32, NULL },
- { "MODULE", TEXT, 0, 8, NULL },
- /* { "MULTIPLE", "ATOM_PAIR", 0, 32, NULL }, */
- { "NAME", TEXT, 0, 8, NULL },
- { "ODIF", TEXT, 0, 8, NULL },
- { "OWNER_OS", TEXT, 0, 8, NULL },
- { "PIXMAP", PIXMAP, 0, 32, NULL },
- { "POSTSCRIPT", STRING, 0, 8, NULL },
- { "PROCEDURE", TEXT, 0, 8, NULL },
- { "PROCESS", INTEGER, 0, 32, NULL },
- { "STRING", STRING, 0, 8, NULL },
- { "TARGETS", ATOM, 0, 32, NULL },
- { "TASK", INTEGER, 0, 32, NULL },
- { "TEXT", TEXT, 0, 8 , NULL },
- { "TIMESTAMP", INTEGER, 0, 32, NULL },
- { "USER", TEXT, 0, 8, NULL },
-};
-
-static int num_targets = sizeof(targets)/sizeof(Target);
-
-static int have_selection = FALSE;
-
-GtkWidget *selection_text;
-GtkWidget *selection_button;
-GString *selection_string = NULL;
-
-static void
-init_atoms ()
-{
- int i;
-
- seltypes[SEL_TYPE_NONE] = GDK_NONE;
- seltypes[APPLE_PICT] = gdk_atom_intern ("APPLE_PICT",FALSE);
- seltypes[ATOM] = gdk_atom_intern ("ATOM",FALSE);
- seltypes[ATOM_PAIR] = gdk_atom_intern ("ATOM_PAIR",FALSE);
- seltypes[BITMAP] = gdk_atom_intern ("BITMAP",FALSE);
- seltypes[C_STRING] = gdk_atom_intern ("C_STRING",FALSE);
- seltypes[COLORMAP] = gdk_atom_intern ("COLORMAP",FALSE);
- seltypes[COMPOUND_TEXT] = gdk_atom_intern ("COMPOUND_TEXT",FALSE);
- seltypes[DRAWABLE] = gdk_atom_intern ("DRAWABLE",FALSE);
- seltypes[INTEGER] = gdk_atom_intern ("INTEGER",FALSE);
- seltypes[PIXEL] = gdk_atom_intern ("PIXEL",FALSE);
- seltypes[PIXMAP] = gdk_atom_intern ("PIXMAP",FALSE);
- seltypes[SPAN] = gdk_atom_intern ("SPAN",FALSE);
- seltypes[STRING] = gdk_atom_intern ("STRING",FALSE);
- seltypes[TEXT] = gdk_atom_intern ("TEXT",FALSE);
- seltypes[WINDOW] = gdk_atom_intern ("WINDOW",FALSE);
-
- for (i=0; i<num_targets; i++)
- targets[i].target = gdk_atom_intern (targets[i].target_name, FALSE);
-}
-
-void
-selection_toggled (GtkWidget *widget)
-{
- if (GTK_TOGGLE_BUTTON(widget)->active)
- {
- have_selection = gtk_selection_owner_set (widget,
- GDK_SELECTION_PRIMARY,
- GDK_CURRENT_TIME);
- if (!have_selection)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(widget), FALSE);
- }
- else
- {
- if (have_selection)
- {
- if (gdk_selection_owner_get (GDK_SELECTION_PRIMARY) == widget->window)
- gtk_selection_owner_set (NULL, GDK_SELECTION_PRIMARY,
- GDK_CURRENT_TIME);
- have_selection = FALSE;
- }
- }
-}
-
-void
-selection_handle (GtkWidget *widget,
- GtkSelectionData *selection_data, gpointer data)
-{
- guchar *buffer;
- gint len;
-
- if (!selection_string)
- {
- buffer = NULL;
- len = 0;
- }
- else
- {
- buffer = selection_string->str;
- len = selection_string->len;
- }
-
- gtk_selection_data_set (selection_data,
- selection_data->target == seltypes[COMPOUND_TEXT] ?
- seltypes[COMPOUND_TEXT] : seltypes[STRING],
- 8, buffer, len);
-}
-
-gint
-selection_clear (GtkWidget *widget, GdkEventSelection *event)
-{
- have_selection = FALSE;
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(widget), FALSE);
-
- return TRUE;
-}
-
-gchar *
-stringify_atom (guchar *data, gint *position)
-{
- gchar *str = gdk_atom_name (*(GdkAtom *)(data+*position));
- *position += sizeof(GdkAtom);
-
- return str;
-}
-
-gchar *
-stringify_text (guchar *data, gint *position)
-{
- gchar *str = g_strdup ((gchar *)(data+*position));
- *position += strlen (str) + 1;
-
- return str;
-}
-
-gchar *
-stringify_xid (guchar *data, gint *position)
-{
- gchar buffer[20];
- gchar *str;
-
- sprintf(buffer,"0x%x",*(guint32 *)(data+*position));
- str = g_strdup (buffer);
-
- *position += sizeof(guint32);
-
- return str;
-}
-
-gchar *
-stringify_integer (guchar *data, gint *position)
-{
- gchar buffer[20];
- gchar *str;
-
- sprintf(buffer,"%d",*(int *)(data+*position));
- str = g_strdup (buffer);
-
- *position += sizeof(int);
-
- return str;
-}
-
-gchar *
-stringify_span (guchar *data, gint *position)
-{
- gchar buffer[42];
- gchar *str;
-
- sprintf(buffer,"%d - %d",((int *)(data+*position))[0],
- ((int *)(data+*position))[1]);
- str = g_strdup (buffer);
-
- *position += 2*sizeof(int);
-
- return str;
-}
-
-void
-selection_received (GtkWidget *widget, GtkSelectionData *data)
-{
- int position;
- int i;
- SelType seltype;
- char *str;
-
- if (data->length < 0)
- {
- g_print("Error retrieving selection\n");
- return;
- }
-
- seltype = SEL_TYPE_NONE;
- for (i=0; i<LAST_SEL_TYPE; i++)
- {
- if (seltypes[i] == data->type)
- {
- seltype = i;
- break;
- }
- }
-
- if (seltype == SEL_TYPE_NONE)
- {
- char *name = gdk_atom_name (data->type);
- g_print("Don't know how to handle type: %s (%ld)\n",
- name?name:"<unknown>",
- data->type);
- return;
- }
-
- if (selection_string != NULL)
- g_string_free (selection_string, TRUE);
-
- selection_string = g_string_new (NULL);
-
- gtk_text_freeze (GTK_TEXT (selection_text));
- gtk_text_set_point (GTK_TEXT (selection_text), 0);
- gtk_text_forward_delete (GTK_TEXT (selection_text),
- gtk_text_get_length (GTK_TEXT (selection_text)));
-
- position = 0;
- while (position < data->length)
- {
- switch (seltype)
- {
- case ATOM:
- str = stringify_atom (data->data, &position);
- break;
- case COMPOUND_TEXT:
- case STRING:
- case TEXT:
- str = stringify_text (data->data, &position);
- break;
- case BITMAP:
- case DRAWABLE:
- case PIXMAP:
- case WINDOW:
- case COLORMAP:
- str = stringify_xid (data->data, &position);
- break;
- case INTEGER:
- case PIXEL:
- str = stringify_integer (data->data, &position);
- break;
- case SPAN:
- str = stringify_span (data->data, &position);
- break;
- default:
- {
- char *name = gdk_atom_name (data->type);
- g_print("Can't convert type %s (%ld) to string\n",
- name?name:"<unknown>",
- data->type);
- position = data->length;
- continue;
- }
- }
- gtk_text_insert (GTK_TEXT (selection_text), NULL,
- &selection_text->style->black,
- NULL, str, -1);
- gtk_text_insert (GTK_TEXT (selection_text), NULL,
- &selection_text->style->black,
- NULL, "\n", -1);
- g_string_append (selection_string, str);
- g_free (str);
- }
- gtk_text_thaw (GTK_TEXT (selection_text));
-}
-
-void
-paste (GtkWidget *widget, GtkWidget *entry)
-{
- char *name;
- GdkAtom atom;
-
- name = gtk_entry_get_text (GTK_ENTRY(entry));
- atom = gdk_atom_intern (name, FALSE);
-
- if (atom == GDK_NONE)
- {
- g_print("Could not create atom: \"%s\"\n",name);
- return;
- }
-
- gtk_selection_convert (selection_button, GDK_SELECTION_PRIMARY, atom,
- GDK_CURRENT_TIME);
-}
-
-void
-quit ()
-{
- gtk_exit (0);
-}
-
-int
-main (int argc, char *argv[])
-{
- GtkWidget *dialog;
- GtkWidget *button;
- GtkWidget *table;
- GtkWidget *label;
- GtkWidget *entry;
- GtkWidget *hscrollbar;
- GtkWidget *vscrollbar;
- GtkWidget *hbox;
-
- gtk_init (&argc, &argv);
-
- init_atoms();
-
- dialog = gtk_dialog_new ();
- gtk_widget_set_name (dialog, "Test Input");
- gtk_container_border_width (GTK_CONTAINER(dialog), 0);
-
- gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
- GTK_SIGNAL_FUNC (quit), NULL);
-
- table = gtk_table_new (4, 2, FALSE);
- gtk_container_border_width (GTK_CONTAINER(table), 10);
-
- gtk_table_set_row_spacing (GTK_TABLE (table), 0, 5);
- gtk_table_set_row_spacing (GTK_TABLE (table), 1, 2);
- gtk_table_set_row_spacing (GTK_TABLE (table), 2, 2);
- gtk_table_set_col_spacing (GTK_TABLE (table), 0, 2);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG(dialog)->vbox),
- table, TRUE, TRUE, 0);
- gtk_widget_show (table);
-
- selection_button = gtk_toggle_button_new_with_label ("Claim Selection");
- gtk_table_attach (GTK_TABLE (table), selection_button, 0, 2, 0, 1,
- GTK_EXPAND | GTK_FILL, 0, 0, 0);
- gtk_widget_show (selection_button);
-
- gtk_signal_connect (GTK_OBJECT(selection_button), "toggled",
- GTK_SIGNAL_FUNC (selection_toggled), NULL);
- gtk_signal_connect (GTK_OBJECT(selection_button), "selection_clear_event",
- GTK_SIGNAL_FUNC (selection_clear), NULL);
- gtk_signal_connect (GTK_OBJECT(selection_button), "selection_received",
- GTK_SIGNAL_FUNC (selection_received), NULL);
-
- gtk_selection_add_handler (selection_button, GDK_SELECTION_PRIMARY,
- seltypes[STRING], selection_handle, NULL);
-
- gtk_selection_add_handler (selection_button, GDK_SELECTION_PRIMARY,
- seltypes[TEXT], selection_handle, NULL);
-
- gtk_selection_add_handler (selection_button, GDK_SELECTION_PRIMARY,
- seltypes[COMPOUND_TEXT],
- selection_handle, NULL);
-
- selection_text = gtk_text_new (NULL, NULL);
- gtk_table_attach_defaults (GTK_TABLE (table), selection_text, 0, 1, 1, 2);
- gtk_widget_show (selection_text);
-
- hscrollbar = gtk_hscrollbar_new (GTK_TEXT (selection_text)->hadj);
- gtk_table_attach (GTK_TABLE (table), hscrollbar, 0, 1, 2, 3,
- GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
- gtk_widget_show (hscrollbar);
-
- vscrollbar = gtk_vscrollbar_new (GTK_TEXT (selection_text)->vadj);
- gtk_table_attach (GTK_TABLE (table), vscrollbar, 1, 2, 1, 2,
- GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (vscrollbar);
-
- hbox = gtk_hbox_new (FALSE, 2);
- gtk_table_attach (GTK_TABLE (table), hbox, 0, 2, 3, 4,
- GTK_EXPAND | GTK_FILL, 0, 0, 0);
- gtk_widget_show (hbox);
-
- label = gtk_label_new ("Target:");
- gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0);
- gtk_widget_show (label);
-
- entry = gtk_entry_new ();
- gtk_box_pack_start (GTK_BOX(hbox), entry, TRUE, TRUE, 0);
- gtk_widget_show (entry);
-
- /* .. And create some buttons */
- button = gtk_button_new_with_label ("Paste");
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG(dialog)->action_area),
- button, TRUE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (paste), entry);
- gtk_widget_show (button);
-
- button = gtk_button_new_with_label ("Quit");
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG(dialog)->action_area),
- button, TRUE, TRUE, 0);
-
- gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (dialog));
- gtk_widget_show (button);
-
- gtk_widget_show (dialog);
-
- gtk_main ();
-
- return 0;
-}