Update to editres 1.0.7

This commit is contained in:
matthieu 2018-05-21 15:15:36 +00:00
parent 307bf81e1f
commit d8bf5bd739
21 changed files with 1233 additions and 597 deletions

View File

@ -1,3 +1,220 @@
commit 9644bfe7f56eb8c1cc795b724a6fc95ae4172d43
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Mar 4 18:43:17 2018 -0800
editres 1.0.7
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 476ad1ea6588e277d59ae6d0fc64a17bc1b5df5a
Author: Mihail Konev <k.mvc@ya.ru>
Date: Thu Jan 26 14:00:20 2017 +1000
autogen: add default patch prefix
Signed-off-by: Mihail Konev <k.mvc@ya.ru>
commit e03471032c584669d06ca4fe47f52cafd9013493
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date: Mon Mar 9 12:00:52 2015 +0000
autogen.sh: use quoted string variables
Place quotes around the $srcdir, $ORIGDIR and $0 variables to prevent
fall-outs, when they contain space.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
commit 931b91c5ff7b2dedb149f0a89010b64407baabf3
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue Jan 24 10:32:07 2017 +1000
autogen.sh: use exec instead of waiting for configure to finish
Syncs the invocation of configure with the one from the server.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
commit 3f4d7d388dce6c9783c30bcc006f73d799845c0e
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Jan 1 11:02:42 2016 -0800
Add intro to editres to README
Mostly copied from editres man page
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit a415214bf282dcc8385f2101e6f8c018e188fa41
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat May 9 13:13:32 2015 -0700
Fix -Wmissing-noreturn warnings
editres.c:140:1: warning: function 'Syntax' could be declared with
attribute 'noreturn' [-Wmissing-noreturn]
handler.c:65:1: warning: function 'Quit' could be declared with
attribute 'noreturn' [-Wmissing-noreturn]
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit a6733f76dad52644bd45a8674bf0ea97c6e424ac
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat May 9 12:47:23 2015 -0700
Strip trailing whitespace
'git diff -w' shows no changes for this commit
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit c33a44612947eb91579b24f98848812018dd8c16
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat May 9 11:38:18 2015 -0700
Fix -Wsign-compare warnings
actions.c:291:21: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare]
for ( i = 0 ; i < num_table; i++ )
~ ^ ~~~~~~~~~
actions.c:299:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare]
for (i = 0; i < num_table; ) {
~ ^ ~~~~~~~~~
actions.c:302:8: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
if (i == (num_table - 1))
~ ^ ~~~~~~~~~~~~~
actions.c:304:13: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare]
else if (i < num_table)
~ ^ ~~~~~~~~~
geometry.c:150:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare]
for (i = 0; i < tree_info->num_nodes; i++)
~ ^ ~~~~~~~~~~~~~~~~~~~~
geometry.c:380:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare]
for (i = 0; i < tree_info->num_flash_widgets; i++) {
~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
geometry.c:401:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare]
for (i = 0; i < tree_info->num_flash_widgets; i++)
~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
geometry.c:423:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare]
for (i = 0; i < tree_info->num_flash_widgets; i++)
~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
geometry.c:428:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare]
for (i = 0; i < tree_info->num_flash_widgets; i++)
~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
handler.c:475:13: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare]
if (len > malloc_size) {
~~~ ^ ~~~~~~~~~~~
handler.c:476:58: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion]
malloc_string = XtRealloc(malloc_string, sizeof(char) * len);
~ ^~~
handler.c:477:16: warning: implicit conversion changes signedness: 'int' to 'Cardinal' (aka 'unsigned int') [-Wsign-conversion]
malloc_size = len;
~ ^~~
utils.c:167:37: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare]
for (node = top_node, i = 1 ; i < number; i++) {
~ ^ ~~~~~~
utils.c:170:16: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare]
for (j = 0; j < node->num_children; j++) {
~ ^ ~~~~~~~~~~~~~~~~~~
utils.c:215:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare]
for (i = 0; i < node->num_children; i++) {
~ ^ ~~~~~~~~~~~~~~~~~~
utils.c:787:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare]
for (i = 0; i < top_node->num_children; i++)
~ ^ ~~~~~~~~~~~~~~~~~~~~~~
wtree.c:129:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare]
for (i = 0; i < top->num_children; i++)
~ ^ ~~~~~~~~~~~~~~~~~
wtree.c:194:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare]
for (i = 0; i < info->num_nodes; i++) {
~ ^ ~~~~~~~~~~~~~~~
wtree.c:216:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare]
for (i = 0; i < info->num_nodes; i++)
~ ^ ~~~~~~~~~~~~~~~
wtree.c:270:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare]
for (i = 0; i < top->num_children; i++)
~ ^ ~~~~~~~~~~~~~~~~~
wtree.c:339:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare]
for (i = 0; i < num_active_nodes; i++)
~ ^ ~~~~~~~~~~~~~~~~
wtree.c:386:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare]
for (i = 0; i < node->num_children; i++)
~ ^ ~~~~~~~~~~~~~~~~~~
wtree.c:446:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare]
for (i = 0; i < node->num_children; i++)
~ ^ ~~~~~~~~~~~~~~~~~~
wtree.c:478:16: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare]
for (i = 0; i < node->num_children; i++) {
~ ^ ~~~~~~~~~~~~~~~~~~
wtree.c:607:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare]
for (i = 0; i < tree_info->num_nodes; i++)
~ ^ ~~~~~~~~~~~~~~~~~~~~
wtree.c:686:19: warning: comparison of integers of different signs: 'int' and 'Cardinal' (aka 'unsigned int') [-Wsign-compare]
for (i = 0; i < node->num_children; i++)
~ ^ ~~~~~~~~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit af90a105ec97c6d856d2e8a80e8822c3e192d1e9
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat May 9 11:19:33 2015 -0700
Replace remaining sprintf calls with snprintf
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 9ffefd5b3d38e9ed2b5ed59bc50e8a7da761fb77
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat May 9 11:17:38 2015 -0700
Replace XtMalloc+sprintf pair with XtAsprintf call
Raises required version of libXt to >= 1.0.99.1
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 15f9d88e13bda2617c05c278a1ca9f6ce26df479
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Jun 1 21:06:47 2014 -0700
autogen.sh: Honor NOCONFIGURE=1
See http://people.gnome.org/~walters/docs/build-api.txt
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit eed2fbbfc5292b5cf02d4c4b9f10266d8a41b787
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Jun 1 21:06:47 2014 -0700
configure: Drop AM_MAINTAINER_MODE
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 57e1f1c4aa60136ab22e3faf75832c728beee4aa
Author: Eric S. Raymond <esr@thyrsus.com>
Date: Thu Jun 6 15:50:08 2013 -0400
Avoid a spurious warning during XML upconversion.
commit 703edaa26044cfa0a607fa7b93396095fdfdfbaa
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat Jan 19 09:21:50 2013 -0800
config: Add missing AC_CONFIG_SRCDIR
Regroup AC statements under the Autoconf initialization section.
Regroup AM statements under the Automake initialization section.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit c256f5a1e82ed874d8bd068901dd9b138adb6f89
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat Jan 12 16:05:16 2013 -0800

View File

@ -1,6 +1,6 @@
#
#
# Copyright 2005 Red Hat, Inc.
#
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
@ -10,7 +10,7 @@
# specific, written prior permission. Red Hat makes no
# representations about the suitability of this software for any purpose. It
# is provided "as is" without express or implied warranty.
#
#
# RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
# EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR

View File

@ -14,9 +14,9 @@
@SET_MAKE@
#
#
# Copyright 2005 Red Hat, Inc.
#
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
@ -26,7 +26,7 @@
# specific, written prior permission. Red Hat makes no
# representations about the suitability of this software for any purpose. It
# is provided "as is" without express or implied warranty.
#
#
# RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
# EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
@ -77,8 +77,8 @@ subdir = .
DIST_COMMON = README $(am__configure_deps) $(dist_appdefault_DATA) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/config.h.in $(top_srcdir)/configure AUTHORS COPYING \
ChangeLog INSTALL config.guess config.sub depcomp install-sh \
missing
ChangeLog INSTALL compile config.guess config.sub depcomp \
install-sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \

View File

@ -1,6 +1,14 @@
Editres is a tool that allows users and application developers to view
the full widget hierarchy of any Xt Toolkit application that speaks the
Editres protocol. In addition, editres will help the user construct
resource specifications, allow the user to apply the resource to
the application and view the results dynamically. Once the user is
happy with a resource specification editres will append the resource
string to the user's X Resources file.
Instructions for building Editres.
For more information on editres usage, see:
http://www.rahul.net/kenton/editres.html
Editres depends on the _EresInsert<something> and
_EresRetrieve<something> routines that are are implemented and used by

View File

@ -1242,7 +1242,7 @@ AC_SUBST([am__untar])
dnl xorg-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure.
dnl
dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
dnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
dnl
dnl Permission is hereby granted, free of charge, to any person obtaining a
dnl copy of this software and associated documentation files (the "Software"),
@ -1279,7 +1279,7 @@ dnl DEALINGS IN THE SOFTWARE.
# See the "minimum version" comment for each macro you use to see what
# version you require.
m4_defun([XORG_MACROS_VERSION],[
m4_define([vers_have], [1.19.0])
m4_define([vers_have], [1.19.2])
m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
m4_if(m4_cmp(maj_have, maj_needed), 0,,
@ -1357,6 +1357,17 @@ AC_DEFUN([XORG_MANPAGE_SECTIONS],[
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([AC_PROG_SED])
case $host_os in
solaris*)
# Solaris 2.0 - 11.3 use SysV man page section numbers, so we
# check for a man page file found in later versions that use
# traditional section numbers instead
AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
[SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
;;
*) SYSV_MAN_SECTIONS=false ;;
esac
if test x$APP_MAN_SUFFIX = x ; then
APP_MAN_SUFFIX=1
fi
@ -1372,9 +1383,9 @@ if test x$LIB_MAN_DIR = x ; then
fi
if test x$FILE_MAN_SUFFIX = x ; then
case $host_os in
solaris*) FILE_MAN_SUFFIX=4 ;;
*) FILE_MAN_SUFFIX=5 ;;
case $SYSV_MAN_SECTIONS in
true) FILE_MAN_SUFFIX=4 ;;
*) FILE_MAN_SUFFIX=5 ;;
esac
fi
if test x$FILE_MAN_DIR = x ; then
@ -1382,9 +1393,9 @@ if test x$FILE_MAN_DIR = x ; then
fi
if test x$MISC_MAN_SUFFIX = x ; then
case $host_os in
solaris*) MISC_MAN_SUFFIX=5 ;;
*) MISC_MAN_SUFFIX=7 ;;
case $SYSV_MAN_SECTIONS in
true) MISC_MAN_SUFFIX=5 ;;
*) MISC_MAN_SUFFIX=7 ;;
esac
fi
if test x$MISC_MAN_DIR = x ; then
@ -1392,9 +1403,9 @@ if test x$MISC_MAN_DIR = x ; then
fi
if test x$DRIVER_MAN_SUFFIX = x ; then
case $host_os in
solaris*) DRIVER_MAN_SUFFIX=7 ;;
*) DRIVER_MAN_SUFFIX=4 ;;
case $SYSV_MAN_SECTIONS in
true) DRIVER_MAN_SUFFIX=7 ;;
*) DRIVER_MAN_SUFFIX=4 ;;
esac
fi
if test x$DRIVER_MAN_DIR = x ; then
@ -1402,9 +1413,9 @@ if test x$DRIVER_MAN_DIR = x ; then
fi
if test x$ADMIN_MAN_SUFFIX = x ; then
case $host_os in
solaris*) ADMIN_MAN_SUFFIX=1m ;;
*) ADMIN_MAN_SUFFIX=8 ;;
case $SYSV_MAN_SECTIONS in
true) ADMIN_MAN_SUFFIX=1m ;;
*) ADMIN_MAN_SUFFIX=8 ;;
esac
fi
if test x$ADMIN_MAN_DIR = x ; then
@ -1665,13 +1676,24 @@ m4_ifval([$1],
fi])
# Test for the ability of xmlto to generate a text target
#
# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
# following test for empty XML docbook files.
# For compatibility reasons use the following empty XML docbook file and if
# it fails try it again with a non-empty XML file.
have_xmlto_text=no
cat > conftest.xml << "EOF"
EOF
AS_IF([test "$have_xmlto" = yes],
[AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
[have_xmlto_text=yes],
[AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])
[# Try it again with a non-empty XML file.
cat > conftest.xml << "EOF"
<x></x>
EOF
AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
[have_xmlto_text=yes],
[AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
rm -f conftest.xml
AM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
@ -3067,8 +3089,9 @@ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
echo 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
touch \$(top_srcdir)/INSTALL; \
echo 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
AC_SUBST([INSTALL_CMD])
]) # XORG_INSTALL
dnl Copyright 2005 Red Hat, Inc
@ -3129,10 +3152,11 @@ AC_DEFUN([XORG_RELEASE_VERSION],[
#
#
AC_DEFUN([XORG_CHANGELOG], [
CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
CHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
echo 'git directory not found: installing possibly empty changelog.' >&2)"
|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
touch \$(top_srcdir)/ChangeLog; \
echo 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
AC_SUBST([CHANGELOG_CMD])
]) # XORG_CHANGELOG

View File

@ -28,7 +28,7 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Intrinsic.h>
#include <X11/Xutil.h>
#include <X11/Xaw/Cardinals.h>
#include <X11/Xaw/Cardinals.h>
#include <X11/Xmu/CharSet.h>
#include "editresP.h"
@ -61,20 +61,20 @@ static struct ActionValues label_values[] = {
{ "toggle", (int) ToggleLabel }
};
static void EnableGetVal ( Widget w, XEvent *event,
static void EnableGetVal ( Widget w, XEvent *event,
String *params, Cardinal * num_params );
static void SelectAction ( Widget w, XEvent *event,
static void SelectAction ( Widget w, XEvent *event,
String *params, Cardinal *num_params );
static void RelabelAction ( Widget w, XEvent *event,
static void RelabelAction ( Widget w, XEvent *event,
String *params, Cardinal *num_params );
static void PopdownFileDialogAction ( Widget w, XEvent *event,
static void PopdownFileDialogAction ( Widget w, XEvent *event,
String *params, Cardinal *num_params );
static void ActionQuit ( Widget w, XEvent *event,
static void ActionQuit ( Widget w, XEvent *event,
String *params, Cardinal *num_params );
static WNode * FindTreeNodeFromWidget ( Widget w );
static Boolean CheckAndFindEntry ( String action_name,
String * params, Cardinal num_params,
struct ActionValues * table,
static Boolean CheckAndFindEntry ( String action_name,
String * params, Cardinal num_params,
struct ActionValues * table,
Cardinal num_table, int * type );
/* Function Name: EnableGetVal
@ -83,7 +83,7 @@ static Boolean CheckAndFindEntry ( String action_name,
* Arguments: w - any widget in the widget tree.
* event - NOT USED.
* params, num_params - the parameters paseed to the action
* routine.
* routine.
*
*/
@ -97,11 +97,11 @@ EnableGetVal(Widget w, XEvent *event, String *params, Cardinal *num_params)
}
/* Function Name: SelectAction
* Description:
* Description:
* Arguments: w - any widget in the widget tree.
* event - NOT USED.
* params, num_params - the parameters paseed to the action
* routine.
* routine.
*
* params[0] - One of "nothing", "parent", "children", "ancestors",
* "descendants", "invert", "all"
@ -115,7 +115,7 @@ SelectAction(Widget w, XEvent *event, String *params, Cardinal *num_params)
WNode * node;
int type;
if (!CheckAndFindEntry("Select", params, *num_params,
if (!CheckAndFindEntry("Select", params, *num_params,
select_values, XtNumber(select_values), &type))
return;
@ -131,7 +131,7 @@ SelectAction(Widget w, XEvent *event, String *params, Cardinal *num_params)
default:
node = FindTreeNodeFromWidget(w);
if (node)
_TreeActivateNode(node, (SelectTypes)type);
_TreeActivateNode(node, (SelectTypes)type);
else
_TreeSelect(global_tree_info, (SelectTypes)type);
break;
@ -139,11 +139,11 @@ SelectAction(Widget w, XEvent *event, String *params, Cardinal *num_params)
}
/* Function Name: RelabelAction
* Description:
* Description:
* Arguments: w - any widget in the widget tree.
* event - NOT USED.
* params, num_params - the parameters paseed to the action
* routine.
* routine.
*
* params[0] - One of "name", "class", "id"
* num_params - must be one.
@ -156,16 +156,16 @@ RelabelAction(Widget w, XEvent *event, String *params, Cardinal *num_params)
WNode * node;
int type;
if (!CheckAndFindEntry("Relabel", params, *num_params,
if (!CheckAndFindEntry("Relabel", params, *num_params,
label_values, XtNumber(label_values), &type))
return;
if ((node = FindTreeNodeFromWidget(w)) == NULL)
if ((node = FindTreeNodeFromWidget(w)) == NULL)
_TreeRelabel(global_tree_info, (LabelTypes)type);
else {
PrepareToLayoutTree(global_tree_info->tree_widget);
PrepareToLayoutTree(global_tree_info->tree_widget);
_TreeRelabelNode(node, (LabelTypes)type, FALSE);
LayoutTree(global_tree_info->tree_widget);
LayoutTree(global_tree_info->tree_widget);
}
}
@ -188,8 +188,7 @@ PopdownFileDialogAction(Widget w, XEvent *event,
Boolean val;
if (*num_params != 1) {
sprintf(buf, res_labels[2],
"PopdownFileDialog");
snprintf(buf, sizeof(buf), res_labels[2], "PopdownFileDialog");
SetMessage(global_screen_data.info_label, buf);
return;
@ -202,8 +201,7 @@ PopdownFileDialogAction(Widget w, XEvent *event,
else if (streq(buf, "okay"))
val = TRUE;
else {
sprintf(buf, res_labels[1],
"PopdownFileDialog");
snprintf(buf, sizeof(buf), res_labels[1], "PopdownFileDialog");
SetMessage(global_screen_data.info_label, buf);
return;
@ -246,7 +244,7 @@ static XtActionsRec actions[] = {
{"EnableGetVal", EnableGetVal},
{"Select", SelectAction},
{"SVActiveEntry", ModifySVEntry},
{"Relabel", RelabelAction},
{"Relabel", RelabelAction},
{"PopdownFileDialog", PopdownFileDialogAction},
{"quit", ActionQuit}
};
@ -255,13 +253,13 @@ void
SetApplicationActions(XtAppContext app_con)
{
XtAppAddActions(app_con, actions, XtNumber(actions));
}
/************************************************************
*
* Private functions
* Private functions
*
************************************************************/
@ -281,34 +279,32 @@ CheckAndFindEntry(String action_name, String *params, Cardinal num_params,
struct ActionValues *table, Cardinal num_table, int *type)
{
char buf[BUFSIZ];
int i;
Cardinal i;
if (num_params != 1) {
sprintf(buf, res_labels[2],
action_name);
snprintf(buf, sizeof(buf), res_labels[2], action_name);
SetMessage(global_screen_data.info_label, buf);
return(FALSE);
}
XmuCopyISOLatin1Lowered(buf, params[0]);
for ( i = 0 ; i < num_table; i++ )
for ( i = 0 ; i < num_table; i++ )
if (streq(buf, table[i].name)) {
*type = table[i].type;
return(TRUE);
}
sprintf(buf,res_labels[3],
action_name);
snprintf(buf, sizeof(buf), res_labels[3], action_name);
for (i = 0; i < num_table; ) {
strcat(buf, table[i++].name);
if (i == (num_table - 1))
strcat(buf, ", or ");
else if (i < num_table)
strcat(buf, ", ");
}
SetMessage(global_screen_data.info_label, buf);
return(FALSE);
}
@ -331,7 +327,7 @@ FindTreeNodeFromWidget(Widget w)
ret_val = XFindContext(XtDisplay(w), (Window) w, NODE_INFO, &data_return);
if (ret_val == 0)
if (ret_val == 0)
return((WNode *) data_return);
return(NULL);
}

View File

@ -128,7 +128,7 @@ Editres.Geometry: 500x568
! For the Filename popup dialog.
*fileDialog*value:
*fileDialog*value:
*fileDialog*allowShellResize: True
*fileDialog*Text.baseTranslations: #override \n\
<Key>Return: PopdownFileDialog(okay)
@ -185,7 +185,7 @@ Editres.Geometry: 500x568
*namesAndClasses*Toggle.baseTranslations: #override \n\
<Btn1Down>,<Btn1Up>: set() notify()
*commandBox.skipAdjust: True
@ -208,7 +208,7 @@ Editres.Geometry: 500x568
:<Key>N: Relabel(name) \n\
:<Key>C: Relabel(class) \n\
:<Key>I: Relabel(id) \n\
:<Key>W: Relabel(window)
:<Key>W: Relabel(window)
*Tree.Toggle.baseTranslations: #override \n\
:<Key>space: Select(nothing) \n\

View File

@ -56,13 +56,13 @@ extern Widget CM_entries[NUM_CM_ENTRIES], TM_entries[NUM_TM_ENTRIES];
static void ClientTimedOut ( XtPointer data, XtIntervalId * id );
static void TellUserAboutMessage ( Widget label, ResCommand command );
static Boolean ConvertCommand ( Widget w, Atom * selection, Atom * target,
Atom * type_ret, XtPointer *value_ret,
static Boolean ConvertCommand ( Widget w, Atom * selection, Atom * target,
Atom * type_ret, XtPointer *value_ret,
unsigned long * length_ret, int * format_ret );
static void SelectionDone ( Widget w, Atom *sel, Atom *targ );
static void LoseSelection ( Widget w, Atom * sel );
static void GetClientValue ( Widget w, XtPointer data, Atom *selection,
Atom *type, XtPointer value,
static void GetClientValue ( Widget w, XtPointer data, Atom *selection,
Atom *type, XtPointer value,
unsigned long *length, int * format );
static void BuildHeader ( CurrentClient * client_data );
static Event * BuildEvent ( ProtocolStream * stream );
@ -73,7 +73,7 @@ static char * DispatchEvent ( Event * event );
/* Function Name: ClientTimedOut
* Description: Called if the client takes too long to take our selection.
* Arguments: data - The widget that owns the client
* Arguments: data - The widget that owns the client
* communication selection.
* id - *** UNUSED ***
* Returns: none.
@ -85,13 +85,12 @@ ClientTimedOut(XtPointer data, XtIntervalId *id)
{
char msg[BUFSIZ];
Widget w = (Widget) data;
global_client.ident = NO_IDENT;
XtDisownSelection(w, global_client.atom,
XtDisownSelection(w, global_client.atom,
XtLastTimestampProcessed(XtDisplay(w)));
sprintf(msg, res_labels[4],
"the Editres Protocol.");
snprintf(msg, sizeof(msg), res_labels[4], "the Editres Protocol.");
SetMessage(global_screen_data.info_label, msg);
}
@ -103,7 +102,7 @@ ClientTimedOut(XtPointer data, XtIntervalId *id)
* Returns: a clients window, or None.
*/
Window
Window
GetClientWindow(Widget w, int *x, int *y)
{
int status;
@ -113,10 +112,10 @@ GetClientWindow(Widget w, int *x, int *y)
Display * dpy = XtDisplayOfObject(w);
Window target_win = None, root = RootWindowOfScreen(XtScreenOfObject(w));
XtAppContext app = XtWidgetToApplicationContext(w);
/* Make the target cursor */
cursor = XCreateFontCursor(dpy, XC_crosshair);
/* Grab the pointer using target cursor, letting it room all over */
status = XGrabPointer(dpy, root, False,
ButtonPressMask|ButtonReleaseMask, GrabModeSync,
@ -125,7 +124,7 @@ GetClientWindow(Widget w, int *x, int *y)
SetMessage(global_screen_data.info_label, res_labels[5]);
return(None);
}
/* Let the user select a window... */
while ((target_win == None) || (buttons != 0)) {
/* allow one more event */
@ -137,7 +136,7 @@ GetClientWindow(Widget w, int *x, int *y)
XtDispatchEvent(&event);
break;
}
if (target_win == None) {
target_win = event.xbutton.subwindow; /* window selected */
if (x != NULL)
@ -152,7 +151,7 @@ GetClientWindow(Widget w, int *x, int *y)
XtDispatchEvent(&event);
break;
}
if (buttons > 0) /* There may have been some
down before we started */
buttons--;
@ -161,17 +160,17 @@ GetClientWindow(Widget w, int *x, int *y)
XtDispatchEvent(&event);
break;
}
}
}
XUngrabPointer(dpy, CurrentTime); /* Done with pointer */
return(XmuClientWindow(dpy, target_win));
}
/* Function Name: SetCommand
* Description: Causes this widget to own the resource editor's
* Description: Causes this widget to own the resource editor's
* command selection.
* Arguments: w - the widget that will own the selection.
* command - command to send to client.
@ -185,24 +184,24 @@ SetCommand(Widget w, ResCommand command, char *msg)
{
XClientMessageEvent client_event;
Display * dpy = XtDisplay(w);
if (msg == NULL)
if (msg == NULL)
msg = res_labels[6];
SetMessage(global_screen_data.info_label, msg);
if (global_client.window == None)
if ( (global_client.window = GetClientWindow(w, NULL, NULL)) == None)
if ( (global_client.window = GetClientWindow(w, NULL, NULL)) == None)
return;
global_client.ident = GetNewIdent();
global_client.command = command;
global_client.atom = atom_comm;
BuildHeader(&(global_client));
BuildHeader(&(global_client));
if (!XtOwnSelection(w, global_client.atom, CurrentTime, ConvertCommand,
if (!XtOwnSelection(w, global_client.atom, CurrentTime, ConvertCommand,
LoseSelection, SelectionDone))
SetMessage(global_screen_data.info_label,
res_labels[7]);
@ -215,32 +214,31 @@ SetCommand(Widget w, ResCommand command, char *msg)
client_event.data.l[1] = global_client.atom;
client_event.data.l[2] = (long) global_client.ident;
client_event.data.l[3] = global_effective_protocol_version;
global_error_code = NO_ERROR; /* Reset Error code. */
global_old_error_handler = XSetErrorHandler(HandleXErrors);
global_serial_num = NextRequest(dpy);
XSendEvent(dpy, global_client.window, FALSE, (long) 0,
XSendEvent(dpy, global_client.window, FALSE, (long) 0,
(XEvent *) &client_event);
XSync(dpy, FALSE);
XSetErrorHandler(global_old_error_handler);
if (global_error_code == NO_WINDOW) {
char error_buf[BUFSIZ];
char error_buf[BUFSIZ] =
"The communication window with the"
" application is no longer available\n"
"Please select a new widget tree.";
global_error_code = NO_ERROR; /* Reset Error code. */
sprintf(error_buf, "The communication window with%s%s.",
" application is no longer available\n",
"Please select a new widget tree");
global_client.window = None;
SetCommand(w, LocalSendWidgetTree, error_buf);
return;
}
}
TellUserAboutMessage(global_screen_data.info_label, command);
global_client.timeout = XtAppAddTimeOut(XtWidgetToApplicationContext(w),
CLIENT_TIME_OUT,
CLIENT_TIME_OUT,
ClientTimedOut, (XtPointer) w);
}
@ -280,7 +278,7 @@ TellUserAboutMessage(Widget label, ResCommand command)
break;
}
sprintf(msg, res_labels[8], str);
snprintf(msg, sizeof(msg), res_labels[8], str);
SetMessage(label, msg);
}
@ -305,7 +303,7 @@ ConvertCommand(Widget w, Atom *selection, Atom *target, Atom *type_ret,
*value_ret = (XtPointer) global_client.stream.real_top;
*length_ret = global_client.stream.size + HEADER_SIZE;
*format_ret = EDITRES_FORMAT;
return(TRUE);
}
@ -396,15 +394,15 @@ GetClientValue(Widget w, XtPointer data, Atom *selection, Atom *type,
#ifdef DEBUG
if (global_resources.debug)
printf("Incorrect ident from client.\n");
#endif
if (!XtOwnSelection(w, *selection, CurrentTime, ConvertCommand,
#endif
if (!XtOwnSelection(w, *selection, CurrentTime, ConvertCommand,
LoseSelection, SelectionDone))
SetMessage(global_screen_data.info_label,
res_labels[10]);
return;
}
(void) _XEditResGet8(stream, &error_code);
(void) _XEditResGet8(stream, &error_code);
(void) _XEditResGet32(stream, &(stream->size));
stream->top = stream->current; /* reset stream to top of value.*/
@ -420,7 +418,7 @@ GetClientValue(Widget w, XtPointer data, Atom *selection, Atom *type,
FreeEvent(event);
}
else {
sprintf(msg, "Unable to unpack protocol request.");
snprintf(msg, sizeof(msg), "Unable to unpack protocol request.");
error_str = XtNewString(msg);
}
break;
@ -438,19 +436,19 @@ GetClientValue(Widget w, XtPointer data, Atom *selection, Atom *type,
SetCommand(w, LocalSendWidgetTree, NULL);
break;
default:
sprintf(msg, res_labels[11], (int) error_code);
snprintf(msg, sizeof(msg), res_labels[11], (int) error_code);
SetMessage(global_screen_data.info_label, msg);
break;
}
if (error_str == NULL) {
WNode * top;
if (global_tree_info == NULL)
return;
top = global_tree_info->top_node;
sprintf(msg, res_labels[12], top->name, top->class);
snprintf(msg, sizeof(msg), res_labels[12], top->name, top->class);
SetMessage(global_screen_data.info_label, msg);
return;
}
@ -480,22 +478,22 @@ BuildHeader(CurrentClient *client_data)
* fill in the space.
*/
/*
/*
* Fool the insert routines into putting the header in the right
* place while being damn sure not to realloc (that would be very bad.
*/
old_current = stream->current;
old_alloc = stream->alloc;
old_size = stream->size;
stream->current = stream->real_top;
stream->alloc = stream->size + (2 * HEADER_SIZE);
stream->alloc = stream->size + (2 * HEADER_SIZE);
_XEditResPut8(stream, client_data->ident);
switch(client_data->command) {
case LocalSendWidgetTree:
if (reset_protocol_level) global_effective_protocol_version =
case LocalSendWidgetTree:
if (reset_protocol_level) global_effective_protocol_version =
CURRENT_PROTOCOL_VERSION;
reset_protocol_level = True;
command = SendWidgetTree;
@ -519,7 +517,7 @@ BuildHeader(CurrentClient *client_data)
command = SendWidgetTree;
break;
}
_XEditResPut8(stream, (unsigned char) command);
_XEditResPut32(stream, old_size);
@ -531,12 +529,12 @@ BuildHeader(CurrentClient *client_data)
/* Function Name: BuildEvent
* Description: Builds the event structure from the
* Description: Builds the event structure from the
* Arguments: stream - the protocol data stream.
* Returns: event - the event.
*/
static Event *
static Event *
BuildEvent(ProtocolStream *stream)
{
int i;
@ -556,7 +554,7 @@ BuildEvent(ProtocolStream *stream)
if (!_XEditResGet16(stream, &(send_event->num_entries)))
goto done;
send_event->info = (WidgetTreeInfo *)
XtCalloc(sizeof(WidgetTreeInfo),
send_event->num_entries);
@ -566,13 +564,13 @@ BuildEvent(ProtocolStream *stream)
if (!(_XEditResGetWidgetInfo(stream, &(info->widgets)) &&
_XEditResGetString8(stream, &(info->name)) &&
_XEditResGetString8(stream, &(info->class)) &&
_XEditResGet32(stream, &(info->window))))
_XEditResGet32(stream, &(info->window))))
{
goto done;
}
}
if (global_effective_protocol_version ==
if (global_effective_protocol_version ==
CURRENT_PROTOCOL_VERSION) {
/* get toolkit type and reset if necessary */
if (!_XEditResGetString8(stream, &(send_event->toolkit)))
@ -582,11 +580,11 @@ BuildEvent(ProtocolStream *stream)
SetEntriesSensitive(&CM_entries[CM_OFFSET], CM_NUM, True);
/* set the tree menu entries senitive */
SetEntriesSensitive(TM_entries, TM_NUM, True);
if (global_effective_protocol_version ==
if (global_effective_protocol_version ==
CURRENT_PROTOCOL_VERSION) {
if (!strcmp(send_event->toolkit, "InterViews"))
if (!strcmp(send_event->toolkit, "InterViews"))
RebuildMenusAndLabel("iv");
}
}
else
RebuildMenusAndLabel("xt");
}
@ -599,7 +597,7 @@ BuildEvent(ProtocolStream *stream)
if (!_XEditResGet16(stream, &(sv_event->num_entries)))
goto done;
sv_event->info = (SetValuesInfo *) XtCalloc(sizeof(SetValuesInfo),
sv_event->num_entries);
@ -616,13 +614,13 @@ BuildEvent(ProtocolStream *stream)
case LocalGetResources:
{
GetResourcesEvent * res_event = (GetResourcesEvent *) event;
res_event->type = GetGeometry;
if (!_XEditResGet16(stream, &(res_event->num_entries)))
goto done;
res_event->info = (GetResourcesInfo *)
res_event->info = (GetResourcesInfo *)
XtCalloc(sizeof(GetResourcesInfo),
res_event->num_entries);
@ -634,7 +632,7 @@ BuildEvent(ProtocolStream *stream)
goto done;
}
if (res_info->error) {
if (!_XEditResGetString8(stream, &(res_info->message)))
if (!_XEditResGetString8(stream, &(res_info->message)))
goto done;
}
else {
@ -643,7 +641,7 @@ BuildEvent(ProtocolStream *stream)
if (!_XEditResGet16(stream, &(res_info->num_resources)))
goto done;
res_info->res_info = (ResourceInfo *)
res_info->res_info = (ResourceInfo *)
XtCalloc(sizeof(ResourceInfo),
res_info->num_resources);
@ -673,7 +671,7 @@ BuildEvent(ProtocolStream *stream)
if (!_XEditResGet16(stream, &(geom_event->num_entries)))
goto done;
geom_event->info = (GetGeomInfo *) XtCalloc(sizeof(GetGeomInfo),
geom_event->num_entries);
@ -716,9 +714,9 @@ BuildEvent(ProtocolStream *stream)
{
Arg args[1];
GetValuesEvent * gv_event = (GetValuesEvent *) event;
gv_event->type = GetValues;
if (!_XEditResGet16(stream, &(gv_event->num_entries)))
goto done;
@ -760,7 +758,7 @@ BuildEvent(ProtocolStream *stream)
/* Function Name: FreeEvent
* Description: Frees all memory associated with the event.
* Description: Frees all memory associated with the event.
* Arguments: event - the event.
* Returns: none.
*
@ -777,7 +775,7 @@ FreeEvent(Event *event)
{
SendWidgetTreeEvent * send_event = (SendWidgetTreeEvent *) event;
WidgetTreeInfo * info = send_event->info;
if (info != NULL) {
for (i = 0; i < send_event->num_entries; i++, info++) {
XtFree((char *)info->widgets.ids);
@ -792,7 +790,7 @@ FreeEvent(Event *event)
{
SetValuesEvent * sv_event = (SetValuesEvent *) event;
SetValuesInfo * info = sv_event->info;
if (info != NULL) {
for (i = 0; i < sv_event->num_entries; i++, info++) {
XtFree((char *)info->widgets.ids);
@ -810,15 +808,15 @@ FreeEvent(Event *event)
if (info != NULL) {
for (i = 0; i < get_event->num_entries; i++, info++) {
XtFree((char *)info->widgets.ids);
if (info->error)
if (info->error)
XtFree(info->message);
else {
unsigned int j;
ResourceInfo * res_info = info->res_info;
if (res_info != NULL) {
for (j = 0;
j < info->num_resources; j++, res_info++)
for (j = 0;
j < info->num_resources; j++, res_info++)
{
XtFree(res_info->name);
XtFree(res_info->class);
@ -827,7 +825,7 @@ FreeEvent(Event *event)
XtFree((char *)info->res_info);
}
}
}
}
XtFree((char *)get_event->info);
}
}
@ -840,7 +838,7 @@ FreeEvent(Event *event)
if (info != NULL) {
for (i = 0; i < geom_event->num_entries; i++, info++) {
XtFree((char *)info->widgets.ids);
if (info->error)
if (info->error)
XtFree(info->message);
}
XtFree((char *)geom_event->info);
@ -850,7 +848,7 @@ FreeEvent(Event *event)
case FindChild:
{
FindChildEvent * find_event = (FindChildEvent *) event;
XtFree((char *)find_event->widgets.ids);
}
break;
@ -866,7 +864,7 @@ FreeEvent(Event *event)
* Arguments: event - the event.
* Returns: one.
*/
static char *
DispatchEvent(Event *event)
{
@ -893,8 +891,8 @@ DispatchEvent(Event *event)
default:
{
char msg[BUFSIZ];
sprintf(msg, "Internal error: Unknown command %d.",
global_client.command);
snprintf(msg, sizeof(msg), "Internal error: Unknown command %d.",
global_client.command);
error = XtNewString(msg);
}
break;

347
app/editres/compile Normal file
View File

@ -0,0 +1,347 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2012-10-14.11; # UTC
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://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
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

115
app/editres/configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for editres 1.0.6.
# Generated by GNU Autoconf 2.69 for editres 1.0.7.
#
# Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg>.
#
@ -581,11 +581,12 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='editres'
PACKAGE_TARNAME='editres'
PACKAGE_VERSION='1.0.6'
PACKAGE_STRING='editres 1.0.6'
PACKAGE_VERSION='1.0.7'
PACKAGE_STRING='editres 1.0.7'
PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg'
PACKAGE_URL=''
ac_unique_file="Makefile.am"
# Factoring default headers for most tests.
ac_includes_default="\
#include <stdio.h>
@ -1316,7 +1317,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 editres 1.0.6 to adapt to many kinds of systems.
\`configure' configures editres 1.0.7 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1386,7 +1387,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of editres 1.0.6:";;
short | recursive ) echo "Configuration of editres 1.0.7:";;
esac
cat <<\_ACEOF
@ -1506,7 +1507,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
editres configure 1.0.6
editres configure 1.0.7
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@ -1763,7 +1764,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 editres $as_me 1.0.6, which was
It was created by editres $as_me 1.0.7, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@ -2111,6 +2112,11 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_config_headers="$ac_config_headers config.h"
# Initialize Automake
am__api_version='1.12'
ac_aux_dir=
@ -2587,7 +2593,7 @@ fi
# Define the identity of the package.
PACKAGE='editres'
VERSION='1.0.6'
VERSION='1.0.7'
cat >>confdefs.h <<_ACEOF
@ -10254,10 +10260,11 @@ _ACEOF
CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \
CHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \
echo 'git directory not found: installing possibly empty changelog.' >&2)"
|| (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
touch \$(top_srcdir)/ChangeLog; \
echo 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
@ -10265,14 +10272,45 @@ echo 'git directory not found: installing possibly empty changelog.' >&2)"
macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \
echo 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
|| (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
touch \$(top_srcdir)/INSTALL; \
echo 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
case $host_os in
solaris*)
# Solaris 2.0 - 11.3 use SysV man page section numbers, so we
# check for a man page file found in later versions that use
# traditional section numbers instead
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /usr/share/man/man7/attributes.7" >&5
$as_echo_n "checking for /usr/share/man/man7/attributes.7... " >&6; }
if ${ac_cv_file__usr_share_man_man7_attributes_7+:} false; then :
$as_echo_n "(cached) " >&6
else
test "$cross_compiling" = yes &&
as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
if test -r "/usr/share/man/man7/attributes.7"; then
ac_cv_file__usr_share_man_man7_attributes_7=yes
else
ac_cv_file__usr_share_man_man7_attributes_7=no
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__usr_share_man_man7_attributes_7" >&5
$as_echo "$ac_cv_file__usr_share_man_man7_attributes_7" >&6; }
if test "x$ac_cv_file__usr_share_man_man7_attributes_7" = xyes; then :
SYSV_MAN_SECTIONS=false
else
SYSV_MAN_SECTIONS=true
fi
;;
*) SYSV_MAN_SECTIONS=false ;;
esac
if test x$APP_MAN_SUFFIX = x ; then
APP_MAN_SUFFIX=1
fi
@ -10288,9 +10326,9 @@ if test x$LIB_MAN_DIR = x ; then
fi
if test x$FILE_MAN_SUFFIX = x ; then
case $host_os in
solaris*) FILE_MAN_SUFFIX=4 ;;
*) FILE_MAN_SUFFIX=5 ;;
case $SYSV_MAN_SECTIONS in
true) FILE_MAN_SUFFIX=4 ;;
*) FILE_MAN_SUFFIX=5 ;;
esac
fi
if test x$FILE_MAN_DIR = x ; then
@ -10298,9 +10336,9 @@ if test x$FILE_MAN_DIR = x ; then
fi
if test x$MISC_MAN_SUFFIX = x ; then
case $host_os in
solaris*) MISC_MAN_SUFFIX=5 ;;
*) MISC_MAN_SUFFIX=7 ;;
case $SYSV_MAN_SECTIONS in
true) MISC_MAN_SUFFIX=5 ;;
*) MISC_MAN_SUFFIX=7 ;;
esac
fi
if test x$MISC_MAN_DIR = x ; then
@ -10308,9 +10346,9 @@ if test x$MISC_MAN_DIR = x ; then
fi
if test x$DRIVER_MAN_SUFFIX = x ; then
case $host_os in
solaris*) DRIVER_MAN_SUFFIX=7 ;;
*) DRIVER_MAN_SUFFIX=4 ;;
case $SYSV_MAN_SECTIONS in
true) DRIVER_MAN_SUFFIX=7 ;;
*) DRIVER_MAN_SUFFIX=4 ;;
esac
fi
if test x$DRIVER_MAN_DIR = x ; then
@ -10318,9 +10356,9 @@ if test x$DRIVER_MAN_DIR = x ; then
fi
if test x$ADMIN_MAN_SUFFIX = x ; then
case $host_os in
solaris*) ADMIN_MAN_SUFFIX=1m ;;
*) ADMIN_MAN_SUFFIX=8 ;;
case $SYSV_MAN_SECTIONS in
true) ADMIN_MAN_SUFFIX=1m ;;
*) ADMIN_MAN_SUFFIX=8 ;;
esac
fi
if test x$ADMIN_MAN_DIR = x ; then
@ -10400,9 +10438,6 @@ AM_BACKSLASH='\'
ac_config_headers="$ac_config_headers config.h"
# Obtain compiler/linker options from depedencies
pkg_failed=no
@ -10413,12 +10448,12 @@ if test -n "$EDITRES_CFLAGS"; then
pkg_cv_EDITRES_CFLAGS="$EDITRES_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xaw7 x11 xt xmu\""; } >&5
($PKG_CONFIG --exists --print-errors "xaw7 x11 xt xmu") 2>&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xaw7 x11 xt >= 1.0.99.1 xmu xproto >= 7.0.17\""; } >&5
($PKG_CONFIG --exists --print-errors "xaw7 x11 xt >= 1.0.99.1 xmu xproto >= 7.0.17") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_EDITRES_CFLAGS=`$PKG_CONFIG --cflags "xaw7 x11 xt xmu" 2>/dev/null`
pkg_cv_EDITRES_CFLAGS=`$PKG_CONFIG --cflags "xaw7 x11 xt >= 1.0.99.1 xmu xproto >= 7.0.17" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@ -10430,12 +10465,12 @@ if test -n "$EDITRES_LIBS"; then
pkg_cv_EDITRES_LIBS="$EDITRES_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xaw7 x11 xt xmu\""; } >&5
($PKG_CONFIG --exists --print-errors "xaw7 x11 xt xmu") 2>&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xaw7 x11 xt >= 1.0.99.1 xmu xproto >= 7.0.17\""; } >&5
($PKG_CONFIG --exists --print-errors "xaw7 x11 xt >= 1.0.99.1 xmu xproto >= 7.0.17") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_EDITRES_LIBS=`$PKG_CONFIG --libs "xaw7 x11 xt xmu" 2>/dev/null`
pkg_cv_EDITRES_LIBS=`$PKG_CONFIG --libs "xaw7 x11 xt >= 1.0.99.1 xmu xproto >= 7.0.17" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@ -10456,14 +10491,14 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
EDITRES_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "xaw7 x11 xt xmu" 2>&1`
EDITRES_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "xaw7 x11 xt >= 1.0.99.1 xmu xproto >= 7.0.17" 2>&1`
else
EDITRES_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "xaw7 x11 xt xmu" 2>&1`
EDITRES_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "xaw7 x11 xt >= 1.0.99.1 xmu xproto >= 7.0.17" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$EDITRES_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (xaw7 x11 xt xmu) were not met:
as_fn_error $? "Package requirements (xaw7 x11 xt >= 1.0.99.1 xmu xproto >= 7.0.17) were not met:
$EDITRES_PKG_ERRORS
@ -11138,7 +11173,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 editres $as_me 1.0.6, which was
This file was extended by editres $as_me 1.0.7, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -11204,7 +11239,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
editres config.status 1.0.6
editres config.status 1.0.7
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@ -11333,8 +11368,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
"depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;;

View File

@ -1,6 +1,6 @@
dnl Copyright 2005 Red Hat, Inc.
dnl
dnl
dnl Permission to use, copy, modify, distribute, and sell this software and its
dnl documentation for any purpose is hereby granted without fee, provided that
dnl the above copyright notice appear in all copies and that both that
@ -10,7 +10,7 @@ dnl advertising or publicity pertaining to distribution of the software without
dnl specific, written prior permission. Red Hat makes no
dnl representations about the suitability of this software for any purpose. It
dnl is provided "as is" without express or implied warranty.
dnl
dnl
dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
@ -21,9 +21,14 @@ dnl PERFORMANCE OF THIS SOFTWARE.
dnl
dnl Process this file with autoconf to create configure.
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([editres], [1.0.6],
AC_INIT([editres], [1.0.7],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [editres])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h])
# Initialize Automake
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_MAINTAINER_MODE
@ -33,10 +38,8 @@ m4_ifndef([XORG_MACROS_VERSION],
XORG_MACROS_VERSION(1.8)
XORG_DEFAULT_OPTIONS
AC_CONFIG_HEADERS([config.h])
# Obtain compiler/linker options from depedencies
PKG_CHECK_MODULES(EDITRES, xaw7 x11 xt xmu)
PKG_CHECK_MODULES(EDITRES, [xaw7 x11 xt >= 1.0.99.1 xmu xproto >= 7.0.17])
PKG_CHECK_MODULES(APPDEFS, xt)
xt_appdefaultdir=`$PKG_CONFIG --variable=appdefaultdir xt`

View File

@ -27,7 +27,7 @@ in this Software without prior written authorization from The Open Group.
#include <stdlib.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Xaw/Cardinals.h>
#include <X11/Xaw/Cardinals.h>
#define THIS_IS_MAIN /* Don't get extern definitions of global
variables. */
@ -35,7 +35,7 @@ in this Software without prior written authorization from The Open Group.
#include "editresP.h"
/*
* Global variables.
* Global variables.
*/
/* array of toolkit dependent labels taken from the resource file */
@ -61,9 +61,9 @@ Widget global_toplevel;
AppResources global_resources;
static void Syntax ( XtAppContext app_con, char *call );
static void Syntax ( XtAppContext app_con, char *call ) _X_NORETURN;
static String fallback_resources[] = {
static String fallback_resources[] = {
NULL,
};
@ -73,9 +73,9 @@ static XtResource editres_resources[] = {
{"debug", "Debug", XtRBoolean, sizeof(Boolean),
Offset(debug), XtRImmediate, (XtPointer) FALSE},
{"numFlashes", "NumFlashes", XtRInt, sizeof(int),
Offset(num_flashes), XtRImmediate, (XtPointer) NUM_FLASHES},
Offset(num_flashes), XtRImmediate, (XtPointer) NUM_FLASHES},
{"flashTime", "FlashTime", XtRInt, sizeof(int),
Offset(flash_time), XtRImmediate, (XtPointer) FLASH_TIME},
Offset(flash_time), XtRImmediate, (XtPointer) FLASH_TIME},
{"flashColor", XtCForeground, XtRPixel, sizeof(Pixel),
Offset(flash_color), XtRImmediate, (XtPointer) XtDefaultForeground},
{"saveResourceFile", "SaveResourcesFile", XtRString, sizeof(String),
@ -93,23 +93,23 @@ main(int argc, char **argv)
&argc, argv, fallback_resources,
NULL, ZERO);
if (argc != 1)
if (argc != 1)
Syntax(app_con, argv[0]);
SetApplicationActions(app_con);
XtGetApplicationResources(global_toplevel, (XtPointer) &global_resources,
XtGetApplicationResources(global_toplevel, (XtPointer) &global_resources,
editres_resources, XtNumber(editres_resources),
NULL, (Cardinal) 0);
global_resources.allocated_save_resources_file = FALSE;
XtOverrideTranslations
(global_toplevel,
XtParseTranslationTable ("<Message>WM_PROTOCOLS: quit()"));
(global_toplevel,
XtParseTranslationTable ("<Message>WM_PROTOCOLS: quit()"));
/* build tree for Xt intrinsics */
BuildWidgetTree(global_toplevel);
BuildWidgetTree(global_toplevel);
SetMessage(global_screen_data.info_label,
SetMessage(global_screen_data.info_label,
res_labels[13]);
global_screen_data.set_values_popup = NULL;
@ -118,10 +118,10 @@ main(int argc, char **argv)
XtRealizeWidget(global_toplevel);
wm_delete_window =
wm_delete_window =
XInternAtom(XtDisplay(global_toplevel), "WM_DELETE_WINDOW",
False);
(void) XSetWMProtocols (XtDisplay(global_toplevel),
(void) XSetWMProtocols (XtDisplay(global_toplevel),
XtWindow(global_toplevel),
&wm_delete_window, 1);
XtAppMainLoop(app_con);
@ -135,7 +135,7 @@ main(int argc, char **argv)
* Returns: none - exits tho.
*/
static void
static void
Syntax(XtAppContext app_con, char *call)
{
XtDestroyApplicationContext(app_con);

View File

@ -28,6 +28,7 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xmu/EditresP.h>
#include <X11/Xresource.h>
#include <X11/Xfuncproto.h>
#define DEBUG
@ -40,9 +41,9 @@ in this Software without prior written authorization from The Open Group.
#define PROTOCOL_VERSION_ONE_POINT_ONE 5 /* version 1.1 */
#define ONE_POINT_ONE_STRING "1.1"
#define PROTOCOL_VERSION_ONE_POINT_ZERO 4 /* version 1.0 */
#define ONE_POINT_ZERO_STRING "1.0" ONE_POINT_ONE_STRING
#define ONE_POINT_ZERO_STRING "1.0" ONE_POINT_ONE_STRING
#define CURRENT_PROTOCOL_VERSION PROTOCOL_VERSION_ONE_POINT_ONE
#define CURRENT_PROTOCOL_VERSION PROTOCOL_VERSION_ONE_POINT_ONE
#define CURRENT_PROTOCOL_VERSION_STRING ONE_POINT_ONE_STRING
#define FLASH_TIME 1000 /* Default flash time in microseconds */
@ -71,19 +72,19 @@ in this Software without prior written authorization from The Open Group.
#define NODE_INFO ((XContext) 42)
/*
* Error codes for X Server errors.
* Error codes for X Server errors.
*/
#define NO_ERROR 0
#define NO_WINDOW 1
typedef enum {LocalSendWidgetTree, LocalSetValues, LocalFindChild,
typedef enum {LocalSendWidgetTree, LocalSetValues, LocalFindChild,
LocalFlashWidget, LocalGetGeometry, LocalGetResources,
LocalGetValues} ResCommand;
typedef enum {ClassLabel, NameLabel, IDLabel, WindowLabel,
ToggleLabel} LabelTypes;
typedef enum {SelectWidget, SelectAll, SelectNone, SelectInvert, SelectParent,
typedef enum {SelectWidget, SelectAll, SelectNone, SelectInvert, SelectParent,
SelectChildren, SelectDescendants, SelectAncestors} SelectTypes;
typedef struct _NameInfo {
@ -97,16 +98,16 @@ typedef struct _ResourceBoxInfo {
Widget res_label; /* The label containing current resoruce. */
Widget shell; /* Shell widget containing resource box. */
Widget norm_list; /* The List widget for the normal list. */
Widget cons_list; /* The List widget for the
Widget cons_list; /* The List widget for the
Constriaint Resources */
NameInfo * name_info; /* The info about the widgets for each
name and class in the instance heirarchy. */
} ResourceBoxInfo;
typedef struct _WidgetResourceInfo {
char * name, * class, *type; /* Name, Class and Type of each resource. */
} WidgetResourceInfo;
typedef struct _WidgetResources {
int num_normal, num_constraint;
WidgetResourceInfo *normal, *constraint;
@ -196,7 +197,7 @@ typedef struct _ApplyResourcesInfo {
ProtocolStream * stream;
XrmDatabase database;
} ApplyResourcesInfo;
/*
* Information needed to get a resource string from a widget.
*/
@ -236,7 +237,7 @@ typedef struct _SetValuesInfo {
WidgetInfo widgets;
char * message;
} SetValuesInfo;
typedef struct _SetValuesEvent {
EditresCommand type;
unsigned short num_entries;
@ -247,7 +248,7 @@ typedef struct _GetValuesInfo {
WidgetInfo widgets;
char * value;
} GetValuesInfo;
typedef struct _GetValuesEvent {
EditresCommand type;
unsigned short num_entries;
@ -303,7 +304,7 @@ typedef union _Event {
FindChildEvent find_child_event;
GetValuesEvent get_values_event;
} Event;
/*
* number of application resource labels.
*/
@ -311,7 +312,7 @@ typedef union _Event {
#define NUM_RES_LABELS 37
/*
* Global variables.
* Global variables.
*/
extern int global_effective_protocol_version;
extern char* global_effective_toolkit;
@ -393,7 +394,7 @@ extern void LayoutTree ( Widget tree );
extern int main ( int argc, char **argv );
extern void ModifySVEntry ( Widget w, XEvent *event, String * params, Cardinal * num_params );
extern void PannerCallback ( Widget w, XtPointer closure, XtPointer report_ptr );
extern void PerformTreeToFileDump ( WNode * node, int num_tabs, FILE * fp );
extern void PerformTreeToFileDump ( WNode * node, Cardinal num_tabs, FILE * fp );
extern void PopdownResBox ( Widget w, XtPointer shell_ptr, XtPointer junk );
extern void PopupCentered ( XEvent * event, Widget w, XtGrabKind mode );
extern void PopupSetValues ( Widget parent, XEvent * event );
@ -403,7 +404,7 @@ extern void PrintNodes ( WNode * top );
extern char * PrintSetValuesError ( Event * event );
extern char * ProtocolFailure ( ProtocolStream * stream );
extern XrmQuarkList Quarkify ( char ** list, char * ptr );
extern void Quit ( Widget w, XtPointer client_data, XtPointer call_data );
extern void Quit ( Widget w, XtPointer client_data, XtPointer call_data ) _X_NORETURN;
extern void RebuildMenusAndLabel ( String toolkit );
extern void ResourceListCallback ( Widget list, XtPointer node_ptr, XtPointer junk );
extern void SaveResource ( Widget w, XtPointer res_box_ptr, XtPointer junk );

View File

@ -30,19 +30,19 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Shell.h>
#include <stdio.h>
#include <X11/Xaw/Cardinals.h>
#include <X11/Xaw/Cardinals.h>
#include "editresP.h"
/*
* Local function definitions
* Local function definitions
*/
static void AddToFlashList ( TreeInfo * tree_info, GetGeomInfo * geom_info,
static void AddToFlashList ( TreeInfo * tree_info, GetGeomInfo * geom_info,
char ** errors );
static void _AddToFlashList ( TreeInfo * tree_info, char ** errors,
WNode * node, int x, int y, unsigned int width,
static void _AddToFlashList ( TreeInfo * tree_info, char ** errors,
WNode * node, int x, int y, unsigned int width,
unsigned int height );
static void CreateFlashWidget ( TreeInfo * tree_info, int x, int y,
static void CreateFlashWidget ( TreeInfo * tree_info, int x, int y,
unsigned int width, unsigned int height );
static void FlashWidgets ( TreeInfo * tree_info );
static void FlashWidgetsOn ( XtPointer info_ptr, XtIntervalId * id );
@ -55,7 +55,7 @@ static void FlashWidgetsCleanup ( XtPointer info_ptr, XtIntervalId * id );
* Returns: none.
*/
void
void
_FindWidget(Widget w)
{
char msg[BUFSIZ];
@ -63,15 +63,15 @@ _FindWidget(Widget w)
Window win;
int x, y; /* location of event in root coordinates. */
sprintf(msg, res_labels[14]);
snprintf(msg, sizeof(msg), res_labels[14]);
SetMessage(global_screen_data.info_label, msg);
if ( (win = GetClientWindow(w, &x, &y)) != None) {
node = FindWidgetFromWindow(global_tree_info, win);
if (node != NULL) {
ProtocolStream * stream = &(global_client.stream);
ProtocolStream * stream = &(global_client.stream);
_XEditResResetStream(stream);
InsertWidgetFromNode(stream, node);
_XEditResPut16(stream, (short) x);
@ -81,7 +81,7 @@ _FindWidget(Widget w)
}
}
SetMessage(global_screen_data.info_label,
SetMessage(global_screen_data.info_label,
res_labels[15]);
}
@ -103,16 +103,16 @@ DisplayChild(Event *event)
find_event->widgets.num_widgets);
if (node == NULL) {
sprintf(msg, res_labels[13]);
snprintf(msg, sizeof(msg), res_labels[13]);
SetMessage(global_screen_data.info_label, msg);
return;
return;
}
SetAndCenterTreeNode(node);
node = node->tree_info->top_node;
sprintf(msg, res_labels[12], node->name, node->class);
snprintf(msg, sizeof(msg), res_labels[12], node->name, node->class);
SetMessage(global_screen_data.info_label, msg);
_FlashActiveWidgets(global_tree_info);
@ -127,7 +127,7 @@ DisplayChild(Event *event)
void
_FlashActiveWidgets(TreeInfo *tree_info)
{
int i;
Cardinal i;
ProtocolStream * stream = &(global_client.stream);
if (tree_info == NULL) {
@ -140,14 +140,14 @@ _FlashActiveWidgets(TreeInfo *tree_info)
SetMessage(global_screen_data.info_label,res_labels[18]);
return;
}
_XEditResResetStream(stream);
_XEditResResetStream(stream);
/*
* Insert the number of widgets.
* Insert the number of widgets.
*/
_XEditResPut16(stream, (unsigned short) tree_info->num_nodes);
for (i = 0; i < tree_info->num_nodes; i++)
for (i = 0; i < tree_info->num_nodes; i++)
InsertWidgetFromNode(stream, global_tree_info->active_nodes[i]);
SetCommand(tree_info->tree_widget, LocalFlashWidget, NULL);
@ -167,7 +167,7 @@ HandleFlashWidget(Event *event)
char * errors = NULL;
int i;
for (i = 0; i < (int)geom_event->num_entries; i++)
for (i = 0; i < (int)geom_event->num_entries; i++)
AddToFlashList(global_tree_info, geom_event->info + i, &errors);
FlashWidgets(global_tree_info);
@ -189,30 +189,31 @@ AddToFlashList(TreeInfo *tree_info, GetGeomInfo *geom_info, char **errors)
WNode * node;
char buf[BUFSIZ];
node = FindNode(tree_info->top_node,
node = FindNode(tree_info->top_node,
geom_info->widgets.ids, geom_info->widgets.num_widgets);
if (node == NULL) {
sprintf(buf, "Editres Internal Error: Unable to FindNode.\n");
AddString(errors, buf);
return;
}
if (geom_info->error) {
AddString(errors, geom_info->message);
return;
}
if (!geom_info->visable) {
sprintf(buf, "%s(0x%lx) - This widget is not mapped\n",
node->name, node->id);
AddString(errors, buf);
snprintf(buf, sizeof(buf),
"Editres Internal Error: Unable to FindNode.\n");
AddString(errors, buf);
return;
}
_AddToFlashList(tree_info, errors, node,
geom_info->x, geom_info->y,
geom_info->width + geom_info->border_width,
if (geom_info->error) {
AddString(errors, geom_info->message);
return;
}
if (!geom_info->visable) {
snprintf(buf, sizeof(buf), "%s(0x%lx) - This widget is not mapped\n",
node->name, node->id);
AddString(errors, buf);
return;
}
_AddToFlashList(tree_info, errors, node,
geom_info->x, geom_info->y,
geom_info->width + geom_info->border_width,
geom_info->height + geom_info->border_width);
}
@ -239,14 +240,16 @@ _AddToFlashList(TreeInfo *tree_info, char **errors, WNode *node,
if (window == EDITRES_IS_UNREALIZED) {
char buf[BUFSIZ];
if (node->window == EDITRES_IS_OBJECT)
sprintf(buf, "%s(0x%lx) - This object's parent is unrealized\n",
node->name, node->id);
if (node->window == EDITRES_IS_OBJECT)
snprintf(buf, sizeof(buf),
"%s(0x%lx) - This object's parent is unrealized\n",
node->name, node->id);
else
sprintf(buf, "%s(0x%lx) - This widget is unrealized\n",
node->name, node->id);
snprintf(buf, sizeof(buf),
"%s(0x%lx) - This widget is unrealized\n",
node->name, node->id);
AddString(errors, buf);
AddString(errors, buf);
return;
}
@ -261,20 +264,21 @@ _AddToFlashList(TreeInfo *tree_info, char **errors, WNode *node,
if (global_error_code == NO_WINDOW) {
char buf[BUFSIZ];
sprintf(buf, "%s(0x%lx) - This widget's window no longer exists.\n",
node->name, node->id);
AddString(errors, buf);
snprintf(buf, sizeof(buf),
"%s(0x%lx) - This widget's window no longer exists.\n",
node->name, node->id);
AddString(errors, buf);
return;
}
}
if (attrs.map_state != IsViewable) {
char buf[BUFSIZ];
sprintf(buf, "%s(0x%lx) - This widget is not mapped.\n",
node->name, node->id);
AddString(errors, buf);
snprintf(buf, sizeof(buf), "%s(0x%lx) - This widget is not mapped.\n",
node->name, node->id);
AddString(errors, buf);
return;
}
}
CreateFlashWidget(tree_info, x, y, width, height);
}
@ -287,7 +291,7 @@ _AddToFlashList(TreeInfo *tree_info, char **errors, WNode *node,
* x,y,width, height - size and location of the flash widget.
* Returns: none.
*/
#define MORE_FLASH_WIDGETS 5
static void
@ -303,20 +307,20 @@ CreateFlashWidget(TreeInfo *tree_info, int x, int y,
XtSetArg(args[num], XtNy, y); num++;
XtSetArg(args[num], XtNbackground, global_resources.flash_color); num++;
shell = XtCreatePopupShell("flash", overrideShellWidgetClass,
shell = XtCreatePopupShell("flash", overrideShellWidgetClass,
tree_info->tree_widget, args, num);
num = 0;
XtSetArg(args[num], XtNborderWidth, &bw); num++;
XtGetValues(shell, args, num);
bw *= 2;
num = 0;
XtSetArg(args[num], XtNwidth, (width - bw)); num++;
XtSetArg(args[num], XtNheight, (height - bw)); num++;
XtSetValues(shell, args, num);
XtSetValues(shell, args, num);
if (tree_info->num_flash_widgets + 1 > tree_info->alloc_flash_widgets) {
tree_info->alloc_flash_widgets += MORE_FLASH_WIDGETS;
tree_info->flash_widgets =
@ -357,7 +361,7 @@ FlashWidgets(TreeInfo *tree_info)
FlashWidgetsOn((XtPointer) tree_info, (XtIntervalId *) NULL);
}
/* Function Name: FlashWidgetsOn
* Description: Turns on all the Flash Widgets.
* Arguments: info_ptr - pointer to the tree info.
@ -370,9 +374,9 @@ static void
FlashWidgetsOn(XtPointer info_ptr, XtIntervalId *id)
{
int i;
Cardinal i;
TreeInfo * tree_info = (TreeInfo *) info_ptr;
for (i = 0; i < tree_info->num_flash_widgets; i++) {
XtRealizeWidget(tree_info->flash_widgets[i]);
XMapRaised(XtDisplay(tree_info->flash_widgets[i]),
@ -391,9 +395,9 @@ FlashWidgetsOn(XtPointer info_ptr, XtIntervalId *id)
static void
FlashWidgetsOff(XtPointer info_ptr, XtIntervalId *id)
{
int i;
Cardinal i;
TreeInfo * tree_info = (TreeInfo *) info_ptr;
for (i = 0; i < tree_info->num_flash_widgets; i++)
XtUnmapWidget(tree_info->flash_widgets[i]);
}
@ -409,19 +413,19 @@ FlashWidgetsOff(XtPointer info_ptr, XtIntervalId *id)
static void
FlashWidgetsCleanup(XtPointer info_ptr, XtIntervalId *id)
{
int i;
Cardinal i;
TreeInfo * tree_info = (TreeInfo *) info_ptr;
/*
* Unmap 'em first for consistency.
*/
for (i = 0; i < tree_info->num_flash_widgets; i++)
XtUnmapWidget(tree_info->flash_widgets[i]);
XFlush(XtDisplay(tree_info->tree_widget));
for (i = 0; i < tree_info->num_flash_widgets; i++)
for (i = 0; i < tree_info->num_flash_widgets; i++)
XtDestroyWidget(tree_info->flash_widgets[i]);
XtFree((char *)tree_info->flash_widgets);

View File

@ -39,13 +39,13 @@ in this Software without prior written authorization from The Open Group.
#include "editresP.h"
/*
/*
* Local function definitions.
*/
static char * GetResourceName ( ResourceBoxInfo * res_box );
static void _AppendResourceString ( Widget w, XtPointer res_box_ptr,
static void _AppendResourceString ( Widget w, XtPointer res_box_ptr,
XtPointer filename_ptr );
static void _SetResourcesFile ( Widget w, XtPointer junk,
static void _SetResourcesFile ( Widget w, XtPointer junk,
XtPointer filename_ptr );
static void ObtainResource ( XtPointer node_ptr );
static void CreateSetValuesCommand ( WNode * node, XtPointer info_ptr );
@ -89,8 +89,8 @@ SendTree(Widget w, XtPointer value, XtPointer call_data)
w = XtParent(w);
_XEditResResetStream(&(global_client.stream)); /* an empty message. */
SetCommand(w, LocalSendWidgetTree, NULL);
SetCommand(w, LocalSendWidgetTree, NULL);
}
/* Function Name: FindWidget
@ -171,13 +171,13 @@ TreeRelabel(Widget w, XtPointer client_data, XtPointer call_data)
*/
/* ARGSUSED */
void
void
PannerCallback(Widget w, XtPointer closure, XtPointer report_ptr)
{
Arg args[2];
XawPannerReport *report = (XawPannerReport *) report_ptr;
if (global_tree_info == NULL)
if (global_tree_info == NULL)
return;
XtSetArg (args[0], XtNx, -report->slider_x);
@ -188,7 +188,7 @@ PannerCallback(Widget w, XtPointer closure, XtPointer report_ptr)
/* Function Name: PortholeCallback
* Description: called when the porthole or its child has
* changed
* changed
* Arguments: porthole - the porthole widget.
* panner_ptr - the panner widget.
* report_ptr - the porthole record.
@ -196,7 +196,7 @@ PannerCallback(Widget w, XtPointer closure, XtPointer report_ptr)
*/
/* ARGSUSED */
void
void
PortholeCallback(Widget w, XtPointer panner_ptr, XtPointer report_ptr)
{
Arg args[10];
@ -222,7 +222,7 @@ PortholeCallback(Widget w, XtPointer panner_ptr, XtPointer report_ptr)
*/
/* ARGSUSED */
void
void
FlashActiveWidgets(Widget w, XtPointer junk, XtPointer garbage)
{
_FlashActiveWidgets(global_tree_info);
@ -268,7 +268,7 @@ GetResourceList(Widget w, XtPointer junk, XtPointer garbage)
* No resoruces, fetch them from the client.
*/
_XEditResResetStream(stream);
_XEditResResetStream(stream);
_XEditResPut16(stream, (unsigned short) 1);
InsertWidgetFromNode(stream, node);
SetCommand(global_tree_info->tree_widget, LocalGetResources, NULL);
@ -282,7 +282,7 @@ GetResourceList(Widget w, XtPointer junk, XtPointer garbage)
*/
/* ARGSUSED */
void
void
DumpTreeToFile(Widget w, XtPointer junk, XtPointer garbage)
{
_PopupFileDialog(XtParent(w), "Enter the filename:", "",
@ -290,24 +290,24 @@ DumpTreeToFile(Widget w, XtPointer junk, XtPointer garbage)
}
/************************************************************
*
*
* Callbacks for the Resource Box.
*
************************************************************/
/* Function Name: AnyChosen
* Description: Callback that is called when the "any" widget
* Description: Callback that is called when the "any" widget
* is activated.
* Arguments: w - the "any" widget that activated this callback.
* any_info_ptr - pointer to struct containing
* any_info_ptr - pointer to struct containing
* dot and star widgets to lock.
* state_ptr - state of the any toggle.
* Returns: none.
*/
/* ARGSUSED */
void
void
AnyChosen(Widget w, XtPointer any_info_ptr, XtPointer state_ptr)
{
AnyInfo * any_info = (AnyInfo *) any_info_ptr;
@ -337,9 +337,9 @@ AnyChosen(Widget w, XtPointer any_info_ptr, XtPointer state_ptr)
(*any_info->right_count)++;
}
else { /* state == 0 */
if (any_info->left_count > 0)
if (any_info->left_count > 0)
any_info->left_count--;
if ((any_info->right_count != NULL)&&(*any_info->right_count > 0))
if ((any_info->right_count != NULL)&&(*any_info->right_count > 0))
(*any_info->right_count)--;
if (any_info->left_count == 0) {
@ -374,17 +374,17 @@ GetResourceName(ResourceBoxInfo *res_box)
{
XawListReturnStruct * list_info;
char * result;
list_info = XawListShowCurrent(res_box->norm_list);
if ((list_info->list_index == XAW_LIST_NONE) &&
if ((list_info->list_index == XAW_LIST_NONE) &&
(res_box->cons_list != NULL)) {
list_info = XawListShowCurrent(res_box->cons_list);
}
if (list_info->list_index == XAW_LIST_NONE)
if (list_info->list_index == XAW_LIST_NONE)
result = "unknown";
else
result = list_info->string;
result = list_info->string;
return(result);
}
@ -431,12 +431,12 @@ SetResourceString(Widget w, XtPointer node_ptr, XtPointer junk)
char * temp, buf[BUFSIZ * 10]; /* here's hoping it's big enough. */
NameInfo * name_node = res_box->name_info;
Arg args[1];
int len;
Cardinal len;
if ((w != NULL) && XtIsSubclass(w, toggleWidgetClass)) {
/*
* Only set resources when toggles are activated, not when they are
* deactivated.
* deactivated.
*/
if (!((Boolean)(long) junk))
return;
@ -456,13 +456,13 @@ SetResourceString(Widget w, XtPointer node_ptr, XtPointer junk)
if ( (temp != NULL) && !streq(temp, ANY_RADIO_DATA) ) {
strcat(buf, temp);
temp = (char *) XawToggleGetCurrent(name_node->next->sep_leader);
if (temp == NULL)
if (temp == NULL)
strcat(buf, "!");
else
strcat(buf, temp);
}
}
strcat(buf, GetResourceName(res_box));
len = strlen(buf) + 2; /* Leave space for ':' and '\0' */
@ -476,7 +476,7 @@ SetResourceString(Widget w, XtPointer node_ptr, XtPointer junk)
malloc_string = XtRealloc(malloc_string, sizeof(char) * len);
malloc_size = len;
}
strcpy(malloc_string, buf);
strcat(malloc_string, ":");
#ifdef notdef
@ -486,9 +486,9 @@ SetResourceString(Widget w, XtPointer node_ptr, XtPointer junk)
XtSetArg(args[0], XtNlabel, malloc_string);
XtSetValues(res_box->res_label, args, ONE);
}
/* Function Name: ResourceListCallback
* Description: Callback functions for the resource lists. This
* Description: Callback functions for the resource lists. This
* routine is essentialy called by the list widgets
* Notify action. If action EnableGetVal has been
* invoked, ResourceListCallback will perform a
@ -508,7 +508,7 @@ ResourceListCallback(Widget list, XtPointer node_ptr, XtPointer junk)
WNode * node = (WNode *) node_ptr;
ResourceBoxInfo * res_box = node->resources->res_box;
if (list == res_box->norm_list)
if (list == res_box->norm_list)
o_list = res_box->cons_list;
else
o_list = res_box->norm_list;
@ -555,17 +555,18 @@ _AppendResourceString(Widget w, XtPointer res_box_ptr, XtPointer filename_ptr)
char *value_ptr;
if (filename != NULL) {
if (global_resources.allocated_save_resources_file)
if (global_resources.allocated_save_resources_file)
XtFree(global_resources.save_resources_file);
else
global_resources.allocated_save_resources_file = TRUE;
global_resources.save_resources_file = XtNewString(filename);
}
if ((fp = fopen(global_resources.save_resources_file, "a+")) == NULL) {
sprintf(buf, "Unable to open this file for writing, would %s",
"you like To try again?");
snprintf(buf, sizeof(buf), "%s",
"Unable to open this file for writing, would "
"you like To try again?");
_PopupFileDialog(global_toplevel ,buf,
global_resources.save_resources_file,
_AppendResourceString, res_box_ptr);
@ -595,7 +596,7 @@ _AppendResourceString(Widget w, XtPointer res_box_ptr, XtPointer filename_ptr)
void
SaveResource(Widget w, XtPointer res_box_ptr, XtPointer junk)
{
/*
/*
* If there is no filename the ask for one, otherwise just save to
* current file.
*/
@ -622,7 +623,7 @@ _SetResourcesFile(Widget w, XtPointer junk, XtPointer filename_ptr)
{
char *filename = (char *) filename_ptr;
if (global_resources.allocated_save_resources_file)
if (global_resources.allocated_save_resources_file)
XtFree(global_resources.save_resources_file);
else
global_resources.allocated_save_resources_file = TRUE;
@ -642,7 +643,7 @@ _SetResourcesFile(Widget w, XtPointer junk, XtPointer filename_ptr)
void
SetFile(Widget w, XtPointer junk, XtPointer garbage)
{
/*
/*
* If there is no filename the ask for one, otherwise just save to
* current file.
*/
@ -655,7 +656,7 @@ SetFile(Widget w, XtPointer junk, XtPointer garbage)
/* Function Name: ApplyResource
* Description: Apply the current resource to the running application.
* Arguments: w - any widget in the application.
* node_ptr - a pointer to the node containing
* node_ptr - a pointer to the node containing
* the current resouce box.
* junk - UNUSED.
* Returns: none
@ -667,7 +668,7 @@ ApplyResource(Widget w, XtPointer node_ptr, XtPointer junk)
{
ProtocolStream * stream = &(global_client.stream);
ApplyResourcesInfo info;
WNode * node = (WNode *) node_ptr;
WNode * node = (WNode *) node_ptr;
char * value;
unsigned short size, i;
long len;
@ -694,37 +695,37 @@ ApplyResource(Widget w, XtPointer node_ptr, XtPointer junk)
*/
value = GetResourceValueForSetValues(node, &size);
_XEditResPut16(stream, size);
for (i = 0; i < size; i++)
_XEditResPut16(stream, size);
for (i = 0; i < size; i++)
_XEditResPut8(stream, value[i]);
XtFree(value);
len = stream->current - stream->top;
/*
* Insert the widget count, overriden later.
/*
* Insert the widget count, overriden later.
*/
_XEditResPut16(stream, 0);
_XEditResPut16(stream, 0);
ExecuteOverAllNodes(node->tree_info->top_node,
CreateSetValuesCommand, (XtPointer) &info);
if (info.count > 0) {
*(stream->top + len++) = info.count >> XER_NBBY; /* Set the correct */
*(stream->top + len) = info.count; /* count. */
SetCommand(node->tree_info->tree_widget, LocalSetValues, NULL);
}
else
else
SetMessage(global_screen_data.info_label,
res_labels[20]);
XrmDestroyDatabase(info.database);
}
/* Function Name: ObtainResource
* Description: Obtain the current resource from the running application.
* Arguments: node_ptr - a pointer to the node containing
* Arguments: node_ptr - a pointer to the node containing
* the current resouce box.
* Returns: none
*/
@ -735,7 +736,7 @@ ObtainResource(XtPointer node_ptr)
{
ProtocolStream * stream = &(global_client.stream);
ObtainResourcesInfo info;
WNode * node = (WNode *) node_ptr;
WNode * node = (WNode *) node_ptr;
char * value;
Arg args[1];
@ -753,11 +754,11 @@ ObtainResource(XtPointer node_ptr)
_XEditResResetStream(stream);
_XEditResPutString8(stream, info.name); /* insert name */
/*
/*
* Insert the widget count, always 1
*/
_XEditResPut16(stream, 1);
_XEditResPut16(stream, 1);
/*CreateGetValuesCommand(node, (XtPointer)&info); Inserts widget */
@ -836,7 +837,7 @@ CreateGetValuesCommand(WNode *node, XtPointer info_ptr)
* Description: Activates all widgets that match this resource.
* Arguments: w - UNUSED.
* node_ptr - the node that owns this resource box.
* junk - UNUSED.
* junk - UNUSED.
* Returns: none.
*/
@ -844,7 +845,7 @@ CreateGetValuesCommand(WNode *node, XtPointer info_ptr)
void
ActivateResourceWidgets(Widget w, XtPointer node_ptr, XtPointer junk)
{
WNode * node = (WNode *) node_ptr;
WNode * node = (WNode *) node_ptr;
ApplyResourcesInfo info;
char * line;
Arg args[1];
@ -852,7 +853,7 @@ ActivateResourceWidgets(Widget w, XtPointer node_ptr, XtPointer junk)
info.name = GetResourceName(node->resources->res_box);
info.class = "IGNORE_ME"; /* Not currently used. */
/*
/*
* Unused fields.
*/
@ -868,7 +869,7 @@ ActivateResourceWidgets(Widget w, XtPointer node_ptr, XtPointer junk)
ExecuteOverAllNodes(node->tree_info->top_node,
SetOnlyMatchingWidgets, (XtPointer) &info);
XrmDestroyDatabase(info.database);
}

View File

@ -325,6 +325,8 @@ the widgets which compose \fIeditres\fP. In the notation below,
indentation indicates hierarchical structure. The widget class name
is given first, followed by the widget instance name.
.sp
.\" Default tab stops will work for this display,
.\" which allows us to avoid spurious a warning duriing XML upconversion.
.nf
.TA .5i 1.0i 1.5i 2.0i
.ta .5i 1.0i 1.5i 2.0i

View File

@ -32,7 +32,7 @@ in this Software without prior written authorization from The Open Group.
#include <stdio.h>
#include <X11/Xaw/AsciiText.h>
#include <X11/Xaw/Cardinals.h>
#include <X11/Xaw/Cardinals.h>
#include <X11/Xfuncs.h>
#include <X11/Xos.h>
#include "editresP.h"
@ -55,22 +55,23 @@ PrintSetValuesError(Event *event)
SetValuesEvent * sv_event = (SetValuesEvent *) event;
char buf[BUFSIZ];
if (sv_event->num_entries == 0)
if (sv_event->num_entries == 0)
return(XtNewString("SetValues was Successful."));
for (i = 0 ; i < (int)sv_event->num_entries ; i++) {
node = FindNode(global_tree_info->top_node,
sv_event->info[i].widgets.ids,
sv_event->info[i].widgets.ids,
sv_event->info[i].widgets.num_widgets);
if (node == NULL) {
sprintf(buf, "Editres Internal Error: Unable to FindNode.\n");
AddString(&errors, buf);
snprintf(buf, sizeof(buf),
"Editres Internal Error: Unable to FindNode.\n");
AddString(&errors, buf);
continue;
}
sprintf(buf, "%s(0x%lx) - %s\n", node->name, node->id,
sv_event->info[i].message);
snprintf(buf, sizeof(buf), "%s(0x%lx) - %s\n", node->name, node->id,
sv_event->info[i].message);
AddString(&errors, buf);
}
return(errors);
@ -99,8 +100,7 @@ GetResourceValueForSetValues(WNode *node, unsigned short *size)
* the resource database.
*/
temp = XtMalloc(sizeof(char) * (strlen(ptr) + strlen(RESOURCE_NAME) + 2));
sprintf(temp, "%s:%s", RESOURCE_NAME, ptr);
XtAsprintf(&temp, "%s:%s", RESOURCE_NAME, ptr);
XrmPutLineResource(&db, temp);
XtFree(temp);
@ -109,7 +109,7 @@ GetResourceValueForSetValues(WNode *node, unsigned short *size)
ptr = XtMalloc(sizeof(char) * value.size);
memmove( ptr, value.addr, value.size);
XrmDestroyDatabase(db);
*size = (unsigned short) value.size;
return(ptr);
}

View File

@ -32,10 +32,10 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Shell.h>
#include <X11/Xaw/AsciiText.h>
#include <X11/Xaw/Cardinals.h>
#include <X11/Xaw/Command.h>
#include <X11/Xaw/Cardinals.h>
#include <X11/Xaw/Command.h>
#include <X11/Xaw/Form.h>
#include <X11/Xaw/Label.h>
#include <X11/Xaw/Label.h>
#include <stdio.h>
@ -69,7 +69,7 @@ PopupSetValues(Widget parent, XEvent *event)
return;
}
/*
/*
* Check and possibly create the popup.
*/
@ -94,27 +94,27 @@ PopupSetValues(Widget parent, XEvent *event)
}
/* Function Name: ModifySVEntry
* Description: Action routine that can be bound to the set values
* dialog box's Text Widget that will send input to the
* Description: Action routine that can be bound to the set values
* dialog box's Text Widget that will send input to the
* field specified.
* Arguments: (Standard Action Routine args)
* Arguments: (Standard Action Routine args)
* Returns: none.
*/
/* ARGSUSED */
void
void
ModifySVEntry(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
Widget new, old;
char msg[BUFSIZ];
if (*num_params != 1) {
strcpy(msg,
strcpy(msg,
res_labels[21]);
SetMessage(global_screen_data.info_label, msg);
return;
}
switch (params[0][0]) {
case 'r':
case 'R':
@ -127,11 +127,11 @@ ModifySVEntry(Widget w, XEvent *event, String *params, Cardinal *num_params)
old = global_screen_data.res_text;
break;
default:
sprintf(msg, res_labels[22]);
snprintf(msg, sizeof(msg), res_labels[22]);
SetMessage(global_screen_data.info_label, msg);
return;
}
_SetField(new, old);
}
@ -152,26 +152,26 @@ _SetField(Widget new, Widget old)
{
Arg args[2];
Pixel new_border, old_border, old_bg;
if (!XtIsSensitive(new)) {
#ifdef XKB
/* Don't set field to an inactive Widget. */
XkbStdBell(XtDisplay(old), XtWindow(new), 0, XkbBI_InvalidLocation);
XkbStdBell(XtDisplay(old), XtWindow(new), 0, XkbBI_InvalidLocation);
#else
XBell(XtDisplay(old), 0); /* Don't set field to an inactive Widget. */
#endif
return;
}
XtSetKeyboardFocus(XtParent(new), new);
XtSetKeyboardFocus(XtParent(new), new);
XtSetArg(args[0], XtNborderColor, &old_border);
XtSetArg(args[1], XtNbackground, &old_bg);
XtGetValues(new, args, TWO);
XtSetArg(args[0], XtNborderColor, &new_border);
XtGetValues(old, args, ONE);
if (old_border != old_bg) /* Colors are already correct, return. */
return;
@ -196,12 +196,12 @@ CreateSetValuesPopup(Widget parent, ScreenData *scr_data)
Widget res_label;
Arg args[10];
Cardinal num_args;
scr_data->set_values_popup = XtCreatePopupShell("setValuesPopup",
transientShellWidgetClass,
scr_data->set_values_popup = XtCreatePopupShell("setValuesPopup",
transientShellWidgetClass,
parent, NULL, ZERO);
form = XtCreateManagedWidget("form", formWidgetClass,
form = XtCreateManagedWidget("form", formWidgetClass,
scr_data->set_values_popup, NULL, ZERO);
num_args = 0;
@ -217,7 +217,7 @@ CreateSetValuesPopup(Widget parent, ScreenData *scr_data)
num_args = 0;
XtSetArg(args[num_args], XtNfromVert, label); num_args++;
XtSetArg(args[num_args], XtNfromHoriz, res_label); num_args++;
scr_data->res_text = XtCreateManagedWidget("resourceText",
scr_data->res_text = XtCreateManagedWidget("resourceText",
asciiTextWidgetClass,
form, args, num_args);
@ -229,13 +229,13 @@ CreateSetValuesPopup(Widget parent, ScreenData *scr_data)
num_args = 0;
XtSetArg(args[num_args], XtNfromHoriz, res_label); num_args++;
XtSetArg(args[num_args], XtNfromVert, scr_data->res_text); num_args++;
scr_data->val_text = XtCreateManagedWidget("valueText",
scr_data->val_text = XtCreateManagedWidget("valueText",
asciiTextWidgetClass,
form, args, num_args);
num_args = 0;
XtSetArg(args[num_args], XtNfromVert, scr_data->val_text); num_args++;
do_it = XtCreateManagedWidget("setValues", commandWidgetClass,
do_it = XtCreateManagedWidget("setValues", commandWidgetClass,
form, args, num_args);
num_args = 0;
@ -287,20 +287,20 @@ DoSetValues(Widget w, XtPointer junk, XtPointer garbage)
res_labels[23]);
return;
}
XtSetArg(args[0], XtNstring, &res_name);
XtGetValues(global_screen_data.res_text, args, ONE);
XtSetArg(args[0], XtNstring, &res_value);
XtGetValues(global_screen_data.val_text, args, ONE);
_XEditResResetStream(stream);
_XEditResPutString8(stream, res_name);
_XEditResPutString8(stream, XtRString);
_XEditResPutString8(stream, res_value);
_XEditResPut16(stream, global_tree_info->num_nodes);
for (i = 0; i < global_tree_info->num_nodes; i++)
for (i = 0; i < global_tree_info->num_nodes; i++)
InsertWidgetFromNode(stream, global_tree_info->active_nodes[i]);
SetCommand(w, LocalSetValues, NULL);
@ -317,5 +317,5 @@ DoSetValues(Widget w, XtPointer junk, XtPointer garbage)
static void
CancelSetValues(Widget w, XtPointer junk, XtPointer garbage)
{
XtPopdown(XtParent(XtParent(w)));
XtPopdown(XtParent(XtParent(w)));
}

View File

@ -39,11 +39,11 @@ in this Software without prior written authorization from The Open Group.
#include "editresP.h"
static WNode * FindWidgetFromWindowGivenNode ( WNode * node, Window win );
static WidgetResources * ParseResources ( GetResourcesInfo * info,
static WidgetResources * ParseResources ( GetResourcesInfo * info,
char **error );
static int CompareResourceEntries ( const void *e1,
static int CompareResourceEntries ( const void *e1,
const void *e2 );
static void AddResource ( ResourceInfo * res_info,
static void AddResource ( ResourceInfo * res_info,
WidgetResourceInfo * resource );
static void FreeResources ( WidgetResources * resources );
@ -144,7 +144,7 @@ AddString(char ** str, char *add)
ptr = *str + len_str;
strcpy(ptr, add);
}
/* Function Name: FindNode
* Description: Finds a node give the top node, and a node id number.
* Arguments: top_node - the top node.
@ -155,7 +155,7 @@ AddString(char ** str, char *add)
WNode *
FindNode(WNode *top_node, unsigned long *ids, Cardinal number)
{
int i, j;
Cardinal i, j;
WNode *node;
if (top_node == NULL)
@ -176,7 +176,7 @@ FindNode(WNode *top_node, unsigned long *ids, Cardinal number)
}
if (!found_it)
return(NULL);
}
}
return(node);
}
@ -187,7 +187,7 @@ FindNode(WNode *top_node, unsigned long *ids, Cardinal number)
* Returns: node - the node corrosponding to this widget.
*/
WNode *
WNode *
FindWidgetFromWindow(TreeInfo *tree_info, Window win)
{
if (tree_info == NULL)
@ -206,7 +206,7 @@ FindWidgetFromWindow(TreeInfo *tree_info, Window win)
static WNode *
FindWidgetFromWindowGivenNode(WNode *node, Window win)
{
int i;
Cardinal i;
WNode * ret_node;
if (node->window == win)
@ -237,7 +237,7 @@ HandleXErrors(Display *display, XErrorEvent *error)
}
if (error->error_code == BadWindow)
global_error_code = NO_WINDOW;
global_error_code = NO_WINDOW;
else {
if (XmuPrintDefaultErrorMessage(display, error, stderr) != 0)
exit(1);
@ -260,7 +260,7 @@ void
_DumpTreeToFile(Widget w, XtPointer tree_ptr, XtPointer filename)
{
TreeInfo * tree_info = (TreeInfo *) tree_ptr;
FILE * fp;
FILE * fp;
if (tree_info == NULL) {
SetMessage(global_screen_data.info_label,
@ -271,7 +271,7 @@ _DumpTreeToFile(Widget w, XtPointer tree_ptr, XtPointer filename)
if ( (fp = fopen((char *)filename, "w")) == NULL ) {
char buf[BUFSIZ];
sprintf(buf, res_labels[24], (char *)filename);
snprintf(buf, sizeof(buf), res_labels[24], (char *)filename);
SetMessage(global_screen_data.info_label, buf);
return;
}
@ -281,7 +281,7 @@ _DumpTreeToFile(Widget w, XtPointer tree_ptr, XtPointer filename)
}
/************************************************************
*
*
* The file dialog boxes are handled with this code.
*
* It automatically calls the function specified when the
@ -325,7 +325,7 @@ _PopupFileDialog(Widget w, String str, String default_value,
num_args = 0;
XtSetArg(args[num_args], XtNlabel, str); num_args++;
XtSetArg(args[num_args], XtNvalue, default_value); num_args++;
dialog = XtCreateManagedWidget("dialog", dialogWidgetClass,
dialog = XtCreateManagedWidget("dialog", dialogWidgetClass,
shell, args, num_args);
file_info = XtNew(FileDialogInfo);
@ -333,7 +333,7 @@ _PopupFileDialog(Widget w, String str, String default_value,
file_info->func = func;
file_info->data = data;
if (XSaveContext(XtDisplay(dialog), (Window) dialog, file_dialog_context,
if (XSaveContext(XtDisplay(dialog), (Window) dialog, file_dialog_context,
(XPointer) file_info) != 0) {
SetMessage(global_screen_data.info_label,
"Error while trying to save Context\nAborting file dialog popup.");
@ -391,7 +391,7 @@ PopupCentered(XEvent *event, Widget w, XtGrabKind mode)
Window root, child;
int win_x, win_y;
unsigned int mask;
XQueryPointer(XtDisplay(w), XtWindow(w),
&root, &child, &x, &y, &win_x, &win_y, &mask);
}
@ -406,17 +406,17 @@ PopupCentered(XEvent *event, Widget w, XtGrabKind mode)
height += 2 * b_width;
x -= ((int) width/2);
if (x < 0)
if (x < 0)
x = 0;
if ( x > (max_x = (int) (XtScreen(w)->width - width)) )
x = max_x;
y -= ( (Position) height/2 );
if (y < 0)
if (y < 0)
y = 0;
if ( y > (max_y = (int) (XtScreen(w)->height - height)) )
y = max_y;
num_args = 0;
XtSetArg(args[num_args], XtNx, x); num_args++;
XtSetArg(args[num_args], XtNy, y); num_args++;
@ -435,7 +435,7 @@ PopupCentered(XEvent *event, Widget w, XtGrabKind mode)
/* ARGSUSED */
void
void
_PopdownFileDialog(Widget w, XtPointer client_data, XtPointer junk)
{
Widget dialog = XtParent(w);
@ -444,11 +444,11 @@ _PopdownFileDialog(Widget w, XtPointer client_data, XtPointer junk)
if (XFindContext(XtDisplay(dialog), (Window) dialog, file_dialog_context,
&file_info_ptr) == XCNOENT) {
SetMessage(global_screen_data.info_label,
"Error while trying to find Context\nAborting...");
SetMessage(global_screen_data.info_label,
"Error while trying to find Context\nAborting...");
}
(void) XDeleteContext(XtDisplay(dialog), (Window)dialog,
(void) XDeleteContext(XtDisplay(dialog), (Window)dialog,
file_dialog_context);
file_info = (FileDialogInfo *) file_info_ptr;
@ -514,16 +514,16 @@ HandleGetResources(Event *event)
for (i = 0; i < (int)get_event->num_entries; i++) {
node = FindNode(global_tree_info->top_node,
get_event->info[i].widgets.ids,
get_event->info[i].widgets.ids,
get_event->info[i].widgets.num_widgets);
if (node == NULL) {
sprintf(buf, res_labels[16]);
AddString(&errors, buf);
continue;
snprintf(buf, sizeof(buf), res_labels[16]);
AddString(&errors, buf);
continue;
}
if (node->resources != NULL)
if (node->resources != NULL)
FreeResources(node->resources);
if (!get_event->info[i].error) {
@ -563,7 +563,7 @@ CreateResourceBox(WNode *node, char **errors)
if (resources->num_normal > 0) {
names = (char **) XtMalloc(sizeof(char *) *
(resources->num_normal + 1));
for (i = 0 ; i < resources->num_normal ; i++)
for (i = 0 ; i < resources->num_normal ; i++)
names[i] = resources->normal[i].name;
names[i] = NULL;
}
@ -573,8 +573,8 @@ CreateResourceBox(WNode *node, char **errors)
if (resources->num_constraint > 0) {
cons_names = (char **) XtMalloc(sizeof(char *) *
(resources->num_constraint + 1));
for (i = 0 ; i < resources->num_constraint ; i++)
for (i = 0 ; i < resources->num_constraint ; i++)
cons_names[i] = resources->constraint[i].name;
cons_names[i] = NULL;
}
@ -592,15 +592,15 @@ CreateResourceBox(WNode *node, char **errors)
* Returns: The resource information.
*/
static WidgetResources *
static WidgetResources *
ParseResources(GetResourcesInfo *info, char **error)
{
WidgetResources * resources;
WidgetResourceInfo * normal;
int i;
resources = (WidgetResources *) XtMalloc(sizeof(WidgetResources));
resources = (WidgetResources *) XtMalloc(sizeof(WidgetResources));
/*
* Allocate enough space for both the normal and constraint resources,
* then add the normal resources from the top, and the constraint resources
@ -608,7 +608,7 @@ ParseResources(GetResourcesInfo *info, char **error)
* that there is no overlap.
*/
resources->normal = (WidgetResourceInfo *)
resources->normal = (WidgetResourceInfo *)
XtMalloc(sizeof(WidgetResourceInfo) * info->num_resources);
normal = resources->normal;
@ -620,7 +620,7 @@ ParseResources(GetResourcesInfo *info, char **error)
switch((int) info->res_info[i].res_type) {
case NormalResource:
resources->num_normal++;
AddResource(info->res_info + i, normal++);
AddResource(info->res_info + i, normal++);
break;
case ConstraintResource:
resources->num_constraint++;
@ -629,8 +629,8 @@ ParseResources(GetResourcesInfo *info, char **error)
default:
{
char buf[BUFSIZ];
sprintf(buf, "Unknown resource type %d\n",
info->res_info[i].res_type);
snprintf(buf, sizeof(buf), "Unknown resource type %d\n",
info->res_info[i].res_type);
AddString(error, buf);
}
break;
@ -638,7 +638,7 @@ ParseResources(GetResourcesInfo *info, char **error)
}
/*
* Sort the resources alphabetically.
* Sort the resources alphabetically.
*/
qsort(resources->normal, resources->num_normal,
@ -661,10 +661,10 @@ ParseResources(GetResourcesInfo *info, char **error)
* Returns: an integer >, < or = 0.
*/
static int
static int
CompareResourceEntries(const void *e1, const void *e2)
{
return (strcmp(((WidgetResourceInfo *)e1)->name,
return (strcmp(((WidgetResourceInfo *)e1)->name,
((WidgetResourceInfo *)e2)->name));
}
@ -719,7 +719,7 @@ FreeResources(WidgetResources *resources)
XFree((char *)resources);
}
/* Function Name: CheckDatabase
* Description: Checks to see if the node is in the database.
@ -758,12 +758,12 @@ Quarkify(char **list, char *ptr)
quarks = (XrmQuarkList) XtMalloc(sizeof(XrmQuark) * i);
for (tlist = list, tquarks = quarks; *tlist != NULL; tlist++, tquarks++)
for (tlist = list, tquarks = quarks; *tlist != NULL; tlist++, tquarks++)
*tquarks = XrmStringToQuark(*tlist);
if (ptr != NULL)
if (ptr != NULL)
*tquarks++ = XrmStringToQuark(ptr);
*tquarks = NULLQUARK;
return(quarks);
}
@ -780,11 +780,11 @@ void
ExecuteOverAllNodes(WNode *top_node, void (*func)(WNode *, XtPointer),
XtPointer data)
{
int i;
Cardinal i;
(*func)(top_node, data);
for (i = 0; i < top_node->num_children; i++)
for (i = 0; i < top_node->num_children; i++)
ExecuteOverAllNodes(top_node->children[i], func, data);
}
@ -806,7 +806,7 @@ InsertWidgetFromNode(ProtocolStream *stream, WNode *node)
for (temp = node, i = 0; temp != NULL; temp = temp->parent, i++) {}
num_widgets = i;
widget_list = (unsigned long *)
widget_list = (unsigned long *)
XtMalloc(sizeof(unsigned long) * num_widgets);
/*
@ -814,13 +814,13 @@ InsertWidgetFromNode(ProtocolStream *stream, WNode *node)
* Make sure that they are inserted in the list from parent -> child.
*/
for (i--, temp = node; temp != NULL; temp = temp->parent, i--)
for (i--, temp = node; temp != NULL; temp = temp->parent, i--)
widget_list[i] = temp->id;
_XEditResPut16(stream, num_widgets); /* insert number of widgets. */
for (i = 0; i < num_widgets; i++) /* insert Widgets themselves. */
_XEditResPut32(stream, widget_list[i]);
XtFree((char *)widget_list);
}
@ -830,12 +830,12 @@ InsertWidgetFromNode(ProtocolStream *stream, WNode *node)
* Returns: message to show.
*/
char *
char *
GetFailureMessage(ProtocolStream *stream)
{
char * return_str;
if (_XEditResGetString8(stream, &return_str))
if (_XEditResGetString8(stream, &return_str))
return(return_str);
return(XtNewString(res_labels[35]));
@ -848,23 +848,23 @@ GetFailureMessage(ProtocolStream *stream)
* Returns: message to show.
*/
char *
char *
ProtocolFailure(ProtocolStream *stream)
{
char buf[BUFSIZ];
unsigned char version;
char* old_version_string;
if (!_XEditResGet8(stream, &version))
if (!_XEditResGet8(stream, &version))
return(XtNewString(res_labels[35]));
switch ((int)version) {
case PROTOCOL_VERSION_ONE_POINT_ZERO: old_version_string = "1.0"; break;
default: old_version_string = "1.0";
}
sprintf(buf, res_labels[36],
CURRENT_PROTOCOL_VERSION_STRING, old_version_string);
snprintf(buf, sizeof(buf), res_labels[36],
CURRENT_PROTOCOL_VERSION_STRING, old_version_string);
return(XtNewString(buf));
}

View File

@ -32,20 +32,20 @@ in this Software without prior written authorization from The Open Group.
#include <X11/StringDefs.h> /* Get standard string definations. */
#include <X11/Xaw/AsciiText.h>
#include <X11/Xaw/Box.h>
#include <X11/Xaw/Cardinals.h>
#include <X11/Xaw/Label.h>
#include <X11/Xaw/List.h>
#include <X11/Xaw/MenuButton.h>
#include <X11/Xaw/Paned.h>
#include <X11/Xaw/Panner.h>
#include <X11/Xaw/Porthole.h>
#include <X11/Xaw/SmeBSB.h>
#include <X11/Xaw/SmeLine.h>
#include <X11/Xaw/SimpleMenu.h>
#include <X11/Xaw/Toggle.h>
#include <X11/Xaw/Box.h>
#include <X11/Xaw/Cardinals.h>
#include <X11/Xaw/Label.h>
#include <X11/Xaw/List.h>
#include <X11/Xaw/MenuButton.h>
#include <X11/Xaw/Paned.h>
#include <X11/Xaw/Panner.h>
#include <X11/Xaw/Porthole.h>
#include <X11/Xaw/SmeBSB.h>
#include <X11/Xaw/SmeLine.h>
#include <X11/Xaw/SimpleMenu.h>
#include <X11/Xaw/Toggle.h>
#include <X11/Xaw/Tree.h>
#include <X11/Xaw/Viewport.h>
#include <X11/Xaw/Viewport.h>
#include "editresP.h"
@ -60,10 +60,10 @@ static void CreateCommandMenu ( Widget parent, String toolkit );
static void CreateTreeCommandMenu ( Widget parent, String toolkit );
static void CreateResourceNameForm ( Widget parent, WNode * node );
static void SetToggleGroupLeaders ( WNode * node );
static void MakeBoxLookNice ( Widget dot, Widget star, Widget any,
Widget single, Widget name, Widget class,
static void MakeBoxLookNice ( Widget dot, Widget star, Widget any,
Widget single, Widget name, Widget class,
int endbox );
static void CreateLists ( Widget parent, WNode * node, char **names,
static void CreateLists ( Widget parent, WNode * node, char **names,
char **cons_names );
static void CreateValueWidget ( Widget parent, WNode * node );
static void PopupOnNode ( WNode * node, Widget shell );
@ -133,21 +133,21 @@ static XtResource resources[] = {
#undef Offset
void
void
RebuildMenusAndLabel(String toolkit)
{
if (strcmp(global_effective_toolkit, toolkit)) {
CreateCommandMenu(box, toolkit);
CreateTreeCommandMenu(box, toolkit);
XtDestroyWidget(global_screen_data.info_label);
global_screen_data.info_label = XtCreateManagedWidget(toolkit,
global_screen_data.info_label = XtCreateManagedWidget(toolkit,
labelWidgetClass,
hPane, NULL, ZERO);
/* get the new toolkit label application resources for info_label */
XtGetApplicationResources(global_screen_data.info_label,
res_labels, resources,
XtNumber(resources), NULL, 0);
global_effective_toolkit = toolkit;
}
}
@ -160,7 +160,7 @@ RebuildMenusAndLabel(String toolkit)
* Returns: none.
*/
void
void
BuildWidgetTree(Widget parent)
{
Widget paned, porthole, panner;
@ -177,9 +177,9 @@ BuildWidgetTree(Widget parent)
* Allow the panner and porthole to talk to each other.
*/
XtAddCallback(porthole,
XtAddCallback(porthole,
XtNreportCallback, PortholeCallback, (XtPointer) panner);
XtAddCallback(panner,
XtAddCallback(panner,
XtNreportCallback, PannerCallback, (XtPointer) porthole);
global_tree_parent = porthole;
@ -191,7 +191,7 @@ BuildWidgetTree(Widget parent)
/* Function Name: CreateTopArea
* Description: Creates the top part of the display
* Arguments: parent - widget to put this menu bar into.
* Returns: none.
* Returns: none.
*/
@ -208,10 +208,10 @@ CreateTopArea(Widget parent)
hPane = XtCreateManagedWidget("hPane",panedWidgetClass, parent, NULL,ZERO);
{
panner = XtCreateManagedWidget("panner", pannerWidgetClass,
panner = XtCreateManagedWidget("panner", pannerWidgetClass,
hPane, NULL, ZERO);
global_screen_data.info_label = XtCreateManagedWidget("xt",
global_screen_data.info_label = XtCreateManagedWidget("xt",
labelWidgetClass,
hPane, NULL,ZERO);
@ -219,7 +219,7 @@ CreateTopArea(Widget parent)
XtGetApplicationResources(global_screen_data.info_label,
res_labels, resources,
XtNumber(resources), NULL, 0);
}
return(panner);
@ -237,7 +237,7 @@ CreateTopArea(Widget parent)
void
SetEntriesSensitive(Widget *entries, int num, Boolean sensitive)
{
int i; for (i=0; i<num; i++) XtSetSensitive(entries[i], sensitive);
int i; for (i=0; i<num; i++) XtSetSensitive(entries[i], sensitive);
}
@ -260,7 +260,7 @@ CreateCommandMenu(Widget parent, String toolkit)
Arg args[1];
if (cmenu) { XtDestroyWidget(cmenu); CM_set_insensitive = False; }
else
else
cbutton = XtCreateManagedWidget("commands", menuButtonWidgetClass,
parent, NULL, ZERO);
@ -270,7 +270,7 @@ CreateCommandMenu(Widget parent, String toolkit)
cmenu = XtCreatePopupShell(toolkit, simpleMenuWidgetClass, cbutton,
NULL, ZERO);
CM_entries[0] = XtCreateManagedWidget("sendTree", smeBSBObjectClass,cmenu,
NULL, ZERO);
XtAddCallback(CM_entries[0], XtNcallback, SendTree, (XtPointer) TRUE);
@ -279,19 +279,19 @@ CreateCommandMenu(Widget parent, String toolkit)
NULL, ZERO);
XtAddCallback(CM_entries[1], XtNcallback, SendTree, (XtPointer) FALSE);
CM_entries[2] = XtCreateManagedWidget("dumpTreeToFile",
CM_entries[2] = XtCreateManagedWidget("dumpTreeToFile",
smeBSBObjectClass,cmenu,
NULL, ZERO);
XtAddCallback(CM_entries[2], XtNcallback, DumpTreeToFile, NULL);
CM_entries[3] = XtCreateManagedWidget("line", smeLineObjectClass, cmenu,
NULL, ZERO);
CM_entries[4]= XtCreateManagedWidget("getResourceList",
CM_entries[4]= XtCreateManagedWidget("getResourceList",
smeBSBObjectClass,cmenu,
NULL, ZERO);
XtAddCallback(CM_entries[4], XtNcallback, GetResourceList, NULL);
CM_entries[5] = XtCreateManagedWidget("setValues", smeBSBObjectClass,
CM_entries[5] = XtCreateManagedWidget("setValues", smeBSBObjectClass,
cmenu,
NULL, ZERO);
XtAddCallback(CM_entries[5], XtNcallback, InitSetValues, NULL);
@ -303,7 +303,7 @@ CreateCommandMenu(Widget parent, String toolkit)
NULL, ZERO);
XtAddCallback(CM_entries[7], XtNcallback, Quit, NULL);
if (CM_set_insensitive)
if (CM_set_insensitive)
SetEntriesSensitive(&CM_entries[CM_OFFSET], CM_NUM, False);
}
@ -395,7 +395,7 @@ CreateTreeCommandMenu(Widget parent, String toolkit)
TM_entries[i] = XtCreateManagedWidget(tree_menu[i].name, class, tmenu,
NULL, ZERO);
if (func != NULL)
if (func != NULL)
XtAddCallback(TM_entries[i], XtNcallback, func,tree_menu[i].data);
}
if (TM_set_insensitive) SetEntriesSensitive(&TM_entries[TM_OFFSET],
@ -438,9 +438,9 @@ void
LayoutTree(Widget tree)
{
Arg args[1];
XawTreeForceLayout(tree);
XtMapWidget(tree);
XtMapWidget(tree);
XtSetArg(args[0], XtNbackgroundPixmap, old_pixmap);
XtSetValues(XtParent(tree), args, ONE);
@ -458,8 +458,8 @@ LayoutTree(Widget tree)
* Description: Creates the widgets that make up the resource box.
* Arguments: node - the widget node.
* names - the list of names that make up the normal resources.
* cons_names - the list of names that make up
* the constraint resources.
* cons_names - the list of names that make up
* the constraint resources.
* Returns: none.
*/
@ -483,16 +483,16 @@ CreateResourceBoxWidgets(WNode *node, char **names, char **cons_names)
XtAddCallback(res_box->shell, XtNdestroyCallback,
FreeResBox, (XtPointer) node);
pane = XtCreateManagedWidget("pane", panedWidgetClass,
pane = XtCreateManagedWidget("pane", panedWidgetClass,
res_box->shell, NULL, ZERO);
viewport = XtCreateManagedWidget("mainViewport", viewportWidgetClass,
pane, NULL, 0);
pane_child = XtCreateManagedWidget("pane", panedWidgetClass,
pane_child = XtCreateManagedWidget("pane", panedWidgetClass,
viewport, NULL, ZERO);
res_box->res_label = XtCreateManagedWidget("resourceLabel",
labelWidgetClass,
res_box->res_label = XtCreateManagedWidget("resourceLabel",
labelWidgetClass,
pane_child, NULL, ZERO);
CreateResourceNameForm(pane_child, node);
@ -565,9 +565,9 @@ CreateResourceNameForm(Widget parent, WNode *node)
num_args = 0;
XtSetArg(args[num_args], XtNfromHoriz, name); num_args++;
XtSetArg(args[num_args], XtNradioData, "."); num_args++;
dot = XtCreateManagedWidget("dot", toggleWidgetClass,
dot = XtCreateManagedWidget("dot", toggleWidgetClass,
form, args, num_args);
XtAddCallback(dot, XtNcallback,
XtAddCallback(dot, XtNcallback,
ActivateWidgetsAndSetResourceString,(XtPointer) node);
num_args = 0;
@ -575,9 +575,9 @@ CreateResourceNameForm(Widget parent, WNode *node)
XtSetArg(args[num_args], XtNfromVert, dot); num_args++;
XtSetArg(args[num_args], XtNradioGroup, dot); num_args++;
XtSetArg(args[num_args], XtNradioData, "*"); num_args++;
star = XtCreateManagedWidget("star", toggleWidgetClass,
star = XtCreateManagedWidget("star", toggleWidgetClass,
form, args, num_args);
XtAddCallback(star,XtNcallback,
XtAddCallback(star,XtNcallback,
ActivateWidgetsAndSetResourceString, (XtPointer) node);
if (name_info != NULL) {
@ -585,7 +585,7 @@ CreateResourceNameForm(Widget parent, WNode *node)
name_info = name_info->next;
}
else
res_box->name_info =
res_box->name_info =
name_info = (NameInfo *) XtMalloc(sizeof(NameInfo));
name_info->sep_leader = dot;
@ -597,10 +597,10 @@ CreateResourceNameForm(Widget parent, WNode *node)
new_info->left_dot = dot;
new_info->left_star = star;
new_info->left_count = 0;
if (old_info != NULL)
if (old_info != NULL)
old_info->right_count = &(new_info->left_count);
}
else if (old_info != NULL)
else if (old_info != NULL)
old_info->right_count = NULL;
if (old_info != NULL) {
@ -608,7 +608,7 @@ CreateResourceNameForm(Widget parent, WNode *node)
old_info->right_star = star;
XtAddCallback(any, XtNcallback, AnyChosen, (XtPointer) old_info);
XtAddCallback(any, XtNdestroyCallback,
XtAddCallback(any, XtNdestroyCallback,
FreeClientData, (XtPointer) old_info);
}
@ -621,7 +621,7 @@ CreateResourceNameForm(Widget parent, WNode *node)
XtSetArg(args[num_args], XtNfromHoriz, dot); num_args++;
XtSetArg(args[num_args], XtNlabel, names[i]); num_args++;
XtSetArg(args[num_args], XtNradioData, names[i]); num_args++;
name = XtCreateManagedWidget("name", toggleWidgetClass,
name = XtCreateManagedWidget("name", toggleWidgetClass,
form, args, num_args);
XtAddCallback(name,XtNcallback,
ActivateWidgetsAndSetResourceString,(XtPointer) node);
@ -632,7 +632,7 @@ CreateResourceNameForm(Widget parent, WNode *node)
XtSetArg(args[num_args], XtNlabel, classes[i]); num_args++;
XtSetArg(args[num_args], XtNradioGroup, name); num_args++;
XtSetArg(args[num_args], XtNradioData, classes[i]); num_args++;
class = XtCreateManagedWidget("class", toggleWidgetClass,
class = XtCreateManagedWidget("class", toggleWidgetClass,
form,args,num_args);
XtAddCallback(class, XtNcallback,
ActivateWidgetsAndSetResourceString,(XtPointer) node);
@ -642,7 +642,7 @@ CreateResourceNameForm(Widget parent, WNode *node)
XtSetArg(args[num_args], XtNfromVert, class); num_args++;
XtSetArg(args[num_args], XtNradioData, "?"); num_args++;
XtSetArg(args[num_args], XtNradioGroup, name); num_args++;
single = XtCreateManagedWidget("single", toggleWidgetClass,
single = XtCreateManagedWidget("single", toggleWidgetClass,
form, args, num_args);
XtAddCallback(single,XtNcallback,
ActivateWidgetsAndSetResourceString,(XtPointer) node);
@ -652,7 +652,7 @@ CreateResourceNameForm(Widget parent, WNode *node)
XtSetArg(args[num_args], XtNfromVert, single); num_args++;
XtSetArg(args[num_args], XtNradioGroup, name); num_args++;
XtSetArg(args[num_args], XtNradioData, ANY_RADIO_DATA); num_args++;
any = XtCreateManagedWidget("any", toggleWidgetClass,
any = XtCreateManagedWidget("any", toggleWidgetClass,
form, args, num_args);
name_info->name_leader = name;
@ -703,7 +703,7 @@ SetToggleGroupLeaders(WNode *node)
* name and class of this object.
* Returns: none.
*/
static void
MakeBoxLookNice(Widget dot, Widget star, Widget any, Widget single,
Widget name, Widget class, int endbox)
@ -736,7 +736,7 @@ MakeBoxLookNice(Widget dot, Widget star, Widget any, Widget single,
XtSetArg(args[num_args], XtNhorizDistance, &(h_dist[2])); num_args++;
XtSetArg(args[num_args], XtNwidth, &any_width); num_args++;
XtGetValues(any, args, num_args);
dot_star_width = (width_1 > width_2) ? width_1 : width_2;
for (i = 1 ; i < MAX_HDIST; i++) {
if (h_dist[i] > h_dist[0]) h_dist[0] = h_dist[i];
@ -745,11 +745,11 @@ MakeBoxLookNice(Widget dot, Widget star, Widget any, Widget single,
num_args = 0;
XtSetArg(args[num_args], XtNhorizDistance, h_dist[0]); num_args++;
XtSetValues(any, args, num_args);
/*
* Add a new arg, and continue...
*/
XtSetArg(args[num_args], XtNwidth, dot_star_width); num_args++;
XtSetArg(args[num_args], XtNwidth, dot_star_width); num_args++;
XtSetValues(star, args, num_args);
XtSetValues(dot, args, num_args);
@ -793,20 +793,20 @@ MakeBoxLookNice(Widget dot, Widget star, Widget any, Widget single,
}
XtSetArg(args[num_args], XtNwidth, any_width); num_args++;
XtSetValues(any, args, num_args);
XtSetValues(any, args, num_args);
num_args = 0;
XtSetArg(args[num_args], XtNwidth, name_class_width); num_args++;
XtSetArg(args[num_args], XtNhorizDistance, h_dist[0]); num_args++;
XtSetValues(name, args, num_args);
XtSetValues(class, args, num_args);
XtSetValues(single, args, num_args);
XtSetValues(name, args, num_args);
XtSetValues(class, args, num_args);
XtSetValues(single, args, num_args);
}
/* Function Name: CreateLists
* Description: Creates the list widgets for the normal and constraint
* Description: Creates the list widgets for the normal and constraint
* resources
* Arguments: parent - parent of the lists.
* node - The widget node containing this res box.
@ -824,9 +824,9 @@ CreateLists(Widget parent, WNode *node, char **names, char **cons_names)
ResourceBoxInfo * res_box = node->resources->res_box;
Arg args[3];
(void) XtCreateManagedWidget("namesLabel", labelWidgetClass,
(void) XtCreateManagedWidget("namesLabel", labelWidgetClass,
parent, NULL, ZERO);
num_args = 0;
/* if the first list item is the widget name we want an empty
* list.
@ -839,30 +839,30 @@ CreateLists(Widget parent, WNode *node, char **names, char **cons_names)
else { XtSetArg(args[num_args], XtNlist, names); num_args++; }
viewport = XtCreateManagedWidget("normalViewport", viewportWidgetClass,
parent, NULL, 0);
res_box->norm_list = XtCreateManagedWidget("namesList", listWidgetClass,
res_box->norm_list = XtCreateManagedWidget("namesList", listWidgetClass,
viewport, args, num_args);
XtAddCallback(res_box->norm_list, XtNcallback,
XtAddCallback(res_box->norm_list, XtNcallback,
ResourceListCallback, (XtPointer) node);
XtAddCallback(res_box->norm_list, XtNdestroyCallback,
XtAddCallback(res_box->norm_list, XtNdestroyCallback,
FreeClientData, (XtPointer) names);
if (cons_names != NULL) {
(void) XtCreateManagedWidget("constraintLabel", labelWidgetClass,
(void) XtCreateManagedWidget("constraintLabel", labelWidgetClass,
parent, NULL, ZERO);
num_args = 0;
XtSetArg(args[num_args], XtNlist, cons_names); num_args++;
XtSetArg(args[num_args], XtNlist, cons_names); num_args++;
viewport = XtCreateManagedWidget("constraintViewport", viewportWidgetClass,
parent, NULL, 0);
res_box->cons_list = XtCreateManagedWidget("constraintList",
listWidgetClass,
res_box->cons_list = XtCreateManagedWidget("constraintList",
listWidgetClass,
viewport, args, num_args);
XtAddCallback(res_box->cons_list, XtNcallback,
XtAddCallback(res_box->cons_list, XtNcallback,
ResourceListCallback, (XtPointer) node);
XtAddCallback(res_box->cons_list, XtNdestroyCallback,
XtAddCallback(res_box->cons_list, XtNdestroyCallback,
FreeClientData, (XtPointer) cons_names);
}
else
else
res_box->cons_list = NULL;
}
@ -880,7 +880,7 @@ CreateValueWidget(Widget parent, WNode *node)
Cardinal num_args;
Arg args[10];
ResourceBoxInfo * res_box = node->resources->res_box;
form = XtCreateManagedWidget("valueForm", formWidgetClass,
parent, NULL, ZERO);
@ -889,7 +889,7 @@ CreateValueWidget(Widget parent, WNode *node)
XtSetArg(args[num_args], XtNright, XawChainLeft); num_args++;
XtSetArg(args[num_args], XtNtop, XawChainTop); num_args++;
XtSetArg(args[num_args], XtNbottom, XawChainBottom); num_args++;
label = XtCreateManagedWidget("valueLabel", labelWidgetClass,
label = XtCreateManagedWidget("valueLabel", labelWidgetClass,
form, args, num_args);
num_args = 0;
@ -898,8 +898,8 @@ CreateValueWidget(Widget parent, WNode *node)
XtSetArg(args[num_args], XtNright, XawChainRight); num_args++;
XtSetArg(args[num_args], XtNtop, XawChainTop); num_args++;
XtSetArg(args[num_args], XtNbottom, XawChainBottom); num_args++;
res_box->value_wid = XtCreateManagedWidget("valueText",
asciiTextWidgetClass,
res_box->value_wid = XtCreateManagedWidget("valueText",
asciiTextWidgetClass,
form, args, num_args);
#ifdef notdef
XtAddCallback(XawTextGetSource(res_box->value_wid), XtNcallback,
@ -929,10 +929,10 @@ PopupOnNode(WNode *node, Widget shell)
XtSetArg(args[num_args], XtNheight, &height); num_args++;
XtSetArg(args[num_args], XtNborderWidth, &bw); num_args++;
XtGetValues(node->widget, args, num_args);
XtTranslateCoords(node->widget,
XtTranslateCoords(node->widget,
(Position) (width/2 + bw), (Position) (height/2 + bw),
&x, &y);
XtOverrideTranslations
(shell, XtParseTranslationTable ("<Message>WM_PROTOCOLS: quit()"));
XtRealizeWidget(shell);
@ -954,7 +954,7 @@ PopupOnNode(WNode *node, Widget shell)
max_loc = HeightOfScreen(XtScreen(shell)) - (Position) (height + 2 * bw);
if (y > max_loc)
y = max_loc;
if (y < 0)
if (y < 0)
y = 0;
num_args = 0;
@ -1000,7 +1000,7 @@ FreeResBox(Widget w, XtPointer ptr, XtPointer junk)
NameInfo *old_name, *name = node->resources->res_box->name_info;
global_resource_box_up = FALSE;
XtFree((XtPointer) node->resources->res_box);
node->resources->res_box = NULL;
@ -1008,8 +1008,8 @@ FreeResBox(Widget w, XtPointer ptr, XtPointer junk)
old_name = name;
name = name->next;
XtFree((XtPointer) old_name);
}
}
}

View File

@ -30,7 +30,7 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xaw/Cardinals.h>
#include <X11/Xaw/Toggle.h>
#include <X11/Xaw/Viewport.h>
#include <X11/Xaw/Viewport.h>
#include <X11/Xaw/Tree.h>
#include "editresP.h"
@ -38,9 +38,9 @@ in this Software without prior written authorization from The Open Group.
static void AddNodeToActiveList ( WNode * node );
static void RemoveNodeFromActiveList ( WNode * node );
static Boolean IsActiveNode ( WNode * node );
static void AddNode ( WNode ** top_node, WidgetTreeInfo * info,
static void AddNode ( WNode ** top_node, WidgetTreeInfo * info,
TreeInfo * tree_info );
static void FillNode ( WidgetTreeInfo * info, WNode * node,
static void FillNode ( WidgetTreeInfo * info, WNode * node,
TreeInfo * tree_info );
static void AddChild ( WNode * parent, WNode * child );
static WNode ** CopyActiveNodes ( TreeInfo * tree_info );
@ -84,7 +84,7 @@ BuildVisualTree(Widget tree_parent, Event *event)
XtManageChild(global_tree_info->tree_widget);
sprintf(msg, res_labels[11], top->name, top->class);
snprintf(msg, sizeof(msg), res_labels[11], top->name, top->class);
SetMessage(global_screen_data.info_label, msg);
}
@ -100,15 +100,15 @@ BuildVisualTree(Widget tree_parent, Event *event)
void
AddTreeNode(Widget tree, WNode *top)
{
int i;
Cardinal i;
Arg args[1];
Cardinal num_args = 0;
char msg[BUFSIZ];
if (top->parent != NULL) {
if (top->parent->widget == NULL) {
sprintf( msg, res_labels[28],
top->name, top->parent->name, "not been created yet");
snprintf(msg, sizeof(msg), res_labels[28],
top->name, top->parent->name, "not been created yet");
SetMessage(global_screen_data.info_label, msg);
}
XtSetArg(args[num_args], XtNtreeParent, top->parent->widget);
@ -118,15 +118,15 @@ AddTreeNode(Widget tree, WNode *top)
top->widget = XtCreateManagedWidget(top->name, toggleWidgetClass, tree,
args, num_args);
if (XSaveContext(XtDisplay(top->widget), (Window) top->widget,
if (XSaveContext(XtDisplay(top->widget), (Window) top->widget,
NODE_INFO, (XPointer) top) != 0) {
sprintf( msg, res_labels[29], top->name);
snprintf(msg, sizeof(msg), res_labels[29], top->name);
SetMessage(global_screen_data.info_label, msg);
}
}
XtAddCallback(top->widget, XtNcallback, TreeToggle, (XtPointer) top);
for (i = 0; i < top->num_children; i++)
for (i = 0; i < top->num_children; i++)
AddTreeNode(tree, top->children[i]);
}
@ -145,7 +145,7 @@ TreeToggle(Widget w, XtPointer node_ptr, XtPointer state_ptr)
Boolean state = (Boolean)(long) state_ptr;
WNode * node = (WNode *) node_ptr;
if (state)
if (state)
AddNodeToActiveList(node);
else
RemoveNodeFromActiveList(node);
@ -168,7 +168,7 @@ AddNodeToActiveList(WNode *node)
if (info->num_nodes >= info->alloc_nodes) {
info->alloc_nodes += NUM_INC;
info->active_nodes =(WNode **)XtRealloc((XtPointer) info->active_nodes,
sizeof(WNode *) *
sizeof(WNode *) *
info->alloc_nodes);
}
@ -186,7 +186,7 @@ RemoveNodeFromActiveList(WNode *node)
{
TreeInfo * info = node->tree_info;
Boolean found_node = FALSE;
int i;
Cardinal i;
if (!IsActiveNode(node)) /* This node is not active. */
return;
@ -194,7 +194,7 @@ RemoveNodeFromActiveList(WNode *node)
for (i = 0; i < info->num_nodes; i++) {
if (found_node)
info->active_nodes[i - 1] = info->active_nodes[i];
else if (info->active_nodes[i] == node)
else if (info->active_nodes[i] == node)
found_node = TRUE;
}
@ -211,26 +211,26 @@ static Boolean
IsActiveNode(WNode *node)
{
TreeInfo * info = node->tree_info;
int i;
Cardinal i;
for (i = 0; i < info->num_nodes; i++)
for (i = 0; i < info->num_nodes; i++)
if (info->active_nodes[i] == node)
return(TRUE);
return(FALSE);
}
/* Function Name: CreateTree
* Description: Creates a widget tree give a list of names and classes.
* Arguments: event - the information from the client.
* Returns: The tree_info about this new tree.
*/
TreeInfo *
CreateTree(Event *event)
{
SendWidgetTreeEvent * send_event = (SendWidgetTreeEvent *) event;
int i;
unsigned short i;
TreeInfo * tree_info;
@ -243,7 +243,7 @@ CreateTree(Event *event)
tree_info->flash_widgets = NULL;
tree_info->num_flash_widgets = tree_info->alloc_flash_widgets = 0;
for ( i = 0; i < (int)send_event->num_entries; i++)
for ( i = 0; i < send_event->num_entries; i++)
AddNode(&(tree_info->top_node), (send_event->info + i), tree_info);
return(tree_info);
@ -258,16 +258,16 @@ CreateTree(Event *event)
void
PrintNodes(WNode *top)
{
int i;
Cardinal i;
if (top->parent == NULL)
printf("Top of Tree, Name: %10s, ID: %10ld, Class: %10s\n",
if (top->parent == NULL)
printf("Top of Tree, Name: %10s, ID: %10ld, Class: %10s\n",
top->name, top->id, top->class);
else
printf("Parent %10s, Name: %10s, ID: %10ld, Class: %10s\n",
printf("Parent %10s, Name: %10s, ID: %10ld, Class: %10s\n",
top->parent->name, top->name, top->id, top->class);
for (i = 0; i < top->num_children; i++)
for (i = 0; i < top->num_children; i++)
PrintNodes(top->children[i]);
}
@ -291,9 +291,9 @@ _TreeRelabel(TreeInfo *tree_info, LabelTypes type)
top = tree_info->top_node;
PrepareToLayoutTree(tree_info->tree_widget);
PrepareToLayoutTree(tree_info->tree_widget);
_TreeRelabelNode(top, type, TRUE);
LayoutTree(tree_info->tree_widget);
LayoutTree(tree_info->tree_widget);
}
/* Function Name: _TreeSelect
@ -309,7 +309,7 @@ _TreeSelect(TreeInfo *tree_info, SelectTypes type)
{
WNode ** active_nodes;
Cardinal num_active_nodes;
int i;
Cardinal i;
if (tree_info == NULL) {
SetMessage(global_screen_data.info_label,
@ -353,7 +353,7 @@ _TreeSelect(TreeInfo *tree_info, SelectTypes type)
void
_TreeSelectNode(WNode *node, SelectTypes type, Boolean recurse)
{
int i;
Cardinal i;
Arg args[1];
Boolean state;
@ -367,7 +367,7 @@ _TreeSelectNode(WNode *node, SelectTypes type, Boolean recurse)
case SelectInvert:
XtSetArg(args[0], XtNstate, &state);
XtGetValues(node->widget, args, ONE);
state = !state;
break;
default:
@ -383,7 +383,7 @@ _TreeSelectNode(WNode *node, SelectTypes type, Boolean recurse)
if (!recurse)
return;
for (i = 0; i < node->num_children; i++)
for (i = 0; i < node->num_children; i++)
_TreeSelectNode(node->children[i], type, recurse);
}
@ -398,7 +398,7 @@ _TreeSelectNode(WNode *node, SelectTypes type, Boolean recurse)
void
_TreeRelabelNode(WNode *node, LabelTypes type, Boolean recurse)
{
int i;
Cardinal i;
Arg args[1];
char buf[30];
char *label;
@ -411,17 +411,17 @@ _TreeRelabelNode(WNode *node, LabelTypes type, Boolean recurse)
XtSetArg(args[0], XtNlabel, node->name);
break;
case IDLabel:
sprintf(buf, "id: 0x%lx", node->id);
snprintf(buf, sizeof(buf), "id: 0x%lx", node->id);
XtSetArg(args[0], XtNlabel, buf);
break;
case WindowLabel:
if (node->window == EDITRES_IS_UNREALIZED)
if (node->window == EDITRES_IS_UNREALIZED)
strcpy(buf, "unrealized widget");
else if (node->window == EDITRES_IS_OBJECT)
strcpy(buf, "non windowed object");
else if (node->window == EDITRES_IS_OBJECT)
strcpy(buf, "non windowed object");
else
sprintf(buf, "win: 0x%lx", node->window);
snprintf(buf, sizeof(buf), "win: 0x%lx", node->window);
XtSetArg(args[0], XtNlabel, buf);
break;
case ToggleLabel:
@ -443,7 +443,7 @@ _TreeRelabelNode(WNode *node, LabelTypes type, Boolean recurse)
if (!recurse)
return;
for (i = 0; i < node->num_children; i++)
for (i = 0; i < node->num_children; i++)
_TreeRelabelNode(node->children[i], type, recurse);
}
@ -459,7 +459,7 @@ void
_TreeActivateNode(WNode* node, SelectTypes type)
{
Arg args[1];
int i;
Cardinal i;
XtSetArg(args[0], XtNstate, TRUE);
@ -468,13 +468,13 @@ _TreeActivateNode(WNode* node, SelectTypes type)
if (node == NULL)
return;
XtSetValues(node->widget, args, ONE);
XtSetValues(node->widget, args, ONE);
AddNodeToActiveList(node);
if (type == SelectAncestors)
_TreeActivateNode(node, type);
_TreeActivateNode(node, type);
}
else if ((type == SelectChildren) || (type == SelectDescendants))
else if ((type == SelectChildren) || (type == SelectDescendants))
for (i = 0; i < node->num_children; i++) {
AddNodeToActiveList(node->children[i]);
XtSetValues(node->children[i]->widget, args, ONE);
@ -483,12 +483,12 @@ _TreeActivateNode(WNode* node, SelectTypes type)
}
else
SetMessage(global_screen_data.info_label,
res_labels[33]);
res_labels[33]);
}
/************************************************************
*
* Non - Exported Functions.
* Non - Exported Functions.
*
************************************************************/
@ -525,7 +525,7 @@ AddNode(WNode **top_node, WidgetTreeInfo *info, TreeInfo *tree_info)
AddChild(parent, node);
if (early_break)
if (early_break)
break;
}
@ -571,7 +571,7 @@ AddChild(WNode *parent, WNode *child)
{
if (parent->num_children >= parent->alloc_children) {
parent->alloc_children += NUM_INC;
parent->children = (WNode **) XtRealloc((char *)parent->children,
parent->children = (WNode **) XtRealloc((char *)parent->children,
sizeof(WNode *) * parent->alloc_children);
}
@ -584,20 +584,20 @@ AddChild(WNode *parent, WNode *child)
/************************************************************
*
* Functions that operate of the current tree.
*
*
************************************************************/
/* Function Name: CopyActiveNodes
* Description: returns a copy of the currently selected nodes.
* Arguments: tree_info - the tree info struct.
* Returns: a copy of the selected nodes.
*/
static WNode **
static WNode **
CopyActiveNodes(TreeInfo *tree_info)
{
WNode ** list;
int i;
Cardinal i;
if ( (tree_info == NULL) || (tree_info->num_nodes == 0))
return(NULL);
@ -654,19 +654,19 @@ SetAndCenterTreeNode(WNode *node)
* reset the node x and y location to be the new x and y location of
* the tree relative to the porthole.
*/
node_x = port_width/2 - (node_x + node_width/2 + node_bw);
node_y = port_height/2 - (node_y + node_height/2 + node_bw);
num_args = 0;
XtSetArg(args[num_args], XtNx, node_x); num_args++;
XtSetArg(args[num_args], XtNy, node_y); num_args++;
XtSetValues(node->tree_info->tree_widget, args, num_args);
XtSetValues(node->tree_info->tree_widget, args, num_args);
}
/* Function Name: PerformTreeToFileDump
* Description: Dumps the contents of the current widget tree to
* the file specified.
* the file specified.
* Arguments: node - node to dump.
* num_tabs - number of spaces to indent.
* fp - pointer to the file to write to.
@ -674,11 +674,11 @@ SetAndCenterTreeNode(WNode *node)
*/
void
PerformTreeToFileDump(WNode *node, int num_tabs, FILE *fp)
PerformTreeToFileDump(WNode *node, Cardinal num_tabs, FILE *fp)
{
int i;
Cardinal i;
for (i = 0; i < num_tabs; i++)
for (i = 0; i < num_tabs; i++)
fprintf(fp, "\t");
fprintf(fp, "%s %s\n", node->class, node->name);