home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 January
/
usenetsourcesnewsgroupsinfomagicjanuary1994.iso
/
sources
/
x
/
volume18
/
wclock
/
part01
/
Outline.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-07-13
|
3KB
|
102 lines
/*
* This file hacked from Weekday.c in the xdiary distribution by RJC.
*/
/*
* Original author: Jason Baietto, jason@ssd.csd.harris.com
*
* Permission to use, copy, modify, and distribute, 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
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of the copyright holder be used in
* advertising or publicity pertaining to distribution of the software with
* specific, written prior permission, and that no fee is charged for further
* distribution of this software, or any modifications thereof. The copyright
* holder makes no representations about the suitability of this software for
* any purpose. It is provided "as is" without express or implied warranty.
*
* THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, AND IN NO
* EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM ITS USE,
* LOSS OF DATA, PROFITS, QPA OR GPA, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
* THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <ctype.h>
#include <X11/StringDefs.h>
#include <X11/IntrinsicP.h>
#include "OutlineP.h"
#define MAX_STRING_LEN 256
/*==========================================================================*/
/* Quarks: */
/*==========================================================================*/
XrmQuark XtQNoOutline;
XrmQuark XtQBitmap;
XrmQuark XtQCircle;
/*==========================================================================*/
/* Outline Type Converter: */
/*==========================================================================*/
static void downcase_string(source, dest)
char * source;
char * dest;
{
for (; *source != 0; source++, dest++) {
if ( isupper(*source) )
*dest = tolower(*source);
else
*dest = *source;
}
*dest = 0;
}
/*ARGSUSED*/
void OutlineConverter(args, num_args, fromVal, toVal)
XrmValuePtr args;
Cardinal *num_args;
XrmValuePtr fromVal;
XrmValuePtr toVal;
{
static int initialized = FALSE;
static XtOutline Outline;
XrmQuark q;
char lowerName[MAX_STRING_LEN];
if (!initialized) {
/* Create quarks the first time we're called. */
XtQBitmap = XrmStringToQuark(XtNbitmap);
XtQCircle = XrmStringToQuark(XtNcircle);
XtQNoOutline = XrmStringToQuark(XtNnoOutline);
}
downcase_string((char*)fromVal->addr, lowerName);
q = XrmStringToQuark(lowerName);
toVal->size = sizeof(XtOutline);
toVal->addr = (XtPointer) &Outline;
if (q == XtQBitmap) {
Outline = Bitmap;
} else if (q == XtQCircle) {
Outline = Circle;
} else if (q == XtQNoOutline) {
Outline = NoOutline;
} else {
XtStringConversionWarning(fromVal->addr, "XtROutline");
toVal->addr = NULL;
toVal->size = 0;
}
}