/* $Id: AxisP.h,v 1.1 91/05/20 15:12:19 gnb Exp $ */
/* $Source: /export/sources/x/At/Plotter/tmp/RCS/AxisP.h,v $ */

/*

Copyright 1990,1991 by the Massachusetts Institute of Technology

All rights reserved.

Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
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 Massachusetts
Institute of Technology (M.I.T.) not be used in advertising or publicity
pertaining to distribution of the software without specific, written
prior permission.

M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
M.I.T. 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 PERFORMANCE OF THIS
SOFTWARE.

*/

/*
 * $Log:	AxisP.h,v $
 * Revision 1.1  91/05/20  15:12:19  gnb
 * Initial revision
 * 
 * 
 */

#ifndef _AxisP_h
#define _AxisP_h    

#include <X11/IntrinsicP.h>
#include <X11/ObjectP.h>

#ifdef _AtDevelopment_
#include "Text.h"
#include "Scale.h"    
#include "Axis.h"
#else
#include <At/Text.h>
#include <At/Scale.h>    
#include <At/Axis.h>
#endif    
/*
 * define an Xt Object named Axis.  It will have resources settable by
 * XtSetValues.  The plotter widget will have three instances of this object,
 * for the x, y, and y2 axes, and three others for the frame axes.
 *
 * Knowledge of axis scaling, auto scaling, numbering, grids, etc is
 * contained herein.  The parent is concerned only with min and max
 * values and pixel locations.
 */

typedef struct _AtAxisPart {
    /* resources */
    String label;
    String label_font_family;
    int label_size;
    String number_font_family;
    int number_size;
    Pixel axis_color;
    Pixel number_color;
    Pixel label_color;

    double min,max;
    short transform;
    Boolean round_endpoints;
    
    Boolean vertical;
    Boolean mirror;
    Boolean draw_numbers;
    Boolean draw_grid;
    Boolean auto_number;
    short tics;             /* number of tic values INCLUDIND ENDPOINTS */
    short subtics;		/* Number of subtics per tic  */
    double tic_interval;
    short tic_density;
    short subtic_density;
    double tic_multiplier;
    String tic_format;
    Boolean tics_outside;
    Boolean tics_inside;
    Boolean numbers_outside;
    short tic_length;
    short subtic_length;
    String tic_labels;
    XtCallbackList errorCallback;

    /* private state */

    AtScale *scale;
    AtText *label_text;
    AtFontFamily *labelFF, *numberFF;
    GC axisGC, numberGC, labelGC, dottedGC;

    short x1,y1,x2,y2;          /* where to draw the axis */
    short grid_length;		/* How long the grid is */
    
    /* The tics stored for quick update */
    XSegment *tic_segments;
    short num_tic_segments;
    XSegment *grid_segments;
    short num_grid_segments;
    
    char **tic_label_array;	/* Pointer to array of tic label pointers */
    short *tic_coords;          /* array of coordinates for each tic label */
    double *tic_values;		/* The real coord of each tic */
    AtText **tic_text;		/* One AtText for each tic */
    short label_x, label_y;     /* coordinates of the axis label */
    short max_num_width;	/* Width, in pixels, of the widest label */
    Boolean min_max_changed;	/* True if min/max changed and tics
				   need recalculating */

    String *user_tic_labels;	/* Parsed from the tic_labels resource */
    int num_user_tic_labels;

    /* These ones are from the date label routine */
    String *date_label_array;
    double *date_label_values; 
    int num_date_labels;
    
} AtAxisPart;

typedef struct _AtAxisRec {
    ObjectPart object;
    AtAxisPart axis;
} AtAxisRec;

typedef struct _AtAxisClassPart {
    int nothing_here;
} AtAxisClassPart;

typedef struct _AtAxisClassRec {
    ObjectClassPart object_class;
    AtAxisClassPart axis_class;
} AtAxisClassRec;

extern AtAxisClassRec atAxisClassRec;

#define MIN_MARGIN       5

#endif
