From: John L. <jr...@us...> - 2007-08-14 13:42:19
|
Update of /cvsroot/wxlua/wxLua/apps/wxluacan/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv3043/wxLua/apps/wxluacan/src Modified Files: canlua.cpp canlua.h cansim.cpp cansim.h Log Message: Fix ambiguous call to wxLuaState(...) in cansum.cpp A little cleanup for the wxluacan app Update luamodule.cpp to use new enums for wxLuaState(lua_State, ...) Nil the wxLuaState lookup in the registry table when the wxLuaState is closed Index: cansim.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxluacan/src/cansim.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** cansim.cpp 16 Jul 2007 19:34:12 -0000 1.14 --- cansim.cpp 14 Aug 2007 13:42:13 -0000 1.15 *************** *** 1,4 **** /*! \file cansim.cpp ! \author XX Copyright: 2001-2004 (C) XX --- 1,4 ---- /*! \file cansim.cpp ! \author Klaas Holwerda Copyright: 2001-2004 (C) XX *************** *** 58,61 **** --- 58,65 ---- EVT_MENU( wxID_REDO, MyFrame::OnRedo) EVT_MENU( wxID_EXIT, MyFrame::OnQuit) + + EVT_LUA_PRINT (wxID_ANY, MyFrame::OnLua) + EVT_LUA_ERROR (wxID_ANY, MyFrame::OnLua) + EVT_LUA_DEBUG_HOOK (wxID_ANY, MyFrame::OnLua) END_EVENT_TABLE() *************** *** 77,82 **** SetIcon(wxICON(wxLuaSmall)); ! m_interp = wxLuaState(NULL, wxID_ANY); ! m_interp.SetEventHandler( &wxGetApp() ); //default 1000,1000 mapping --- 81,85 ---- SetIcon(wxICON(wxLuaSmall)); ! m_interp = wxLuaState(this, wxID_ANY); //default 1000,1000 mapping *************** *** 89,94 **** m_canvas->SetVirtualSize( 1000, 1000 ); m_canvas->SetScrollRate( 50, 50 ); ! m_canvas->SetBackgroundColour( wxColour( 223,234,251)); ! m_canvas->SetBackgroundBrush( wxBrush( wxColour( 30,174,171), wxCROSS_HATCH ) ); m_canvas->SetYaxis( false ); //true ); --- 92,97 ---- m_canvas->SetVirtualSize( 1000, 1000 ); m_canvas->SetScrollRate( 50, 50 ); ! m_canvas->SetBackgroundColour( wxColour(223, 234, 251) ); ! m_canvas->SetBackgroundBrush( wxBrush( wxColour(30, 174, 171), wxCROSS_HATCH ) ); m_canvas->SetYaxis( false ); //true ); *************** *** 96,102 **** m_canvas->SetMappingUpp( m_xOrigin, m_yOrigin, m_xScale, m_yScale ); wxlCanObjRect* rect = new wxlCanObjRect( 170, 170,200, -120 ); rect->SetPen(*wxGREEN_PEN); ! rect->SetBrush( wxBrush( wxColour( 70, 124,71) ) ); m_canvas->AddObject( rect ); --- 99,106 ---- m_canvas->SetMappingUpp( m_xOrigin, m_yOrigin, m_xScale, m_yScale ); + // Add some initial objects to the canvas wxlCanObjRect* rect = new wxlCanObjRect( 170, 170,200, -120 ); rect->SetPen(*wxGREEN_PEN); ! rect->SetBrush( wxBrush( wxColour(70, 124, 71) ) ); m_canvas->AddObject( rect ); *************** *** 280,294 **** } //------------------------------------------------------------------------------ // MyApp //------------------------------------------------------------------------------ ! BEGIN_EVENT_TABLE(MyApp, wxApp) ! EVT_LUA_PRINT (wxID_ANY, MyApp::OnLua) ! EVT_LUA_ERROR (wxID_ANY, MyApp::OnLua) ! EVT_LUA_DEBUG_HOOK (wxID_ANY, MyApp::OnLua) ! END_EVENT_TABLE() ! ! MyApp::MyApp() { } --- 284,304 ---- } + void MyFrame::OnLua( wxLuaEvent &event ) + { + if (event.GetEventType() == wxEVT_LUA_PRINT) + { + wxMessageBox(event.GetString(), wxT("maskpro")); + } + else if (event.GetEventType() == wxEVT_LUA_ERROR) + { + wxMessageBox(event.GetString(), wxT("maskpro")); + } + } + //------------------------------------------------------------------------------ // MyApp //------------------------------------------------------------------------------ ! MyApp::MyApp() : m_frame(NULL) { } *************** *** 301,305 **** wxLuaBinding_wxluacan_init(); ! m_frame = new MyFrame( NULL, -1, _T("LuaCan"), wxPoint(20,30), wxSize(600,440) ); m_frame->Show( true ); --- 311,315 ---- wxLuaBinding_wxluacan_init(); ! m_frame = new MyFrame( NULL, wxID_ANY, _T("LuaCan"), wxPoint(20,30), wxSize(600,440) ); m_frame->Show( true ); *************** *** 311,324 **** return 0; } - - void MyApp::OnLua( wxLuaEvent &event ) - { - if (event.GetEventType() == wxEVT_LUA_PRINT) - { - wxMessageBox(event.GetString(), wxT("maskpro")); - } - else if (event.GetEventType() == wxEVT_LUA_ERROR) - { - wxMessageBox(event.GetString(), wxT("maskpro")); - } - } --- 321,322 ---- Index: cansim.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxluacan/src/cansim.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** cansim.h 17 Dec 2006 10:47:07 -0000 1.5 --- cansim.h 14 Aug 2007 13:42:13 -0000 1.6 *************** *** 1,4 **** /*! \file canvas/samples/cansim/cansim.h ! \author XX Copyright: 2001-2004 (C) XX --- 1,4 ---- /*! \file canvas/samples/cansim/cansim.h ! \author Klaas Holwerda Copyright: 2001-2004 (C) XX *************** *** 92,95 **** --- 92,96 ---- void OnRunScript(wxCommandEvent& event); + void OnLua( wxLuaEvent &event ); double m_xScale; *************** *** 114,130 **** class MyApp: public wxApp { - DECLARE_EVENT_TABLE() - public: MyApp(); - virtual bool OnInit(); virtual int OnExit(); - - void OnLua( wxLuaEvent &event ); - MyFrame *m_frame; }; --- 115,125 ---- Index: canlua.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxluacan/src/canlua.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** canlua.h 21 Dec 2006 06:02:02 -0000 1.8 --- canlua.h 14 Aug 2007 13:42:13 -0000 1.9 *************** *** 45,49 **** wxlCanObj( double x = 0, double y = 0 ); ! ~wxlCanObj(); //! sets the position of the object relative to its parent object. --- 45,49 ---- wxlCanObj( double x = 0, double y = 0 ); ! virtual ~wxlCanObj(); //! sets the position of the object relative to its parent object. *************** *** 198,202 **** protected: ! virtual void DoUpdate( double WXUNUSED(absx), double WXUNUSED(absy) ); wxString m_script; --- 198,202 ---- protected: ! virtual void DoUpdate( double absx, double absy ); wxString m_script; Index: canlua.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxluacan/src/canlua.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** canlua.cpp 16 Jul 2007 19:34:12 -0000 1.12 --- canlua.cpp 14 Aug 2007 13:42:13 -0000 1.13 *************** *** 82,88 **** void wxlCanObj::Draw( wxDC& dc, double absx, double absy ) { ! if ( m_brush != wxNullBrush ) dc.SetBrush( m_brush ); ! if ( m_pen != wxNullPen ) dc.SetPen( m_pen ); --- 82,88 ---- void wxlCanObj::Draw( wxDC& dc, double absx, double absy ) { ! if ( m_brush.Ok() ) dc.SetBrush( m_brush ); ! if ( m_pen.Ok() ) dc.SetPen( m_pen ); *************** *** 159,166 **** yh = y - absy; ! double xmin = wxMin( 0 , m_w); ! double ymin = wxMin( 0 , m_h); ! double xmax = wxMax( 0 , m_w); ! double ymax = wxMax( 0 , m_h); // check if inside bounding box with positive margin --- 159,166 ---- yh = y - absy; ! double xmin = wxMin( 0, m_w); ! double ymin = wxMin( 0, m_h); ! double xmax = wxMax( 0, m_w); ! double ymax = wxMax( 0, m_h); // check if inside bounding box with positive margin |