diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2022-11-06 16:03:15 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2022-11-06 16:03:15 +0000 |
commit | d7d55fb55f26adac2bcd65388bb9fc0fa17362e1 (patch) | |
tree | b173dcd57585d1f8d3f79b3b2f751dedf565562b | |
parent | c40c44863c0cbef4434b1e023145e99c27ed8959 (diff) |
Update viewres to version 1.0.7
-rw-r--r-- | app/viewres/ChangeLog | 97 | ||||
-rw-r--r-- | app/viewres/Makefile.in | 7 | ||||
-rw-r--r-- | app/viewres/aclocal.m4 | 16 | ||||
-rw-r--r-- | app/viewres/compile | 17 | ||||
-rw-r--r-- | app/viewres/configure | 79 | ||||
-rw-r--r-- | app/viewres/configure.ac | 7 | ||||
-rw-r--r-- | app/viewres/man/Makefile.in | 1 | ||||
-rw-r--r-- | app/viewres/man/viewres.man | 4 | ||||
-rw-r--r-- | app/viewres/viewres.c | 1238 |
9 files changed, 781 insertions, 685 deletions
diff --git a/app/viewres/ChangeLog b/app/viewres/ChangeLog index ba497b815..9a30bca67 100644 --- a/app/viewres/ChangeLog +++ b/app/viewres/ChangeLog @@ -1,3 +1,98 @@ +commit b2b611960b5f11740cb3ca66c6dcd0a3688a82ae +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sat Oct 15 09:53:33 2022 -0700 + + viewres 1.0.7 + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 04afb2de50ff3f7d074299a83f70ba779502eac6 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sat Sep 10 14:26:28 2022 -0700 + + Add .git-blame-ignore-revs to hide whitespace commits from git blame + + To use this in your local repo clone, you will need to either run + `git blame --ignore-revs-file .git-blame-ignore-revs` + or set it permanently with + `git config blame.ignoreRevsFile .git-blame-ignore-revs` + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 7c75ce13299af68b73563714ca366f891f6a9eb8 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sat Sep 10 14:13:58 2022 -0700 + + set_node_labels: move dereference of node to after the NULL check + + Found by cppcheck: + + viewres.c:815:22: warning: Either the condition '!node' is redundant or there is possible null pointer dereference: node. [nullPointerRedundantCheck] + ViewresData *d = VData(node); + ^ + viewres.c:817:9: note: Assuming that condition '!node' is not redundant + if (!node) + ^ + viewres.c:815:22: note: Null pointer dereference + ViewresData *d = VData(node); + ^ + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 73f73d21c22b0220403bc036c6175fb7c2bfafee +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sun Aug 14 12:07:10 2022 -0700 + + Variable scope reductions as suggested by cppcheck + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 49c9ace57166a4014fafa36ff5cb373846a9b4cf +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sun Aug 14 11:54:50 2022 -0700 + + Remove obsolete casts on calloc & malloc calls + + Not needed in C89 and later + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit f03145544e4390e0bcd462ac5c154a4c474c46ee +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sun Aug 14 11:47:02 2022 -0700 + + Apply X.Org standard coding style + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 3eca4f7fa432b21db94429cfa8b9c4c71dfeebfd +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sat Apr 2 12:59:54 2022 -0700 + + man page: remove out-of-date COPYRIGHT section + + The information previously listed here didn't match what is present in + the source code or the COPYING file, and the X(7) man page doesn't list + any license information as this had claimed. + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit baf57b3540ff5a23ecfb3f6c37726cd13875ae95 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sat Dec 4 10:27:12 2021 -0800 + + Build xz tarballs instead of bzip2 + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 89f7c7eb3501abf4506b7374d9f4f45c0f2e990d +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sat Dec 4 10:27:08 2021 -0800 + + gitlab CI: add a basic build test + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + commit 5661dfdc04572cdbb6ed4e641049657c4ba39252 Author: Alan Coopersmith <alan.coopersmith@oracle.com> Date: Sun Aug 25 16:11:01 2019 -0700 @@ -551,7 +646,7 @@ Date: Sun Jul 17 20:11:01 2005 +0000 fix rules to work with non-GNU make and outside of $srcdir commit ce1447d0a8b2a7fc3a36f11eed69cd14be397ffe -Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> +Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> Date: Wed Jun 29 19:22:16 2005 +0000 Build system for viewres diff --git a/app/viewres/Makefile.in b/app/viewres/Makefile.in index 3087726b0..da0da7bc2 100644 --- a/app/viewres/Makefile.in +++ b/app/viewres/Makefile.in @@ -209,9 +209,9 @@ am__relativize = \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" -DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 +DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.xz GZIP_ENV = --best -DIST_TARGETS = dist-bzip2 dist-gzip +DIST_TARGETS = dist-xz dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' @@ -330,6 +330,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -701,6 +702,7 @@ distdir: $(DISTFILES) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__post_remove_distdir) + dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) @@ -708,7 +710,6 @@ dist-bzip2: distdir dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) - dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) diff --git a/app/viewres/aclocal.m4 b/app/viewres/aclocal.m4 index 2a518c4b6..d0a818e1e 100644 --- a/app/viewres/aclocal.m4 +++ b/app/viewres/aclocal.m4 @@ -19,9 +19,9 @@ You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -dnl serial 11 (pkg-config-0.29.1) -dnl +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 12 (pkg-config-0.29.2) + dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>. dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com> dnl @@ -62,7 +62,7 @@ dnl dnl See the "Since" comment for each macro you use to see what version dnl of the macros you require. m4_defun([PKG_PREREQ], -[m4_define([PKG_MACROS_VERSION], [0.29.1]) +[m4_define([PKG_MACROS_VERSION], [0.29.2]) m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) ])dnl PKG_PREREQ @@ -163,7 +163,7 @@ AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no -AC_MSG_CHECKING([for $1]) +AC_MSG_CHECKING([for $2]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) @@ -173,11 +173,11 @@ and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then - AC_MSG_RESULT([no]) + AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` - else + else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs @@ -194,7 +194,7 @@ installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then - AC_MSG_RESULT([no]) + AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full diff --git a/app/viewres/compile b/app/viewres/compile index a85b723c7..df363c8fb 100644 --- a/app/viewres/compile +++ b/app/viewres/compile @@ -1,9 +1,9 @@ #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. -scriptversion=2012-10-14.11; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # Written by Tom Tromey <tromey@cygnus.com>. # # This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ scriptversion=2012-10-14.11; # UTC # 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, see <http://www.gnu.org/licenses/>. +# along with this program. If not, see <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -53,7 +53,7 @@ func_file_conv () MINGW*) file_conv=mingw ;; - CYGWIN*) + CYGWIN* | MSYS*) file_conv=cygwin ;; *) @@ -67,7 +67,7 @@ func_file_conv () mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; - cygwin/*) + cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) @@ -255,7 +255,8 @@ EOF echo "compile $scriptversion" exit $? ;; - cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ + icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac @@ -339,9 +340,9 @@ exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff --git a/app/viewres/configure b/app/viewres/configure index 392f6b91d..03fe42351 100644 --- a/app/viewres/configure +++ b/app/viewres/configure @@ -1,8 +1,8 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for viewres 1.0.6. +# Generated by GNU Autoconf 2.69 for viewres 1.0.7. # -# Report bugs to <https://gitlab.freedesktop.org/xorg/app/viewres/issues>. +# Report bugs to <https://gitlab.freedesktop.org/xorg/app/viewres/~/issues>. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -267,7 +267,7 @@ fi $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and -$0: https://gitlab.freedesktop.org/xorg/app/viewres/issues +$0: https://gitlab.freedesktop.org/xorg/app/viewres/~/issues $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do @@ -581,9 +581,9 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='viewres' PACKAGE_TARNAME='viewres' -PACKAGE_VERSION='1.0.6' -PACKAGE_STRING='viewres 1.0.6' -PACKAGE_BUGREPORT='https://gitlab.freedesktop.org/xorg/app/viewres/issues' +PACKAGE_VERSION='1.0.7' +PACKAGE_STRING='viewres 1.0.7' +PACKAGE_BUGREPORT='https://gitlab.freedesktop.org/xorg/app/viewres/~/issues' PACKAGE_URL='' ac_unique_file="Makefile.am" @@ -730,6 +730,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -811,6 +812,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1063,6 +1065,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1200,7 +1211,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1313,7 +1324,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures viewres 1.0.6 to adapt to many kinds of systems. +\`configure' configures viewres 1.0.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1353,6 +1364,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1383,7 +1395,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of viewres 1.0.6:";; + short | recursive ) echo "Configuration of viewres 1.0.7:";; esac cat <<\_ACEOF @@ -1436,7 +1448,7 @@ Some influential environment variables: Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. -Report bugs to <https://gitlab.freedesktop.org/xorg/app/viewres/issues>. +Report bugs to <https://gitlab.freedesktop.org/xorg/app/viewres/~/issues>. _ACEOF ac_status=$? fi @@ -1499,7 +1511,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -viewres configure 1.0.6 +viewres configure 1.0.7 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1756,7 +1768,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by viewres $as_me 1.0.6, which was +It was created by viewres $as_me 1.0.7, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2585,7 +2597,7 @@ fi # Define the identity of the package. PACKAGE='viewres' - VERSION='1.0.6' + VERSION='1.0.7' cat >>confdefs.h <<_ACEOF @@ -2632,29 +2644,6 @@ am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 -$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } - # Check whether --enable-maintainer-mode was given. -if test "${enable_maintainer_mode+set}" = set; then : - enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval -else - USE_MAINTAINER_MODE=no -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 -$as_echo "$USE_MAINTAINER_MODE" >&6; } - if test $USE_MAINTAINER_MODE = yes; then - MAINTAINER_MODE_TRUE= - MAINTAINER_MODE_FALSE='#' -else - MAINTAINER_MODE_TRUE='#' - MAINTAINER_MODE_FALSE= -fi - - MAINT=$MAINTAINER_MODE_TRUE - - - # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS @@ -10432,8 +10421,8 @@ AM_BACKSLASH='\' pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for VIEWRES" >&5 -$as_echo_n "checking for VIEWRES... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for xaw7 xmu xt" >&5 +$as_echo_n "checking for xaw7 xmu xt... " >&6; } if test -n "$VIEWRES_CFLAGS"; then pkg_cv_VIEWRES_CFLAGS="$VIEWRES_CFLAGS" @@ -10473,7 +10462,7 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -10500,7 +10489,7 @@ Alternatively, you may set the environment variables VIEWRES_CFLAGS and VIEWRES_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} @@ -10665,10 +10654,6 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then - as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -11074,7 +11059,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by viewres $as_me 1.0.6, which was +This file was extended by viewres $as_me 1.0.7, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -11134,13 +11119,13 @@ $config_headers Configuration commands: $config_commands -Report bugs to <https://gitlab.freedesktop.org/xorg/app/viewres/issues>." +Report bugs to <https://gitlab.freedesktop.org/xorg/app/viewres/~/issues>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -viewres config.status 1.0.6 +viewres config.status 1.0.7 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/app/viewres/configure.ac b/app/viewres/configure.ac index 6059b85b5..3f5ffc611 100644 --- a/app/viewres/configure.ac +++ b/app/viewres/configure.ac @@ -23,14 +23,13 @@ dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) -AC_INIT([viewres], [1.0.6], - [https://gitlab.freedesktop.org/xorg/app/viewres/issues], [viewres]) +AC_INIT([viewres], [1.0.7], + [https://gitlab.freedesktop.org/xorg/app/viewres/~/issues], [viewres]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) # Initialize Automake -AM_INIT_AUTOMAKE([foreign dist-bzip2]) -AM_MAINTAINER_MODE +AM_INIT_AUTOMAKE([foreign dist-xz]) # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS m4_ifndef([XORG_MACROS_VERSION], diff --git a/app/viewres/man/Makefile.in b/app/viewres/man/Makefile.in index 7aa0ba92a..213a9a2b4 100644 --- a/app/viewres/man/Makefile.in +++ b/app/viewres/man/Makefile.in @@ -223,6 +223,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/app/viewres/man/viewres.man b/app/viewres/man/viewres.man index 672aff8f9..c1fa2d2bd 100644 --- a/app/viewres/man/viewres.man +++ b/app/viewres/man/viewres.man @@ -209,9 +209,5 @@ Viewres viewres where \fIvariable-name\fP is the widget variable name of each node. .SH "SEE ALSO" X(__miscmansuffix__), xrdb(__appmansuffix__), listres(__appmansuffix__), editres(__appmansuffix__), appres(__appmansuffix__), appropriate widget documents -.SH COPYRIGHT -Copyright 1994 X Consortium -.br -See \fIX(__miscmansuffix__)\fP for a full statement of rights and permissions. .SH AUTHOR Jim Fulton, MIT X Consortium diff --git a/app/viewres/viewres.c b/app/viewres/viewres.c index 8200f81a5..d53e220f3 100644 --- a/app/viewres/viewres.c +++ b/app/viewres/viewres.c @@ -1,7 +1,7 @@ /* * $XConsortium: viewres.c,v 1.74 94/04/17 20:43:24 converse Exp $ * - * + * Copyright (c) 1989 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy @@ -24,7 +24,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. - * * + * * Author: Jim Fulton, MIT X Consortium */ /* $XFree86: xc/programs/viewres/viewres.c,v 1.6 2003/05/27 22:26:58 tsi Exp $ */ @@ -55,26 +55,24 @@ in this Software without prior written authorization from the X Consortium. #include <X11/Xmu/WidgetNode.h> #include <X11/Xaw/AllWidgets.h> -#define widget_list XawWidgetArray /* or motif or ol or ... */ +#define widget_list XawWidgetArray /* or motif or ol or ... */ #define nwidgets XawWidgetCount typedef struct { - const char **resource_labels; /* names of res added by widget */ - Cardinal nnewresources; /* number res added by widget */ - Cardinal nnewconstraints; /* number res added by widget */ - Cardinal nnew; /* number new */ - Widget instance; /* Label widget in box in tree */ - Widget resource_lw; /* List widget showing resources */ - int selection_index; /* -1 or index into selection_list */ + const char **resource_labels; /* names of res added by widget */ + Cardinal nnewresources; /* number res added by widget */ + Cardinal nnewconstraints; /* number res added by widget */ + Cardinal nnew; /* number new */ + Widget instance; /* Label widget in box in tree */ + Widget resource_lw; /* List widget showing resources */ + int selection_index; /* -1 or index into selection_list */ } ViewresData; #define VData(node) ((ViewresData *) (node)->data) - #define IsShowing(node) (VData(node)->resource_lw && \ XtIsManaged(VData(node)->resource_lw)) - struct WidgetList { int n_elements; int max_elements; @@ -93,8 +91,10 @@ static struct WidgetList selected_list = { 0, 0, (XmuWidgetNode **) NULL }; static const char *ProgramName; static int NumberShowing = 0; -static Arg sensitiveargs[2] = {{ XtNsensitive, (XtArgVal) FALSE }, - { XtNsensitive, (XtArgVal) TRUE }}; +static Arg sensitiveargs[2] = { + {XtNsensitive, (XtArgVal) FALSE}, + {XtNsensitive, (XtArgVal) TRUE} +}; static const char *help_message[] = { "-top name object to be top of tree", @@ -109,7 +109,6 @@ static XrmOptionDescRec Options[] = { { "-vertical", "*Tree.Gravity", XrmoptionNoArg, (XPointer) "north" } }; - typedef struct { char *top_object; Boolean show_variable; @@ -121,9 +120,9 @@ static OptionsRec options; static XtResource Resources[] = { { "topObject", "TopObject", XtRString, sizeof(char *), - Offset(top_object), XtRString, (XtPointer) "object" }, + Offset(top_object), XtRString, (XtPointer) "object" }, { "showVariable", "ShowVariable", XtRBoolean, sizeof(Boolean), - Offset(show_variable), XtRImmediate, (XtPointer) FALSE }, + Offset(show_variable), XtRImmediate, (XtPointer) FALSE }, }; #undef Offset @@ -226,641 +225,651 @@ static XmuWidgetNode *topnode; static Arg false_args[1] = {{ XtNstate, (XtArgVal) FALSE }}; static Arg true_args[1] = {{ XtNstate, (XtArgVal) TRUE }}; - /* * routines */ -static void -usage (void) +static void +usage(void) { - const char **cpp; - fprintf (stderr, "usage: %s [-options...]\n", ProgramName); + fprintf(stderr, "usage: %s [-options...]\n", ProgramName); fprintf(stderr, "\nwhere options include:\n"); - for (cpp = help_message; *cpp; cpp++) { - fprintf (stderr, " %s\n", *cpp); + for (const char **cpp = help_message; *cpp; cpp++) { + fprintf(stderr, " %s\n", *cpp); } fprintf(stderr, "\n"); - exit (1); + exit(1); } - static XmuWidgetNode * -widget_to_node (Widget gw) +widget_to_node(Widget gw) { XmuWidgetNode *node; int i; - if (XtIsSubclass (gw, toggleWidgetClass)) { - for (i = 0, node = widget_list; i < nwidgets; i++, node++) { - if (VData(node)->instance == gw) return node; - } - } else if (XtIsSubclass (gw, listWidgetClass)) { - for (i = 0, node = widget_list; i < nwidgets; i++, node++) { - if (VData(node)->resource_lw == gw) return node; - } + if (XtIsSubclass(gw, toggleWidgetClass)) { + for (i = 0, node = widget_list; i < nwidgets; i++, node++) { + if (VData(node)->instance == gw) + return node; + } + } + else if (XtIsSubclass(gw, listWidgetClass)) { + for (i = 0, node = widget_list; i < nwidgets; i++, node++) { + if (VData(node)->resource_lw == gw) + return node; + } } return (XmuWidgetNode *) NULL; } - -static void -initialize_widgetnode_list (XmuWidgetNode ***listp, int *sizep, int n) +static void +initialize_widgetnode_list(XmuWidgetNode ***listp, int *sizep, int n) { - int i; - XmuWidgetNode **l; - if (!*listp) { *listp = (XmuWidgetNode **) - XtCalloc ((unsigned int) n, (unsigned int)sizeof(XmuWidgetNode **)); + XtCalloc((unsigned int) n, (unsigned int) sizeof(XmuWidgetNode **)); *sizep = ((*listp) ? n : 0); return; } if (n > *sizep) { - *listp = (XmuWidgetNode **) XtRealloc ((char *) *listp, - (unsigned int) - (n * sizeof(XmuWidgetNode **))); - if (!*listp) { - *sizep = 0; - return; - } - for (i = *sizep, l = (*listp) + i; i < n; i++, l++) *l = - (XmuWidgetNode *) NULL; - *sizep = n; + int i; + XmuWidgetNode **l; + + *listp = (XmuWidgetNode **) XtRealloc((char *) *listp, (unsigned int) + (n * sizeof(XmuWidgetNode **))); + if (!*listp) { + *sizep = 0; + return; + } + for (i = *sizep, l = (*listp) + i; i < n; i++, l++) + *l = (XmuWidgetNode *) NULL; + *sizep = n; } return; } - -static Boolean -set_resource_labels (XmuWidgetNode *node) +static Boolean +set_resource_labels(XmuWidgetNode *node) { - Cardinal i; const char **cur; XtResourceList res; XmuWidgetNode **wn; ViewresData *d = VData(node); if (!d->resource_labels) { - d->resource_labels = - (const char **) calloc ((unsigned) d->nnew * 3, - (unsigned) sizeof (const char *)); - if (!d->resource_labels) return FALSE; + d->resource_labels = calloc(d->nnew * 3, sizeof(const char *)); + if (!d->resource_labels) + return FALSE; } cur = d->resource_labels; res = node->resources; wn = node->resourcewn; - for (i = 0; i < node->nresources; i++, res++, wn++) { - if (*wn == node) { /* should match nnew */ - *cur++ = res->resource_name; - *cur++ = res->resource_class; - *cur++ = res->resource_type; - } + for (Cardinal i = 0; i < node->nresources; i++, res++, wn++) { + if (*wn == node) { /* should match nnew */ + *cur++ = res->resource_name; + *cur++ = res->resource_class; + *cur++ = res->resource_type; + } } if (d->nnewconstraints > 0) { - const char *s; + const char *s; - *cur++ = s = ""; - *cur++ = s; - *cur++ = s; + *cur++ = s = ""; + *cur++ = s; + *cur++ = s; } res = node->constraints; wn = node->constraintwn; - for (i = 0; i < node->nconstraints; i++, res++, wn++) { - if (*wn == node) { /* should match nnew */ - *cur++ = res->resource_name; - *cur++ = res->resource_class; - *cur++ = res->resource_type; - } + for (Cardinal i = 0; i < node->nconstraints; i++, res++, wn++) { + if (*wn == node) { /* should match nnew */ + *cur++ = res->resource_name; + *cur++ = res->resource_class; + *cur++ = res->resource_type; + } } return TRUE; } - static ViewresData * -create_viewres_data (XmuWidgetNode *node) +create_viewres_data(XmuWidgetNode *node) { - ViewresData *d = - (ViewresData *) malloc ((unsigned) sizeof(ViewresData)); + ViewresData *d = malloc(sizeof(ViewresData)); if (d) { - d->resource_labels = NULL; - d->nnewresources = XmuWnCountOwnedResources (node, node, False); - d->nnewconstraints = XmuWnCountOwnedResources (node, node, True); - d->nnew = (d->nnewresources + (d->nnewconstraints - ? d->nnewconstraints + 1 : 0)); - d->instance = (Widget) NULL; - d->resource_lw = (Widget) NULL; - d->selection_index = -1; + d->resource_labels = NULL; + d->nnewresources = XmuWnCountOwnedResources(node, node, False); + d->nnewconstraints = XmuWnCountOwnedResources(node, node, True); + d->nnew = (d->nnewresources + (d->nnewconstraints + ? d->nnewconstraints + 1 : 0)); + d->instance = (Widget) NULL; + d->resource_lw = (Widget) NULL; + d->selection_index = -1; } return d; } -static int -copydown (int start) +static int +copydown(int start) { XmuWidgetNode **src = &selected_list.elements[start]; XmuWidgetNode **dst = src; int cur; for (cur = start; start < selected_list.n_elements; start++, src++) { - if (*src) { - VData((*src))->selection_index = cur++; - *dst++ = *src; - } + if (*src) { + VData((*src))->selection_index = cur++; + *dst++ = *src; + } } return (start - cur); } - -static void -add_to_selected_list (XmuWidgetNode *node, Boolean updatewidget) +static void +add_to_selected_list(XmuWidgetNode *node, Boolean updatewidget) { ViewresData *d = VData(node); - if (!d->instance || d->selection_index >= 0) return; + + if (!d->instance || d->selection_index >= 0) + return; if (selected_list.n_elements >= selected_list.max_elements) { - initialize_widgetnode_list (&selected_list.elements, - &selected_list.max_elements, - (selected_list.max_elements * 3) / 2); + initialize_widgetnode_list(&selected_list.elements, + &selected_list.max_elements, + (selected_list.max_elements * 3) / 2); } - INSERT_NODE (node, selected_list.n_elements); + INSERT_NODE(node, selected_list.n_elements); selected_list.n_elements++; - if (updatewidget) XtSetValues (d->instance, true_args, ONE); + if (updatewidget) + XtSetValues(d->instance, true_args, ONE); } -static Boolean -remove_from_selected_list (XmuWidgetNode *node, Boolean updatewidget) +static Boolean +remove_from_selected_list(XmuWidgetNode *node, Boolean updatewidget) { int i, skips; ViewresData *d = VData(node); - if ((i = d->selection_index) < 0) return FALSE; + if ((i = d->selection_index) < 0) + return FALSE; - REMOVE_NODE (node); + REMOVE_NODE(node); /* copy down */ if (selected_list.n_elements > 1) { - skips = copydown (i); - } else { - skips = 1; + skips = copydown(i); + } + else { + skips = 1; } selected_list.n_elements -= skips; - if (updatewidget) XtSetValues (d->instance, false_args, ONE); + if (updatewidget) + XtSetValues(d->instance, false_args, ONE); return TRUE; } -static void -remove_nodes_from_selected_list (int start, int count, Boolean updatewidget) +static void +remove_nodes_from_selected_list(int start, int count, Boolean updatewidget) { - int i; + for (int i = 0; i < count; i++) { + XmuWidgetNode *p = selected_list.elements[start + i]; + ViewresData *d = VData(p); - for (i = 0; i < count; i++) { - XmuWidgetNode *p = selected_list.elements[start+i]; - ViewresData *d = VData(p); - REMOVE_NODE (p); - if (updatewidget) XtSetValues (d->instance, false_args, ONE); + REMOVE_NODE(p); + if (updatewidget) + XtSetValues(d->instance, false_args, ONE); } - selected_list.n_elements -= copydown (start); + selected_list.n_elements -= copydown(start); } - -static void -add_subtree_to_selected_list (XmuWidgetNode *node, Boolean updatewidget) + +static void +add_subtree_to_selected_list(XmuWidgetNode *node, Boolean updatewidget) { - if (!node) return; + if (!node) + return; - add_to_selected_list (node, updatewidget); + add_to_selected_list(node, updatewidget); for (node = node->children; node; node = node->siblings) { - add_subtree_to_selected_list (node, updatewidget); + add_subtree_to_selected_list(node, updatewidget); } } - /* ARGSUSED */ -static void -variable_labeltype_callback (Widget gw, - XtPointer closure, /* TRUE or FALSE */ - XtPointer data) +static void +variable_labeltype_callback(Widget gw, + XtPointer closure, /* TRUE or FALSE */ + XtPointer data) { - set_labeltype_menu ((Boolean) (long) closure, True); + set_labeltype_menu((Boolean) (long) closure, True); } /* ARGSUSED */ -static void -gravity_callback (Widget gw, - XtPointer closure, /* TRUE or FALSE */ - XtPointer data) +static void +gravity_callback(Widget gw, + XtPointer closure, /* TRUE or FALSE */ + XtPointer data) { - set_orientation_menu ((XtGravity) (long) closure, True); + set_orientation_menu((XtGravity) (long) closure, True); } - -static Boolean -create_resource_lw (XmuWidgetNode *node) +static Boolean +create_resource_lw(XmuWidgetNode *node) { Arg args[4]; Cardinal n; ViewresData *d = VData(node); - if (d->nnew == 0) return FALSE; + if (d->nnew == 0) + return FALSE; - if (!d->resource_labels && - !set_resource_labels (node)) return FALSE; + if (!d->resource_labels && !set_resource_labels(node)) + return FALSE; n = 0; - XtSetArg (args[n], XtNnumberStrings, 3 * d->nnew); n++; - XtSetArg (args[n], XtNlist, d->resource_labels); n++; - XtSetArg (args[n], XtNdefaultColumns, 3); n++; - XtSetArg (args[n], XtNforceColumns, TRUE); n++; - d->resource_lw = XtCreateManagedWidget (node->label, listWidgetClass, - XtParent(d->instance), - args, n); - XtRealizeWidget (d->resource_lw); + XtSetArg(args[n], XtNnumberStrings, 3 * d->nnew); + n++; + XtSetArg(args[n], XtNlist, d->resource_labels); + n++; + XtSetArg(args[n], XtNdefaultColumns, 3); + n++; + XtSetArg(args[n], XtNforceColumns, TRUE); + n++; + d->resource_lw = XtCreateManagedWidget(node->label, listWidgetClass, + XtParent(d->instance), args, n); + XtRealizeWidget(d->resource_lw); return TRUE; } -static void -update_selection_items (void) +static void +update_selection_items(void) { - int i; - static Arg args[1] = {{ XtNsensitive, (XtArgVal) FALSE }}; - Boolean show = FALSE, hide = FALSE, ancestors = FALSE; - Boolean descendants = FALSE; - - for (i = 0; i < selected_list.n_elements; i++) { - XmuWidgetNode *node = selected_list.elements[i]; - ViewresData *d = VData(node); - - /* - * If node has any new resources then may be shown (if not - * already being shown). If node has widget and is managed, - * then may be hidden. - */ - if (d->nnew > 0) { - if (IsShowing(node)) { - hide = TRUE; - } else { - show = TRUE; - } - } - if (node != topnode) ancestors = TRUE; - if (node->children) descendants = TRUE; + static Arg args[1] = { {XtNsensitive, (XtArgVal) FALSE} }; + Boolean show = FALSE, hide = FALSE; + Boolean ancestors = FALSE, descendants = FALSE; + + for (int i = 0; i < selected_list.n_elements; i++) { + XmuWidgetNode *node = selected_list.elements[i]; + ViewresData *d = VData(node); + + /* + * If node has any new resources then may be shown (if not + * already being shown). If node has widget and is managed, + * then may be hidden. + */ + if (d->nnew > 0) { + if (IsShowing(node)) { + hide = TRUE; + } + else { + show = TRUE; + } + } + if (node != topnode) + ancestors = TRUE; + if (node->children) + descendants = TRUE; } - + args[0].value = (XtArgVal) show; - XtSetValues (view_widgets[VIEW_SHOW_RESOURCES], args, ONE); + XtSetValues(view_widgets[VIEW_SHOW_RESOURCES], args, ONE); args[0].value = (XtArgVal) hide; - XtSetValues (view_widgets[VIEW_HIDE_RESOURCES], args, ONE); + XtSetValues(view_widgets[VIEW_HIDE_RESOURCES], args, ONE); args[0].value = (XtArgVal) (selected_list.n_elements > 0 ? TRUE : FALSE); - XtSetValues (select_widgets[SELECT_NOTHING], args, ONE); + XtSetValues(select_widgets[SELECT_NOTHING], args, ONE); args[0].value = (XtArgVal) ancestors; - XtSetValues (select_widgets[SELECT_PARENT], args, ONE); - XtSetValues (select_widgets[SELECT_ANCESTORS], args, ONE); + XtSetValues(select_widgets[SELECT_PARENT], args, ONE); + XtSetValues(select_widgets[SELECT_ANCESTORS], args, ONE); args[0].value = (XtArgVal) descendants; - XtSetValues (select_widgets[SELECT_CHILDREN], args, ONE); - XtSetValues (select_widgets[SELECT_DESCENDANTS], args, ONE); + XtSetValues(select_widgets[SELECT_CHILDREN], args, ONE); + XtSetValues(select_widgets[SELECT_DESCENDANTS], args, ONE); args[0].value = (XtArgVal) ((Boolean) (NumberShowing > 0)); - XtSetValues (select_widgets[SELECT_SHOWN_RESOURCES], args, ONE); + XtSetValues(select_widgets[SELECT_SHOWN_RESOURCES], args, ONE); } - -static void -do_resources (XmuWidgetNode *node, Boolean op, Boolean updatewidget) +static void +do_resources(XmuWidgetNode *node, Boolean op, Boolean updatewidget) { ViewresData *d = VData(node); - if (op == BOOL_TOGGLE) op = (IsShowing(node) ? BOOL_OFF : BOOL_ON); + + if (op == BOOL_TOGGLE) + op = (IsShowing(node) ? BOOL_OFF : BOOL_ON); if (op == BOOL_ON) { - if (d->resource_lw) { /* if already created */ - if (!XtIsManaged(d->resource_lw)) { - NumberShowing++; - XtManageChild (d->resource_lw); - } /* else ignore it */ - } else if (create_resource_lw (node)) /* create it */ - NumberShowing++; - } else if (d->resource_lw) { /* if already created */ - if (XtIsManaged (d->resource_lw)) { - NumberShowing--; - XtUnmanageChild (d->resource_lw); - XawListUnhighlight (d->resource_lw); - if (updatewidget) remove_from_selected_list (node, TRUE); - } /* else ignore it */ + if (d->resource_lw) { /* if already created */ + if (!XtIsManaged(d->resource_lw)) { + NumberShowing++; + XtManageChild(d->resource_lw); + } /* else ignore it */ + } + else if (create_resource_lw(node)) /* create it */ + NumberShowing++; + } + else if (d->resource_lw) { /* if already created */ + if (XtIsManaged(d->resource_lw)) { + NumberShowing--; + XtUnmanageChild(d->resource_lw); + XawListUnhighlight(d->resource_lw); + if (updatewidget) + remove_from_selected_list(node, TRUE); + } /* else ignore it */ } } - - /* ARGSUSED */ -static void -show_resources_callback ( - Widget gw, /* menu or toggle button */ - XtPointer closure, /* BOOL_OFF, BOOL_ON, BOOL_TOGGLE */ - XtPointer data) /* undefined */ +static void +show_resources_callback(Widget gw, /* menu or toggle button */ + XtPointer closure, /* BOOL_OFF, BOOL_ON, BOOL_TOGGLE */ + XtPointer data) /* undefined */ { int op = (long) closure; - XmuWidgetNode *node = widget_to_node (gw); + XmuWidgetNode *node = widget_to_node(gw); if (node) { - XUnmapWindow (XtDisplay(treeWidget), XtWindow(treeWidget)); - do_resources (node, op, TRUE); - } else if (selected_list.n_elements <= 0) { - return; - } else { - int i; - - XUnmapWindow (XtDisplay(treeWidget), XtWindow(treeWidget)); - for (i = 0; i < selected_list.n_elements; i++) { - do_resources (selected_list.elements[i], op, FALSE); - } + XUnmapWindow(XtDisplay(treeWidget), XtWindow(treeWidget)); + do_resources(node, op, TRUE); + } + else if (selected_list.n_elements <= 0) { + return; + } + else { + XUnmapWindow(XtDisplay(treeWidget), XtWindow(treeWidget)); + for (int i = 0; i < selected_list.n_elements; i++) { + do_resources(selected_list.elements[i], op, FALSE); + } } - XawTreeForceLayout (treeWidget); - XMapWindow (XtDisplay(treeWidget), XtWindow(treeWidget)); - update_selection_items (); + XawTreeForceLayout(treeWidget); + XMapWindow(XtDisplay(treeWidget), XtWindow(treeWidget)); + update_selection_items(); } - /* ARGSUSED */ -static void -select_callback ( - Widget gw, /* entry widget */ - XtPointer closure, /* TRUE or FALSE */ - XtPointer data) /* undefined */ +static void +select_callback(Widget gw, /* entry widget */ + XtPointer closure, /* TRUE or FALSE */ + XtPointer data) /* undefined */ { int i; int nselected = selected_list.n_elements; XmuWidgetNode *node; switch ((long) closure) { - case SELECT_NOTHING: /* clear selection_list */ - remove_nodes_from_selected_list (0, nselected, True); - break; - - case SELECT_ALL: /* put everything on selection_list */ - add_subtree_to_selected_list (topnode, TRUE); - break; - - case SELECT_INVERT: /* toggle selection state */ - for (i = 0, node = widget_list; i < nwidgets; i++, node++) { - ViewresData *d = VData(node); - if (d->selection_index < 0) add_to_selected_list (node, TRUE); - } - remove_nodes_from_selected_list (0, nselected, True); - break; - - - case SELECT_PARENT: /* choose immediate parent */ - node = widget_to_node (gw); - if (node) { - if (node->superclass) - add_to_selected_list (node->superclass, TRUE); - } else { - for (i = 0; i < nselected; i++) { - XmuWidgetNode *nodeI = selected_list.elements[i]; - if (nodeI->superclass) - add_to_selected_list (nodeI->superclass, TRUE); - } - } - break; - - case SELECT_ANCESTORS: /* chain up adding to selection_list */ - node = widget_to_node (gw); - if (node) { - do { - add_to_selected_list (node, TRUE); - } while ((node = node->superclass) != NULL); - } else { - for (i = 0; i < nselected; i++) { - XmuWidgetNode *parent = selected_list.elements[i]; - - /* - * chain up the tree, but stop if we get to nodes that - * are already in the selected list. - */ - while ((parent = parent->superclass) != NULL) { - if (VData(parent)->selection_index >= 0) break; - add_to_selected_list (parent, TRUE); - } - } - } - break; - - case SELECT_CHILDREN: /* all direct sub nodes */ - node = widget_to_node (gw); - if (node) { - add_to_selected_list (node, TRUE); - for (node = node->children; node; node = node->siblings) { - add_to_selected_list (node, TRUE); - } - } else { - for (i = 0; i < nselected; i++) { - XmuWidgetNode *nodeI = selected_list.elements[i]; - - add_to_selected_list (nodeI, TRUE); - for (nodeI = nodeI->children; nodeI; nodeI = nodeI->siblings) { - add_to_selected_list (nodeI, TRUE); - } - } - } - break; - - case SELECT_DESCENDANTS: /* all sub nodes */ - node = widget_to_node (gw); - if (node) { - add_subtree_to_selected_list (node, TRUE); - } else { - for (i = 0; i < nselected; i++) { - XmuWidgetNode *parent = selected_list.elements[i]; - - add_subtree_to_selected_list (parent, TRUE); - } - } - break; - - case SELECT_HAS_RESOURCES: /* put all w/ rescnt > 0 on sel_list */ - for (i = 0, node = widget_list; i < nwidgets; i++, node++) { - if (VData(node)->nnew > 0) - add_to_selected_list (node, TRUE); - } - break; - - case SELECT_SHOWN_RESOURCES: - for (i = 0, node = widget_list; i < nwidgets; i++, node++) { - if (IsShowing(node)) add_to_selected_list (node, TRUE); - } - break; - - default: /* error!!! */ - XBell (XtDisplay(gw), 0); - return; + case SELECT_NOTHING: /* clear selection_list */ + remove_nodes_from_selected_list(0, nselected, True); + break; + + case SELECT_ALL: /* put everything on selection_list */ + add_subtree_to_selected_list(topnode, TRUE); + break; + + case SELECT_INVERT: /* toggle selection state */ + for (i = 0, node = widget_list; i < nwidgets; i++, node++) { + ViewresData *d = VData(node); + + if (d->selection_index < 0) + add_to_selected_list(node, TRUE); + } + remove_nodes_from_selected_list(0, nselected, True); + break; + + case SELECT_PARENT: /* choose immediate parent */ + node = widget_to_node(gw); + if (node) { + if (node->superclass) + add_to_selected_list(node->superclass, TRUE); + } + else { + for (i = 0; i < nselected; i++) { + XmuWidgetNode *nodeI = selected_list.elements[i]; + + if (nodeI->superclass) + add_to_selected_list(nodeI->superclass, TRUE); + } + } + break; + + case SELECT_ANCESTORS: /* chain up adding to selection_list */ + node = widget_to_node(gw); + if (node) { + do { + add_to_selected_list(node, TRUE); + } while ((node = node->superclass) != NULL); + } + else { + for (i = 0; i < nselected; i++) { + XmuWidgetNode *parent = selected_list.elements[i]; + + /* + * chain up the tree, but stop if we get to nodes that + * are already in the selected list. + */ + while ((parent = parent->superclass) != NULL) { + if (VData(parent)->selection_index >= 0) + break; + add_to_selected_list(parent, TRUE); + } + } + } + break; + + case SELECT_CHILDREN: /* all direct sub nodes */ + node = widget_to_node(gw); + if (node) { + add_to_selected_list(node, TRUE); + for (node = node->children; node; node = node->siblings) { + add_to_selected_list(node, TRUE); + } + } + else { + for (i = 0; i < nselected; i++) { + XmuWidgetNode *nodeI = selected_list.elements[i]; + + add_to_selected_list(nodeI, TRUE); + for (nodeI = nodeI->children; nodeI; nodeI = nodeI->siblings) { + add_to_selected_list(nodeI, TRUE); + } + } + } + break; + + case SELECT_DESCENDANTS: /* all sub nodes */ + node = widget_to_node(gw); + if (node) { + add_subtree_to_selected_list(node, TRUE); + } + else { + for (i = 0; i < nselected; i++) { + XmuWidgetNode *parent = selected_list.elements[i]; + + add_subtree_to_selected_list(parent, TRUE); + } + } + break; + + case SELECT_HAS_RESOURCES: /* put all w/ rescnt > 0 on sel_list */ + for (i = 0, node = widget_list; i < nwidgets; i++, node++) { + if (VData(node)->nnew > 0) + add_to_selected_list(node, TRUE); + } + break; + + case SELECT_SHOWN_RESOURCES: + for (i = 0, node = widget_list; i < nwidgets; i++, node++) { + if (IsShowing(node)) + add_to_selected_list(node, TRUE); + } + break; + + default: /* error!!! */ + XBell(XtDisplay(gw), 0); + return; } - update_selection_items (); + update_selection_items(); } /* ARGSUSED */ -static void -toggle_callback (Widget gw, - XtPointer closure, /* XmuWidgetNode for this widget */ - XtPointer data) /* on or off */ +static void +toggle_callback(Widget gw, + XtPointer closure, /* XmuWidgetNode for this widget */ + XtPointer data) /* on or off */ { XmuWidgetNode *node = (XmuWidgetNode *) closure; Boolean selected = (Boolean) (long) data; if (selected) { - add_to_selected_list (node, FALSE); - } else { - (void) remove_from_selected_list (node, FALSE); + add_to_selected_list(node, FALSE); + } + else { + (void) remove_from_selected_list(node, FALSE); } - update_selection_items (); + update_selection_items(); } - /* * panner/porthole controls - called when the other changes */ /* ARGSUSED */ -static void -panner_callback ( - Widget gw, /* panner widget */ - XtPointer closure, /* porthole widget */ - XtPointer data) /* report */ +static void +panner_callback(Widget gw, /* panner widget */ + XtPointer closure, /* porthole widget */ + XtPointer data) /* report */ { XawPannerReport *rep = (XawPannerReport *) data; Arg args[2]; - if (!treeWidget) return; + if (!treeWidget) + return; - XtSetArg (args[0], XtNx, -rep->slider_x); - XtSetArg (args[1], XtNy, -rep->slider_y); - XtSetValues (treeWidget, args, TWO); /* just assume... */ + XtSetArg(args[0], XtNx, -rep->slider_x); + XtSetArg(args[1], XtNy, -rep->slider_y); + XtSetValues(treeWidget, args, TWO); /* just assume... */ } /* ARGSUSED */ -static void -porthole_callback ( - Widget gw, /* porthole widget */ - XtPointer closure, /* panner widget */ - XtPointer data) /* report */ +static void +porthole_callback(Widget gw, /* porthole widget */ + XtPointer closure, /* panner widget */ + XtPointer data) /* report */ { Widget panner = (Widget) closure; XawPannerReport *rep = (XawPannerReport *) data; Arg args[6]; Cardinal n = TWO; - XtSetArg (args[0], XtNsliderX, rep->slider_x); - XtSetArg (args[1], XtNsliderY, rep->slider_y); + XtSetArg(args[0], XtNsliderX, rep->slider_x); + XtSetArg(args[1], XtNsliderY, rep->slider_y); if (rep->changed != (XawPRSliderX | XawPRSliderY)) { - XtSetArg (args[2], XtNsliderWidth, rep->slider_width); - XtSetArg (args[3], XtNsliderHeight, rep->slider_height); - XtSetArg (args[4], XtNcanvasWidth, rep->canvas_width); - XtSetArg (args[5], XtNcanvasHeight, rep->canvas_height); - n = SIX; + XtSetArg(args[2], XtNsliderWidth, rep->slider_width); + XtSetArg(args[3], XtNsliderHeight, rep->slider_height); + XtSetArg(args[4], XtNcanvasWidth, rep->canvas_width); + XtSetArg(args[5], XtNcanvasHeight, rep->canvas_height); + n = SIX; } - XtSetValues (panner, args, n); + XtSetValues(panner, args, n); } - - -static void -build_tree (XmuWidgetNode *node, Widget tree, Widget super) +static void +build_tree(XmuWidgetNode *node, Widget tree, Widget super) { - ViewresData *d = VData (node); - Widget box, w; /* widget for this Class */ - XmuWidgetNode *child; /* iterator over children */ - Arg args[3]; /* need to set super node */ - Cardinal n; /* count of args */ - static XtCallbackRec callback_rec[2] = {{ toggle_callback, NULL }, - { NULL, NULL }}; - + ViewresData *d = VData(node); + Widget box, w; /* widget for this Class */ + XmuWidgetNode *child; /* iterator over children */ + Arg args[3]; /* need to set super node */ + Cardinal n; /* count of args */ + static XtCallbackRec callback_rec[2] = { + {toggle_callback, NULL}, + {NULL, NULL} + }; n = 0; - XtSetArg (args[n], XtNtreeParent, super); n++; - box = XtCreateManagedWidget (node->label, boxWidgetClass, tree, args, n); + XtSetArg(args[n], XtNtreeParent, super); + n++; + box = XtCreateManagedWidget(node->label, boxWidgetClass, tree, args, n); n = 0; - XtSetArg (args[n], XtNlabel, (options.show_variable ? - node->label : XmuWnClassname(node))); n++; - XtSetArg (args[n], XtNcallback, callback_rec); n++; + XtSetArg(args[n], XtNlabel, (options.show_variable ? + node->label : XmuWnClassname(node))); + n++; + XtSetArg(args[n], XtNcallback, callback_rec); + n++; callback_rec[0].closure = (XtPointer) node; - w = XtCreateManagedWidget (node->label, toggleWidgetClass, box, args, n); + w = XtCreateManagedWidget(node->label, toggleWidgetClass, box, args, n); d->instance = w; /* * recursively build the rest of the tree */ for (child = node->children; child; child = child->siblings) { - build_tree (child, tree, box); + build_tree(child, tree, box); } } - -static void -set_node_labels (XmuWidgetNode *node, int depth) +static void +set_node_labels(XmuWidgetNode *node, int depth) { Arg args[1]; XmuWidgetNode *child; - ViewresData *d = VData(node); + ViewresData *d; - if (!node) return; - XtSetArg (args[0], XtNlabel, (options.show_variable ? - node->label : XmuWnClassname(node))); - XtSetValues (d->instance, args, ONE); + if (!node) + return; + d = VData(node); + XtSetArg(args[0], XtNlabel, (options.show_variable ? + node->label : XmuWnClassname(node))); + XtSetValues(d->instance, args, ONE); for (child = node->children; child; child = child->siblings) { - set_node_labels (child, depth + 1); + set_node_labels(child, depth + 1); } } - -static void -oneof_sensitive (Boolean choosea, Widget a, Widget b) +static void +oneof_sensitive(Boolean choosea, Widget a, Widget b) { - static Arg args[1] = { { XtNsensitive, (XtArgVal) NULL } }; + static Arg args[1] = { {XtNsensitive, (XtArgVal) NULL} }; args[0].value = (XtArgVal) TRUE; - XtSetValues (choosea ? a : b, args, ONE); + XtSetValues(choosea ? a : b, args, ONE); args[0].value = (XtArgVal) FALSE; - XtSetValues (choosea ? b : a, args, ONE); + XtSetValues(choosea ? b : a, args, ONE); } -static void -set_labeltype_menu (Boolean isvar, Boolean doall) +static void +set_labeltype_menu(Boolean isvar, Boolean doall) { options.show_variable = isvar; - oneof_sensitive (isvar, view_widgets[VIEW_CLASSES], - view_widgets[VIEW_VARIABLES]); + oneof_sensitive(isvar, view_widgets[VIEW_CLASSES], + view_widgets[VIEW_VARIABLES]); if (doall) { - XUnmapWindow (XtDisplay(treeWidget), XtWindow(treeWidget)); - set_node_labels (topnode, 0); - XawTreeForceLayout (treeWidget); - XMapWindow (XtDisplay(treeWidget), XtWindow(treeWidget)); + XUnmapWindow(XtDisplay(treeWidget), XtWindow(treeWidget)); + set_node_labels(topnode, 0); + XawTreeForceLayout(treeWidget); + XMapWindow(XtDisplay(treeWidget), XtWindow(treeWidget)); } } -static void -set_orientation_menu (XtGravity grav, Boolean dosetvalues) +static void +set_orientation_menu(XtGravity grav, Boolean dosetvalues) { #define CHOOSE(val) (sensitiveargs + (grav != (val))) - XtSetValues (view_widgets[VIEW_HORIZONTAL], CHOOSE(WestGravity), ONE); - XtSetValues (view_widgets[VIEW_VERTICAL], CHOOSE(NorthGravity), ONE); + XtSetValues(view_widgets[VIEW_HORIZONTAL], CHOOSE(WestGravity), ONE); + XtSetValues(view_widgets[VIEW_VERTICAL], CHOOSE(NorthGravity), ONE); #undef CHOOSE if (dosetvalues) { - Arg args[1]; + Arg args[1]; - XtSetArg (args[0], XtNgravity, grav); - XUnmapWindow (XtDisplay(treeWidget), XtWindow(treeWidget)); - XtSetValues (treeWidget, args, ONE); - XMapWindow (XtDisplay(treeWidget), XtWindow(treeWidget)); + XtSetArg(args[0], XtNgravity, grav); + XUnmapWindow(XtDisplay(treeWidget), XtWindow(treeWidget)); + XtSetValues(treeWidget, args, ONE); + XMapWindow(XtDisplay(treeWidget), XtWindow(treeWidget)); } } - /***************************************************************************** * * * viewres - visual class browser for Xt * @@ -868,198 +877,197 @@ set_orientation_menu (XtGravity grav, Boolean dosetvalues) *****************************************************************************/ int -main (int argc, char *argv[]) +main(int argc, char *argv[]) { Widget toplevel, pane, box, dummy, porthole, panner, form; - XmuWidgetNode *rootNode; /* always the root of the resource hierarchy */ + XmuWidgetNode *rootNode; /* always the root of the resource hierarchy */ XtAppContext app_con; Arg args[6]; Dimension canvasWidth, canvasHeight, sliderWidth, sliderHeight; - static XtCallbackRec callback_rec[2] = {{ NULL, NULL }, { NULL, NULL }}; + static XtCallbackRec callback_rec[2] = { {NULL, NULL}, {NULL, NULL} }; XtGravity grav; - int i; ProgramName = argv[0]; XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL); - toplevel = XtAppInitialize (&app_con, "Viewres", - Options, XtNumber (Options), - &argc, argv, (String *) fallback_resources, - (ArgList) NULL, ZERO); - if (argc != 1) usage (); + toplevel = XtAppInitialize(&app_con, "Viewres", + Options, XtNumber(Options), + &argc, argv, (String *) fallback_resources, + (ArgList) NULL, ZERO); + if (argc != 1) + usage(); - initialize_widgetnode_list (&selected_list.elements, - &selected_list.max_elements, 10); + initialize_widgetnode_list(&selected_list.elements, + &selected_list.max_elements, 10); - XtGetApplicationResources (toplevel, (XtPointer) &options, - Resources, XtNumber(Resources), NULL, ZERO); - XmuWnInitializeNodes (widget_list, nwidgets); + XtGetApplicationResources(toplevel, (XtPointer) & options, + Resources, XtNumber(Resources), NULL, ZERO); + XmuWnInitializeNodes(widget_list, nwidgets); - topnode = XmuWnNameToNode (widget_list, nwidgets, options.top_object); + topnode = XmuWnNameToNode(widget_list, nwidgets, options.top_object); if (!topnode) { - fprintf(stderr, "%s: no widget with name \"%s\" found.\n", - ProgramName, options.top_object); - exit(1); + fprintf(stderr, "%s: no widget with name \"%s\" found.\n", + ProgramName, options.top_object); + exit(1); } - XtAppAddActions (app_con, viewres_actions, XtNumber (viewres_actions)); + XtAppAddActions(app_con, viewres_actions, XtNumber(viewres_actions)); XtOverrideTranslations - (toplevel, XtParseTranslationTable ("<Message>WM_PROTOCOLS: Quit()")); + (toplevel, XtParseTranslationTable("<Message>WM_PROTOCOLS: Quit()")); /* * create dummy widgets to initialize resources */ - XtSetArg (args[0], XtNwidth, 1); - XtSetArg (args[1], XtNheight, 1); - dummy = XtCreateWidget ("dummy", widgetClass, toplevel, args, TWO); + XtSetArg(args[0], XtNwidth, 1); + XtSetArg(args[1], XtNheight, 1); + dummy = XtCreateWidget("dummy", widgetClass, toplevel, args, TWO); rootNode = XmuWnNameToNode(widget_list, nwidgets, "Object"); - for (i = 0; i < nwidgets; i++) { - XmuWidgetNode *node = &widget_list[i]; - XmuWnFetchResources (node, dummy, rootNode); - node->data = (XtPointer) create_viewres_data (node); + for (int i = 0; i < nwidgets; i++) { + XmuWidgetNode *node = &widget_list[i]; + + XmuWnFetchResources(node, dummy, rootNode); + node->data = (XtPointer) create_viewres_data(node); } - XtDestroyWidget (dummy); + XtDestroyWidget(dummy); - pane = XtCreateManagedWidget ("pane", panedWidgetClass, toplevel, - (ArgList) NULL, ZERO); + pane = XtCreateManagedWidget("pane", panedWidgetClass, toplevel, + (ArgList) NULL, ZERO); - box = XtCreateManagedWidget ("buttonbox", boxWidgetClass, pane, - (ArgList) NULL, ZERO); - (void) XtCreateManagedWidget ("quit", commandWidgetClass, box, - (ArgList) NULL, ZERO); + box = XtCreateManagedWidget("buttonbox", boxWidgetClass, pane, + (ArgList) NULL, ZERO); + (void) XtCreateManagedWidget("quit", commandWidgetClass, box, + (ArgList) NULL, ZERO); /* * Format menu */ - XtSetArg (args[0], XtNmenuName, "viewMenu"); - viewButton = XtCreateManagedWidget ("view", menuButtonWidgetClass, box, - args, ONE); - viewMenu = XtCreatePopupShell ("viewMenu", simpleMenuWidgetClass, - viewButton, (ArgList) NULL, ZERO); - XtSetArg (args[0], XtNcallback, callback_rec); + XtSetArg(args[0], XtNmenuName, "viewMenu"); + viewButton = XtCreateManagedWidget("view", menuButtonWidgetClass, box, + args, ONE); + viewMenu = XtCreatePopupShell("viewMenu", simpleMenuWidgetClass, + viewButton, (ArgList) NULL, ZERO); + XtSetArg(args[0], XtNcallback, callback_rec); #define MAKE_VIEW(n,v,name) \ callback_rec[0].closure = (XtPointer) v; \ view_widgets[n] = XtCreateManagedWidget (name, smeBSBObjectClass, \ viewMenu, args, ONE) callback_rec[0].callback = (XtCallbackProc) gravity_callback; - MAKE_VIEW (VIEW_HORIZONTAL, WestGravity, "layoutHorizontal"); - MAKE_VIEW (VIEW_VERTICAL, NorthGravity, "layoutVertical"); + MAKE_VIEW(VIEW_HORIZONTAL, WestGravity, "layoutHorizontal"); + MAKE_VIEW(VIEW_VERTICAL, NorthGravity, "layoutVertical"); - (void) XtCreateManagedWidget ("line1", smeLineObjectClass, viewMenu, - (ArgList) NULL, ZERO); + (void) XtCreateManagedWidget("line1", smeLineObjectClass, viewMenu, + (ArgList) NULL, ZERO); callback_rec[0].callback = (XtCallbackProc) variable_labeltype_callback; - MAKE_VIEW (VIEW_VARIABLES, TRUE, "namesVariable"); - MAKE_VIEW (VIEW_CLASSES, FALSE, "namesClass"); + MAKE_VIEW(VIEW_VARIABLES, TRUE, "namesVariable"); + MAKE_VIEW(VIEW_CLASSES, FALSE, "namesClass"); - (void) XtCreateManagedWidget ("line2", smeLineObjectClass, viewMenu, - (ArgList) NULL, ZERO); + (void) XtCreateManagedWidget("line2", smeLineObjectClass, viewMenu, + (ArgList) NULL, ZERO); callback_rec[0].callback = (XtCallbackProc) show_resources_callback; - MAKE_VIEW (VIEW_SHOW_RESOURCES, BOOL_ON, "viewResources"); - MAKE_VIEW (VIEW_HIDE_RESOURCES, BOOL_OFF, "viewNoResources"); + MAKE_VIEW(VIEW_SHOW_RESOURCES, BOOL_ON, "viewResources"); + MAKE_VIEW(VIEW_HIDE_RESOURCES, BOOL_OFF, "viewNoResources"); #undef MAKE_VIEW /* * Select menu */ - XtSetArg (args[0], XtNmenuName, "selectMenu"); - selectButton = XtCreateManagedWidget ("select", menuButtonWidgetClass, box, - args, ONE); - selectMenu = XtCreatePopupShell ("selectMenu", simpleMenuWidgetClass, - selectButton, (ArgList) NULL, ZERO); - XtSetArg (args[0], XtNcallback, callback_rec); + XtSetArg(args[0], XtNmenuName, "selectMenu"); + selectButton = XtCreateManagedWidget("select", menuButtonWidgetClass, box, + args, ONE); + selectMenu = XtCreatePopupShell("selectMenu", simpleMenuWidgetClass, + selectButton, (ArgList) NULL, ZERO); + XtSetArg(args[0], XtNcallback, callback_rec); callback_rec[0].callback = (XtCallbackProc) select_callback; #define MAKE_SELECT(n,name) \ callback_rec[0].closure = (XtPointer) n; \ select_widgets[n] = XtCreateManagedWidget (name, smeBSBObjectClass, \ selectMenu, args, ONE) - MAKE_SELECT (SELECT_NOTHING, "unselect"); - MAKE_SELECT (SELECT_ALL, "selectAll"); - MAKE_SELECT (SELECT_INVERT, "selectInvert"); - (void) XtCreateManagedWidget ("line1", smeLineObjectClass, selectMenu, - (ArgList) NULL, ZERO); - MAKE_SELECT (SELECT_PARENT, "selectParent"); - MAKE_SELECT (SELECT_ANCESTORS, "selectAncestors"); - MAKE_SELECT (SELECT_CHILDREN, "selectChildren"); - MAKE_SELECT (SELECT_DESCENDANTS, "selectDescendants"); - (void) XtCreateManagedWidget ("line2", smeLineObjectClass, selectMenu, - (ArgList) NULL, ZERO); - MAKE_SELECT (SELECT_HAS_RESOURCES, "selectHasResources"); - MAKE_SELECT (SELECT_SHOWN_RESOURCES, "selectShownResources"); + MAKE_SELECT(SELECT_NOTHING, "unselect"); + MAKE_SELECT(SELECT_ALL, "selectAll"); + MAKE_SELECT(SELECT_INVERT, "selectInvert"); + (void) XtCreateManagedWidget("line1", smeLineObjectClass, selectMenu, + (ArgList) NULL, ZERO); + MAKE_SELECT(SELECT_PARENT, "selectParent"); + MAKE_SELECT(SELECT_ANCESTORS, "selectAncestors"); + MAKE_SELECT(SELECT_CHILDREN, "selectChildren"); + MAKE_SELECT(SELECT_DESCENDANTS, "selectDescendants"); + (void) XtCreateManagedWidget("line2", smeLineObjectClass, selectMenu, + (ArgList) NULL, ZERO); + MAKE_SELECT(SELECT_HAS_RESOURCES, "selectHasResources"); + MAKE_SELECT(SELECT_SHOWN_RESOURCES, "selectShownResources"); #undef MAKE_SELECT - form = XtCreateManagedWidget ("treeform", formWidgetClass, pane, - (ArgList) NULL, ZERO); + form = XtCreateManagedWidget("treeform", formWidgetClass, pane, + (ArgList) NULL, ZERO); /* * create the panner and the porthole and then connect them with the * callbacks (passing the other widget each callback) */ - XtSetArg (args[0], XtNbackgroundPixmap, None); /* faster updates */ - porthole = XtCreateManagedWidget ("porthole", portholeWidgetClass, form, - args, ONE); - panner = XtCreateManagedWidget ("panner", pannerWidgetClass, form, - (ArgList) NULL, ZERO); + XtSetArg(args[0], XtNbackgroundPixmap, None); /* faster updates */ + porthole = XtCreateManagedWidget("porthole", portholeWidgetClass, form, + args, ONE); + panner = XtCreateManagedWidget("panner", pannerWidgetClass, form, + (ArgList) NULL, ZERO); - XtSetArg (args[0], XtNreportCallback, callback_rec); + XtSetArg(args[0], XtNreportCallback, callback_rec); callback_rec[0].callback = (XtCallbackProc) panner_callback; callback_rec[0].closure = (XtPointer) porthole; - XtSetValues (panner, args, ONE); + XtSetValues(panner, args, ONE); callback_rec[0].callback = (XtCallbackProc) porthole_callback; callback_rec[0].closure = (XtPointer) panner; - XtSetValues (porthole, args, ONE); + XtSetValues(porthole, args, ONE); /* - * now that the panner and porthole are set up, insert the tree and + * now that the panner and porthole are set up, insert the tree and * fix up the menu, fill in the nodes */ - treeWidget = XtCreateManagedWidget ("tree", treeWidgetClass, - porthole, (ArgList) NULL, ZERO); + treeWidget = XtCreateManagedWidget("tree", treeWidgetClass, + porthole, (ArgList) NULL, ZERO); - set_labeltype_menu (options.show_variable, FALSE); - XtSetArg (args[0], XtNgravity, &grav); - XtGetValues (treeWidget, args, ONE); - set_orientation_menu (grav, FALSE); - update_selection_items (); - build_tree (topnode, treeWidget, (Widget) NULL); + set_labeltype_menu(options.show_variable, FALSE); + XtSetArg(args[0], XtNgravity, &grav); + XtGetValues(treeWidget, args, ONE); + set_orientation_menu(grav, FALSE); + update_selection_items(); + build_tree(topnode, treeWidget, (Widget) NULL); /* - * Realize the tree, but do not map it (we set mappedWhenManaged to + * Realize the tree, but do not map it (we set mappedWhenManaged to * false up above). Get the initial size of the tree so that we can * size the panner appropriately. */ - XtRealizeWidget (toplevel); + XtRealizeWidget(toplevel); wm_delete_window = XInternAtom(XtDisplay(toplevel), "WM_DELETE_WINDOW", - False); - (void) XSetWMProtocols (XtDisplay(toplevel), XtWindow(toplevel), - &wm_delete_window, 1); + False); + (void) XSetWMProtocols(XtDisplay(toplevel), XtWindow(toplevel), + &wm_delete_window, 1); - XtSetArg (args[0], XtNwidth, &canvasWidth); - XtSetArg (args[1], XtNheight, &canvasHeight); - XtGetValues (treeWidget, args, TWO); + XtSetArg(args[0], XtNwidth, &canvasWidth); + XtSetArg(args[1], XtNheight, &canvasHeight); + XtGetValues(treeWidget, args, TWO); - XtSetArg (args[0], XtNwidth, &sliderWidth); - XtSetArg (args[1], XtNheight, &sliderHeight); - XtGetValues (porthole, args, TWO); + XtSetArg(args[0], XtNwidth, &sliderWidth); + XtSetArg(args[1], XtNheight, &sliderHeight); + XtGetValues(porthole, args, TWO); - XtSetArg (args[0], XtNcanvasWidth, canvasWidth); - XtSetArg (args[1], XtNcanvasHeight, canvasHeight); - XtSetArg (args[2], XtNsliderWidth, sliderWidth); - XtSetArg (args[3], XtNsliderHeight, sliderHeight); - XtSetValues (panner, args, FOUR); + XtSetArg(args[0], XtNcanvasWidth, canvasWidth); + XtSetArg(args[1], XtNcanvasHeight, canvasHeight); + XtSetArg(args[2], XtNsliderWidth, sliderWidth); + XtSetArg(args[3], XtNsliderHeight, sliderHeight); + XtSetValues(panner, args, FOUR); - XRaiseWindow (XtDisplay(panner), XtWindow(panner)); - XtAppMainLoop (app_con); + XRaiseWindow(XtDisplay(panner), XtWindow(panner)); + XtAppMainLoop(app_con); return 0; } - - /***************************************************************************** * * * viewres translation table action routines * @@ -1067,142 +1075,152 @@ main (int argc, char *argv[]) *****************************************************************************/ /* ARGSUSED */ -static void -ActionQuit (Widget w, XEvent *event, - String *params, Cardinal *num_params) +static void +ActionQuit(Widget w, XEvent *event, String *params, Cardinal *num_params) { - exit (0); + exit(0); } /* ARGSUSED */ -static void -ActionSetLableType (Widget w, XEvent *event, - String *params, Cardinal *num_params) +static void +ActionSetLableType(Widget w, XEvent *event, + String *params, Cardinal *num_params) { const char *cmd; Boolean oldvar = options.show_variable, newvar; switch (*num_params) { - case 0: - cmd = "toggle"; - break; - case 1: - cmd = params[0]; - break; - default: - XBell (XtDisplay(w), 0); - return; + case 0: + cmd = "toggle"; + break; + case 1: + cmd = params[0]; + break; + default: + XBell(XtDisplay(w), 0); + return; } - if (XmuCompareISOLatin1 (cmd, "toggle") == 0) { - newvar = !oldvar; - } else if (XmuCompareISOLatin1 (cmd, "variable") == 0) { - newvar = TRUE; - } else if (XmuCompareISOLatin1 (cmd, "class") == 0) { - newvar = FALSE; - } else { - XBell (XtDisplay(w), 0); - return; + if (XmuCompareISOLatin1(cmd, "toggle") == 0) { + newvar = !oldvar; + } + else if (XmuCompareISOLatin1(cmd, "variable") == 0) { + newvar = TRUE; + } + else if (XmuCompareISOLatin1(cmd, "class") == 0) { + newvar = FALSE; + } + else { + XBell(XtDisplay(w), 0); + return; } - if (newvar != oldvar) set_labeltype_menu (newvar, TRUE); + if (newvar != oldvar) + set_labeltype_menu(newvar, TRUE); return; } /* ARGSUSED */ -static void -ActionSetOrientation (Widget w, XEvent *event, - String *params, Cardinal *num_params) +static void +ActionSetOrientation(Widget w, XEvent *event, + String *params, Cardinal *num_params) { XtGravity newgrav = ForgetGravity; if (*num_params < 1) { - Arg arg; - XtGravity oldgrav = ForgetGravity; - - XtSetArg (arg, XtNgravity, &oldgrav); - XtGetValues (treeWidget, &arg, ONE); - switch (oldgrav) { - case WestGravity: newgrav = NorthGravity; break; - case NorthGravity: newgrav = WestGravity; break; - case EastGravity: newgrav = SouthGravity; break; - case SouthGravity: newgrav = EastGravity; break; - default: - return; - } - } else { - XrmValue fromval, toval; - - fromval.size = sizeof (String); - fromval.addr = (XPointer) params[0]; - toval.size = sizeof (XtGravity); - toval.addr = (XPointer) &newgrav; - XtConvertAndStore (treeWidget, XtRString, &fromval, - XtRGravity, &toval); + Arg arg; + XtGravity oldgrav = ForgetGravity; + + XtSetArg(arg, XtNgravity, &oldgrav); + XtGetValues(treeWidget, &arg, ONE); + switch (oldgrav) { + case WestGravity: + newgrav = NorthGravity; + break; + case NorthGravity: + newgrav = WestGravity; + break; + case EastGravity: + newgrav = SouthGravity; + break; + case SouthGravity: + newgrav = EastGravity; + break; + default: + return; + } + } + else { + XrmValue fromval, toval; + + fromval.size = sizeof(String); + fromval.addr = (XPointer) params[0]; + toval.size = sizeof(XtGravity); + toval.addr = (XPointer) & newgrav; + XtConvertAndStore(treeWidget, XtRString, &fromval, XtRGravity, &toval); } switch (newgrav) { - case WestGravity: case NorthGravity: case EastGravity: case SouthGravity: - break; - default: - XBell (XtDisplay(w), 0); - return; + case WestGravity: + case NorthGravity: + case EastGravity: + case SouthGravity: + break; + default: + XBell(XtDisplay(w), 0); + return; } - set_orientation_menu (newgrav, TRUE); + set_orientation_menu(newgrav, TRUE); return; } - -static void -do_single_arg (Widget w, String *params, Cardinal nparams, - struct _nametable table[] , int nentries, XtCallbackProc proc) +static void +do_single_arg(Widget w, String *params, Cardinal nparams, + struct _nametable table[], int nentries, XtCallbackProc proc) { int obj; - int i; if (nparams != 1) { - XBell (XtDisplay(w), 0); - return; + XBell(XtDisplay(w), 0); + return; } - for (i = 0; i < nentries; i++) { - if (XmuCompareISOLatin1 (params[0], table[i].name) == 0) { - obj = table[i].value; - goto found; - } + for (int i = 0; i < nentries; i++) { + if (XmuCompareISOLatin1(params[0], table[i].name) == 0) { + obj = table[i].value; + goto found; + } } - XBell (XtDisplay(w), 0); + XBell(XtDisplay(w), 0); return; - found: + found: /* * use any old widget */ (*proc) (w, (XtPointer) (long) obj, (XtPointer) NULL); } - /* ARGSUSED */ -static void -ActionSelect (Widget w, XEvent *event, - String *params, Cardinal *num_params) +static void +ActionSelect(Widget w, XEvent *event, String *params, Cardinal *num_params) { - do_single_arg (w, params, *num_params, select_nametable, - (int) XtNumber(select_nametable), select_callback); + do_single_arg(w, params, *num_params, select_nametable, + (int) XtNumber(select_nametable), select_callback); } - /* ARGSUSED */ -static void ActionResources (Widget w, XEvent *event, - String *params, Cardinal *num_params) +static void +ActionResources(Widget w, XEvent *event, + String *params, Cardinal *num_params) { if (*num_params == 0) { - show_resources_callback (w, (XtPointer) BOOL_TOGGLE, (XtPointer) NULL); - } else { - do_single_arg (w, params, *num_params, boolean_nametable, - (int) XtNumber(boolean_nametable), - show_resources_callback); + show_resources_callback(w, (XtPointer) BOOL_TOGGLE, (XtPointer) NULL); + } + else { + do_single_arg(w, params, *num_params, boolean_nametable, + (int) XtNumber(boolean_nametable), + show_resources_callback); } } - |