/*
*
* (c) Copyright 1992-1994 Adobe Systems Incorporated.
* All rights reserved.
*
* Permission to use, copy, modify, distribute, and sublicense this software
* and its documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notices appear in all copies and that
* both those copyright notices and this permission notice appear in
* supporting documentation and that the name of Adobe Systems Incorporated
* not be used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission. No trademark license
* to use the Adobe trademarks is hereby granted. If the Adobe trademark
* "Display PostScript"(tm) is used to describe this software, its
* functionality or for any other purpose, such use shall be limited to a
* statement that this software works in conjunction with the Display
* PostScript system. Proper trademark attribution to reflect Adobe's
* ownership of the trademark shall be given whenever any such reference to
* the Display PostScript system is made.
*
* ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR
* ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
* ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE
* TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT
* PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE.
*
* Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems
* Incorporated which may be registered in certain jurisdictions
*
* Author: Adobe Systems Incorporated
*/
/* $XFree86$ */
#include <stdio.h>
#include <ctype.h>
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
/* There are no words to describe how I feel about having to do this */
#if XmVersion > 1001
#include <Xm/ManagerP.h>
#else
#endif
#include <Xm/DrawingA.h>
#include <Xm/MessageB.h>
#include <Xm/SeparatoG.h>
#include <Xm/ToggleBG.h>
#include <Xm/RowColumn.h>
#include <DPS/dpsXclient.h>
#include <DPS/dpsXshare.h>
#include <DPS/FontCreatP.h>
#include <stdlib.h>
#include <math.h>
#include "FontSBI.h"
#include "FSBwraps.h"
/* Turn a string into a compound string */
static float defaultSizeList[] = {
#ifndef CREATOR_DEFAULT_SIZE_LIST
8, 10, 12, 14, 16, 18, 24, 36, 48, 72
#else
#endif /* CREATOR_DEFAULT_SIZE_LIST */
};
#ifndef CREATOR_DEFAULT_SIZE_LIST_COUNT
#endif /* CREATOR_DEFAULT_SIZE_LIST_COUNT */
};
/* Forward declarations */
static XtGeometryResult GeometryManager(Widget w, XtWidgetGeometry *desired, XtWidgetGeometry *allowed);
static void ChangeManaged(Widget w);
static void ClassInitialize(void);
/* Core class part */
{
/* class_name */ "FontCreator",
/* widget_size */ sizeof(FontCreatorRec),
/* class_initialize */ ClassInitialize,
/* class_part_initialize */ NULL,
/* class_inited */ FALSE,
/* initialize */ Initialize,
/* initialize_hook */ NULL,
/* realize */ XtInheritRealize,
/* actions */ NULL,
/* num_actions */ 0,
/* resources */ resources,
/* xrm_class */ NULLQUARK,
/* compress_motion */ TRUE,
/* compress_exposure */ XtExposeCompressMultiple,
/* compress_enterleave */ TRUE,
/* visible_interest */ FALSE,
/* destroy */ Destroy,
/* resize */ Resize,
/* expose */ NULL,
/* set_values */ SetValues,
/* set_values_hook */ NULL,
/* set_values_almost */ XtInheritSetValuesAlmost,
/* get_values_hook */ NULL,
/* accept_focus */ NULL,
/* version */ XtVersion,
/* callback offsets */ NULL,
/* tm_table */ NULL,
/* query_geometry */ XtInheritQueryGeometry,
/* display_accelerator */ NULL,
/* extension */ NULL,
},
/* Composite class part */
{
/* geometry_manager */ GeometryManager,
/* change_managed */ ChangeManaged,
/* insert_child */ XtInheritInsertChild,
/* delete_child */ XtInheritDeleteChild,
/* extension */ NULL,
},
/* Constraint class part */
{
/* resources */ NULL,
/* num_resources */ 0,
/* constraint_size */ 0,
/* initialize */ NULL,
/* destroy */ NULL,
/* set_values */ NULL,
/* extension */ NULL,
},
/* Manager class part */
{
/* translations */ XtInheritTranslations,
/* syn_resources */ NULL,
/* num_syn_resources */ 0,
/* syn_constraint_resources */ NULL,
/* num_syn_constraint_resources */ 0,
/* parent_process */ XmInheritParentProcess,
/* extension */ NULL,
},
/* FontCreator class part */
{
/* extension */ NULL,
}
};
static void ClassInitialize(void)
{
}
/* ARGSUSED */
static void ResizePreview(
{
(XDPSStandardColormap *) NULL,
(XDPSStandardColormap *) NULL,
}
{
int i, j;
float p[MAX_AXES];
float b[MAX_BLENDS];
int val;
float size;
char *chSize;
float total;
int bogusFont;
}
/* Force b[0] to be 1 - total(b[1..n]) to avoid round-off error */
total = 0.0;
b[i] = 1.0;
else b[i] *= 1.0 - p[j];
}
total += b[i];
}
b[0] = 1.0 - total;
}
/* ARGSUSED */
static void DrawMMCallback(
{
}
/* ARGSUSED */
static void ExposeCallback(
{
CWBitGravity, &att);
}
}
{
int count, i;
BlendRec *b;
NULL);
if (f->blend_count == 0) {
count = 1;
} else {
count = f->blend_count;
i++, b = b->next) {
CSblends[i] = b->CS_blend_name;
}
}
}
{
int i, j;
carry_values[i] = -1;
carry_values+i);
break;
}
}
}
}
{
int i;
char *value;
}
}
}
}
}
}
{
int i, j;
int diff;
if (diff == 0) return;
if (diff < 0) {
}
} else {
i++, j+=5) {
}
}
}
{
int val;
int i, axes;
for (i = 0; i < axes; i++) {
}
}
{
ManageAxes(fc);
}
/* ARGSUSED */
static void FaceSelect(
{
int i;
i = 0;
while (f != NULL) {
if (f->blend_data != NULL) i++;
if (i == listCB->item_position) break;
f = f->next;
}
if (f == NULL) return;
return;
}
f->in_font_creator = True;
}
{
BlendRec *b;
int i;
int value;
/* List uses 1-based addressing!! */
for (i = 1; i < n; i++) b = b->next;
}
}
/* ARGSUSED */
static void BlendSelect(
{
}
/* ARGSUSED */
static void SetValue(
{
}
/* ARGSUSED */
static void SetScale(
{
char *value;
/* Handle range and illegal characters this way...*/
}
/* ARGSUSED */
static void DeleteMessage(
{
}
{
XtUnmanageChild(w);
XtUnmanageChild(w);
}
{
}
{
}
{
}
{
}
{
char *spaceName;
}
}
f->blend_count++;
}
return False;
}
/* ARGSUSED */
static void AddCallback(
{
char *value;
FontRec *f;
int i;
return;
}
if (f->blend_data != NULL &&
}
}
}
}
{
BlendRec *b;
if (name == b->blend_name) {
}
}
return False;
}
}
return True;
}
/* ARGSUSED */
static void ReplaceCallback(
{
char *value;
FontRec *f;
int i;
return;
}
if (f->blend_data != NULL &&
}
}
}
}
{
if (name == b->blend_name) {
}
f->blend_count--;
return False;
}
}
return True;
}
/* ARGSUSED */
static void DeleteCallback(
{
char *value;
FontRec *f;
return;
}
if (f->blend_data != NULL) {
}
}
}
/* ARGSUSED */
static void UnmanageOptions(
{
}
/* ARGSUSED */
static void ShowOptions(
{
}
/* ARGSUSED */
static void GenerateCallback(
{
char *ch;
}
}
}
/* ARGSUSED */
static void DismissCallback(
{
}
/* ARGSUSED */
static void SizeChanged(
{
int size;
int i;
/* See if we have an optical size scale */
bd = f->blend_data;
}
return;
}
}
/* There's a problem; sometimes the change has already been made in the field,
and sometimes it hasn't. The times when it has seem to correspond to
making changes with the size option menu, so we use this disgusting
global flag to notice when this happens. We also use this to tell whether
or not the change is coming from internal to the widget or as a result
of user interaction. */
/* ARGSUSED */
static void SizeSelect(
{
char *ch;
else {
}
}
/* ARGSUSED */
static void TextVerify(
{
int decimalPoints = 0;
int i;
if (changingSize) return; /* We know what we're doing; allow it */
/* Should probably look at format field, but seems to contain garbage */
return;
}
}
if (decimalPoints > 1) {
return;
}
}
}
/* ARGSUSED */
static void SetSize(
{
char *ch;
changingSize = True;
}
/* This makes sure the selected item is visible */
{
}
static void CreateSizeMenu(
{
int i, j;
char *ch;
if (destroyOldChildren) {
/* Don't destroy first child ("other") */
sizeof(Widget));
} else {
sizeof(Widget));
i = 0;
}
i = 0;
sizes[j+1] =
}
}
{
int i, j;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
for (j = 0; j < 4; j++) {
i = 0;
i = 0;
i = 0;
i = 0;
i = 0;
}
/* Create the options box so we have the toggles */
XtCreateManagedWidget("followSizeToggle",
}
/* ARGSUSED */
static void Initialize(
{
/* Must have a fsb */
"initializeFontCreator", "noFontSelectionBox",
"FontSelectionBoxError",
"No font selection box given to font creator",
}
/* Verify size list */
"initializeFontCreator", "sizeMismatch",
"FontSelectionBoxError",
"Size count specified but no sizes present",
}
"initializeFontCreator", "negativeSize",
"FontSelectionBoxError",
"Size count should not be negative",
}
}
{
int i, cur = 0;
BlendRec *b;
&selectList, &selectCount)) return;
cur = *selectList;
} else {
if (b == cur_b) {
cur = i+1;
break;
}
}
}
}
{
if (f->blend_data == NULL) continue;
count++;
newf = f;
}
}
} else {
if (f->blend_data == NULL) continue;
count++;
newf = f;
break;
}
}
}
} else {
}
}
{
}
}
{
}
/* ARGSUSED */
{
"setValuesFontCreator", "sizeMismatch",
"FontSelectionBoxError",
"Size count specified but no sizes present",
}
"setValuesFontCreator", "negativeSize",
"FontSelectionBoxError",
"Size count should not be negative",
}
return False;
}
/* ARGSUSED */
Widget w,
{
if (WANTS(CWBorderWidth)) {
}
return XtGeometryYes;
}
{
}