home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
x
/
xtici.zip
/
xtici
/
layout.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-08-28
|
7KB
|
208 lines
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
* This file is a component of an X Window System client which uses the Xcms
* Color Management System. TekColor is a trademark of Tektronix, Inc. The
* TekColor Editor is the subject of U.S. and foreign patents pending. The
* term "TekHVC" designates a particular color space that is the subject of
* U.S. Patent No. 4,985,853 (equivalent foreign patents pending).
* Permission is hereby granted to use, copy, modify, sell, and otherwise
* distribute this software and its documentation for the X Window System
* environment, for any purpose and without fee, provided that:
*
* 1. The code and documentation are only used to implement a
* TekColor Editor in an X Window System environment; and
* 2. This copyright and permission notice is reproduced in all copies
* of the code and in supporting documentation.
*
* Permission is granted to modify this code as required to allow it to
* be compiled on any host computer, provided that the functionality of
* the TekColor Editor is not modified in any way. A description of any
* modifications must be sent to Tektronix, Inc. Contact
* Tektronix Inc., P.O. Box 1000, Mail Station 60-850,
* Network Displays Division Engineering, Wilsonville, OR 97070.
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF
* CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE.
*
* NAME
* layout - create the overall layout of the interface
*
* DESCRIPTION
* Create and position top levels of the interface.
* Other creation routines within packages deal with lower
* level pieces, such as the hue bar and leaf,
* auxiliary window, etc.
*/
#ifndef LINT
static char *copy_notice = "Copyright 1991 Tektronix, Inc.";
#ifdef RCS_ID
static char *rcsid= "$Header: layout.c,v 1.2 91/08/22 11:33:46 adamsc Exp $";
#endif /* RCS_ID */
#endif /* LINT */
/*
* EXTERNAL INCLUDES
*/
/*
* INTERNAL INCLUDES
*/
#include "xtici.h"
#include <X11/Intrinsic.h>
#include <X11/Xaw/Form.h>
#include <X11/Xaw/Text.h> /* has XtNwrap definition */
#include "widgets/VShellP.h"
#include "widgets/ColorS.h"
/*
* EXTERNS
*/
extern char *exeName;
/*
* GLOBALS
*/
#ifdef DEC
# define GLOBAL global
#else
# define GLOBAL
#endif
GLOBAL Widget primary;
/* interface widget children */
GLOBAL Widget menubar, colormap, huebar, leaf, patch, hvcShow,uvyShow,rgbShow;
/*
* LOCAL DEFINES
*/
/*
* LOCAL TYPEDEFS
*/
/*
* LOCALS VARIABLES
*/
#ifdef DEBUG
# define STATIC
#else
# define STATIC static
#endif
STATIC Arg mapArgs[] = {
{XtNmaximum, 255},
{XtNzoom, 32},
{XtNwidth, 185},
{XtNlabel, (XtArgVal)"Colormap\nScale"},
};
STATIC Arg hueArgs[] = {
{XtNbase, 0},
{XtNlength, 1},
{XtNlabel, (XtArgVal)"HUE"},
{XtNmaximum, 3599},
{XtNincrement, 10},
{XtNwrap, True},
{XtNwidth, 95},
};
/************************************************************************
* *
* PRIVATE ROUTINES *
* *
************************************************************************/
STATIC void CreateIfWindow(parent)
Widget parent;
{
#define WidgetCt 6
Widget CreateLeafForm(), CreatePatch(), CreateShowWidgets();
Widget CreateHueForm();
void ChangedIndex(); /* callback */
Widget wlist[WidgetCt];
Pixel back;
Arg barg;
mapArgs[0].value = (XtArgVal)(mapSize - 1);
/* shows 32 colors in the zoom bar */
mapArgs[1].value = (XtArgVal)(mapSize / 32);
colormap = XtCreateManagedWidget("scale", colorScaleWidgetClass, parent,
mapArgs, XtNumber(mapArgs));
XtAddCallback(colormap, XtNvalueChangedCallback, ChangedIndex,
(XtPointer)ColormapWidget);
wlist[ColormapWidget] = colormap;
/* set real widget attachment values */
wlist[ShowWidget] = CreateShowWidgets(parent);
wlist[PatchWidget] = patch = CreatePatch(parent);
/* If huebar starts empty set the base to the background of the widget */
if (huebarState == HuebarEmpty) {
XtSetArg(barg, XtNbackground, &back);
XtGetValues(parent, &barg, 1);
hueArgs[0].value = (XtArgVal)back;
} else /* if (huebarState == HuebarConstant) */ {
HuebarRangeSave();
HuebarRangeLoad((Pixel *)&hueArgs[0].value, (int *)&hueArgs[1].value);
}
wlist[HuebarWidget] = huebar = CreateHueForm(parent, "huebar",
hueArgs, XtNumber(hueArgs));
wlist[LeafWidget] = leaf = CreateLeafForm(parent, "leaf");
}
/************************************************************************
* *
* PUBLIC ROUTINES *
* *
************************************************************************/
Widget LayoutWidgets()
{
Arg shellArgs[15];
Widget CreateMenuBar();
Widget toplevel;
int argCt = 0;
/* Create a shell widget and its main window child */
XtSetArg(shellArgs[argCt], XtNcolormap, cmap); argCt++;
XtSetArg(shellArgs[argCt], XtNdepth, visInfo.depth); argCt++;
XtSetArg(shellArgs[argCt], XtNvisual, visInfo.visual); argCt++;
XtSetArg(shellArgs[argCt], XtNtitle, "TekColor Editor"); argCt++;
XtSetArg(shellArgs[argCt], XtNiconPixmap, MakeIcon()); argCt++;
XtSetArg(shellArgs[argCt], XtNiconName, exeName); argCt++;
/**********************************************************************
* I know you expect the user to be able to set all this
* But no inorder to maintain the aspect ratio of the widgets
* and the minimum size so there is no overlap I will not allow you
* to reset these resources.
**********************************************************************/
XtSetArg(shellArgs[argCt], XtNwidth, 560); argCt++;
XtSetArg(shellArgs[argCt], XtNheight, 450); argCt++;
toplevel = XtAppCreateShell(exeName, "TekHVC", visualShellWidgetClass,
dpy, shellArgs, argCt);
primary = XtCreateManagedWidget("main", tekBoxWidgetClass, toplevel,
NULL, 0);
/* Create the menu bar, including all menus and dialogs */
menubar = CreateMenuBar(primary);
/* Create the working area form widget */
CreateIfWindow(primary);
return(toplevel);
}