Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

mcw_graf.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002    Major portions of this software are copyrighted by the Medical College
00003    of Wisconsin, 1994-2000, and are released under the Gnu General Public
00004    License, Version 2.  See the file README.Copyright for details.
00005 ******************************************************************************/
00006    
00007 #ifndef _MCW_GRAFFF_HEADER_
00008 #define _MCW_GRAFFF_HEADER_
00009 
00010 /* header for MCW_graf stuff -- derived from xv program */
00011 
00012 #include "bbox.h"       /* MCW stuff for buttons, etc. */
00013 
00014 #include "mcw_malloc.h"
00015 
00016 #define MAX_GHANDS 16   /* maximum # of handles */
00017 
00018 #define GRAF_SIZE 128
00019 
00020 typedef struct {
00021    Widget topform , toplabel , drawer , reset_pb ;
00022    MCW_bbox * curve_bbox ;
00023    MCW_arrowval * handle_av ;
00024    MCW_DC * dc ;
00025    Pixel fg , bg ;
00026    Window gwin ;
00027 
00028    gen_func * cbfunc ;
00029    void     * cbdata ;
00030 
00031    int spline ;                /* spline curve or lines? */
00032    int nhands ;                /* current # of handles */
00033    int yeqx ;                  /* is it y=x? */
00034    XPoint hands[MAX_GHANDS] ;  /* positions of handles */
00035    byte func[256] ;            /* output function */
00036    byte oldf[256] ;            /* for comparison */
00037 
00038    float xbot,xtop,ybot,ytop ; /* for scaling x,y axes */
00039    Widget popmenu , poplabel ;
00040 } MCW_graf ;
00041 
00042 #define UNMANAGE_GRAF(g)                                           \
00043   do{ Widget wl[6] = { (g)->topform, (g)->toplabel , (g)->drawer , \
00044                        (g)->reset_pb , (g)->curve_bbox->wrowcol ,  \
00045                        (g)->handle_av->wrowcol } ;                 \
00046       XtUnmanageChildren( wl , 6 ) ; } while(0)
00047 
00048 #define MANAGE_GRAF(g)                                             \
00049   do{ Widget wl[6] = { (g)->topform, (g)->toplabel , (g)->drawer , \
00050                        (g)->reset_pb , (g)->curve_bbox->wrowcol ,  \
00051                        (g)->handle_av->wrowcol } ;                 \
00052       XtManageChildren( wl , 6 ) ; } while(0)
00053 
00054 /* RANGE forces a to be in the range b..c (inclusive) */
00055 
00056 #define RANGE(a,b,c) { if (a < b) a = b;  if (a > c) a = c; }
00057 
00058 /* PTINRECT returns '1' if x,y is in rect */
00059 
00060 #define PTINRECT(x,y,rx,ry,rw,rh) \
00061            ((x)>=(rx) && (y)>=(ry) && (x)<((rx)+(rw)) && (y)<((ry)+(rh)))
00062 
00063 /* prototypes */
00064 
00065 extern MCW_graf * new_MCW_graf( Widget wpar , MCW_DC * , char * title ,
00066                                 gen_func * cbfunc , void * cbdata ) ;
00067 
00068 extern void GRAF_drawing_EV( Widget w , XtPointer client_data ,
00069                              XEvent * ev , Boolean * continue_to_dispatch ) ;
00070 
00071 extern void drawGraf( MCW_graf * gp , int erase ) ;
00072 
00073 extern void GRAF_curve_CB( Widget w, XtPointer client_data, XtPointer call_data ) ;
00074 
00075 extern void GRAF_reset_CB( Widget w, XtPointer client_data, XtPointer call_data ) ;
00076 
00077 extern void GRAF_handle_CB( MCW_arrowval * av , XtPointer client_data ) ;
00078 
00079 extern void GRAF_put_setup( MCW_graf * , int   , int * , int * , int   ) ;
00080 extern void GRAF_get_setup( MCW_graf * , int * , int * , int * , int * ) ;
00081 
00082 extern void GenerateGrafFunc( MCW_graf * gp , int redraw ) ;
00083 extern void InitSpline(int *x,int *y,int n,double *y2) ;
00084 extern double EvalSpline(int xa[],int ya[],double y2a[],int n,double x) ;
00085 extern void xvbcopy(char * src, char * dst, size_t len) ;
00086 
00087 extern int GRAF_changed( MCW_graf * gp ) ;
00088 extern void GRAF_set_func( MCW_graf * gp , byte * func ) ;
00089 
00090 extern void GRAF_set_xyrange( MCW_graf *gp , float xb,float xt, float yb,float yt ) ;
00091 
00092 /* passive graf */
00093 
00094 #define PASGRAF_LINE  0        /* for 'mode', below */
00095 #define PASGRAF_BAR   1
00096 
00097 #define PASGRAF_MODENUM 2
00098 #define NEXT_PASGRAF_MODE(g) ( (g)->mode = ((g)->mode+1)%PASGRAF_MODENUM )
00099 
00100 typedef struct {
00101    Widget topform , toplabel , drawer ;
00102    MCW_DC * dc ;
00103    Pixel fg , bg ;
00104    Window gwin ;
00105 
00106    int mode ;
00107    byte func[GRAF_SIZE] ;
00108 
00109    float xbot,xtop,ybot,ytop ; /* for scaling x,y axes */
00110    Widget popmenu , poplabel ;
00111 } MCW_pasgraf ;
00112 
00113 #define UNMANAGE_PASGRAF(g)                                          \
00114   do{ Widget wl[3] = { (g)->topform, (g)->toplabel , (g)->drawer } ; \
00115       XtUnmanageChildren( wl , 3 ) ; } while(0)
00116 
00117 #define MANAGE_PASGRAF(g)                                            \
00118   do{ Widget wl[3] = { (g)->topform, (g)->toplabel , (g)->drawer } ; \
00119       XtManageChildren( wl , 3 ) ; } while(0)
00120 
00121 extern MCW_pasgraf * new_MCW_pasgraf( Widget wpar , MCW_DC * dc , char * title ) ;
00122 extern void GRAF_pasdrawing_EV( Widget w , XtPointer client_data ,
00123                          XEvent * ev , Boolean * continue_to_dispatch ) ;
00124 extern void redraw_MCW_pasgraf( MCW_pasgraf * gp ) ;
00125 extern void set_MCW_pasgraf( MCW_pasgraf * gp , byte * func ) ;
00126 
00127 extern void MCW_histo_bytes( int nb , byte * bar , int * har ) ;
00128 
00129 extern void PASGRAF_set_xyrange( MCW_pasgraf *gp , float xb,float xt, float yb,float yt ) ;
00130 
00131 #endif /* _MCW_GRAFFF_HEADER_ */
 

Powered by Plone

This site conforms to the following standards: