From: ellson Date: Thu, 30 Jul 2009 16:45:29 +0000 (+0000) Subject: add a demo of an independently packaged and compiled plugin X-Git-Tag: LAST_LIBGRAPH~32^2~1778 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=81991d33a537d20fb19485e93318af68839aa327;p=graphviz add a demo of an independently packaged and compiled plugin --- diff --git a/plugin.demo/xgtk/AUTHORS b/plugin.demo/xgtk/AUTHORS new file mode 100644 index 000000000..e69de29bb diff --git a/plugin.demo/xgtk/COPYING b/plugin.demo/xgtk/COPYING new file mode 100644 index 000000000..c9990a7ea --- /dev/null +++ b/plugin.demo/xgtk/COPYING @@ -0,0 +1,213 @@ +Common Public License Version 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC +LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM +CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + + a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and + + b) in the case of each subsequent Contributor: + + i) changes to the Program, and + + ii) additions to the Program; + + where such changes and/or additions to the Program originate from and are +distributed by that particular Contributor. A Contribution 'originates' from a +Contributor if it was added to the Program by such Contributor itself or anyone +acting on such Contributor's behalf. Contributions do not include additions to +the Program which: (i) are separate modules of software distributed in +conjunction with the Program under their own license agreement, and (ii) are not +derivative works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor which are +necessarily infringed by the use or sale of its Contribution alone or when +combined with the Program. + +"Program" means the Contributions distributed in accordance with this Agreement. + +"Recipient" means anyone who receives the Program under this Agreement, +including all Contributors. + +2. GRANT OF RIGHTS + + a) Subject to the terms of this Agreement, each Contributor hereby grants +Recipient a non-exclusive, worldwide, royalty-free copyright license to +reproduce, prepare derivative works of, publicly display, publicly perform, +distribute and sublicense the Contribution of such Contributor, if any, and such +derivative works, in source code and object code form. + + b) Subject to the terms of this Agreement, each Contributor hereby grants +Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed +Patents to make, use, sell, offer to sell, import and otherwise transfer the +Contribution of such Contributor, if any, in source code and object code form. +This patent license shall apply to the combination of the Contribution and the +Program if, at the time the Contribution is added by the Contributor, such +addition of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other combinations +which include the Contribution. No hardware per se is licensed hereunder. + + c) Recipient understands that although each Contributor grants the licenses +to its Contributions set forth herein, no assurances are provided by any +Contributor that the Program does not infringe the patent or other intellectual +property rights of any other entity. Each Contributor disclaims any liability to +Recipient for claims brought by any other entity based on infringement of +intellectual property rights or otherwise. As a condition to exercising the +rights and licenses granted hereunder, each Recipient hereby assumes sole +responsibility to secure any other intellectual property rights needed, if any. +For example, if a third party patent license is required to allow Recipient to +distribute the Program, it is Recipient's responsibility to acquire that license +before distributing the Program. + + d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright license set +forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under its +own license agreement, provided that: + + a) it complies with the terms and conditions of this Agreement; and + + b) its license agreement: + + i) effectively disclaims on behalf of all Contributors all warranties and +conditions, express and implied, including warranties or conditions of title and +non-infringement, and implied warranties or conditions of merchantability and +fitness for a particular purpose; + + ii) effectively excludes on behalf of all Contributors all liability for +damages, including direct, indirect, special, incidental and consequential +damages, such as lost profits; + + iii) states that any provisions which differ from this Agreement are offered +by that Contributor alone and not by any other party; and + + iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable manner on or +through a medium customarily used for software exchange. + +When the Program is made available in source code form: + + a) it must be made available under this Agreement; and + + b) a copy of this Agreement must be included with each copy of the Program. + +Contributors may not remove or alter any copyright notices contained within the +Program. + +Each Contributor must identify itself as the originator of its Contribution, if +any, in a manner that reasonably allows subsequent Recipients to identify the +originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with +respect to end users, business partners and the like. While this license is +intended to facilitate the commercial use of the Program, the Contributor who +includes the Program in a commercial product offering should do so in a manner +which does not create potential liability for other Contributors. Therefore, if +a Contributor includes the Program in a commercial product offering, such +Contributor ("Commercial Contributor") hereby agrees to defend and indemnify +every other Contributor ("Indemnified Contributor") against any losses, damages +and costs (collectively "Losses") arising from claims, lawsuits and other legal +actions brought by a third party against the Indemnified Contributor to the +extent caused by the acts or omissions of such Commercial Contributor in +connection with its distribution of the Program in a commercial product +offering. The obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. In order +to qualify, an Indemnified Contributor must: a) promptly notify the Commercial +Contributor in writing of such claim, and b) allow the Commercial Contributor to +control, and cooperate with the Commercial Contributor in, the defense and any +related settlement negotiations. The Indemnified Contributor may participate in +any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial product +offering, Product X. That Contributor is then a Commercial Contributor. If that +Commercial Contributor then makes performance claims, or offers warranties +related to Product X, those performance claims and warranties are such +Commercial Contributor's responsibility alone. Under this section, the +Commercial Contributor would have to defend claims against the other +Contributors related to those performance claims and warranties, and if a court +requires any other Contributor to pay any damages as a result, the Commercial +Contributor must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR +IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, +NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each +Recipient is solely responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its exercise of +rights under this Agreement, including but not limited to the risks and costs of +program errors, compliance with applicable laws, damage to or loss of data, +programs or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY +CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST +PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS +GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under applicable +law, it shall not affect the validity or enforceability of the remainder of the +terms of this Agreement, and without further action by the parties hereto, such +provision shall be reformed to the minimum extent necessary to make such +provision valid and enforceable. + +If Recipient institutes patent litigation against a Contributor with respect to +a patent applicable to software (including a cross-claim or counterclaim in a +lawsuit), then any patent licenses granted by that Contributor to such Recipient +under this Agreement shall terminate as of the date such litigation is filed. In +addition, if Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that the Program +itself (excluding combinations of the Program with other software or hardware) +infringes such Recipient's patent(s), then such Recipient's rights granted under +Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to +comply with any of the material terms or conditions of this Agreement and does +not cure such failure in a reasonable period of time after becoming aware of +such noncompliance. If all Recipient's rights under this Agreement terminate, +Recipient agrees to cease use and distribution of the Program as soon as +reasonably practicable. However, Recipient's obligations under this Agreement +and any licenses granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in +order to avoid inconsistency the Agreement is copyrighted and may only be +modified in the following manner. The Agreement Steward reserves the right to +publish new versions (including revisions) of this Agreement from time to time. +No one other than the Agreement Steward has the right to modify this Agreement. +IBM is the initial Agreement Steward. IBM may assign the responsibility to serve +as the Agreement Steward to a suitable separate entity. Each new version of the +Agreement will be given a distinguishing version number. The Program (including +Contributions) may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the Agreement +is published, Contributor may elect to distribute the Program (including its +Contributions) under the new version. Except as expressly stated in Sections +2(a) and 2(b) above, Recipient receives no rights or licenses to the +intellectual property of any Contributor under this Agreement, whether +expressly, by implication, estoppel or otherwise. All rights in the Program not +expressly granted under this Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and the +intellectual property laws of the United States of America. No party to this +Agreement will bring a legal action under this Agreement more than one year +after the cause of action arose. Each party waives its rights to a jury trial in +any resulting litigation. diff --git a/plugin.demo/xgtk/ChangeLog b/plugin.demo/xgtk/ChangeLog new file mode 100644 index 000000000..e69de29bb diff --git a/plugin.demo/xgtk/Makefile.am b/plugin.demo/xgtk/Makefile.am new file mode 100644 index 000000000..2d304a7f7 --- /dev/null +++ b/plugin.demo/xgtk/Makefile.am @@ -0,0 +1,3 @@ +ACLOCAL_AMFLAGS = -I m4 + +SUBDIRS=src diff --git a/plugin.demo/xgtk/NEWS b/plugin.demo/xgtk/NEWS new file mode 100644 index 000000000..e69de29bb diff --git a/plugin.demo/xgtk/README b/plugin.demo/xgtk/README new file mode 100644 index 000000000..e69de29bb diff --git a/plugin.demo/xgtk/autogen.sh b/plugin.demo/xgtk/autogen.sh new file mode 100755 index 000000000..2c71aca6f --- /dev/null +++ b/plugin.demo/xgtk/autogen.sh @@ -0,0 +1,27 @@ +#! /bin/sh + +# autoregen doesn't run libtoolize with --ltdl on older systems, so force it + +LIBTOOLIZE=libtoolize +if test -x /opt/local/bin/glibtoolize; then + LIBTOOLIZE=/opt/local/bin/glibtoolize +fi +export LIBTOOLIZE + +echo "autogen.sh: running: $LIBTOOLIZE --copy --force --ltdl" +$LIBTOOLIZE --copy --force --ltdl + +autoreconf -v --install --force || exit 1 + +# ensure config/depcomp exists even if still using automake-1.4 +# otherwise "make dist" fails. +touch config/depcomp + +# ensure COPYING is based on cpl1.0.txt +# cpl1.0.txt was obtained from: http://www.opensource.org/licenses/cpl1.0.txt +rm -f COPYING +cp cpl1.0.txt COPYING + +# don't use any old cache, but create a new one +rm -f config.cache +./configure -C "$@" diff --git a/plugin.demo/xgtk/configure.ac b/plugin.demo/xgtk/configure.ac new file mode 100644 index 000000000..f55ccbb30 --- /dev/null +++ b/plugin.demo/xgtk/configure.ac @@ -0,0 +1,78 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ([2.63]) +AC_INIT([graphviz], [0.1], [ellson@research.att.com]) +AC_CONFIG_SRCDIR([src/gvplugin_gtk.c]) +AC_CONFIG_AUX_DIR([config]) +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_MACRO_DIR([m4]) + +AM_INIT_AUTOMAKE + +# Checks for programs. +AC_PROG_CC +AC_PROG_LIBTOOL +PKG_PROG_PKG_CONFIG + +# Checks for libraries. + +dnl ----------------------------------- +dnl INCLUDES and LIBS for GVC. + +AC_ARG_WITH(gvc, + [AS_HELP_STRING([--with-gvc=yes],[gvc library])], + [], [with_gvc=yes]) + +if test "x$with_gvc" != "xyes"; then + use_gvc="No (disabled)" +else + PKG_CHECK_MODULES(GVC, [libgvc],[ + use_gvc="Yes" + AC_DEFINE_UNQUOTED(HAVE_GVC,1, + [Define if you have the gvc library]) + AC_SUBST(GVC_CFLAGS) + AC_SUBST(GVC_LIBS) + ],[ + use_gvc="No (gvc library not available)" + ]) +fi +AM_CONDITIONAL(WITH_GVC, [test "x$use_gvc" = "xYes"]) + +# FIXME - this should be automatically obtained +GVPLUGIN_VERSION_INFO='6:0:0' +AC_SUBST(GVPLUGIN_VERSION_INFO) + +dnl ----------------------------------- +dnl INCLUDES and LIBS for GTK. + +AC_ARG_WITH(gtk, + [AS_HELP_STRING([--with-gtk=yes],[gtk+ library])], + [], [with_gtk=yes]) + +if test "x$with_gtk" != "xyes"; then + use_gtk="No (disabled)" +else + PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.7.0],[ + use_gtk="Yes" + AC_DEFINE_UNQUOTED(HAVE_GTK,1, + [Define if you have the gtk library]) + AC_SUBST(GTK_CFLAGS) + AC_SUBST(GTK_LIBS) + ],[ + use_gtk="No (gtk library not available)" + ]) +fi +AM_CONDITIONAL(WITH_GTK, [test "x$use_gtk" = "xYes"]) + + +# Checks for header files. +AC_PATH_X +AC_CHECK_HEADERS([inttypes.h libintl.h stdint.h string.h unistd.h]) + +# Checks for typedefs, structures, and compiler characteristics. + +# Checks for library functions. + +AC_CONFIG_FILES([Makefile src/Makefile]) +AC_OUTPUT diff --git a/plugin.demo/xgtk/cpl1.0.txt b/plugin.demo/xgtk/cpl1.0.txt new file mode 100644 index 000000000..c9990a7ea --- /dev/null +++ b/plugin.demo/xgtk/cpl1.0.txt @@ -0,0 +1,213 @@ +Common Public License Version 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC +LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM +CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + + a) in the case of the initial Contributor, the initial code and +documentation distributed under this Agreement, and + + b) in the case of each subsequent Contributor: + + i) changes to the Program, and + + ii) additions to the Program; + + where such changes and/or additions to the Program originate from and are +distributed by that particular Contributor. A Contribution 'originates' from a +Contributor if it was added to the Program by such Contributor itself or anyone +acting on such Contributor's behalf. Contributions do not include additions to +the Program which: (i) are separate modules of software distributed in +conjunction with the Program under their own license agreement, and (ii) are not +derivative works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor which are +necessarily infringed by the use or sale of its Contribution alone or when +combined with the Program. + +"Program" means the Contributions distributed in accordance with this Agreement. + +"Recipient" means anyone who receives the Program under this Agreement, +including all Contributors. + +2. GRANT OF RIGHTS + + a) Subject to the terms of this Agreement, each Contributor hereby grants +Recipient a non-exclusive, worldwide, royalty-free copyright license to +reproduce, prepare derivative works of, publicly display, publicly perform, +distribute and sublicense the Contribution of such Contributor, if any, and such +derivative works, in source code and object code form. + + b) Subject to the terms of this Agreement, each Contributor hereby grants +Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed +Patents to make, use, sell, offer to sell, import and otherwise transfer the +Contribution of such Contributor, if any, in source code and object code form. +This patent license shall apply to the combination of the Contribution and the +Program if, at the time the Contribution is added by the Contributor, such +addition of the Contribution causes such combination to be covered by the +Licensed Patents. The patent license shall not apply to any other combinations +which include the Contribution. No hardware per se is licensed hereunder. + + c) Recipient understands that although each Contributor grants the licenses +to its Contributions set forth herein, no assurances are provided by any +Contributor that the Program does not infringe the patent or other intellectual +property rights of any other entity. Each Contributor disclaims any liability to +Recipient for claims brought by any other entity based on infringement of +intellectual property rights or otherwise. As a condition to exercising the +rights and licenses granted hereunder, each Recipient hereby assumes sole +responsibility to secure any other intellectual property rights needed, if any. +For example, if a third party patent license is required to allow Recipient to +distribute the Program, it is Recipient's responsibility to acquire that license +before distributing the Program. + + d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright license set +forth in this Agreement. + +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under its +own license agreement, provided that: + + a) it complies with the terms and conditions of this Agreement; and + + b) its license agreement: + + i) effectively disclaims on behalf of all Contributors all warranties and +conditions, express and implied, including warranties or conditions of title and +non-infringement, and implied warranties or conditions of merchantability and +fitness for a particular purpose; + + ii) effectively excludes on behalf of all Contributors all liability for +damages, including direct, indirect, special, incidental and consequential +damages, such as lost profits; + + iii) states that any provisions which differ from this Agreement are offered +by that Contributor alone and not by any other party; and + + iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable manner on or +through a medium customarily used for software exchange. + +When the Program is made available in source code form: + + a) it must be made available under this Agreement; and + + b) a copy of this Agreement must be included with each copy of the Program. + +Contributors may not remove or alter any copyright notices contained within the +Program. + +Each Contributor must identify itself as the originator of its Contribution, if +any, in a manner that reasonably allows subsequent Recipients to identify the +originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with +respect to end users, business partners and the like. While this license is +intended to facilitate the commercial use of the Program, the Contributor who +includes the Program in a commercial product offering should do so in a manner +which does not create potential liability for other Contributors. Therefore, if +a Contributor includes the Program in a commercial product offering, such +Contributor ("Commercial Contributor") hereby agrees to defend and indemnify +every other Contributor ("Indemnified Contributor") against any losses, damages +and costs (collectively "Losses") arising from claims, lawsuits and other legal +actions brought by a third party against the Indemnified Contributor to the +extent caused by the acts or omissions of such Commercial Contributor in +connection with its distribution of the Program in a commercial product +offering. The obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. In order +to qualify, an Indemnified Contributor must: a) promptly notify the Commercial +Contributor in writing of such claim, and b) allow the Commercial Contributor to +control, and cooperate with the Commercial Contributor in, the defense and any +related settlement negotiations. The Indemnified Contributor may participate in +any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial product +offering, Product X. That Contributor is then a Commercial Contributor. If that +Commercial Contributor then makes performance claims, or offers warranties +related to Product X, those performance claims and warranties are such +Commercial Contributor's responsibility alone. Under this section, the +Commercial Contributor would have to defend claims against the other +Contributors related to those performance claims and warranties, and if a court +requires any other Contributor to pay any damages as a result, the Commercial +Contributor must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR +IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, +NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each +Recipient is solely responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its exercise of +rights under this Agreement, including but not limited to the risks and costs of +program errors, compliance with applicable laws, damage to or loss of data, +programs or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY +CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST +PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS +GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under applicable +law, it shall not affect the validity or enforceability of the remainder of the +terms of this Agreement, and without further action by the parties hereto, such +provision shall be reformed to the minimum extent necessary to make such +provision valid and enforceable. + +If Recipient institutes patent litigation against a Contributor with respect to +a patent applicable to software (including a cross-claim or counterclaim in a +lawsuit), then any patent licenses granted by that Contributor to such Recipient +under this Agreement shall terminate as of the date such litigation is filed. In +addition, if Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that the Program +itself (excluding combinations of the Program with other software or hardware) +infringes such Recipient's patent(s), then such Recipient's rights granted under +Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to +comply with any of the material terms or conditions of this Agreement and does +not cure such failure in a reasonable period of time after becoming aware of +such noncompliance. If all Recipient's rights under this Agreement terminate, +Recipient agrees to cease use and distribution of the Program as soon as +reasonably practicable. However, Recipient's obligations under this Agreement +and any licenses granted by Recipient relating to the Program shall continue and +survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in +order to avoid inconsistency the Agreement is copyrighted and may only be +modified in the following manner. The Agreement Steward reserves the right to +publish new versions (including revisions) of this Agreement from time to time. +No one other than the Agreement Steward has the right to modify this Agreement. +IBM is the initial Agreement Steward. IBM may assign the responsibility to serve +as the Agreement Steward to a suitable separate entity. Each new version of the +Agreement will be given a distinguishing version number. The Program (including +Contributions) may always be distributed subject to the version of the Agreement +under which it was received. In addition, after a new version of the Agreement +is published, Contributor may elect to distribute the Program (including its +Contributions) under the new version. Except as expressly stated in Sections +2(a) and 2(b) above, Recipient receives no rights or licenses to the +intellectual property of any Contributor under this Agreement, whether +expressly, by implication, estoppel or otherwise. All rights in the Program not +expressly granted under this Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and the +intellectual property laws of the United States of America. No party to this +Agreement will bring a legal action under this Agreement more than one year +after the cause of action arose. Each party waives its rights to a jury trial in +any resulting litigation. diff --git a/plugin.demo/xgtk/src/Makefile.am b/plugin.demo/xgtk/src/Makefile.am new file mode 100644 index 000000000..42869a0a6 --- /dev/null +++ b/plugin.demo/xgtk/src/Makefile.am @@ -0,0 +1,27 @@ +## Process this file with automake to produce Makefile.in + +ACLOCAL_AMFLAGS = -I m4 + +AM_CPPFLAGS = $(GVC_CFLAGS) $(GTK_CFLAGS) + +noinst_HEADERS = support.h interface.h callbacks.h +noinst_LTLIBRARIES = libgvplugin_gtk_C.la +pkglib_LTLIBRARIES = libgvplugin_gtk.la + +libgvplugin_gtk_C_la_SOURCES = \ + gvplugin_gtk.c \ + gvdevice_gtk.c \ + support.c \ + interface.c \ + callbacks.c + +libgvplugin_gtk_la_LDFLAGS = -version-info @GVPLUGIN_VERSION_INFO@ +libgvplugin_gtk_la_SOURCES = $(libgvplugin_gtk_C_la_SOURCES) +libgvplugin_gtk_la_LIBADD = $(GTK_LIBS) + +EXTRA_DIST = gtk.glade gtk.gladep + +# run "dot -c", if possible, to create plugin config +install-exec-hook: + if test "x$(DESTDIR)" = "x"; then if test -x $(bindir)/dot$(EXEEXT); then if test -x /sbin/ldconfig; then /sbin/ldconfig 2>/dev/null; fi; $(bindir)/dot$(EXEEXT) -c; else $(bindir)/dot_static$(EXEEXT) -c; fi; fi +# diff --git a/plugin.demo/xgtk/src/callbacks.c b/plugin.demo/xgtk/src/callbacks.c new file mode 100644 index 000000000..bad425012 --- /dev/null +++ b/plugin.demo/xgtk/src/callbacks.c @@ -0,0 +1,440 @@ +/* $Id$ $Revision$ */ +/* vim:set shiftwidth=4 ts=8: */ + +/********************************************************** +* This software is part of the graphviz package * +* http://www.graphviz.org/ * +* * +* Copyright (c) 1994-2004 AT&T Corp. * +* and is licensed under the * +* Common Public License, Version 1.0 * +* by AT&T Corp. * +* * +* Information and Software Systems Research * +* AT&T Research, Florham Park NJ * +**********************************************************/ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#include "gvplugin_device.h" + +#include "callbacks.h" +#include "interface.h" +#include "support.h" + +void +on_new1_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + GtkWindow *window1; + GVJ_t *job; + + window1 = GTK_WINDOW(menuitem); + job = g_object_get_data(G_OBJECT(window1), "job"); + + (job->callbacks->read)(job, NULL, "dot"); + + // should there be specific menus for (un)directed graphs etc? + // - I think the directed flag only affects layout and rendering + // so I plan to make it look like a graph attribute. + // Similarly "strict". +} + +static void +ui_open_graph(GtkWindow *window1, gchar *filename) +{ + GVJ_t *job; + GtkWidget *dialog; + + job = g_object_get_data(G_OBJECT(window1), "job"); + dialog = gtk_file_chooser_dialog_new( + "Open graph", window1, GTK_FILE_CHOOSER_ACTION_OPEN, + "Cancel", GTK_RESPONSE_CANCEL, + "Open", GTK_RESPONSE_ACCEPT, + NULL); + if (filename) + gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), filename); + if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) + filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); + gtk_widget_destroy(dialog); + if (filename) { + (job->callbacks->read)(job, filename, "dot"); +// if (!file) // we'll probably want to create a error dialog function +// fprintf(stderr, "Could not open file: %s\n", filename); +// else + g_object_set_data_full(G_OBJECT(window1), + "activefilename", filename, (GDestroyNotify)g_free); + } +} + +void +on_open1_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + GtkWindow *window1; + gchar *filename; + + window1 = GTK_WINDOW(menuitem); + filename = g_object_get_data(G_OBJECT(window1), "activefilename"); + ui_open_graph(window1, filename); +} + +static void +ui_save_graph(GtkWindow *window1, gchar *filename) +{ + GVJ_t *job; + GtkWidget *dialog; + + job = (GVJ_t *)g_object_get_data(G_OBJECT(window1), "job"); + + dialog = gtk_file_chooser_dialog_new( + "Save graph as", window1, GTK_FILE_CHOOSER_ACTION_SAVE, + "Cancel", GTK_RESPONSE_CANCEL, + "Save", GTK_RESPONSE_ACCEPT, + NULL); + filename = g_object_get_data(G_OBJECT(window1), "activefilename"); + if (filename) + gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), filename); + if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) + filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); + gtk_widget_destroy(dialog); + if (filename) { + (job->callbacks->render)(job, "dot", filename); + g_object_set_data_full(G_OBJECT(window1), + "activefilename", filename, (GDestroyNotify)g_free); + } +} + +void +on_save1_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + GtkWindow *window1; + gchar *filename; + + window1 = GTK_WINDOW(menuitem); + filename = (gchar *)g_object_get_data(G_OBJECT(window1), "activefilename"); + ui_save_graph(window1, filename); +} + + +void +on_save_as1_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + GtkWindow *window1; + + window1 = GTK_WINDOW(menuitem); + ui_save_graph(window1, NULL); +} + + +void +on_quit1_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + gtk_widget_destroy(GTK_WIDGET(gtk_widget_get_toplevel(GTK_WIDGET(menuitem)))); + gtk_main_quit(); +} + + +void +on_cut1_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + // I am thinking that we will annotate a node as to whether it is selected, + // then retrieve a list of selected nodes for these operations +} + + +void +on_copy1_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_paste1_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_delete1_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_about1_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + static gchar *authors[] = { + "John Ellson", + "Emden Gansner", + "Stephen North", + "special thanks to Michael Lawrence", + NULL }; + GtkWindow *window = GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(menuitem))); + gtk_show_about_dialog(window, + "name", "DotEdit", + "version", "0.1", + "copyright", "(C) 2005 AT&T Corp.", + "license", "Common Public License, Version 1.0.", + "website", "http://www.graphviz.org", + "comments", "Visualize and edit graphs of nodes and edges", + "authors", authors, + NULL); +} + +static void +load_store_with_attrs(GtkListStore *model, GVJ_t *job) +{ +#if 0 + gint attrs_len = job->selected_obj_attributes.argc, i; + gchar **attrs = job->selected_obj_attributes.argv; + GtkTreeIter iter; + gvattr_t type; +#endif + + gtk_list_store_clear(model); + +#if 0 + for (i = 0; i < attrs_len; i+=3) { + gtk_list_store_append(model, &iter); + gtk_list_store_set(model, &iter, 0, attrs[i], 1, g_strdup(attrs[i+1]), -1); + type = (gvattr_t)attrs[i+2]; + } +#endif +} + + +gboolean +on_drawingarea1_expose_event (GtkWidget *widget, + GdkEventExpose *event, + gpointer user_data) +{ + GVJ_t *job; + cairo_t *cr; + + job = (GVJ_t *)g_object_get_data(G_OBJECT(widget),"job"); + cr = gdk_cairo_create(widget->window); + + (job->callbacks->motion)(job, job->pointer); + + job->context = (void *)cr; + job->external_context = TRUE; + job->width = widget->allocation.width; + job->height = widget->allocation.height; + if (job->has_been_rendered) { + (job->callbacks->refresh)(job); + } + else { + (job->callbacks->refresh)(job); + +// FIXME - copy image to keyhole +// the keyhole image is a fixed size and doesn;t need to be recomputed +// each time. save a pixmap, then each time, show pixmap and overlay +// with scaled view rectangle. + + } + cairo_destroy(cr); + + load_store_with_attrs(GTK_LIST_STORE(g_object_get_data(G_OBJECT(widget), "attr_store")), job); + + return FALSE; +} + + +gboolean +on_drawingarea1_motion_notify_event (GtkWidget *widget, + GdkEventMotion *event, + gpointer user_data) +{ + GVJ_t *job; + + job = (GVJ_t *)g_object_get_data(G_OBJECT(widget),"job"); + job->pointer.x = event->x; + job->pointer.y = event->y; + gtk_widget_queue_draw(widget); + +#if 0 + if (job->active_tooltip && job->active_tooltip[0]) + fprintf(stderr,"tooltip = \"%s\"\n", job->active_tooltip); +#endif + + return FALSE; +} + + +gboolean +on_drawingarea2_motion_notify_event (GtkWidget *widget, + GdkEventMotion *event, + gpointer user_data) +{ + + return FALSE; +} + + + +gboolean +on_drawingarea2_expose_event (GtkWidget *widget, + GdkEventExpose *event, + gpointer user_data) +{ + GVJ_t *job; + cairo_t *cr; + double tmp; + + job = (GVJ_t *)g_object_get_data(G_OBJECT(widget),"job"); + cr = gdk_cairo_create(widget->window); + + (job->callbacks->motion)(job, job->pointer); + + job->context = (void *)cr; + job->external_context = TRUE; + job->width = widget->allocation.width; + job->height = widget->allocation.height; + + tmp = job->zoom; + job->zoom = MIN(job->width * POINTS_PER_INCH / (job->bb.UR.x * job->dpi.x), + job->height * POINTS_PER_INCH / (job->bb.UR.y * job->dpi.y)); + (job->callbacks->refresh)(job); + job->zoom = tmp; + + cairo_destroy(cr); + + return FALSE; +} + +gboolean +on_window1_delete_event (GtkWidget *widget, + GdkEvent *event, + gpointer user_data) +{ + gtk_main_quit(); + return FALSE; +} + + +gboolean +on_drawingarea1_configure_event (GtkWidget *widget, + GdkEventConfigure *event, + gpointer user_data) +{ + GVJ_t *job; + double zoom_to_fit; + +/*FIXME - should allow for margins */ +/* - similar zoom_to_fit code exists in: */ +/* plugin/gtk/callbacks.c */ +/* plugin/xlib/gvdevice_xlib.c */ +/* lib/gvc/gvevent.c */ + + job = (GVJ_t *)g_object_get_data(G_OBJECT(widget),"job"); + if (! job->has_been_rendered) { + zoom_to_fit = MIN((double) event->width / (double) job->width, + (double) event->height / (double) job->height); + if (zoom_to_fit < 1.0) /* don't make bigger */ + job->zoom *= zoom_to_fit; + } + else if (job->fit_mode) { + zoom_to_fit = MIN((double) event->width / (double) job->width, + (double) event->height / (double) job->height); + job->zoom *= zoom_to_fit; + } + if (event->width > job->width || event->height > job->height) + job->has_grown = TRUE; + job->width = event->width; + job->height = event->height; + job->needs_refresh = TRUE; + + return FALSE; +} + + +gboolean +on_drawingarea1_button_press_event (GtkWidget *widget, + GdkEventButton *event, + gpointer user_data) +{ + GVJ_t *job; + pointf pointer; + + job = (GVJ_t *)g_object_get_data(G_OBJECT(widget),"job"); + pointer.x = event->x; + pointer.y = event->y; + (job->callbacks->button_press)(job, event->button, pointer); + + load_store_with_attrs(GTK_LIST_STORE(g_object_get_data(G_OBJECT(widget), "attr_store")), job); + return FALSE; +} + + +gboolean +on_drawingarea1_button_release_event (GtkWidget *widget, + GdkEventButton *event, + gpointer user_data) +{ + GVJ_t *job; + pointf pointer; + + job = (GVJ_t *)g_object_get_data(G_OBJECT(widget),"job"); + pointer.x = event->x; + pointer.y = event->y; + (job->callbacks->button_release)(job, event->button, pointer); + + return FALSE; +} + + +gboolean +on_drawingarea1_scroll_event (GtkWidget *widget, + GdkEvent *event, + gpointer user_data) +{ + GVJ_t *job; + pointf pointer; + + job = (GVJ_t *)g_object_get_data(G_OBJECT(widget),"job"); + pointer.x = ((GdkEventScroll *)event)->x; + pointer.y = ((GdkEventScroll *)event)->y; + switch (((GdkEventScroll *)event)->direction) { + case GDK_SCROLL_UP: + (job->callbacks->button_press)(job, 4, pointer); + break; + case GDK_SCROLL_DOWN: + (job->callbacks->button_press)(job, 5, pointer); + break; + case GDK_SCROLL_LEFT: + case GDK_SCROLL_RIGHT: + break; + } + gtk_widget_queue_draw(widget); + + return FALSE; +} + +gboolean +on_button1_button_press_event (GtkWidget *widget, + GdkEventButton *event, + gpointer user_data) +{ + + +fprintf(stderr, "will delete selected object\n"); + + return FALSE; +} + diff --git a/plugin.demo/xgtk/src/callbacks.h b/plugin.demo/xgtk/src/callbacks.h new file mode 100644 index 000000000..7b1feaa24 --- /dev/null +++ b/plugin.demo/xgtk/src/callbacks.h @@ -0,0 +1,102 @@ +#include + + +void +on_new1_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_open1_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_save1_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_save_as1_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_quit1_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_cut1_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_copy1_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_paste1_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_delete1_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_about1_activate (GtkMenuItem *menuitem, + gpointer user_data); + +gboolean +on_drawingarea1_expose_event (GtkWidget *widget, + GdkEventExpose *event, + gpointer user_data); + +gboolean +on_drawingarea1_motion_notify_event (GtkWidget *widget, + GdkEventMotion *event, + gpointer user_data); + +gboolean +on_drawingarea2_motion_notify_event (GtkWidget *widget, + GdkEventMotion *event, + gpointer user_data); + +gboolean +on_drawingarea2_expose_event (GtkWidget *widget, + GdkEventExpose *event, + gpointer user_data); + +gboolean +on_window1_delete_event (GtkWidget *widget, + GdkEvent *event, + gpointer user_data); + +gboolean +on_drawingarea1_configure_event (GtkWidget *widget, + GdkEventConfigure *event, + gpointer user_data); + +gboolean +on_drawingarea1_button_press_event (GtkWidget *widget, + GdkEventButton *event, + gpointer user_data); + +gboolean +on_drawingarea1_button_release_event (GtkWidget *widget, + GdkEventButton *event, + gpointer user_data); + +gboolean +on_drawingarea1_scroll_event (GtkWidget *widget, + GdkEvent *event, + gpointer user_data); + +gboolean +on_drawingarea2_expose_event (GtkWidget *widget, + GdkEventExpose *event, + gpointer user_data); + +gboolean +on_drawingarea2_motion_notify_event (GtkWidget *widget, + GdkEventMotion *event, + gpointer user_data); + +gboolean +on_button1_button_press_event (GtkWidget *widget, + GdkEventButton *event, + gpointer user_data); diff --git a/plugin.demo/xgtk/src/gtk.glade b/plugin.demo/xgtk/src/gtk.glade new file mode 100644 index 000000000..c8738e345 --- /dev/null +++ b/plugin.demo/xgtk/src/gtk.glade @@ -0,0 +1,429 @@ + + + + + + + True + DotEdit + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_NORMAL + GDK_GRAVITY_NORTH_WEST + True + + + + + True + False + 0 + + + + True + + + + True + _File + True + + + + + + + True + gtk-new + True + + + + + + + True + gtk-open + True + + + + + + + True + gtk-save + True + + + + + + + True + gtk-save-as + True + + + + + + + True + + + + + + True + gtk-quit + True + + + + + + + + + + + True + _Edit + True + + + + + + + True + gtk-cut + True + + + + + + + True + gtk-copy + True + + + + + + + True + gtk-paste + True + + + + + + + True + gtk-delete + True + + + + + + + + + + + True + _View + True + + + + + + + + + + + True + _Help + True + + + + + + + True + _About + True + + + + + + + + + + 0 + False + False + + + + + + True + True + 0 + + + + True + False + 0 + + + + True + False + 0 + + + + 100 + 100 + True + + + + + 1 + False + False + + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + False + False + False + True + False + False + False + + + + + 1 + True + True + GTK_PACK_END + + + + + 0 + False + False + + + + + + True + GTK_ORIENTATION_HORIZONTAL + GTK_TOOLBAR_ICONS + True + True + + + + True + True + True + False + + + + True + type - name + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + + + False + False + + + + + + True + True + True + False + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + + + True + False + + + + + + True + True + True + False + + + + True + True + Delete + True + GTK_RELIEF_NORMAL + False + + + + + + False + False + + + + + 0 + False + False + + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + False + True + False + True + False + False + False + + + + + 1 + True + True + + + + + True + True + + + + + + 300 + 300 + True + GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK + + + + + + + + + True + True + + + + + 0 + True + True + + + + + + + diff --git a/plugin.demo/xgtk/src/gtk.gladep b/plugin.demo/xgtk/src/gtk.gladep new file mode 100644 index 000000000..916c9ce19 --- /dev/null +++ b/plugin.demo/xgtk/src/gtk.gladep @@ -0,0 +1,11 @@ + + + + + Gtk + gtk + + FALSE + FALSE + FALSE + diff --git a/plugin.demo/xgtk/src/gvdevice_gtk.c b/plugin.demo/xgtk/src/gvdevice_gtk.c new file mode 100644 index 000000000..d61645808 --- /dev/null +++ b/plugin.demo/xgtk/src/gvdevice_gtk.c @@ -0,0 +1,175 @@ +/* $Id$ $Revision$ */ +/* vim:set shiftwidth=4 ts=8: */ + +/********************************************************** +* This software is part of the graphviz package * +* http://www.graphviz.org/ * +* * +* Copyright (c) 1994-2004 AT&T Corp. * +* and is licensed under the * +* Common Public License, Version 1.0 * +* by AT&T Corp. * +* * +* Information and Software Systems Research * +* AT&T Research, Florham Park NJ * +**********************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_STDINT_H +#include +#endif +#ifdef HAVE_INTTYPES_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif + +#include "gvplugin_device.h" + +#ifdef HAVE_GTK +#include + +#include +#ifdef CAIRO_HAS_XLIB_SURFACE +#include +#include + +#include "interface.h" +#include "support.h" + +// note that we do not own the newly entered string - must copy +void +attr_value_edited_cb(GtkCellRendererText *renderer, gchar *pathStr, gchar *newText, gpointer data) +{ + GtkTreeModel *model = GTK_TREE_MODEL(data); +// GVJ_t *job = (GVJ_t *)g_object_get_data(G_OBJECT(model), "job"); + GtkTreePath *path; + GtkTreeIter iter; + gchar *old_attr; + gint row; + + path = gtk_tree_path_new_from_string(pathStr); + row = gtk_tree_path_get_indices(path)[0]; + + // need to free old attr value in job and allocate new attr value - how? + + // free old attr value in model + gtk_tree_model_get_iter(model, &iter, path); + gtk_tree_model_get(model, &iter, 1, &old_attr, -1); + g_free(old_attr); + + // set new attr value in model + gtk_list_store_set(GTK_LIST_STORE(model), &iter, 1, g_strdup(newText), -1); + + gtk_tree_path_free(path); +} + +static void gtk_initialize(GVJ_t *firstjob) +{ + Display *dpy; + const char *display_name = NULL; + int scr; +// GdkScreen *scr1; +// GtkWidget *window1; + +#if 0 +#ifdef ENABLE_NLS + bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + textdomain (GETTEXT_PACKAGE); +#endif +#endif + + gtk_set_locale (); +// gtk_init (&argc, &argv); + gtk_init (NULL, NULL); + +// add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps"); + +// window1 = create_window1 (); + +// scr = gdk_drawable_get_screen (window1); +// firstjob->device_dpi.x = gdk_screen_get_width(scr) * 25.4 / gdk_screen_get_width_mm(scr); /* pixels_per_inch */ +// firstjob->device_dpi.y = gdk_screen_get_height(scr) * 25.4 / gdk_screen_get_height_mm(scr); + dpy = XOpenDisplay(display_name); + if (dpy == NULL) { + fprintf(stderr, "Failed to open XLIB display: %s\n", + XDisplayName(NULL)); + return; + } + scr = DefaultScreen(dpy); + firstjob->device_dpi.x = DisplayWidth(dpy, scr) * 25.4 / DisplayWidthMM(dpy, scr); + firstjob->device_dpi.y = DisplayHeight(dpy, scr) * 25.4 / DisplayHeightMM(dpy, scr); + firstjob->device_sets_dpi = TRUE; +} + +static void gtk_finalize(GVJ_t *firstjob) +{ + GVJ_t *job; + GtkWidget *window1, *drawingarea1, *drawingarea2, *treeview2; + GtkListStore *attr_store; + GtkCellRenderer *value_renderer; + + for (job = firstjob; job; job = job->next_active) { + window1 = create_window1 (); + + g_object_set_data(G_OBJECT(window1), "job", (gpointer) job); + + drawingarea1 = lookup_widget (window1, "drawingarea1"); /* main graph view */ + g_object_set_data(G_OBJECT(drawingarea1), "job", (gpointer) job); + + drawingarea2 = lookup_widget (window1, "drawingarea2"); /* keyholeview */ + g_object_set_data(G_OBJECT(drawingarea2), "job", (gpointer) job); + + treeview2 = lookup_widget (window1, "treeview2"); /* attribute/value view */ + g_object_set_data(G_OBJECT(treeview2), "job", (gpointer) job); + + attr_store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); + + gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview2), -1, "Name", + gtk_cell_renderer_text_new(), "text", 0, NULL); + + value_renderer = gtk_cell_renderer_text_new(); + g_signal_connect(G_OBJECT(value_renderer), "edited", G_CALLBACK(attr_value_edited_cb), attr_store); + g_object_set(G_OBJECT(value_renderer), "editable", TRUE, "wrap-mode", PANGO_WRAP_WORD, + "wrap-width", 100, NULL); + gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview2), -1, "Value", value_renderer, + "text", 1, NULL); + + gtk_tree_view_set_model(GTK_TREE_VIEW(treeview2), GTK_TREE_MODEL(attr_store)); + g_object_set_data(G_OBJECT(drawingarea1), "attr_store", attr_store); + + gtk_widget_show (window1); + } + + gtk_main(); +} + +static gvdevice_features_t device_features_gtk = { + GVDEVICE_DOES_TRUECOLOR + | GVDEVICE_EVENTS, /* flags */ + {0.,0.}, /* default margin - points */ + {0.,0.}, /* default page width, height - points */ + {96.,96.}, /* dpi */ +}; + +static gvdevice_engine_t device_engine_gtk = { + gtk_initialize, + NULL, /* gtk_format */ + gtk_finalize, +}; +#endif +#endif + +gvplugin_installed_t gvdevice_types_gtk[] = { +#ifdef HAVE_GTK +#ifdef CAIRO_HAS_XLIB_SURFACE + {0, "gtk:cairo", 0, &device_engine_gtk, &device_features_gtk}, +#endif +#endif + {0, NULL, 0, NULL, NULL} +}; diff --git a/plugin.demo/xgtk/src/gvplugin_gtk.c b/plugin.demo/xgtk/src/gvplugin_gtk.c new file mode 100644 index 000000000..c0820422f --- /dev/null +++ b/plugin.demo/xgtk/src/gvplugin_gtk.c @@ -0,0 +1,26 @@ +/* $Id$ $Revision$ */ +/* vim:set shiftwidth=4 ts=8: */ + +/********************************************************** +* This software is part of the graphviz package * +* http://www.graphviz.org/ * +* * +* Copyright (c) 1994-2004 AT&T Corp. * +* and is licensed under the * +* Common Public License, Version 1.0 * +* by AT&T Corp. * +* * +* Information and Software Systems Research * +* AT&T Research, Florham Park NJ * +**********************************************************/ + +#include "gvplugin.h" + +extern gvplugin_installed_t gvdevice_types_gtk[]; + +static gvplugin_api_t apis[] = { + {API_device, gvdevice_types_gtk}, + {(api_t)0, 0}, +}; + +gvplugin_library_t gvplugin_gtk_LTX_library = { "gtk", apis }; diff --git a/plugin.demo/xgtk/src/interface.c b/plugin.demo/xgtk/src/interface.c new file mode 100644 index 000000000..895e0a0fe --- /dev/null +++ b/plugin.demo/xgtk/src/interface.c @@ -0,0 +1,345 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#include +#include + +#include +#include + +#include "callbacks.h" +#include "interface.h" +#include "support.h" + +#define GLADE_HOOKUP_OBJECT(component,widget,name) \ + g_object_set_data_full (G_OBJECT (component), name, \ + gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref) + +#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \ + g_object_set_data (G_OBJECT (component), name, widget) + +GtkWidget* +create_window1 (void) +{ + GtkWidget *window1; + GtkWidget *vbox1; + GtkWidget *menubar1; + GtkWidget *menuitem4; + GtkWidget *menu4; + GtkWidget *new1; + GtkWidget *open1; + GtkWidget *save1; + GtkWidget *save_as1; + GtkWidget *separatormenuitem1; + GtkWidget *quit1; + GtkWidget *menuitem5; + GtkWidget *menu5; + GtkWidget *cut1; + GtkWidget *copy1; + GtkWidget *paste1; + GtkWidget *delete1; + GtkWidget *menuitem6; + GtkWidget *menu6; + GtkWidget *menuitem7; + GtkWidget *menu7; + GtkWidget *about1; + GtkWidget *hpaned1; + GtkWidget *vbox2; + GtkWidget *hbox2; + GtkWidget *drawingarea2; + GtkWidget *scrolledwindow3; + GtkWidget *treeview1; + GtkWidget *toolbar1; + GtkIconSize tmp_toolbar_icon_size; + GtkWidget *toolitem1; + GtkWidget *label1; + GtkWidget *toolitem2; + GtkWidget *label2; + GtkWidget *toolitem3; + GtkWidget *button1; + GtkWidget *scrolledwindow4; + GtkWidget *treeview2; + GtkWidget *drawingarea1; + GtkAccelGroup *accel_group; + + accel_group = gtk_accel_group_new (); + + window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (window1), "DotEdit"); + + vbox1 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox1); + gtk_container_add (GTK_CONTAINER (window1), vbox1); + + menubar1 = gtk_menu_bar_new (); + gtk_widget_show (menubar1); + gtk_box_pack_start (GTK_BOX (vbox1), menubar1, FALSE, FALSE, 0); + + menuitem4 = gtk_menu_item_new_with_mnemonic (_("_File")); + gtk_widget_show (menuitem4); + gtk_container_add (GTK_CONTAINER (menubar1), menuitem4); + + menu4 = gtk_menu_new (); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem4), menu4); + + new1 = gtk_image_menu_item_new_from_stock ("gtk-new", accel_group); + gtk_widget_show (new1); + gtk_container_add (GTK_CONTAINER (menu4), new1); + + open1 = gtk_image_menu_item_new_from_stock ("gtk-open", accel_group); + gtk_widget_show (open1); + gtk_container_add (GTK_CONTAINER (menu4), open1); + + save1 = gtk_image_menu_item_new_from_stock ("gtk-save", accel_group); + gtk_widget_show (save1); + gtk_container_add (GTK_CONTAINER (menu4), save1); + + save_as1 = gtk_image_menu_item_new_from_stock ("gtk-save-as", accel_group); + gtk_widget_show (save_as1); + gtk_container_add (GTK_CONTAINER (menu4), save_as1); + + separatormenuitem1 = gtk_separator_menu_item_new (); + gtk_widget_show (separatormenuitem1); + gtk_container_add (GTK_CONTAINER (menu4), separatormenuitem1); + gtk_widget_set_sensitive (separatormenuitem1, FALSE); + + quit1 = gtk_image_menu_item_new_from_stock ("gtk-quit", accel_group); + gtk_widget_show (quit1); + gtk_container_add (GTK_CONTAINER (menu4), quit1); + + menuitem5 = gtk_menu_item_new_with_mnemonic (_("_Edit")); + gtk_widget_show (menuitem5); + gtk_container_add (GTK_CONTAINER (menubar1), menuitem5); + + menu5 = gtk_menu_new (); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem5), menu5); + + cut1 = gtk_image_menu_item_new_from_stock ("gtk-cut", accel_group); + gtk_widget_show (cut1); + gtk_container_add (GTK_CONTAINER (menu5), cut1); + + copy1 = gtk_image_menu_item_new_from_stock ("gtk-copy", accel_group); + gtk_widget_show (copy1); + gtk_container_add (GTK_CONTAINER (menu5), copy1); + + paste1 = gtk_image_menu_item_new_from_stock ("gtk-paste", accel_group); + gtk_widget_show (paste1); + gtk_container_add (GTK_CONTAINER (menu5), paste1); + + delete1 = gtk_image_menu_item_new_from_stock ("gtk-delete", accel_group); + gtk_widget_show (delete1); + gtk_container_add (GTK_CONTAINER (menu5), delete1); + + menuitem6 = gtk_menu_item_new_with_mnemonic (_("_View")); + gtk_widget_show (menuitem6); + gtk_container_add (GTK_CONTAINER (menubar1), menuitem6); + + menu6 = gtk_menu_new (); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem6), menu6); + + menuitem7 = gtk_menu_item_new_with_mnemonic (_("_Help")); + gtk_widget_show (menuitem7); + gtk_container_add (GTK_CONTAINER (menubar1), menuitem7); + + menu7 = gtk_menu_new (); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem7), menu7); + + about1 = gtk_menu_item_new_with_mnemonic (_("_About")); + gtk_widget_show (about1); + gtk_container_add (GTK_CONTAINER (menu7), about1); + + hpaned1 = gtk_hpaned_new (); + gtk_widget_show (hpaned1); + gtk_box_pack_start (GTK_BOX (vbox1), hpaned1, TRUE, TRUE, 0); + gtk_paned_set_position (GTK_PANED (hpaned1), 0); + + vbox2 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox2); + gtk_paned_pack1 (GTK_PANED (hpaned1), vbox2, TRUE, TRUE); + + hbox2 = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox2); + gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, FALSE, 0); + + drawingarea2 = gtk_drawing_area_new (); + gtk_widget_show (drawingarea2); + gtk_box_pack_start (GTK_BOX (hbox2), drawingarea2, FALSE, FALSE, 1); + gtk_widget_set_size_request (drawingarea2, 100, 100); + + scrolledwindow3 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_show (scrolledwindow3); + gtk_box_pack_end (GTK_BOX (hbox2), scrolledwindow3, TRUE, TRUE, 1); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow3), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow3), GTK_SHADOW_IN); + + treeview1 = gtk_tree_view_new (); + gtk_widget_show (treeview1); + gtk_container_add (GTK_CONTAINER (scrolledwindow3), treeview1); + gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview1), FALSE); + + toolbar1 = gtk_toolbar_new (); + gtk_widget_show (toolbar1); + gtk_box_pack_start (GTK_BOX (vbox2), toolbar1, FALSE, FALSE, 0); + gtk_toolbar_set_style (GTK_TOOLBAR (toolbar1), GTK_TOOLBAR_ICONS); + tmp_toolbar_icon_size = gtk_toolbar_get_icon_size (GTK_TOOLBAR (toolbar1)); + + toolitem1 = (GtkWidget*) gtk_tool_item_new (); + gtk_widget_show (toolitem1); + gtk_container_add (GTK_CONTAINER (toolbar1), toolitem1); + + label1 = gtk_label_new (_("type - name")); + gtk_widget_show (label1); + gtk_container_add (GTK_CONTAINER (toolitem1), label1); + + toolitem2 = (GtkWidget*) gtk_tool_item_new (); + gtk_widget_show (toolitem2); + gtk_tool_item_set_expand (GTK_TOOL_ITEM (toolitem2), TRUE); + gtk_container_add (GTK_CONTAINER (toolbar1), toolitem2); + + label2 = gtk_label_new (""); + gtk_widget_show (label2); + gtk_container_add (GTK_CONTAINER (toolitem2), label2); + + toolitem3 = (GtkWidget*) gtk_tool_item_new (); + gtk_widget_show (toolitem3); + gtk_container_add (GTK_CONTAINER (toolbar1), toolitem3); + + button1 = gtk_button_new_with_mnemonic (_("Delete")); + gtk_widget_show (button1); + gtk_container_add (GTK_CONTAINER (toolitem3), button1); + gtk_button_set_focus_on_click (GTK_BUTTON (button1), FALSE); + + scrolledwindow4 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_show (scrolledwindow4); + gtk_box_pack_start (GTK_BOX (vbox2), scrolledwindow4, TRUE, TRUE, 1); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow4), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow4), GTK_SHADOW_IN); + + treeview2 = gtk_tree_view_new (); + gtk_widget_show (treeview2); + gtk_container_add (GTK_CONTAINER (scrolledwindow4), treeview2); + gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview2), FALSE); + gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview2), TRUE); + + drawingarea1 = gtk_drawing_area_new (); + gtk_widget_show (drawingarea1); + gtk_paned_pack2 (GTK_PANED (hpaned1), drawingarea1, TRUE, TRUE); + gtk_widget_set_size_request (drawingarea1, 300, 300); + gtk_widget_set_events (drawingarea1, GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); + + g_signal_connect ((gpointer) window1, "delete_event", + G_CALLBACK (on_window1_delete_event), + NULL); + g_signal_connect_swapped ((gpointer) new1, "activate", + G_CALLBACK (on_new1_activate), + GTK_OBJECT (window1)); + g_signal_connect_swapped ((gpointer) open1, "activate", + G_CALLBACK (on_open1_activate), + GTK_OBJECT (window1)); + g_signal_connect_swapped ((gpointer) save1, "activate", + G_CALLBACK (on_save1_activate), + GTK_OBJECT (window1)); + g_signal_connect_swapped ((gpointer) save_as1, "activate", + G_CALLBACK (on_save_as1_activate), + GTK_OBJECT (window1)); + g_signal_connect ((gpointer) quit1, "activate", + G_CALLBACK (on_quit1_activate), + NULL); + g_signal_connect ((gpointer) cut1, "activate", + G_CALLBACK (on_cut1_activate), + NULL); + g_signal_connect ((gpointer) copy1, "activate", + G_CALLBACK (on_copy1_activate), + NULL); + g_signal_connect ((gpointer) paste1, "activate", + G_CALLBACK (on_paste1_activate), + NULL); + g_signal_connect ((gpointer) delete1, "activate", + G_CALLBACK (on_delete1_activate), + NULL); + g_signal_connect ((gpointer) about1, "activate", + G_CALLBACK (on_about1_activate), + NULL); + g_signal_connect ((gpointer) drawingarea2, "expose_event", + G_CALLBACK (on_drawingarea2_expose_event), + NULL); + g_signal_connect ((gpointer) drawingarea2, "motion_notify_event", + G_CALLBACK (on_drawingarea2_motion_notify_event), + NULL); + g_signal_connect ((gpointer) button1, "button_press_event", + G_CALLBACK (on_button1_button_press_event), + NULL); + g_signal_connect ((gpointer) drawingarea1, "expose_event", + G_CALLBACK (on_drawingarea1_expose_event), + NULL); + g_signal_connect ((gpointer) drawingarea1, "motion_notify_event", + G_CALLBACK (on_drawingarea1_motion_notify_event), + NULL); + g_signal_connect ((gpointer) drawingarea1, "configure_event", + G_CALLBACK (on_drawingarea1_configure_event), + NULL); + g_signal_connect ((gpointer) drawingarea1, "button_press_event", + G_CALLBACK (on_drawingarea1_button_press_event), + NULL); + g_signal_connect ((gpointer) drawingarea1, "button_release_event", + G_CALLBACK (on_drawingarea1_button_release_event), + NULL); + g_signal_connect ((gpointer) drawingarea1, "scroll_event", + G_CALLBACK (on_drawingarea1_scroll_event), + NULL); + + /* Store pointers to all widgets, for use by lookup_widget(). */ + GLADE_HOOKUP_OBJECT_NO_REF (window1, window1, "window1"); + GLADE_HOOKUP_OBJECT (window1, vbox1, "vbox1"); + GLADE_HOOKUP_OBJECT (window1, menubar1, "menubar1"); + GLADE_HOOKUP_OBJECT (window1, menuitem4, "menuitem4"); + GLADE_HOOKUP_OBJECT (window1, menu4, "menu4"); + GLADE_HOOKUP_OBJECT (window1, new1, "new1"); + GLADE_HOOKUP_OBJECT (window1, open1, "open1"); + GLADE_HOOKUP_OBJECT (window1, save1, "save1"); + GLADE_HOOKUP_OBJECT (window1, save_as1, "save_as1"); + GLADE_HOOKUP_OBJECT (window1, separatormenuitem1, "separatormenuitem1"); + GLADE_HOOKUP_OBJECT (window1, quit1, "quit1"); + GLADE_HOOKUP_OBJECT (window1, menuitem5, "menuitem5"); + GLADE_HOOKUP_OBJECT (window1, menu5, "menu5"); + GLADE_HOOKUP_OBJECT (window1, cut1, "cut1"); + GLADE_HOOKUP_OBJECT (window1, copy1, "copy1"); + GLADE_HOOKUP_OBJECT (window1, paste1, "paste1"); + GLADE_HOOKUP_OBJECT (window1, delete1, "delete1"); + GLADE_HOOKUP_OBJECT (window1, menuitem6, "menuitem6"); + GLADE_HOOKUP_OBJECT (window1, menu6, "menu6"); + GLADE_HOOKUP_OBJECT (window1, menuitem7, "menuitem7"); + GLADE_HOOKUP_OBJECT (window1, menu7, "menu7"); + GLADE_HOOKUP_OBJECT (window1, about1, "about1"); + GLADE_HOOKUP_OBJECT (window1, hpaned1, "hpaned1"); + GLADE_HOOKUP_OBJECT (window1, vbox2, "vbox2"); + GLADE_HOOKUP_OBJECT (window1, hbox2, "hbox2"); + GLADE_HOOKUP_OBJECT (window1, drawingarea2, "drawingarea2"); + GLADE_HOOKUP_OBJECT (window1, scrolledwindow3, "scrolledwindow3"); + GLADE_HOOKUP_OBJECT (window1, treeview1, "treeview1"); + GLADE_HOOKUP_OBJECT (window1, toolbar1, "toolbar1"); + GLADE_HOOKUP_OBJECT (window1, toolitem1, "toolitem1"); + GLADE_HOOKUP_OBJECT (window1, label1, "label1"); + GLADE_HOOKUP_OBJECT (window1, toolitem2, "toolitem2"); + GLADE_HOOKUP_OBJECT (window1, label2, "label2"); + GLADE_HOOKUP_OBJECT (window1, toolitem3, "toolitem3"); + GLADE_HOOKUP_OBJECT (window1, button1, "button1"); + GLADE_HOOKUP_OBJECT (window1, scrolledwindow4, "scrolledwindow4"); + GLADE_HOOKUP_OBJECT (window1, treeview2, "treeview2"); + GLADE_HOOKUP_OBJECT (window1, drawingarea1, "drawingarea1"); + + gtk_window_add_accel_group (GTK_WINDOW (window1), accel_group); + + return window1; +} + diff --git a/plugin.demo/xgtk/src/interface.h b/plugin.demo/xgtk/src/interface.h new file mode 100644 index 000000000..75b41be4b --- /dev/null +++ b/plugin.demo/xgtk/src/interface.h @@ -0,0 +1,5 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +GtkWidget* create_window1 (void); diff --git a/plugin.demo/xgtk/src/support.c b/plugin.demo/xgtk/src/support.c new file mode 100644 index 000000000..387e0a0bc --- /dev/null +++ b/plugin.demo/xgtk/src/support.c @@ -0,0 +1,146 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#include +#include + +#include + +#include "support.h" + +GtkWidget* +lookup_widget (GtkWidget *widget, + const gchar *widget_name) +{ + GtkWidget *parent, *found_widget; + + for (;;) + { + if (GTK_IS_MENU (widget)) + parent = gtk_menu_get_attach_widget (GTK_MENU (widget)); + else + parent = widget->parent; + if (!parent) + parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey"); + if (parent == NULL) + break; + widget = parent; + } + + found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget), + widget_name); + if (!found_widget) + g_warning ("Widget not found: %s", widget_name); + return found_widget; +} + +static GList *pixmaps_directories = NULL; + +/* Use this function to set the directory containing installed pixmaps. */ +void +add_pixmap_directory (const gchar *directory) +{ + pixmaps_directories = g_list_prepend (pixmaps_directories, + g_strdup (directory)); +} + +/* This is an internally used function to find pixmap files. */ +static gchar* +find_pixmap_file (const gchar *filename) +{ + GList *elem; + + /* We step through each of the pixmaps directory to find it. */ + elem = pixmaps_directories; + while (elem) + { + gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data, + G_DIR_SEPARATOR_S, filename); + if (g_file_test (pathname, G_FILE_TEST_EXISTS)) + return pathname; + g_free (pathname); + elem = elem->next; + } + return NULL; +} + +/* This is an internally used function to create pixmaps. */ +GtkWidget* +create_pixmap (GtkWidget *widget, + const gchar *filename) +{ + gchar *pathname = NULL; + GtkWidget *pixmap; + + if (!filename || !filename[0]) + return gtk_image_new (); + + pathname = find_pixmap_file (filename); + + if (!pathname) + { + g_warning (_("Couldn't find pixmap file: %s"), filename); + return gtk_image_new (); + } + + pixmap = gtk_image_new_from_file (pathname); + g_free (pathname); + return pixmap; +} + +/* This is an internally used function to create pixmaps. */ +GdkPixbuf* +create_pixbuf (const gchar *filename) +{ + gchar *pathname = NULL; + GdkPixbuf *pixbuf; + GError *error = NULL; + + if (!filename || !filename[0]) + return NULL; + + pathname = find_pixmap_file (filename); + + if (!pathname) + { + g_warning (_("Couldn't find pixmap file: %s"), filename); + return NULL; + } + + pixbuf = gdk_pixbuf_new_from_file (pathname, &error); + if (!pixbuf) + { + fprintf (stderr, "Failed to load pixbuf file: %s: %s\n", + pathname, error->message); + g_error_free (error); + } + g_free (pathname); + return pixbuf; +} + +/* This is used to set ATK action descriptions. */ +void +glade_set_atk_action_description (AtkAction *action, + const gchar *action_name, + const gchar *description) +{ + gint n_actions, i; + + n_actions = atk_action_get_n_actions (action); + for (i = 0; i < n_actions; i++) + { + if (!strcmp (atk_action_get_name (action, i), action_name)) + atk_action_set_description (action, i, description); + } +} + diff --git a/plugin.demo/xgtk/src/support.h b/plugin.demo/xgtk/src/support.h new file mode 100644 index 000000000..a32649e53 --- /dev/null +++ b/plugin.demo/xgtk/src/support.h @@ -0,0 +1,69 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +/* + * Standard gettext macros. + */ +#ifdef ENABLE_NLS +# include +# undef _ +# define _(String) dgettext (PACKAGE, String) +# define Q_(String) g_strip_context ((String), gettext (String)) +# ifdef gettext_noop +# define N_(String) gettext_noop (String) +# else +# define N_(String) (String) +# endif +#else +# define textdomain(String) (String) +# define gettext(String) (String) +# define dgettext(Domain,Message) (Message) +# define dcgettext(Domain,Message,Type) (Message) +# define bindtextdomain(Domain,Directory) (Domain) +# define _(String) (String) +# define Q_(String) g_strip_context ((String), (String)) +# define N_(String) (String) +#endif + + +/* + * Public Functions. + */ + +/* + * This function returns a widget in a component created by Glade. + * Call it with the toplevel widget in the component (i.e. a window/dialog), + * or alternatively any widget in the component, and the name of the widget + * you want returned. + */ +GtkWidget* lookup_widget (GtkWidget *widget, + const gchar *widget_name); + + +/* Use this function to set the directory containing installed pixmaps. */ +void add_pixmap_directory (const gchar *directory); + + +/* + * Private Functions. + */ + +/* This is used to create the pixmaps used in the interface. */ +GtkWidget* create_pixmap (GtkWidget *widget, + const gchar *filename); + +/* This is used to create the pixbufs used in the interface. */ +GdkPixbuf* create_pixbuf (const gchar *filename); + +/* This is used to set ATK action descriptions. */ +void glade_set_atk_action_description (AtkAction *action, + const gchar *action_name, + const gchar *description); +