📄 wpig.hpp
字号:
// File: wpig.hpp
/* ==================================================================
WPIG.HPP contains class definitions and function prototypes for
the WPIG (MS Windows) implementation of PIGS .
Written by: Lizhuang Fu July 1994
Norman Chan
John Carver
==================================================================*/
/* -----------------------------------------------------------------------
CEditDialog class derived from MFC CModalDialog class creates a dialog box
that provides a one line entry field for getting a string input from the
user. The data entered is stored when the user hits OK.
------------------------------------------------------------------------ */
class CEditDialog : public CModalDialog
{
public:
// CEditDialog( CWnd* pParentWnd )
// : CModalDialog( "StringInput", pParentWnd ){ }
// CEditDialog( CWnd* pParentWnd, CString* msg)
// : CModalDialog( "StringInput", pParentWnd )
// { MsgStr = msg; }
CEditDialog( CWnd* pParentWnd, CString* msg, CString *reply_init)
: CModalDialog( "StringInput", pParentWnd )
{ MsgStr = msg; ReplyStr = reply_init; }
private:
BOOL OnInitDialog();
void OnOKBtn();
CString* MsgStr;
CString* ReplyStr;
DECLARE_MESSAGE_MAP()
};
/* ------------------------------------------------------------------------
QuitDialog class derived from MFC CModalDialog class creates a dialog box
used to confirm users' wishes to exit the program.
Sets the prompt message passed from application to the caption.
------------------------------------------------------------------------ */
class QuitDialog : public CModalDialog
{
public:
QuitDialog( CWnd* pParentWnd, CString* msg )
: CModalDialog( "WpigQuit", pParentWnd )
{ MsgStr = msg; }
private:
BOOL OnInitDialog();
void OnOKBtn();
void OnCancelBtn();
CString* MsgStr;
DECLARE_MESSAGE_MAP()
};
/* --------------------------------------------------------------------------
FatalDialog class derived from MFC CModalDialog class creates a dialog box
that prompts user that an error occured in the program and quits the
program when user hits OK. Sets the prompt message passed from application to the
caption.
------------------------------------------------------------------------- */
class FatalDialog : public CModalDialog
{
public:
FatalDialog ( CWnd *pParent, CString* msg ):
CModalDialog( "Fatal", pParent )
{ aTitleStr = msg; }
private:
BOOL OnInitDialog();
void DoQuit();
CString* aTitleStr;
DECLARE_MESSAGE_MAP()
};
/* -------------------------------------------------------------------------
This CListDialog class derived from MFC CModalDialog creates a dialog box
which provides the ability to respond to a list of choices passed by the
application, using cursor input. Sets the prompt message passed from
application to the caption.
------------------------------------------------------------------------ */
class CListDialog : public CModalDialog
{
public:
CListDialog (CWnd *pParent, CStringList* inList, CString* msg):
CModalDialog("ListDialog", pParent)
{ pList = inList; aCStr = msg; }
private:
BOOL OnInitDialog();
void OnOkBtn() { EndDialog(nChoice); }
void OnOk() { EndDialog(nChoice); }
void OnListBoxSel();
int nChoice;
CString* aCStr;
CStringList* pList;
CListBox* pListBox;
DECLARE_MESSAGE_MAP()
};
//class CFileDialog : public CWnd
//{
// public:
// CFileDialog (CWnd *pParent) { m_hWnd = pParent;}
// long GetOpenFile(char *prompt, char *name, char *tmpl);
// long GetSaveFile(char *prompt, char *name, char *tmpl);
//}
/* -----------------------------------------------------------------------
CMainWindow class derived from MFC CFrameWnd class provides house keeping
facilities for the application. Its constructor will be called by CTheApp
class.
---------------------------------------------------------------------- */
class CMainWindow : public CFrameWnd
{
public:
CMainWindow();
void OnClose();
private:
Real lastx_main, lasty_main;
Long lastb_main, lastw_main;
BOOL OnCommand( UINT, LONG );
void OnPaint ();
void OnPrint (); // added agd 94/aug/9
void EnableMenu();
void DisableMenu();
void OnSize(UINT, int, int);
void OnLButtonUp( UINT , CPoint );
void OnLButtonDown( UINT , CPoint );
void OnMButtonUp( UINT , CPoint );
void OnButtonUp(long, UINT , CPoint );
void OnMButtonDown( UINT , CPoint );
void OnRButtonUp( UINT , CPoint );
void OnRButtonDown( UINT , CPoint );
void OnButtonDown(long, UINT , CPoint );
void OnMouseMove( UINT , CPoint );
DECLARE_MESSAGE_MAP()
};
/* -------------------------------------------------------------------------
CTheApp class is a main application's class that defines the application
object in Windows' environment.
------------------------------------------------------------------------- */
class CTheApp : public CWinApp
{
public:
BOOL InitInstance ();
int ExitInstance ();
};
/* ------------------------------------------------------------------
CSymbol class defines a set of symbols. It has no constructor.
------------------------------------------------------------------ */
class CSymbol
{
public:
void DrawCross (POINT, int);
void DrawEx (POINT, int);
void DrawSplat (POINT, int);
void DrawCircle (POINT, int);
void DrawSquare (POINT, int);
void DrawDiamond (POINT, int);
void DrawPoint (POINT, int);
// void DrawPixel (POINT);
};
static POINT IWPigFloatToInt(Long, Real, Real);
static void IWPigIntToFloat(Long, POINT, Real *, Real *);
static DWORD IWPigSetColour (Long);
static void IWPigSetLinePosition (LPPOINT, LPPOINT);
static void IWPigDrawRubberBox(POINT);
static void IWPigDrawRubberLine(POINT);
static void IWPigSetColourPixel(Long, Long);
static void IWPigGetColourPixel(Long, Long*);
static void IWPigSetWindowRect();
static void IWPigSetWindowRgn();
static Long IWPigGetWinNum (CPoint);
typedef struct
{
Long ( __stdcall *Initialiser )();
Long ( __stdcall *MenuEHandler )( Long * );
Long ( __stdcall *MouseEHandler )( Long *, Long *, Real *, Real * );
Long ( __stdcall *MouseEMoveHandler )( Long *, Real *, Real * );
Long ( __stdcall *StringEHandler )( Long *, char * );
} WinPig;
// FORTRAN interface...
extern "C"
{
void __stdcall MainApp();
void __stdcall PigErase(Long *);
Long __stdcall PigGetBackgroundColour();
void __stdcall IPigDebugToggle();
void __stdcall IPigSetMenuRepeatLabel(Long *);
void WPigMainInit(void);
void WPigMain( Long (__stdcall *InitFnc)(),
Long (__stdcall *MenuFnc)( Long * ),
Long (__stdcall *MousFnc)( Long *, Long *, Real *, Real * ),
Long (__stdcall *MousMoveFnc)( Long *, Real *, Real * ),
Long (__stdcall *StriFnc)( Long *, char * ) );
void WPigSetHandlers( Long (__stdcall *InitFnc)(),
Long (__stdcall *MenuFnc)( Long * ),
Long (__stdcall *MousFnc)( Long *, Long *, Real *, Real * ),
Long (__stdcall *MousMoveFnc)( Long *, Real *, Real * ),
Long (__stdcall *StriFnc)( Long *, char * ) );
void WPigDrawText( Real , Real , char * );
void WPigGetString( char *, Long *, char * );
void WPigCursPrompt( char*, Long , char *, char * );
void WPigCursYesNo( char*, char * );
// void WPigEraseMain();
void WPigFatal( char * );
void WPigExit();
void WPigSetTextAlignment( Long, Long );
void WPigGetTextExtent (char *, Real *, Real *);
void WPigSetCharSpacing(Real);
void WPigSetWindowNum(Long Num);
void WPigSetZoomFlag();
Long WPigGetZoomFlag();
void WPigGetZoomArea(Real *, Real *, Real *, Real *);
void WPigDrawBox (Real, Real, Real, Real);
void WPigSetLineColour (Long);
void WPigSetLineWidth (Real);
void WPigSetTextColour (Long);
void WPigSetRGBColour (Long, Long, Long, Long);
void WPigGetRGBColour (Long, Long *, Long *, Long *);
void WPigSetColourPixel (Long, Long);
void WPigGetColourPixel (Long, Long *);
void WPigSetFillColour (Long);
void WPigSetForegrColour (Long NewColour);
void WPigSetBackgrColour (Long NewColour);
void WPigSetSymbolColour (Long);
void WPigSetSymbolNumber (Long);
void WPigSetSymbolSize (Real);
void WPigDrawPolyLine(Long, Real *x, Real *y);
void WPigDrawFilledPolygon(Long, Real *x, Real *y);
void WPigDrawSymbols (Long n, const Real x[], const Real y[]);
/* void WPigDrawRubberLine(int, LPPOINT); */
void WPigSetWorldCoordinates(Real, Real, Real, Real);
void WPigGetWorldCoordinates(Real *, Real *, Real *, Real *);
void WPigSetProfileCoordinates(Real, Real, Real, Real);
void WPigGetProfileCoordinates(Real *, Real *, Real *, Real *);
void WPigGetMouseAndButton (Long *, Long *, Real *, Real *);
void WPigGetRubberMouseAndButton (Long *, Long *, Real *, Real *);
Long WPigNewMenu(void);
Long WPigNewPopup(char *title);
void WPigAddMenuItem(Long menu, char *title, Long tag);
void WPigAddMenuSeparator(Long menu);
void WPigAttachPopup(Long parent, Long popup, char *title);
void WPigSetMenu(Long menu);
void WPigUWait(Real delay_sec);
void WPigGetVersion(char *version);
Long WPigPrinting(void);
Long WPigGetOpenFileName(char *prompt, char *name, char *tmpl);
Long WPigGetSaveFileName(char *prompt, char *name, char *tmpl);
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -