Collapse the gnome2 branch back into HEAD.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@11565 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton
2005-11-02 03:32:36 +00:00
parent 02dbf6e134
commit f28d033d74
1554 changed files with 260156 additions and 80266 deletions

View File

@@ -32,6 +32,7 @@ ltconfig
make-gnucash-patch
make-gnucash-potfiles
missing
mkinstalldirs
stamp-h
stamp-h1
stamp-h.in
@@ -50,5 +51,11 @@ tags
*.diff
*.diffs
*.xac.*.xac
autom4te.cache
ltmain.sh
mkinstalldirs
.DS_Store
*.prj
*.pws
.tm_project.cache

View File

@@ -101,6 +101,7 @@ Paul Campbell <kemitix@users.sourceforge.net> reconcile children patch
Conrad Canterford <conrad@mail.watersprite.com.au> register bug fix
Bill Carlson <wwc@wwcnet.nu> performance improvements
David Mar?n Carre?o <davefx@aspl.f2s.com> Spanish translation of account setup.
Tomas Cernaj <tcernaj@gmx.de> GType consistency changes
Carol Champagne <carol@io.com> documentation & a patient GUI usability critic
Nikos Charonitakis <charosn@her.forthnet.gr> Greek translation
Graham Chapman <grahamc@zeta.org.au> for the xacc-rpts addon package
@@ -170,6 +171,7 @@ G. Allen Morris III <gam3@ann.softgams.com> for QIF core dump
Steven Murdoch <sjmurdoch@bigfoot.com> gnc-prices fix for London exchange
Jose Carlos Nascimento <joseca@psabs.com> Brazilian Portuguese translation
Brent Neal <brent@baton.phys.lsu.edu> TIAA-CREF support.
Christian Neumair <chris@gnome-de.org> Various gnome2 fixes/HIG work.
Johnny Ernst Nielsen <j.e.nielsen@iname.com> messages Danish translation
Stefan Nobis <stefan-ml@snobis.de> German translation patch
Martin Norb<72>ck <d95mback@dtek.chalmers.se> Swedish translation
@@ -178,6 +180,7 @@ Bill Nottingham <notting@redhat.com> guile configure patch
Peter O'Gorman <peter@pogma.com> file i/o patches, Mac OS X patches
OmNiBuS <webmaster@obsidian.uia.net> web site graphics & content
Gordon Oliver <gordo@pincoya.com> multiple currency status line patch
Scott Oonk <s.oonk@comcast.net>, <scott.oonk@gmail.com> utf-8 changes.
Alan Orndorff <dwarf@solarisresources.com> Solaris packager
Myroslav Opyr <mopyr@IPM.Lviv.UA> for misc patches
Laurent P{'e}lecq <laurent.pelecq@wanadoo.fr> i18n patches with gettext
@@ -210,6 +213,7 @@ Arnold Troeger <troeger@samart.co.th> Mandrake packager
Diane Trout <detrout@earthlink.net> scheme QIF import patch
Richard -Gilligan- Uschold <uschold@cs.ucf.edu> tax report & txf export
Matthew Vanecek <mevanecek@yahoo.com> for pg_config configure.in patch
Didier Vidal <didier-devel@9online.fr> various G2 fixes.
Richard Wackerbarth <rkw@dataplex.net> patch to gnc-prices, qif import fixes
Rob Walker <rob@valinux.com> guile and register patches
Andy Wingo <wingo@pobox.com> income per day-of-week report

6339
ChangeLog

File diff suppressed because it is too large Load Diff

443
GNOME2_STATUS Normal file
View File

@@ -0,0 +1,443 @@
# -*- reStructuredText -*-
Intro
-----
This is a ad-hoc list of what works and doesn't work in the g2
port of gnucash. The plan is to finish porting those parts of gnucash
that have already been started (i.e. new windowing system, account
tree, commodities tree, etc.), but not to port any additional features
unless absolutely required. The clist/ctree widgets *do* still exist
in gtk2 and can be used, even though they've been marked as deprecated
and will disappear in a future release. Its important to get this
release out the door and not stall it until all the deprecated
functionality has been removed.
+--------------------------------------+
| Last sync with HEAD on 2005-10-31 |
+--------------------------------------+
========================================
DONE
========================================
Help
Financial Calculator
Commodity Editor
Price Editor
Reconcile
Transfer
View Toolbar
View Statusbar
Properties Dialog
QIF Import
OFX Import
HBCI Actions
Export Accounts
Stock Split Dialog
+-----
| Can someone who comes across this note and wants to help please go
| through 1.8.9 and create a list of stuff missing from 2.0?
+------------
========================================
General Notes
========================================
Resources
---------
- Porting applications to the GNOME 2.0 Platform -- http://developer.gnome.org/dotplan/porting/
- Should switch from `gnome_config` to gconf...
- Introduction to GConf -- http://developer.gnome.org/feature/archive/gconf/gconf.html
- General
- Printing
- Tested? Reporting? Accounts?
- Startup CRITICAL errors...
[jsled@phoenix:~/stuff/proj/gnucash/src-g2/gnucash]$ /opt/gnc-g2-unstable/bin/gnucash
(gnucash:7823): GLib-GObject-CRITICAL **: file gvaluetypes.c: line 741 (g_value_set_string): assertion `G_VALUE_HOLDS_STRING (value)' failed
(gnucash:7823): GLib-GObject-CRITICAL **: file gobject.c: line 1239 (g_object_set_property): assertion `G_IS_VALUE (value)' failed
(gnucash:7823): GLib-GObject-CRITICAL **: file gvalue.c: line 149 (g_value_unset): assertion `G_IS_VALUE (value)' failed
(gnucash:7823): GLib-GObject-CRITICAL **: file gvaluetypes.c: line 741 (g_value_set_string): assertion `G_VALUE_HOLDS_STRING (value)' failed
(gnucash:7823): GLib-GObject-CRITICAL **: file gobject.c: line 1239 (g_object_set_property): assertion `G_IS_VALUE (value)' failed
(gnucash:7823): GLib-GObject-CRITICAL **: file gvalue.c: line 149 (g_value_unset): assertion `G_IS_VALUE (value)' failed
(gnucash:7823): GLib-GObject-CRITICAL **: file gvaluetypes.c: line 741 (g_value_set_string): assertion `G_VALUE_HOLDS_STRING (value)' failed
(gnucash:7823): GLib-GObject-CRITICAL **: file gobject.c: line 1239 (g_object_set_property): assertion `G_IS_VALUE (value)' failed
(gnucash:7823): GLib-GObject-CRITICAL **: file gvalue.c: line 149 (g_value_unset): assertion `G_IS_VALUE (value)' failed
Use of deprecated SAXv1 function getLineNumber
- Window size/position not being saved or used.
- Dialog window positions are now saved. Saving position of the
main window is in progress. Please annotate this file with any
windows whose positions are not saved but you think they should be.
- The main windows do not yet support saving position/size
information. (On my list - DRH)
- Open pages are no longer open after reopening file.
- Weird pango_layout_set_text "string not UTF-8" issues reported by Neil Williams:
- http://lists.gnucash.org/pipermail/gnucash-devel/2005-March/012797.html
- http://lists.gnucash.org/pipermail/gnucash-devel/2005-March/012824.html
- Register Core - mostly functional
- mouse wheel up/down events only work if mouse-focused on scroll bar / are
not passed from the sheet to the scroll.
- (fixed, notes) Completion has problems. It does complete when a
character is typed but it fails to select the inserted text. This means
that the next character typed is inserted instead of continuing to test
for completion
- This is better, but by hacking around GTK... it appears that both
2.4(.14) and 2.6(.8) disallow the editable's selection to be set in the
char-insert callback/handler. Instead, we register a one-shot
immediate callback for the idle loop to do the selection.
- doesn't remember custom check formats.
- duplicate-transaction dialog is not initialized with transaction number
- Reconcile
- Crash after initial value-prompting dialog:
#0 0x400f65e8 in waitpid () from /lib/libpthread.so.0
#1 0x405e8a90 in ?? () from /usr/lib/libgnomeui-2.so.0
#2 0x405ab116 in libgnomeui_module_info_get () from /usr/lib/libgnomeui-2.so.0
#3 0x400f5393 in __pthread_clock_settime () from /lib/libpthread.so.0
#4 <signal handler called>
#5 0x40d88809 in gnc_xfer_dialog_show_inc_exp_visible_cb (account=0x84d8cc8, data=0x8522a28) at dialog-transfer.c:414
#6 0x40dc0877 in gnc_tree_view_account_filter_helper (model=0x855e828, iter=0xbfffdc70, data=0x855e828) at gnc-tree-view-account.c:718
#7 0x40430d46 in egg_tree_model_filter_visible (filter=0x854bce0, child_iter=0xbfffdc70) at eggtreemodelfilter.c:618
#8 0x404341de in egg_tree_model_filter_row_changed (c_model=0x84aa138, c_path=0x8620470, c_iter=0x8640c60, data=0x84d8cc8) at eggtreemodelfilter.c:990
#9 0x40a7e185 in _gtk_marshal_VOID__BOXED_BOXED () from /usr/lib/libgtk-x11-2.0.so.0
#10 0x40313310 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#11 0x40327076 in g_signal_emit_by_name () from /usr/lib/libgobject-2.0.so.0
#12 0x40326047 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
- Reporting / Graphing [mostly functional]
- Menus added in reverse order.
- Probably a detail of gtk-ui-manager merging; should be controllable in
gnc-menu-extensions.c.
- Graphing working, with some known issue; see top
of src/gnome-utils/gnc-html-graph-gog.c for more detail.
- colors
- axis-label string rotation
- Known issue with height/width bug in libgtkhtml 3.3.2 (on FC3).
- When rendering, progress bar always says "Rendering 'Untitled' report...".
- warlord reports this was true in 1.8 as well.
- Importing
- HBCI - Transaction templates eventually need to be converted from a GTK_CLIST
to a GTK_TREE_VIEW. Currently working as a GtkClist.
- Notebook tabs
- When opening multiple report tabs, all reports get tab title of
first report. [FIXED]
- Account Tree tab title is unaffected by "Name of Account View" option.
- Also, changing that option doesn't affect dirty status of options
dialog. [ FIXED ]
- Budgeting
- Budget Report
- the default account selection isn't very reasonable, Inc & Exp
would be better
- sometimes negative numbers render on two lines in their table-cell
- Budget GUI
- default account filter doesn't take effect until options are
opened, should take effect as soon as view is opened
- it might be nice to disallow some of the more unusual recurrences
- better if budget list dialog allowed double click to open
- need help text
- should displaying zero values be optional?
- it'd be nice if there was a summary column at the far right
- Budget Engine
- Do budgets play nice with QSF?
- Still a lot of dead legacy code hanging around
- New Account Hierarchy - somewhat works
- Simply invoking, even if cancelled, trashes current book state?
- Sometimes crashes when loading account data.
- Main account selection layout is too (visually) compressed
- Should have two columns: left={category(80%) + detailed-description(20%)}, right={category-accounts(100%)}
- See 'relayout Hierarchy' in src/gnome/glade/account.glade.
- Account tree's only column (account name) is relatively thin, truncating
some titles.
- It seems that gnc_tree_view_add_text_column sets column-width based on
an example string, whereas in this use-case the best would be to set to
'0'(=autosize).
- Account Hierarchy Merge - BROKEN
- Bad integration with Account Hierarchy druid
- Static variables used for process/window state.
- Misc errors with no apparent cause
- (gnucash:27485): Gtk-CRITICAL **: gtk_widget_event: assertion `WIDGET_REALIZED_FOR_EVENT (widget, event)' failed
- (gnucash:27485): Gtk-CRITICAL **: gtk_widget_event: assertion `WIDGET_REALIZED_FOR_EVENT (widget, event)' failed
- Doesn't let you complete the conflict resolution process, thus you can never complete the druid.
- (jsled) actually, it just doesn't display the 1-conflict -> 0-conflict
transition in the UI correctly, but it does allow you to finish.
- conflict-resolution process/display issues.
- Backend
- price_lookup awaits a solution - as a query instead of a backend operation.
- Scheduled Transactions
- Since Last Run dialog spews console-crap on init, generally broken?
- SX Editor
- "Register Lines" preference not respected.
- When tabbing from memo to account on the second split with the same
name as the first, the account will be auto-populated with a GUID
(instead of an account name), but not a valid one.
- Template-register Cut/Copy/Paste not connected.
- Template-register View > {Basic, Auto-Split} options have no effect.
- Open SX Editor, close it; open Register Preferences, change "Draw
{horiz,vert} lines" => crash.
- Entering a value (e.g. '20.00') without entering an account or a memo for
the first split causes everything else entered so far to be reset when
tabbing to the second split.
- Font hard-coded (dense-cal), especially broken for non-ISO8859-1 locales.
- http://bugzilla.gnome.org/show_bug.cgi?id=303180
========================================
ENHANCEMENTS
========================================
- New icons
- Add account.
- Register
- Report
- "Report options", especially, since it often confuses users.
- In-place editing
- Provide in-place editing where feasable. Eg. Editing the account code
or the account name, but not being able to re-parent the account. (Maybe
add DND support for this in long-term?)
- File Menu
- Rename "New Account Tree" to "Display Account Tree" as "New" gives the
impression that a creation of something will occur. PJK
- Find
- There's no way to edit/refine a search.
[There's no way to do so in 1.8, either...]
- Main Window
- Change Notebook tabs to include an 'x' to act as the "close tab" method,
and then remove the "Close" button from the toolbar. Then we can also
decide if we want to allow a user to 'close' the account tree.
-----------------------------------------
<#GOG> ----------------------------------
These are notes jsled was using during the GOG hack-porting effort.
[dc:created 2004-12-17]
gog-guru.c
\- gog-guru.h
\- goffice-graph.h
\- <glib.h>
\- data-structures
\- command-context.h
\- <goffice/goffice-config.h>
\- <gnumeric-config.h> + "When the module splits we'll make this a real file"
\- <goffice/graph/gog-object.h>
\- <goffice/graph/goffice-graph.h>
\- <glib-object.h>
\- <command-context.h> /* for GnmCmdContext */
\- <libart_lgpl/art_rect.h>
\- <goffice/graph/gog-graph.h>
\- [nothing new]
\- <goffice/graph/gog-object.h>
\- [nothing new]
\- <goffice/graph/gog-chart.h>
\- <goffice/graph/gog-plot.h>
\- <goffice/utils/goffice-utils.h>
\- <glib.h>
\- decls
\- <goffice/graph/gog-view.h>
\- <goffice/graph/gog-plot-engine.h>
\- <goffice/graph/gog-data-allocator.h>
\- <goffice/graph/gog-control-foocanvas.h>
\- <goffice/graph/gog-renderer-pixbuf.h>
\- <gui-util.h>
\- "workbook-control-gui.h"
\- "error-info.h"
\- "command-context.h"
\- "gutils.h"
<#goffice/graph> :depOn [ :module <#libart> ].
<file:gog-plot-engine.c>
:depOn [ :module <#gsf>; :how "entirely [?] for GSF_CLASS macros" ]
,[ :module <#gnumeric-plugin>; :how "plot-engine loading" ].
<file:gog-graph.c>
:depOn [ :module <#gsf>; :how "entirely [?] for GSF_CLASS macros." ].
<file:gog-view.c>
:depOn [ :module <#gsf> ].
<file:gog-object.c> :depOn [ :module <#gsf> ].
<file:gog-renderer.c>
:depOn [ :module <utils/go-math.h>; :how "basic math aliasing." ]
,[ :module <utils/go-units.h>; :how "basic unit-typing/aliasing." ]
,[ :module <utils/go-font.h>; :how "font aliasing; pango, mostly." ]
<file:gog-renderer-impl.h>
:depOn [ :module <#go-line> ].
<#go-line> :depOn [ :module <#gui-utils> ].
<file:gog-renderer-pixbuf.c>
:depOn [ :module <#gsf>; :how "weakly" ]
,[ :module <#pango> ]
,[ :module <#libart> ]
,[ :module <#gnumeric-app>; :how "for the `gnm_app_display_dpi_get(...)` call, apparently." ]
.
<file:gog-control-foocanvas.c>
:depOn [ :module <#gnm-libfoocanvas-copy>; :note "we can do without this." ].
<file:gog-axis.c>
:depOn [ :module <#gnm-widget-format-selector>; :how "??" ]
,[ :module <#gnm-gui-util>; :how "`number_format_selector_set_style_format`" ]
,[ :module <#gnm-format.h>; :how "`style_format_is_general`" ]
.
------------------------------
[jsled@phoenix:~/stuff/programming/projects/gnucash-budget/src-gnome2/gnucash/lib/goffice]$ nm -a .libs/libgoffice.a | ./symbols.py | egrep -v "(xml|gtk_|g_|gdk_|pango_|gsf_|art_|gnome_|glade_)" | sort
# some manual cleanup of the results results in the list here:
error_info_free
error_info_print
- provided by error-info.[hc]
font_selector_get_pango
font_selector_get_type
font_selector_new
font_selector_set_from_pango
- used by gog-style.c:gog_style_editor.
- gog_styled_object_editor, however, is called from gog-{axis,label,legend,series}.
format_value
- seems straightforward, but depends on format logic.
gnm_app_display_dpi_get
- thin wrapper over configuration; should be easy to stub out.
gnm_app_get_pixbuf
- called by go_action_combo_color_new, which isn't called in lib...
gnm_font_find_closest_from_weight_slant
- depends on gnome print, but nicely seperable.
gnm_measure_string
- nicely seperable; depends on pango.
gnm_pixbuf_intelligent_scale
- nicely seperable; depends on GdkPixbuf.
gnm_plugin_get_dir_name
gnm_plugin_use_ref
gnm_plugin_use_unref
- split/plugin.[hc]; seems to wrap plugin_* stuff...
gnm_setup_label_atk
- seperable
gnm_widget_disable_focus
- seperable
gnumeric_button_new_with_stock_image
- looks seperable [being stolen from gtkedit]
gnumeric_load_pixbuf
- depends weakly on gnumeric configuration path.
go_nan
- text symbol
gui_image_file_select
- used to select [fill] image file by gog-style ... do we need the UI
elements of gog-style here?
number_format_selector_get_type
number_format_selector_new
number_format_selector_set_style_format
plugin_service_define
plugin_service_get_description
plugin_service_get_plugin
plugin_service_get_type
plugin_service_gobject_loader_get_type
plugin_service_load
plugin_service_simple_get_type
style_format_as_XL
style_format_default_date
style_format_default_money
style_format_default_percentage
style_format_default_time
style_format_equal
style_format_general
style_format_new_XL
style_format_ref
style_format_unref

33
HACKING
View File

@@ -76,7 +76,7 @@ Starting Gnucash from the build tree:
To run gnucash from your build tree:
-- edit ./src/bin/overrides/gnucash and replace gnucash-env with
gnucash-build-env
./src/bin/overrides/gnucash-build-env
-- then start gnucash by saying ./src/bin/overrides/gnucash
-- Make sure you undo this change before installing gnucash
@@ -107,6 +107,33 @@ To run gdb on the version in your build tree:
[gdb output]
% gdb> run -e main -s ./src/bin/overrides/gnucash --g-fatal-warnings
To run gdb on an opt-style-install from your build tree:
$ ./gnucash-env gdb /usr/bin/guile
[gdb output]
gdb> run -e main -s ../libexec/overrides/gnucash --g-fatal-warning
You'll also probably want to know about these:
% gdb> catch fork
% gdb> set follow-fork-mode child
-----
It may be the case that running GDB from within emacs doesn't work for you,
with the following error:
[C-u M-x gdb /opt/gnucash-cvs/bin/gnucash-env gdb /usr/bin/guile...
...in buffer *gud-gdb*:]
/opt/gnucash-cvs/libexec/gnucash/overrides/gnucash-env: line 28: exec: -d: invalid option
exec: usage: exec [-cl] [-a name] file [redirection ...]
jsled needed to re-define a gud.el function as such:
(defun gud-gdb-massage-args (file args)
(let ((l (copy-list args)))
(nconc l (list "-cd" (expand-file-name default-directory) "-fullname"))))
Using Electric Fence with GnuCash
---------------------------------
@@ -126,10 +153,10 @@ Using Valgrind with GnuCash
-- run ./src/bin/overrides/gnucash-valgrind
However, I did not find valgrind to be useful. It reported a bunch of
guile bugs, some g_has_table bugs, and then the program exited prematurely
guile bugs, some g_hash_table bugs, and then the program exited prematurely
for no appearenet reason. :-(
For the moment, use the supressions in lib/gnucash_valgrind.supp.
For the moment, use the supressions in src/valgrind-gnucash.supp
This file needs to be cleaned up in two ways:

View File

@@ -7,23 +7,17 @@
# i.e. TAGS: etags.files $(shell cat etags.files) doesn't work right
# because etags.files contents are expanded before it's re-generated.
# The $(shell find . -type d) dependency seems to be pointless -- it
# always fires. It appears that someone's always touching something.
etags.files: $(shell find . -type d)
find . -path './debian' -prune -o -name '*.[ch]' -print -o -name '*.scm' -print | sort > etags.files.tmp
@if cmp --quiet etags.files etags.files.tmp; \
then \
echo "TAGS file list hasn't changed."; \
rm -f etags.files.tmp; \
else \
echo "TAGS file list has changed."; \
mv etags.files.tmp etags.files; \
fi
etags.files: $(shell find . -mindepth 1 -type d ! -name CVS ! -path "*/.*")
find . -path '*/.*' -prune -o \( -name '*.[ch]' -o -name '*.scm' \) \
-print | sort > etags.files.tmp
cmp -s etags.files etags.files.tmp || cp etags.files.tmp etags.files
rm -f etags.files.tmp
touch etags.files
# we don't need an etags.files dep here b/c you always call this after
# re-generating etags.files if needed from the top-level Makefile.am.
etags: $(shell cat etags.files)
TAGS: $(shell cat etags.files)
etags `cat etags.files`
ctags: $(shell cat etags.files)
tags: $(shell cat etags.files)
ctags `cat etags.files`

View File

@@ -1,5 +1,5 @@
SUBDIRS = intl m4 macros doc lib src intl-scm po rpm accounts
SUBDIRS = doc lib src intl-scm po rpm accounts
docdir = ${GNC_DOC_INSTALL_DIR}
@@ -33,9 +33,7 @@ m4data_DATA = gnucash.m4
# Don't list any directories or you'll get *everything*, including the
# CVS dirs.
EXTRA_DIST = config.rpath \
.cvsignore \
ChangeLog.1 \
EXTRA_DIST = ChangeLog.1 \
HACKING \
README.patches \
gnucash.lsm \
@@ -43,7 +41,12 @@ EXTRA_DIST = config.rpath \
gnucash-config.in \
make-gnucash-patch.in \
make-gnucash-potfiles.in \
po/.cvsignore \
macros/aqbanking.m4 \
macros/as-scrub-include.m4 \
macros/autogen.sh \
macros/compiler-flags.m4 \
macros/gnome-guile-checks.m4 \
macros/legacy_macros.m4 \
po/README \
po/glossary/da.po \
po/glossary/de.po \
@@ -94,7 +97,7 @@ etags:
# make sure etags.files is up to date.
${MAKE} -f Makefile.TAGS etags.files
# now use the contents of etags.files to re-make TAGS if needed.
${MAKE} -f Makefile.TAGS etags
${MAKE} -f Makefile.TAGS TAGS
else
@@ -109,7 +112,7 @@ ctags:
# make sure etags.files is up to date.
${MAKE} -f Makefile.TAGS etags.files
# now use the contents of etags.files to re-make TAGS if needed.
${MAKE} -f Makefile.TAGS ctags
${MAKE} -f Makefile.TAGS tags
else
@@ -120,7 +123,7 @@ endif
.PHONY: etags ctags
ACLOCAL_AMFLAGS = -I m4
ACLOCAL_AMFLAGS = -I macros -I m4
.PHONY: doc
doc:

72
README
View File

@@ -163,71 +163,7 @@ Dependencies
The following packages are required to be installed to run GnuCash:
Gnome 1.4: see www.gnome.org for more information.
guile: provides main extension language infrastructure, used
extensively in GnuCash for initialization & startup. Requires
version 1.3.4 or later. Version 1.4 is noticeably speedier and is
recommended if possible. You can obtain source from
ftp://ftp.gnu.org/pub/gnu/guile/guile-1.4.tar.gz
slib: scheme libraries for guile. Need version slib2c4 or later.
You can find source at
http://swissnet.ai.mit.edu/ftpdir/scm/slib2d1.zip
libpng: portable network graphics library. Any version. You can
find the source at
ftp://swrinde.nde.swri.edu/pub/png/src/libpng-1.0.9.tar.gz.
libjpeg: JPEG image handling library. Any version. Sources can be
found at ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz.
libz: compression library. Any version. You can find source at
http://www.gzip.org/zlib.tar.gz.
xpm: X Pixmap extension. Any version. Normally distributed with an
X installation. By default this is part of XFree86 4.0 or better.
You can also find this at
ftp://ftp.x.org/contrib/libraries/xpm-3.4k.tar.gz.
gnome-libs: version 1.2.0 or higher should work. The latest
version, 1.2.13, is of course recommended. These libraries
require numerous other supporting libraries, such as gtk and glib.
All of these can be found at ftp.gnome.org.
gnome-print: any recent version should work, however problems have
been reported with 0.28. This is a part of GNOME as well. Sources
at ftp://ftp.gnome.org/pub/GNOME/stable/sources/gnome-print
gdk-pixbuf: any recent version should work. This is typically
distributed with GNOME. Sources at
ftp://ftp.gnome.org/pub/GNOME/stable/sources/gdk-pixbuf.
gtkhtml: version 0.8 and later should work. You can obtain the latest
version of gtkhtml from Helix Code. Note that this has changed
since 1.4, which used the older gtkxmhtml library. Sources can be
found at ftp://ftp.gnome.org/pub/GNOME/unstable/sources/gtkhtml/.
guppi: version 0.35.3 should work. Version 0.35.5 is required for
some advanced functionality. This can be found at
ftp://ftp.gnome.org/pub/GNOME/stable/sources/Guppi. You may need
to configure it with `--prefix=/usr' in order for gnucash's
`configure' to find the guppi library. Note: Version 0.40.3
(released January 2002) has a problem with reversed legends in
stacked barcharts. Since Guppi development has halted since that
version, we can only provide a source code patch for Guppi 0.40.3
that fixes this problem. You find that patch in
lib/guppi-legend.patch.
libgal: any recent version should work. This is a GNOME related
library used by several different programs. You can find it at
ftp://ftp.gnome.org/pub/GNOME/unstable/sources/gal/.
libdb: Version 1.85 or a compatible version.
The above urls are from June 5, 2001. Source locations can change,
but will likely be found near the same place (maybe moved from
unstable to stable).
[FIXME; see README.dependencies]
To be able to use certain features of GnuCash, such as reports and
network stock price downloads, you must have the following packages
@@ -359,9 +295,9 @@ some of them:
The second style is the FSSTND, opt-style install. In this style,
all of the files are installed under a common subdirectory, often
in /usr/local/opt, with the binaries going to
/usr/local/opt/foo/bin, the libs going to /usr/local/opt/foo/lib,
etc. To request this style of install, just use the
--enable-opt-style-install option to ./configure.
/usr/local/opt/'packagename'/bin, the libs going to
/usr/local/opt/'packagename'/lib, etc. To request this style of
install, just use the --enable-opt-style-install option to ./configure.
If you only want a particular language installed, you can set the
LINGUAS environment variable before you run configure. For example,

199
README.dependencies Normal file
View File

@@ -0,0 +1,199 @@
GnuCash Dependency Policy
-------------------------
GnuCash desires to only depend on library versions and packages that are
practically available. Specifically, we choose to depend only on versions
that have been in the major distributions for 6 months. This is motivated in
part by the 1.6 release, which required a large set of relatively-recent
dependencies. Specifically, as most user's (distributions) did not have the
required versions packaged, it was exceedingly painful for end users to
upgrade to the anticipated release, leading to a reputation that gnucash
still has.
This document serves to keep track of the major distributions, the date of
their major release[s], and the relevant library versions as part of that
release (or an official package-upgrade path)
Libraries/Deps
--------------
aqbanking
cairo
gconf-2
glib[+gobject,module]-2
gtk+-2
guile
gwrap
libart-2
libglade-2
libgnomeprint-2.2
libgnomeui-2
libgsf-1
libofx
libxml-2
pango
libgoffice/libgsf details
-------------------------
- libgoffice-0.1.0
- glib-2.0 >= 2.6.3
- libgsf-1 >= 1.13.1
- libgsf-1.13.1
- glib-2.0 >= 2.6.0
- libxml-2.0 >= 2.4.16
- libbonobo-2.0 >= 2.0.0
- gnome-vfs-2.0 >= 2.2.0
- gnome-vfs-module-2.0 >= 2.2.0
- libxml-2.0 >= 2.4.12
- pango >= 1.8.1
- pangoft2 >= 1.8.1
- cairo >= 0.5.0 [optional]
- gtk+-2.0 >= 2.6.0
- libglade-2.0 >= 2.3.6
- libgnomeprint-2.2 >= 2.8.2
- libart-2.0 >= 2.3.11
- gconf-2.0
- libgnomeui-2.0 >= 2.0.0
- libgsf-gnome-1 >= 1.12.2
Status, 2005-10-15
------------------
The major distributions, as defined by http://distrowatch.com/dwres.php?resource=major, are:
- Ubuntu - http://www.ubuntu.com/
- 5.10 = 2005-10-13 - http://www.ubuntu.com/newsitems/release510
- *5.04 = 2005-04-08 - http://www.ubuntu.com/504Released
- Mandriva
- 2006 = 2005-10-06
- *2005 = 2005-04-14
- SUSE
- 10.0 = 2005-10-06
- aqbanking: not included; binary aqbanking-1.6.0 available at ftp://ftp.gwdg.de/linux/misc/suser-crauch/10.0/
- cairo-1.0.0
- gconf2-2.12.0
- glib2-2.8.1
- gtk2-2.8.3
- guile-1.6.7
- g-wrap: not included
- libart_lgpl-2.3.17
- libglade2-2.5.1
- libgnomeprint-2.12.0
- libgnomeui-2.12.0
- libgsf-1.12.1
- libofx-0.7.0
- libxml2-2.6.20
- pango-1.10.0
- *9.3 = 2005-04-15
- aqbanking: not included, but binary aqbanking-1.6.0 provided by upstream
- cairo-0.3.0
- gconf2-2.10.0
- glib2-2.6.3
- gtk2-2.6.4
- guile-1.6.7
- gwrap: not included
- libart_lgpl-2.3.17
- libglade2-2.5.1
- libgnomeprint-2.10.1
- libgnomeui-2.10.0
- libgsf-1.11.1
- libofx-0.7.0
- libxml2-2.6.17
- pango-1.8.1
- Fedora Core
- *FC4 = 2005-06-13
- g-wrap-1.3.4
- gconf2-2.10.0
- glib-2.6.6
- guile-1.6.7
- libart_lgpl-2.3.17
- libglade2-2.5.1
- libgnomeprint22-2.10.3
- libgnomeui-2.10.0
- libgsf-1.11.1
- libxml2-2.6.20
- pango-1.8.1
- FC3 = 2004-11-08
- Debian GNU/Linux
- unstable4
(already includes goffice and will include libqof1)
- Knoppix
- 4.0.2 = 2005-09-24
- *3.9 = 2005-06-01
- 3.8.2 = 2005-05-12
- MEPIS
- *3.3.1 = 2005-05-12
- Gentoo
- 2005.1 = 2005-08-08
[from http://distro.ibiblio.org/pub/linux/distributions/gentoo/releases/snapshots/2005.1/portage-20050709.tar.bz2]
- aqbanking-1.0.8
- cairo-0.4.0
- g-wrap-1.3.4
- gconf-2.10.0
- glib-2.6.5
- gtk+-2.6.8
- guile-1.6.7
- libart_lgpl-2.3.17
- libglade-2.5.1
- libgnomeprint-2.10.3
- libgnomeui-2.10.0
- libgsf-1.12.1
- libofx-0.7.0
- libxml2-2.6.19
- pango-1.8.1-r1
- 2005.0 = 2005-03-28
[from http://gentoo.osuosl.org/releases/x86/2005.0/packagecd/CONTENTS
and http://gentoo.osuosl.org/releases/snapshots/2005.0/portage-20050303.tar.bz2]
- aqbanking-1.0.4_beta, -0.9.9
- cairo-0.3.0-r1
- g-wrap-1.3.4-r1
- gconf-2.8.1-r1
- glib-2.6.2
- guile-1.6.7
- libart_gpl-2.3.16
- libglade-2.4.0
- libgnomeprint-2.8.1
- libgnomeui-2.8.1-r1
- libgsf-1.10.0
- libxml2-2.6.16
- pango-1.8.0
- Slackware
- 10.2 = 2005-09-14
- *10.1 = 2005-02-07
- 10.0 = 2004-06-21
- Xandros Desktop
- *3.0 = 2004-12
- 2.5 = 2004-07
- ftp://ftp2.xandros.com/src/dists/
- FreeBSD
- *5.4 = 2005-05-09 - http://www.freebsd.org/releases/5.4R/announce.html
- 4.11 = 2005-01-25 - http://www.freebsd.org/releases/4.11R/announce.html
- Fink/OSX
- ??
- RHEL
- *RHEL 4 = 2005-02-15
[from http://ftp.redhat.com/pub/redhat/linux/enterprise/4/en/]
- aqbanking no
- cairo no
- gconf2-2.8.1-1
- glib[+gobject,module]-2-2.4.7-1
- gtk+-2.4.13-12
- guile-1.6.4-14
- gwrap no
- libart-2.3.16-3
- libglade-2-4.0-5
- libgnomeprint-2.2-2.8.0-3
- libgnomeui-2.8.0-1
- libgsf-1.10.1-1
- libofx no
- libxml-2-2.6.16-6
- pango-1.6.0-7
- RHEL 3 = 2003-10-22
- CentOS
- 4.2 = 2005-10-12
- *4.1 = 2005-06-12
- 3.6 = 2005-10-12
- 3.5 = 2005-06-10
- 2.0 = 2004-05-24

56
TODO
View File

@@ -1,8 +1,50 @@
For the latest plans regarding future GnuCash features, please consult
the file:
doc/projects.html
or the webpage:
For plans regarding future GnuCash features, please consult
the file: doc/projects.html, or its clone:
http://cvs.gnucash.org/linux/gnucash/projects.html
However, these files are currently (4/03) far out of date.
Currently, This TODO file is the start of a categorized list
of developers' notes of work noted and left for later, together
with the a list of developers. If a work item is substantial
enough to require an RFE, the item and all discussion, status,
and progress reports are kept in bugzilla, with no references
from bugzilla to the TODO file, or vice versa.
If you want to work on the Gnome2 port, please let me (TomF)
know what subcategories you want to work on. New categories
are welcome.
The current developers are:
email: TomF@sjpc.org IRC: #gnucash TomF TODO, Build
The categorized list:
gnucash-gnome2-dev Gnome2 port
Build Problems to solve before running gnucash the first time
Delete declare of gnc_html_register_object_handler (FIXME)
Delete typedef of GncHTMLObjectCB (FIXME)
Replace deprecated functions
Make a table mapping deprecated functions in gdkfont.h to their
Pango replacements.
Replace all deprecated functions in gdkfont.h
Replace deprecated GnomeMDI functions by gdknotebook functions.
Run Problems which affect running gnucash
Is deprecated gtk_object_class_add_signals handled correctly?
gtk-changes-2-0 Handle the changes documented in:
http://developer.gnome.org/doc/API/2.0/gtk/gtk-changes-2-0.html
GNOME 2.0 platform Handle the changes documented in:
http://developer.gnome.org/dotplan/porting/
doc
Add links to examples in GTK+ Reference Manual.
Update *.glade files for GNOME_BUTTON changes
Misc

View File

@@ -1,61 +0,0 @@
/********************************************************************\
* acconfig.h -- configuration defines for gnucash *
* Copyright (C) 1997 Robin D. Clark (rclark@cs.hmc.edu) *
* *
* 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, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
* *
\********************************************************************/
#ifndef GNC_CONFIG_H
#define GNC_CONFIG_H
/* ieeefp.h header present */
#undef HAVE_IEEEFP_H
/* If configure found libXpm, then use it */
#undef HAVE_XPM
/* is guile available */
#undef HAVE_GUILE
/* New or old Guile Smob for G-wrap */
#undef GWRAP_OLD_GUILE_SMOB
/* misc image and compression libs needed by html widget */
#undef HAVE_ZLIB
#undef HAVE_PNG
#undef HAVE_JPEG
/* Configure found the function malloc_usable_size */
#undef HAVE_MALLOC_USABLE_SIZE
/*** Begin i18n ***/
/* internationalization with catgets */
#undef HAVE_CATGETS
/* specific locale directory */
#undef HAVE_LOCALE_DIR
/*** End i18n ***/
#undef HAVE_XML_VERSION_HEADER
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -14,4 +14,5 @@ PKG_NAME="gnucash"
exit 1
}
USE_GNOME2_MACROS=1
. $srcdir/macros/autogen.sh

View File

@@ -18,38 +18,47 @@ dnl Process this file with autoconf to produce a configure script.
# Libraries - Check for libraries
# Footer - Autoconf footer stuff
# Autoconf initialization
AC_INIT
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_SRCDIR(src/engine/Transaction.h)
AC_PREREQ(2.53)
# Define the version number
GNUCASH_MAJOR_VERSION=1
GNUCASH_MINOR_VERSION=9
GNUCASH_MICRO_VERSION=0
GNUCASH_VERSION_STRING="$GNUCASH_MAJOR_VERSION.$GNUCASH_MINOR_VERSION.$GNUCASH_MICRO_VERSION"
AM_INIT_AUTOMAKE(gnucash, $GNUCASH_VERSION_STRING)
## Do this first, because the other tests depend on it:
### --------------------------------------------------------------------------
### Headers
### check for various programs, and stuff (do this first because later
### commands depend on them):
AC_INIT(src/engine/Transaction.h)
AC_PREREQ(2.53)
# Check for gcc and intltool (somehow breaks the suggested content
# order, doesn't it? Whatever.)
AC_PROG_CC
AC_PROG_INTLTOOL
AM_GCONF_SOURCE_2
# Override gconf default install locations. The default is to always
# put them into /etc. This change puts them into $(prefix)/etc.
if test "x$GCONF_SCHEMA_INSTALL_SOURCE" = "x"; then
GCONF_SCHEMA_CONFIG_SOURCE="xml::${sysconfdir}/gconf/gconf.xml.defaults"
fi
GCONF_SCHEMA_CONFIG_SOURCE_DIRONLY=`echo $GCONF_SCHEMA_CONFIG_SOURCE | cut -d ':' -f 3`
AC_SUBST(GCONF_SCHEMA_CONFIG_SOURCE_DIRONLY)
# Comment out for production or semi-production builds. I.E. Anything
# that is explicitly tagged in cvs as a version.
AC_DEFINE(GNUCASH_CVS,1,[Define if built from untagged cvs])
GNUCASH_MAJOR_VERSION=1
GNUCASH_MINOR_VERSION=9
GNUCASH_MICRO_VERSION=0
GNUCASH_VERSION=$GNUCASH_MAJOR_VERSION.$GNUCASH_MINOR_VERSION.$GNUCASH_MICRO_VERSION
AC_SUBST(GNUCASH_MAJOR_VERSION)
AC_SUBST(GNUCASH_MINOR_VERSION)
AC_SUBST(GNUCASH_MICRO_VERSION)
AM_INIT_AUTOMAKE(gnucash,$GNUCASH_VERSION)
AC_PROG_INTLTOOL
AM_CONFIG_HEADER(config.h)
AC_DEFINE_UNQUOTED(GNUCASH_MAJOR_VERSION, $GNUCASH_MAJOR_VERSION,
[GnuCash Major version number])
AC_DEFINE_UNQUOTED(GNUCASH_MINOR_VERSION, $GNUCASH_MINOR_VERSION,
@@ -59,11 +68,18 @@ AC_DEFINE_UNQUOTED(GNUCASH_MICRO_VERSION, $GNUCASH_MICRO_VERSION,
dnl Set of available languages.
ALL_LINGUAS="da de el en_GB es es_NI fr hu it ja nb nl pl pt pt_BR ru rw sk sv ta uk zh_CN zh_TW"
AM_GNU_GETTEXT([use-libtool])
GETTEXT_PACKAGE=gnucash
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
[GetText version number])
AM_GLIB_GNU_GETTEXT
AM_MAINTAINER_MODE
AM_ACLOCAL_INCLUDE(macros)
AC_CONFIG_MACRO_DIR(macros)
AC_PROG_INSTALL
@@ -73,29 +89,6 @@ AM_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
# # checks for the pthreads library
# have_pthread=no
# for i in pthreads lthread pthread; do
# if test "x$have_pthread" = xno; then
# AC_CHECK_LIB($i, pthread_once, [
# PTHREAD_LIBS=-l$i
# have_pthread=yes
# ])
# fi
# done
#
# # Hmm, maybe it's just in libc?
# if test "x$have_pthread" = xno; then
# AC_CHECK_FUNC(pthread_once, [ have_pthread=yes ])
# fi
#
# # Do we HAVE threads?!?
# if test "x$have_pthread" = xno; then
# AC_MSG_ERROR([unable to find pthreads on your system. Sorry.])
# fi
#
# AC_SUBST(PTHREAD_LIBS)
AC_ISC_POSIX
AC_C_BIGENDIAN
AC_PROG_MAKE_SET
@@ -103,6 +96,18 @@ AC_HEADER_STDC
AC_CHECK_HEADERS(limits.h)
AC_CHECK_FUNCS(stpcpy memcpy timegm towupper)
AC_CHECK_FUNCS(setenv,,[
AC_CHECK_FUNCS(putenv,,[
AC_MSG_ERROR([Must have one of the setenv or putenv functions.])
])
])
## +jsled
# copied from gnumeric
AC_CHECK_HEADERS(ieeefp.h ieee754.h)
dnl Check for some functions
AC_CHECK_FUNCS(random drand48 finite memmove mkdtemp uname times sysconf fmin)
## --jsled
STRUCT_TM_GMTOFF_CHECK
SCANF_LLD_CHECK
@@ -119,14 +124,29 @@ if test "x$ac_cv_header_ltdl_h" = xno; then
AC_MSG_ERROR([Cannot find ltdl.h -- libtool-devel not installed?])
fi
AM_PATH_GLIB
AM_PATH_GLIB_2_0(2.4.0,,AC_MSG_ERROR([
*** GLIB >= 2.4 is required to build Gnucash; please make sure you have the
*** development headers installed. The latest version of GLIB is
*** always available at ftp://ftp.gnome.org/pub/gnome/sources/glib/.]),
gthread gobject)
if test ${no_glib}x = yesx
then
AC_MSG_ERROR([Cannot find glib. Check config.log])
fi
AC_CHECK_HEADERS(dlfcn.h dl.h ghttp_ssl.h utmp.h locale.h mcheck.h unistd.h wctype.h)
AC_MSG_CHECKING(for GLIB - version >= 2.6.0)
if $PKG_CONFIG 'glib-2.0 >= 2.6.0'
then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GLIB26,1,[System has glib 2.6.0 or better])
HAVE_GLIB26=yes
else
AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(HAVE_GLIB26, test "x$HAVE_GLIB26" = "xyes" )
AC_CHECK_HEADERS(dlfcn.h dl.h utmp.h locale.h mcheck.h unistd.h wctype.h)
DL_LIB=
AC_CHECK_FUNCS(dlopen,,[
@@ -149,8 +169,9 @@ AC_SUBST(DL_LIB)
### MacOS 10.x requires some special handling...
# Some systems (MacOS) require -lintl
AC_SEARCH_LIBS(gettext, intl, ,[
AC_MSG_ERROR([Cannot find gettext -- do you need to build -lintl?])], )
# not true for darwin 10.3 - halts the build.
#AC_SEARCH_LIBS(gettext, intl, ,[
# AC_MSG_ERROR([Cannot find gettext -- do you need to build -lintl?])], )
AC_MSG_CHECKING(for darwin)
case $host_os in
@@ -160,6 +181,16 @@ case $host_os in
update to latest darwin])
;;
darwin*)
dnl Use fink under MacOS X to find popt
AC_MSG_CHECKING(for fink support)
if test -d "/sw/lib" -a -d "/sw/include"; then
AM_CFLAGS="$AM_CFLAGS -I/sw/include"
LDFLAGS="$LDFLAGS -L/sw/lib"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_CHECK_HEADERS(popt.h)
AC_MSG_RESULT([yes, patching libtool to always build dylibs])
mv libtool libtool.old
sed -e 's/^deplibs_check_method.*/deplibs_check_method=pass_all/g' \
@@ -179,8 +210,10 @@ esac
### Guile and g-wrap version checks (should this be something other than
### the Gnome check?)
GUILE_LIBS=""
GNOME_CHECK_GUILE
AS_SCRUB_INCLUDE(GUILE_INCS)
AC_SUBST(GUILE_LIBS)
### --------------------------------------------------------------------------
### G-wrap (libraries and executable)
@@ -188,12 +221,11 @@ AS_SCRUB_INCLUDE(GUILE_INCS)
G_WRAP_COMPILE_ARGS=""
G_WRAP_LINK_ARGS=""
AM_GUILE_VERSION_CHECK(1.3.4, , , [AC_MSG_ERROR([
AM_GUILE_VERSION_CHECK(1.6, , , [AC_MSG_ERROR([
guile does not appear to be installed correctly, or is not in the
correct version range. Perhaps you have not installed the guile
development packages? Right now gnucash requires at least version
1.3.4 to build.
development packages? Gnucash requires at least version 1.6 to build.
])])
AC_DEFINE_UNQUOTED(GNC_GUILE_MAJOR_VERSION, ${guile_major_version},
@@ -206,10 +238,7 @@ AC_DEFINE_UNQUOTED(GNC_GUILE_MICRO_VERSION, ${guile_micro_version},
AM_PATH_GWRAP(1.3.3, , , [AC_MSG_ERROR([
g-wrap does not appear to be installed correctly, or is not new
enough. Right now gnucash requires at least version 1.3.3 to build
as there were major changes between version 1.3.1 and 1.3.2, and
extra support added between 1.3.2 and 1.3.3 that is now required
by gnucash.
enough. Right now gnucash requires at least version 1.3.3 to build.
If you need to install g-wrap, you can find it at
http://www.gnucash.org/pub/g-wrap.
])])
@@ -241,7 +270,7 @@ AS_SCRUB_INCLUDE(CFLAGS)
### Check size of long_long - some guile's are broken.
AC_MSG_CHECKING(if guile long_long is at least as big as gint64)
GNC_OLDCFLAGS="$CFLAGS"
CFLAGS="${GNOME_INCLUDEDIR} ${GUILE_INCS} ${CFLAGS} ${GLIB_CFLAGS}"
CFLAGS="${GNOME_CFLAGS} ${GUILE_INCS} ${CFLAGS} ${GLIB_CFLAGS}"
AC_TRY_RUN([
#include <glib.h>
#include <libguile/__scm.h>
@@ -263,7 +292,7 @@ CFLAGS="$GNC_OLDCFLAGS"
# unless you've done sufficient code review/testing.
AC_MSG_CHECKING(if unsigned long is at least as big as guint32)
GNC_OLDCFLAGS="$CFLAGS"
CFLAGS="${GNOME_INCLUDEDIR} ${GUILE_INCS} ${CFLAGS} ${GLIB_CFLAGS}"
CFLAGS="${GNOME_CFLAGS} ${GUILE_INCS} ${CFLAGS} ${GLIB_CFLAGS}"
AC_TRY_RUN([
#include <glib.h>
int main(int argc, char *argv[]) {
@@ -323,24 +352,169 @@ else
AC_MSG_RESULT(yes)
fi
### --------------------------------------------------------------------------
### See if we have pkg-config
AC_PATH_PROG(PKG_CONFIG,pkg-config)
if test "x$PKG_CONFIG" = x; then
# @*%&$ Ximian programmers renamed this application
AC_PATH_PROG(PKG_CONFIG,pkgconfig)
if test "x$PKG_CONFIG" = x; then
AC_MSG_ERROR([Could not find the pkg-config (or pkgconfig) program.],)
fi
fi
PKG_CHECK_MODULES(GCONF, gconf-2.0 >= "2.0")
AC_SUBST(GCONF_CFLAGS)
AC_SUBST(GCONF_LIBS)
AM_CONDITIONAL(GNC_HAVE_GUILE_WWW, test "${gnc_have_guile_www}" = yes)
### --------------------------------------------------------------------------
### Gnome XML -- GNOME_XML_LIB is defined by GNOME_XML_CHECK
GNOME_XML_CHECK
GNOME_XML_CFLAGS=`$GNOME_CONFIG --cflags xml`
AS_SCRUB_INCLUDE(GNOME_XML_CFLAGS)
PKG_CHECK_MODULES(XML, libxml-2.0)
AS_SCRUB_INCLUDE(XML_CFLAGS)
AC_SUBST(XML_CFLAGS)
AC_SUBST(XML_LIBS)
AC_SUBST(GNOME_XML_CFLAGS)
LIBXML2_REQUIRED=2.5.10
PKG_CHECK_MODULES(LIBXML2, libxml-2.0 >= $LIBXML2_REQUIRED)
LIBXML_VERSION=`$PKG_CONFIG --version xml`
AC_SUBST(LIBXML2_CFLAGS)
AC_SUBST(LIBXML2_LIBS)
AC_SUBST(LIBXML_VERSION)
oLIBS="$LIBS"
LIBS="$LIBS $GNOME_XML_LIB"
AC_CHECK_LIB(xml, xmlElemDump, [:], [
AC_MSG_ERROR([libxml 1.8.3 or newer required for GnuCash])
LIBS="$LIBS $XML_LIBS"
# Compile a test program to verify that the xml2 library works.
AC_CHECK_LIB(xml2, xmlElemDump, [:], [
AC_MSG_ERROR([libxml2 is required for GnuCash])
])
LIBS="$oLIBS"
dnl *************************************
dnl QOF
dnl *************************************
AC_ARG_WITH(qof, [ --with-qof=path prefix for Query Object Framework - QOF (auto)])
QOF_REQUIRED=0.6.0
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
if test pkg-config = no; then
AC_MSG_ERROR([Please install pkgconfig])
exit 1
fi
AC_MSG_CHECKING([for QOF, version >= $QOF_REQUIRED])
if test "$withval" != "yes"; then
QOF=`$PKG_CONFIG --exists '$withval/lib/pkgconfig/qof-1.pc >= $QOF_REQUIRED'`
QOF_LIBS=`$PKG_CONFIG --libs $withval/lib/pkgconfig/qof-1.pc`
QOF_CFLAGS=`$PKG_CONFIG --cflags $withval/lib/pkgconfig/qof-1.pc`
QOF_VERSION=`$PKG_CONFIG --modversion $withval/lib/pkgconfig/qof-1.pc`
QOF_PREFIX=`$PKG_CONFIG --variable=prefix $withval/lib/pkgconfig/qof-1.pc`
QOF_LIB_DIR=`$PKG_CONFIG --variable=libdir $withval/lib/pkgconfig/qof-1.pc`
QOF_XML_DIR=`$PKG_CONFIG --variable=xmldir $withval/lib/pkgconfig/qof-1.pc`
else
QOF=`$PKG_CONFIG --exists 'qof-1 >= $QOF_REQUIRED'`
QOF_LIBS=`$PKG_CONFIG --libs qof-1`
QOF_CFLAGS=`$PKG_CONFIG --cflags qof-1`
QOF_VERSION=`$PKG_CONFIG --modversion qof-1`
QOF_PREFIX=`$PKG_CONFIG --variable=prefix qof-1`
QOF_LIB_DIR=`$PKG_CONFIG --variable=libdir qof-1`
QOF_XML_DIR=`$PKG_CONFIG --variable=xmldir qof-1`
fi
if test x$QOF_XML_DIR = x; then
AC_MSG_RESULT([no, will use internal QOF code])
QOF_CFLAGS="-I\${top_srcdir}/src/engine"
QOF_LIBS="\${top_srcdir}/src/engine/libqof.la"
QOF_LIB_DIR="${libdir}"
QOF_PREFIX="internal"
QOF_XML_DIR="$QSF_SCHEMA_DIR"
LIBQOF_LIBRARY_VERSION=1:1:0
LIBQOF_BACKEND_QSF_LIBRARY_VERSION=0:0:0
AC_SUBST(LIBQOF_LIBRARY_VERSION)
AC_SUBST(LIBQOF_BACKEND_QSF_LIBRARY_VERSION)
AC_DEFINE(HAVE_LIBQOF,,[We will use the internal QOF code])
HAVE_LIBQOF="use_internal"
else
AC_MSG_RESULT([yes])
fi
AM_CONDITIONAL(USE_LIBQOF, [test x$HAVE_LIBQOF != x])
AM_CONDITIONAL(USE_LIBQOF, [test $HAVE_LIBQOF = "use_internal"])
AC_SUBST(USE_LIBQOF)
AC_SUBST(QOF_CFLAGS)
AC_SUBST(QOF_LIBS)
AS_SCRUB_INCLUDE(QOF_PREFIX)
AC_SUBST(QOF_PREFIX)
AC_SUBST(QOF_LIB_DIR)
### --------------------------------------------------------------------------
### for GOG/goffice...
dnl If libgoffice-1 >= 0.0.3-2 and libgsf >= 1.12.0-1 are found,
dnl we need to omit lib/goffice and use the external library
dnl because lib/goffice will not build with newer versions of libgsf.
GOFFICE_REQUIRED=0.0.3
GSF_REQUIRED=1.12.0
AC_MSG_CHECKING([for GOffice and GSF])
LIBGOFFICE_CFLAGS=`$PKG_CONFIG --silence-errors --cflags " libgoffice-1 >= $GOFFICE_REQUIRED"`
LIBGOFFICE_LIBS=`$PKG_CONFIG --silence-errors --libs " libgoffice-1 >= $GOFFICE_REQUIRED"`
LIBGSF_CFLAGS=`$PKG_CONFIG --silence-errors --cflags " libgsf-1 >= $GSF_REQUIRED"`
LIBGSF_LIBS=`$PKG_CONFIG --silence-errors --libs " libgsf-1 >= $GSF_REQUIRED"`
AC_SUBST(LIBGOFFICE_CFLAGS)
AC_SUBST(LIBGOFFICE_LIBS)
if test x"$LIBGOFFICE_LIBS" = x; then
AC_MSG_RESULT([No, GOffice not found, will build using internal goffice library.])
else
AC_MSG_RESULT([Yes, using GOffice])
AC_DEFINE(HAVE_GOFFICE,,[We have found an external GOffice])
HAVE_GOFFICE="use_external"
fi
AM_CONDITIONAL(USE_LIBGOFFICE, [test x$HAVE_GOFFICE != x])
AM_CONDITIONAL(USE_LIBGOFFICE, [test $HAVE_GOFFICE = "use_external"])
AC_SUBST(USE_LIBGOFFICE)
###
### GSF
PKG_CHECK_MODULES(GSF, libgsf-1 >= 1.8.0
libgsf-gnome-1 >= 1.8.0)
AC_SUBST(GSF_LIBS)
AC_SUBST(GSF_CFLAGS)
### libart
PKG_CHECK_MODULES(ART, libart-2.0 >= 2.3.11)
AC_SUBST(ART_LIBS)
AC_SUBST(ART_CFLAGS)
### silence convention-difference from cut-n-paste'd gnumeric Makefile.am's:
AM_CONDITIONAL(WITH_GNOME, true)
# for lib/goffice/graph/plugins/plot_barcol/gog-1.5d.c's use of
# goffice/graph/gog-error-bar.h:gog_error_bar_prefs, which is bounded by
# WITH_GTK for some reason... :/
AM_CONDITIONAL(WITH_GTK, true)
AC_DEFINE(WITH_GTK, 1, [Define if UI is built])
### gnome-print [= gnome-font]
PKG_CHECK_MODULES(PRINT, libgnomeprint-2.2 >= 2.5.2)
AC_SUBST(PRINT_LIBS)
AC_SUBST(PRINT_CFLAGS)
AC_ARG_VAR(GLIB_GENMARSHAL, [Absolute path of the glib-genmarshal executable.])
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
gog_plugindir='${GNC_LIBDIR}/plugins'
# do this to minimize changes in the plugin makefiles...
gnumeric_plugindir='${gog_plugindir}'
AC_SUBST(gog_plugindir)
AC_SUBST(gnumeric_plugindir)
#AC_SUBST(pkglibdir) -- this breaks builds into /opt.
gnumeric_icondir='${GNC_SHAREDIR}/pixmaps'
AC_SUBST(gnumeric_icondir)
# /GOG
### --------------------------------------------------------------------------
### Variables
@@ -376,14 +550,18 @@ fi
GNC_ACCOUNTS_DIR='${GNC_SHAREDIR}/accounts'
GNC_GLADE_DIR='${GNC_SHAREDIR}/glade'
QSF_SCHEMA_DIR='${GNC_SHAREDIR}/xml/qsf'
GNC_UI_DIR='${GNC_SHAREDIR}/ui'
GNC_GWRAP_LIBDIR='${GNC_SHAREDIR}/guile-modules/g-wrapped'
GNC_MODULE_DIR='${pkglibdir}'
GNC_PIXMAP_DIR='${datadir}/pixmaps/gnucash'
GNC_PIXMAP_DIR='${GNC_SHAREDIR}/pixmaps'
AC_SUBST(GNC_ACCOUNTS_DIR)
AC_SUBST(GNC_CONFIGDIR)
AC_SUBST(GNC_DOC_INSTALL_DIR)
AC_SUBST(GNC_GLADE_DIR)
AC_SUBST(QSF_SCHEMA_DIR)
AC_SUBST(GNC_UI_DIR)
AC_SUBST(GNC_GWRAP_LIBDIR)
AC_SUBST(GNC_INCLUDE_DIR)
AC_SUBST(GNC_LIBDIR)
@@ -405,6 +583,11 @@ AC_ARG_ENABLE( profile,
CFLAGS="${CFLAGS} -pg"
LDFLAGS="${LDFLAGS} -pg")
AC_ARG_ENABLE( ref-counts-dumps,
[ --enable-ref-counts-dumps compile with ref count dumps],
AC_DEFINE(DEBUG_REFERENCE_COUNTING,1,Enable reference count dumps),
AC_DEFINE(DEBUG_REFERENCE_COUNTING,0,Enable reference count dumps) )
### --------------------------------------------------------------------------
### SQL
@@ -572,7 +755,7 @@ then
[ AC_MSG_ERROR([cannot find libofx header, needed for OFX support.]) ] )
fi
LIBOFX_LIBS="${LIBOFX_LIBS} -lofx -lstdc++"
LIBOFX_LIBS="${LIBOFX_LIBS} -lofx"
AC_MSG_CHECKING(for libofx)
save_LIBS="${LIBS}"
LIBS="${LIBS} ${LIBOFX_LIBS}"
@@ -667,8 +850,8 @@ AC_ARG_ENABLE( locale-specific-tax,
# Used to initialize doc-path.
AC_ARG_WITH( help-prefix,
[ --with-help-prefix=PATH specify where to store the help files],
GNC_HELPDIR="$with_help_prefix/gnome/help/gnucash",
GNC_HELPDIR="\${datadir}/gnome/help/gnucash")
GNC_HELPDIR="$with_help_prefix",
GNC_HELPDIR="\${datadir}")
AC_SUBST(GNC_HELPDIR)
@@ -792,69 +975,9 @@ BB_ENABLE_DOXYGEN
LIBS="$LIBS -lm"
### --------------------------------------------------------------------------
### Berkeley db
AC_ARG_ENABLE(prefer-db1,
[ --enable-prefer-db1 Prefer Berkeley DB 1.x],[prefer_db1="$enableval"],[prefer_db1=yes])
DB_LIBS=
AC_CHECK_FUNC(dbopen, [],
if test "$prefer_db1" = "yes"; then
AC_CHECK_LIB(db1, dbopen, DB_LIBS="-ldb1",
AC_CHECK_LIB(db, dbopen, DB_LIBS="-ldb",
AC_CHECK_LIB(db-3, __db185_open, DB_LIBS="-ldb-3",
AC_CHECK_LIB(db-4.0, __db185_open, DB_LIBS="-ldb-4.0",
AC_CHECK_LIB(db-4.1, __db185_open, DB_LIBS="-ldb-4.1",
AC_CHECK_LIB(db-4.2, __db185_open, DB_LIBS="-ldb-4.2",
AC_CHECK_LIB(db, __db185_open, DB_LIBS="-ldb",
AC_MSG_ERROR([Your db library is missing db 1.85 compatibility mode])
)
)
)
)
)
)
)
else
AC_CHECK_LIB(db, dbopen, DB_LIBS="-ldb",
AC_CHECK_LIB(db1, dbopen, DB_LIBS="-ldb1",
AC_CHECK_LIB(db-3, __db185_open, DB_LIBS="-ldb-3",
AC_CHECK_LIB(db-4.0, __db185_open, DB_LIBS="-ldb-4.0",
AC_CHECK_LIB(db-4.1, __db185_open, DB_LIBS="-ldb-4.1",
AC_CHECK_LIB(db-4.2, __db185_open, DB_LIBS="-ldb-4.2",
AC_CHECK_LIB(db, __db185_open, DB_LIBS="-ldb",
AC_MSG_ERROR([Your db library is missing db 1.85 compatibility mode])
)
)
)
)
)
)
)
fi
)
dnl look for db headers
if test "$prefer_db1" = "yes"; then
AC_CHECK_HEADERS(db_185.h db1/db.h db4/db_185.h)
if test "$ac_cv_header_db_185_h$ac_cv_header_db1_db_h$ac_cv_header_db4_db_185_h" = nonono; then
AC_MSG_ERROR([Berkeley db library required for GnuCash])
fi
AC_DEFINE(PREFER_DB1,,Prefer DB1)
else
AC_CHECK_HEADERS(db.h db_185.h db1/db.h db4/db_185.h)
if test "$ac_cv_header_db_h$ac_cv_header_db_185_h$ac_cv_header_db1_db_h$ac_cv_header_db4_db_185_h" = nononono; then
AC_MSG_ERROR([Berkeley db library required for GnuCash])
fi
fi
AC_SUBST(DB_LIBS)
### --------------------------------------------------------------------------
### popt
AC_CHECK_HEADERS(popt.h)
AC_CHECK_LIB(popt, poptStrippedArgv,, [AC_MSG_ERROR([
popt 1.5 or newer is required to build gnucash. You can download
@@ -881,125 +1004,84 @@ AM_CONDITIONAL(GNUCASH_ENABLE_GUI, test x${gnc_build_gui} = xtrue)
if test x${gnc_build_gui} = xtrue ;
then
GNOME_INIT
GNOME_COMPILE_WARNINGS
GNOME_CHECK_GDK_PIXBUF
GNOME_PRINT_CHECK
# gnome-print-check appears tobe sort of b0rked for the time being
GNOME_PRINT_CFLAGS=`${GNOME_CONFIG} --cflags print`
# Look for libgnomeui by pkg-config
PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4)
AS_SCRUB_INCLUDE(GTK_CFLAGS)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
PKG_CHECK_MODULES(GNOME, libgnomeui-2.0 >= 2.4)
AS_SCRUB_INCLUDE(GNOME_CFLAGS)
AC_SUBST(GNOME_CFLAGS)
AC_SUBST(GNOME_LIBS)
# look for gdk-pixbuf
PKG_CHECK_MODULES(GDK_PIXBUF, gdk-pixbuf-2.0)
AS_SCRUB_INCLUDE(GDK_PIXBUF_CFLAGS)
AC_SUBST(GDK_PIXBUF_CFLAGS)
AC_SUBST(GDK_PIXBUF_LIBS)
# Gnome-Print -- some people already have/need libgnomeprint-2.2
# Yep, so lets test to see if it is 2.0 or 2.2,
# Anyone know why gnome has versions in the package config?
# Why cant I just ask for the version of 'libgnomeprint'
PKG_CHECK_MODULES(GNOME_PRINT, libgnomeprint-2.2 libgnomeprintui-2.2)
AS_SCRUB_INCLUDE(GNOME_PRINT_CFLAGS)
AC_SUBST(GNOME_PRINT_CFLAGS)
AC_SUBST(GNOME_PRINT_LIBS)
# There is no libguppi. Just substitute empty stuff
LIBGUPPI_CFLAGS=
LIBGUPPI_LIBS=
AC_SUBST(LIBGUPPI_CFLAGS)
AC_SUBST(LIBGUPPI_LIBS)
### ----------------------------------------------------------------------
### Check for glade
AM_PATH_LIBGLADE
GLADE_LIBS="$LIBGLADE_LIBS"
GLADE_CFLAGS="$LIBGLADE_CFLAGS"
### Check for glade, gtkhtml
PKG_CHECK_MODULES(GLADE, libglade-2.0 >= 2.4)
AS_SCRUB_INCLUDE(GLADE_CFLAGS)
AC_SUBST(GLADE_LIBS)
AC_SUBST(GLADE_CFLAGS)
AC_SUBST(GLADE_LIBS)
### ----------------------------------------------------------------------
AC_CHECK_LIB(gal, main, true,
[AC_MSG_ERROR([gal library not found. See the README and config.log for more info.])],
`$GNOME_CONFIG --libs gal`)
#
# Check for GtkHTML.. First check for 1.1, then check for < 1.1
#
AC_PATH_PROG(PKG_CONFIG,pkg-config)
if test "x$PKG_CONFIG" = x; then
# @*%&$ Ximian programmers renamed this application
AC_PATH_PROG(PKG_CONFIG,pkgconfig)
# check for gtkhtml 3.x
gtkhtml=0
PKG_CHECK_MODULES(GTKHTML, libgtkhtml-3.8 , [gtkhtml=1] , [gtkhtml=0])
if test $gtkhtml = 0
then
PKG_CHECK_MODULES(GTKHTML, libgtkhtml-3.6 , [gtkhtml=1] , [gtkhtml=0])
if test $gtkhtml = 0
then
PKG_CHECK_MODULES(GTKHTML, libgtkhtml-3.2 , [gtkhtml=1] , [gtkhtml=0])
if test $gtkhtml = 0
then
PKG_CHECK_MODULES(GTKHTML, libgtkhtml-3.1 , [gtkhtml=1] , [gtkhtml=0])
if test $gtkhtml = 0
then
PKG_CHECK_MODULES(GTKHTML, libgtkhtml-3.0 ,,
AC_MSG_ERROR([Could not find a working gtkhtml version]))
fi
fi
fi
fi
AC_MSG_CHECKING([for gtkhtml >= 1.1])
if test "x$PKG_CONFIG" != x; then
GTKHTML_LIBS=`$PKG_CONFIG --libs gtkhtml-1.1`
GTKHTML_CFLAGS=`$PKG_CONFIG --cflags gtkhtml-1.1`
AS_SCRUB_INCLUDE(GTKHTML_CFLAGS)
fi
if test "x$GTKHTML_LIBS" != x; then
AC_MSG_RESULT(yes)
# check for gtkhtml and enable it via HAVE_LIBGTKHTML if found
AC_CHECK_LIB(gtkhtml-1.1, gtk_html_new,
GNOMEBUILDLIBS="${GNOMEBUILDLIBS} $GTKHTML_TEST_LIB"
AC_DEFINE(HAVE_LIBGTKHTML,,We Have LIBGTKHTML),
AC_MSG_ERROR([Cannot link gtkhtml-1.1. See the README and config.log for more info.]),
$GTKHTML_LIBS)
else
AC_MSG_CHECKING([for gtkhtml < 1.1])
GTKHTML_LIBS=`$GNOME_CONFIG --libs gtkhtml`
GTKHTML_CFLAGS=`$GNOME_CONFIG --cflags gtkhtml`
AS_SCRUB_INCLUDE(GTKHTML_CFLAGS)
if test "x$GTKHTML_LIBS" != x; then
AC_MSG_RESULT(yes)
# check for gtkhtml and enable it via HAVE_LIBGTKHTML if found
AC_CHECK_LIB(gtkhtml, gtk_html_new,
GNOMEBUILDLIBS="${GNOMEBUILDLIBS}"
AC_DEFINE(HAVE_LIBGTKHTML,,We Have LIBGTKHTML),
AC_MSG_ERROR([Cannot link gtkhtml. See the README and config.log for more info.]),
$GTKHTML_LIBS)
else
AC_MSG_ERROR([Cannot find GtkHTML <= 1.x on your system. See the README and config.log for more info.])
fi
fi
#
# Check for GHTTP
#
GHTTP_LIBS=`$GNOME_CONFIG --libs ghttp`
GHTTP_CFLAGS=`$GNOME_CONFIG --cflags ghttp`
# Note: this doesn't croak if GHTTP_LIBS is empty! (e.g. on RH6.2)
AC_CHECK_LIB(ghttp, ghttp_request_new,
GNOMEBUILDLIBS="${GNOMEBUILDLIBS} ghttp"
AC_DEFINE(HAVE_LIBGHTTP,,We Have GHTTP)
if test "x$GHTTP_LIBS" = "x" ; then
GHTTP_LIBS=-lghttp
fi,
AC_MSG_ERROR([Cannot find ghttp. See the README and config.log for more info.]),
$GHTTP_LIBS)
AC_CHECK_LIB(ghttp, ghttp_enable_ssl,
AC_DEFINE(HAVE_OPENSSL,,We Have OpenSSL),
AC_MSG_WARN([****** ghttp does not have SSL support.]),
$GHTTP_LIBS)
AS_SCRUB_INCLUDE(GHTTP_CFLAGS)
AC_SUBST(GTKHTML_LIBS)
dnl if Mac OSX, also scrub /sw/include
dnl GIVEN_CFLAGS=$(echo $GIVEN_CFLAGS | sed -e "s;-I/sw/include ;;" | sed -e "s;-I/sw/include$;;")
case $host_os in
darwin*)
GTKHTML_CFLAGS=$(echo $GTKHTML_CFLAGS | sed -e "s;-I/sw/include ;;" | sed -e "s;-I/sw/include$;;")
GTKHTML_CFLAGS=$(echo $GTKHTML_CFLAGS | sed -e "s;-I/sw/include/gtkhtml ;;" | sed -e "s;-I/sw/includ/gtkhtmle$;;")
;;
esac
AC_SUBST(GTKHTML_CFLAGS)
AC_SUBST(GHTTP_LIBS)
AC_SUBST(GHTTP_CFLAGS)
AC_SUBST(GTKHTML_LIBS)
### ----------------------------------------------------------------------
### guppi
AC_ARG_ENABLE( guppi,
[ --disable-guppi compile without guppi support],
if test $enableval = no; then
USE_GUPPI=0
else
USE_GUPPI=1
fi,
USE_GUPPI=1 )
if test ${USE_GUPPI} = 0; then
AC_MSG_WARN([Compiling without guppi support])
else
AC_DEFINE(USE_GUPPI,,We are using guppi)
AC_ARG_ENABLE( efence,
[ --enable-efence link using efence],
@@ -1012,34 +1094,6 @@ then
EFENCE_LIBS="")
AC_SUBST(EFENCE_LIBS)
## Things guppi needs (actually are these guppi dependencies or gtkhtml's?)
# LAME: if you ask gnome-config for the zvt libs, it doesn't include
# imlib, though it needs it so we'll just steal gtkhtml's which does.
AC_CHECK_LIB(zvt, main, true,
[AC_MSG_ERROR([libzvt development files not found. See config.log.])],
`$GNOME_CONFIG --libs zvt` $GTKHTML_LIBS)
#AC_CHECK_LIB(bonobo, main, true,
# [AC_MSG_ERROR([libbonobo development files not found. See config.log.])
#],
# `$GNOME_CONFIG --libs bonobo`)
AC_CHECK_LIB(oaf, main, true,
[AC_MSG_ERROR([liboaf development files not found. See config.log.])],
`$GNOME_CONFIG --libs oaf`)
## guppi itself.
GUPPI_LIBS=`$GNOME_CONFIG --libs libguppi`
GUPPI_CFLAGS=`$GNOME_CONFIG --cflags libguppi`
AS_SCRUB_INCLUDE(GUPPI_CFLAGS)
LIBGUPPI_CHECK
AC_SUBST(GUPPI_LIBS)
AC_SUBST(GUPPI_CFLAGS)
fi
### ----------------------------------------------------------------------
### XIM
AC_ARG_ENABLE(xim,
@@ -1153,6 +1207,7 @@ then
# us to keep it turned on, but also not break configure proceses.
# -- warlord, 02/02/2003
# Enable error-on-warning by default -- I'm tired of fixing other
# people's missing #includes, etc.
AC_ARG_ENABLE(error-on-warning,
@@ -1173,6 +1228,10 @@ then
if test `echo ${GCC_VERSION} | cut -d. -f2` -ge 4; then
# This is gcc >= 3.4.x
warnFLAGS="${warnFLAGS} -Wdeclaration-after-statement"
else if test `echo ${GCC_VERSION} | cut -d. -f1` -ge 4; then
# This is gcc == 4.x.x
warnFLAGS="${warnFLAGS} -Wdeclaration-after-statement -Wno-pointer-sign"
fi
fi
fi
@@ -1202,8 +1261,7 @@ chmod u+x ${srcdir}/src/bin/overrides/gnucash-make-guids
LIBOBJS_SEDSCRIPT="s,\.[[^.]]* ,$U&,g;s,\.[[^.]]*\$\$,$U&,"
AC_SUBST(LIBOBJS_SEDSCRIPT)
AC_OUTPUT( intl/Makefile po/Makefile.in
m4/Makefile
AC_CONFIG_FILES(po/Makefile.in
dnl # Makefiles
Makefile
accounts/Makefile
@@ -1224,15 +1282,29 @@ AC_OUTPUT( intl/Makefile po/Makefile.in
doc/examples/Makefile
intl-scm/Makefile
lib/Makefile
lib/glib26/Makefile
lib/guile-www/Makefile
lib/srfi/Makefile
lib/libc/Makefile
macros/Makefile
lib/goffice/Makefile
lib/goffice/split/Makefile
lib/goffice/split/widgets/Makefile
lib/goffice/app/Makefile
lib/goffice/graph/Makefile
lib/goffice/graph/plugins/Makefile
lib/goffice/graph/plugins/plot_barcol/Makefile
lib/goffice/graph/plugins/plot_pie/Makefile
lib/goffice/graph/plugins/plot_radar/Makefile
lib/goffice/graph/plugins/plot_surface/Makefile
lib/goffice/graph/plugins/plot_xy/Makefile
lib/goffice/utils/Makefile
lib/goffice/gui-utils/Makefile
lib/goffice/drawing/Makefile
lib/goffice/pixmaps/Makefile
lib/goffice/cut-n-paste/Makefile
lib/goffice/cut-n-paste/pcre/Makefile
rpm/Makefile
src/Makefile
src/app-file/Makefile
src/app-file/test/Makefile
src/app-file/gnome/Makefile
src/app-utils/Makefile
src/app-utils/test/Makefile
src/backend/Makefile
@@ -1241,6 +1313,7 @@ AC_OUTPUT( intl/Makefile po/Makefile.in
src/backend/file/test/Makefile
src/backend/file/test/test-files/Makefile
src/backend/file/test/test-files/xml2/Makefile
src/backend/qsf/Makefile
src/backend/postgres/Makefile
src/backend/postgres/test/Makefile
src/backend/rpc/Makefile
@@ -1256,11 +1329,6 @@ AC_OUTPUT( intl/Makefile po/Makefile.in
src/engine/Makefile
src/engine/test/Makefile
src/engine/test-core/Makefile
src/experimental/Makefile
src/experimental/cbb/Makefile
src/experimental/cbb/cbb-engine/Makefile
src/experimental/cgi-bin/Makefile
src/experimental/gg/Makefile
src/gnc-module/Makefile
src/gnc-module/test/Makefile
src/gnc-module/test/mod-foo/Makefile
@@ -1269,8 +1337,12 @@ AC_OUTPUT( intl/Makefile po/Makefile.in
src/gnc-module/test/misc-mods/Makefile
src/gnome/Makefile
src/gnome/glade/Makefile
src/gnome/schemas/Makefile
src/gnome/ui/Makefile
src/gnome-utils/Makefile
src/gnome-utils/schemas/Makefile
src/gnome-utils/test/Makefile
src/gnome-utils/ui/Makefile
src/gnome-search/Makefile
src/import-export/Makefile
src/import-export/test/Makefile
@@ -1282,12 +1354,14 @@ AC_OUTPUT( intl/Makefile po/Makefile.in
src/import-export/qif-import/test/Makefile
src/import-export/qif-io-core/Makefile
src/import-export/qif-io-core/test/Makefile
src/import-export/schemas/Makefile
src/import-export/ofx/Makefile
src/import-export/ofx/test/Makefile
src/import-export/mt940/Makefile
src/import-export/log-replay/Makefile
src/import-export/hbci/Makefile
src/import-export/hbci/glade/Makefile
src/import-export/hbci/schemas/Makefile
src/import-export/hbci/test/Makefile
src/network-utils/Makefile
src/network-utils/test/Makefile
@@ -1305,7 +1379,7 @@ AC_OUTPUT( intl/Makefile po/Makefile.in
src/register/register-gnome/test/Makefile
src/report/Makefile
src/report/report-gnome/Makefile
src/report/report-gnome/test/Makefile
dnl # src/report/report-gnome/test/Makefile
src/report/report-system/Makefile
src/report/report-system/test/Makefile
src/report/standard-reports/Makefile
@@ -1332,6 +1406,8 @@ AC_OUTPUT( intl/Makefile po/Makefile.in
src/business/dialog-tax-table/Makefile
src/business/business-gnome/Makefile
src/business/business-gnome/glade/Makefile
src/business/business-gnome/schemas/Makefile
src/business/business-gnome/ui/Makefile
src/business/business-ledger/Makefile
src/business/business-reports/Makefile
@@ -1344,13 +1420,29 @@ AC_OUTPUT( intl/Makefile po/Makefile.in
,
dnl # commands go here, but we don't have any right now
)
AC_OUTPUT
if test x$RPC_DIR = xrpc ; then
AC_MSG_WARN([
The RPC Backend is depricated. You should not use it.
The RPC Backend is deprecated. You should not use it.
It may go away in the future. If you need it, please
contact gnucash-devel@gnucash.org and let the developers
know.
])
fi
AC_MSG_RESULT([
Options detected/selected
-------------------------
gnucash version ...... : $VERSION
Build for host ....... : $host
Extra Warnings ....... : $warnFLAGS
CPPFLAGS ............. : $CPPFLAGS
CFLAGS ............... : $CFLAGS
LDFLAGS .............. : $LDFLAGS
QOF support ...........: $QOF_VERSION
QOF location ..........: $QOF_PREFIX
QOF library dir .......: $QOF_LIB_DIR
QOF backend config ....: $QOF_XML_DIR
])

View File

@@ -2,3 +2,5 @@ Makefile
Makefile.in
gnucash.1
gnc-prices.1
tip_of_the_day.list
*.tmp

View File

@@ -1,8 +1,6 @@
docdir = ${GNC_DOC_INSTALL_DIR}
SUBDIRS = examples
docdir = ${GNC_DOC_INSTALL_DIR}
doc_DATA = \
README.francais \
README.german \
@@ -13,6 +11,9 @@ man_MANS = \
gnc-prices.1 \
gnucash.1
tipsdir = $(GNC_SHAREDIR)
tips_DATA = tip_of_the_day.list
EXTRA_DIST = \
.cvsignore \
${doc_DATA} \
@@ -30,7 +31,8 @@ EXTRA_DIST = \
generic_objects.txt \
gnome-hackers.txt \
gnc-prices.1.in \
gnucash.1.in
gnucash.1.in \
tip_of_the_day.list.in
## We borrow guile's convention and use @-...-@ as the substitution
## brackets here, instead of the usual @...@. This prevents autoconf
@@ -52,4 +54,9 @@ gnucash.1: gnucash.1.in
chmod +x $@.tmp
mv $@.tmp $@
DISTCLEANFILES = gnc-prices.1 gnucash.1
tip_of_the_day.list: tip_of_the_day.list.in
gcc -E -P -x c -D'N_(x)=x' -o $@.tmp $<
cat -s $@.tmp | sed -e 's/^ *\"\(.*\)\" *$$/\1/m' > $@
rm -f $@.tmp
DISTCLEANFILES = gnc-prices.1 gnucash.1 tip_of_the_day.list

12
doc/What_is_Euro_support Normal file
View File

@@ -0,0 +1,12 @@
The following changes occur in the Gnucash GUI when the "Euro support"
preference is enabled:
1) In any register denominated in a national currency that been
replaced by the Euro (e.g. an account in DEM), the summarybar will
show totals in both the old currency and in EUR.
2) There is an additional line labeled "EUR, total" in the account
tree summarybar. The totals in this line are a sum of all accounts
denominated in currencies that have been replaced by the Euro.
(E.G. The sum of all accounts in DEM, plus all accounts in FRF,
etc., etc.)

171
doc/gtkrc-2.0.gnucash Normal file
View File

@@ -0,0 +1,171 @@
#
# This is an example GTK RC file that can be used with Gnucash.
# Simply copy this file to ~/.gtkrc-2.0.gnucash and then restart
# gnucash. Yes the colors are hideous, but then this is a (bad)
# example that you should customize to your liking.
#
# On an FC3 system, the RC files (if they exist) are loaded for in
# this order:
#
# /usr/share/gtkrc-2.0
# /etc/gtk-2.0/gtkrc
# ~/.gtkrc-2.0
# ** ~/.gtkrc-2.0.gnucash **
# ~/.gnome2/gtkrc-2.0
# ~/.themes/Bluecurve/gtk-2.0/gtkrc
# /usr/share/themes/Bluecurve/gtk-2.0/gtkrc
# ~/.themes/Default/gtk-2.0-key/gtkrc
# /usr/share/themes/Default/gtk-2.0-key/gtkrc
#
##########
#
# Define the various styles here
#
##########
style "gnc-button"
{
# This shows all the possible states for a button. The only one that
# doesn't apply is the SELECTED state.
bg[NORMAL] = "LightBlue"
fg[NORMAL] = "IndianRed"
# Mouse over
bg[PRELIGHT] = "SkyBlue"
fg[PRELIGHT] = "white"
# Mouse down
bg[ACTIVE] = "SteelBlue"
fg[ACTIVE] = "white"
bg[INSENSITIVE] = { 1.0, 1.0, 1.0 }
fg[INSENSITIVE] = { 1.0, 0, 1.0 }
}
style "gnc-button2" = "gnc-button"
{
bg[NORMAL] = "PeachPuff"
fg[NORMAL] = "firebrick"
}
style "gnc-button3" = "gnc-button"
{
bg[NORMAL] = "LightGoldenrod1"
fg[NORMAL] = "firebrick"
}
style "gnc-entry"
{
base[NORMAL] = "LightBlue"
text[NORMAL] = "firebrick"
}
style "gnc-entry2"
{
base[NORMAL] = "RoyalBlue"
text[NORMAL] = "WhiteSmoke"
}
style "gnc-treeview"
{
GtkTreeView::even-row-color = "IndianRed"
GtkTreeView::odd-row-color = "LightBlue"
}
##########
#
# Program wide changes should go here.
#
##########
class "GtkEntry" style "gnc-entry"
class "GtkButton" style "gnc-button"
##########
#
# Individual window changes should go here.
#
##########
#
# Price Selection Dialog
#
# widget "Prices Dialog.*.close_button" style "gnc-button"
# widget "Prices Dialog.*.get_quotes_button" style "gnc-button2"
# widget "Prices Dialog.*.edit_button" style "gnc-button2"
# widget "Prices Dialog.*.add_button" style "gnc-button2"
# widget "Prices Dialog.*.remove_button" style "gnc-button2"
# widget "Prices Dialog.*.remove_old_button" style "gnc-button2"
widget "Prices Dialog.*.price_tree" style "gnc-treeview"
widget "Prices Dialog.*.price_tree.GtkButton" style "gnc-button3"
#
# Dialog to edit one price
#
# widget "Price Dialog.*.cancel_button" style "gnc-button2"
# widget "Price Dialog.*.ok_button" style "gnc-button2"
# widget "Price Dialog.*.GNCGeneralSelect" style "gnc-entry"
# widget "Price Dialog.*.GNCCurrencyEdit" style "gnc-entry"
# widget "Price Dialog.*.GNCDateEdit.GtkEntry" style "gnc-entry"
# widget "Price Dialog.*.source_entry" style "gnc-entry"
# widget "Price Dialog.*.type_option" style "foo"
widget "Price Dialog.*.GNCAmountEdit" style "gnc-entry2"
#
# Commodity Dialog
#
widget "Commodities Dialog.*.commodity_tree" style "gnc-treeview"
#
# Register - Font
#
style "gnc-register"
{
font_name = "Sans 10"
}
widget "*.GnucashSheet" style "gnc-register"
#
# Register Window - Colors
#
# The header lines at the top of a register.
style "gnc-register-header"
{
base[NORMAL] = "#B18396"
}
# The color of the first line/transaction in a register.
style "gnc-register-primary"
{
base[NORMAL] = "#DEB9BF"
base[SELECTED] = "#EF98FF"
}
# The color of the second line/transaction in a register.
style "gnc-register-secondary"
{
base[NORMAL] = "#FFDAF6"
base[SELECTED] = "#EF98FF"
}
# The color of any "split" lines in a register.
style "gnc-register-split"
{
base[NORMAL] = "#E7D3ED"
base[SELECTED] = "#EF98FF"
}
widget "GncMainWindow.*.header_color" style : highest "gnc-register-header"
widget "GncMainWindow.*.primary_color" style : highest "gnc-register-primary"
widget "GncMainWindow.*.secondary_color" style : highest "gnc-register-secondary"
widget "GncMainWindow.*.split_color" style : highest "gnc-register-split"

View File

@@ -0,0 +1,91 @@
N_( "Warning!! This is a DEVELOPMENT version of GnuCash. \
It probably has lots of bugs and unstable features! \
If you are looking for a stable personal finance application, \
you should use the latest release of GnuCash 1.8.")
N_( "The GnuCash online manual has lots of helpful information. \
If you are upgrading from earlier versions of GnuCash, the section \
\"What's new in GnuCash 1.8\" is particularly interesting. You can \
access the manual under the Help menu.")
N_( "You can easily import your existing financial data from Quicken, \
MS Money or other programs that export QIF files or OFX files. In the \
File menu, click on the sub-menu Import and click on QIF or OFX file, \
respectively. Then, follow the instructions provided.")
N_( "If you are familiar with other financial programs such as Quicken, \
note that GnuCash uses accounts instead of categories to track \
income and expenses. For more information on income and expense \
accounts, please see the GnuCash online manual.")
N_( "Create new accounts by clicking the New button in the main window \
tool bar. This will bring up a dialog box where you can enter \
account details. For more information on choosing an account type \
or setting up a chart of accounts, please see the GnuCash online \
manual.")
N_( "Click the right mouse button in the main window to bring up the \
account menu options. Within each register, clicking the right \
mouse button brings up the transaction menu options.")
N_( "To enter multiple-split transactions such as a paycheck with \
multiple deductions, click the Split button in the tool bar. \
Alternatively, in the View -> Style menu, you can choose the register \
style Auto-Split Ledger or Transaction Journal.")
N_( "As you enter amounts in the register, you can use the GnuCash \
calculator to add, subtract, multiply and divide . Simply type \
the first value, then select '+', '-','*', or '/'. Type the \
second value and press Enter to record the calculated amount.")
N_( "Quick-fill makes it easy to enter common transactions. When you \
type the first letter(s) of a common transaction description, \
GnuCash will automatically complete the remainder of the \
transaction as it was last entered.")
N_( "Type the first letter(s) of an existing account name in the \
Transfer register column, and GnuCash will complete the name from \
your list of accounts. For subaccounts, type the first letter(s) \
of the parent account, followed by ':' and the first letter(s) of \
the subaccount (e.g. A:C for Assets:Cash.)")
N_( "Want to see all your subaccount transactions in one register? \
From the main menu, highlight the parent account and select \
Accounts -> Open Subaccounts from the menu.")
N_( "When entering dates, you can type '+' or '-' to increment or \
decrement the selected date. You can use '+' and '-' to increment and \
decrement check numbers as well.")
N_( "In the reconcile window, you can press the spacebar to mark \
transactions as reconciled. You can also press Tab and Shift-Tab to \
move between deposits and withdrawals.")
N_( "To transfer funds between accounts with different currencies, \
click on the Transfer button in the register toolbar, select the \
accounts, and the Currency Transfer options for entering the exchange \
rate or the other currency's amount will be available.")
N_( "You can pack multiple reports into a single window, \
providing all the financial information you want at a glance. \
To do so, use the Sample & Custom -> \"Custom Multicolumn Report\" \
report.")
N_( "GnuCash can act as a simple web browser! To display \
a web page as a report, use the Sample & Custom -> \
\"Custom Web Report\" report.")
N_( "Style Sheets affect how reports are displayed. Choose \
a style sheet for your report as a report option, and use \
the Edit -> Style Sheets menu to customize style sheets.")
N_( "The GnuCash developers are easy to contact. As well \
as several mailing lists, you can chat to them live on IRC! \
Join them on #gnucash at irc.gnome.org")
N_( "There is a theory that if ever anyone discovers what \
the Universe is for and why it is here, it will instantly \
disappear and be replaced with something even more bizarre and \
inexplicable. \
There is another theory that this has already happened. \
Douglas Adams, \"The Restaurant at the End of the Universe\"")

View File

@@ -1,11 +0,0 @@
*.c
*.h
*.in
*.sed
*.sin
*.y
ChangeLog
Makefile
VERSION
config.charset
locale.alias

View File

@@ -1,4 +1,7 @@
SUBDIRS = libc guile-www srfi
if USE_LIBGOFFICE
SUBDIRS = libc glib26 guile-www srfi
else
SUBDIRS = libc glib26 guile-www srfi goffice
endif
EXTRA_DIST = README guppi-legend.patch

View File

@@ -1,7 +1,7 @@
Makefile
Makefile.in
*.lo
*.la
.deps
.libs
.scm-links
Makefile
Makefile.in

View File

@@ -1,5 +1,7 @@
*.lo
*.la
.deps
.libs
.scm-links
Makefile
Makefile.in
test-link

16
lib/glib26/Makefile.am Normal file
View File

@@ -0,0 +1,16 @@
noinst_LTLIBRARIES = libgncglib.la
DUMMYSRCS=dummy.c
REALSRCS=gkeyfile.c gkeyfile.h gutils26.c gutils26.h
if HAVE_GLIB26
libgncglib_la_SOURCES = $(DUMMYSRCS)
else
libgncglib_la_SOURCES = $(REALSRCS)
endif
libgncglib_la_LIBADD = ${GLIB_LIBS}
AM_CFLAGS = ${GLIB_CFLAGS}
EXTRA_DIST=$(DUMMYSRCS) $(REALSRCS)

6
lib/glib26/dummy.c Normal file
View File

@@ -0,0 +1,6 @@
void g_key_file_dumy_function (void);
void
g_key_file_dumy_function (void)
{
}

3312
lib/glib26/gkeyfile.c Normal file

File diff suppressed because it is too large Load Diff

199
lib/glib26/gkeyfile.h Normal file
View File

@@ -0,0 +1,199 @@
/* gkeyfile.h - desktop entry file parser
*
* Copyright 2004 Red Hat, Inc.
*
* Ray Strode <halfline@hawaii.rr.com>
*
* GLib is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with GLib; see the file COPYING.LIB. If not,
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __G_KEY_FILE_H__
#define __G_KEY_FILE_H__
#include <glib/gerror.h>
/* Start hacks to make this file compile with glib 2.4 */
#define G_GNUC_MALLOC
/* End hacks to make this file compile with glib 2.4 */
G_BEGIN_DECLS
typedef enum
{
G_KEY_FILE_ERROR_UNKNOWN_ENCODING,
G_KEY_FILE_ERROR_PARSE,
G_KEY_FILE_ERROR_NOT_FOUND,
G_KEY_FILE_ERROR_KEY_NOT_FOUND,
G_KEY_FILE_ERROR_GROUP_NOT_FOUND,
G_KEY_FILE_ERROR_INVALID_VALUE
} GKeyFileError;
#define G_KEY_FILE_ERROR g_key_file_error_quark()
GQuark g_key_file_error_quark (void);
typedef struct _GKeyFile GKeyFile;
typedef enum
{
G_KEY_FILE_NONE = 0,
G_KEY_FILE_KEEP_COMMENTS = 1 << 0,
G_KEY_FILE_KEEP_TRANSLATIONS = 1 << 1
} GKeyFileFlags;
GKeyFile *g_key_file_new (void);
void g_key_file_free (GKeyFile *key_file);
void g_key_file_set_list_separator (GKeyFile *key_file,
gchar separator);
gboolean g_key_file_load_from_file (GKeyFile *key_file,
const gchar *file,
GKeyFileFlags flags,
GError **error);
gboolean g_key_file_load_from_data (GKeyFile *key_file,
const gchar *data,
gsize length,
GKeyFileFlags flags,
GError **error);
gboolean g_key_file_load_from_data_dirs (GKeyFile *key_file,
const gchar *file,
gchar **full_path,
GKeyFileFlags flags,
GError **error);
gchar *g_key_file_to_data (GKeyFile *key_file,
gsize *length,
GError **error) G_GNUC_MALLOC;
gchar *g_key_file_get_start_group (GKeyFile *key_file) G_GNUC_MALLOC;
gchar **g_key_file_get_groups (GKeyFile *key_file,
gsize *length) G_GNUC_MALLOC;
gchar **g_key_file_get_keys (GKeyFile *key_file,
const gchar *group_name,
gsize *length,
GError **error) G_GNUC_MALLOC;
gboolean g_key_file_has_group (GKeyFile *key_file,
const gchar *group_name);
gboolean g_key_file_has_key (GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
GError **error);
gchar *g_key_file_get_value (GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
GError **error) G_GNUC_MALLOC;
void g_key_file_set_value (GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
const gchar *value);
gchar *g_key_file_get_string (GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
GError **error) G_GNUC_MALLOC;
void g_key_file_set_string (GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
const gchar *string);
gchar *g_key_file_get_locale_string (GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
const gchar *locale,
GError **error) G_GNUC_MALLOC;
void g_key_file_set_locale_string (GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
const gchar *locale,
const gchar *string);
gboolean g_key_file_get_boolean (GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
GError **error);
void g_key_file_set_boolean (GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
gboolean value);
gint g_key_file_get_integer (GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
GError **error);
void g_key_file_set_integer (GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
gint value);
gchar **g_key_file_get_string_list (GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
gsize *length,
GError **error) G_GNUC_MALLOC;
void g_key_file_set_string_list (GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
const gchar * const list[],
gsize length);
gchar **g_key_file_get_locale_string_list (GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
const gchar *locale,
gsize *length,
GError **error) G_GNUC_MALLOC;
void g_key_file_set_locale_string_list (GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
const gchar *locale,
const gchar * const list[],
gsize length);
gboolean *g_key_file_get_boolean_list (GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
gsize *length,
GError **error) G_GNUC_MALLOC;
void g_key_file_set_boolean_list (GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
gboolean list[],
gsize length);
gint *g_key_file_get_integer_list (GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
gsize *length,
GError **error) G_GNUC_MALLOC;
void g_key_file_set_integer_list (GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
gint list[],
gsize length);
void g_key_file_set_comment (GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
const gchar *comment,
GError **error);
gchar *g_key_file_get_comment (GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
GError **error) G_GNUC_MALLOC;
void g_key_file_remove_comment (GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
GError **error);
void g_key_file_remove_key (GKeyFile *key_file,
const gchar *group_name,
const gchar *key,
GError **error);
void g_key_file_remove_group (GKeyFile *key_file,
const gchar *group_name,
GError **error);
G_END_DECLS
#endif /* __G_KEY_FILE_H__ */

1041
lib/glib26/gutils26.c Normal file

File diff suppressed because it is too large Load Diff

183
lib/glib26/gutils26.h Normal file
View File

@@ -0,0 +1,183 @@
/* 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 Lesser 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GLib Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __G_UTILS_26_H__
#define __G_UTILS_26_H__
#include <glib/gtypes.h>
#include <stdarg.h>
/* Start hacks to make this file compile with glib 2.4 */
#define G_GNUC_MALLOC
/* End hacks to make this file compile with glib 2.4 */
G_BEGIN_DECLS
#ifdef G_OS_WIN32
/* On native Win32, directory separator is the backslash, and search path
* separator is the semicolon.
*/
#define G_DIR_SEPARATOR '\\'
#define G_DIR_SEPARATOR_S "\\"
#define G_IS_DIR_SEPARATOR(c) ((c) == G_DIR_SEPARATOR || (c) == '/')
#define G_SEARCHPATH_SEPARATOR ';'
#define G_SEARCHPATH_SEPARATOR_S ";"
#else /* !G_OS_WIN32 */
/* Unix */
#define G_DIR_SEPARATOR '/'
#define G_DIR_SEPARATOR_S "/"
#define G_IS_DIR_SEPARATOR(c) ((c) == G_DIR_SEPARATOR)
#define G_SEARCHPATH_SEPARATOR ':'
#define G_SEARCHPATH_SEPARATOR_S ":"
#endif /* !G_OS_WIN32 */
/* Retrive static string info
*/
#ifdef G_OS_WIN32
#define g_get_user_name g_get_user_name_utf8
#define g_get_real_name g_get_real_name_utf8
#define g_get_home_dir g_get_home_dir_utf8
#define g_get_tmp_dir g_get_tmp_dir_utf8
#endif
G_CONST_RETURN gchar* g_get_user_name (void);
G_CONST_RETURN gchar* g_get_real_name (void);
G_CONST_RETURN gchar* g_get_home_dir (void);
G_CONST_RETURN gchar* g_get_tmp_dir (void);
gchar* g_get_prgname (void);
void g_set_prgname (const gchar *prgname);
G_CONST_RETURN gchar* g_get_application_name (void);
void g_set_application_name (const gchar *application_name);
G_CONST_RETURN gchar* g_get_user_data_dir (void);
G_CONST_RETURN gchar* g_get_user_config_dir (void);
G_CONST_RETURN gchar* g_get_user_cache_dir (void);
G_CONST_RETURN gchar* G_CONST_RETURN * g_get_system_data_dirs (void);
G_CONST_RETURN gchar* G_CONST_RETURN * g_get_system_config_dirs (void);
G_CONST_RETURN gchar* G_CONST_RETURN * g_get_language_names (void);
/* Miscellaneous utility functions
*/
gint g_snprintf (gchar *string,
gulong n,
gchar const *format,
...) G_GNUC_PRINTF (3, 4);
gint g_vsnprintf (gchar *string,
gulong n,
gchar const *format,
va_list args);
#ifndef G_DISABLE_DEPRECATED
/* These two functions are deprecated and will be removed in the next
* major release of GLib. Use g_path_get_dirname/g_path_get_basename
* instead. Whatch out! The string returned by g_path_get_basename
* must be g_freed, while the string returned by g_basename must not.*/
G_CONST_RETURN gchar* g_basename (const gchar *file_name);
#define g_dirname g_path_get_dirname
#endif /* G_DISABLE_DEPRECATED */
#ifdef G_OS_WIN32
#define g_get_current_dir g_get_current_dir_utf8
#endif
/* The returned strings are newly allocated with g_malloc() */
gchar* g_get_current_dir (void);
gchar* g_path_get_basename (const gchar *file_name) G_GNUC_MALLOC;
gchar* g_path_get_dirname (const gchar *file_name) G_GNUC_MALLOC;
/* Set the pointer at the specified location to NULL */
void g_nullify_pointer (gpointer *nullify_location);
/* Look for an executable in PATH, following execvp() rules */
gchar* g_find_program_in_path (const gchar *program);
/* Glib version.
* we prefix variable declarations so they can
* properly get exported in windows dlls.
*/
GLIB_VAR const guint glib_major_version;
GLIB_VAR const guint glib_minor_version;
GLIB_VAR const guint glib_micro_version;
GLIB_VAR const guint glib_interface_age;
GLIB_VAR const guint glib_binary_age;
const gchar * glib_check_version (guint required_major,
guint required_minor,
guint required_micro);
#define GLIB_CHECK_VERSION(major,minor,micro) \
(GLIB_MAJOR_VERSION > (major) || \
(GLIB_MAJOR_VERSION == (major) && GLIB_MINOR_VERSION > (minor)) || \
(GLIB_MAJOR_VERSION == (major) && GLIB_MINOR_VERSION == (minor) && \
GLIB_MICRO_VERSION >= (micro)))
G_END_DECLS
/*
* On Windows, this macro defines a DllMain function that stores the
* actual DLL name that the code being compiled will be included in.
* STATIC should be empty or 'static'. DLL_NAME is the name of the
* (pointer to the) char array where the DLL name will be stored. If
* this is used, you must also include <windows.h>. If you need a more complex
* DLL entry point function, you cannot use this.
*
* On non-Windows platforms, expands to nothing.
*/
#ifndef G_PLATFORM_WIN32
# define G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name)
#else
# define G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name) \
static char *dll_name; \
\
BOOL WINAPI \
DllMain (HINSTANCE hinstDLL, \
DWORD fdwReason, \
LPVOID lpvReserved) \
{ \
char bfr[1000]; \
switch (fdwReason) \
{ \
case DLL_PROCESS_ATTACH: \
GetModuleFileName ((HMODULE) hinstDLL, bfr, sizeof (bfr)); \
dll_name = g_path_get_basename (bfr); \
break; \
} \
\
return TRUE; \
}
#endif /* G_PLATFORM_WIN32 */
#endif /* __G_UTILS_26_H__ */

12
lib/goffice/.cvsignore Normal file
View File

@@ -0,0 +1,12 @@
Makefile
Makefile.in
*.diff
*.diffs
*.patch
*.log
*.xac.*.xac
.deps
.libs
paths.h
*.la
*.lo

3451
lib/goffice/ChangeLog Normal file

File diff suppressed because it is too large Load Diff

37
lib/goffice/Makefile.am Normal file
View File

@@ -0,0 +1,37 @@
SUBDIRS = app graph utils gui-utils drawing pixmaps split cut-n-paste
AM_CFLAGS = $(GLIB_CFLAGS) $(ART_CFLAGS) $(GNOME_CFLAGS) $(GSF_CFLAGS) $(PRINT_CFLAGS)
noinst_LTLIBRARIES = libgoffice.la
BUILT_SOURCES = \
paths.h
libgoffice_la_LIBADD = \
utils/libgoffice-utils.la \
app/libgoffice-app.la \
gui-utils/libgoffice-gui-utils.la \
graph/libgoffice-graph.la \
drawing/libgoffice-drawing.la \
split/libgoffice-split.la \
split/widgets/libgoffice-split-widgets.la \
cut-n-paste/pcre/libpcre.la \
${GLIB_LIBS}
libgoffice_la_SOURCES = \
$(BUILT_SOURCES) \
goffice.c \
goffice.h \
goffice-config.h \
split.h \
split.c
EXTRA_DIST = goffice.mk goffice-plugins.mk paths.h.in
paths.h: paths.h.in ${top_builddir}/config.status
rm -f $@.tmp
sed < $< > $@.tmp \
-e 's:@-GNC_LIBDIR-@:${GNC_LIBDIR}:g'
mv $@.tmp $@
include $(srcdir)/goffice.mk

View File

@@ -0,0 +1,11 @@
Makefile
Makefile.in
*.diff
*.diffs
*.patch
*.log
*.xac.*.xac
.deps
.libs
*.la
*.lo

View File

@@ -0,0 +1,18 @@
SUBDIRS =
noinst_LTLIBRARIES = libgoffice-app.la
libgoffice_app_la_SOURCES = \
goffice-app.h \
go-doc.c \
go-doc.h \
go-doc-impl.h \
go-doc-control.c \
go-doc-control.h \
go-doc-control-impl.h
libgoffice_app_la_LIBADD = ${GLIB_LIBS}
AM_CFLAGS = ${GLIB_CFLAGS} ${GSF_CFLAGS}
include $(srcdir)/../goffice.mk

52
lib/goffice/app/go-app.h Normal file
View File

@@ -0,0 +1,52 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* go-app.h : A GOffice appument
*
* Copyright (C) 2004 Jody Goldberg (jody@gnome.org)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* 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
*/
#ifndef GO_APP_H
#define GO_APP_H
#include <goffice/app/goffice-app.h>
#include <glib-object.h>
G_BEGIN_DECLS
#define GO_APP_TYPE (go_app_get_type ())
#define GO_APP(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GO_APP_TYPE, GOApp))
#define IS_GO_APP(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GO_APP_TYPE))
GType go_app_get_type (void);
/* FIXME : should be in GOContext which App inherits from */
GOPlugin *go_app_get_plugin (char const *id);
/* TODO : I suspect these should be lookups of some sort
* eg go_app_find_in_lib_dir (GOApp const *app, subdir);
* or possibly
* go_app_foreach_lib_dir (GOApp const *app, gboolean (*handler)(path, userdata));
**/
char *go_app_sys_lib_dir (GOApp const *app, char const *subdir);
char *go_app_sys_data_dir (GOApp const *app, char const *subdir);
char *go_app_sys_plugin_dir (GOApp const *app);
/* FIXME : Seems gui specific, move to gui-utils */
char *go_app_sys_glade_dir (GOApp const *app);
G_END_DECLS
#endif /* GO_APP_H */

View File

@@ -0,0 +1,29 @@
#ifndef GO_CMD_CONTEXT_IMPL_H
#define GO_CMD_CONTEXT_IMPL_H
#include <goffice/app/go-cmd-context.h>
typedef struct {
GTypeInterface base;
char * (*get_password) (GOCmdContext *gcc,
char const *filename);
void (*set_sensitive) (GOCmdContext *gcc,
gboolean sensitive);
struct {
void (*error) (GOCmdContext *gcc, GError *err);
void (*error_info) (GOCmdContext *gcc, GOErrorStack *stack);
} error;
void (*progress_set) (GOCmdContext *gcc, float val);
void (*progress_message_set) (GOCmdContext *gcc, gchar const *msg);
} GOCmdContextClass;
#define GO_CMD_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GO_CMD_CONTEXT_TYPE, GOCmdContextClass))
#define IS_GO_CMD_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GO_CMD_CONTEXT_TYPE))
/* protected, these do not really belong here, they are associated with io-context */
void cmd_context_progress_set (GOCmdContext *gcc, float f);
void cmd_context_progress_message_set (GOCmdContext *gcc, char const *msg);
#endif /* GO_CMD_CONTEXT_IMPL_H */

View File

@@ -0,0 +1,155 @@
/*
* go-cmd-context.c : Error dispatch utilities.
*
* Author:
* Jody Goldberg <jody@gnome.org>
*
* (C) 1999-2004 Jody Goldberg
*/
#include <goffice/goffice-config.h>
#include "go-cmd-context-impl.h"
#include <goffice/app/goffice-app.h>
#include <gsf/gsf-impl-utils.h>
#include <glib/gi18n.h>
#define GCC_CLASS(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), GO_CMD_CONTEXT_TYPE, GOCmdContextClass))
static GError *
format_message (GQuark id, char const *message)
{
char const *msg = message ? message : "";
return g_error_new_literal (id, 0, msg);
}
void
go_cmd_context_error (GOCmdContext *context, GError *err)
{
g_return_if_fail (IS_GO_CMD_CONTEXT (context));
GCC_CLASS (context)->error.error (context, err);
}
void
go_cmd_context_error_info (GOCmdContext *context, GOErrorStack *stack)
{
g_return_if_fail (IS_GO_CMD_CONTEXT (context));
GCC_CLASS (context)->error.error_info (context, stack);
}
void
go_cmd_context_error_system (GOCmdContext *context, char const *message)
{
GError *err = format_message (go_error_system (), message);
go_cmd_context_error (context, err);
g_error_free (err);
}
void
go_cmd_context_error_import (GOCmdContext *context, char const *message)
{
GError *err = format_message (go_error_import (), message);
go_cmd_context_error (context, err);
g_error_free (err);
}
void
go_cmd_context_error_export (GOCmdContext *context, char const *message)
{
GError *err = format_message (go_error_export (), message);
go_cmd_context_error (context, err);
g_error_free (err);
}
void
go_cmd_context_error_invalid (GOCmdContext *context, char const *msg, char const *val)
{
GError *err = g_error_new (go_error_invalid(), 0, "Invalid %s : '%s'", msg, val);
go_cmd_context_error (context, err);
g_error_free (err);
}
GQuark
go_error_system (void)
{
static GQuark quark;
if (!quark)
quark = g_quark_from_static_string ("go_error_system");
return quark;
}
GQuark
go_error_import (void)
{
static GQuark quark;
if (!quark)
quark = g_quark_from_static_string ("go_error_import");
return quark;
}
GQuark
go_error_export (void)
{
static GQuark quark;
if (!quark)
quark = g_quark_from_static_string ("go_error_export");
return quark;
}
GQuark
go_error_invalid (void)
{
static GQuark quark;
if (!quark)
quark = g_quark_from_static_string ("go_error_invalid");
return quark;
}
void
cmd_context_progress_set (GOCmdContext *context, gfloat f)
{
g_return_if_fail (IS_GO_CMD_CONTEXT (context));
GCC_CLASS (context)->progress_set (context, f);
}
void
cmd_context_progress_message_set (GOCmdContext *context, gchar const *msg)
{
g_return_if_fail (IS_GO_CMD_CONTEXT (context));
if (msg == NULL)
msg = " ";
GCC_CLASS (context)->progress_message_set (context, msg);
}
char *
go_cmd_context_get_password (GOCmdContext *cc, char const *filename)
{
g_return_val_if_fail (IS_GO_CMD_CONTEXT (cc), NULL);
return GCC_CLASS (cc)->get_password (cc, filename);
}
void
go_cmd_context_set_sensitive (GOCmdContext *cc, gboolean sensitive)
{
g_return_if_fail (IS_GO_CMD_CONTEXT (cc));
GCC_CLASS (cc)->set_sensitive (cc, sensitive);
}
GType
go_cmd_context_get_type (void)
{
static GType go_cmd_context_type = 0;
if (!go_cmd_context_type) {
static GTypeInfo const go_cmd_context_info = {
sizeof (GOCmdContextClass), /* class_size */
NULL, /* base_init */
NULL, /* base_finalize */
};
go_cmd_context_type = g_type_register_static (G_TYPE_INTERFACE,
"GOCmdContext", &go_cmd_context_info, 0);
}
return go_cmd_context_type;
}

View File

@@ -0,0 +1,51 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* go-cmd-context.h:
*
* Copyright (C) 2004 Jody Goldberg (jody@gnome.org)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* 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
*/
#ifndef GO_CMD_CONTEXT_H
#define GO_CMD_CONTEXT_H
#include <goffice/app/goffice-app.h>
#include <glib-object.h>
#define GO_CMD_CONTEXT_TYPE (go_cmd_context_get_type ())
#define GO_CMD_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GO_CMD_CONTEXT_TYPE, GOCmdContext))
#define IS_GO_CMD_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GO_CMD_CONTEXT_TYPE))
GType go_cmd_context_get_type (void);
void go_cmd_context_error (GOCmdContext *cc, GError *err);
char *go_cmd_context_get_password (GOCmdContext *cc, char const *fname);
void go_cmd_context_set_sensitive (GOCmdContext *cc, gboolean flag);
/* utility routines for common errors */
void go_cmd_context_error_system (GOCmdContext *cc, char const *msg);
void go_cmd_context_error_import (GOCmdContext *cc, char const *msg);
void go_cmd_context_error_export (GOCmdContext *cc, char const *msg);
void go_cmd_context_error_invalid (GOCmdContext *cc,
char const *msg, char const *val);
void go_cmd_context_error_info (GOCmdContext *cc, GOErrorStack *stack);
/* An initial set of std errors */
GQuark go_error_system (void);
GQuark go_error_import (void);
GQuark go_error_export (void);
GQuark go_error_invalid (void);
#endif /* GO_CMD_CONTEXT_H */

View File

@@ -0,0 +1,45 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* go-doc-impl.h : Implementation details of a GOffice Document
*
* Copyright (C) 2004 Jody Goldberg (jody@gnome.org)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* 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
*/
#ifndef GO_DOC_CONTROL_IMPL_H
#define GO_DOC_CONTROL_IMPL_H
#include <goffice/app/go-doc-control.h>
G_BEGIN_DECLS
struct _GODocControl {
GObject base;
struct {
} state[GO_DOC_CONTROL_STATE_MAX];
};
typedef struct {
GObjectClass base;
} GODocControlClass;
#define GO_DOC_CONTROL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GO_DOC_CONTROL_TYPE, GODocControlClass))
#define IS_GO_DOC_CONTROL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GO_DOC_CONTROL_TYPE))
#define GO_DOC_CONTROL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GO_DOC_CONTROL_TYPE, GODocControlClass))
G_END_DECLS
#endif /* GO_DOC_CONTROL_IMPL_H */

View File

@@ -0,0 +1,40 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* go-doc-control.c : A controller for GOffice Document
*
* Copyright (C) 2004 Jody Goldberg (jody@gnome.org)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* 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
*/
#include <goffice/goffice-config.h>
#include <goffice/app/goffice-app.h>
#include <goffice/app/go-doc-control-impl.h>
#include <gsf/gsf-impl-utils.h>
static void
go_doc_control_class_init (GObjectClass *klass)
{
}
static void
go_doc_control_init (GODocControl *obj)
{
}
GSF_CLASS (GODocControl, go_doc_control,
go_doc_control_class_init, go_doc_control_init,
G_TYPE_OBJECT)

View File

@@ -0,0 +1,43 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* go-doc.h : A GOffice document
*
* Copyright (C) 2004 Jody Goldberg (jody@gnome.org)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* 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
*/
#ifndef GO_DOC_CONTROL_H
#define GO_DOC_CONTROL_H
#include <goffice/app/goffice-app.h>
#include <glib-object.h>
G_BEGIN_DECLS
#define GO_DOC_CONTROL_TYPE (go_doc_control_get_type ())
#define GO_DOC_CONTROL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GO_DOC_CONTROL_TYPE, GODocControl))
#define IS_GO_DOC_CONTROL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GO_DOC_CONTROL_TYPE))
typedef enum {
GO_DOC_CONTROL_STATE_NORMAL = 0,
GO_DOC_CONTROL_STATE_FULLSCREEN,
GO_DOC_CONTROL_STATE_MAX
} GODocControlState;
GType go_doc_control_get_type (void);
G_END_DECLS
#endif /* GO_DOC_CONTROL_H */

View File

@@ -0,0 +1,42 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* go-doc-impl.h : Implementation details of a GOffice Document
*
* Copyright (C) 2004 Jody Goldberg (jody@gnome.org)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* 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
*/
#ifndef GO_DOC_IMPL_H
#define GO_DOC_IMPL_H
#include <goffice/app/go-doc.h>
G_BEGIN_DECLS
struct _GODoc {
GObject base;
};
typedef struct {
GObjectClass base;
} GODocClass;
#define GO_DOC_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GO_DOC_TYPE, GODocClass))
#define IS_GO_DOC_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GO_DOC_TYPE))
#define GO_DOC_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GO_DOC_TYPE, GODocClass))
G_END_DECLS
#endif /* GO_DOC_IMPL_H */

40
lib/goffice/app/go-doc.c Normal file
View File

@@ -0,0 +1,40 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* go-doc.c : A GOffice Document
*
* Copyright (C) 2004 Jody Goldberg (jody@gnome.org)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* 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
*/
#include <goffice/goffice-config.h>
#include <goffice/app/goffice-app.h>
#include <goffice/app/go-doc-impl.h>
#include <gsf/gsf-impl-utils.h>
static void
go_doc_class_init (GObjectClass *klass)
{
}
static void
go_doc_init (GODoc *obj)
{
}
GSF_CLASS (GODoc, go_doc,
go_doc_class_init, go_doc_init,
G_TYPE_OBJECT)

52
lib/goffice/app/go-doc.h Normal file
View File

@@ -0,0 +1,52 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* go-doc.h : A GOffice document
*
* Copyright (C) 2004 Jody Goldberg (jody@gnome.org)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* 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
*/
#ifndef GO_DOC_H
#define GO_DOC_H
#include <goffice/app/goffice-app.h>
#include <glib-object.h>
G_BEGIN_DECLS
#define GO_DOC_TYPE (go_doc_get_type ())
#define GO_DOC(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GO_DOC_TYPE, GODoc))
#define IS_GO_DOC(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GO_DOC_TYPE))
GType go_doc_get_type (void);
#if 0
GODoc *go_doc_new_from_input (GsfInput *input,
GODocImporter const *fmt,
GOIOContext *context,
gchar const *encoding);
GODoc *go_doc_new_from_uri (char const *uri,
GnmFileOpener const *fmt,
GOIOContext *context,
gchar const *encoding);
gboolean go_doc_save (GODoc *doc, GOIOContext *context);
gboolean go_doc_save_as (GODoc *doc, GODocExporter *fmt, char const *uri,
GOIOContext *cc);
gboolean go_doc_sendto (GODoc *doc, GOIOContext *cc);
#endif
G_END_DECLS
#endif /* GO_DOC_H */

View File

@@ -0,0 +1,32 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* go-error-stack.h : A tree of errors
*
* Copyright (C) 2004 Jody Goldberg (jody@gnome.org)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* 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
*/
#ifndef GO_ERROR_STACK_H
#define GO_ERROR_STACK_H
#include <glib-object.h>
GOErrorStack *gog_error_stack_new (GOErrorStack *child,
char const *msg, ...) G_GNUC_PRINTF (2, 3);
void go_error_stack_add_child (GOErrorStack *estack, GOErrorStack *child);
void go_error_stack_dump (GOErrorStack *estack);
void go_error_stack_free (GOErrorStack *estack);
#endif /* GO_ERROR_STACK_H */

128
lib/goffice/app/go-object.c Normal file
View File

@@ -0,0 +1,128 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* go-object.c :
*
* Copyright (C) 2004 Jody Goldberg (jody@gnome.org)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* 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
*/
#include <goffice/goffice-config.h>
#include <goffice/app/go-object.h>
#include <goffice/app/go-service-impl.h>
#include <goffice/app/go-plugin.h>
#include <goffice/app/go-error-stack.h>
#include <gsf/gsf-impl-utils.h>
#include <glib/gi18n.h>
struct _GOServiceObject {
GOService base;
char *primary_type;
GSList *interfaces;
};
typedef GOServiceClass GOServiceObjectClass;
static GHashTable *plugin_types = NULL;
static void
go_service_object_finalize (GObject *obj)
{
}
static char *
go_service_object_description (G_GNUC_UNUSED GOService *s)
{
return g_strdup (_("Objects"));
}
static void
go_service_object_class_init (GObjectClass *gobj_class)
{
GOServiceClass *serv_class = (GOServiceClass *)gobj_class;
gobj_class->finalize = go_service_object_finalize;
serv_class->description = go_service_object_description;
plugin_types = g_hash_table_new (g_str_hash, g_str_equal);
}
GSF_CLASS (GOServiceObject, go_service_object,
go_service_object_class_init, NULL,
GO_SERVICE_TYPE)
char const *
go_service_object_primary_type (GOServiceObject const *service)
{
g_return_val_if_fail (IS_GO_SERVICE_OBJECT (service), NULL);
return service->primary_type;
}
GSList const *
go_service_object_interfaces (GOServiceObject const *service)
{
g_return_val_if_fail (IS_GO_SERVICE_OBJECT (service), NULL);
return service->interfaces;
}
/****************************************************************************/
gpointer
go_object_new_valist (char const *type, char const *first_prop, va_list args)
{
GType t = g_type_from_name (type);
if (t == 0) {
GOService *service = plugin_types ?
g_hash_table_lookup (plugin_types, type) : NULL;
GOPlugin *plugin;
GOErrorStack *err;
g_return_val_if_fail (service != NULL, NULL);
plugin = go_service_get_plugin (service);
if (!go_plugin_is_enabled (plugin))
return NULL;
if (!go_plugin_is_loaded (plugin))
err = go_plugin_load (plugin);
t = g_type_from_name (type);
if (t == 0)
err = gog_error_stack_new (err,
_("Loading plugin '%s' that contains the object '%s'"),
go_plugin_get_id (plugin), type);;
if (err != NULL) {
go_error_stack_dump (err);
go_error_stack_free (err);
return NULL;
}
g_return_val_if_fail (type != 0, NULL);
}
return g_object_new_valist (t, first_prop, args);
}
gpointer
go_object_new (char const *type, char const *first_prop, ...)
{
gpointer res;
va_list args;
va_start (args, first_prop);
res = go_object_new_valist (type, first_prop, args);
va_end (args);
return res;
}

View File

@@ -0,0 +1,41 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* go-object.h : A GOPlugin aware wrapper for g_object_new
*
* Copyright (C) 2004 Jody Goldberg (jody@gnome.org)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* 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
*/
#ifndef GO_OBJECT_H
#define GO_OBJECT_H
#include <glib-object.h>
gpointer go_object_new (char const *type, char const *first_prop, ...);
gpointer go_object_new_valist (char const *type, char const *first_prop,
va_list vargs);
/*****************************************************************************/
#define GO_SERVICE_OBJECT_TYPE (go_service_object_get_type ())
#define GO_SERVICE_OBJECT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GO_SERVICE_OBJECT_TYPE, GOServiceObject))
#define IS_GO_SERVICE_OBJECT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GO_SERVICE_OBJECT_TYPE))
typedef struct _GOServiceObject GOServiceObject;
GType go_service_object_get_type (void);
char const *go_service_object_primary_type (GOServiceObject const *service);
GSList const *go_service_object_interfaces (GOServiceObject const *service);
#endif /* GO_OBJECT_H */

View File

@@ -0,0 +1,59 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* go-plugin.h : A GOffice plugin
*
* Copyright (C) 2004 Jody Goldberg (jody@gnome.org)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* 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
*/
#ifndef GO_PLUGIN_H
#define GO_PLUGIN_H
#include <goffice/app/goffice-app.h>
#include <glib-object.h>
G_BEGIN_DECLS
#define GO_PLUGIN_TYPE (go_plugin_get_type ())
#define GO_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GO_PLUGIN_TYPE, GOPlugin))
#define IS_GO_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GO_PLUGIN_TYPE))
/**
* NOTE NOTE NOTE
* Inherits from GTypeModule
**/
GType go_plugin_get_type (void);
/* Methods */
GOErrorStack *go_plugin_load (GOPlugin *plugin);
/* Info */
gboolean go_plugin_is_enabled (GOPlugin *plugin);
gboolean go_plugin_is_loaded (GOPlugin *plugin);
char const *go_plugin_get_dir (GOPlugin *plugin);
char const *go_plugin_get_id (GOPlugin *plugin);
char const *go_plugin_get_name (GOPlugin *plugin);
char const *go_plugin_get_description (GOPlugin *plugin);
char const *go_plugin_get_textdomain (GOPlugin *plugin);
GSList *go_plugin_get_dependencies (GOPlugin *plugin);
GSList *go_plugin_get_services (GOPlugin *plugin);
/* Utilities */
char *go_plugin_build_filename (GOPlugin *plugin,
char const *first_element, ...);
G_END_DECLS
#endif /* GO_PLUGIN_H */

View File

@@ -0,0 +1,52 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* go-service-impl.h : Implementation details for the abstract GOService
* interface
*
* Copyright (C) 2001-2004 Zbigniew Chyla (cyba@gnome.pl)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* 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
*/
#ifndef GO_SERVICE_IMPL_H
#define GO_SERVICE_IMPL_H
#include <goffice/app/go-service.h>
#include <glib-object.h>
#include <libxml/tree.h>
G_BEGIN_DECLS
struct _GOService {
GObject base;
GOPlugin *plugin;
};
typedef struct {
GObjectClass base;
GOErrorStack *(*read_details) (GOService *service, xmlNode *tree);
GOErrorStack *(*activate) (GOService *service);
GOErrorStack *(*deactivate) (GOService *service);
char *(*description) (GOService *service);
} GOServiceClass;
struct _GOServiceSimple {
GOService base;
};
typedef GOServiceClass GOServiceSimpleClass;
G_END_DECLS
#endif /* GO_GRAPH_ITEM_IMPL_H */

View File

View File

@@ -0,0 +1,40 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* go-service.h : A GOffice plugin
*
* Copyright (C) 2004 Jody Goldberg (jody@gnome.org)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* 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
*/
#ifndef GO_SERVICE_H
#define GO_SERVICE_H
#include <goffice/app/goffice-app.h>
#include <glib-object.h>
#define GO_SERVICE_TYPE (go_service_get_type ())
#define GO_SERVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GO_SERVICE_TYPE, GOService))
#define IS_GO_SERVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GO_SERVICE_TYPE))
GType go_service_get_type (void);
GOPlugin *go_service_get_plugin (GOService const *service);
#define GO_SERVICE_SIMPLE_TYPE (go_service_simple_get_type ())
#define GO_SERVICE_SIMPLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GO_SERVICE_SIMPLE_TYPE, GOServiceSimple))
#define IS_GO_SERVICE_SIMPLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GO_SERVICE_SIMPLE_TYPE))
typedef struct _GOServiceSimple GOServiceSimple;
GType go_service_simple_get_type (void);
#endif /* GO_SERVICE_H */

View File

@@ -0,0 +1,39 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* goffice-app.h:
*
* Copyright (C) 2004 Jody Goldberg (jody@gnome.org)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* 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
*/
#ifndef GOFFICE_APP_H
#define GOFFICE_APP_H
#include <glib/gmacros.h>
G_BEGIN_DECLS
typedef struct _GOApp GOApp;
typedef struct _GODoc GODoc;
typedef struct _GODocControl GODocControl;
typedef struct _GOPlugin GOPlugin;
typedef struct _GOPluginService GOPluginService;
typedef struct _GOPluginLoader GOPluginLoader;
typedef struct _GOErrorInfo GOErrorInfo;
G_END_DECLS
#endif /* GOFFICE_GRAPH_H */

View File

@@ -0,0 +1,11 @@
Makefile
Makefile.in
*.diff
*.diffs
*.patch
*.log
*.xac.*.xac
.deps
.libs
*.la
*.lo

View File

@@ -0,0 +1,8 @@
if WITH_GNOME
EGG_RECENT = egg-recent-files
else
EGG_RECENT =
endif
SUBDIRS = pcre
#$(EGG_RECENT)

View File

@@ -0,0 +1,11 @@
Makefile
Makefile.in
*.diff
*.diffs
*.patch
*.log
*.xac.*.xac
.deps
.libs
*.la
*.lo

View File

@@ -0,0 +1,33 @@
INCLUDES = \
$(GNUMERIC_CFLAGS) -I$(top_srcdir)/src -DUSE_STABLE_LIBGNOMEUI \
\
\
-DEGG_COMPILATION
noinst_LIBRARIES = libeggrecent.a
vfsdir = $(libdir)/gnome-vfs-2.0/modules
vfsconfdir = $(sysconfdir)/gnome-vfs-2.0/modules
libeggrecent_a_LIBADD = $(EGG_RECENT_LIBS)
libeggrecent_a_SOURCES = \
egg-recent.h \
egg-recent-item.h \
egg-recent-item.c \
egg-recent-model.c \
egg-recent-model.h \
egg-recent-view.c \
egg-recent-view.h \
egg-recent-view-gtk.c \
egg-recent-view-gtk.h \
\
\
egg-recent-util.c \
egg-recent-util.h

View File

@@ -0,0 +1,443 @@
/* File import from libegg to gnumeric by import-egg. Do not edit. */
#include <goffice/goffice-config.h>
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/**
* 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.
*
* Authors:
* James Willcox <jwillcox@cs.indiana.edu>
*/
#include <stdio.h>
#include <string.h>
#include <glib.h>
#include <libgnomevfs/gnome-vfs.h>
#include <libgnomevfs/gnome-vfs-mime-utils.h>
#include "egg-recent-item.h"
EggRecentItem *
egg_recent_item_new (void)
{
EggRecentItem *item;
item = g_new (EggRecentItem, 1);
item->groups = NULL;
item->private_data = FALSE;
item->uri = NULL;
item->mime_type = NULL;
item->refcount = 1;
return item;
}
static void
egg_recent_item_free (EggRecentItem *item)
{
if (item->uri)
g_free (item->uri);
if (item->mime_type)
g_free (item->mime_type);
if (item->groups) {
g_list_foreach (item->groups, (GFunc)g_free, NULL);
g_list_free (item->groups);
item->groups = NULL;
}
g_free (item);
}
EggRecentItem *
egg_recent_item_ref (EggRecentItem *item)
{
item->refcount++;
return item;
}
EggRecentItem *
egg_recent_item_unref (EggRecentItem *item)
{
item->refcount--;
if (item->refcount == 0) {
egg_recent_item_free (item);
}
return item;
}
EggRecentItem *
egg_recent_item_new_from_uri (const gchar *uri)
{
EggRecentItem *item;
g_return_val_if_fail (uri != NULL, NULL);
item = egg_recent_item_new ();
if (!egg_recent_item_set_uri (item ,uri)) {
egg_recent_item_free (item);
return NULL;
}
item->mime_type = gnome_vfs_get_mime_type (item->uri);
if (!item->mime_type)
item->mime_type = g_strdup (GNOME_VFS_MIME_TYPE_UNKNOWN);
return item;
}
/*
static GList *
egg_recent_item_copy_groups (const GList *list)
{
GList *newlist = NULL;
while (list) {
gchar *group = (gchar *)list->data;
newlist = g_list_prepend (newlist, g_strdup (group));
list = list->next;
}
return newlist;
}
EggRecentItem *
egg_recent_item_copy (const EggRecentItem *item)
{
EggRecentItem *newitem;
newitem = egg_recent_item_new ();
newitem->uri = g_strdup (item->uri);
if (item->mime_type)
newitem->mime_type = g_strdup (item->mime_type);
newitem->timestamp = item->timestamp;
newitem->private_data = item->private_data;
newitem->groups = egg_recent_item_copy_groups (item->groups);
return newitem;
}
*/
/*
EggRecentItem *
egg_recent_item_new_valist (const gchar *uri, va_list args)
{
EggRecentItem *item;
EggRecentArg arg;
gchar *str1;
gchar *str2;
gboolean priv;
item = egg_recent_item_new ();
arg = va_arg (args, EggRecentArg);
while (arg != EGG_RECENT_ARG_NONE) {
switch (arg) {
case EGG_RECENT_ARG_MIME_TYPE:
str1 = va_arg (args, gchar*);
egg_recent_item_set_mime_type (item, str1);
break;
case EGG_RECENT_ARG_GROUP:
str1 = va_arg (args, gchar*);
egg_recent_item_add_group (item, str1);
break;
case EGG_RECENT_ARG_PRIVATE:
priv = va_arg (args, gboolean);
egg_recent_item_set_private (item, priv);
break;
default:
break;
}
arg = va_arg (args, EggRecentArg);
}
return item;
}
*/
gboolean
egg_recent_item_set_uri (EggRecentItem *item, const gchar *uri)
{
gchar *utf8_uri;
/* if G_BROKEN_FILENAMES is not set, this should succede */
if (g_utf8_validate (uri, -1, NULL)) {
item->uri = gnome_vfs_make_uri_from_input (uri);
} else {
utf8_uri = g_filename_to_utf8 (uri, -1, NULL, NULL, NULL);
if (utf8_uri == NULL) {
g_warning ("Couldn't convert URI to UTF-8");
return FALSE;
}
if (g_utf8_validate (utf8_uri, -1, NULL)) {
item->uri = gnome_vfs_make_uri_from_input (utf8_uri);
} else {
g_free (utf8_uri);
return FALSE;
}
g_free (utf8_uri);
}
return TRUE;
}
gchar *
egg_recent_item_get_uri (const EggRecentItem *item)
{
return g_strdup (item->uri);
}
G_CONST_RETURN gchar *
egg_recent_item_peek_uri (const EggRecentItem *item)
{
return item->uri;
}
gchar *
egg_recent_item_get_uri_utf8 (const EggRecentItem *item)
{
/* this could fail, but it's not likely, since we've already done it
* once in set_uri()
*/
return g_filename_to_utf8 (item->uri, -1, NULL, NULL, NULL);
}
gchar *
egg_recent_item_get_uri_for_display (const EggRecentItem *item)
{
return gnome_vfs_format_uri_for_display (item->uri);
}
/* Stolen from gnome_vfs_make_valid_utf8() */
static char *
make_valid_utf8 (const char *name)
{
GString *string;
const char *remainder, *invalid;
int remaining_bytes, valid_bytes;
string = NULL;
remainder = name;
remaining_bytes = strlen (name);
while (remaining_bytes != 0) {
if (g_utf8_validate (remainder, remaining_bytes, &invalid))
break;
valid_bytes = invalid - remainder;
if (string == NULL)
string = g_string_sized_new (remaining_bytes);
g_string_append_len (string, remainder, valid_bytes);
g_string_append_c (string, '?');
remaining_bytes -= valid_bytes + 1;
remainder = invalid + 1;
}
if (string == NULL)
return g_strdup (name);
g_string_append (string, remainder);
/* g_string_append (string, _(" (invalid file name)")); */
g_assert (g_utf8_validate (string->str, -1, NULL));
return g_string_free (string, FALSE);
}
/**
* egg_recent_item_get_short_name:
* @item: an #EggRecentItem
*
* Computes a valid UTF-8 string that can be used as the name of the item in a
* menu or list. For example, calling this function on an item that refers to
* "file:///foo/bar.txt" will yield "bar.txt".
*
* Return value: A newly-allocated string in UTF-8 encoding; free it with
* g_free().
**/
gchar *
egg_recent_item_get_short_name (const EggRecentItem *item)
{
GnomeVFSURI *uri;
char *short_name;
gboolean valid;
g_return_val_if_fail (item != NULL, NULL);
if (item->uri == NULL)
return NULL;
uri = gnome_vfs_uri_new (item->uri);
if (uri == NULL)
return NULL;
short_name = gnome_vfs_uri_extract_short_name (uri);
valid = FALSE;
if (strcmp (gnome_vfs_uri_get_scheme (uri), "file") == 0) {
char *tmp;
tmp = g_filename_to_utf8 (short_name, -1, NULL, NULL, NULL);
if (tmp) {
g_free (short_name);
short_name = tmp;
valid = TRUE;
}
}
if (!valid) {
char *tmp;
tmp = make_valid_utf8 (short_name);
g_assert (tmp != NULL);
g_free (short_name);
short_name = tmp;
}
gnome_vfs_uri_unref (uri);
return short_name;
}
void
egg_recent_item_set_mime_type (EggRecentItem *item, const gchar *mime)
{
item->mime_type = g_strdup (mime);
}
gchar *
egg_recent_item_get_mime_type (const EggRecentItem *item)
{
return g_strdup (item->mime_type);
}
void
egg_recent_item_set_timestamp (EggRecentItem *item, time_t timestamp)
{
if (timestamp == (time_t) -1)
time (&timestamp);
item->timestamp = timestamp;
}
time_t
egg_recent_item_get_timestamp (const EggRecentItem *item)
{
return item->timestamp;
}
G_CONST_RETURN GList *
egg_recent_item_get_groups (const EggRecentItem *item)
{
return item->groups;
}
gboolean
egg_recent_item_in_group (const EggRecentItem *item, const gchar *group_name)
{
GList *tmp;
tmp = item->groups;
while (tmp != NULL) {
gchar *val = (gchar *)tmp->data;
if (strcmp (group_name, val) == 0)
return TRUE;
tmp = tmp->next;
}
return FALSE;
}
void
egg_recent_item_add_group (EggRecentItem *item, const gchar *group_name)
{
g_return_if_fail (group_name != NULL);
if (!egg_recent_item_in_group (item, group_name))
item->groups = g_list_append (item->groups, g_strdup (group_name));
}
void
egg_recent_item_remove_group (EggRecentItem *item, const gchar *group_name)
{
GList *tmp;
g_return_if_fail (group_name != NULL);
tmp = item->groups;
while (tmp != NULL) {
gchar *val = (gchar *)tmp->data;
if (strcmp (group_name, val) == 0) {
item->groups = g_list_remove (item->groups,
val);
g_free (val);
break;
}
tmp = tmp->next;
}
}
void
egg_recent_item_set_private (EggRecentItem *item, gboolean priv)
{
item->private_data = priv;
}
gboolean
egg_recent_item_get_private (const EggRecentItem *item)
{
return item->private_data;
}
GType
egg_recent_item_get_type (void)
{
static GType boxed_type = 0;
if (!boxed_type) {
boxed_type = g_boxed_type_register_static ("EggRecentItem",
(GBoxedCopyFunc)egg_recent_item_ref,
(GBoxedFreeFunc)egg_recent_item_unref);
}
return boxed_type;
}

View File

@@ -0,0 +1,80 @@
/* File import from libegg to gnumeric by import-egg. Do not edit. */
#ifndef __EGG_RECENT_ITEM_H__
#define __EGG_RECENT_ITEM_H__
#include <time.h>
#include <glib.h>
#include <glib-object.h>
G_BEGIN_DECLS
#define EGG_TYPE_RECENT_ITEM (egg_recent_item_get_type ())
#define EGG_RECENT_ITEM_LIST_UNREF(list) \
g_list_foreach (list, (GFunc)egg_recent_item_unref, NULL); \
g_list_free (list);
typedef struct _EggRecentItem EggRecentItem;
struct _EggRecentItem {
/* do not access any of these directly */
gchar *uri;
gchar *mime_type;
time_t timestamp;
gboolean private_data;
GList *groups;
int refcount;
};
GType egg_recent_item_get_type (void) G_GNUC_CONST;
/* constructors */
EggRecentItem * egg_recent_item_new (void);
EggRecentItem * egg_recent_item_ref (EggRecentItem *item);
EggRecentItem * egg_recent_item_unref (EggRecentItem *item);
/* automatically fetches the mime type, etc */
EggRecentItem * egg_recent_item_new_from_uri (const gchar *uri);
gboolean egg_recent_item_set_uri (EggRecentItem *item, const gchar *uri);
gchar * egg_recent_item_get_uri (const EggRecentItem *item);
gchar * egg_recent_item_get_uri_utf8 (const EggRecentItem *item);
gchar * egg_recent_item_get_uri_for_display (const EggRecentItem *item);
gchar * egg_recent_item_get_short_name (const EggRecentItem *item);
void egg_recent_item_set_mime_type (EggRecentItem *item, const gchar *mime);
gchar * egg_recent_item_get_mime_type (const EggRecentItem *item);
void egg_recent_item_set_timestamp (EggRecentItem *item, time_t timestamp);
time_t egg_recent_item_get_timestamp (const EggRecentItem *item);
G_CONST_RETURN gchar *egg_recent_item_peek_uri (const EggRecentItem *item);
/* groups */
G_CONST_RETURN GList * egg_recent_item_get_groups (const EggRecentItem *item);
gboolean egg_recent_item_in_group (const EggRecentItem *item,
const gchar *group_name);
void egg_recent_item_add_group (EggRecentItem *item,
const gchar *group_name);
void egg_recent_item_remove_group (EggRecentItem *item,
const gchar *group_name);
void egg_recent_item_set_private (EggRecentItem *item,
gboolean priv);
gboolean egg_recent_item_get_private (const EggRecentItem *item);
G_END_DECLS
#endif /* __EGG_RECENT_ITEM_H__ */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,82 @@
/* File import from libegg to gnumeric by import-egg. Do not edit. */
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#ifndef __EGG_RECENT_MODEL_H__
#define __EGG_RECENT_MODEL_H__
#include "egg-recent-item.h"
G_BEGIN_DECLS
#define EGG_TYPE_RECENT_MODEL (egg_recent_model_get_type ())
#define EGG_RECENT_MODEL(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, EGG_TYPE_RECENT_MODEL, EggRecentModel)
#define EGG_RECENT_MODEL_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, EGG_TYPE_RECENT_MODEL, EggRecentModelClass)
#define EGG_IS_RECENT_MODEL(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, egg_recent_model_get_type ())
typedef struct _EggRecentModel EggRecentModel;
typedef struct _EggRecentModelPrivate EggRecentModelPrivate;
typedef struct _EggRecentModelClass EggRecentModelClass;
struct _EggRecentModel {
GObject parent_instance;
EggRecentModelPrivate *priv;
};
struct _EggRecentModelClass {
GObjectClass parent_class;
void (*changed) (EggRecentModel *model, GList *list);
};
typedef enum {
EGG_RECENT_MODEL_SORT_MRU,
EGG_RECENT_MODEL_SORT_LRU,
EGG_RECENT_MODEL_SORT_NONE
} EggRecentModelSort;
/* Standard group names */
#define EGG_RECENT_GROUP_LAUNCHERS "Launchers"
GType egg_recent_model_get_type (void);
/* constructors */
EggRecentModel * egg_recent_model_new (EggRecentModelSort sort);
/* public methods */
void egg_recent_model_set_filter_mime_types (EggRecentModel *model,
...);
void egg_recent_model_set_filter_groups (EggRecentModel *model, ...);
void egg_recent_model_set_filter_uri_schemes (EggRecentModel *model,
...);
void egg_recent_model_set_sort (EggRecentModel *model,
EggRecentModelSort sort);
gboolean egg_recent_model_add_full (EggRecentModel *model,
EggRecentItem *item);
gboolean egg_recent_model_add (EggRecentModel *model,
const gchar *uri);
gboolean egg_recent_model_delete (EggRecentModel *model,
const gchar *uri);
void egg_recent_model_clear (EggRecentModel *model);
GList * egg_recent_model_get_list (EggRecentModel *model);
void egg_recent_model_changed (EggRecentModel *model);
void egg_recent_model_set_limit (EggRecentModel *model, int limit);
int egg_recent_model_get_limit (EggRecentModel *model);
void egg_recent_model_remove_expired (EggRecentModel *model);
G_END_DECLS
#endif /* __EGG_RECENT_MODEL_H__ */

View File

@@ -0,0 +1,141 @@
/* File import from libegg to gnumeric by import-egg. Do not edit. */
#include <goffice/goffice-config.h>
/* #include <config.h> */
#include <stdio.h>
#include <string.h>
#include <gtk/gtk.h>
#include <time.h>
#include <unistd.h>
#include <sys/types.h>
#ifndef USE_STABLE_LIBGNOMEUI
#include <libgnomeui/gnome-icon-theme.h>
#include <libgnomeui/gnome-icon-lookup.h>
#endif
#include <math.h>
#include "egg-recent-util.h"
#define EGG_RECENT_UTIL_HOSTNAME_SIZE 512
/* ripped out of gedit2 */
gchar*
egg_recent_util_escape_underlines (const gchar* text)
{
GString *str;
gint length;
const gchar *p;
const gchar *end;
g_return_val_if_fail (text != NULL, NULL);
length = strlen (text);
str = g_string_new ("");
p = text;
end = text + length;
while (p != end)
{
const gchar *next;
next = g_utf8_next_char (p);
switch (*p)
{
case '_':
g_string_append (str, "__");
break;
default:
g_string_append_len (str, p, next - p);
break;
}
p = next;
}
return g_string_free (str, FALSE);
}
#ifndef USE_STABLE_LIBGNOMEUI
static GdkPixbuf *
load_icon_file (char *filename,
guint nominal_size)
{
GdkPixbuf *pixbuf, *scaled_pixbuf;
guint width, height;
pixbuf = gdk_pixbuf_new_from_file_at_size (filename, nominal_size, nominal_size, NULL);
if (pixbuf == NULL) {
return NULL;
}
width = gdk_pixbuf_get_width (pixbuf);
height = gdk_pixbuf_get_height (pixbuf);
/* if the icon is larger than the nominal size, scale down */
if (MAX (width, height) > nominal_size) {
if (width > height) {
height = height * nominal_size / width;
width = nominal_size;
} else {
width = width * nominal_size / height;
height = nominal_size;
}
scaled_pixbuf = gdk_pixbuf_scale_simple
(pixbuf, width, height, GDK_INTERP_BILINEAR);
g_object_unref (pixbuf);
pixbuf = scaled_pixbuf;
}
return pixbuf;
}
GdkPixbuf *
egg_recent_util_get_icon (GnomeIconTheme *theme, const gchar *uri,
const gchar *mime_type, int size)
{
gchar *icon;
gchar *filename;
const GnomeIconData *icon_data;
GdkPixbuf *pixbuf;
icon = gnome_icon_lookup (theme, NULL, uri, NULL, NULL,
mime_type, 0, NULL);
g_return_val_if_fail (icon != NULL, NULL);
filename = gnome_icon_theme_lookup_icon (theme, icon,
size,
&icon_data,
NULL);
g_free (icon);
if (filename == NULL) {
return NULL;
}
pixbuf = load_icon_file (filename, size);
g_free (filename);
return pixbuf;
}
#endif /* !USE_STABLE_LIBGNOMEUI */
gchar *
egg_recent_util_get_unique_id (void)
{
char hostname[EGG_RECENT_UTIL_HOSTNAME_SIZE];
time_t the_time;
guint32 rand;
int pid;
gethostname (hostname, EGG_RECENT_UTIL_HOSTNAME_SIZE);
time (&the_time);
rand = g_random_int ();
pid = getpid ();
return g_strdup_printf ("%s-%d-%d-%d", hostname, (int)time, (int)rand, (int)pid);
}

View File

@@ -0,0 +1,25 @@
/* File import from libegg to gnumeric by import-egg. Do not edit. */
#ifndef __EGG_RECENT_UTIL__
#define __EGG_RECENT_UTIL__
#include <gtk/gtk.h>
#ifndef USE_STABLE_LIBGNOMEUI
#include <libgnomeui/gnome-icon-theme.h>
#endif
G_BEGIN_DECLS
gchar * egg_recent_util_escape_underlines (const gchar *uri);
gchar * egg_recent_util_get_unique_id (void);
#ifndef USE_STABLE_LIBGNOMEUI
GdkPixbuf * egg_recent_util_get_icon (GnomeIconTheme *theme,
const gchar *uri,
const gchar *mime_type,
int size);
#endif
G_END_DECLS
#endif /* __EGG_RECENT_UTIL__ */

View File

@@ -0,0 +1,820 @@
/* File import from libegg to gnumeric by import-egg. Do not edit. */
#include <goffice/goffice-config.h>
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/**
* 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.
*
* Authors:
* James Willcox <jwillcox@cs.indiana.edu>
*/
#ifdef HAVE_CONFIG_H
/* #include <config.h> */
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include <libgnomevfs/gnome-vfs.h>
#ifndef USE_STABLE_LIBGNOMEUI
#include <libgnomeui/gnome-icon-theme.h>
#endif
#include <gconf/gconf-client.h>
#include "egg-recent-model.h"
#include "egg-recent-view.h"
#include "egg-recent-view-gtk.h"
#include "egg-recent-util.h"
#include "egg-recent-item.h"
struct _EggRecentViewGtk {
GObject parent_instance; /* We emit signals */
GtkWidget *menu;
GtkWidget *start_menu_item;
gboolean leading_sep;
gboolean trailing_sep;
gulong changed_cb_id;
gchar *uid;
gboolean show_icons;
gboolean show_numbers;
#ifndef USE_STABLE_LIBGNOMEUI
GnomeIconTheme *theme;
#endif
GtkTooltips *tooltips;
EggRecentViewGtkTooltipFunc tooltip_func;
gpointer tooltip_func_data;
EggRecentModel *model;
GConfClient *client;
GtkIconSize icon_size;
};
struct _EggRecentViewGtkMenuData {
EggRecentViewGtk *view;
EggRecentItem *item;
};
typedef struct _EggRecentViewGtkMenuData EggRecentViewGtkMenuData;
enum {
ACTIVATE,
LAST_SIGNAL
};
/* GObject properties */
enum {
PROP_BOGUS,
PROP_MENU,
PROP_START_MENU_ITEM,
PROP_SHOW_ICONS,
PROP_SHOW_NUMBERS
};
static guint view_signals[LAST_SIGNAL] = { 0 };
static void
egg_recent_view_gtk_clear (EggRecentViewGtk *view)
{
GList *menu_children;
GList *p;
GObject *menu_item;
gint *menu_data=NULL;
g_return_if_fail (view->menu != NULL);
menu_children = gtk_container_get_children (GTK_CONTAINER (view->menu));
p = menu_children;
while (p != NULL) {
menu_item = (GObject *)p->data;
menu_data = (gint *)g_object_get_data (menu_item,
view->uid);
if (menu_data) {
gtk_container_remove (GTK_CONTAINER (view->menu),
GTK_WIDGET (menu_item));
}
p = p->next;
}
}
static gint
egg_recent_view_gtk_find_menu_offset (EggRecentViewGtk *view)
{
gint i;
GList *menu_children;
GList *p;
GtkWidget *menu_item;
gint menu_loc=-1;
g_return_val_if_fail (view, 0);
menu_children = GTK_MENU_SHELL (view->menu)->children;
i = 0;
p = menu_children;
while (p != NULL) {
menu_item = (GtkWidget *)p->data;
if (menu_item == view->start_menu_item) {
menu_loc = i;
break;
}
p = p->next;
i++;
}
return menu_loc;
}
static void
egg_recent_view_gtk_menu_cb (GtkWidget *menu, gpointer data)
{
EggRecentViewGtkMenuData *md = (EggRecentViewGtkMenuData *) data;
EggRecentItem *item;
g_return_if_fail (md);
g_return_if_fail (md->item);
g_return_if_fail (md->view);
g_return_if_fail (EGG_IS_RECENT_VIEW_GTK (md->view));
item = md->item;
egg_recent_item_ref (item);
g_signal_emit (G_OBJECT(md->view), view_signals[ACTIVATE], 0,
item);
egg_recent_item_unref (item);
}
static void
egg_recent_view_gtk_destroy_cb (gpointer data, GClosure *closure)
{
EggRecentViewGtkMenuData *md = data;
egg_recent_item_unref (md->item);
g_free (md);
}
static GtkWidget *
egg_recent_view_gtk_new_separator (EggRecentViewGtk *view)
{
GtkWidget *retval;
g_return_val_if_fail (view, NULL);
retval = gtk_separator_menu_item_new ();
/**
* this is a tag so we can distinguish our menu items
* from others that may be in the menu.
*/
g_object_set_data (G_OBJECT (retval),
view->uid,
GINT_TO_POINTER (1));
gtk_widget_show (retval);
return retval;
}
static GtkWidget *
egg_recent_view_gtk_new_menu_item (EggRecentViewGtk *view,
EggRecentItem *item,
gint index)
{
GtkWidget *menu_item;
EggRecentViewGtkMenuData *md;
gchar *mime_type;
GtkWidget *image;
GdkPixbuf *pixbuf;
gchar *text;
gchar *short_name;
gchar *escaped;
g_return_val_if_fail (view, NULL);
g_return_val_if_fail (item, NULL);
short_name = egg_recent_item_get_short_name (item);
if (!short_name)
return NULL;
escaped = egg_recent_util_escape_underlines (short_name);
g_free (short_name);
if (view->show_numbers) {
/* avoid having conflicting mnemonics */
if (index >= 10)
text = g_strdup_printf ("%d. %s", index,
escaped);
else
text = g_strdup_printf ("_%d. %s", index,
escaped);
g_free (escaped);
} else {
text = escaped;
}
mime_type = egg_recent_item_get_mime_type (item);
#ifndef USE_STABLE_LIBGNOMEUI
{
int width, height;
gchar *uri;
gtk_icon_size_lookup_for_settings
(gtk_widget_get_settings (view->menu),
view->icon_size,
&width, &height);
uri = egg_recent_item_get_uri (item);
pixbuf = egg_recent_util_get_icon (view->theme, uri,
mime_type,
height);
g_free (uri);
}
#else
pixbuf = NULL;
#endif
image = gtk_image_new_from_pixbuf (pixbuf);
if (pixbuf)
g_object_unref (pixbuf);
if (view->show_icons)
gtk_widget_show (image);
menu_item = gtk_image_menu_item_new_with_mnemonic (text);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item),
image);
md = g_new0 (EggRecentViewGtkMenuData, 1);
md->view = view;
md->item = egg_recent_item_ref (item);
g_signal_connect_data (G_OBJECT (menu_item), "activate",
G_CALLBACK (egg_recent_view_gtk_menu_cb),
md,
(GClosureNotify)egg_recent_view_gtk_destroy_cb,
0);
g_free (mime_type);
g_free (text);
/**
* this is a tag so we can distinguish our menu items
* from others that may be in the menu.
*/
g_object_set_data (G_OBJECT (menu_item),
view->uid,
GINT_TO_POINTER (1));
gtk_widget_show (menu_item);
return menu_item;
}
static void
egg_recent_view_gtk_add_to_menu (EggRecentViewGtk *view,
EggRecentItem *item,
gint display,
gint index)
{
GtkWidget *menu_item;
gint menu_offset;
g_return_if_fail (view);
g_return_if_fail (view->menu);
menu_offset = egg_recent_view_gtk_find_menu_offset (view);
if (item != NULL)
menu_item = egg_recent_view_gtk_new_menu_item (view, item, display);
else
menu_item = egg_recent_view_gtk_new_separator (view);
if (view->tooltip_func != NULL && menu_item != NULL) {
view->tooltip_func (view->tooltips, menu_item,
item, view->tooltip_func_data);
}
if (menu_item)
gtk_menu_shell_insert (GTK_MENU_SHELL (view->menu), menu_item,
menu_offset+index);
}
static void
egg_recent_view_gtk_set_list (EggRecentViewGtk *view, GList *list)
{
EggRecentItem *item;
GList *p;
gint display=1;
gint index=1;
g_return_if_fail (view);
egg_recent_view_gtk_clear (view);
if (view->leading_sep) {
egg_recent_view_gtk_add_to_menu (view, NULL, display, index);
index++;
}
p = list;
while (p != NULL) {
item = (EggRecentItem *)p->data;
egg_recent_view_gtk_add_to_menu (view, item, display, index);
p = p->next;
display++;
index++;
}
if (view->trailing_sep)
egg_recent_view_gtk_add_to_menu (view, NULL, display, index);
}
static void
model_changed_cb (EggRecentModel *model, GList *list, EggRecentViewGtk *view)
{
if (list != NULL)
egg_recent_view_gtk_set_list (view, list);
else
egg_recent_view_gtk_clear (view);
}
static EggRecentModel *
egg_recent_view_gtk_get_model (EggRecentView *view_parent)
{
EggRecentViewGtk *view;
g_return_val_if_fail (view_parent != NULL, NULL);
view = EGG_RECENT_VIEW_GTK (view_parent);
return view->model;
}
static void
egg_recent_view_gtk_set_model (EggRecentView *view_parent,
EggRecentModel *model)
{
EggRecentViewGtk *view;
g_return_if_fail (view_parent != NULL);
view = EGG_RECENT_VIEW_GTK (view_parent);
if (view->model != NULL) {
g_object_unref (view->model);
g_signal_handler_disconnect (G_OBJECT (model),
view->changed_cb_id);
}
view->model = model;
g_object_ref (view->model);
view->changed_cb_id = g_signal_connect_object (G_OBJECT (model),
"changed",
G_CALLBACK (model_changed_cb),
view, 0);
egg_recent_model_changed (view->model);
}
void
egg_recent_view_gtk_set_leading_sep (EggRecentViewGtk *view, gboolean val)
{
view->leading_sep = val;
egg_recent_view_gtk_clear (view);
if (view->model)
egg_recent_model_changed (view->model);
}
void
egg_recent_view_gtk_set_trailing_sep (EggRecentViewGtk *view, gboolean val)
{
view->trailing_sep = val;
egg_recent_view_gtk_clear (view);
if (view->model)
egg_recent_model_changed (view->model);
}
static void
egg_recent_view_gtk_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
EggRecentViewGtk *view = EGG_RECENT_VIEW_GTK (object);
switch (prop_id)
{
case PROP_MENU:
egg_recent_view_gtk_set_menu (view,
GTK_WIDGET (g_value_get_object (value)));
break;
case PROP_START_MENU_ITEM:
egg_recent_view_gtk_set_start_menu_item (view,
g_value_get_object (value));
break;
case PROP_SHOW_ICONS:
egg_recent_view_gtk_show_icons (view,
g_value_get_boolean (value));
break;
case PROP_SHOW_NUMBERS:
egg_recent_view_gtk_show_numbers (view,
g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
egg_recent_view_gtk_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
EggRecentViewGtk *view = EGG_RECENT_VIEW_GTK (object);
switch (prop_id)
{
case PROP_MENU:
g_value_set_object (value, view->menu);
break;
case PROP_START_MENU_ITEM:
g_value_set_object (value, view->start_menu_item);
break;
case PROP_SHOW_ICONS:
g_value_set_boolean (value, view->show_icons);
break;
case PROP_SHOW_NUMBERS:
g_value_set_boolean (value, view->show_numbers);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
egg_recent_view_gtk_finalize (GObject *object)
{
EggRecentViewGtk *view = EGG_RECENT_VIEW_GTK (object);
g_signal_handler_disconnect (G_OBJECT (view->model),
view->changed_cb_id);
g_free (view->uid);
g_object_unref (view->menu);
g_object_unref (view->model);
#ifndef USE_STABLE_LIBGNOMEUI
g_object_unref (view->theme);
#endif
g_object_unref (view->client);
g_object_unref (view->tooltips);
}
static void
egg_recent_view_gtk_class_init (EggRecentViewGtkClass * klass)
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (klass);
object_class->set_property = egg_recent_view_gtk_set_property;
object_class->get_property = egg_recent_view_gtk_get_property;
object_class->finalize = egg_recent_view_gtk_finalize;
view_signals[ACTIVATE] = g_signal_new ("activate",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EggRecentViewGtkClass, activate),
NULL, NULL,
g_cclosure_marshal_VOID__BOXED,
G_TYPE_NONE, 1,
EGG_TYPE_RECENT_ITEM);
g_object_class_install_property (object_class,
PROP_MENU,
g_param_spec_object ("menu",
"Menu",
"The GtkMenuShell this object will update.",
gtk_menu_get_type(),
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_START_MENU_ITEM,
g_param_spec_object ("start-menu-item",
"Start Menu Item",
"The menu item that precedes where are menu items will go",
gtk_menu_item_get_type (),
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_SHOW_ICONS,
g_param_spec_boolean ("show-icons",
"Show Icons",
"Whether or not to show icons",
FALSE,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_SHOW_NUMBERS,
g_param_spec_boolean ("show-numbers",
"Show Numbers",
"Whether or not to show numbers",
TRUE,
G_PARAM_READWRITE));
klass->activate = NULL;
}
static void
egg_recent_view_init (EggRecentViewClass *iface)
{
iface->do_get_model = egg_recent_view_gtk_get_model;
iface->do_set_model = egg_recent_view_gtk_set_model;
}
static void
show_menus_changed_cb (GConfClient *client,
guint cnxn_id,
GConfEntry *entry,
EggRecentViewGtk *view)
{
GConfValue *value;
value = gconf_entry_get_value (entry);
g_return_if_fail (value->type == GCONF_VALUE_BOOL);
egg_recent_view_gtk_show_icons (view,
gconf_value_get_bool (value));
}
#ifndef USE_STABLE_LIBGNOMEUI
static void
theme_changed_cb (GnomeIconTheme *theme, EggRecentViewGtk *view)
{
if (view->model != NULL)
egg_recent_model_changed (view->model);
}
#endif
static void
egg_recent_view_gtk_init (EggRecentViewGtk * view)
{
view->client = gconf_client_get_default ();
view->show_icons =
gconf_client_get_bool (view->client,
"/desktop/gnome/interface/menus_have_icons",
NULL);
gconf_client_add_dir (view->client, "/desktop/gnome/interface",
GCONF_CLIENT_PRELOAD_NONE,
NULL);
gconf_client_notify_add (view->client,
"/desktop/gnome/interface/menus_have_icons",
(GConfClientNotifyFunc)show_menus_changed_cb,
view, NULL, NULL);
view->leading_sep = FALSE;
view->trailing_sep = FALSE;
view->uid = egg_recent_util_get_unique_id ();
#ifndef USE_STABLE_LIBGNOMEUI
view->theme = gnome_icon_theme_new ();
gnome_icon_theme_set_allow_svg (view->theme, TRUE);
g_signal_connect_object (view->theme, "changed",
G_CALLBACK (theme_changed_cb), view, 0);
#endif
view->tooltips = gtk_tooltips_new ();
g_object_ref (view->tooltips);
gtk_object_sink (GTK_OBJECT (view->tooltips));
view->tooltip_func = NULL;
view->tooltip_func_data = NULL;
view->icon_size = GTK_ICON_SIZE_MENU;
}
void
egg_recent_view_gtk_set_icon_size (EggRecentViewGtk *view,
GtkIconSize icon_size)
{
if (view->icon_size != icon_size) {
view->icon_size = icon_size;
egg_recent_model_changed (view->model);
} else {
view->icon_size = icon_size;
}
}
GtkIconSize
egg_recent_view_gtk_get_icon_size (EggRecentViewGtk *view)
{
return view->icon_size;
}
void
egg_recent_view_gtk_show_icons (EggRecentViewGtk *view, gboolean show)
{
view->show_icons = show;
if (view->model)
egg_recent_model_changed (view->model);
}
void
egg_recent_view_gtk_show_numbers (EggRecentViewGtk *view, gboolean show)
{
view->show_numbers = show;
if (view->model)
egg_recent_model_changed (view->model);
}
void
egg_recent_view_gtk_set_tooltip_func (EggRecentViewGtk *view,
EggRecentViewGtkTooltipFunc func,
gpointer user_data)
{
view->tooltip_func = func;
view->tooltip_func_data = user_data;
if (view->model)
egg_recent_model_changed (view->model);
}
/**
* egg_recent_view_gtk_set_menu:
* @view: A EggRecentViewGtk object.
* @menu: The GtkMenuShell to put the menu items in.
*
* Use this function to change the GtkMenuShell that the recent
* documents appear in.
*
*/
void
egg_recent_view_gtk_set_menu (EggRecentViewGtk *view,
GtkWidget *menu)
{
g_return_if_fail (view);
g_return_if_fail (EGG_IS_RECENT_VIEW_GTK (view));
g_return_if_fail (menu);
if (view->menu != NULL)
g_object_unref (view->menu);
view->menu = menu;
g_object_ref (view->menu);
}
/**
* egg_recent_view_gtk_set_start_menu_item:
* @view: A EggRecentViewGtk object.
* @start_menu_item: The menu item that appears just before where our menu
* items should appear
*
*/
void
egg_recent_view_gtk_set_start_menu_item (EggRecentViewGtk *view,
GtkWidget *menu_item)
{
g_return_if_fail (view);
g_return_if_fail (EGG_IS_RECENT_VIEW_GTK (view));
view->start_menu_item = menu_item;
}
/**
* egg_recent_view_gtk_get_menu:
* @view: A EggRecentViewGtk object.
*
*/
GtkWidget *
egg_recent_view_gtk_get_menu (EggRecentViewGtk *view)
{
return view->menu;
}
/**
* egg_recent_view_gtk_get_start_menu_item
* @view: A EggRecentViewGtk object.
*
*/
GtkWidget *
egg_recent_view_gtk_get_start_menu_item (EggRecentViewGtk *view)
{
return view->start_menu_item;
}
/**
* egg_recent_view_gtk_new:
* @appname: The name of your application.
* @limit: The maximum number of items allowed.
*
* This creates a new EggRecentViewGtk object.
*
* Returns: a EggRecentViewGtk object
*/
EggRecentViewGtk *
egg_recent_view_gtk_new (GtkWidget *menu, GtkWidget *start_menu_item)
{
EggRecentViewGtk *view;
g_return_val_if_fail (menu, NULL);
view = EGG_RECENT_VIEW_GTK (g_object_new (egg_recent_view_gtk_get_type (),
"start-menu-item",
start_menu_item,
"menu", menu,
"show-numbers", TRUE, NULL));
g_return_val_if_fail (view, NULL);
return view;
}
/**
* egg_recent_view_gtk_get_type:
* @:
*
* This returns a GType representing a EggRecentViewGtk object.
*
* Returns: a GType
*/
GType
egg_recent_view_gtk_get_type (void)
{
static GType egg_recent_view_gtk_type = 0;
if(!egg_recent_view_gtk_type) {
static const GTypeInfo egg_recent_view_gtk_info = {
sizeof (EggRecentViewGtkClass),
NULL, /* base init */
NULL, /* base finalize */
(GClassInitFunc)egg_recent_view_gtk_class_init, /* class init */
NULL, /* class finalize */
NULL, /* class data */
sizeof (EggRecentViewGtk),
0,
(GInstanceInitFunc) egg_recent_view_gtk_init
};
static const GInterfaceInfo view_info =
{
(GInterfaceInitFunc) egg_recent_view_init,
NULL,
NULL
};
egg_recent_view_gtk_type = g_type_register_static (G_TYPE_OBJECT,
"EggRecentViewGtk",
&egg_recent_view_gtk_info, 0);
g_type_add_interface_static (egg_recent_view_gtk_type,
EGG_TYPE_RECENT_VIEW,
&view_info);
}
return egg_recent_view_gtk_type;
}

View File

@@ -0,0 +1,66 @@
/* File import from libegg to gnumeric by import-egg. Do not edit. */
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#ifndef __EGG_RECENT_VIEW_GTK_H__
#define __EGG_RECENT_VIEW_GTK_H__
G_BEGIN_DECLS
#include <gtk/gtk.h>
#include "egg-recent-item.h"
#define EGG_RECENT_VIEW_GTK(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, egg_recent_view_gtk_get_type (), EggRecentViewGtk)
#define EGG_RECENT_VIEW_GTK_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, egg_recent_view_gtk_get_type (), EggRecentViewGtkClass)
#define EGG_IS_RECENT_VIEW_GTK(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, egg_recent_view_gtk_get_type ())
typedef void (*EggRecentViewGtkTooltipFunc) (GtkTooltips *tooltips,
GtkWidget *menu,
EggRecentItem *item,
gpointer user_data);
typedef struct _EggRecentViewGtk EggRecentViewGtk;
typedef struct _EggRecentViewGtkClass EggRecentViewGtkClass;
struct _EggRecentViewGtkClass {
GObjectClass parent_class;
void (*activate) (EggRecentViewGtk *view, EggRecentItem *item);
};
GType egg_recent_view_gtk_get_type (void);
EggRecentViewGtk * egg_recent_view_gtk_new (GtkWidget *menu,
GtkWidget *start_menu_item);
void egg_recent_view_gtk_set_menu (EggRecentViewGtk *view,
GtkWidget *menu);
GtkWidget * egg_recent_view_gtk_get_menu (EggRecentViewGtk *view);
void egg_recent_view_gtk_set_start_menu_item (EggRecentViewGtk *view,
GtkWidget *menu_item);
GtkWidget *egg_recent_view_gtk_get_start_menu_item (EggRecentViewGtk *view);
void egg_recent_view_gtk_set_leading_sep (EggRecentViewGtk *view,
gboolean val);
void egg_recent_view_gtk_set_trailing_sep (EggRecentViewGtk *view,
gboolean val);
void egg_recent_view_gtk_show_icons (EggRecentViewGtk *view,
gboolean show);
void egg_recent_view_gtk_show_numbers (EggRecentViewGtk *view,
gboolean show);
void egg_recent_view_gtk_set_tooltip_func (EggRecentViewGtk *view,
EggRecentViewGtkTooltipFunc func,
gpointer user_data);
void egg_recent_view_gtk_set_icon_size (EggRecentViewGtk *view,
GtkIconSize icon_size);
GtkIconSize egg_recent_view_gtk_get_icon_size (EggRecentViewGtk *view);
G_END_DECLS
#endif /* __EGG_RECENT_VIEW_GTK_H__ */

View File

@@ -0,0 +1,71 @@
/* File import from libegg to gnumeric by import-egg. Do not edit. */
#include <goffice/goffice-config.h>
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/**
* 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.
*
* Authors:
* James Willcox <jwillcox@cs.indiana.edu>
*/
#ifdef HAVE_CONFIG_H
/* #include <config.h> */
#endif
#include <string.h>
#include <gtk/gtk.h>
#include "egg-recent-view.h"
GtkType
egg_recent_view_get_type (void)
{
static GtkType view_type = 0;
if (!view_type)
{
static const GTypeInfo view_info =
{
sizeof (EggRecentViewClass), /* class_size */
NULL, /* base_init */
NULL, /* base_finalize */
};
view_type = g_type_register_static (G_TYPE_INTERFACE,
"EggRecentView",
&view_info, 0);
}
return view_type;
}
EggRecentModel *
egg_recent_view_get_model (EggRecentView *view)
{
g_return_val_if_fail (view, NULL);
return EGG_RECENT_VIEW_GET_CLASS (view)->do_get_model (view);
}
void
egg_recent_view_set_model (EggRecentView *view, EggRecentModel *model)
{
g_return_if_fail (view);
g_return_if_fail (model);
EGG_RECENT_VIEW_GET_CLASS (view)->do_set_model (view, model);
}

View File

@@ -0,0 +1,45 @@
/* File import from libegg to gnumeric by import-egg. Do not edit. */
#ifndef __EGG_RECENT_VIEW_H__
#define __EGG_RECENT_VIEW_H__
#include <gdk/gdk.h>
#include <gtk/gtkwidget.h>
#include "egg-recent-model.h"
#include "egg-recent-item.h"
G_BEGIN_DECLS
#define EGG_TYPE_RECENT_VIEW (egg_recent_view_get_type ())
#define EGG_RECENT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_RECENT_VIEW, EggRecentView))
#define EGG_RECENT_VIEW_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), EGG_TYPE_RECENT_VIEW, EggRecentViewClass))
#define EGG_IS_RECENT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_RECENT_VIEW))
#define EGG_IS_RECENT_VIEW_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), EGG_TYPE_RECENT_VIEW))
#define EGG_RECENT_VIEW_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EGG_TYPE_RECENT_VIEW, EggRecentViewClass))
typedef struct _EggRecentView EggRecentView;
typedef struct _EggRecentViewClass EggRecentViewClass;
struct _EggRecentViewClass
{
GTypeInterface base_iface;
/* vtable, not signals */
void (* do_set_model) (EggRecentView *view,
EggRecentModel *model);
EggRecentModel * (* do_get_model) (EggRecentView *view);
};
GtkType egg_recent_view_get_type (void) G_GNUC_CONST;
void egg_recent_view_set_list (EggRecentView *view,
GSList *list);
void egg_recent_view_clear (EggRecentView *view);
EggRecentModel *egg_recent_view_get_model (EggRecentView *view);
void egg_recent_view_set_model (EggRecentView *view,
EggRecentModel *model);
G_END_DECLS
#endif /* __EGG_RECENT_VIEW_H__ */

View File

@@ -0,0 +1,7 @@
/* File import from libegg to gnumeric by import-egg. Do not edit. */
#include "egg-recent-item.h"
#include "egg-recent-model.h"
#include "egg-recent-view.h"
#include "egg-recent-view-bonobo.h"
#include "egg-recent-view-gtk.h"

View File

@@ -0,0 +1,11 @@
Makefile
Makefile.in
*.diff
*.diffs
*.patch
*.log
*.xac.*.xac
.deps
.libs
*.la
*.lo

View File

@@ -0,0 +1,15 @@
INCLUDES = \
$(GNUMERIC_CFLAGS) -I$(top_srcdir) \
-DSUPPORT_UTF8 \
-DNEWLINE=10 \
-DPOSIX_MALLOC_THRESHOLD=100 \
-DLINK_SIZE=2 \
-DMATCH_LIMIT=10000000
AM_CFLAGS = $(GNOME_CFLAGS)
noinst_LTLIBRARIES = libpcre.la
libpcre_la_SOURCES = maketables.c get.c study.c pcre.c pcreposix.c
noinst_HEADERS = internal.h pcreposix.h pcre.h

View File

@@ -0,0 +1,354 @@
/* File import from pcre to goffice by import-pcre. Do not edit. */
/* This file has been programatically changed. */
/* This makes the following file fall under GPL license, see below. */
/*************************************************
* Perl-Compatible Regular Expressions *
*************************************************/
/*
This is a library of functions to support regular expressions whose syntax
and semantics are as close as possible to those of the Perl 5 language. See
the file Tech.Notes for some information on the internals.
Written by: Philip Hazel <ph10@cam.ac.uk>
Copyright (c) 1997-2003 University of Cambridge
-----------------------------------------------------------------------------
Permission is granted to anyone to use this software for any purpose on any
computer system, and to redistribute it freely, subject to the following
restrictions:
1. This software is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
2. The origin of this software must not be misrepresented, either by
explicit claim or by omission.
3. Altered versions must be plainly marked as such, and must not be
misrepresented as being the original software.
4. If PCRE is embedded in any software that is released under the GNU
General Purpose Licence (GPL), then the terms of that licence shall
supersede any condition above with which it is incompatible.
-----------------------------------------------------------------------------
*/
/* This module contains some convenience functions for extracting substrings
from the subject string after a regex match has succeeded. The original idea
for these functions came from Scott Wimer <scottw@cgibuilder.com>. */
/* Include the internals header, which itself includes Standard C headers plus
the external pcre header. */
#include "internal.h"
/*************************************************
* Find number for named string *
*************************************************/
/* This function is used by the two extraction functions below, as well
as being generally available.
Arguments:
code the compiled regex
stringname the name whose number is required
Returns: the number of the named parentheses, or a negative number
(PCRE_ERROR_NOSUBSTRING) if not found
*/
int
pcre_get_stringnumber(const pcre *code, const char *stringname)
{
int rc;
int entrysize;
int top, bot;
uschar *nametable;
if ((rc = pcre_fullinfo(code, NULL, PCRE_INFO_NAMECOUNT, &top)) != 0)
return rc;
if (top <= 0) return PCRE_ERROR_NOSUBSTRING;
if ((rc = pcre_fullinfo(code, NULL, PCRE_INFO_NAMEENTRYSIZE, &entrysize)) != 0)
return rc;
if ((rc = pcre_fullinfo(code, NULL, PCRE_INFO_NAMETABLE, &nametable)) != 0)
return rc;
bot = 0;
while (top > bot)
{
int mid = (top + bot) / 2;
uschar *entry = nametable + entrysize*mid;
int c = strcmp(stringname, (char *)(entry + 2));
if (c == 0) return (entry[0] << 8) + entry[1];
if (c > 0) bot = mid + 1; else top = mid;
}
return PCRE_ERROR_NOSUBSTRING;
}
/*************************************************
* Copy captured string to given buffer *
*************************************************/
/* This function copies a single captured substring into a given buffer.
Note that we use memcpy() rather than strncpy() in case there are binary zeros
in the string.
Arguments:
subject the subject string that was matched
ovector pointer to the offsets table
stringcount the number of substrings that were captured
(i.e. the yield of the pcre_exec call, unless
that was zero, in which case it should be 1/3
of the offset table size)
stringnumber the number of the required substring
buffer where to put the substring
size the size of the buffer
Returns: if successful:
the length of the copied string, not including the zero
that is put on the end; can be zero
if not successful:
PCRE_ERROR_NOMEMORY (-6) buffer too small
PCRE_ERROR_NOSUBSTRING (-7) no such captured substring
*/
int
pcre_copy_substring(const char *subject, int *ovector, int stringcount,
int stringnumber, char *buffer, int size)
{
int yield;
if (stringnumber < 0 || stringnumber >= stringcount)
return PCRE_ERROR_NOSUBSTRING;
stringnumber *= 2;
yield = ovector[stringnumber+1] - ovector[stringnumber];
if (size < yield + 1) return PCRE_ERROR_NOMEMORY;
memcpy(buffer, subject + ovector[stringnumber], yield);
buffer[yield] = 0;
return yield;
}
/*************************************************
* Copy named captured string to given buffer *
*************************************************/
/* This function copies a single captured substring into a given buffer,
identifying it by name.
Arguments:
code the compiled regex
subject the subject string that was matched
ovector pointer to the offsets table
stringcount the number of substrings that were captured
(i.e. the yield of the pcre_exec call, unless
that was zero, in which case it should be 1/3
of the offset table size)
stringname the name of the required substring
buffer where to put the substring
size the size of the buffer
Returns: if successful:
the length of the copied string, not including the zero
that is put on the end; can be zero
if not successful:
PCRE_ERROR_NOMEMORY (-6) buffer too small
PCRE_ERROR_NOSUBSTRING (-7) no such captured substring
*/
int
pcre_copy_named_substring(const pcre *code, const char *subject, int *ovector,
int stringcount, const char *stringname, char *buffer, int size)
{
int n = pcre_get_stringnumber(code, stringname);
if (n <= 0) return n;
return pcre_copy_substring(subject, ovector, stringcount, n, buffer, size);
}
/*************************************************
* Copy all captured strings to new store *
*************************************************/
/* This function gets one chunk of store and builds a list of pointers and all
of the captured substrings in it. A NULL pointer is put on the end of the list.
Arguments:
subject the subject string that was matched
ovector pointer to the offsets table
stringcount the number of substrings that were captured
(i.e. the yield of the pcre_exec call, unless
that was zero, in which case it should be 1/3
of the offset table size)
listptr set to point to the list of pointers
Returns: if successful: 0
if not successful:
PCRE_ERROR_NOMEMORY (-6) failed to get store
*/
int
pcre_get_substring_list(const char *subject, int *ovector, int stringcount,
const char ***listptr)
{
int i;
int size = sizeof(char *);
int double_count = stringcount * 2;
char **stringlist;
char *p;
for (i = 0; i < double_count; i += 2)
size += sizeof(char *) + ovector[i+1] - ovector[i] + 1;
stringlist = (char **)(pcre_malloc)(size);
if (stringlist == NULL) return PCRE_ERROR_NOMEMORY;
*listptr = (const char **)stringlist;
p = (char *)(stringlist + stringcount + 1);
for (i = 0; i < double_count; i += 2)
{
int len = ovector[i+1] - ovector[i];
memcpy(p, subject + ovector[i], len);
*stringlist++ = p;
p += len;
*p++ = 0;
}
*stringlist = NULL;
return 0;
}
/*************************************************
* Free store obtained by get_substring_list *
*************************************************/
/* This function exists for the benefit of people calling PCRE from non-C
programs that can call its functions, but not free() or (pcre_free)() directly.
Argument: the result of a previous pcre_get_substring_list()
Returns: nothing
*/
void
pcre_free_substring_list(const char **pointer)
{
(pcre_free)((void *)pointer);
}
/*************************************************
* Copy captured string to new store *
*************************************************/
/* This function copies a single captured substring into a piece of new
store
Arguments:
subject the subject string that was matched
ovector pointer to the offsets table
stringcount the number of substrings that were captured
(i.e. the yield of the pcre_exec call, unless
that was zero, in which case it should be 1/3
of the offset table size)
stringnumber the number of the required substring
stringptr where to put a pointer to the substring
Returns: if successful:
the length of the string, not including the zero that
is put on the end; can be zero
if not successful:
PCRE_ERROR_NOMEMORY (-6) failed to get store
PCRE_ERROR_NOSUBSTRING (-7) substring not present
*/
int
pcre_get_substring(const char *subject, int *ovector, int stringcount,
int stringnumber, const char **stringptr)
{
int yield;
char *substring;
if (stringnumber < 0 || stringnumber >= stringcount)
return PCRE_ERROR_NOSUBSTRING;
stringnumber *= 2;
yield = ovector[stringnumber+1] - ovector[stringnumber];
substring = (char *)(pcre_malloc)(yield + 1);
if (substring == NULL) return PCRE_ERROR_NOMEMORY;
memcpy(substring, subject + ovector[stringnumber], yield);
substring[yield] = 0;
*stringptr = substring;
return yield;
}
/*************************************************
* Copy named captured string to new store *
*************************************************/
/* This function copies a single captured substring, identified by name, into
new store.
Arguments:
code the compiled regex
subject the subject string that was matched
ovector pointer to the offsets table
stringcount the number of substrings that were captured
(i.e. the yield of the pcre_exec call, unless
that was zero, in which case it should be 1/3
of the offset table size)
stringname the name of the required substring
stringptr where to put the pointer
Returns: if successful:
the length of the copied string, not including the zero
that is put on the end; can be zero
if not successful:
PCRE_ERROR_NOMEMORY (-6) couldn't get memory
PCRE_ERROR_NOSUBSTRING (-7) no such captured substring
*/
int
pcre_get_named_substring(const pcre *code, const char *subject, int *ovector,
int stringcount, const char *stringname, const char **stringptr)
{
int n = pcre_get_stringnumber(code, stringname);
if (n <= 0) return n;
return pcre_get_substring(subject, ovector, stringcount, n, stringptr);
}
/*************************************************
* Free store obtained by get_substring *
*************************************************/
/* This function exists for the benefit of people calling PCRE from non-C
programs that can call its functions, but not free() or (pcre_free)() directly.
Argument: the result of a previous pcre_get_substring()
Returns: nothing
*/
void
pcre_free_substring(const char *pointer)
{
(pcre_free)((void *)pointer);
}
/* End of get.c */

View File

@@ -0,0 +1,683 @@
/* File import from pcre to goffice by import-pcre. Do not edit. */
/* This file has been programatically changed. */
/* This makes the following file fall under GPL license, see internal.c. */
/*************************************************
* Perl-Compatible Regular Expressions *
*************************************************/
/* This is a library of functions to support regular expressions whose syntax
and semantics are as close as possible to those of the Perl 5 language. See
the file Tech.Notes for some information on the internals.
Written by: Philip Hazel <ph10@cam.ac.uk>
Copyright (c) 1997-2003 University of Cambridge
-----------------------------------------------------------------------------
Permission is granted to anyone to use this software for any purpose on any
computer system, and to redistribute it freely, subject to the following
restrictions:
1. This software is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
2. The origin of this software must not be misrepresented, either by
explicit claim or by omission.
3. Altered versions must be plainly marked as such, and must not be
misrepresented as being the original software.
4. If PCRE is embedded in any software that is released under the GNU
General Purpose Licence (GPL), then the terms of that licence shall
supersede any condition above with which it is incompatible.
-----------------------------------------------------------------------------
*/
/* This header contains definitions that are shared between the different
modules, but which are not relevant to the outside. */
/* Get the definitions provided by running "configure" */
#include <config.h>
/* Standard C headers plus the external interface definition. The only time
setjmp and stdarg are used is when NO_RECURSE is set. */
/* Whatever the question is, ctype.h is not the answer. */
/* #include <ctype.h> */
#include <limits.h>
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef PCRE_SPY
#define PCRE_DEFINITION /* Win32 __declspec(export) trigger for .dll */
#endif
#include "pcre.h"
/* When compiling for use with the Virtual Pascal compiler, these functions
need to have their names changed. PCRE must be compiled with the -DVPCOMPAT
option on the command line. */
#ifdef VPCOMPAT
#define strncmp(s1,s2,m) _strncmp(s1,s2,m)
#define memcpy(d,s,n) _memcpy(d,s,n)
#define memmove(d,s,n) _memmove(d,s,n)
#define memset(s,c,n) _memset(s,c,n)
#else /* VPCOMPAT */
/* To cope with SunOS4 and other systems that lack memmove() but have bcopy(),
define a macro for memmove() if HAVE_MEMMOVE is false, provided that HAVE_BCOPY
is set. Otherwise, include an emulating function for those systems that have
neither (there some non-Unix environments where this is the case). This assumes
that all calls to memmove are moving strings upwards in store, which is the
case in PCRE. */
#if ! HAVE_MEMMOVE
#undef memmove /* some systems may have a macro */
#if HAVE_BCOPY
#define memmove(a, b, c) bcopy(b, a, c)
#else /* HAVE_BCOPY */
void *
pcre_memmove(unsigned char *dest, const unsigned char *src, size_t n)
{
int i;
dest += n;
src += n;
for (i = 0; i < n; ++i) *(--dest) = *(--src);
}
#define memmove(a, b, c) pcre_memmove(a, b, c)
#endif /* not HAVE_BCOPY */
#endif /* not HAVE_MEMMOVE */
#endif /* not VPCOMPAT */
/* PCRE keeps offsets in its compiled code as 2-byte quantities by default.
These are used, for example, to link from the start of a subpattern to its
alternatives and its end. The use of 2 bytes per offset limits the size of the
compiled regex to around 64K, which is big enough for almost everybody.
However, I received a request for an even bigger limit. For this reason, and
also to make the code easier to maintain, the storing and loading of offsets
from the byte string is now handled by the macros that are defined here.
The macros are controlled by the value of LINK_SIZE. This defaults to 2 in
the config.h file, but can be overridden by using -D on the command line. This
is automated on Unix systems via the "configure" command. */
#if LINK_SIZE == 2
#define PUT(a,n,d) \
(a[n] = (d) >> 8), \
(a[(n)+1] = (d) & 255)
#define GET(a,n) \
(((a)[n] << 8) | (a)[(n)+1])
#define MAX_PATTERN_SIZE (1 << 16)
#elif LINK_SIZE == 3
#define PUT(a,n,d) \
(a[n] = (d) >> 16), \
(a[(n)+1] = (d) >> 8), \
(a[(n)+2] = (d) & 255)
#define GET(a,n) \
(((a)[n] << 16) | ((a)[(n)+1] << 8) | (a)[(n)+2])
#define MAX_PATTERN_SIZE (1 << 24)
#elif LINK_SIZE == 4
#define PUT(a,n,d) \
(a[n] = (d) >> 24), \
(a[(n)+1] = (d) >> 16), \
(a[(n)+2] = (d) >> 8), \
(a[(n)+3] = (d) & 255)
#define GET(a,n) \
(((a)[n] << 24) | ((a)[(n)+1] << 16) | ((a)[(n)+2] << 8) | (a)[(n)+3])
#define MAX_PATTERN_SIZE (1 << 30) /* Keep it positive */
#else
#error LINK_SIZE must be either 2, 3, or 4
#endif
/* Convenience macro defined in terms of the others */
#define PUTINC(a,n,d) PUT(a,n,d), a += LINK_SIZE
/* PCRE uses some other 2-byte quantities that do not change when the size of
offsets changes. There are used for repeat counts and for other things such as
capturing parenthesis numbers in back references. */
#define PUT2(a,n,d) \
a[n] = (d) >> 8; \
a[(n)+1] = (d) & 255
#define GET2(a,n) \
(((a)[n] << 8) | (a)[(n)+1])
#define PUT2INC(a,n,d) PUT2(a,n,d), a += 2
/* In case there is no definition of offsetof() provided - though any proper
Standard C system should have one. */
#ifndef offsetof
#define offsetof(p_type,field) ((size_t)&(((p_type *)0)->field))
#endif
/* These are the public options that can change during matching. */
#define PCRE_IMS (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL)
/* Private options flags start at the most significant end of the four bytes,
but skip the top bit so we can use ints for convenience without getting tangled
with negative values. The public options defined in pcre.h start at the least
significant end. Make sure they don't overlap, though now that we have expanded
to four bytes there is plenty of space. */
#define PCRE_FIRSTSET 0x40000000 /* first_byte is set */
#define PCRE_REQCHSET 0x20000000 /* req_byte is set */
#define PCRE_STARTLINE 0x10000000 /* start after \n for multiline */
#define PCRE_ICHANGED 0x08000000 /* i option changes within regex */
/* Options for the "extra" block produced by pcre_study(). */
#define PCRE_STUDY_MAPPED 0x01 /* a map of starting chars exists */
/* Masks for identifying the public options which are permitted at compile
time, run time or study time, respectively. */
#define PUBLIC_OPTIONS \
(PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \
PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_UNGREEDY|PCRE_UTF8| \
PCRE_NO_AUTO_CAPTURE|PCRE_NO_UTF8_CHECK)
#define PUBLIC_EXEC_OPTIONS \
(PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK)
#define PUBLIC_STUDY_OPTIONS 0 /* None defined */
/* Magic number to provide a small check against being handed junk. */
#define MAGIC_NUMBER 0x50435245UL /* 'PCRE' */
/* Negative values for the firstchar and reqchar variables */
#define REQ_UNSET (-2)
#define REQ_NONE (-1)
/* Flags added to firstbyte or reqbyte; a "non-literal" item is either a
variable-length repeat, or a anything other than literal characters. */
#define REQ_CASELESS 0x0100 /* indicates caselessness */
#define REQ_VARY 0x0200 /* reqbyte followed non-literal item */
/* Miscellaneous definitions */
typedef int BOOL;
#define FALSE 0
#define TRUE 1
/* Escape items that are just an encoding of a particular data value. Note that
ESC_n is defined as yet another macro, which is set in config.h to either \n
(the default) or \r (which some people want). */
#ifndef ESC_e
#define ESC_e 27
#endif
#ifndef ESC_f
#define ESC_f '\f'
#endif
#ifndef ESC_n
#define ESC_n NEWLINE
#endif
#ifndef ESC_r
#define ESC_r '\r'
#endif
/* We can't officially use ESC_t because it is a POSIX reserved identifier
(presumably because of all the others like size_t). */
#ifndef ESC_tee
#define ESC_tee '\t'
#endif
/* These are escaped items that aren't just an encoding of a particular data
value such as \n. They must have non-zero values, as check_escape() returns
their negation. Also, they must appear in the same order as in the opcode
definitions below, up to ESC_z. There's a dummy for OP_ANY because it
corresponds to "." rather than an escape sequence. The final one must be
ESC_REF as subsequent values are used for \1, \2, \3, etc. There is are two
tests in the code for an escape greater than ESC_b and less than ESC_Z to
detect the types that may be repeated. These are the types that consume a
character. If any new escapes are put in between that don't consume a
character, that code will have to change. */
enum { ESC_A = 1, ESC_G, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s, ESC_W,
ESC_w, ESC_dum1, ESC_C, ESC_Z, ESC_z, ESC_E, ESC_Q, ESC_REF };
/* Flag bits and data types for the extended class (OP_XCLASS) for classes that
contain UTF-8 characters with values greater than 255. */
#define XCL_NOT 0x01 /* Flag: this is a negative class */
#define XCL_MAP 0x02 /* Flag: a 32-byte map is present */
#define XCL_END 0 /* Marks end of individual items */
#define XCL_SINGLE 1 /* Single item (one multibyte char) follows */
#define XCL_RANGE 2 /* A range (two multibyte chars) follows */
/* Opcode table: OP_BRA must be last, as all values >= it are used for brackets
that extract substrings. Starting from 1 (i.e. after OP_END), the values up to
OP_EOD must correspond in order to the list of escapes immediately above.
Note that whenever this list is updated, the two macro definitions that follow
must also be updated to match. */
enum {
OP_END, /* 0 End of pattern */
/* Values corresponding to backslashed metacharacters */
OP_SOD, /* 1 Start of data: \A */
OP_SOM, /* 2 Start of match (subject + offset): \G */
OP_NOT_WORD_BOUNDARY, /* 3 \B */
OP_WORD_BOUNDARY, /* 4 \b */
OP_NOT_DIGIT, /* 5 \D */
OP_DIGIT, /* 6 \d */
OP_NOT_WHITESPACE, /* 7 \S */
OP_WHITESPACE, /* 8 \s */
OP_NOT_WORDCHAR, /* 9 \W */
OP_WORDCHAR, /* 10 \w */
OP_ANY, /* 11 Match any character */
OP_ANYBYTE, /* 12 Match any byte (\C); different to OP_ANY for UTF-8 */
OP_EODN, /* 13 End of data or \n at end of data: \Z. */
OP_EOD, /* 14 End of data: \z */
OP_OPT, /* 15 Set runtime options */
OP_CIRC, /* 16 Start of line - varies with multiline switch */
OP_DOLL, /* 17 End of line - varies with multiline switch */
OP_CHARS, /* 18 Match string of characters */
OP_NOT, /* 19 Match anything but the following char */
OP_STAR, /* 20 The maximizing and minimizing versions of */
OP_MINSTAR, /* 21 all these opcodes must come in pairs, with */
OP_PLUS, /* 22 the minimizing one second. */
OP_MINPLUS, /* 23 This first set applies to single characters */
OP_QUERY, /* 24 */
OP_MINQUERY, /* 25 */
OP_UPTO, /* 26 From 0 to n matches */
OP_MINUPTO, /* 27 */
OP_EXACT, /* 28 Exactly n matches */
OP_NOTSTAR, /* 29 The maximizing and minimizing versions of */
OP_NOTMINSTAR, /* 30 all these opcodes must come in pairs, with */
OP_NOTPLUS, /* 31 the minimizing one second. */
OP_NOTMINPLUS, /* 32 This set applies to "not" single characters */
OP_NOTQUERY, /* 33 */
OP_NOTMINQUERY, /* 34 */
OP_NOTUPTO, /* 35 From 0 to n matches */
OP_NOTMINUPTO, /* 36 */
OP_NOTEXACT, /* 37 Exactly n matches */
OP_TYPESTAR, /* 38 The maximizing and minimizing versions of */
OP_TYPEMINSTAR, /* 39 all these opcodes must come in pairs, with */
OP_TYPEPLUS, /* 40 the minimizing one second. These codes must */
OP_TYPEMINPLUS, /* 41 be in exactly the same order as those above. */
OP_TYPEQUERY, /* 42 This set applies to character types such as \d */
OP_TYPEMINQUERY, /* 43 */
OP_TYPEUPTO, /* 44 From 0 to n matches */
OP_TYPEMINUPTO, /* 45 */
OP_TYPEEXACT, /* 46 Exactly n matches */
OP_CRSTAR, /* 47 The maximizing and minimizing versions of */
OP_CRMINSTAR, /* 48 all these opcodes must come in pairs, with */
OP_CRPLUS, /* 49 the minimizing one second. These codes must */
OP_CRMINPLUS, /* 50 be in exactly the same order as those above. */
OP_CRQUERY, /* 51 These are for character classes and back refs */
OP_CRMINQUERY, /* 52 */
OP_CRRANGE, /* 53 These are different to the three seta above. */
OP_CRMINRANGE, /* 54 */
OP_CLASS, /* 55 Match a character class, chars < 256 only */
OP_NCLASS, /* 56 Same, but the bitmap was created from a negative
class - the difference is relevant only when a UTF-8
character > 255 is encountered. */
OP_XCLASS, /* 57 Extended class for handling UTF-8 chars within the
class. This does both positive and negative. */
OP_REF, /* 58 Match a back reference */
OP_RECURSE, /* 59 Match a numbered subpattern (possibly recursive) */
OP_CALLOUT, /* 60 Call out to external function if provided */
OP_ALT, /* 61 Start of alternation */
OP_KET, /* 62 End of group that doesn't have an unbounded repeat */
OP_KETRMAX, /* 63 These two must remain together and in this */
OP_KETRMIN, /* 64 order. They are for groups the repeat for ever. */
/* The assertions must come before ONCE and COND */
OP_ASSERT, /* 65 Positive lookahead */
OP_ASSERT_NOT, /* 66 Negative lookahead */
OP_ASSERTBACK, /* 67 Positive lookbehind */
OP_ASSERTBACK_NOT, /* 68 Negative lookbehind */
OP_REVERSE, /* 69 Move pointer back - used in lookbehind assertions */
/* ONCE and COND must come after the assertions, with ONCE first, as there's
a test for >= ONCE for a subpattern that isn't an assertion. */
OP_ONCE, /* 70 Once matched, don't back up into the subpattern */
OP_COND, /* 71 Conditional group */
OP_CREF, /* 72 Used to hold an extraction string number (cond ref) */
OP_BRAZERO, /* 73 These two must remain together and in this */
OP_BRAMINZERO, /* 74 order. */
OP_BRANUMBER, /* 75 Used for extracting brackets whose number is greater
than can fit into an opcode. */
OP_BRA /* 76 This and greater values are used for brackets that
extract substrings up to a basic limit. After that,
use is made of OP_BRANUMBER. */
};
/* WARNING: There is an implicit assumption in study.c that all opcodes are
less than 128 in value. This makes handling UTF-8 character sequences easier.
*/
/* This macro defines textual names for all the opcodes. There are used only
for debugging, in pcre.c when DEBUG is defined, and also in pcretest.c. The
macro is referenced only in printint.c. */
#define OP_NAME_LIST \
"End", "\\A", "\\G", "\\B", "\\b", "\\D", "\\d", \
"\\S", "\\s", "\\W", "\\w", "Any", "Anybyte", "\\Z", "\\z", \
"Opt", "^", "$", "chars", "not", \
"*", "*?", "+", "+?", "?", "??", "{", "{", "{", \
"*", "*?", "+", "+?", "?", "??", "{", "{", "{", \
"*", "*?", "+", "+?", "?", "??", "{", "{", "{", \
"*", "*?", "+", "+?", "?", "??", "{", "{", \
"class", "nclass", "xclass", "Ref", "Recurse", "Callout", \
"Alt", "Ket", "KetRmax", "KetRmin", "Assert", "Assert not", \
"AssertB", "AssertB not", "Reverse", "Once", "Cond", "Cond ref",\
"Brazero", "Braminzero", "Branumber", "Bra"
/* This macro defines the length of fixed length operations in the compiled
regex. The lengths are used when searching for specific things, and also in the
debugging printing of a compiled regex. We use a macro so that it can be
incorporated both into pcre.c and pcretest.c without being publicly exposed.
As things have been extended, some of these are no longer fixed lenths, but are
minima instead. For example, the length of a single-character repeat may vary
in UTF-8 mode. The code that uses this table must know about such things. */
#define OP_LENGTHS \
1, /* End */ \
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* \A, \G, \B, \B, \D, \d, \S, \s, \W, \w */ \
1, 1, 1, 1, 2, 1, 1, /* Any, Anybyte, \Z, \z, Opt, ^, $ */ \
2, /* Chars - the minimum length */ \
2, /* not */ \
/* Positive single-char repeats ** These are */ \
2, 2, 2, 2, 2, 2, /* *, *?, +, +?, ?, ?? ** minima in */ \
4, 4, 4, /* upto, minupto, exact ** UTF-8 mode */ \
/* Negative single-char repeats - only for chars < 256 */ \
2, 2, 2, 2, 2, 2, /* NOT *, *?, +, +?, ?, ?? */ \
4, 4, 4, /* NOT upto, minupto, exact */ \
/* Positive type repeats */ \
2, 2, 2, 2, 2, 2, /* Type *, *?, +, +?, ?, ?? */ \
4, 4, 4, /* Type upto, minupto, exact */ \
/* Character class & ref repeats */ \
1, 1, 1, 1, 1, 1, /* *, *?, +, +?, ?, ?? */ \
5, 5, /* CRRANGE, CRMINRANGE */ \
33, /* CLASS */ \
33, /* NCLASS */ \
0, /* XCLASS - variable length */ \
3, /* REF */ \
1+LINK_SIZE, /* RECURSE */ \
2, /* CALLOUT */ \
1+LINK_SIZE, /* Alt */ \
1+LINK_SIZE, /* Ket */ \
1+LINK_SIZE, /* KetRmax */ \
1+LINK_SIZE, /* KetRmin */ \
1+LINK_SIZE, /* Assert */ \
1+LINK_SIZE, /* Assert not */ \
1+LINK_SIZE, /* Assert behind */ \
1+LINK_SIZE, /* Assert behind not */ \
1+LINK_SIZE, /* Reverse */ \
1+LINK_SIZE, /* Once */ \
1+LINK_SIZE, /* COND */ \
3, /* CREF */ \
1, 1, /* BRAZERO, BRAMINZERO */ \
3, /* BRANUMBER */ \
1+LINK_SIZE /* BRA */ \
/* The highest extraction number before we have to start using additional
bytes. (Originally PCRE didn't have support for extraction counts highter than
this number.) The value is limited by the number of opcodes left after OP_BRA,
i.e. 255 - OP_BRA. We actually set it a bit lower to leave room for additional
opcodes. */
#define EXTRACT_BASIC_MAX 150
/* A magic value for OP_CREF to indicate the "in recursion" condition. */
#define CREF_RECURSE 0xffff
/* The texts of compile-time error messages are defined as macros here so that
they can be accessed by the POSIX wrapper and converted into error codes. Yes,
I could have used error codes in the first place, but didn't feel like changing
just to accommodate the POSIX wrapper. */
#define ERR1 "\\ at end of pattern"
#define ERR2 "\\c at end of pattern"
#define ERR3 "unrecognized character follows \\"
#define ERR4 "numbers out of order in {} quantifier"
#define ERR5 "number too big in {} quantifier"
#define ERR6 "missing terminating ] for character class"
#define ERR7 "invalid escape sequence in character class"
#define ERR8 "range out of order in character class"
#define ERR9 "nothing to repeat"
#define ERR10 "operand of unlimited repeat could match the empty string"
#define ERR11 "internal error: unexpected repeat"
#define ERR12 "unrecognized character after (?"
#define ERR13 "POSIX named classes are supported only within a class"
#define ERR14 "missing )"
#define ERR15 "reference to non-existent subpattern"
#define ERR16 "erroffset passed as NULL"
#define ERR17 "unknown option bit(s) set"
#define ERR18 "missing ) after comment"
#define ERR19 "parentheses nested too deeply"
#define ERR20 "regular expression too large"
#define ERR21 "failed to get memory"
#define ERR22 "unmatched parentheses"
#define ERR23 "internal error: code overflow"
#define ERR24 "unrecognized character after (?<"
#define ERR25 "lookbehind assertion is not fixed length"
#define ERR26 "malformed number after (?("
#define ERR27 "conditional group contains more than two branches"
#define ERR28 "assertion expected after (?("
#define ERR29 "(?R or (?digits must be followed by )"
#define ERR30 "unknown POSIX class name"
#define ERR31 "POSIX collating elements are not supported"
#define ERR32 "this version of PCRE is not compiled with PCRE_UTF8 support"
#define ERR33 "spare error"
#define ERR34 "character value in \\x{...} sequence is too large"
#define ERR35 "invalid condition (?(0)"
#define ERR36 "\\C not allowed in lookbehind assertion"
#define ERR37 "PCRE does not support \\L, \\l, \\N, \\P, \\p, \\U, \\u, or \\X"
#define ERR38 "number after (?C is > 255"
#define ERR39 "closing ) for (?C expected"
#define ERR40 "recursive call could loop indefinitely"
#define ERR41 "unrecognized character after (?P"
#define ERR42 "syntax error after (?P"
#define ERR43 "two named groups have the same name"
#define ERR44 "invalid UTF-8 string"
/* All character handling must be done as unsigned characters. Otherwise there
are problems with top-bit-set characters and functions such as g_unichar_isspace().
However, we leave the interface to the outside world as char *, because that
should make things easier for callers. We define a short type for unsigned char
to save lots of typing. I tried "uchar", but it causes problems on Digital
Unix, where it is defined in sys/types, so use "uschar" instead. */
typedef unsigned char uschar;
/* The real format of the start of the pcre block; the index of names and the
code vector run on as long as necessary after the end. */
typedef struct real_pcre {
unsigned long int magic_number;
size_t size; /* Total that was malloced */
const unsigned char *tables; /* Pointer to tables */
unsigned long int options;
unsigned short int top_bracket;
unsigned short int top_backref;
unsigned short int first_byte;
unsigned short int req_byte;
unsigned short int name_entry_size; /* Size of any name items; 0 => none */
unsigned short int name_count; /* Number of name items */
} real_pcre;
/* The format of the block used to store data from pcre_study(). */
typedef struct pcre_study_data {
size_t size; /* Total that was malloced */
uschar options;
uschar start_bits[32];
} pcre_study_data;
/* Structure for passing "static" information around between the functions
doing the compiling, so that they are thread-safe. */
typedef struct compile_data {
const uschar *lcc; /* Points to lower casing table */
const uschar *fcc; /* Points to case-flipping table */
const uschar *cbits; /* Points to character type table */
const uschar *ctypes; /* Points to table of type maps */
const uschar *start_code; /* The start of the compiled code */
uschar *name_table; /* The name/number table */
int names_found; /* Number of entries so far */
int name_entry_size; /* Size of each entry */
int top_backref; /* Maximum back reference */
unsigned int backref_map; /* Bitmap of low back refs */
int req_varyopt; /* "After variable item" flag for reqbyte */
} compile_data;
/* Structure for maintaining a chain of pointers to the currently incomplete
branches, for testing for left recursion. */
typedef struct branch_chain {
struct branch_chain *outer;
uschar *current;
} branch_chain;
/* Structure for items in a linked list that represents an explicit recursive
call within the pattern. */
typedef struct recursion_info {
struct recursion_info *prevrec; /* Previous recursion record (or NULL) */
int group_num; /* Number of group that was called */
const uschar *after_call; /* "Return value": points after the call in the expr */
const uschar *save_start; /* Old value of md->start_match */
int *offset_save; /* Pointer to start of saved offsets */
int saved_max; /* Number of saved offsets */
} recursion_info;
/* When compiling in a mode that doesn't use recursive calls to match(),
a structure is used to remember local variables on the heap. It is defined in
pcre.c, close to the match() function, so that it is easy to keep it in step
with any changes of local variable. However, the pointer to the current frame
must be saved in some "static" place over a longjmp(). We declare the
structure here so that we can put a pointer in the match_data structure.
NOTE: This isn't used for a "normal" compilation of pcre. */
struct heapframe;
/* Structure for passing "static" information around between the functions
doing the matching, so that they are thread-safe. */
typedef struct match_data {
unsigned long int match_call_count; /* As it says */
unsigned long int match_limit;/* As it says */
int *offset_vector; /* Offset vector */
int offset_end; /* One past the end */
int offset_max; /* The maximum usable for return data */
const uschar *lcc; /* Points to lower casing table */
const uschar *ctypes; /* Points to table of type maps */
BOOL offset_overflow; /* Set if too many extractions */
BOOL notbol; /* NOTBOL flag */
BOOL noteol; /* NOTEOL flag */
BOOL utf8; /* UTF8 flag */
BOOL endonly; /* Dollar not before final \n */
BOOL notempty; /* Empty string match not wanted */
const uschar *start_code; /* For use when recursing */
const uschar *start_subject; /* Start of the subject string */
const uschar *end_subject; /* End of the subject string */
const uschar *start_match; /* Start of this match attempt */
const uschar *end_match_ptr; /* Subject position at end match */
int end_offset_top; /* Highwater mark at end of match */
int capture_last; /* Most recent capture number */
int start_offset; /* The start offset value */
recursion_info *recursive; /* Linked list of recursion data */
void *callout_data; /* To pass back to callouts */
struct heapframe *thisframe; /* Used only when compiling for no recursion */
} match_data;
/* Bit definitions for entries in the pcre_ctypes table. */
#define ctype_space 0x01
#define ctype_letter 0x02
#define ctype_digit 0x04
#define ctype_xdigit 0x08
#define ctype_word 0x10 /* alphameric or '_' */
#define ctype_meta 0x80 /* regexp meta char or zero (end pattern) */
/* Offsets for the bitmap tables in pcre_cbits. Each table contains a set
of bits for a class map. Some classes are built by combining these tables. */
#define cbit_space 0 /* [:space:] or \s */
#define cbit_xdigit 32 /* [:xdigit:] */
#define cbit_digit 64 /* [:digit:] or \d */
#define cbit_upper 96 /* [:upper:] */
#define cbit_lower 128 /* [:lower:] */
#define cbit_word 160 /* [:word:] or \w */
#define cbit_graph 192 /* [:graph:] */
#define cbit_print 224 /* [:print:] */
#define cbit_punct 256 /* [:punct:] */
#define cbit_cntrl 288 /* [:cntrl:] */
#define cbit_length 320 /* Length of the cbits table */
/* Offsets of the various tables from the base tables pointer, and
total length. */
#define lcc_offset 0
#define fcc_offset 256
#define cbits_offset 512
#define ctypes_offset (cbits_offset + cbit_length)
#define tables_length (ctypes_offset + 256)
/* End of internal.h */

View File

@@ -0,0 +1,146 @@
/* File import from pcre to goffice by import-pcre. Do not edit. */
/* This file has been programatically changed. */
/* This makes the following file fall under GPL license, see below. */
/*************************************************
* Perl-Compatible Regular Expressions *
*************************************************/
/*
PCRE is a library of functions to support regular expressions whose syntax
and semantics are as close as possible to those of the Perl 5 language.
Written by: Philip Hazel <ph10@cam.ac.uk>
Copyright (c) 1997-2003 University of Cambridge
-----------------------------------------------------------------------------
Permission is granted to anyone to use this software for any purpose on any
computer system, and to redistribute it freely, subject to the following
restrictions:
1. This software is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
2. The origin of this software must not be misrepresented, either by
explicit claim or by omission.
3. Altered versions must be plainly marked as such, and must not be
misrepresented as being the original software.
4. If PCRE is embedded in any software that is released under the GNU
General Purpose Licence (GPL), then the terms of that licence shall
supersede any condition above with which it is incompatible.
-----------------------------------------------------------------------------
See the file Tech.Notes for some information on the internals.
*/
/* This file is compiled on its own as part of the PCRE library. However,
it is also included in the compilation of dftables.c, in which case the macro
DFTABLES is defined. */
#ifndef DFTABLES
#include "internal.h"
#include <glib.h>
#endif
/*************************************************
* Create PCRE character tables *
*************************************************/
/* This function builds a set of character tables for use by PCRE and returns
a pointer to them. They are build using the ctype functions, and consequently
their contents will depend upon the current locale setting. When compiled as
part of the library, the store is obtained via pcre_malloc(), but when compiled
inside dftables, use malloc().
Arguments: none
Returns: pointer to the contiguous block of data
*/
const unsigned char *
pcre_maketables(void)
{
unsigned char *yield, *p;
int i;
#ifndef DFTABLES
yield = (unsigned char*)(pcre_malloc)(tables_length);
#else
yield = (unsigned char*)malloc(tables_length);
#endif
if (yield == NULL) return NULL;
p = yield;
/* First comes the lower casing table */
for (i = 0; i < 256; i++) *p++ = g_unichar_tolower(i);
/* Next the case-flipping table */
for (i = 0; i < 256; i++) *p++ = g_unichar_islower(i)? g_unichar_toupper(i) : g_unichar_tolower(i);
/* Then the character class tables. Don't try to be clever and save effort
on exclusive ones - in some locales things may be different. Note that the
table for "space" includes everything "g_unichar_isspace" gives, including VT in the
default locale. This makes it work for the POSIX class [:space:]. */
memset(p, 0, cbit_length);
for (i = 0; i < 256; i++)
{
if (g_unichar_isdigit(i))
{
p[cbit_digit + i/8] |= 1 << (i&7);
p[cbit_word + i/8] |= 1 << (i&7);
}
if (g_unichar_isupper(i))
{
p[cbit_upper + i/8] |= 1 << (i&7);
p[cbit_word + i/8] |= 1 << (i&7);
}
if (g_unichar_islower(i))
{
p[cbit_lower + i/8] |= 1 << (i&7);
p[cbit_word + i/8] |= 1 << (i&7);
}
if (i == '_') p[cbit_word + i/8] |= 1 << (i&7);
if (g_unichar_isspace(i)) p[cbit_space + i/8] |= 1 << (i&7);
if (g_unichar_isxdigit(i))p[cbit_xdigit + i/8] |= 1 << (i&7);
if (g_unichar_isgraph(i)) p[cbit_graph + i/8] |= 1 << (i&7);
if (g_unichar_isprint(i)) p[cbit_print + i/8] |= 1 << (i&7);
if (g_unichar_ispunct(i)) p[cbit_punct + i/8] |= 1 << (i&7);
if (g_unichar_iscntrl(i)) p[cbit_cntrl + i/8] |= 1 << (i&7);
}
p += cbit_length;
/* Finally, the character type table. In this, we exclude VT from the white
space chars, because Perl doesn't recognize it as such for \s and for comments
within regexes. */
for (i = 0; i < 256; i++)
{
int x = 0;
if (i != 0x0b && g_unichar_isspace(i)) x += ctype_space;
if (g_unichar_isalpha(i)) x += ctype_letter;
if (g_unichar_isdigit(i)) x += ctype_digit;
if (g_unichar_isxdigit(i)) x += ctype_xdigit;
if (g_unichar_isalnum(i) || i == '_') x += ctype_word;
/* Note: strchr includes the terminating zero in the characters it considers.
In this instance, that is ok because we want binary zero to be flagged as a
meta-character, which in this sense is any character that terminates a run
of data characters. */
if (strchr("*+?{^.$|()[", i) != 0) x += ctype_meta; *p++ = x; }
return yield;
}
/* End of maketables.c */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,198 @@
/* File import from pcre to goffice by import-pcre. Do not edit. */
/* This file has been programatically changed. */
/* This makes the following file fall under GPL license, see pcre.c. */
/*************************************************
* Perl-Compatible Regular Expressions *
*************************************************/
/* Copyright (c) 1997-2003 University of Cambridge */
#ifndef _PCRE_H
#define _PCRE_H
/* The file pcre.h is build by "configure". Do not edit it; instead
make changes to pcre.in. */
#define PCRE_MAJOR 4
#define PCRE_MINOR 5
#define PCRE_DATE 01-December-2003
/* Win32 uses DLL by default */
#ifdef _WIN32
# ifdef PCRE_DEFINITION
# ifdef DLL_EXPORT
# define PCRE_DATA_SCOPE __declspec(dllexport)
# endif
# else
# ifndef PCRE_STATIC
# define PCRE_DATA_SCOPE extern __declspec(dllimport)
# endif
# endif
#endif
#ifndef PCRE_DATA_SCOPE
# define PCRE_DATA_SCOPE extern
#endif
/* Have to include stdlib.h in order to ensure that size_t is defined;
it is needed here for malloc. */
#include <stdlib.h>
/* Allow for C++ users */
#ifdef __cplusplus
extern "C" {
#endif
/* Options */
#define PCRE_CASELESS 0x0001
#define PCRE_MULTILINE 0x0002
#define PCRE_DOTALL 0x0004
#define PCRE_EXTENDED 0x0008
#define PCRE_ANCHORED 0x0010
#define PCRE_DOLLAR_ENDONLY 0x0020
#define PCRE_EXTRA 0x0040
#define PCRE_NOTBOL 0x0080
#define PCRE_NOTEOL 0x0100
#define PCRE_UNGREEDY 0x0200
#define PCRE_NOTEMPTY 0x0400
#define PCRE_UTF8 0x0800
#define PCRE_NO_AUTO_CAPTURE 0x1000
#define PCRE_NO_UTF8_CHECK 0x2000
/* Exec-time and get/set-time error codes */
#define PCRE_ERROR_NOMATCH (-1)
#define PCRE_ERROR_NULL (-2)
#define PCRE_ERROR_BADOPTION (-3)
#define PCRE_ERROR_BADMAGIC (-4)
#define PCRE_ERROR_UNKNOWN_NODE (-5)
#define PCRE_ERROR_NOMEMORY (-6)
#define PCRE_ERROR_NOSUBSTRING (-7)
#define PCRE_ERROR_MATCHLIMIT (-8)
#define PCRE_ERROR_CALLOUT (-9) /* Never used by PCRE itself */
#define PCRE_ERROR_BADUTF8 (-10)
#define PCRE_ERROR_BADUTF8_OFFSET (-11)
/* Request types for pcre_fullinfo() */
#define PCRE_INFO_OPTIONS 0
#define PCRE_INFO_SIZE 1
#define PCRE_INFO_CAPTURECOUNT 2
#define PCRE_INFO_BACKREFMAX 3
#define PCRE_INFO_FIRSTBYTE 4
#define PCRE_INFO_FIRSTCHAR 4 /* For backwards compatibility */
#define PCRE_INFO_FIRSTTABLE 5
#define PCRE_INFO_LASTLITERAL 6
#define PCRE_INFO_NAMEENTRYSIZE 7
#define PCRE_INFO_NAMECOUNT 8
#define PCRE_INFO_NAMETABLE 9
#define PCRE_INFO_STUDYSIZE 10
/* Request types for pcre_config() */
#define PCRE_CONFIG_UTF8 0
#define PCRE_CONFIG_NEWLINE 1
#define PCRE_CONFIG_LINK_SIZE 2
#define PCRE_CONFIG_POSIX_MALLOC_THRESHOLD 3
#define PCRE_CONFIG_MATCH_LIMIT 4
#define PCRE_CONFIG_STACKRECURSE 5
/* Bit flags for the pcre_extra structure */
#define PCRE_EXTRA_STUDY_DATA 0x0001
#define PCRE_EXTRA_MATCH_LIMIT 0x0002
#define PCRE_EXTRA_CALLOUT_DATA 0x0004
/* Types */
struct real_pcre; /* declaration; the definition is private */
typedef struct real_pcre pcre;
/* The structure for passing additional data to pcre_exec(). This is defined in
such as way as to be extensible. */
typedef struct pcre_extra {
unsigned long int flags; /* Bits for which fields are set */
void *study_data; /* Opaque data from pcre_study() */
unsigned long int match_limit; /* Maximum number of calls to match() */
void *callout_data; /* Data passed back in callouts */
} pcre_extra;
/* The structure for passing out data via the pcre_callout_function. We use a
structure so that new fields can be added on the end in future versions,
without changing the API of the function, thereby allowing old clients to work
without modification. */
typedef struct pcre_callout_block {
int version; /* Identifies version of block */
/* ------------------------ Version 0 ------------------------------- */
int callout_number; /* Number compiled into pattern */
int *offset_vector; /* The offset vector */
const char *subject; /* The subject being matched */
int subject_length; /* The length of the subject */
int start_match; /* Offset to start of this match attempt */
int current_position; /* Where we currently are */
int capture_top; /* Max current capture */
int capture_last; /* Most recently closed capture */
void *callout_data; /* Data passed in with the call */
/* ------------------------------------------------------------------ */
} pcre_callout_block;
/* Indirection for store get and free functions. These can be set to
alternative malloc/free functions if required. Special ones are used in the
non-recursive case for "frames". There is also an optional callout function
that is triggered by the (?) regex item. Some magic is required for Win32 DLL;
it is null on other OS. For Virtual Pascal, these have to be different again.
*/
#ifndef VPCOMPAT
PCRE_DATA_SCOPE void *(*pcre_malloc)(size_t);
PCRE_DATA_SCOPE void (*pcre_free)(void *);
PCRE_DATA_SCOPE void *(*pcre_stack_malloc)(size_t);
PCRE_DATA_SCOPE void (*pcre_stack_free)(void *);
PCRE_DATA_SCOPE int (*pcre_callout)(pcre_callout_block *);
#else /* VPCOMPAT */
extern void *pcre_malloc(size_t);
extern void pcre_free(void *);
extern void *pcre_stack_malloc(size_t);
extern void pcre_stack_free(void *);
extern int pcre_callout(pcre_callout_block *);
#endif /* VPCOMPAT */
/* Exported PCRE functions */
extern pcre *pcre_compile(const char *, int, const char **,
int *, const unsigned char *);
extern int pcre_config(int, void *);
extern int pcre_copy_named_substring(const pcre *, const char *,
int *, int, const char *, char *, int);
extern int pcre_copy_substring(const char *, int *, int, int,
char *, int);
extern int pcre_exec(const pcre *, const pcre_extra *,
const char *, int, int, int, int *, int);
extern void pcre_free_substring(const char *);
extern void pcre_free_substring_list(const char **);
extern int pcre_fullinfo(const pcre *, const pcre_extra *, int,
void *);
extern int pcre_get_named_substring(const pcre *, const char *,
int *, int, const char *, const char **);
extern int pcre_get_stringnumber(const pcre *, const char *);
extern int pcre_get_substring(const char *, int *, int, int,
const char **);
extern int pcre_get_substring_list(const char *, int *, int,
const char ***);
extern int pcre_info(const pcre *, int *, int *);
extern const unsigned char *pcre_maketables(void);
extern pcre_extra *pcre_study(const pcre *, int, const char **);
extern const char *pcre_version(void);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* End of pcre.h */

View File

@@ -0,0 +1,310 @@
/* File import from pcre to goffice by import-pcre. Do not edit. */
/* This file has been programatically changed. */
/* This makes the following file fall under GPL license, see below. */
/*************************************************
* Perl-Compatible Regular Expressions *
*************************************************/
/*
This is a library of functions to support regular expressions whose syntax
and semantics are as close as possible to those of the Perl 5 language. See
the file Tech.Notes for some information on the internals.
This module is a wrapper that provides a POSIX API to the underlying PCRE
functions.
Written by: Philip Hazel <ph10@cam.ac.uk>
Copyright (c) 1997-2003 University of Cambridge
-----------------------------------------------------------------------------
Permission is granted to anyone to use this software for any purpose on any
computer system, and to redistribute it freely, subject to the following
restrictions:
1. This software is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
2. The origin of this software must not be misrepresented, either by
explicit claim or by omission.
3. Altered versions must be plainly marked as such, and must not be
misrepresented as being the original software.
4. If PCRE is embedded in any software that is released under the GNU
General Purpose Licence (GPL), then the terms of that licence shall
supersede any condition above with which it is incompatible.
-----------------------------------------------------------------------------
*/
#include "internal.h"
#include "pcreposix.h"
#include "stdlib.h"
/* Corresponding tables of PCRE error messages and POSIX error codes. */
static const char *const estring[] = {
ERR1, ERR2, ERR3, ERR4, ERR5, ERR6, ERR7, ERR8, ERR9, ERR10,
ERR11, ERR12, ERR13, ERR14, ERR15, ERR16, ERR17, ERR18, ERR19, ERR20,
ERR21, ERR22, ERR23, ERR24, ERR25, ERR26, ERR27, ERR29, ERR29, ERR30,
ERR31, ERR32, ERR33, ERR34, ERR35, ERR36, ERR37, ERR38, ERR39, ERR40,
ERR41, ERR42, ERR43, ERR44 };
static const int eint[] = {
REG_EESCAPE, /* "\\ at end of pattern" */
REG_EESCAPE, /* "\\c at end of pattern" */
REG_EESCAPE, /* "unrecognized character follows \\" */
REG_BADBR, /* "numbers out of order in {} quantifier" */
REG_BADBR, /* "number too big in {} quantifier" */
REG_EBRACK, /* "missing terminating ] for character class" */
REG_ECTYPE, /* "invalid escape sequence in character class" */
REG_ERANGE, /* "range out of order in character class" */
REG_BADRPT, /* "nothing to repeat" */
REG_BADRPT, /* "operand of unlimited repeat could match the empty string" */
REG_ASSERT, /* "internal error: unexpected repeat" */
REG_BADPAT, /* "unrecognized character after (?" */
REG_BADPAT, /* "POSIX named classes are supported only within a class" */
REG_EPAREN, /* "missing )" */
REG_ESUBREG, /* "reference to non-existent subpattern" */
REG_INVARG, /* "erroffset passed as NULL" */
REG_INVARG, /* "unknown option bit(s) set" */
REG_EPAREN, /* "missing ) after comment" */
REG_ESIZE, /* "parentheses nested too deeply" */
REG_ESIZE, /* "regular expression too large" */
REG_ESPACE, /* "failed to get memory" */
REG_EPAREN, /* "unmatched brackets" */
REG_ASSERT, /* "internal error: code overflow" */
REG_BADPAT, /* "unrecognized character after (?<" */
REG_BADPAT, /* "lookbehind assertion is not fixed length" */
REG_BADPAT, /* "malformed number after (?(" */
REG_BADPAT, /* "conditional group containe more than two branches" */
REG_BADPAT, /* "assertion expected after (?(" */
REG_BADPAT, /* "(?R or (?digits must be followed by )" */
REG_ECTYPE, /* "unknown POSIX class name" */
REG_BADPAT, /* "POSIX collating elements are not supported" */
REG_INVARG, /* "this version of PCRE is not compiled with PCRE_UTF8 support" */
REG_BADPAT, /* "spare error" */
REG_BADPAT, /* "character value in \x{...} sequence is too large" */
REG_BADPAT, /* "invalid condition (?(0)" */
REG_BADPAT, /* "\\C not allowed in lookbehind assertion" */
REG_EESCAPE, /* "PCRE does not support \\L, \\l, \\N, \\P, \\p, \\U, \\u, or \\X" */
REG_BADPAT, /* "number after (?C is > 255" */
REG_BADPAT, /* "closing ) for (?C expected" */
REG_BADPAT, /* "recursive call could loop indefinitely" */
REG_BADPAT, /* "unrecognized character after (?P" */
REG_BADPAT, /* "syntax error after (?P" */
REG_BADPAT, /* "two named groups have the same name" */
REG_BADPAT /* "invalid UTF-8 string" */
};
/* Table of texts corresponding to POSIX error codes */
static const char *const pstring[] = {
"", /* Dummy for value 0 */
"internal error", /* REG_ASSERT */
"invalid repeat counts in {}", /* BADBR */
"pattern error", /* BADPAT */
"? * + invalid", /* BADRPT */
"unbalanced {}", /* EBRACE */
"unbalanced []", /* EBRACK */
"collation error - not relevant", /* ECOLLATE */
"bad class", /* ECTYPE */
"bad escape sequence", /* EESCAPE */
"empty expression", /* EMPTY */
"unbalanced ()", /* EPAREN */
"bad range inside []", /* ERANGE */
"expression too big", /* ESIZE */
"failed to get memory", /* ESPACE */
"bad back reference", /* ESUBREG */
"bad argument", /* INVARG */
"match failed" /* NOMATCH */
};
/*************************************************
* Translate PCRE text code to int *
*************************************************/
/* PCRE compile-time errors are given as strings defined as macros. We can just
look them up in a table to turn them into POSIX-style error codes. */
static int
pcre_posix_error_code(const char *s)
{
size_t i;
for (i = 0; i < sizeof(estring)/sizeof(char *); i++)
if (strcmp(s, estring[i]) == 0) return eint[i];
return REG_ASSERT;
}
/*************************************************
* Translate error code to string *
*************************************************/
size_t
go_regerror(int errcode, const go_regex_t *preg, char *errbuf, size_t errbuf_size)
{
const char *message, *addmessage;
size_t length, addlength;
message = (errcode >= (int)(sizeof(pstring)/sizeof(char *)))?
"unknown error code" : pstring[errcode];
length = strlen(message) + 1;
addmessage = " at offset ";
addlength = (preg != NULL && (int)preg->re_erroffset != -1)?
strlen(addmessage) + 6 : 0;
if (errbuf_size > 0)
{
if (addlength > 0 && errbuf_size >= length + addlength)
sprintf(errbuf, "%s%s%-6d", message, addmessage, (int)preg->re_erroffset);
else
{
strncpy(errbuf, message, errbuf_size - 1);
errbuf[errbuf_size-1] = 0;
}
}
return length + addlength;
}
/*************************************************
* Free store held by a regex *
*************************************************/
void
go_regfree(go_regex_t *preg)
{
(pcre_free)(preg->re_pcre);
}
/*************************************************
* Compile a regular expression *
*************************************************/
/*
Arguments:
preg points to a structure for recording the compiled expression
pattern the pattern to compile
cflags compilation flags
Returns: 0 on success
various non-zero codes on failure
*/
int
go_regcomp(go_regex_t *preg, const char *pattern, int cflags)
{
const char *errorptr;
int erroffset;
int options = 0;
if ((cflags & REG_ICASE) != 0) options |= PCRE_CASELESS;
if ((cflags & REG_NEWLINE) != 0) options |= PCRE_MULTILINE;
preg->re_pcre = pcre_compile(pattern, options | PCRE_UTF8 | PCRE_NO_UTF8_CHECK, &errorptr, &erroffset, NULL);
preg->re_erroffset = erroffset;
if (preg->re_pcre == NULL) return pcre_posix_error_code(errorptr);
preg->re_nsub = pcre_info((const pcre *)preg->re_pcre, NULL, NULL);
return 0;
}
/*************************************************
* Match a regular expression *
*************************************************/
/* Unfortunately, PCRE requires 3 ints of working space for each captured
substring, so we have to get and release working store instead of just using
the POSIX structures as was done in earlier releases when PCRE needed only 2
ints. However, if the number of possible capturing brackets is small, use a
block of store on the stack, to reduce the use of malloc/free. The threshold is
in a macro that can be changed at configure time. */
int
go_regexec(const go_regex_t *preg, const char *string, size_t nmatch,
regmatch_t pmatch[], int eflags)
{
int rc;
int options = 0;
int *ovector = NULL;
int small_ovector[POSIX_MALLOC_THRESHOLD * 3];
BOOL allocated_ovector = FALSE;
if ((eflags & REG_NOTBOL) != 0) options |= PCRE_NOTBOL;
if ((eflags & REG_NOTEOL) != 0) options |= PCRE_NOTEOL;
((go_regex_t *)preg)->re_erroffset = (size_t)(-1); /* Only has meaning after compile */
if (nmatch > 0)
{
if (nmatch <= POSIX_MALLOC_THRESHOLD)
{
ovector = &(small_ovector[0]);
}
else
{
ovector = (int *)malloc(sizeof(int) * nmatch * 3);
if (ovector == NULL) return REG_ESPACE;
allocated_ovector = TRUE;
}
}
rc = pcre_exec((const pcre *)preg->re_pcre, NULL, string, (int)strlen(string),
0, options, ovector, nmatch * 3);
if (rc == 0) rc = nmatch; /* All captured slots were filled in */
if (rc >= 0)
{
size_t i;
for (i = 0; i < (size_t)rc; i++)
{
pmatch[i].rm_so = ovector[i*2];
pmatch[i].rm_eo = ovector[i*2+1];
}
if (allocated_ovector) free(ovector);
for (; i < nmatch; i++) pmatch[i].rm_so = pmatch[i].rm_eo = -1;
return 0;
}
else
{
if (allocated_ovector) free(ovector);
switch(rc)
{
case PCRE_ERROR_NOMATCH: return REG_NOMATCH;
case PCRE_ERROR_NULL: return REG_INVARG;
case PCRE_ERROR_BADOPTION: return REG_INVARG;
case PCRE_ERROR_BADMAGIC: return REG_INVARG;
case PCRE_ERROR_UNKNOWN_NODE: return REG_ASSERT;
case PCRE_ERROR_NOMEMORY: return REG_ESPACE;
case PCRE_ERROR_MATCHLIMIT: return REG_ESPACE;
case PCRE_ERROR_BADUTF8: return REG_INVARG;
case PCRE_ERROR_BADUTF8_OFFSET: return REG_INVARG;
default: return REG_ASSERT;
}
}
}
/* End of pcreposix.c */

View File

@@ -0,0 +1,93 @@
/* File import from pcre to goffice by import-pcre. Do not edit. */
/* This file has been programatically changed. */
/* This makes the following file fall under GPL license, see pcreposix.c. */
/*************************************************
* Perl-Compatible Regular Expressions *
*************************************************/
/* Copyright (c) 1997-2003 University of Cambridge */
#ifndef _PCREPOSIX_H
#define _PCREPOSIX_H
/* This is the header for the POSIX wrapper interface to the PCRE Perl-
Compatible Regular Expression library. It defines the things POSIX says should
be there. I hope. */
/* Have to include stdlib.h in order to ensure that size_t is defined. */
#include <stdlib.h>
/* Allow for C++ users */
#ifdef __cplusplus
extern "C" {
#endif
/* Options defined by POSIX. */
#define REG_ICASE 0x01
#define REG_NEWLINE 0x02
#define REG_NOTBOL 0x04
#define REG_NOTEOL 0x08
/* These are not used by PCRE, but by defining them we make it easier
to slot PCRE into existing programs that make POSIX calls. */
#define REG_EXTENDED 0
#define REG_NOSUB 0
/* Error values. Not all these are relevant or used by the wrapper. */
enum {
REG_ASSERT = 1, /* internal error ? */
REG_BADBR, /* invalid repeat counts in {} */
REG_BADPAT, /* pattern error */
REG_BADRPT, /* ? * + invalid */
REG_EBRACE, /* unbalanced {} */
REG_EBRACK, /* unbalanced [] */
REG_ECOLLATE, /* collation error - not relevant */
REG_ECTYPE, /* bad class */
REG_EESCAPE, /* bad escape sequence */
REG_EMPTY, /* empty expression */
REG_EPAREN, /* unbalanced () */
REG_ERANGE, /* bad range inside [] */
REG_ESIZE, /* expression too big */
REG_ESPACE, /* failed to get memory */
REG_ESUBREG, /* bad back reference */
REG_INVARG, /* bad argument */
REG_NOMATCH /* match failed */
};
/* The structure representing a compiled regular expression. */
typedef struct {
void *re_pcre;
size_t re_nsub;
size_t re_erroffset;
} go_regex_t;
/* The structure in which a captured offset is returned. */
typedef int go_regoff_t;
typedef struct {
go_regoff_t rm_so;
go_regoff_t rm_eo;
} regmatch_t;
/* The functions */
extern int go_regcomp(go_regex_t *, const char *, int);
extern int go_regexec(const go_regex_t *, const char *, size_t, regmatch_t *, int);
extern size_t go_regerror(int, const go_regex_t *, char *, size_t);
extern void go_regfree(go_regex_t *);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* End of pcreposix.h */

View File

@@ -0,0 +1,365 @@
/* File import from pcre to goffice by import-pcre. Do not edit. */
/* This file has been programatically changed. */
/* This makes the following file fall under GPL license, see below. */
/*************************************************
* Perl-Compatible Regular Expressions *
*************************************************/
/*
This is a library of functions to support regular expressions whose syntax
and semantics are as close as possible to those of the Perl 5 language. See
the file Tech.Notes for some information on the internals.
Written by: Philip Hazel <ph10@cam.ac.uk>
Copyright (c) 1997-2003 University of Cambridge
-----------------------------------------------------------------------------
Permission is granted to anyone to use this software for any purpose on any
computer system, and to redistribute it freely, subject to the following
restrictions:
1. This software is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
2. The origin of this software must not be misrepresented, either by
explicit claim or by omission.
3. Altered versions must be plainly marked as such, and must not be
misrepresented as being the original software.
4. If PCRE is embedded in any software that is released under the GNU
General Purpose Licence (GPL), then the terms of that licence shall
supersede any condition above with which it is incompatible.
-----------------------------------------------------------------------------
*/
/* This module contains a debugging function for printing out the internal form
of a compiled regular expression. It is kept in a separate file so that it can
be #included both in the pcretest program, and in the library itself when
compiled with the debugging switch. */
static const char *OP_names[] = { OP_NAME_LIST };
/*************************************************
* Print single- or multi-byte character *
*************************************************/
/* These tables are actually copies of ones in pcre.c. If we compile the
library with debugging, they are included twice, but that isn't really a
problem - compiling with debugging is pretty rare and these are very small. */
static const int utf8_t3[] = { 0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01};
static const uschar utf8_t4[] = {
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 };
static int
print_char(FILE *f, uschar *ptr, BOOL utf8)
{
int c = *ptr;
if (!utf8 || (c & 0xc0) != 0xc0)
{
if (g_unichar_isprint(c)) fprintf(f, "%c", c); else fprintf(f, "\\x%02x", c);
return 0;
}
else
{
int i;
int a = utf8_t4[c & 0x3f]; /* Number of additional bytes */
int s = 6*a;
c = (c & utf8_t3[a]) << s;
for (i = 1; i <= a; i++)
{
s -= 6;
c |= (ptr[i] & 0x3f) << s;
}
if (c < 128) fprintf(f, "\\x%02x", c); else fprintf(f, "\\x{%x}", c);
return a;
}
}
/*************************************************
* Print compiled regex *
*************************************************/
static void
print_internals(pcre *external_re, FILE *f)
{
real_pcre *re = (real_pcre *)external_re;
uschar *codestart =
(uschar *)re + sizeof(real_pcre) + re->name_count * re->name_entry_size;
uschar *code = codestart;
BOOL utf8 = (re->options & PCRE_UTF8) != 0;
for(;;)
{
uschar *ccode;
int c;
int extra = 0;
fprintf(f, "%3d ", code - codestart);
if (*code >= OP_BRA)
{
if (*code - OP_BRA > EXTRACT_BASIC_MAX)
fprintf(f, "%3d Bra extra\n", GET(code, 1));
else
fprintf(f, "%3d Bra %d\n", GET(code, 1), *code - OP_BRA);
code += OP_lengths[OP_BRA];
continue;
}
switch(*code)
{
case OP_END:
fprintf(f, " %s\n", OP_names[*code]);
fprintf(f, "------------------------------------------------------------------\n");
return;
case OP_OPT:
fprintf(f, " %.2x %s", code[1], OP_names[*code]);
break;
case OP_CHARS:
{
int charlength = code[1];
ccode = code + 2;
extra = charlength;
fprintf(f, "%3d ", charlength);
while (charlength > 0)
{
int extrabytes = print_char(f, ccode, utf8);
ccode += 1 + extrabytes;
charlength -= 1 + extrabytes;
}
}
break;
case OP_KETRMAX:
case OP_KETRMIN:
case OP_ALT:
case OP_KET:
case OP_ASSERT:
case OP_ASSERT_NOT:
case OP_ASSERTBACK:
case OP_ASSERTBACK_NOT:
case OP_ONCE:
case OP_COND:
case OP_REVERSE:
fprintf(f, "%3d %s", GET(code, 1), OP_names[*code]);
break;
case OP_BRANUMBER:
printf("%3d %s", GET2(code, 1), OP_names[*code]);
break;
case OP_CREF:
if (GET2(code, 1) == CREF_RECURSE)
fprintf(f, " Cond recurse");
else
fprintf(f, "%3d %s", GET2(code,1), OP_names[*code]);
break;
case OP_STAR:
case OP_MINSTAR:
case OP_PLUS:
case OP_MINPLUS:
case OP_QUERY:
case OP_MINQUERY:
case OP_TYPESTAR:
case OP_TYPEMINSTAR:
case OP_TYPEPLUS:
case OP_TYPEMINPLUS:
case OP_TYPEQUERY:
case OP_TYPEMINQUERY:
fprintf(f, " ");
if (*code >= OP_TYPESTAR) fprintf(f, "%s", OP_names[code[1]]);
else extra = print_char(f, code+1, utf8);
fprintf(f, "%s", OP_names[*code]);
break;
case OP_EXACT:
case OP_UPTO:
case OP_MINUPTO:
fprintf(f, " ");
extra = print_char(f, code+3, utf8);
fprintf(f, "{");
if (*code != OP_EXACT) fprintf(f, ",");
fprintf(f, "%d}", GET2(code,1));
if (*code == OP_MINUPTO) fprintf(f, "?");
break;
case OP_TYPEEXACT:
case OP_TYPEUPTO:
case OP_TYPEMINUPTO:
fprintf(f, " %s{", OP_names[code[3]]);
if (*code != OP_TYPEEXACT) fprintf(f, "0,");
fprintf(f, "%d}", GET2(code,1));
if (*code == OP_TYPEMINUPTO) fprintf(f, "?");
break;
case OP_NOT:
if (g_unichar_isprint(c = code[1])) fprintf(f, " [^%c]", c);
else fprintf(f, " [^\\x%02x]", c);
break;
case OP_NOTSTAR:
case OP_NOTMINSTAR:
case OP_NOTPLUS:
case OP_NOTMINPLUS:
case OP_NOTQUERY:
case OP_NOTMINQUERY:
if (g_unichar_isprint(c = code[1])) fprintf(f, " [^%c]", c);
else fprintf(f, " [^\\x%02x]", c);
fprintf(f, "%s", OP_names[*code]);
break;
case OP_NOTEXACT:
case OP_NOTUPTO:
case OP_NOTMINUPTO:
if (g_unichar_isprint(c = code[3])) fprintf(f, " [^%c]{", c);
else fprintf(f, " [^\\x%02x]{", c);
if (*code != OP_NOTEXACT) fprintf(f, ",");
fprintf(f, "%d}", GET2(code,1));
if (*code == OP_NOTMINUPTO) fprintf(f, "?");
break;
case OP_RECURSE:
fprintf(f, "%3d %s", GET(code, 1), OP_names[*code]);
break;
case OP_REF:
fprintf(f, " \\%d", GET2(code,1));
ccode = code + OP_lengths[*code];
goto CLASS_REF_REPEAT;
case OP_CALLOUT:
fprintf(f, " %s %d", OP_names[*code], code[1]);
break;
/* OP_XCLASS can only occur in UTF-8 mode. However, there's no harm in
having this code always here, and it makes it less messy without all those
#ifdefs. */
case OP_CLASS:
case OP_NCLASS:
case OP_XCLASS:
{
int i, min, max;
BOOL printmap;
fprintf(f, " [");
if (*code == OP_XCLASS)
{
extra = GET(code, 1);
ccode = code + LINK_SIZE + 1;
printmap = (*ccode & XCL_MAP) != 0;
if ((*ccode++ & XCL_NOT) != 0) fprintf(f, "^");
}
else
{
printmap = TRUE;
ccode = code + 1;
}
/* Print a bit map */
if (printmap)
{
for (i = 0; i < 256; i++)
{
if ((ccode[i/8] & (1 << (i&7))) != 0)
{
int j;
for (j = i+1; j < 256; j++)
if ((ccode[j/8] & (1 << (j&7))) == 0) break;
if (i == '-' || i == ']') fprintf(f, "\\");
if (g_unichar_isprint(i)) fprintf(f, "%c", i); else fprintf(f, "\\x%02x", i);
if (--j > i)
{
fprintf(f, "-");
if (j == '-' || j == ']') fprintf(f, "\\");
if (g_unichar_isprint(j)) fprintf(f, "%c", j); else fprintf(f, "\\x%02x", j);
}
i = j;
}
}
ccode += 32;
}
/* For an XCLASS there is always some additional data */
if (*code == OP_XCLASS)
{
int ch;
while ((ch = *ccode++) != XCL_END)
{
ccode += 1 + print_char(f, ccode, TRUE);
if (ch == XCL_RANGE)
{
fprintf(f, "-");
ccode += 1 + print_char(f, ccode, TRUE);
}
}
}
/* Indicate a non-UTF8 class which was created by negation */
fprintf(f, "]%s", (*code == OP_NCLASS)? " (neg)" : "");
/* Handle repeats after a class or a back reference */
CLASS_REF_REPEAT:
switch(*ccode)
{
case OP_CRSTAR:
case OP_CRMINSTAR:
case OP_CRPLUS:
case OP_CRMINPLUS:
case OP_CRQUERY:
case OP_CRMINQUERY:
fprintf(f, "%s", OP_names[*ccode]);
extra = OP_lengths[*ccode];
break;
case OP_CRRANGE:
case OP_CRMINRANGE:
min = GET2(ccode,1);
max = GET2(ccode,3);
if (max == 0) fprintf(f, "{%d,}", min);
else fprintf(f, "{%d,%d}", min, max);
if (*ccode == OP_CRMINRANGE) fprintf(f, "?");
extra = OP_lengths[*ccode];
break;
}
}
break;
/* Anything else is just an item with no data*/
default:
fprintf(f, " %s", OP_names[*code]);
break;
}
code += OP_lengths[*code] + extra;
fprintf(f, "\n");
}
}
/* End of printint.c */

View File

@@ -0,0 +1,477 @@
/* File import from pcre to goffice by import-pcre. Do not edit. */
/* This file has been programatically changed. */
/* This makes the following file fall under GPL license, see below. */
/*************************************************
* Perl-Compatible Regular Expressions *
*************************************************/
/*
This is a library of functions to support regular expressions whose syntax
and semantics are as close as possible to those of the Perl 5 language. See
the file Tech.Notes for some information on the internals.
Written by: Philip Hazel <ph10@cam.ac.uk>
Copyright (c) 1997-2003 University of Cambridge
-----------------------------------------------------------------------------
Permission is granted to anyone to use this software for any purpose on any
computer system, and to redistribute it freely, subject to the following
restrictions:
1. This software is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
2. The origin of this software must not be misrepresented, either by
explicit claim or by omission.
3. Altered versions must be plainly marked as such, and must not be
misrepresented as being the original software.
4. If PCRE is embedded in any software that is released under the GNU
General Purpose Licence (GPL), then the terms of that licence shall
supersede any condition above with which it is incompatible.
-----------------------------------------------------------------------------
*/
/* Include the internals header, which itself includes Standard C headers plus
the external pcre header. */
#include "internal.h"
/*************************************************
* Set a bit and maybe its alternate case *
*************************************************/
/* Given a character, set its bit in the table, and also the bit for the other
version of a letter if we are caseless.
Arguments:
start_bits points to the bit map
c is the character
caseless the caseless flag
cd the block with char table pointers
Returns: nothing
*/
static void
set_bit(uschar *start_bits, int c, BOOL caseless, compile_data *cd)
{
start_bits[c/8] |= (1 << (c&7));
if (caseless && (cd->ctypes[c] & ctype_letter) != 0)
start_bits[cd->fcc[c]/8] |= (1 << (cd->fcc[c]&7));
}
/*************************************************
* Create bitmap of starting chars *
*************************************************/
/* This function scans a compiled unanchored expression and attempts to build a
bitmap of the set of initial characters. If it can't, it returns FALSE. As time
goes by, we may be able to get more clever at doing this.
Arguments:
code points to an expression
start_bits points to a 32-byte table, initialized to 0
caseless the current state of the caseless flag
utf8 TRUE if in UTF-8 mode
cd the block with char table pointers
Returns: TRUE if table built, FALSE otherwise
*/
static BOOL
set_start_bits(const uschar *code, uschar *start_bits, BOOL caseless,
BOOL utf8, compile_data *cd)
{
register int c;
/* This next statement and the later reference to dummy are here in order to
trick the optimizer of the IBM C compiler for OS/2 into generating correct
code. Apparently IBM isn't going to fix the problem, and we would rather not
disable optimization (in this module it actually makes a big difference, and
the pcre module can use all the optimization it can get). */
volatile int dummy;
do
{
const uschar *tcode = code + 1 + LINK_SIZE;
BOOL try_next = TRUE;
while (try_next)
{
/* If a branch starts with a bracket or a positive lookahead assertion,
recurse to set bits from within them. That's all for this branch. */
if ((int)*tcode >= OP_BRA || *tcode == OP_ASSERT)
{
if (!set_start_bits(tcode, start_bits, caseless, utf8, cd))
return FALSE;
try_next = FALSE;
}
else switch(*tcode)
{
default:
return FALSE;
/* Skip over callout */
case OP_CALLOUT:
tcode += 2;
break;
/* Skip over extended extraction bracket number */
case OP_BRANUMBER:
tcode += 3;
break;
/* Skip over lookbehind and negative lookahead assertions */
case OP_ASSERT_NOT:
case OP_ASSERTBACK:
case OP_ASSERTBACK_NOT:
do tcode += GET(tcode, 1); while (*tcode == OP_ALT);
tcode += 1+LINK_SIZE;
break;
/* Skip over an option setting, changing the caseless flag */
case OP_OPT:
caseless = (tcode[1] & PCRE_CASELESS) != 0;
tcode += 2;
break;
/* BRAZERO does the bracket, but carries on. */
case OP_BRAZERO:
case OP_BRAMINZERO:
if (!set_start_bits(++tcode, start_bits, caseless, utf8, cd))
return FALSE;
dummy = 1;
do tcode += GET(tcode,1); while (*tcode == OP_ALT);
tcode += 1+LINK_SIZE;
break;
/* Single-char * or ? sets the bit and tries the next item */
case OP_STAR:
case OP_MINSTAR:
case OP_QUERY:
case OP_MINQUERY:
set_bit(start_bits, tcode[1], caseless, cd);
tcode += 2;
#ifdef SUPPORT_UTF8
if (1 /* utf8 */) while ((*tcode & 0xc0) == 0x80) tcode++;
#endif
break;
/* Single-char upto sets the bit and tries the next */
case OP_UPTO:
case OP_MINUPTO:
set_bit(start_bits, tcode[3], caseless, cd);
tcode += 4;
#ifdef SUPPORT_UTF8
if (1 /* utf8 */) while ((*tcode & 0xc0) == 0x80) tcode++;
#endif
break;
/* At least one single char sets the bit and stops */
case OP_EXACT: /* Fall through */
tcode++;
case OP_CHARS: /* Fall through */
tcode++;
case OP_PLUS:
case OP_MINPLUS:
set_bit(start_bits, tcode[1], caseless, cd);
try_next = FALSE;
break;
/* Single character type sets the bits and stops */
case OP_NOT_DIGIT:
for (c = 0; c < 32; c++)
start_bits[c] |= ~cd->cbits[c+cbit_digit];
try_next = FALSE;
break;
case OP_DIGIT:
for (c = 0; c < 32; c++)
start_bits[c] |= cd->cbits[c+cbit_digit];
try_next = FALSE;
break;
case OP_NOT_WHITESPACE:
for (c = 0; c < 32; c++)
start_bits[c] |= ~cd->cbits[c+cbit_space];
try_next = FALSE;
break;
case OP_WHITESPACE:
for (c = 0; c < 32; c++)
start_bits[c] |= cd->cbits[c+cbit_space];
try_next = FALSE;
break;
case OP_NOT_WORDCHAR:
for (c = 0; c < 32; c++)
start_bits[c] |= ~cd->cbits[c+cbit_word];
try_next = FALSE;
break;
case OP_WORDCHAR:
for (c = 0; c < 32; c++)
start_bits[c] |= cd->cbits[c+cbit_word];
try_next = FALSE;
break;
/* One or more character type fudges the pointer and restarts, knowing
it will hit a single character type and stop there. */
case OP_TYPEPLUS:
case OP_TYPEMINPLUS:
tcode++;
break;
case OP_TYPEEXACT:
tcode += 3;
break;
/* Zero or more repeats of character types set the bits and then
try again. */
case OP_TYPEUPTO:
case OP_TYPEMINUPTO:
tcode += 2; /* Fall through */
case OP_TYPESTAR:
case OP_TYPEMINSTAR:
case OP_TYPEQUERY:
case OP_TYPEMINQUERY:
switch(tcode[1])
{
case OP_ANY:
return FALSE;
case OP_NOT_DIGIT:
for (c = 0; c < 32; c++)
start_bits[c] |= ~cd->cbits[c+cbit_digit];
break;
case OP_DIGIT:
for (c = 0; c < 32; c++)
start_bits[c] |= cd->cbits[c+cbit_digit];
break;
case OP_NOT_WHITESPACE:
for (c = 0; c < 32; c++)
start_bits[c] |= ~cd->cbits[c+cbit_space];
break;
case OP_WHITESPACE:
for (c = 0; c < 32; c++)
start_bits[c] |= cd->cbits[c+cbit_space];
break;
case OP_NOT_WORDCHAR:
for (c = 0; c < 32; c++)
start_bits[c] |= ~cd->cbits[c+cbit_word];
break;
case OP_WORDCHAR:
for (c = 0; c < 32; c++)
start_bits[c] |= cd->cbits[c+cbit_word];
break;
}
tcode += 2;
break;
/* Character class where all the information is in a bit map: set the
bits and either carry on or not, according to the repeat count. If it was
a negative class, and we are operating with UTF-8 characters, any byte
with a value >= 0xc4 is a potentially valid starter because it starts a
character with a value > 255. */
case OP_NCLASS:
if (1 /* utf8 */)
{
start_bits[24] |= 0xf0; /* Bits for 0xc4 - 0xc8 */
memset(start_bits+25, 0xff, 7); /* Bits for 0xc9 - 0xff */
}
/* Fall through */
case OP_CLASS:
{
tcode++;
/* In UTF-8 mode, the bits in a bit map correspond to character
values, not to byte values. However, the bit map we are constructing is
for byte values. So we have to do a conversion for characters whose
value is > 127. In fact, there are only two possible starting bytes for
characters in the range 128 - 255. */
if (1 /* utf8 */)
{
for (c = 0; c < 16; c++) start_bits[c] |= tcode[c];
for (c = 128; c < 256; c++)
{
if ((tcode[c/8] && (1 << (c&7))) != 0)
{
int d = (c >> 6) | 0xc0; /* Set bit for this starter */
start_bits[d/8] |= (1 << (d&7)); /* and then skip on to the */
c = (c & 0xc0) + 0x40 - 1; /* next relevant character. */
}
}
}
/* In non-UTF-8 mode, the two bit maps are completely compatible. */
else
{
for (c = 0; c < 32; c++) start_bits[c] |= tcode[c];
}
/* Advance past the bit map, and act on what follows */
tcode += 32;
switch (*tcode)
{
case OP_CRSTAR:
case OP_CRMINSTAR:
case OP_CRQUERY:
case OP_CRMINQUERY:
tcode++;
break;
case OP_CRRANGE:
case OP_CRMINRANGE:
if (((tcode[1] << 8) + tcode[2]) == 0) tcode += 5;
else try_next = FALSE;
break;
default:
try_next = FALSE;
break;
}
}
break; /* End of bitmap class handling */
} /* End of switch */
} /* End of try_next loop */
code += GET(code, 1); /* Advance to next branch */
}
while (*code == OP_ALT);
return TRUE;
}
/*************************************************
* Study a compiled expression *
*************************************************/
/* This function is handed a compiled expression that it must study to produce
information that will speed up the matching. It returns a pcre_extra block
which then gets handed back to pcre_exec().
Arguments:
re points to the compiled expression
options contains option bits
errorptr points to where to place error messages;
set NULL unless error
Returns: pointer to a pcre_extra block, with study_data filled in and the
appropriate flag set;
NULL on error or if no optimization possible
*/
pcre_extra *
pcre_study(const pcre *external_re, int options, const char **errorptr)
{
uschar start_bits[32];
pcre_extra *extra;
pcre_study_data *study;
const real_pcre *re = (const real_pcre *)external_re;
uschar *code = (uschar *)re + sizeof(real_pcre) +
(re->name_count * re->name_entry_size);
compile_data compile_block;
*errorptr = NULL;
if (re == NULL || re->magic_number != MAGIC_NUMBER)
{
*errorptr = "argument is not a compiled regular expression";
return NULL;
}
if ((options & ~PUBLIC_STUDY_OPTIONS) != 0)
{
*errorptr = "unknown or incorrect option bit(s) set";
return NULL;
}
/* For an anchored pattern, or an unanchored pattern that has a first char, or
a multiline pattern that matches only at "line starts", no further processing
at present. */
if ((re->options & (PCRE_ANCHORED|PCRE_FIRSTSET|PCRE_STARTLINE)) != 0)
return NULL;
/* Set the character tables in the block which is passed around */
compile_block.lcc = re->tables + lcc_offset;
compile_block.fcc = re->tables + fcc_offset;
compile_block.cbits = re->tables + cbits_offset;
compile_block.ctypes = re->tables + ctypes_offset;
/* See if we can find a fixed set of initial characters for the pattern. */
memset(start_bits, 0, 32 * sizeof(uschar));
if (!set_start_bits(code, start_bits, (re->options & PCRE_CASELESS) != 0,
(re->options & PCRE_UTF8) != 0, &compile_block)) return NULL;
/* Get a pcre_extra block and a pcre_study_data block. The study data is put in
the latter, which is pointed to by the former, which may also get additional
data set later by the calling program. At the moment, the size of
pcre_study_data is fixed. We nevertheless save it in a field for returning via
the pcre_fullinfo() function so that if it becomes variable in the future, we
don't have to change that code. */
extra = (pcre_extra *)(pcre_malloc)
(sizeof(pcre_extra) + sizeof(pcre_study_data));
if (extra == NULL)
{
*errorptr = "failed to get memory";
return NULL;
}
study = (pcre_study_data *)((char *)extra + sizeof(pcre_extra));
extra->flags = PCRE_EXTRA_STUDY_DATA;
extra->study_data = study;
study->size = sizeof(pcre_study_data);
study->options = PCRE_STUDY_MAPPED;
memcpy(study->start_bits, start_bits, sizeof(start_bits));
return extra;
}
/* End of study.c */

View File

@@ -0,0 +1,11 @@
Makefile
Makefile.in
*.diff
*.diffs
*.patch
*.log
*.xac.*.xac
.deps
.libs
*.la
*.lo

View File

@@ -0,0 +1,31 @@
noinst_LTLIBRARIES = libgoffice-drawing.la
AM_CFLAGS = $(GNOME_CFLAGS) $(GSF_CFLAGS)
libgoffice_drawing_la_SOURCES = \
god-anchor.c \
god-anchor.h \
god-default-attributes.c \
god-default-attributes.h \
god-drawing-group.c \
god-drawing-group.h \
god-drawing-renderer-gdk.c \
god-drawing-renderer-gdk.h \
god-drawing-view.c \
god-drawing-view.h \
god-drawing.c \
god-drawing.h \
god-image-store.c \
god-image-store.h \
god-image.c \
god-image.h \
god-paragraph-attributes.c \
god-paragraph-attributes.h \
god-property-table.c \
god-property-table.h \
god-shape.c \
god-shape.h \
god-text-model.c \
god-text-model.h
include $(srcdir)/../goffice.mk

View File

@@ -0,0 +1,122 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* god-anchor.c: MS Office Graphic Object support
*
* Copyright (C) 2000-2002
* Jody Goldberg (jody@gnome.org)
* Michael Meeks (mmeeks@gnu.org)
* Christopher James Lahey <clahey@ximian.com>
*
* 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
*/
#include <goffice/goffice-config.h>
#include "drawing/god-anchor.h"
#include <gsf/gsf-impl-utils.h>
#include <string.h>
static GObjectClass *parent_class;
struct GodAnchorPrivate_ {
GoRect rect;
};
GodAnchor *
god_anchor_new (void)
{
GodAnchor *anchor;
anchor = g_object_new (GOD_ANCHOR_TYPE, NULL);
return anchor;
}
void
god_anchor_get_rect (GodAnchor *anchor,
GoRect *rect)
{
if (GOD_ANCHOR_GET_CLASS (anchor)->get_rect) {
GOD_ANCHOR_GET_CLASS (anchor)->get_rect (anchor, rect);
} else {
rect->top = 0;
rect->left = 0;
rect->bottom = 0;
rect->right = 0;
}
}
void
god_anchor_set_rect (GodAnchor *anchor,
const GoRect *rect)
{
if (GOD_ANCHOR_GET_CLASS (anchor)->set_rect)
GOD_ANCHOR_GET_CLASS (anchor)->set_rect (anchor, rect);
}
static void
god_anchor_init (GObject *object)
{
GodAnchor *anchor = GOD_ANCHOR (object);
anchor->priv = g_new0 (GodAnchorPrivate, 1);
anchor->priv->rect.top = 0.0;
anchor->priv->rect.left = 0.0;
anchor->priv->rect.bottom = 0.0;
anchor->priv->rect.right = 0.0;
}
static void
god_anchor_finalize (GObject *object)
{
GodAnchor *anchor = GOD_ANCHOR (object);
g_free (anchor->priv);
anchor->priv = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
real_god_anchor_get_rect (GodAnchor *anchor,
GoRect *rect)
{
*rect = anchor->priv->rect;
}
static void
real_god_anchor_set_rect (GodAnchor *anchor,
const GoRect *rect)
{
anchor->priv->rect = *rect;
}
static void
god_anchor_class_init (GodAnchorClass *class)
{
GObjectClass *object_class;
object_class = (GObjectClass *) class;
parent_class = g_type_class_peek_parent (class);
object_class->finalize = god_anchor_finalize;
class->get_rect = real_god_anchor_get_rect;
class->set_rect = real_god_anchor_set_rect;
}
GSF_CLASS (GodAnchor, god_anchor,
god_anchor_class_init, god_anchor_init,
G_TYPE_OBJECT)

View File

@@ -0,0 +1,55 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/**
* god-anchor.h: MS Office Graphic Object support
*
* Author:
* Michael Meeks (michael@ximian.com)
* Jody Goldberg (jody@gnome.org)
* Christopher James Lahey <clahey@ximian.com>
*
* (C) 1998-2003 Michael Meeks, Jody Goldberg, Chris Lahey
**/
#ifndef GOD_ANCHOR_H
#define GOD_ANCHOR_H
#include <glib-object.h>
#include <glib.h>
#include <utils/go-units.h>
G_BEGIN_DECLS
#define GOD_ANCHOR_TYPE (god_anchor_get_type ())
#define GOD_ANCHOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOD_ANCHOR_TYPE, GodAnchor))
#define GOD_ANCHOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GOD_ANCHOR_TYPE, GodAnchorClass))
#define GOD_ANCHOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GOD_ANCHOR_TYPE, GodAnchorClass))
#define IS_GOD_ANCHOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOD_ANCHOR_TYPE))
#define IS_GOD_ANCHOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GOD_ANCHOR_TYPE))
typedef struct GodAnchorPrivate_ GodAnchorPrivate;
typedef struct {
GObject parent;
GodAnchorPrivate *priv;
} GodAnchor;
typedef struct {
GObjectClass parent_class;
void (*get_rect) (GodAnchor *anchor, GoRect *rect);
void (*set_rect) (GodAnchor *anchor, const GoRect *rect);
} GodAnchorClass;
GType god_anchor_get_type (void);
GodAnchor *god_anchor_new (void);
void god_anchor_get_rect (GodAnchor *anchor,
GoRect *rect);
void god_anchor_set_rect (GodAnchor *anchor,
const GoRect *anchor_value);
G_END_DECLS
#endif /* GOD_ANCHOR_H */

View File

@@ -0,0 +1,201 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* god-default-attributes.c: MS Office Graphic Object support
*
* Copyright (C) 2000-2002
* Jody Goldberg (jody@gnome.org)
* Michael Meeks (mmeeks@gnu.org)
* Christopher James Lahey <clahey@ximian.com>
*
* 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
*/
#include <goffice/goffice-config.h>
#include "drawing/god-default-attributes.h"
#include <pango/pango-attributes.h>
#include <glib/gi18n.h>
#include <gsf/gsf-impl-utils.h>
static GObjectClass *parent_class;
struct GodDefaultAttributesPrivate_ {
GPtrArray *paragraph_attributes;
GPtrArray *pango_attributes;
};
GodDefaultAttributes *
god_default_attributes_new (void)
{
GodDefaultAttributes *default_attributes;
default_attributes = g_object_new (GOD_DEFAULT_ATTRIBUTES_TYPE, NULL);
return default_attributes;
}
void
god_default_attributes_set_paragraph_attributes (GodDefaultAttributes *attributes,
GodParagraphAttributes *paragraph_attributes)
{
god_default_attributes_set_paragraph_attributes_for_indent (attributes,
0,
paragraph_attributes);
}
void
god_default_attributes_set_paragraph_attributes_for_indent (GodDefaultAttributes *attributes,
guint indent,
GodParagraphAttributes *paragraph_attributes)
{
if (attributes->priv->paragraph_attributes == NULL)
attributes->priv->paragraph_attributes = g_ptr_array_new();
if (attributes->priv->paragraph_attributes->len <= indent)
g_ptr_array_set_size (attributes->priv->paragraph_attributes, indent + 1);
if (g_ptr_array_index (attributes->priv->paragraph_attributes, indent))
g_object_unref (g_ptr_array_index (attributes->priv->paragraph_attributes, indent));
g_ptr_array_index (attributes->priv->paragraph_attributes, indent) = paragraph_attributes;
if (paragraph_attributes)
g_object_ref (paragraph_attributes);
}
void
god_default_attributes_set_pango_attributes (GodDefaultAttributes *attributes,
GList *pango_attributes)
{
god_default_attributes_set_pango_attributes_for_indent (attributes,
0,
pango_attributes);
}
static void
add_attributes (PangoAttribute *attribute, GList **new_attributes)
{
PangoAttribute *new_attribute = pango_attribute_copy (attribute);
new_attribute->start_index = 0;
new_attribute->end_index = (guint) -1;
*new_attributes = g_list_prepend (*new_attributes, pango_attribute_copy (attribute));
}
void
god_default_attributes_set_pango_attributes_for_indent (GodDefaultAttributes *attributes,
guint indent,
GList *pango_attributes)
{
GList **pango_attributes_location;
if (attributes->priv->pango_attributes == NULL)
attributes->priv->pango_attributes = g_ptr_array_new();
if (attributes->priv->pango_attributes->len <= indent)
g_ptr_array_set_size (attributes->priv->pango_attributes, indent + 1);
pango_attributes_location = (GList **) &g_ptr_array_index (attributes->priv->pango_attributes, indent);
g_list_foreach (*pango_attributes_location, (GFunc) pango_attribute_destroy, NULL);
g_list_free (*pango_attributes_location);
*pango_attributes_location = NULL;
g_list_foreach (pango_attributes, (GFunc) add_attributes, pango_attributes_location);
*pango_attributes_location = g_list_reverse (*pango_attributes_location);
}
const GodParagraphAttributes *
god_default_attributes_get_paragraph_attributes (GodDefaultAttributes *attributes)
{
return god_default_attributes_get_paragraph_attributes_for_indent (attributes,
0);
}
const GodParagraphAttributes *
god_default_attributes_get_paragraph_attributes_for_indent (GodDefaultAttributes *attributes,
guint indent)
{
if (attributes->priv->paragraph_attributes == NULL)
return NULL;
if (attributes->priv->paragraph_attributes->len <= indent)
return NULL;
return g_ptr_array_index (attributes->priv->paragraph_attributes, indent);
}
const GList *
god_default_attributes_get_pango_attributes (GodDefaultAttributes *attributes)
{
return god_default_attributes_get_pango_attributes_for_indent (attributes,
0);
}
const GList *
god_default_attributes_get_pango_attributes_for_indent (GodDefaultAttributes *attributes,
guint indent)
{
if (attributes->priv->pango_attributes == NULL)
return NULL;
if (attributes->priv->pango_attributes->len <= indent)
return NULL;
return g_ptr_array_index (attributes->priv->pango_attributes, indent);
}
static void
god_default_attributes_init (GObject *object)
{
GodDefaultAttributes *default_attributes = GOD_DEFAULT_ATTRIBUTES (object);
default_attributes->priv = g_new0 (GodDefaultAttributesPrivate, 1);
default_attributes->priv->paragraph_attributes = NULL;
default_attributes->priv->pango_attributes = NULL;
}
static void
maybe_unref (gpointer data, gpointer user_data)
{
if (data)
g_object_unref (data);
}
static void
free_list (gpointer data, gpointer user_data)
{
g_list_foreach (data, (GFunc) pango_attribute_destroy, NULL);
}
static void
god_default_attributes_finalize (GObject *object)
{
GodDefaultAttributes *default_attributes = GOD_DEFAULT_ATTRIBUTES (object);
g_ptr_array_foreach (default_attributes->priv->paragraph_attributes, maybe_unref, NULL);
g_ptr_array_foreach (default_attributes->priv->pango_attributes, free_list, NULL);
g_ptr_array_free (default_attributes->priv->paragraph_attributes, TRUE);
g_ptr_array_free (default_attributes->priv->pango_attributes, TRUE);
g_free (default_attributes->priv);
default_attributes->priv = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
god_default_attributes_class_init (GodDefaultAttributesClass *class)
{
GObjectClass *object_class;
object_class = (GObjectClass *) class;
parent_class = g_type_class_peek_parent (class);
object_class->finalize = god_default_attributes_finalize;
}
GSF_CLASS (GodDefaultAttributes, god_default_attributes,
god_default_attributes_class_init, god_default_attributes_init,
G_TYPE_OBJECT)

View File

@@ -0,0 +1,63 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/**
* god-default-attributes.h: MS Office Graphic Object support
*
* Author:
* Michael Meeks (michael@ximian.com)
* Jody Goldberg (jody@gnome.org)
* Christopher James Lahey <clahey@ximian.com>
*
* (C) 1998-2003 Michael Meeks, Jody Goldberg, Chris Lahey
**/
#ifndef GOD_DEFAULT_ATTRIBUTES_H
#define GOD_DEFAULT_ATTRIBUTES_H
#include <glib-object.h>
#include <glib.h>
#include <drawing/god-paragraph-attributes.h>
G_BEGIN_DECLS
#define GOD_DEFAULT_ATTRIBUTES_TYPE (god_default_attributes_get_type ())
#define GOD_DEFAULT_ATTRIBUTES(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOD_DEFAULT_ATTRIBUTES_TYPE, GodDefaultAttributes))
#define GOD_DEFAULT_ATTRIBUTES_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GOD_DEFAULT_ATTRIBUTES_TYPE, GodDefaultAttributesClass))
#define GOD_DEFAULT_ATTRIBUTES_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GOD_DEFAULT_ATTRIBUTES_TYPE, GodDefaultAttributesClass))
#define IS_GOD_DEFAULT_ATTRIBUTES(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOD_DEFAULT_ATTRIBUTES_TYPE))
#define IS_GOD_DEFAULT_ATTRIBUTES_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GOD_DEFAULT_ATTRIBUTES_TYPE))
typedef struct GodDefaultAttributesPrivate_ GodDefaultAttributesPrivate;
typedef struct {
GObject parent;
GodDefaultAttributesPrivate *priv;
} GodDefaultAttributes;
typedef struct {
GObjectClass parent_class;
} GodDefaultAttributesClass;
GType god_default_attributes_get_type (void);
GodDefaultAttributes *god_default_attributes_new (void);
void god_default_attributes_set_paragraph_attributes (GodDefaultAttributes *attributes,
GodParagraphAttributes *paragraph_attributes);
void god_default_attributes_set_paragraph_attributes_for_indent (GodDefaultAttributes *attributes,
guint indent,
GodParagraphAttributes *paragraph_attributes);
void god_default_attributes_set_pango_attributes (GodDefaultAttributes *attributes,
GList *pango_attributes);
void god_default_attributes_set_pango_attributes_for_indent (GodDefaultAttributes *attributes,
guint indent,
GList *pango_attributes);
const GodParagraphAttributes *god_default_attributes_get_paragraph_attributes (GodDefaultAttributes *attributes);
const GodParagraphAttributes *god_default_attributes_get_paragraph_attributes_for_indent (GodDefaultAttributes *attributes,
guint indent);
const GList *god_default_attributes_get_pango_attributes (GodDefaultAttributes *attributes);
const GList *god_default_attributes_get_pango_attributes_for_indent (GodDefaultAttributes *attributes,
guint indent);
G_END_DECLS
#endif /* GOD_DEFAULT_ATTRIBUTES_H */

View File

@@ -0,0 +1,97 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* god-drawing-group.c: MS Office Graphic Object support
*
* Copyright (C) 2000-2002
* Jody Goldberg (jody@gnome.org)
* Michael Meeks (mmeeks@gnu.org)
* Christopher James Lahey <clahey@ximian.com>
*
* 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
*/
#include <goffice/goffice-config.h>
#include "drawing/god-drawing-group.h"
#include <gsf/gsf-impl-utils.h>
#include <string.h>
static GObjectClass *parent_class;
struct GodDrawingGroupPrivate_ {
GodImageStore *image_store;
};
static void
ensure_image_store (GodDrawingGroup *drawing_group)
{
if (drawing_group->priv->image_store == NULL)
drawing_group->priv->image_store =
god_image_store_new();
}
GodDrawingGroup *
god_drawing_group_new (void)
{
GodDrawingGroup *drawing_group;
drawing_group = g_object_new (GOD_DRAWING_GROUP_TYPE, NULL);
return drawing_group;
}
GodImageStore *
god_drawing_group_get_image_store (GodDrawingGroup *group)
{
ensure_image_store (group);
g_object_ref (group->priv->image_store);
return group->priv->image_store;
}
static void
god_drawing_group_init (GObject *object)
{
GodDrawingGroup *group = GOD_DRAWING_GROUP (object);
group->priv = g_new0 (GodDrawingGroupPrivate, 1);
}
static void
god_drawing_group_dispose (GObject *object)
{
GodDrawingGroup *group = GOD_DRAWING_GROUP (object);
if (group->priv->image_store)
g_object_unref (group->priv->image_store);
g_free (group->priv);
group->priv = NULL;
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
god_drawing_group_class_init (GodDrawingGroupClass *class)
{
GObjectClass *object_class;
object_class = (GObjectClass *) class;
parent_class = g_type_class_peek_parent (class);
object_class->dispose = god_drawing_group_dispose;
}
GSF_CLASS (GodDrawingGroup, god_drawing_group,
god_drawing_group_class_init, god_drawing_group_init,
G_TYPE_OBJECT)

View File

@@ -0,0 +1,48 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/**
* god-drawing-group.h: MS Office Graphic Object support
*
* Author:
* Michael Meeks (michael@ximian.com)
* Jody Goldberg (jody@gnome.org)
* Christopher James Lahey <clahey@ximian.com>
*
* (C) 1998-2003 Michael Meeks, Jody Goldberg, Chris Lahey
**/
#ifndef GOD_DRAWING_GROUP_H
#define GOD_DRAWING_GROUP_H
#include <glib-object.h>
#include <glib.h>
#include <drawing/god-image-store.h>
G_BEGIN_DECLS
#define GOD_DRAWING_GROUP_TYPE (god_drawing_group_get_type ())
#define GOD_DRAWING_GROUP(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOD_DRAWING_GROUP_TYPE, GodDrawingGroup))
#define GOD_DRAWING_GROUP_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GOD_DRAWING_GROUP_TYPE, GodDrawingGroupClass))
#define GOD_DRAWING_GROUP_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GOD_DRAWING_GROUP_TYPE, GodDrawingGroupClass))
#define IS_GOD_DRAWING_GROUP(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOD_DRAWING_GROUP_TYPE))
#define IS_GOD_DRAWING_GROUP_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GOD_DRAWING_GROUP_TYPE))
typedef struct GodDrawingGroupPrivate_ GodDrawingGroupPrivate;
typedef struct {
GObject parent;
GodDrawingGroupPrivate *priv;
} GodDrawingGroup;
typedef struct {
GObjectClass parent_class;
} GodDrawingGroupClass;
GType god_drawing_group_get_type (void);
GodDrawingGroup *god_drawing_group_new (void);
GodImageStore *god_drawing_group_get_image_store (GodDrawingGroup *drawing_group);
G_END_DECLS
#endif /* GOD_DRAWING_GROUP_H */

View File

@@ -0,0 +1,571 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* god-drawing-renderer-gdk.c: MS Office Graphic Object support
*
* Copyright (C) 2000-2002
* Jody Goldberg (jody@gnome.org)
* Michael Meeks (mmeeks@gnu.org)
* Christopher James Lahey <clahey@ximian.com>
*
* 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
*/
#include <goffice/goffice-config.h>
#include "drawing/god-drawing-renderer-gdk.h"
#include <gsf/gsf-impl-utils.h>
#include <gdk/gdk.h>
#include <string.h>
#include <math.h>
static GObjectClass *parent_class;
struct GodDrawingRendererGdkPrivate_ {
GodDrawing *drawing;
GdkDrawable *drawable;
GdkGC *gc;
GodAnchor *extents;
go_unit_t x_units_per_pixel;
go_unit_t y_units_per_pixel;
};
GodDrawingRendererGdk *
god_drawing_renderer_gdk_new (void)
{
GodDrawingRendererGdk *renderer;
renderer = g_object_new (GOD_DRAWING_RENDERER_GDK_TYPE, NULL);
return renderer;
}
static void
update_units_per_pixel (GodDrawingRendererGdk *renderer)
{
if (renderer->priv->drawable && renderer->priv->extents) {
gint pixel_width, pixel_height;
GoRect extent_rect;
gdk_drawable_get_size (renderer->priv->drawable, &pixel_width, &pixel_height);
god_anchor_get_rect (renderer->priv->extents, &extent_rect);
renderer->priv->x_units_per_pixel = (extent_rect.right - extent_rect.left) / pixel_width;
renderer->priv->y_units_per_pixel = (extent_rect.bottom - extent_rect.top) / pixel_height;
} else {
renderer->priv->x_units_per_pixel = 0;
renderer->priv->y_units_per_pixel = 0;
}
}
GodDrawing *
god_drawing_renderer_gdk_get_drawing (GodDrawingRendererGdk *renderer)
{
if (renderer->priv->drawing)
g_object_ref (renderer->priv->drawing);
return renderer->priv->drawing;
}
void
god_drawing_renderer_gdk_set_drawing (GodDrawingRendererGdk *renderer,
GodDrawing *drawing)
{
if (renderer->priv->drawing)
g_object_unref (renderer->priv->drawing);
renderer->priv->drawing = drawing;
if (renderer->priv->drawing)
g_object_ref (renderer->priv->drawing);
}
GdkDrawable *
god_drawing_renderer_gdk_get_drawable (GodDrawingRendererGdk *renderer)
{
if (renderer->priv->drawable)
g_object_ref (renderer->priv->drawable);
return renderer->priv->drawable;
}
void
god_drawing_renderer_gdk_set_drawable (GodDrawingRendererGdk *renderer,
GdkDrawable *drawable)
{
if (renderer->priv->drawable)
g_object_unref (renderer->priv->drawable);
renderer->priv->drawable = drawable;
if (renderer->priv->drawable)
g_object_ref (renderer->priv->drawable);
update_units_per_pixel (renderer);
}
GdkGC *
god_drawing_renderer_gdk_get_gc (GodDrawingRendererGdk *renderer)
{
if (renderer->priv->gc)
g_object_ref (renderer->priv->gc);
return renderer->priv->gc;
}
void
god_drawing_renderer_gdk_set_gc (GodDrawingRendererGdk *renderer,
GdkGC *gc)
{
if (renderer->priv->gc)
g_object_unref (renderer->priv->gc);
renderer->priv->gc = gc;
if (renderer->priv->gc)
g_object_ref (renderer->priv->gc);
update_units_per_pixel (renderer);
}
GodAnchor *
god_drawing_renderer_gdk_get_extents (GodDrawingRendererGdk *renderer)
{
if (renderer->priv->extents)
g_object_ref (renderer->priv->extents);
return renderer->priv->extents;
}
void
god_drawing_renderer_gdk_set_extents (GodDrawingRendererGdk *renderer,
GodAnchor *extents)
{
if (renderer->priv->extents)
g_object_unref (renderer->priv->extents);
renderer->priv->extents = extents;
if (renderer->priv->extents)
g_object_ref (renderer->priv->extents);
update_units_per_pixel (renderer);
}
static GdkPixbuf *
get_pixbuf (GodDrawingRendererGdk *renderer,
int which_pic)
{
GodDrawingGroup *drawing_group;
GdkPixbuf *ret_val = NULL;
if (which_pic < 0)
return NULL;
drawing_group = god_drawing_get_drawing_group (renderer->priv->drawing);
if (drawing_group) {
GodImageStore *image_store = god_drawing_group_get_image_store (drawing_group);
if (which_pic < god_image_store_get_image_count (image_store)) {
GodImage *image = god_image_store_get_image (image_store, which_pic);
ret_val = god_image_get_pixbuf (image);
g_object_unref (image);
}
g_object_unref (image_store);
g_object_unref (drawing_group);
}
return ret_val;
}
typedef struct {
GodDrawingRendererGdk *renderer;
GdkRectangle *rect;
long long y_ofs;
const GodDefaultAttributes *default_attributes;
} DrawTextContext;
#ifdef PANGO_HACK
static gboolean
make_absolute (PangoAttribute *attr, gpointer user_data)
{
DrawTextContext *draw_context = user_data;
if (attr->klass->type == PANGO_ATTR_SIZE &&
! ((PangoAttrSize *) attr)->absolute) {
PangoAttrSize *size_attr = (PangoAttrSize *) attr;
size_attr->size = GO_PT_TO_UN ((long long) size_attr->size) / draw_context->renderer->priv->y_units_per_pixel;
size_attr->absolute = TRUE;
}
return FALSE;
}
#endif
static void
draw_text (GodTextModel *text,
GodTextModelParagraph *paragraph,
gpointer user_data)
{
int height;
PangoLayout *layout;
DrawTextContext *draw_context = user_data;
double space_before = 0;
double space_after = 0;
double indent = 0;
const GList *iterator;
PangoAttrList *attributes;
GodParagraphAlignment alignment = GOD_PARAGRAPH_ALIGNMENT_LEFT;
const GodParagraphAttributes *default_para_attributes;
gunichar bullet_character = 0;
double bullet_indent = 0;
double bullet_size = 1.0;
char *bullet_family = NULL;
PangoFontDescription *bullet_desc;
PangoAttrIterator *attr_iterator;
if (draw_context->default_attributes) {
default_para_attributes = god_default_attributes_get_paragraph_attributes_for_indent ((GodDefaultAttributes *)draw_context->default_attributes, paragraph->indent);
if (default_para_attributes) {
g_object_get ((GodParagraphAttributes *) default_para_attributes,
"space_before", &space_before,
"space_after", &space_after,
"indent", &indent,
"alignment", &alignment,
"bullet_character", &bullet_character,
"bullet_indent", &bullet_indent,
"bullet_size", &bullet_size,
"bullet_family", &bullet_family,
NULL);
}
}
if (paragraph->para_attributes) {
GodParagraphAttributesFlags flags;
g_object_get (paragraph->para_attributes,
"flags", &flags,
NULL);
if (flags & GOD_PARAGRAPH_ATTRIBUTES_FLAGS_SPACE_BEFORE)
g_object_get (paragraph->para_attributes,
"space_before", &space_before,
NULL);
if (flags & GOD_PARAGRAPH_ATTRIBUTES_FLAGS_SPACE_AFTER)
g_object_get (paragraph->para_attributes,
"space_after", &space_after,
NULL);
if (flags & GOD_PARAGRAPH_ATTRIBUTES_FLAGS_INDENT)
g_object_get (paragraph->para_attributes,
"indent", &indent,
NULL);
if (flags & GOD_PARAGRAPH_ATTRIBUTES_FLAGS_ALIGNMENT)
g_object_get (paragraph->para_attributes,
"alignment", &alignment,
NULL);
if (flags & GOD_PARAGRAPH_ATTRIBUTES_FLAGS_BULLET_CHARACTER)
g_object_get (paragraph->para_attributes,
"bullet_character", &bullet_character,
NULL);
if (flags & GOD_PARAGRAPH_ATTRIBUTES_FLAGS_BULLET_INDENT)
g_object_get (paragraph->para_attributes,
"bullet_indent", &bullet_indent,
NULL);
if (flags & GOD_PARAGRAPH_ATTRIBUTES_FLAGS_BULLET_SIZE)
g_object_get (paragraph->para_attributes,
"bullet_size", &bullet_size,
NULL);
if (flags & GOD_PARAGRAPH_ATTRIBUTES_FLAGS_BULLET_FAMILY) {
g_free (bullet_family);
bullet_family = NULL;
g_object_get (paragraph->para_attributes,
"bullet_family", &bullet_family,
NULL);
}
}
draw_context->y_ofs += space_before;
layout = pango_layout_new (gdk_pango_context_get_for_screen (gdk_screen_get_default()));
pango_layout_set_alignment (layout, alignment == GOD_PARAGRAPH_ALIGNMENT_JUSTIFY ? PANGO_ALIGN_LEFT : alignment);
pango_layout_set_width (layout, draw_context->rect->width * PANGO_SCALE);
if (strchr (paragraph->text, 0xb)) {
int i;
char *paragraph_text = g_strdup (paragraph->text);
for (i = 0; paragraph_text[i]; i++) {
if (paragraph_text[i] == 0xb)
paragraph_text[i] = '\r';
}
pango_layout_set_text (layout, paragraph_text, -1);
g_free (paragraph_text);
} else {
pango_layout_set_text (layout, paragraph->text, -1);
}
pango_layout_set_auto_dir (layout, FALSE);
if (paragraph->char_attributes)
attributes = pango_attr_list_copy (paragraph->char_attributes);
else
attributes = pango_attr_list_new ();
if (draw_context->default_attributes) {
iterator = god_default_attributes_get_pango_attributes_for_indent ((GodDefaultAttributes *)draw_context->default_attributes, paragraph->indent);
for (; iterator; iterator = iterator->next) {
PangoAttribute *attr = pango_attribute_copy (iterator->data);
attr->start_index = 0;
attr->end_index = -1;
pango_attr_list_insert_before (attributes, attr);
}
}
#ifdef PANGO_HACK
pango_attr_list_filter (attributes, make_absolute, draw_context);
#endif
pango_layout_set_attributes (layout, attributes);
attr_iterator = pango_attr_list_get_iterator (attributes);
bullet_desc = pango_font_description_new ();
pango_attr_iterator_get_font (attr_iterator, bullet_desc, NULL, NULL);
pango_attr_iterator_destroy (attr_iterator);
pango_attr_list_unref (attributes);
gdk_draw_layout (draw_context->renderer->priv->drawable,
draw_context->renderer->priv->gc,
draw_context->rect->x + indent / draw_context->renderer->priv->x_units_per_pixel,
draw_context->rect->y + draw_context->y_ofs / draw_context->renderer->priv->y_units_per_pixel,
layout);
pango_layout_get_size (layout, NULL, &height);
g_object_unref (layout);
layout = NULL;
if (bullet_character != 0 &&
bullet_character != 0xe011 &&
bullet_size != 0 &&
bullet_family != NULL) {
char utf8[7];
int length;
layout = pango_layout_new (gdk_pango_context_get_for_screen (gdk_screen_get_default()));
pango_layout_set_alignment (layout, PANGO_ALIGN_LEFT);
length = g_unichar_to_utf8 (bullet_character, utf8);
pango_layout_set_text (layout, utf8, length);
pango_layout_set_auto_dir (layout, FALSE);
pango_font_description_set_size (bullet_desc, pango_font_description_get_size (bullet_desc) * sqrt (bullet_size));
pango_font_description_set_family (bullet_desc, bullet_family);
pango_layout_set_font_description (layout, bullet_desc);
gdk_draw_layout (draw_context->renderer->priv->drawable,
draw_context->renderer->priv->gc,
draw_context->rect->x + bullet_indent / draw_context->renderer->priv->x_units_per_pixel,
draw_context->rect->y + draw_context->y_ofs / draw_context->renderer->priv->y_units_per_pixel,
layout);
pango_font_description_free (bullet_desc);
g_object_unref (layout);
layout = NULL;
}
draw_context->y_ofs += height * draw_context->renderer->priv->y_units_per_pixel / PANGO_SCALE;
draw_context->y_ofs += space_after;
#if 0
g_print ("space before: %f\n", space_before);
g_print ("space after: %f\n", space_after);
g_print ("indent: %f\n", indent);
g_print ("x_units: %" GO_UNIT_T_FORMAT "\n", draw_context->renderer->priv->x_units_per_pixel);
g_print ("y_units: %" GO_UNIT_T_FORMAT "\n", draw_context->renderer->priv->y_units_per_pixel);
#endif
}
static void
god_drawing_renderer_gdk_render_shape (GodDrawingRendererGdk *renderer,
GdkRectangle *area,
GodShape *shape)
{
GodAnchor *anchor;
GdkRectangle rect;
GdkRectangle intersection;
GoRect anchor_rect;
anchor = god_shape_get_anchor (shape);
if (anchor) {
god_anchor_get_rect (anchor, &anchor_rect);
rect.x = anchor_rect.left / renderer->priv->x_units_per_pixel;
rect.width = anchor_rect.right / renderer->priv->x_units_per_pixel - rect.x;
rect.y = anchor_rect.top / renderer->priv->y_units_per_pixel;
rect.height = anchor_rect.bottom / renderer->priv->y_units_per_pixel - rect.y;
g_object_unref (anchor);
} else {
rect.x = 0;
rect.y = 0;
gdk_drawable_get_size (renderer->priv->drawable, &(rect.width), &(rect.height));
}
if (!gdk_rectangle_intersect (area, &rect, &intersection))
return;
{
GodPropertyTable *prop_table;
gboolean filled;
GodFillType fill_type;
GodTextModel *text_model;
DrawTextContext *draw_context;
prop_table = god_shape_get_prop_table (shape);
filled = god_property_table_get_flag (prop_table,
GOD_PROPERTY_FILLED,
TRUE);
fill_type = god_property_table_get_int (prop_table,
GOD_PROPERTY_FILL_TYPE,
GOD_FILL_TYPE_SOLID);
if (filled && fill_type == GOD_FILL_TYPE_PICTURE) {
int which_pic = god_property_table_get_int (prop_table,
GOD_PROPERTY_BLIP_ID,
-1);
GdkPixbuf *pixbuf = get_pixbuf (renderer, which_pic);
if (pixbuf) {
GdkPixbuf *to_blit = gdk_pixbuf_new (gdk_pixbuf_get_colorspace (pixbuf),
gdk_pixbuf_get_has_alpha (pixbuf),
gdk_pixbuf_get_bits_per_sample (pixbuf),
intersection.width, intersection.height);
double offset_x, offset_y;
double scale_x, scale_y;
scale_x = (double) rect.width / (double) gdk_pixbuf_get_width (pixbuf);
scale_y = (double) rect.height / (double) gdk_pixbuf_get_height (pixbuf);
offset_x = rect.x - intersection.x;
offset_y = rect.y - intersection.y;
gdk_pixbuf_scale (pixbuf,
to_blit,
0,
0,
intersection.width,
intersection.height,
offset_x,
offset_y,
scale_x,
scale_y,
GDK_INTERP_HYPER);
gdk_draw_pixbuf (renderer->priv->drawable,
renderer->priv->gc,
to_blit,
0,
0,
intersection.x,
intersection.y,
intersection.width,
intersection.height,
GDK_RGB_DITHER_NORMAL,
intersection.x,
intersection.y);
g_object_unref (to_blit);
g_object_unref (pixbuf);
}
}
if (filled && fill_type == GOD_FILL_TYPE_SOLID) {
GdkColor old_color, color;
guint32 colornum = god_property_table_get_uint (prop_table,
GOD_PROPERTY_FILL_COLOR,
0xffffff);
GdkGCValues values;
gdk_gc_get_values (renderer->priv->gc,
&values);
old_color = values.foreground;
color.red = (colornum & 0xff0000) >> 16;
color.blue = (colornum & 0xff00) >> 8;
color.green = colornum & 0xff;
color.red = color.red | (color.red << 8);
color.blue = color.blue | (color.blue << 8);
color.green = color.green + (color.green << 8);
gdk_gc_set_rgb_fg_color (renderer->priv->gc, &color);
gdk_draw_rectangle (renderer->priv->drawable,
renderer->priv->gc,
TRUE,
intersection.x,
intersection.y,
intersection.width,
intersection.height);
gdk_gc_set_foreground (renderer->priv->gc, &old_color);
}
text_model = god_shape_get_text_model (shape);
draw_context = g_new (DrawTextContext, 1);
draw_context->renderer = renderer;
draw_context->rect = &rect;
draw_context->y_ofs = 0;
draw_context->default_attributes = god_text_model_get_default_attributes (text_model);
god_text_model_paragraph_foreach (text_model, draw_text, draw_context);
g_object_unref (prop_table);
}
{
int i, child_count;
GodShape *child;
child_count = god_shape_get_child_count (shape);
for (i = 0; i < child_count; i++) {
child = god_shape_get_child (shape, i);
god_drawing_renderer_gdk_render_shape (renderer, area, child);
}
}
}
void
god_drawing_renderer_gdk_render (GodDrawingRendererGdk *renderer,
GdkRectangle *area)
{
GodShape *shape;
update_units_per_pixel (renderer);
shape = god_drawing_get_background (renderer->priv->drawing);
if (shape) {
god_drawing_renderer_gdk_render_shape (renderer,
area,
shape);
g_object_unref (shape);
}
shape = god_drawing_get_root_shape (renderer->priv->drawing);
if (shape) {
god_drawing_renderer_gdk_render_shape (renderer,
area,
shape);
g_object_unref (shape);
}
}
static void
god_drawing_renderer_gdk_init (GObject *object)
{
GodDrawingRendererGdk *renderer = GOD_DRAWING_RENDERER_GDK (object);
renderer->priv = g_new0 (GodDrawingRendererGdkPrivate, 1);
}
static void
god_drawing_renderer_gdk_dispose (GObject *object)
{
GodDrawingRendererGdk *renderer = GOD_DRAWING_RENDERER_GDK (object);
if (renderer->priv == NULL)
return;
if (renderer->priv->drawing)
g_object_unref (renderer->priv->drawing);
if (renderer->priv->drawable)
g_object_unref (renderer->priv->drawable);
if (renderer->priv->gc)
g_object_unref (renderer->priv->gc);
if (renderer->priv->extents)
g_object_unref (renderer->priv->extents);
g_free (renderer->priv);
renderer->priv = NULL;
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
god_drawing_renderer_gdk_class_init (GodDrawingRendererGdkClass *class)
{
GObjectClass *object_class;
object_class = (GObjectClass *) class;
parent_class = g_type_class_peek_parent (class);
object_class->dispose = god_drawing_renderer_gdk_dispose;
}
GSF_CLASS (GodDrawingRendererGdk, god_drawing_renderer_gdk,
god_drawing_renderer_gdk_class_init, god_drawing_renderer_gdk_init,
G_TYPE_OBJECT)

View File

@@ -0,0 +1,68 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- *//* vim: set sw=8: */
#ifndef GOD_DRAWING_RENDERER_GDK_H
#define GOD_DRAWING_RENDERER_GDK_H
/**
* god-drawing-renderer-gdk.h: MS Office Graphic Object support
*
* Author:
* Michael Meeks (michael@ximian.com)
* Jody Goldberg (jody@gnome.org)
* Christopher James Lahey <clahey@ximian.com>
*
* (C) 1998-2003 Michael Meeks, Jody Goldberg, Chris Lahey
**/
#include <glib-object.h>
#include <glib.h>
#include <drawing/god-drawing.h>
#include <drawing/god-anchor.h>
#include <gdk/gdkdrawable.h>
G_BEGIN_DECLS
#define GOD_DRAWING_RENDERER_GDK_TYPE (god_drawing_renderer_gdk_get_type ())
#define GOD_DRAWING_RENDERER_GDK(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOD_DRAWING_RENDERER_GDK_TYPE, GodDrawingRendererGdk))
#define GOD_DRAWING_RENDERER_GDK_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GOD_DRAWING_RENDERER_GDK_TYPE, GodDrawingRendererGdkClass))
#define IS_GOD_DRAWING_RENDERER_GDK(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOD_DRAWING_RENDERER_GDK_TYPE))
#define IS_GOD_DRAWING_RENDERER_GDK_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GOD_DRAWING_RENDERER_GDK_TYPE))
typedef struct GodDrawingRendererGdkPrivate_ GodDrawingRendererGdkPrivate;
typedef struct {
GObject parent;
GodDrawingRendererGdkPrivate *priv;
} GodDrawingRendererGdk;
typedef struct {
GObjectClass parent_class;
} GodDrawingRendererGdkClass;
GType god_drawing_renderer_gdk_get_type (void);
GodDrawingRendererGdk *god_drawing_renderer_gdk_new (void);
/* Return value is reffed. */
GodDrawing *god_drawing_renderer_gdk_get_drawing (GodDrawingRendererGdk *renderer);
void god_drawing_renderer_gdk_set_drawing (GodDrawingRendererGdk *renderer,
GodDrawing *drawing);
/* Return value is reffed. */
GdkDrawable *god_drawing_renderer_gdk_get_drawable (GodDrawingRendererGdk *renderer);
void god_drawing_renderer_gdk_set_drawable (GodDrawingRendererGdk *renderer,
GdkDrawable *drawable);
/* Return value is reffed. */
GdkGC *god_drawing_renderer_gdk_get_gc (GodDrawingRendererGdk *renderer);
void god_drawing_renderer_gdk_set_gc (GodDrawingRendererGdk *renderer,
GdkGC *gc);
/* Return value is reffed. */
GodAnchor *god_drawing_renderer_gdk_get_extents (GodDrawingRendererGdk *renderer);
void god_drawing_renderer_gdk_set_extents (GodDrawingRendererGdk *renderer,
GodAnchor *extents);
void god_drawing_renderer_gdk_render (GodDrawingRendererGdk *renderer,
GdkRectangle *area);
G_END_DECLS
#endif /* GOD_DRAWING_RENDERER_GDK_H */

View File

@@ -0,0 +1,142 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* god-drawing-view.c: MS Office Graphic Object support
*
* Copyright (C) 2000-2002
* Jody Goldberg (jody@gnome.org)
* Michael Meeks (mmeeks@gnu.org)
* Christopher James Lahey <clahey@ximian.com>
*
* 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
*/
#include <goffice/goffice-config.h>
#include "drawing/god-drawing-view.h"
#include <gsf/gsf-impl-utils.h>
#include <drawing/god-drawing-renderer-gdk.h>
static GObjectClass *parent_class;
struct GodDrawingViewPrivate_ {
GodDrawingRendererGdk *renderer;
};
GodDrawingView *
god_drawing_view_new (void)
{
GodDrawingView *view;
view = g_object_new (GOD_DRAWING_VIEW_TYPE, NULL);
return view;
}
GodDrawing *
god_drawing_view_get_drawing (GodDrawingView *view)
{
return god_drawing_renderer_gdk_get_drawing (view->priv->renderer);
}
void
god_drawing_view_set_drawing (GodDrawingView *view,
GodDrawing *drawing)
{
god_drawing_renderer_gdk_set_drawing (view->priv->renderer, drawing);
gtk_widget_queue_draw (GTK_WIDGET (view));
}
GodAnchor *
god_drawing_view_get_extents (GodDrawingView *view)
{
return god_drawing_renderer_gdk_get_extents (view->priv->renderer);
}
void
god_drawing_view_set_extents (GodDrawingView *view,
GodAnchor *extents)
{
god_drawing_renderer_gdk_set_extents (view->priv->renderer, extents);
gtk_widget_queue_draw (GTK_WIDGET (view));
}
static void
god_drawing_view_init (GObject *object)
{
GodDrawingView *view = GOD_DRAWING_VIEW (object);
view->priv = g_new0 (GodDrawingViewPrivate, 1);
view->priv->renderer = god_drawing_renderer_gdk_new ();
}
static void
god_drawing_view_realize (GtkWidget *widget)
{
GodDrawingView *view = GOD_DRAWING_VIEW (widget);
GTK_WIDGET_CLASS(parent_class)->realize (widget);
god_drawing_renderer_gdk_set_drawable (view->priv->renderer,
widget->window);
god_drawing_renderer_gdk_set_gc (view->priv->renderer,
widget->style->fg_gc[0]);
}
static gboolean
god_drawing_view_expose_event (GtkWidget *widget,
GdkEventExpose *event)
{
GodDrawingView *view = GOD_DRAWING_VIEW (widget);
god_drawing_renderer_gdk_render (view->priv->renderer,
&event->area);
return TRUE;
}
static void
god_drawing_view_dispose (GObject *object)
{
GodDrawingView *view = GOD_DRAWING_VIEW (object);
if (view->priv == NULL)
return;
if (view->priv->renderer)
g_object_unref (view->priv->renderer);
g_free (view->priv);
view->priv = NULL;
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
god_drawing_view_class_init (GodDrawingViewClass *class)
{
GObjectClass *object_class;
GtkWidgetClass *widget_class;
object_class = (GObjectClass *) class;
widget_class = (GtkWidgetClass *) class;
parent_class = g_type_class_peek_parent (class);
object_class->dispose = god_drawing_view_dispose;
widget_class->realize = god_drawing_view_realize;
widget_class->expose_event = god_drawing_view_expose_event;
}
GSF_CLASS (GodDrawingView, god_drawing_view,
god_drawing_view_class_init, god_drawing_view_init,
GTK_TYPE_DRAWING_AREA)

View File

@@ -0,0 +1,57 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- *//* vim: set sw=8: */
#ifndef GOD_DRAWING_VIEW_H
#define GOD_DRAWING_VIEW_H
/**
* god-drawing-view.h: MS Office Graphic Object support
*
* Author:
* Michael Meeks (michael@ximian.com)
* Jody Goldberg (jody@gnome.org)
* Christopher James Lahey <clahey@ximian.com>
*
* (C) 1998-2003 Michael Meeks, Jody Goldberg, Chris Lahey
**/
#include <glib-object.h>
#include <glib.h>
#include <drawing/god-drawing.h>
#include <drawing/god-anchor.h>
#include <gdk/gdkdrawable.h>
#include <gtk/gtkdrawingarea.h>
G_BEGIN_DECLS
#define GOD_DRAWING_VIEW_TYPE (god_drawing_view_get_type ())
#define GOD_DRAWING_VIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOD_DRAWING_VIEW_TYPE, GodDrawingView))
#define GOD_DRAWING_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GOD_DRAWING_VIEW_TYPE, GodDrawingViewClass))
#define IS_GOD_DRAWING_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOD_DRAWING_VIEW_TYPE))
#define IS_GOD_DRAWING_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GOD_DRAWING_VIEW_TYPE))
typedef struct GodDrawingViewPrivate_ GodDrawingViewPrivate;
typedef struct {
GtkDrawingArea parent;
GodDrawingViewPrivate *priv;
} GodDrawingView;
typedef struct {
GtkDrawingAreaClass parent_class;
} GodDrawingViewClass;
GType god_drawing_view_get_type (void);
GodDrawingView *god_drawing_view_new (void);
/* Return value is reffed. */
GodDrawing *god_drawing_view_get_drawing (GodDrawingView *renderer);
void god_drawing_view_set_drawing (GodDrawingView *renderer,
GodDrawing *drawing);
/* Return value is reffed. */
GodAnchor *god_drawing_view_get_extents (GodDrawingView *renderer);
void god_drawing_view_set_extents (GodDrawingView *renderer,
GodAnchor *extents);
G_END_DECLS
#endif /* GOD_DRAWING_VIEW_H */

View File

@@ -0,0 +1,147 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* god-drawing.c: MS Office Graphic Object support
*
* Copyright (C) 2000-2002
* Jody Goldberg (jody@gnome.org)
* Michael Meeks (mmeeks@gnu.org)
* Christopher James Lahey <clahey@ximian.com>
*
* 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
*/
#include <goffice/goffice-config.h>
#include "drawing/god-drawing.h"
#include <gsf/gsf-impl-utils.h>
static GObjectClass *parent_class;
struct GodDrawingPrivate_ {
GodShape *root_shape;
GodShape *background;
GodDrawingGroup *drawing_group;
};
GodDrawing *
god_drawing_new (void)
{
GodDrawing *drawing;
drawing = g_object_new (GOD_DRAWING_TYPE, NULL);
return drawing;
}
GodShape *
god_drawing_get_root_shape (GodDrawing *drawing)
{
if (drawing->priv->root_shape)
g_object_ref (drawing->priv->root_shape);
return drawing->priv->root_shape;
}
void
god_drawing_set_root_shape (GodDrawing *drawing,
GodShape *root_shape)
{
if (drawing->priv->root_shape)
g_object_unref (drawing->priv->root_shape);
drawing->priv->root_shape = root_shape;
if (drawing->priv->root_shape)
g_object_ref (drawing->priv->root_shape);
}
GodShape *
god_drawing_get_background (GodDrawing *drawing)
{
if (drawing->priv->background)
g_object_ref (drawing->priv->background);
return drawing->priv->background;
}
void
god_drawing_set_background (GodDrawing *drawing,
GodShape *background)
{
if (drawing->priv->background)
g_object_unref (drawing->priv->background);
drawing->priv->background = background;
if (drawing->priv->background)
g_object_ref (drawing->priv->background);
}
GodDrawingGroup *
god_drawing_get_drawing_group (GodDrawing *drawing)
{
if (drawing->priv->drawing_group)
g_object_ref (drawing->priv->drawing_group);
return drawing->priv->drawing_group;
}
void
god_drawing_set_drawing_group (GodDrawing *drawing,
GodDrawingGroup *drawing_group)
{
if (drawing->priv->drawing_group)
g_object_unref (drawing->priv->drawing_group);
drawing->priv->drawing_group = drawing_group;
if (drawing->priv->drawing_group)
g_object_ref (drawing->priv->drawing_group);
}
static void
god_drawing_init (GObject *object)
{
GodDrawing *drawing = GOD_DRAWING (object);
drawing->priv = g_new0 (GodDrawingPrivate, 1);
}
static void
god_drawing_dispose (GObject *object)
{
GodDrawing *drawing = GOD_DRAWING (object);
if (drawing->priv == NULL)
return;
if (drawing->priv->root_shape)
g_object_unref (drawing->priv->root_shape);
if (drawing->priv->background)
g_object_unref (drawing->priv->background);
if (drawing->priv->drawing_group)
g_object_unref (drawing->priv->drawing_group);
g_free (drawing->priv);
drawing->priv = NULL;
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
god_drawing_class_init (GodDrawingClass *class)
{
GObjectClass *object_class;
object_class = (GObjectClass *) class;
parent_class = g_type_class_peek_parent (class);
object_class->dispose = god_drawing_dispose;
}
GSF_CLASS (GodDrawing, god_drawing,
god_drawing_class_init, god_drawing_init,
G_TYPE_OBJECT)

View File

@@ -0,0 +1,60 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/**
* god-drawing.h: MS Office Graphic Object support
*
* Author:
* Michael Meeks (michael@ximian.com)
* Jody Goldberg (jody@gnome.org)
* Christopher James Lahey <clahey@ximian.com>
*
* (C) 1998-2003 Michael Meeks, Jody Goldberg, Chris Lahey
**/
#ifndef GOD_DRAWING_H
#define GOD_DRAWING_H
#include <glib-object.h>
#include <glib.h>
#include <drawing/god-shape.h>
#include <drawing/god-drawing-group.h>
G_BEGIN_DECLS
#define GOD_DRAWING_TYPE (god_drawing_get_type ())
#define GOD_DRAWING(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOD_DRAWING_TYPE, GodDrawing))
#define GOD_DRAWING_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GOD_DRAWING_TYPE, GodDrawingClass))
#define IS_GOD_DRAWING(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOD_DRAWING_TYPE))
#define IS_GOD_DRAWING_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GOD_DRAWING_TYPE))
typedef struct GodDrawingPrivate_ GodDrawingPrivate;
typedef struct {
GObject parent;
GodDrawingPrivate *priv;
} GodDrawing;
typedef struct {
GObjectClass parent_class;
} GodDrawingClass;
GType god_drawing_get_type (void);
GodDrawing *god_drawing_new (void);
/* Return value is reffed. */
GodShape *god_drawing_get_root_shape (GodDrawing *drawing);
void god_drawing_set_root_shape (GodDrawing *drawing,
GodShape *root_shape);
/* Return value is reffed. */
GodShape *god_drawing_get_background (GodDrawing *drawing);
void god_drawing_set_background (GodDrawing *drawing,
GodShape *root_shape);
/* Return value is reffed. */
GodDrawingGroup *god_drawing_get_drawing_group (GodDrawing *drawing);
void god_drawing_set_drawing_group (GodDrawing *drawing,
GodDrawingGroup *drawing_group);
G_END_DECLS
#endif /* GOD_DRAWING_H */

View File

@@ -0,0 +1,165 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* god-image-store.c: MS Office Graphic Object support
*
* Copyright (C) 2000-2002
* Jody Goldberg (jody@gnome.org)
* Michael Meeks (mmeeks@gnu.org)
* Christopher James Lahey <clahey@ximian.com>
*
* 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
*/
#include <goffice/goffice-config.h>
#include "drawing/god-image-store.h"
#include <gsf/gsf-impl-utils.h>
#include <string.h>
static GObjectClass *parent_class;
struct GodImageStorePrivate_ {
GPtrArray *images; /* Of type GodImage. */
};
static GPtrArray*
g_ptr_array_insert_val (GPtrArray *array,
guint index,
gpointer data)
{
g_ptr_array_add (array, data);
memmove (array->pdata + index + 1,
array->pdata + index,
array->len - index - 1);
g_ptr_array_index (array, index) = data;
return array;
}
GodImageStore *
god_image_store_new (void)
{
GodImageStore *shape;
shape = g_object_new (GOD_IMAGE_STORE_TYPE, NULL);
return shape;
}
void
god_image_store_append_image (GodImageStore *store,
GodImage *image)
{
god_image_store_insert_image (store, image, -1);
}
/* pos can be -1 to represent the end. */
void
god_image_store_insert_image (GodImageStore *store,
GodImage *image,
int pos)
{
g_return_if_fail (store != NULL);
g_return_if_fail (image != NULL);
if (pos == -1)
pos = store->priv->images->len;
g_ptr_array_insert_val (store->priv->images, pos, image);
g_object_ref (image);
}
/* pos must be an actual position */
void
god_image_store_delete_image (GodImageStore *store,
int pos)
{
GodImage *image = g_ptr_array_remove_index (store->priv->images, pos);
g_object_unref (image);
}
/* old_pos must be an actual position. new_pos can be -1 to represent the end. */
void
god_image_store_reorder_image (GodImageStore *store,
int old_pos,
int new_pos)
{
GodImage *image = g_ptr_array_remove_index (store->priv->images, old_pos);
god_image_store_insert_image (store, image, new_pos);
g_object_unref (image);
}
int
god_image_store_get_image_count (GodImageStore *store)
{
return store->priv->images->len;
}
GodImage *
god_image_store_get_image (GodImageStore *store,
int pos)
{
GodImage *image;
g_return_val_if_fail (pos < god_image_store_get_image_count (store), NULL);
image = g_ptr_array_index (store->priv->images, pos);
g_return_val_if_fail (image, NULL);
g_object_ref (image);
return image;
}
static void
god_image_store_init (GObject *object)
{
GodImageStore *shape = GOD_IMAGE_STORE (object);
shape->priv = g_new0 (GodImageStorePrivate, 1);
shape->priv->images = g_ptr_array_new ();
}
static void
god_image_store_dispose (GObject *object)
{
GodImageStore *shape = GOD_IMAGE_STORE (object);
guint i;
if (shape->priv == NULL)
return;
for (i = 0; i < shape->priv->images->len; i++)
g_object_unref (g_ptr_array_index (shape->priv->images, i));
g_ptr_array_free (shape->priv->images, TRUE);
g_free (shape->priv);
shape->priv = NULL;
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
god_image_store_class_init (GodImageStoreClass *class)
{
GObjectClass *object_class;
object_class = (GObjectClass *) class;
parent_class = g_type_class_peek_parent (class);
object_class->dispose = god_image_store_dispose;
}
GSF_CLASS (GodImageStore, god_image_store,
god_image_store_class_init, god_image_store_init,
G_TYPE_OBJECT)

View File

@@ -0,0 +1,59 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/**
* god-image-store.h: MS Office Graphic Object support
*
* Author:
* Michael Meeks (michael@ximian.com)
* Jody Goldberg (jody@gnome.org)
* Christopher James Lahey <clahey@ximian.com>
*
* (C) 1998-2003 Michael Meeks, Jody Goldberg, Chris Lahey
**/
#ifndef GOD_IMAGE_STORE_H
#define GOD_IMAGE_STORE_H
#include <glib-object.h>
#include <glib.h>
#include <drawing/god-image.h>
G_BEGIN_DECLS
#define GOD_IMAGE_STORE_TYPE (god_image_store_get_type ())
#define GOD_IMAGE_STORE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOD_IMAGE_STORE_TYPE, GodImageStore))
#define GOD_IMAGE_STORE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GOD_IMAGE_STORE_TYPE, GodImageStoreClass))
#define IS_GOD_IMAGE_STORE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOD_IMAGE_STORE_TYPE))
#define IS_GOD_IMAGE_STORE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GOD_IMAGE_STORE_TYPE))
typedef struct GodImageStorePrivate_ GodImageStorePrivate;
typedef struct {
GObject parent;
GodImageStorePrivate *priv;
} GodImageStore;
typedef struct {
GObjectClass parent_class;
} GodImageStoreClass;
GType god_image_store_get_type (void);
GodImageStore *god_image_store_new (void);
/* Tree functions */
void god_image_store_append_image (GodImageStore *store,
GodImage *image);
void god_image_store_insert_image (GodImageStore *store,
GodImage *image,
int pos);
void god_image_store_delete_image (GodImageStore *store,
int pos);
void god_image_store_reorder_image (GodImageStore *store,
int old_pos,
int new_pos);
int god_image_store_get_image_count (GodImageStore *store);
/* Return value is reffed. */
GodImage *god_image_store_get_image (GodImageStore *store,
int pos);
G_END_DECLS
#endif /* GOD_IMAGE_STORE_H */

View File

@@ -0,0 +1,140 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* god-image.c: MS Office Graphic Object support
*
* Copyright (C) 2000-2002
* Jody Goldberg (jody@gnome.org)
* Michael Meeks (mmeeks@gnu.org)
* Christopher James Lahey <clahey@ximian.com>
*
* 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
*/
#include <goffice/goffice-config.h>
#include "drawing/god-image.h"
#include <gsf/gsf-impl-utils.h>
#include <string.h>
static GObjectClass *parent_class;
struct GodImagePrivate_ {
char *format;
guint8 *data;
guint32 length;
GdkPixbuf *pixbuf;
};
static void
ensure_pixbuf (GodImage *image)
{
GdkPixbufLoader *loader;
if (image->priv->pixbuf)
return;
if (image->priv->format)
loader = gdk_pixbuf_loader_new_with_type (image->priv->format, NULL);
else
loader = gdk_pixbuf_loader_new ();
if (loader) {
if (gdk_pixbuf_loader_write (loader, image->priv->data, image->priv->length, NULL)) {
image->priv->pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
if (image->priv->pixbuf) {
g_object_ref (image->priv->pixbuf);
}
}
gdk_pixbuf_loader_close (loader, NULL);
g_object_unref (loader);
}
}
GodImage *
god_image_new (void)
{
GodImage *image;
image = g_object_new (GOD_IMAGE_TYPE, NULL);
return image;
}
GdkPixbuf *
god_image_get_pixbuf (GodImage *image)
{
ensure_pixbuf (image);
if (image->priv->pixbuf)
g_object_ref (image->priv->pixbuf);
return image->priv->pixbuf;
}
void
god_image_set_image_data (GodImage *image,
const char *format,
const guint8 *data,
guint32 length)
{
g_free (image->priv->data);
g_free (image->priv->format);
image->priv->format = g_strdup (format);
image->priv->length = length;
image->priv->data = g_memdup (data, length);
if (image->priv->pixbuf)
g_object_unref (image->priv->pixbuf);
image->priv->pixbuf = NULL;
}
static void
god_image_init (GObject *object)
{
GodImage *image = GOD_IMAGE (object);
image->priv = g_new0 (GodImagePrivate, 1);
}
static void
god_image_dispose (GObject *object)
{
GodImage *image = GOD_IMAGE (object);
if (image->priv == NULL)
return;
if (image->priv->pixbuf)
g_object_unref (image->priv->pixbuf);
g_free (image->priv->data);
g_free (image->priv->format);
g_free (image->priv);
image->priv = NULL;
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
god_image_class_init (GodImageClass *class)
{
GObjectClass *object_class;
object_class = (GObjectClass *) class;
parent_class = g_type_class_peek_parent (class);
object_class->dispose = god_image_dispose;
}
GSF_CLASS (GodImage, god_image,
god_image_class_init, god_image_init,
G_TYPE_OBJECT)

View File

@@ -0,0 +1,53 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/**
* god-image.h: MS Office Graphic Object support
*
* Author:
* Michael Meeks (michael@ximian.com)
* Jody Goldberg (jody@gnome.org)
* Christopher James Lahey <clahey@ximian.com>
*
* (C) 1998-2003 Michael Meeks, Jody Goldberg, Chris Lahey
**/
#ifndef GOD_IMAGE_H
#define GOD_IMAGE_H
#include <glib-object.h>
#include <glib.h>
#include <drawing/god-property-table.h>
#include <drawing/god-anchor.h>
#include <drawing/god-text-model.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
G_BEGIN_DECLS
#define GOD_IMAGE_TYPE (god_image_get_type ())
#define GOD_IMAGE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOD_IMAGE_TYPE, GodImage))
#define GOD_IMAGE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GOD_IMAGE_TYPE, GodImageClass))
#define IS_GOD_IMAGE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOD_IMAGE_TYPE))
#define IS_GOD_IMAGE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GOD_IMAGE_TYPE))
typedef struct GodImagePrivate_ GodImagePrivate;
typedef struct {
GObject parent;
GodImagePrivate *priv;
} GodImage;
typedef struct {
GObjectClass parent_class;
} GodImageClass;
GType god_image_get_type (void);
GodImage *god_image_new (void);
GdkPixbuf *god_image_get_pixbuf (GodImage *image);
/* Instead of setting the pixbuf, you set the image data. */
void god_image_set_image_data (GodImage *image,
const char *format,
const guint8 *data,
guint32 length);
G_END_DECLS
#endif /* GOD_IMAGE_H */

View File

@@ -0,0 +1,249 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* god-paragraph-attributes.c: MS Office Graphic Object support
*
* Copyright (C) 2000-2002
* Jody Goldberg (jody@gnome.org)
* Michael Meeks (mmeeks@gnu.org)
* Christopher James Lahey <clahey@ximian.com>
*
* 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
*/
#include <goffice/goffice-config.h>
#include "drawing/god-paragraph-attributes.h"
#include <glib/gi18n.h>
#include <gsf/gsf-impl-utils.h>
static GObjectClass *parent_class;
struct GodParagraphAttributesPrivate_ {
GodParagraphAttributesFlags flags;
double indent;
double space_before;
double space_after;
GodParagraphAlignment alignment;
gunichar bullet_character;
double bullet_indent;
double bullet_size;
char *bullet_family;
};
enum {
PROP_0,
PROP_FLAGS,
PROP_INDENT,
PROP_SPACE_BEFORE,
PROP_SPACE_AFTER,
PROP_ALIGNMENT,
PROP_BULLET_CHARACTER,
PROP_BULLET_INDENT,
PROP_BULLET_SIZE,
PROP_BULLET_FAMILY,
};
GodParagraphAttributes *
god_paragraph_attributes_new (void)
{
GodParagraphAttributes *paragraph;
paragraph = g_object_new (GOD_PARAGRAPH_ATTRIBUTES_TYPE, NULL);
return paragraph;
}
static void
god_paragraph_attributes_init (GObject *object)
{
GodParagraphAttributes *paragraph = GOD_PARAGRAPH_ATTRIBUTES (object);
paragraph->priv = g_new0 (GodParagraphAttributesPrivate, 1);
paragraph->priv->indent = 0;
paragraph->priv->space_before = 0;
paragraph->priv->space_after = 0;
paragraph->priv->alignment = GOD_PARAGRAPH_ALIGNMENT_LEFT;
paragraph->priv->bullet_character = 0;
paragraph->priv->bullet_indent = 0;
paragraph->priv->bullet_size = 1.0;
paragraph->priv->bullet_family = NULL;
paragraph->priv->flags = 0;
}
static void
god_paragraph_attributes_finalize (GObject *object)
{
GodParagraphAttributes *paragraph = GOD_PARAGRAPH_ATTRIBUTES (object);
g_free (paragraph->priv->bullet_family);
g_free (paragraph->priv);
paragraph->priv = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
god_paragraph_attributes_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
GodParagraphAttributes *paragraph = GOD_PARAGRAPH_ATTRIBUTES (object);
switch (prop_id) {
case PROP_INDENT:
paragraph->priv->indent = g_value_get_double (value);
paragraph->priv->flags |= GOD_PARAGRAPH_ATTRIBUTES_FLAGS_INDENT;
break;
case PROP_SPACE_BEFORE:
paragraph->priv->space_before = g_value_get_double (value);
paragraph->priv->flags |= GOD_PARAGRAPH_ATTRIBUTES_FLAGS_SPACE_BEFORE;
break;
case PROP_SPACE_AFTER:
paragraph->priv->space_after = g_value_get_double (value);
paragraph->priv->flags |= GOD_PARAGRAPH_ATTRIBUTES_FLAGS_SPACE_AFTER;
break;
case PROP_ALIGNMENT:
paragraph->priv->alignment = g_value_get_uint (value);
paragraph->priv->flags |= GOD_PARAGRAPH_ATTRIBUTES_FLAGS_ALIGNMENT;
break;
case PROP_BULLET_CHARACTER:
paragraph->priv->bullet_character = g_value_get_uint (value);
paragraph->priv->flags |= GOD_PARAGRAPH_ATTRIBUTES_FLAGS_BULLET_CHARACTER;
break;
case PROP_BULLET_INDENT:
paragraph->priv->bullet_indent = g_value_get_double (value);
paragraph->priv->flags |= GOD_PARAGRAPH_ATTRIBUTES_FLAGS_BULLET_INDENT;
break;
case PROP_BULLET_SIZE:
paragraph->priv->bullet_size = g_value_get_double (value);
paragraph->priv->flags |= GOD_PARAGRAPH_ATTRIBUTES_FLAGS_BULLET_SIZE;
break;
case PROP_BULLET_FAMILY:
g_free (paragraph->priv->bullet_family);
paragraph->priv->bullet_family = g_value_dup_string (value);
paragraph->priv->flags |= GOD_PARAGRAPH_ATTRIBUTES_FLAGS_BULLET_FAMILY;
break;
}
}
static void
god_paragraph_attributes_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
GodParagraphAttributes *paragraph = GOD_PARAGRAPH_ATTRIBUTES (object);
switch (prop_id){
case PROP_FLAGS:
g_value_set_uint (value, paragraph->priv->flags);
break;
case PROP_INDENT:
g_value_set_double (value, paragraph->priv->indent);
break;
case PROP_SPACE_BEFORE:
g_value_set_double (value, paragraph->priv->space_before);
break;
case PROP_SPACE_AFTER:
g_value_set_double (value, paragraph->priv->space_after);
break;
case PROP_ALIGNMENT:
g_value_set_uint (value, paragraph->priv->alignment);
break;
case PROP_BULLET_CHARACTER:
g_value_set_uint (value, paragraph->priv->bullet_character);
break;
case PROP_BULLET_INDENT:
g_value_set_double (value, paragraph->priv->bullet_indent);
break;
case PROP_BULLET_SIZE:
g_value_set_double (value, paragraph->priv->bullet_size);
break;
case PROP_BULLET_FAMILY:
g_value_set_string (value, paragraph->priv->bullet_family);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
god_paragraph_attributes_class_init (GodParagraphAttributesClass *class)
{
GObjectClass *object_class;
object_class = (GObjectClass *) class;
parent_class = g_type_class_peek_parent (class);
object_class->finalize = god_paragraph_attributes_finalize;
object_class->get_property = god_paragraph_attributes_get_property;
object_class->set_property = god_paragraph_attributes_set_property;
g_object_class_install_property (object_class, PROP_FLAGS,
g_param_spec_uint ("flags",
_( "Flags" ),
_( "Flags" ),
0, GOD_PARAGRAPH_ATTRIBUTES_FLAGS_ALL, 0,
G_PARAM_READABLE));
g_object_class_install_property (object_class, PROP_INDENT,
g_param_spec_double ("indent",
_( "Indent" ),
_( "Indent" ),
-G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_SPACE_BEFORE,
g_param_spec_double ("space_before",
_( "Space Before" ),
_( "Space Before" ),
-G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_SPACE_AFTER,
g_param_spec_double ("space_after",
_( "Space After" ),
_( "Space After" ),
-G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_ALIGNMENT,
g_param_spec_uint ("alignment",
_( "Alignment" ),
_( "Alignment" ),
GOD_PARAGRAPH_ALIGNMENT_LEFT, GOD_PARAGRAPH_ALIGNMENT_JUSTIFY, GOD_PARAGRAPH_ALIGNMENT_LEFT,
G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_BULLET_CHARACTER,
g_param_spec_uint ("bullet_character",
_( "Bullet Character" ),
_( "Bullet Character" ),
0, 0xffffffff, 0,
G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_BULLET_INDENT,
g_param_spec_double ("bullet_indent",
_( "Bullet Indent" ),
_( "Bullet Indent" ),
-G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_BULLET_SIZE,
g_param_spec_double ("bullet_size",
_( "Bullet Size" ),
_( "Bullet Size" ),
0, G_MAXDOUBLE, 1.0,
G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_BULLET_FAMILY,
g_param_spec_string ("bullet_family",
_( "Bullet Family" ),
_( "Bullet Family" ),
NULL,
G_PARAM_READWRITE));
}
GSF_CLASS (GodParagraphAttributes, god_paragraph_attributes,
god_paragraph_attributes_class_init, god_paragraph_attributes_init,
G_TYPE_OBJECT)

View File

@@ -0,0 +1,63 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/**
* god-paragraph-attributes.h: MS Office Graphic Object support
*
* Author:
* Michael Meeks (michael@ximian.com)
* Jody Goldberg (jody@gnome.org)
* Christopher James Lahey <clahey@ximian.com>
*
* (C) 1998-2003 Michael Meeks, Jody Goldberg, Chris Lahey
**/
#ifndef GOD_PARAGRAPH_ATTRIBUTES_H
#define GOD_PARAGRAPH_ATTRIBUTES_H
#include <glib-object.h>
#include <glib.h>
G_BEGIN_DECLS
#define GOD_PARAGRAPH_ATTRIBUTES_TYPE (god_paragraph_attributes_get_type ())
#define GOD_PARAGRAPH_ATTRIBUTES(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOD_PARAGRAPH_ATTRIBUTES_TYPE, GodParagraphAttributes))
#define GOD_PARAGRAPH_ATTRIBUTES_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GOD_PARAGRAPH_ATTRIBUTES_TYPE, GodParagraphAttributesClass))
#define GOD_PARAGRAPH_ATTRIBUTES_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GOD_PARAGRAPH_ATTRIBUTES_TYPE, GodParagraphAttributesClass))
#define IS_GOD_PARAGRAPH_ATTRIBUTES(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOD_PARAGRAPH_ATTRIBUTES_TYPE))
#define IS_GOD_PARAGRAPH_ATTRIBUTES_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GOD_PARAGRAPH_ATTRIBUTES_TYPE))
typedef struct GodParagraphAttributesPrivate_ GodParagraphAttributesPrivate;
typedef struct {
GObject parent;
GodParagraphAttributesPrivate *priv;
} GodParagraphAttributes;
typedef struct {
GObjectClass parent_class;
} GodParagraphAttributesClass;
typedef enum {
GOD_PARAGRAPH_ATTRIBUTES_FLAGS_INDENT = 1 << 0,
GOD_PARAGRAPH_ATTRIBUTES_FLAGS_SPACE_BEFORE = 1 << 1,
GOD_PARAGRAPH_ATTRIBUTES_FLAGS_SPACE_AFTER = 1 << 2,
GOD_PARAGRAPH_ATTRIBUTES_FLAGS_ALIGNMENT = 1 << 3,
GOD_PARAGRAPH_ATTRIBUTES_FLAGS_BULLET_CHARACTER = 1 << 4,
GOD_PARAGRAPH_ATTRIBUTES_FLAGS_BULLET_INDENT = 1 << 5,
GOD_PARAGRAPH_ATTRIBUTES_FLAGS_BULLET_SIZE = 1 << 6,
GOD_PARAGRAPH_ATTRIBUTES_FLAGS_BULLET_FAMILY = 1 << 7,
GOD_PARAGRAPH_ATTRIBUTES_FLAGS_ALL = ((1 << 8) - 1),
} GodParagraphAttributesFlags;
typedef enum {
GOD_PARAGRAPH_ALIGNMENT_LEFT = 0,
GOD_PARAGRAPH_ALIGNMENT_CENTER = 1,
GOD_PARAGRAPH_ALIGNMENT_RIGHT = 2,
GOD_PARAGRAPH_ALIGNMENT_JUSTIFY = 3
} GodParagraphAlignment;
GType god_paragraph_attributes_get_type (void);
GodParagraphAttributes *god_paragraph_attributes_new (void);
G_END_DECLS
#endif /* GOD_PARAGRAPH_ATTRIBUTES_H */

View File

@@ -0,0 +1,993 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* god-property-table.c: MS Office Graphic Object support
*
* Copyright (C) 2000-2004
* Jody Goldberg (jody@gnome.org)
* Michael Meeks (mmeeks@gnu.org)
* Christopher James Lahey <clahey@ximian.com>
*
* 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
*/
#include <goffice/goffice-config.h>
#include "drawing/god-property-table.h"
#include <gsf/gsf-impl-utils.h>
#include <gsf/gsf-utils.h>
#include <stdio.h>
#include <string.h>
static GObjectClass *parent_class;
struct GodPropertyTablePrivate_ {
GHashTable *attrs;
};
#define GR_END 0x00
#define GR_MACRO 0x04
#define GR_COMMAND_BUTTON 0x05
#define GR_GROUP 0x06
#define GR_CLIPBOARD_FORMAT 0x07
#define GR_PICTURE_OPTIONS 0x08
#define GR_PICTURE_FORMULA 0x09
#define GR_CHECKBOX_LINK 0x0A
#define GR_RADIO_BUTTON 0x0B
#define GR_SCROLLBAR 0x0C
#define GR_NOTE_STRUCTURE 0x0D
#define GR_SCROLLBAR_FORMULA 0x0E
#define GR_GROUP_BOX_DATA 0x0F
#define GR_EDIT_CONTROL_DATA 0x10
#define GR_RADIO_BUTTON_DATA 0x11
#define GR_CHECKBOX_DATA 0x12
#define GR_LISTBOX_DATA 0x13
#define GR_CHECKBOX_FORMULA 0x14
#define GR_COMMON_OBJ_DATA 0x15
static GValue *
g_value_new (GType type)
{
GValue *value = g_new0 (GValue, 1);
g_value_init (value, type);
return value;
}
static void
g_value_free (gpointer data)
{
GValue *value = data;
g_value_unset (value);
g_free (value);
}
void
god_property_table_set (GodPropertyTable *prop_table, GodPropertyID id, GValue *value)
{
g_hash_table_insert (prop_table->priv->attrs, g_strdup(id), value);
}
GValue *
god_property_table_get (GodPropertyTable *prop_table, GodPropertyID id)
{
g_return_val_if_fail (prop_table != NULL, NULL);
return g_hash_table_lookup (prop_table->priv->attrs, id);
}
void
god_property_table_set_flag (GodPropertyTable *prop_table,
GodPropertyID id,
gboolean val)
{
GValue *value = g_value_new(G_TYPE_BOOLEAN);
g_value_set_boolean (value, val);
god_property_table_set (prop_table, id, value);
}
void
god_property_table_set_uint (GodPropertyTable *prop_table,
GodPropertyID id,
guint32 val)
{
GValue *value = g_value_new(G_TYPE_UINT);
g_value_set_uint (value, val);
god_property_table_set (prop_table, id, value);
}
void
god_property_table_set_int (GodPropertyTable *prop_table,
GodPropertyID id,
gint32 val)
{
GValue *value = g_value_new(G_TYPE_INT);
g_value_set_int (value, val);
god_property_table_set (prop_table, id, value);
}
void
god_property_table_set_length (GodPropertyTable *prop_table,
GodPropertyID id,
go_unit_t val)
{
GValue *value = g_value_new(G_TYPE_INT64);
g_value_set_int64 (value, val);
god_property_table_set (prop_table, id, value);
}
void
god_property_table_set_pointer (GodPropertyTable *prop_table,
GodPropertyID id,
gpointer val)
{
GValue *value = g_value_new(G_TYPE_POINTER);
g_value_set_pointer (value, val);
god_property_table_set (prop_table, id, value);
}
void
god_property_table_set_array (GodPropertyTable *prop_table,
GodPropertyID id,
GArray *val)
{
GValue *value = g_value_new(G_TYPE_POINTER);
g_value_set_pointer (value, val);
god_property_table_set (prop_table, id, value);
}
void
god_property_table_set_markup (GodPropertyTable *prop_table,
GodPropertyID id,
PangoAttrList *list)
{
GValue *value = g_value_new (PANGO_TYPE_ATTR_LIST);
g_value_set_pointer (value, list);
god_property_table_set (prop_table, id, value);
}
gboolean
god_property_table_get_flag (GodPropertyTable *prop_table,
GodPropertyID id,
gboolean default_value)
{
GValue *value;
g_return_val_if_fail (prop_table != NULL, default_value);
value = g_hash_table_lookup (prop_table->priv->attrs, id);
if (value == NULL)
return default_value;
g_return_val_if_fail (G_VALUE_HOLDS_BOOLEAN (value), default_value);
return g_value_get_boolean (value);
}
guint32
god_property_table_get_uint (GodPropertyTable *prop_table,
GodPropertyID id,
guint32 default_value)
{
GValue *value;
g_return_val_if_fail (prop_table != NULL, default_value);
value = g_hash_table_lookup (prop_table->priv->attrs, id);
if (value == NULL)
return default_value;
g_return_val_if_fail (G_VALUE_HOLDS_UINT (value), default_value);
return g_value_get_uint (value);
}
gint32
god_property_table_get_int (GodPropertyTable *prop_table,
GodPropertyID id,
gint32 default_value)
{
GValue *value;
g_return_val_if_fail (prop_table != NULL, default_value);
value = g_hash_table_lookup (prop_table->priv->attrs, id);
if (value == NULL)
return default_value;
g_return_val_if_fail (G_VALUE_HOLDS_INT (value), default_value);
return g_value_get_int (value);
}
go_unit_t
god_property_table_get_length (GodPropertyTable *prop_table,
GodPropertyID id,
go_unit_t default_value)
{
GValue *value;
g_return_val_if_fail (prop_table != NULL, default_value);
value = g_hash_table_lookup (prop_table->priv->attrs, id);
if (value == NULL)
return default_value;
g_return_val_if_fail (G_VALUE_HOLDS_INT64 (value), default_value);
return g_value_get_int64 (value);
}
gpointer
god_property_table_get_pointer (GodPropertyTable *prop_table,
GodPropertyID id,
gpointer default_value)
{
GValue *value;
g_return_val_if_fail (prop_table != NULL, default_value);
value = g_hash_table_lookup (prop_table->priv->attrs, id);
if (value == NULL)
return default_value;
g_return_val_if_fail (G_VALUE_HOLDS_POINTER (value), default_value);
return g_value_get_pointer (value);
}
GArray *
god_property_table_get_array (GodPropertyTable *prop_table,
GodPropertyID id,
GArray *default_value)
{
GValue *value;
g_return_val_if_fail (prop_table != NULL, default_value);
value = g_hash_table_lookup (prop_table->priv->attrs, id);
if (value == NULL)
return default_value;
g_return_val_if_fail (G_VALUE_HOLDS_POINTER (value), default_value);
return g_value_get_pointer (value);
}
PangoAttrList *
god_property_table_get_markup (GodPropertyTable *prop_table,
GodPropertyID id,
PangoAttrList *default_value)
{
GValue *value;
g_return_val_if_fail (prop_table != NULL, default_value);
value = g_hash_table_lookup (prop_table->priv->attrs, id);
if (value == NULL)
return default_value;
g_return_val_if_fail (G_VALUE_HOLDS_POINTER (value), default_value);
return g_value_get_pointer (value);
}
GodPropertyTable *
god_property_table_new (void)
{
GodPropertyTable *prop_table;
prop_table = g_object_new (GOD_PROPERTY_TABLE_TYPE, NULL);
return prop_table;
}
static void
god_property_table_init (GObject *object)
{
GodPropertyTable *prop_table = GOD_PROPERTY_TABLE (object);
prop_table->priv = g_new0 (GodPropertyTablePrivate, 1);
prop_table->priv->attrs = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
g_value_free);
}
static void
god_property_table_finalize (GObject *object)
{
GodPropertyTable *prop_table = GOD_PROPERTY_TABLE (object);
g_hash_table_destroy (prop_table->priv->attrs);
g_free (prop_table->priv);
prop_table->priv = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
god_property_table_class_init (GodPropertyTableClass *class)
{
GObjectClass *object_class;
object_class = (GObjectClass *) class;
parent_class = g_type_class_peek_parent (class);
object_class->finalize = god_property_table_finalize;
}
GSF_CLASS (GodPropertyTable, god_property_table,
god_property_table_class_init, god_property_table_init,
G_TYPE_OBJECT)
#if 0
/********************************************************************************/
GODrawingPropertyTable *
ms_obj_new (GODrawingPropertyTableAttrBag *attrs)
{
GODrawingPropertyTable *obj = g_new0 (GODrawingPropertyTable, 1);
obj->excel_type = (unsigned)-1; /* Set to undefined */
obj->excel_type_name = NULL;
obj->id = -1;
obj->gnum_obj = NULL;
obj->attrs = (attrs != NULL) ? attrs : ms_obj_attr_bag_new ();
obj->combo_in_autofilter = FALSE;
obj->is_linked = FALSE;
obj->comment_pos.col = obj->comment_pos.row = -1;
return obj;
}
void
ms_obj_delete (GODrawingPropertyTable *obj)
{
if (obj) {
if (obj->gnum_obj) {
g_object_unref (obj->gnum_obj);
obj->gnum_obj = NULL;
}
if (obj->attrs) {
ms_obj_attr_bag_destroy (obj->attrs);
obj->attrs = NULL;
}
g_free (obj);
}
}
/* S59EOE.HTM */
char *
ms_read_TXO (BiffQuery *q)
{
static char const * const orientations [] = {
"Left to right",
"Top to Bottom",
"Bottom to Top on Side",
"Top to Bottom on Side"
};
static char const * const haligns [] = {
"At left", "Horizontaly centered",
"At right", "Horizontaly justified"
};
static char const * const valigns [] = {
"At top", "Verticaly centered",
"At bottom", "Verticaly justified"
};
guint16 const options = GSF_LE_GET_GUINT16 (q->data);
guint16 const orient = GSF_LE_GET_GUINT16 (q->data + 2);
guint16 const text_len = GSF_LE_GET_GUINT16 (q->data + 10);
/* guint16 const num_formats = GSF_LE_GET_GUINT16 (q->data + 12);*/
int const halign = (options >> 1) & 0x7;
int const valign = (options >> 4) & 0x7;
char *text;
guint16 peek_op;
if (text_len == 0)
return NULL;
g_return_val_if_fail (orient <= 3, NULL);
g_return_val_if_fail (1 <= halign && halign <= 4, NULL);
g_return_val_if_fail (1 <= valign && valign <= 4, NULL);
if (ms_biff_query_peek_next (q, &peek_op) && peek_op == BIFF_CONTINUE) {
ms_biff_query_next (q);
if ((int)q->length < text_len) {
g_warning ("Broken continue in TXO record");
text = g_strdup ("Broken continue");
} else
text = ms_biff_get_chars (q->data + 1, text_len,
*(q->data) != 0);
if (ms_biff_query_peek_next (q, &peek_op) &&
peek_op == BIFF_CONTINUE)
ms_biff_query_next (q);
else
g_warning ("Unusual, TXO text with no formatting has 0x%x @ 0x%x", peek_op, q->streamPos);
} else {
if (text_len > 0)
g_warning ("TXO len of %d but no continue", text_len);
text = g_strdup ("");
}
#ifndef NO_DEBUG_EXCEL
if (ms_excel_object_debug > 0) {
printf ("{ TextObject\n");
printf ("Text '%s'\n", text);
printf ("is %s, %s & %s;\n",
orientations[orient], haligns[halign], valigns[valign]);
printf ("}; /* TextObject */\n");
}
#endif
return text;
}
#ifndef NO_DEBUG_EXCEL
#define ms_obj_dump(data, len, data_left, name) ms_obj_dump_impl (data, len, data_left, name)
static void
ms_obj_dump_impl (guint8 const *data, int len, int data_left, char const *name)
{
if (ms_excel_object_debug < 2)
return;
printf ("{ %s \n", name);
if (len+4 > data_left) {
printf ("/* invalid length %d (0x%x) > %d(0x%x)*/\n",
len+4, len+4, data_left, data_left);
len = data_left - 4;
}
if (ms_excel_object_debug > 2)
gsf_mem_dump (data, len+4);
printf ("}; /* %s */\n", name);
}
#else
#define ms_obj_dump (data, len, data_left, name)
#endif
/* S59DAD.HTM */
static gboolean
ms_obj_read_pre_biff8_obj (BiffQuery *q, MSContainer *container, GODrawingPropertyTable *obj)
{
guint16 peek_op, tmp, len;
guint8 const *data;
gboolean const has_fmla = GSF_LE_GET_GUINT16 (q->data+26) != 0;
/* undocumented */
gboolean const has_name = GSF_LE_GET_GUINT16 (q->data+30) != 0;
#if 0
guint16 const flags = GSF_LE_GET_GUINT16(q->data+8);
#endif
guint8 *anchor = g_malloc (MS_ANCHOR_SIZE);
memcpy (anchor, q->data+8, MS_ANCHOR_SIZE);
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_ptr (MS_OBJ_ATTR_ANCHOR, anchor));
obj->excel_type = GSF_LE_GET_GUINT16(q->data + 4);
obj->id = GSF_LE_GET_GUINT32(q->data + 6);
switch (obj->excel_type) {
case 0: /* group */
break;
case 1: /* line */
tmp = GSF_LE_GET_GUINT8 (q->data+40);
if (GSF_LE_GET_GUINT16 (q->data + 10) == 0 &&
GSF_LE_GET_GUINT16 (q->data + 14) < 20) {
g_warning("%hhu", tmp);
}
if (GSF_LE_GET_GUINT8 (q->data+38) & 0x0F)
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_flag (MS_OBJ_ATTR_ARROW_END));
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_FILL_COLOR,
0x80000000 | GSF_LE_GET_GUINT8 (q->data+34)));
if (tmp == 1 || tmp == 2)
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_flag (MS_OBJ_ATTR_FLIP_H));
if (tmp >= 2)
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_flag (MS_OBJ_ATTR_FLIP_V));
break;
case 2: /* rectangle */
break;
case 3: /* oval */
break;
case 4: /* arc */
break;
case 5: /* chart */
break;
case 6: /* textbox */
/* gsf_mem_dump (q->data+34, q->length - 34); */
if (GSF_LE_GET_GUINT8 (q->data+36) > 0) {
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_flag (MS_OBJ_ATTR_FILLED));
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_FILL_COLOR,
0x80000000 | GSF_LE_GET_GUINT8 (q->data+35)));
}
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_FONT_COLOR,
0x80000000 | GSF_LE_GET_GUINT8 (q->data+34)));
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_OUTLINE_COLOR,
0x80000000 | GSF_LE_GET_GUINT8 (q->data+38)));
/* only pull in the text if it exists */
len = GSF_LE_GET_GUINT16 (q->data + 44);
if (len > 0) {
data = q->data + 70;
g_return_val_if_fail ((unsigned)(data - q->data) < q->length, TRUE);
g_return_val_if_fail (!has_fmla, TRUE); /* how would this happen */
/* skip the obj name if defined */
if (has_name) {
data += *data + ((*data & 0x1) ? 1 : 2); /* padding byte */
g_return_val_if_fail ((unsigned)(data - q->data) < q->length, TRUE);
}
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_ptr (MS_OBJ_ATTR_TEXT,
g_strndup (data, len)));
}
break;
case 7: /* button */
break;
case 8: /* picture */
break;
case 9: /* polygon */
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_FILL_COLOR,
0x80000000 | GSF_LE_GET_GUINT8 (q->data+35)));
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_OUTLINE_COLOR,
0x80000000 | GSF_LE_GET_GUINT8 (q->data+38)));
if (ms_biff_query_peek_next (q, &peek_op) &&
peek_op == BIFF_COORDLIST) {
unsigned i, n;
guint tmp;
GArray *array;
ms_biff_query_next (q);
n = q->length / 2;
array = g_array_set_size (
g_array_new (FALSE, FALSE, sizeof (double)), n + 2);
for (i = 0; i < n ; i++) {
tmp = GSF_LE_GET_GUINT16 (q->data + 2*i);
g_array_index (array, double, i) = (double)tmp/ 16384.;
}
g_array_index (array, double, i) = g_array_index (array, double, 0);
g_array_index (array, double, i+1) = g_array_index (array, double, 1);
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_array (MS_OBJ_ATTR_POLYGON_COORDS, array));
}
break;
case 0xB : /* check box */
break;
case 0xC : /* option button */
break;
case 0xD : /* edit box */
break;
case 0xE : /* label */
break;
case 0xF : /* dialog frame */
break;
case 0x10 : /* spinner & scrollbar (layout is the same) */
case 0x11 :
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_SCROLLBAR_VALUE,
GSF_LE_GET_GUINT16 (q->data+48)));
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_SCROLLBAR_MIN,
GSF_LE_GET_GUINT16 (q->data+50)));
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_SCROLLBAR_MAX,
GSF_LE_GET_GUINT16 (q->data+52)));
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_SCROLLBAR_INC,
GSF_LE_GET_GUINT16 (q->data+54)));
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_SCROLLBAR_PAGE,
GSF_LE_GET_GUINT16 (q->data+56)));
{
GnmExpr const *ref;
guint16 len;
guint8 const *last = q->data + q->length;
guint8 const *ptr = q->data + 64;
ptr += 1 + *ptr; /* object name */
if ((ptr - q->data) & 1) ptr++; /* align on word */
if (ptr >= last) break;
ptr += 2 + GSF_LE_GET_GUINT16 (ptr); /* the macro */
if ((ptr - q->data) & 1) ptr++; /* align on word */
if (ptr >= last) break;
len = GSF_LE_GET_GUINT16 (ptr+2); /* the assigned macro */
ref = ms_container_parse_expr (container, ptr + 8, len);
if (ref != NULL)
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_expr (MS_OBJ_ATTR_LINKED_TO_CELL, ref));
}
break;
case 0x12 : /* list box */
break;
case 0x13 : /* group box */
break;
case 0x14 : /* drop down */
obj->combo_in_autofilter =
(GSF_LE_GET_GUINT16 (q->data + 8) & 0x8000) ? TRUE : FALSE;
break;
default :
;
}
return FALSE;
}
/* S59DAD.HTM */
static gboolean
ms_obj_read_biff8_obj (BiffQuery *q, MSContainer *container, GODrawingPropertyTable *obj)
{
guint8 *data;
gint32 data_len_left;
gboolean hit_end = FALSE;
gboolean next_biff_record_maybe_imdata = FALSE;
g_return_val_if_fail (q, TRUE);
g_return_val_if_fail (q->ls_op == BIFF_OBJ, TRUE);
data = q->data;
data_len_left = q->length;
#if 0
ms_biff_query_dump (q);
#endif
/* Scan through the pseudo BIFF substream */
while (data_len_left > 0 && !hit_end) {
guint16 const record_type = GSF_LE_GET_GUINT16(data);
/* All the sub-records seem to have this layout
* 2001/Mar/29 JEG : liars. Ok not all records have this
* layout. Create a list box. It seems to do something
* unique. It acts like an end, and has no length specified.
*/
guint16 len = GSF_LE_GET_GUINT16(data+2);
/* 1st record must be COMMON_OBJ*/
g_return_val_if_fail (obj->excel_type >= 0 ||
record_type == GR_COMMON_OBJ_DATA,
TRUE);
switch (record_type) {
case GR_END:
g_return_val_if_fail (len == 0, TRUE);
/* ms_obj_dump (data, len, data_len_left, "ObjEnd"); */
hit_end = TRUE;
break;
case GR_MACRO :
ms_obj_dump (data, len, data_len_left, "MacroObject");
break;
case GR_COMMAND_BUTTON :
ms_obj_dump (data, len, data_len_left, "CommandButton");
break;
case GR_GROUP :
ms_obj_dump (data, len, data_len_left, "Group");
break;
case GR_CLIPBOARD_FORMAT :
ms_obj_dump (data, len, data_len_left, "ClipboardFmt");
break;
case GR_PICTURE_OPTIONS :
if (len == 2) {
guint16 opt = GSF_LE_GET_GUINT16 (data + 4);
obj->is_linked = (opt & 0x2) ? TRUE : FALSE;
#ifndef NO_DEBUG_EXCEL
if (ms_excel_object_debug >= 1) {
printf ("{ /* PictOpt */\n");
printf ("value = %x;\n", opt);
printf ("}; /* PictOpt */\n");
}
#endif
} else {
/* no docs on this so be careful */
g_warning ("PictOpt record with size other than 2");
}
next_biff_record_maybe_imdata = TRUE;
break;
case GR_PICTURE_FORMULA :
ms_obj_dump (data, len, data_len_left, "PictFormula");
break;
case GR_CHECKBOX_LINK :
ms_obj_dump (data, len, data_len_left, "CheckboxLink");
break;
case GR_RADIO_BUTTON :
ms_obj_dump (data, len, data_len_left, "RadioButton");
break;
case GR_SCROLLBAR :
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_SCROLLBAR_VALUE,
GSF_LE_GET_GUINT16 (data+8)));
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_SCROLLBAR_MIN,
GSF_LE_GET_GUINT16 (data+10)));
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_SCROLLBAR_MAX,
GSF_LE_GET_GUINT16 (data+12)));
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_SCROLLBAR_INC,
GSF_LE_GET_GUINT16 (data+14)));
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_uint (MS_OBJ_ATTR_SCROLLBAR_PAGE,
GSF_LE_GET_GUINT16 (data+16)));
ms_obj_dump (data, len, data_len_left, "ScrollBar");
break;
case GR_NOTE_STRUCTURE :
ms_obj_dump (data, len, data_len_left, "Note");
break;
case GR_SCROLLBAR_FORMULA : {
guint16 const expr_len = GSF_LE_GET_GUINT16 (data+4);
GnmExpr const *ref = ms_container_parse_expr (container, data+10, expr_len);
if (ref != NULL)
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_expr (MS_OBJ_ATTR_LINKED_TO_CELL, ref));
ms_obj_dump (data, len, data_len_left, "ScrollbarFmla");
break;
}
case GR_GROUP_BOX_DATA :
ms_obj_dump (data, len, data_len_left, "GroupBoxData");
break;
case GR_EDIT_CONTROL_DATA :
ms_obj_dump (data, len, data_len_left, "EditCtrlData");
break;
case GR_RADIO_BUTTON_DATA :
ms_obj_dump (data, len, data_len_left, "RadioData");
break;
case GR_CHECKBOX_DATA :
ms_obj_dump (data, len, data_len_left, "CheckBoxData");
break;
case GR_LISTBOX_DATA : {
/* FIXME : find some docs for this
* It seems as if list box data does not conform to
* the docs. It acts like an end and has no size.
*/
hit_end = TRUE;
len = data_len_left - 4;
ms_obj_dump (data, len, data_len_left, "ListBoxData");
break;
}
case GR_CHECKBOX_FORMULA : {
guint16 const expr_len = GSF_LE_GET_GUINT16 (data+4);
GnmExpr const *ref = ms_container_parse_expr (container, data+10, expr_len);
if (ref != NULL)
ms_obj_attr_bag_insert (obj->attrs,
ms_obj_attr_new_expr (MS_OBJ_ATTR_LINKED_TO_CELL, ref));
ms_obj_dump (data, len, data_len_left, "CheckBoxFmla");
break;
}
case GR_COMMON_OBJ_DATA : {
guint16 const options =GSF_LE_GET_GUINT16 (data+8);
/* Multiple objects in 1 record ?? */
g_return_val_if_fail (obj->excel_type == -1, TRUE);
obj->excel_type = GSF_LE_GET_GUINT16(data+4);
obj->id = GSF_LE_GET_GUINT16(data+6);
/* Undocumented. It appears that combos for filters are marked
* with flag 0x100
*/
obj->combo_in_autofilter =
(obj->excel_type == 0x14) && (options & 0x100);
#ifndef NO_DEBUG_EXCEL
/* only print when debug is enabled */
if (ms_excel_object_debug == 0)
break;
printf ("OBJECT TYPE = %d\n", obj->excel_type);
if (options&0x0001)
printf ("Locked;\n");
if (options&0x0010)
printf ("Printable;\n");
if (options&0x2000)
printf ("AutoFilled;\n");
if (options&0x4000)
printf ("AutoLines;\n");
if (ms_excel_object_debug > 4) {
/* According to the docs this should not fail
* but there appears to be a flag at 0x200 for
* scrollbars and 0x100 for combos
* associated with filters.
*/
if ((options & 0x9fee) != 0)
printf ("WARNING : Why is option not 0 (%x)\n",
options & 0x9fee);
}
#endif
}
break;
default:
printf ("ERROR : Unknown Obj record 0x%x len 0x%x dll %d;\n",
record_type, len, data_len_left);
}
if (data_len_left < len+4)
printf ("record len %d (0x%x) > %d\n", len+4, len+4, data_len_left);
/* FIXME : We need a structure akin to the escher code to do this properly */
for (data_len_left -= len+4; data_len_left < 0; ) {
guint16 peek_op;
printf ("deficit of %d\n", data_len_left);
/* FIXME : what do we expect here ??
* I've seen what seem to be embedded drawings
* but I am not sure what is embedding what.
*/
if (!ms_biff_query_peek_next (q, &peek_op) ||
(peek_op != BIFF_CONTINUE &&
peek_op != BIFF_MS_O_DRAWING &&
peek_op != BIFF_TXO &&
peek_op != BIFF_OBJ)) {
printf ("0x%x vs 0x%x\n", q->opcode, peek_op);
return TRUE;
}
ms_biff_query_next (q);
data_len_left += q->length;
printf ("merged in 0x%x with len %d\n", q->opcode, q->length);
}
data = q->data + q->length - data_len_left;
}
/* The ftEnd record should have been the last */
if (data_len_left > 0) {
printf("OBJ : unexpected extra data after Object End record;\n");
gsf_mem_dump (data, data_len_left);
return TRUE;
}
/* Catch underflow too */
g_return_val_if_fail (data_len_left == 0, TRUE);
/* FIXME : Throw away the IMDATA that may follow.
* I am not sure when the IMDATA does follow, or how to display it,
* but very careful in case it is not there.
*/
if (next_biff_record_maybe_imdata) {
guint16 op;
if (ms_biff_query_peek_next (q, &op) && op == BIFF_IMDATA) {
printf ("Reading trailing IMDATA;\n");
ms_biff_query_next (q);
excel_read_IMDATA (q, FALSE);
}
}
return FALSE;
}
/**
* ms_read_OBJ :
* @q : The biff record to start with.
* @container : The object's container
* @attrs : an OPTIONAL hash of object attributes.
*/
void
ms_read_OBJ (BiffQuery *q, MSContainer *container, GODrawingPropertyTableAttrBag *attrs)
{
static char const * const object_type_names[] = {
"Group", /* 0x00 */
"Line", /* 0x01 */
"Rectangle", /* 0x02 */
"Oval", /* 0x03 */
"Arc", /* 0x04 */
"Chart", /* 0x05 */
"TextBox", /* 0x06 */
"Button", /* 0x07 */
"Picture", /* 0x08 */
"Polygon", /* 0x09 */
NULL, /* 0x0A */
"CheckBox", /* 0x0B */
"Option", /* 0x0C */
"Edit", /* 0x0D */
"Label", /* 0x0E */
"Dialog", /* 0x0F */
"Spinner", /* 0x10 */
"Scroll", /* 0x11 */
"List", /* 0x12 */
"Group", /* 0x13 */
"Combo", /* 0x14 */
NULL, NULL, NULL, NULL, /* 0x15 - 0x18 */
"Comment", /* 0x19 */
NULL, NULL, NULL, NULL, /* 0x1A - 0x1D */
"MS Drawing" /* 0x1E */
};
gboolean errors;
GODrawingPropertyTable *obj = ms_obj_new (attrs);
#ifndef NO_DEBUG_EXCEL
if (ms_excel_object_debug > 0)
printf ("{ /* OBJ start */\n");
#endif
errors = (container->ver >= MS_BIFF_V8)
? ms_obj_read_biff8_obj (q, container, obj)
: ms_obj_read_pre_biff8_obj (q, container, obj);
if (errors) {
#ifndef NO_DEBUG_EXCEL
if (ms_excel_object_debug > 0)
printf ("}; /* OBJ error 1 */\n");
#endif
ms_obj_delete (obj);
return;
}
obj->excel_type_name = NULL;
if (obj->excel_type < (int)G_N_ELEMENTS (object_type_names))
obj->excel_type_name = object_type_names [obj->excel_type];
if (obj->excel_type_name == NULL)
obj->excel_type_name = "Unknown";
#ifndef NO_DEBUG_EXCEL
if (ms_excel_object_debug > 0) {
printf ("Object (%d) is a '%s'\n", obj->id, obj->excel_type_name);
printf ("}; /* OBJ end */\n");
}
#endif
if (container->vtbl->create_obj != NULL)
obj->gnum_obj = (*container->vtbl->create_obj) (container, obj);
/* Chart, There should be a BOF next */
if (obj->excel_type == 0x5 &&
ms_excel_chart_read_BOF (q, container, obj->gnum_obj)) {
ms_obj_delete (obj);
return;
}
#if 0
g_warning ("registered obj %d\n", obj->id);
#endif
ms_container_add_obj (container, obj);
}
#endif

View File

@@ -0,0 +1,174 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/**
* god-property-table.h: MS Office Graphic Object support
*
* Author:
* Michael Meeks (michael@ximian.com)
* Jody Goldberg (jody@gnome.org)
* Christopher James Lahey <clahey@ximian.com>
*
* (C) 1998-2003 Michael Meeks, Jody Goldberg, Chris Lahey
**/
#ifndef GOD_PROPERTY_TABLE_H
#define GOD_PROPERTY_TABLE_H
#include <glib-object.h>
#include <glib.h>
#include <utils/go-units.h>
#include <pango/pango-attributes.h>
G_BEGIN_DECLS
#define GOD_PROPERTY_TABLE_TYPE (god_property_table_get_type ())
#define GOD_PROPERTY_TABLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOD_PROPERTY_TABLE_TYPE, GodPropertyTable))
#define GOD_PROPERTY_TABLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GOD_PROPERTY_TABLE_TYPE, GodClassPropertyTable))
#define IS_GOD_PROPERTY_TABLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOD_PROPERTY_TABLE_TYPE))
#define IS_GOD_PROPERTY_TABLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GOD_PROPERTY_TABLE_TYPE))
typedef struct GodPropertyTablePrivate_ GodPropertyTablePrivate;
typedef struct {
GObject parent;
GodPropertyTablePrivate *priv;
} GodPropertyTable;
typedef struct {
GObjectClass parent_class;
} GodPropertyTableClass;
/* Flags */
#define GOD_PROPERTY_FLIP_H "flip_h"
#define GOD_PROPERTY_FLIP_V "flip_v"
#define GOD_PROPERTY_FILLED "filled"
#define GOD_PROPERTY_BACKGROUND "background"
/* will be enums when we support multiple "arrow shapes */
#define GOD_PROPERTY_ARROW_START "arrow_start"
#define GOD_PROPERTY_ARROW_END "arrow_end"
/* Integers & Enums */
#define GOD_PROPERTY_BLIP_ID "blip_id"
#define GOD_PROPERTY_FONT_COLOR "font_color"
#define GOD_PROPERTY_FILL_TYPE "fill_type"
#define GOD_PROPERTY_FILL_SHADE_TYPE "fill_shade_type"
#define GOD_PROPERTY_FILL_ANGLE "fill_angle"
#define GOD_PROPERTY_FILL_FOCUS "fill_focus"
#define GOD_PROPERTY_FILL_COLOR "fill_color"
#define GOD_PROPERTY_FILL_ALPHA "fill_alpha"
#define GOD_PROPERTY_FILL_PRESET "fill_preset"
#define GOD_PROPERTY_FILL_BACKGROUND "fill_background"
#define GOD_PROPERTY_FILL_BACKGROUND_ALPHA "fill_background_alpha"
#define GOD_PROPERTY_OUTLINE_COLOR "outline_color"
#define GOD_PROPERTY_OUTLINE_WIDTH "outline_width"
#define GOD_PROPERTY_OUTLINE_STYLE "outline_style"
#define GOD_PROPERTY_SCROLLBAR_VALUE "scrollbar_value"
#define GOD_PROPERTY_SCROLLBAR_MIN "scrollbar_min"
#define GOD_PROPERTY_SCROLLBAR_MAX "scrollbar_max"
#define GOD_PROPERTY_SCROLLBAR_INC "scrollbar_inc"
#define GOD_PROPERTY_SCROLLBAR_PAGE "scrollbar_page"
#define GOD_PROPERTY_BLIP_CROP_TOP "blip_crop_top"
#define GOD_PROPERTY_BLIP_CROP_BOTTOM "blip_crop_bottom"
#define GOD_PROPERTY_BLIP_CROP_LEFT "blip_crop_left"
#define GOD_PROPERTY_BLIP_CROP_RIGHT "blip_crop_right"
#define GOD_PROPERTY_LTXID "ltxid"
#define GOD_PROPERTY_DX_TEXT_LEFT "dx_text_left"
#define GOD_PROPERTY_DX_TEXT_TOP "dx_text_top"
#define GOD_PROPERTY_DX_TEXT_RIGHT "dx_text_right"
#define GOD_PROPERTY_DX_TEXT_BOTTOM "dx_text_bottom"
#define GOD_PROPERTY_FILL_RECT_LEFT "fill_rect_left"
#define GOD_PROPERTY_FILL_RECT_TOP "fill_rect_top"
#define GOD_PROPERTY_FILL_RECT_RIGHT "fill_rect_right"
#define GOD_PROPERTY_FILL_RECT_BOTTOM "fill_rect_bottom"
/* Ptrs */
#define GOD_PROPERTY_ANCHOR "anchor"
#define GOD_PROPERTY_TEXT "text"
/* GArrays */
#define GOD_PROPERTY_POLYGON_COORDS "polygon_coords"
/* Expressions */
#define GOD_PROPERTY_CHECKBOX_LINK "checkbox_link"
#define GOD_PROPERTY_SCROLLBAR_LINK "scrollbar_link"
/* PangoAttrList */
#define GOD_PROPERTY_MARKUP "markup"
typedef enum {
GOD_FILL_TYPE_SOLID,
GOD_FILL_TYPE_PATTERN,
GOD_FILL_TYPE_TEXTURE,
GOD_FILL_TYPE_PICTURE,
GOD_FILL_TYPE_SHADE,
GOD_FILL_TYPE_SHADE_CENTER,
GOD_FILL_TYPE_SHADE_SHAPE,
GOD_FILL_TYPE_SHADE_SCALE,
GOD_FILL_TYPE_SHADE_TITLE,
GOD_FILL_TYPE_SHADE_BACKGROUND
} GodFillType;
typedef const char *GodPropertyID;
GType god_property_table_get_type (void);
/* Base methods */
void god_property_table_set (GodPropertyTable *attrs,
GodPropertyID id,
GValue *attr);
GValue *god_property_table_get (GodPropertyTable *table,
GodPropertyID id);
/* Set methods */
void god_property_table_set_flag (GodPropertyTable *table,
GodPropertyID id,
gboolean val);
void god_property_table_set_uint (GodPropertyTable *table,
GodPropertyID id,
guint32 val);
void god_property_table_set_int (GodPropertyTable *table,
GodPropertyID id,
gint32 val);
void god_property_table_set_length (GodPropertyTable *table,
GodPropertyID id,
go_unit_t val);
void god_property_table_set_pointer (GodPropertyTable *table,
GodPropertyID id,
gpointer val);
void god_property_table_set_array (GodPropertyTable *table,
GodPropertyID id,
GArray *array);
void god_property_table_set_markup (GodPropertyTable *table,
GodPropertyID id,
PangoAttrList *list);
/* Get methods */
gboolean god_property_table_get_flag (GodPropertyTable *table,
GodPropertyID id,
gboolean default_value);
guint32 god_property_table_get_uint (GodPropertyTable *table,
GodPropertyID id,
guint32 default_value);
gint32 god_property_table_get_int (GodPropertyTable *table,
GodPropertyID id,
gint32 default_value);
go_unit_t god_property_table_get_length (GodPropertyTable *table,
GodPropertyID id,
go_unit_t default_value);
gpointer god_property_table_get_pointer (GodPropertyTable *table,
GodPropertyID id,
gpointer default_value);
GArray *god_property_table_get_array (GodPropertyTable *table,
GodPropertyID id,
GArray *default_value);
PangoAttrList *god_property_table_get_markup (GodPropertyTable *table,
GodPropertyID id,
PangoAttrList *default_value);
/* Allocation */
GodPropertyTable *god_property_table_new (void);
G_END_DECLS
#endif /* GOD_PROPERTY_TABLE_H */

Some files were not shown because too many files have changed in this diff Show More