⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xpig.h

📁 Programs in the irregular grid design package described in this manual are used to carry out five ma
💻 H
字号:
/*
 * $Id: xpig.h,v 1.11 1995/11/20 21:58:10 adolling Exp adolling $
 *
 * $Log: xpig.h,v $
 * Revision 1.11  1995/11/20  21:58:10  adolling
 * Removed some definitions common to text and non-text programs to pigtype.h
 *
 * Revision 1.10  1995/10/30  21:19:21  adolling
 * After HP / ALPHA replacement.
 *
 * Revision 1.8  1995/10/16  17:36:01  adolling
 * Working version.
 *
 * Revision 1.7  1995/10/13  17:07:35  adolling
 * Modified fortran / c interface to remove character*1 function definitions. All
 * character variable interactions now through the argument lists. This is to
 * simplify the portability between fortran and c compilers.
 *
 * Revision 1.6  1995/10/05  19:41:03  adolling
 * Includes changes to date from steve's work
 *
 * Revision 1.5  1995/10/05  19:30:14  adolling
 * After some changes to make code work on HP
 *
 * Revision 1.4  1995/10/05  19:14:08  adolling
 * Small changes - nothing specific, or particularly memorable!
 *
 * Revision 1.3  1995/09/28  19:54:19  adolling
 * After corrections from steve
 *
 * Revision 1.3  1995/09/28  19:54:19  adolling
 * After corrections from steve
 *
 * Revision 1.2  1995/09/25  18:46:39  adolling
 * Added rcs headers, and this is new version from steve.
 *
 *
 * revision 1.1	locked by: adolling;
 * date: 1995/09/24 14:31:02;  author: adolling;  state: Exp;
 * During final stage debugging. Most things working now.
 */

#include "pigtype.h"

#define  MainApp  mainapp_
#define  PigErase  pigerase_
#define  PigGetBackgroundColour  piggetbackgroundcolour_
#define  WPigMain  wpigmain_
#define  WPigMainInit  wpigmaininit_
#define  WPigDrawText  wpigdrawtext_
#define  WPigGetString  wpiggetstring_
#define  WPigCursPrompt  wpigcursprompt_
#define  WPigCursYesNo  wpigcursyesno_
#define  WPigFatal  wpigfatal_
#define  WPigExit  wpigexit_
#define  WPigSetTextAlignment  wpigsettextalignment_
#define  WPigGetTextExtent   wpiggettextextent_
#define  WPigSetCharSpacing  wpigsetcharspacing_
#define  WPigSetWindowNum  wpigsetwindownum_
#define  WPigSetZoomFlag  wpigsetzoomflag_
#define  WPigGetZoomFlag  wpiggetzoomflag_
#define  WPigGetZoomArea  wpiggetzoomarea_
#define  WPigSetLineColour   wpigsetlinecolour_
#define  WPigSetLineWidth   wpigsetlinewidth_
#define  WPigSetTextColour   wpigsettextcolour_
#define  WPigSetFillColour   wpigsetfillcolour_
#define  WPigSetForegrColour   wpigsetforegrcolour_
#define  WPigSetBackgrColour   wpigsetbackgrcolour_
#define  WPigSetSymbolColour   wpigsetsymbolcolour_
#define  WPigSetSymbolNumber   wpigsetsymbolnumber_
#define  WPigSetSymbolSize   wpigsetsymbolsize_
#define  WPigDrawPolyLine  wpigdrawpolyline_
#define  WPigDrawFilledPolygon  wpigdrawfilledpolygon_
#define  WPigDrawSymbols   wpigdrawsymbols_
#define  WPigDrawRubberLine  wpigdrawrubberline_
#define  WPigSetWorldCoordinates  wpigsetworldcoordinates_
#define  WPigGetWorldCoordinates  wpiggetworldcoordinates_
#define  WPigSetProfileCoordinates  wpigsetprofilecoordinates_
#define  WPigGetProfileCoordinates  wpiggetprofilecoordinates_
#define  WPigGetMouseAndButton   wpiggetmouseandbutton_
#define  WPigGetRubberMouseAndButton   wpiggetrubbermouseandbutton_
#define  WPigNewMenu  wpignewmenu_
#define  WPigNewPopup  wpignewpopup_
#define  WPigAddMenuItem  wpigaddmenuitem_
#define  WPigAddMenuSeparator  wpigaddmenuseparator_
#define  WPigAttachPopup  wpigattachpopup_
#define  WPigSetMenu  wpigsetmenu_
#define  WPigUWait  wpiguwait_
#define  WPigGetVersion	wpiggetversion_
#define  WPigPrinting  wpigprinting_
#define  WPigGetOpenFileName  wpiggetopenfilename_
#define  WPigGetSaveFileName  wpiggetsavefilename_
#define  IPigDebugToggle  ipigdebugtoggle_ 
#define  IPigDebugOn ipigdebugon_


/* #define	XPigRegisterLicenceNo xpigregisterlicenceno_ */
/* #define	XPigRegisterAuthority xpigregisterauthority_ */
/* #define	XPigLicenceOK xpiglicenceok_ */
/* #define	XPigSaveLicence xpigsavelicence_ */
/* #define	XPigLicenced xpiglicenced_ */

typedef struct { 
	Long (*InitFnc)(void);
        Long (*MenuFnc)( const Long * item);
        Long (*MousFnc)( const Long * window, const Long * button, const float * x, const float * y);
        Long (*StriFnc)( const Long * length, const char * string, const Long dummy_len);
}  WPigFuncPtrs;

   void  MainApp(void);
   void  PigErase(const Long * window);
   Long  PigGetBackgroundColour(Long *colour);
   void  IPigDebugToggle(void);
   void  IPigDebugOn(void);
   void  WPigMainInit(void);
   void  WPigMain( 
	Long (*InitFnc)(void),
	Long (*MenuFnc)( 
		const Long * item),
	Long (*MousFnc)( 
		const Long * window, 
		const Long * button, 
		const float * x, 
		const float * y),
	Long (*StriFnc)( 
		const Long * length, 
		const char * string, 
		const Long dummy_len) );
   void  WPigDrawText( const float *x, const float *y, const char * string, const Long dummy_len);
   void  WPigGetString( const char *prompt, Long *anslen, char * string, const Long dummy_len1, const Long dummy_len2);
   void  WPigCursPrompt( char *reply, const Long *noptions, const char * question, const char * answer, const Long dum_len1, const Long dum_len2, const Long dum_len3);
   void  WPigCursYesNo( char *reply, const char * question, const Long dummy_len1, const Long dummy_len2);
   void  WPigFatal( const char * message, const Long dunny_len);
   void  WPigExit(void);
   void  WPigSetTextAlignment( const Long *horizontal, const Long *vertical);
   void  WPigGetTextExtent (const char * string, float *str_width, float *str_height, const Long dummy_len);
   void  WPigSetCharSpacing(const float *spacing);
   void  WPigSetWindowNum(const Long *Num);
   void  WPigSetZoomFlag(void);
   Long  WPigGetZoomFlag(void);
   void  WPigGetZoomArea(float * xlow, float *xhigh, float *ylow, float *yhigh);
   void  WPigSetLineColour (const Long *NewColour);
   void  WPigSetLineWidth (const float *width);
   void  WPigSetTextColour (const Long *NewColour);
   void  WPigSetFillColour (const Long *NewColour);
   void  WPigSetForegrColour (const Long *NewColour);
   void  WPigSetBackgrColour (const Long *NewColour);
   void  WPigSetSymbolColour (const Long *NewColour);
   void  WPigSetSymbolNumber (const Long *NewNumber);
   void  WPigSetSymbolSize (const float *NewSize);
   void  WPigDrawPolyLine(const Long *NPoints, const float *xarray, const float *yarray);
   void  WPigDrawFilledPolygon(const Long *NPoints, const float *xarray, const float *yarray);
   void  WPigDrawSymbols (const Long *n, const float *x, const float *y);
   void  WPigSetWorldCoordinates(const float *xlow, const float *xhigh, const float *ylow, const float *yhigh);
   void  WPigGetWorldCoordinates(float *xlow, float *xhigh, float *ylow, float *yhigh);
   void  WPigSetProfileCoordinates(const float *xlow, const float *xhigh, const float *ylow, const float *yhigh);
   void  WPigGetProfileCoordinates(float *xlow, float *xhigh, float *ylow, float *yhigh);
   void  WPigGetMouseAndButton (Long *window, Long *button, float *x, float *y);
   void  WPigGetRubberMouseAndButton (Long *window, Long *button, float *x, float *y);

   Address WPigNewMenu(void);
   Address WPigNewPopup(const char *title, const Long dummy_len);
   void WPigAddMenuItem(const Address *menu, const char *title, const Long *tag, const Long dummy_len);

   void WPigAddMenuSeparator(const Address *menu);
   void WPigAttachPopup(const Address *parent, const Address *popup, const char *title, const Long dummy_len);
   void WPigSetMenu(const Address *menu);

   void WPigUWait(const float *delay_sec);
   void WPigGetVersion(char *version, const long dummy_len);
   
   Long WPigPrinting(void);

   Long WPigGetOpenFileName(const char *prompt, char *name, const char *tmpl, const Long dummy_len1, const Long dummy_len2, const Long dummy_len3);
   Long WPigGetSaveFileName(const char *prompt, char *name, const char *tmpl, const Long dummy_len1, const Long dummy_len2, const Long dummy_len3);

   /* void XPigRegisterLicenceNo(Long *serial); */
   /* void XPigRegisterAuthority(Long *code); */
   /* Long XPigLicenceOK(char *name, char *org, const long dummy_len1, const long dummy_len2); */
   /* void XPigSaveLicence(Long *serial, Long *code, char *name, char *org, const long dummy_len1, const long dummy_len2); */
   /* Long XPigLicenced(void); */

/* from File: Wpig.h         Contains ID values used by wpig.cpp */


#define MENU_QUIT           -1
#define MENU_POP            -2

char           *pig_window_names[6] = {
			"PIG_SCREEN_WIN",
			"PIG_MAIN_WIN",
			"PIG_CONTROL_WIN",
			"PIG_STATUS_WIN",
			"PIG_PROFILE_WIN",
			"NULL_WIN"
};

#define PIG_SCREEN_WIN		0
#define PIG_MAIN_WIN		1
#define PIG_CONTROL_WIN		2
#define PIG_STATUS_WIN		3
#define PIG_PROFILE_WIN		4
#define NULL_WIN		5

#define REPAINT_ALL 	    5050
#define REPAINT 	    REPAINT_ALL
#define REPAINT_MAINWIN     5051
#define REPAINT_CONTROLWIN  5052
#define REPAINT_PROFILEWIN  5053
#define ZOOM_BY_DRAG	    5054
#define DEBUGTOGGLE         5058

#define QUIT_EVENT	    -5000
#define MOUSE_EVENT         -5001
#define NULL_EVENT          -5002
#define MENU_EVENT          -5003
#define KEYBOARD_EVENT      -5004
#define STRING_EVENT        -5005
#define PRINT_EVENT	    -5006
#define REPAINT_EVENT	    -5007

/* colours passed to pigs by the applications */

#define BLACK               0
#define WHITE               1
#define RED                 2
#define GREEN               3
#define BLUE                4
#define YELLOW              5
#define CYAN                6
#define VIOLET              7
#define DKGRAY              8
#define LTGRAY              9
#define DKRED               10
#define DKGREEN             11
#define DKBLUE              12
#define ORANGE              13
#define DKCYAN              14
#define VIOBLUE             15

/* colour name definitions - used in XPig */
/* should appear in /usr/lib/X11/rgb.txt database */

char           *Xcolour_names[16] = {
			"BLACK", 
			"WHITE", 
			"RED", 
			"GREEN", 
			"BLUE", 
			"YELLOW", 
			"CYAN", 
			"VIOLET", 
			"DIM GRAY", /* "DARK GRAY",  */
			"LIGHT GRAY", 
			"RED4", /* "DARK RED",  */
			"DARK GREEN", 
			"BLUE3", /* "DARK BLUE",  */
			"ORANGE", 
			"CYAN3", /* "DARK CYAN",  */
			"BLUE VIOLET"
};

#define NOCOLS                  16

typedef struct stevecolour {
	unsigned char red, green, blue;
	} SteveColour;

static unsigned long CmsColourDefs[NOCOLS] = {
		9,		/*{0  , 0  , 0   },		 WBLACK  */
		3,		/*{255, 255, 255 },		 WWHITE   */
		16711680,	/*{255, 0  , 0   },		 WRED     */
		4,		/*{0  , 255, 0   },		 WGREEN   */
		5,		/*{0  , 0  , 255 },		 WBLUE    */
		6,		/*{255, 255, 64  },		 WYELLOW  */
		4095,		/*{0  , 255, 255 },		 WCYAN    */
		7,		/*{255, 0  , 255 },		 WVIOLET  */
		8,		/*{64 , 64 , 64  },		 WDKGRAY  */
		9,		/*{128, 128, 128 },		 WLTGRAY  */
		10,		/*{128, 0  , 0   },		 WDKRED   */
		11,		/*{0  , 128, 0   },		 WDKGREEN */
		12,		/*{0  , 0  , 128 },		 WDKBLUE  */
		13,		/*{255, 64 , 0   },		 WORANGE  */
		14,		/*{32 , 200, 200 },		 WDKCYAN  */
		15 		/*{128, 32 , 128 },		 WVIOBLUE */
};

/* colours recognized by Windows -- MAKE SURE THEY ARE THE SAME IN X */

/* X event types */
char		*Xevent_type[36] = {
			"ZERO EVENT ????? INVALID!!!!", "ONE EVENT ???? INVALID!!!!",
			"KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease", "MotionNotify",
			"EnterNotify", "LeaveNotify", "FocusIn", "FocusOut", "KeymapNotify",
			"Expose", "GraphicsExpose", "NoExpose", "VisibilityNotify", "CreateNotify",
			"DestroyNotify", "UnmapNotify", "MapNotify", "MapRequest", "ReparentNotify",
			"ConfigureNotify", "ConfigureRequest", "GravityNotify", "ResizeRequest", "CirculateNotify",
			"CirculateRequest", "PropertyNotify", "SelectionClear", "SelectionRequest", "SelectionNotify",
			"ColormapNotify", "ClientMessage", "MappingNotify", "LASTEvent"
};

/* Symbol definitions */

char           *Xsymbol_names[8] = {
			"NULL-SYMBOL", "WPPOINT", "WPCROSS", "WPSPLAT", "WPSQUARE",
			"WPEX ", "WPDIAMOND", "WPCIRCLE"
};

#define WPPOINT   1
#define WPCROSS   2
#define WPSPLAT   3
#define WPSQUARE  4
#define WPEX      5
#define WPDIAMOND 6
#define WPCIRCLE  7

#define ZOOM_ON         50
#define ZOOM_OFF        51

char           *Xalign_names[7] = {
			"NULL_NULL_NULL", "LEFT_ALIGN", "CENTRE_ALIGN", 
			"RIGHT_ALIGN", "BASE_ALIGN", "TOP_ALIGN", "BOTTOM_ALIGN"
};

#define LEFT_ALIGN      1
#define CENTRE_ALIGN    2
#define RIGHT_ALIGN     3
#define BASE_ALIGN      4
#define TOP_ALIGN       5
#define BOTTOM_ALIGN    6

#define LBUTTON         0
#define RBUTTON         1
#define MBUTTON         2

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -