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

📄 wxgcl.cc

📁 Gambit 是一个游戏库理论软件
💻 CC
📖 第 1 页 / 共 2 页
字号:
//// $Source: /home/gambit/CVS/gambit/sources/wxgcl/wxgcl.cc,v $// $Date: 2002/08/31 18:57:54 $// $Revision: 1.5 $//// DESCRIPTION:// wxWindows-based interface to GCL//// This file is part of Gambit// Copyright (c) 2002, The Gambit Project//// This program is free software; you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation; either version 2 of the License, or// (at your option) any later version.//// This program is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the// GNU General Public License for more details.//// You should have received a copy of the GNU General Public License// along with this program; if not, write to the Free Software// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.//#include "wx/wxprec.h"#ifndef WX_PRECOMP#include "wx/wx.h"#endif  // WX_PRECOMP#include "wx/sashwin.h"#include "wx/fontdlg.h"#include "wx/image.h"   // for wxInitAllImageHandlers#include "wxgcl.h"#include "gui/wxstatus.h"#include "gui/dlabout.h"#include "math/gmath.h"#include "gcl/gsm.h"#include "base/gnullstatus.h"#include "gcl/command.h"#include "gcl/gpreproc.h"char *_SourceDir = 0;char *_ExePath = 0;//=======================================================================//                     Math error handling code //=======================================================================#ifdef __BORLANDC__int _RTLENTRY _matherr(struct exception *e){  wxMessageBox("Math error!");  return 1;	// we did not really fix anything, but want no more warnings}#endif  // __BORLANDC__extern int GCLParse(GSM *p_gsm,		    const gText& line, const gText &file, int lineno,		    const gText& rawline);class wxCommandLine : public GCL::CommandLine {protected:  virtual char GetNextChar(void) { return '\n'; }public:  wxCommandLine(int p_historyDepth) : GCL::CommandLine(p_historyDepth) { }  virtual ~wxCommandLine() { }  void SetPrompt(bool) { }  virtual bool eof(void) const { return true; }  virtual gInput &operator>>(int &) { return *this; }  virtual gInput &operator>>(unsigned int &) { return *this; }  virtual gInput &operator>>(long int &) { return *this; }  virtual gInput &operator>>(char &) { return *this; }  virtual gInput &operator>>(double &) { return *this; }  virtual gInput &operator>>(float &) { return *this; }  virtual gInput &operator>>(char *) { return *this; }  virtual int get(char &) { return 0; }  virtual void unget(char) { }  virtual void seekp(long int) const { }  virtual long getpos(void) const { return 0L; }  virtual void setpos(long) const { }};class wxOutputWindowStream : public gOutput {private:  wxTextCtrl *m_window;public:  wxOutputWindowStream(wxTextCtrl *p_window);  virtual ~wxOutputWindowStream() { }  virtual gOutput &operator<<(int x);  virtual gOutput &operator<<(unsigned int x);  virtual gOutput &operator<<(bool x);  virtual gOutput &operator<<(long x);  virtual gOutput &operator<<(char x);  virtual gOutput &operator<<(double x);  virtual gOutput &operator<<(long double x);  virtual gOutput &operator<<(float x);  virtual gOutput &operator<<(const char *x);  virtual gOutput &operator<<(const void *x);  virtual int GetWidth(void) const { return 2; }  virtual gOutput &SetWidth(int w) { return *this; }  virtual int GetPrec(void) const { return 2; }  virtual gOutput &SetPrec(int p) { return *this; }   virtual gOutput &SetExpMode(void) { return *this; }  virtual gOutput &SetFloatMode(void) { return *this; }  virtual char GetRepMode(void) const { return 'f'; }};wxOutputWindowStream::wxOutputWindowStream(wxTextCtrl *p_window)  : m_window(p_window){ }gOutput &wxOutputWindowStream::operator<<(int x){  m_window->AppendText((char *) ToText(x));  return *this;}gOutput &wxOutputWindowStream::operator<<(unsigned int x){  m_window->AppendText((char *) ToText((int) x));  return *this;}gOutput &wxOutputWindowStream::operator<<(bool x){  m_window->AppendText((x) ? "True" : "False");  return *this;}gOutput &wxOutputWindowStream::operator<<(long x){  m_window->AppendText((char *) ToText(x));  return *this;}gOutput &wxOutputWindowStream::operator<<(char x){  m_window->AppendText(x);  return *this;}gOutput &wxOutputWindowStream::operator<<(double x){  m_window->AppendText((char *) ToText(x));  return *this;}gOutput &wxOutputWindowStream::operator<<(long double x){  m_window->AppendText((char *) ToText(x));  return *this;}gOutput &wxOutputWindowStream::operator<<(float x){  m_window->AppendText((char *) ToText((double) x));  return *this;}gOutput &wxOutputWindowStream::operator<<(const char *x){  m_window->AppendText(x);  return *this;}gOutput &wxOutputWindowStream::operator<<(const void *x){  char buf[10];  sprintf(buf, "%p", x);  m_window->AppendText(buf);  return *this;}const int idCANCEL_BUTTON = 1500;class wxCancelButton : public wxButton, public gNullStatus {private:  bool m_sig;public:  wxCancelButton(wxWindow *p_parent);  virtual ~wxCancelButton() { }    void Get(void) const;  void Reset(void) { m_sig = false; }  void Set(void) { m_sig = true; }};wxCancelButton::wxCancelButton(wxWindow *p_parent)  : wxButton(p_parent, idCANCEL_BUTTON, "Cancel"), m_sig(false){ }void wxCancelButton::Get(void) const{  wxYield();  if (m_sig) {    throw gSignalBreak();  }}class wxGSM : public GSM {private:  gStatus &m_status;  gStatus *m_algorithmStatus;  bool m_useAlgorithmStatus;  wxWindow *m_parent;public:  wxGSM(wxWindow *p_parent, gStatus &p_status,	gInput &p_input, gOutput &p_output, gOutput &p_error);  virtual ~wxGSM() { }  gStatus &GetStatusMonitor(void);  void StartAlgorithmMonitor(const gText &);  void EndAlgorithmMonitor(void);  void ToggleMonitorStyle(void);};wxGSM::wxGSM(wxWindow *p_parent, gStatus &p_status,	     gInput &p_input, gOutput &p_output, gOutput &p_error)  : GSM(p_input, p_output, p_error),    m_status(p_status), m_algorithmStatus(0),    m_useAlgorithmStatus(true), m_parent(p_parent){ }gStatus &wxGSM::GetStatusMonitor(void){  return ((m_useAlgorithmStatus && m_algorithmStatus) ? 	  *m_algorithmStatus : m_status);} void wxGSM::StartAlgorithmMonitor(const gText &p_caption){  if (m_useAlgorithmStatus) {    m_algorithmStatus = new wxStatus(m_parent, p_caption);  }}void wxGSM::EndAlgorithmMonitor(void){  if (m_useAlgorithmStatus && m_algorithmStatus) {    delete m_algorithmStatus;    m_algorithmStatus = 0;  }}void wxGSM::ToggleMonitorStyle(void){  m_useAlgorithmStatus = !m_useAlgorithmStatus;}IMPLEMENT_APP(GclApp)class GclFrame : public wxFrame {private:  wxTextCtrl *m_outputWindow;  wxTextCtrl *m_inputWindow;  wxSashWindow *m_inputSashWindow;  wxCancelButton *m_cancelButton;  wxOutputWindowStream *m_outputStream;  gList<gText> m_history;  wxGSM *m_environment;  // Menu event handlers  void OnSaveLog(wxCommandEvent &);  void OnSaveScript(wxCommandEvent &);  void OnPrefsProgress(wxCommandEvent &);  void OnPrefsPrompt(wxCommandEvent &);  void OnPrefsInputFont(wxCommandEvent &);  void OnPrefsOutputFont(wxCommandEvent &);  void OnHelpAbout(wxCommandEvent &);  // Other event handlers  void OnCloseWindow(wxCloseEvent &);  void OnSize(wxSizeEvent &);  void OnSashDrag(wxSashEvent &);  void OnCancel(wxCommandEvent &);  void OnTextEnter(wxCommandEvent &);  gText FormPrompt(void);public:  GclFrame(wxFrame *p_parent, const wxString &p_title,	   const wxPoint &p_position, const wxSize &p_size);  virtual ~GclFrame();  DECLARE_EVENT_TABLE()};bool GclApp::OnInit(void){  // Long run feature: remember frame size from previous invocations  GclFrame *frame = new GclFrame(0, "Gambit Command Language",				 wxPoint(0, 0), wxSize(640, 480));  // Set up the help system.  wxInitAllImageHandlers();  frame->Show(true);    return true;}const int wxID_HELP_INDEX = 1000;const int idINPUT_WINDOW = 1001;const int idINPUT_SASH_WINDOW = 1002;const int idSAVE = 2000;const int idSAVE_LOG = 2001;const int idSAVE_SCRIPT = 2002;const int idPREFS_INPUTFONT = 2100;const int idPREFS_OUTPUTFONT = 2101;const int idPREFS_PROGRESS = 2102;const int idPREFS_PROMPT = 2103;GclFrame::GclFrame(wxFrame *p_parent, const wxString &p_title,		   const wxPoint &p_position, const wxSize &p_size)  : wxFrame(p_parent, -1, p_title, p_position, p_size),    m_outputWindow(0), m_inputSashWindow(0){  wxMenu *fileMenu = new wxMenu;

⌨️ 快捷键说明

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