From: John L. <jr...@us...> - 2006-12-15 05:16:10
|
Update of /cvsroot/wxlua/wxLua/apps/wxluaedit/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv26340/wxLua/apps/wxluaedit/src Modified Files: wxledit.cpp wxledit.h wxluaedit.cpp Log Message: Rename wxLuaEditor's wxLuaConsole class to wxLuaIDE so it won't conflict with the wxLuaApp's wxLuaConsole allow use wxLuaConsole from wxlua app in wxluaeditor Index: wxledit.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxluaedit/src/wxledit.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** wxledit.h 15 Dec 2006 00:02:13 -0000 1.15 --- wxledit.h 15 Dec 2006 05:16:01 -0000 1.16 *************** *** 21,25 **** class WXDLLIMPEXP_WXLUA wxLuaState; class WXDLLIMPEXP_WXLUA wxLuaEvent; ! class wxLuaConsole; // Note: If you get a compilation error on the next two lines you need to --- 21,25 ---- class WXDLLIMPEXP_WXLUA wxLuaState; class WXDLLIMPEXP_WXLUA wxLuaEvent; ! class wxLuaIDE; // Note: If you get a compilation error on the next two lines you need to *************** *** 31,38 **** // we use the following macro to do a compile-time check of wxLuaEdit version #if !defined(wxCHECK_STE_VERSION) ! #error wxStEdit version is too old #endif ! #if !wxCHECK_STE_VERSION(1, 2, 0) ! #error wxStEdit version is too old #endif --- 31,38 ---- // we use the following macro to do a compile-time check of wxLuaEdit version #if !defined(wxCHECK_STE_VERSION) ! #error "wxStEdit version is too old, need at least version 1.2.4" #endif ! #if !wxCHECK_STE_VERSION(1, 2, 3) ! #error "wxStEdit version is too old, need at least version 1.2.4" #endif *************** *** 42,76 **** { // buttons ! ID_LUACON_LOAD_LUA = ID_STE__LAST + 1, ! ID_LUACON_SAVEAS_LUA, ! ID_LUACON_RUN_LUA, ! ID_LUACON_BREAK_LUA, ! ID_LUACON_SHOW_STACK, ! ID_LUACON_TOGGLE_BREAKPOINT, // windows ! ID_LUACON_EDITOR_NOTEBOOK, ! ID_LUACON_MSG_NOTEBOOK, ! ID_LUACON_SHELL, ! ID_LUACON_OUTPUT_WIN }; //----------------------------------------------------------------------------- ! // Events for the wxLuaShell and wxLuaConsole when a wxLua interpreter is // being created. You may intercept this event to adjust or run strings // to finish creating the wxLua interpreter. // // EVT_LUASHELL_wxLUA_CREATION(id, wxLuaEvent& fn) ! // EVT_LUACONSOLE_wxLUA_CREATION(id, wxLuaEvent& fn) //----------------------------------------------------------------------------- BEGIN_DECLARE_EVENT_TYPES() DECLARE_LOCAL_EVENT_TYPE(wxEVT_LUASHELL_wxLUA_CREATION, 7000) ! DECLARE_LOCAL_EVENT_TYPE(wxEVT_LUACONSOLE_wxLUA_CREATION, 7001) END_DECLARE_EVENT_TYPES() #define EVT_LUASHELL_wxLUA_CREATION(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_LUASHELL_wxLUA_CREATION, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxLuaEventFunction) & fn, (wxObject *) NULL ), ! #define EVT_LUACONSOLE_wxLUA_CREATION(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_LUACONSOLE_wxLUA_CREATION, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxLuaEventFunction) & fn, (wxObject *) NULL ), //----------------------------------------------------------------------------- --- 42,78 ---- { // buttons ! ID_WXLUAIDE_LOAD_LUA = ID_STE__LAST + 1, ! ID_WXLUAIDE_SAVEAS_LUA, ! ID_WXLUAIDE_RUN_LUA, ! ID_WXLUAIDE_BREAK_LUA, ! ID_WXLUAIDE_SHOW_STACK, ! ID_WXLUAIDE_TOGGLE_BREAKPOINT, // windows ! ID_WXLUAIDE_EDITOR_NOTEBOOK, ! ID_WXLUAIDE_MSG_NOTEBOOK, ! ID_WXLUAIDE_SHELL, ! ID_WXLUAIDE_OUTPUT_WIN, ! ! ID_WXLUAIDE__LAST }; //----------------------------------------------------------------------------- ! // Events for the wxLuaShell and wxLuaIDE when a wxLua interpreter is // being created. You may intercept this event to adjust or run strings // to finish creating the wxLua interpreter. // // EVT_LUASHELL_wxLUA_CREATION(id, wxLuaEvent& fn) ! // EVT_LUAIDE_wxLUA_CREATION(id, wxLuaEvent& fn) //----------------------------------------------------------------------------- BEGIN_DECLARE_EVENT_TYPES() DECLARE_LOCAL_EVENT_TYPE(wxEVT_LUASHELL_wxLUA_CREATION, 7000) ! DECLARE_LOCAL_EVENT_TYPE(wxEVT_LUAIDE_wxLUA_CREATION, 7001) END_DECLARE_EVENT_TYPES() #define EVT_LUASHELL_wxLUA_CREATION(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_LUASHELL_wxLUA_CREATION, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxLuaEventFunction) & fn, (wxObject *) NULL ), ! #define EVT_LUAIDE_wxLUA_CREATION(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_LUAIDE_wxLUA_CREATION, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) (wxLuaEventFunction) & fn, (wxObject *) NULL ), //----------------------------------------------------------------------------- *************** *** 103,107 **** // Get the interpreter this shell uses wxLuaState GetwxLuaState() const { return m_wxlState; } ! // Set this shell to use another interpreter, will delete it if !is_static // note shell has built in function virtual void SetwxLuaState(const wxLuaState& wxlState, bool is_static); --- 105,109 ---- // Get the interpreter this shell uses wxLuaState GetwxLuaState() const { return m_wxlState; } ! // Set this shell to use another interpreter, will close it if !is_static // note shell has built in function virtual void SetwxLuaState(const wxLuaState& wxlState, bool is_static); *************** *** 164,169 **** virtual ~wxLuaEditor() {} ! wxLuaConsole* GetwxLuaConsole() const { return m_wxluaConsole; } ! void SetwxLuaConsole(wxLuaConsole* wxluaConsole) { m_wxluaConsole = wxluaConsole; } enum mark_Type --- 166,171 ---- virtual ~wxLuaEditor() {} ! wxLuaIDE* GetwxLuaIDE() const { return m_wxluaIDE; } ! void SetwxLuaIDE(wxLuaIDE* wxluaIDE) { m_wxluaIDE = wxluaIDE; } enum mark_Type *************** *** 190,194 **** protected: ! wxLuaConsole* m_wxluaConsole; private: --- 192,196 ---- protected: ! wxLuaIDE* m_wxluaIDE; private: *************** *** 199,225 **** //----------------------------------------------------------------------------- ! // wxLuaConsole - toolbar at the top for open/save/run/stop lua programs // notebook with editors for editing lua programs // notebook with a console and an output window for above editors //----------------------------------------------------------------------------- ! enum wxLuaConsole_Styles { ! LUACON_TB_FILE = 0x0001, ! LUACON_TB_LUA = 0x0002, ! LUACON_TOOLBAR = LUACON_TB_FILE|LUACON_TB_LUA, ! LUACON_DEFAULT = LUACON_TOOLBAR }; ! class wxLuaConsole : public wxWindow { public: ! wxLuaConsole() : wxWindow() { Init(); } ! wxLuaConsole( wxWindow *parent, wxWindowID id, ! const wxPoint& pos = wxDefaultPosition, ! const wxSize& size = wxDefaultSize, ! long style = 0, ! long options = LUACON_DEFAULT, ! const wxString& name = wxT("wxLuaConsole")) : wxWindow() { Init(); --- 201,227 ---- //----------------------------------------------------------------------------- ! // wxLuaIDE - toolbar at the top for open/save/run/stop lua programs // notebook with editors for editing lua programs // notebook with a console and an output window for above editors //----------------------------------------------------------------------------- ! enum wxLuaIDE_Styles { ! WXLUAIDE_TB_FILE = 0x0001, ! WXLUAIDE_TB_LUA = 0x0002, ! WXLUAIDE_TOOLBAR = WXLUAIDE_TB_FILE|WXLUAIDE_TB_LUA, ! WXLUAIDE_DEFAULT = WXLUAIDE_TOOLBAR }; ! class wxLuaIDE : public wxWindow { public: ! wxLuaIDE() : wxWindow() { Init(); } ! wxLuaIDE( wxWindow *parent, wxWindowID id, ! const wxPoint& pos = wxDefaultPosition, ! const wxSize& size = wxDefaultSize, ! long style = 0, ! long options = WXLUAIDE_DEFAULT, ! const wxString& name = wxT("wxLuaIDE")) : wxWindow() { Init(); *************** *** 231,238 **** const wxSize& size = wxDefaultSize, long style = 0, ! long options = LUACON_DEFAULT, ! const wxString& name = wxT("wxLuaConsole")); ! virtual ~wxLuaConsole(); // Get the interpreter this shell uses --- 233,240 ---- const wxSize& size = wxDefaultSize, long style = 0, ! long options = WXLUAIDE_DEFAULT, ! const wxString& name = wxT("wxLuaIDE")); ! virtual ~wxLuaIDE(); // Get the interpreter this shell uses *************** *** 274,278 **** wxToolBar *GetToolBar() const { return m_editorOptions.GetToolBar(); } // may be NULL // add our own tools to the toolbar ! void PopulateToolBar(wxToolBar *toolBar, long options = LUACON_TOOLBAR) const; // create a "new" wxMenu to add to the menubar and popupmenu wxMenu* CreatewxLuaMenu() const; --- 276,280 ---- wxToolBar *GetToolBar() const { return m_editorOptions.GetToolBar(); } // may be NULL // add our own tools to the toolbar ! void PopulateToolBar(wxToolBar *toolBar, long options = WXLUAIDE_TOOLBAR) const; // create a "new" wxMenu to add to the menubar and popupmenu wxMenu* CreatewxLuaMenu() const; *************** *** 293,298 **** wxSTEditorNotebook *m_editorNotebook; wxSTEditorNotebook *m_msgNotebook; // bottom ! wxLuaShell *m_luaOutput; ! wxLuaShell *m_luaShell; wxToolBar *m_toolBar; // a toolbar that is a child of this wxSTEditorOptions m_editorOptions; --- 295,300 ---- wxSTEditorNotebook *m_editorNotebook; wxSTEditorNotebook *m_msgNotebook; // bottom ! wxLuaShell *m_luaOutput; // output of the editor program + shell ! wxLuaShell *m_luaShell; // user interactive shell wxToolBar *m_toolBar; // a toolbar that is a child of this wxSTEditorOptions m_editorOptions; *************** *** 309,313 **** DECLARE_EVENT_TABLE(); ! DECLARE_DYNAMIC_CLASS(wxLuaConsole); }; --- 311,315 ---- DECLARE_EVENT_TABLE(); ! DECLARE_DYNAMIC_CLASS(wxLuaIDE); }; Index: wxluaedit.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxluaedit/src/wxluaedit.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** wxluaedit.cpp 11 Dec 2006 00:09:15 -0000 1.27 --- wxluaedit.cpp 15 Dec 2006 05:16:01 -0000 1.28 *************** *** 31,34 **** --- 31,38 ---- #include "wxluadebug/include/staktree.h" + class wxLuaConsole; + + //#include "art/wxlua.xpm" get it from the lconsole + // Declare the binding initialization functions as extern so we don't have to // #include the binding header for simplicity. *************** *** 38,41 **** --- 42,46 ---- wxWindowID ID_WXLUASTATE_DEBUG = 200; + wxWindowID ID_WXLUA_CONSOLE = 201; // ---------------------------------------------------------------------------- *************** *** 65,74 **** // ---------------------------------------------------------------------------- - // resources and constants - // ---------------------------------------------------------------------------- - - #include "art/wxlua.xpm" - - // ---------------------------------------------------------------------------- // wxLuaEditorApp // ---------------------------------------------------------------------------- --- 70,73 ---- *************** *** 83,91 **** void OnLua(wxLuaEvent &event); ! void DisplayError(const wxString &strError) const; wxLuaDebugTarget *m_pDebugTarget; wxLuaState m_wxlState; wxString m_programName; private: --- 82,93 ---- void OnLua(wxLuaEvent &event); ! void DisplayMessage(const wxString &msg, bool is_error, ! const wxLuaState& wxlState = wxNullLuaState); wxLuaDebugTarget *m_pDebugTarget; wxLuaState m_wxlState; wxString m_programName; + wxLuaConsole *m_luaConsole; + bool m_want_console; private: *************** *** 93,96 **** --- 95,103 ---- }; + IMPLEMENT_APP(wxLuaEditorApp) + + #define WXLUAEDITOR_APP + #include "../../wxlua/src/lconsole.cpp" + // ---------------------------------------------------------------------------- // wxLuaEditorFrame *************** *** 114,118 **** void OnAbout(wxCommandEvent& event); ! wxLuaConsole *m_luaConsole; private: --- 121,125 ---- void OnAbout(wxCommandEvent& event); ! wxLuaIDE *m_wxluaIDE; private: *************** *** 125,130 **** // ---------------------------------------------------------------------------- - IMPLEMENT_APP(wxLuaEditorApp) - BEGIN_EVENT_TABLE(wxLuaEditorApp, wxApp) EVT_LUA_PRINT (ID_WXLUASTATE_DEBUG, wxLuaEditorApp::OnLua) --- 132,135 ---- *************** *** 137,140 **** --- 142,147 ---- m_pDebugTarget = NULL; m_programName = argv[0]; + m_luaConsole = NULL; + m_want_console = false; #if defined(__WXMSW__) && wxCHECK_VERSION(2, 3, 3) *************** *** 175,196 **** case 0: { ! wxString value; ! if (parser.Found(wxT("d"), &value)) { ! // wxLuaDebugServer::StartClient() runs wxExecute(m_programName -d[host]:[port], ...) ! ! m_wxlState = wxLuaState(this, ID_WXLUASTATE_DEBUG); ! if (!m_wxlState.Ok()) ! return false; ! // Set up for debugging ! wxString serverName(value.BeforeFirst(wxT(':'))); ! long portNumber = 0; ! if (value.AfterFirst(wxT(':')).ToLong(&portNumber)) { ! m_pDebugTarget = new wxLuaDebugTarget(m_wxlState, serverName, (int)portNumber); ! if (m_pDebugTarget != NULL) ! return m_pDebugTarget->Run(); } return false; --- 182,215 ---- case 0: { ! wxString debugString; ! if (parser.Found(wxT("d"), &debugString)) { ! // Note: wxLuaDebuggerServer::StartClient() runs ! // wxExecute(m_programName -d[host]:[port], ...) ! wxString serverName(debugString.BeforeFirst(wxT(':'))); ! if (serverName.IsEmpty()) { ! DisplayMessage(_("The wxLua debugger server host name is empty : wxLua -d[host]:[port]\n"), true); ! } ! else ! { ! long portNumber = 0; ! if (debugString.AfterFirst(wxT(':')).ToLong(&portNumber)) ! { ! m_wxlState = wxLuaState(this, ID_WXLUASTATE_DEBUG); ! if (!m_wxlState.Ok()) ! return false; ! ! m_pDebugTarget = new wxLuaDebugTarget(m_wxlState, serverName, (int)portNumber); ! if (m_pDebugTarget != NULL) ! { ! bool ok = m_pDebugTarget->Run(); ! return ok; ! } ! else ! DisplayMessage(_("The wxLua debug target cannot start.\n"), true); ! } } return false; *************** *** 235,244 **** frame->GetToolBar()->AddSeparator(); ! frame->m_luaConsole->PopulateToolBar(frame->GetToolBar(), LUACON_TB_LUA); ! frame->m_luaConsole->SetToolBar(frame->GetToolBar()); ! frame->m_luaConsole->SetMenuBar(frame->GetMenuBar()); // The size of the frame isn't set when the splitter is created, resize it ! wxSplitterWindow *splitWin = frame->m_luaConsole->GetSplitterWin(); splitWin->SetSashPosition(splitWin->GetSize().y/2); --- 254,263 ---- frame->GetToolBar()->AddSeparator(); ! frame->m_wxluaIDE->PopulateToolBar(frame->GetToolBar(), WXLUAIDE_TB_LUA); ! frame->m_wxluaIDE->SetToolBar(frame->GetToolBar()); ! frame->m_wxluaIDE->SetMenuBar(frame->GetMenuBar()); // The size of the frame isn't set when the splitter is created, resize it ! wxSplitterWindow *splitWin = frame->m_wxluaIDE->GetSplitterWin(); splitWin->SetSashPosition(splitWin->GetSize().y/2); *************** *** 282,288 **** } - #if wxCHECK_STE_VERSION(1,2,2) frame->UpdateFileTreeCtrl(); - #endif frame->Show(true); --- 301,305 ---- *************** *** 342,364 **** else if (event.GetEventType() == wxEVT_LUA_ERROR) { ! DisplayError(event.GetString()); } } ! void wxLuaEditorApp::DisplayError(const wxString &errorStr) const { ! if (m_pDebugTarget != NULL) ! m_pDebugTarget->DisplayError(errorStr); else { ! //if (m_pConsole != NULL) ! // m_pConsole->DisplayText(errorStr, true); ! //else #ifdef __WXMSW__ ! wxMessageBox(errorStr, wxT("wxLua")); #else ! fprintf(stderr, wx2lua(errorStr + wxT("\n"))); #endif // __WXMSW__ ! } } --- 359,411 ---- else if (event.GetEventType() == wxEVT_LUA_ERROR) { ! DisplayMessage(event.GetString(), true); } } ! void wxLuaEditorApp::DisplayMessage(const wxString &msg, bool is_error, ! const wxLuaState& wxlState) { ! // If they closed the console, but specified they wanted it ! // on the command-line, recreate it. ! if (m_want_console && (m_luaConsole == NULL)) ! { ! m_luaConsole = new wxLuaConsole(NULL, ID_WXLUA_CONSOLE); ! m_luaConsole->Show(true); ! } ! ! if (!is_error) ! { ! if (m_luaConsole != NULL) ! m_luaConsole->DisplayText(msg); ! else ! { ! #ifdef __WXMSW__ ! wxMessageBox(msg, wxT("wxLua Print")); ! #else ! //fprintf(stderr, wx2lua(msg + wxT("\n"))); ! wxPrintf(msg + wxT("\n")); ! #endif // __WXMSW__ ! } ! } else { ! if (m_pDebugTarget != NULL) ! m_pDebugTarget->DisplayError(msg); ! else if (m_luaConsole != NULL) ! { ! m_luaConsole->DisplayText(msg); ! m_luaConsole->SetExitOnError(is_error); ! if (wxlState.Ok()) ! m_luaConsole->DisplayStack(wxlState); ! } ! else ! { #ifdef __WXMSW__ ! wxMessageBox(msg, wxT("wxLua Error")); #else ! //fprintf(stderr, wx2lua(msg + wxT("\n"))); ! wxPrintf(msg + wxT("\n")); #endif // __WXMSW__ ! } } } *************** *** 377,381 **** { ! m_luaConsole = NULL; if (!wxSTEditorFrame::Create(NULL, wxID_ANY, title, pos, size, frame_style)) return false; --- 424,428 ---- { ! m_wxluaIDE = NULL; if (!wxSTEditorFrame::Create(NULL, wxID_ANY, title, pos, size, frame_style)) return false; *************** *** 404,412 **** m_sideSplitterWin1 = m_sideNotebook; ! m_luaConsole = new wxLuaConsole(m_sideSplitter, wxID_ANY, wxDefaultPosition, wxSize(400,300), 0, 0); ! m_steNotebook = m_luaConsole->GetEditorNotebook(); ! m_sideSplitterWin2 = m_luaConsole; ! m_sideSplitter->SplitVertically(m_sideNotebook, m_luaConsole, 150); return true; --- 451,459 ---- m_sideSplitterWin1 = m_sideNotebook; ! m_wxluaIDE = new wxLuaIDE(m_sideSplitter, wxID_ANY, wxDefaultPosition, wxSize(400,300), 0, 0); ! m_steNotebook = m_wxluaIDE->GetEditorNotebook(); ! m_sideSplitterWin2 = m_wxluaIDE; ! m_sideSplitter->SplitVertically(m_sideNotebook, m_wxluaIDE, 150); return true; *************** *** 430,437 **** { // These windows only handle these IDs ! if (focusWin == m_luaConsole->GetLuaOutputWin()) ! return m_luaConsole->GetLuaOutputWin()->HandleMenuEvent(event); ! if (focusWin == m_luaConsole->GetLuaShellWin()) ! return m_luaConsole->GetLuaShellWin()->HandleMenuEvent(event); break; --- 477,484 ---- { // These windows only handle these IDs ! if (focusWin == m_wxluaIDE->GetLuaOutputWin()) ! return m_wxluaIDE->GetLuaOutputWin()->HandleMenuEvent(event); ! if (focusWin == m_wxluaIDE->GetLuaShellWin()) ! return m_wxluaIDE->GetLuaShellWin()->HandleMenuEvent(event); break; *************** *** 442,446 **** if (!wxSTEditorFrame::HandleMenuEvent(event)) ! m_luaConsole->OnMenu(event); return true; --- 489,493 ---- if (!wxSTEditorFrame::HandleMenuEvent(event)) ! m_wxluaIDE->OnMenu(event); return true; *************** *** 461,467 **** script += wxT("msg = msg..\"Written by John Labenski\\n\\n\""); script += wxT("msg = msg..string.format(\"%s\", \"This dialog is created from a wxLua script.\")"); ! script += wxT("wx.wxMessageBox(msg, \"About wxLua Embedded\", wx.wxOK + wx.wxICON_INFORMATION)"); wxlState.RunString(script); // Equivalent code --- 508,515 ---- script += wxT("msg = msg..\"Written by John Labenski\\n\\n\""); script += wxT("msg = msg..string.format(\"%s\", \"This dialog is created from a wxLua script.\")"); ! script += wxT("wx.wxMessageBox(msg, \"About wxLua Editor\", wx.wxOK + wx.wxICON_INFORMATION)"); wxlState.RunString(script); + wxlState.Destroy(); // Equivalent code Index: wxledit.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxluaedit/src/wxledit.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** wxledit.cpp 15 Dec 2006 00:02:13 -0000 1.28 --- wxledit.cpp 15 Dec 2006 05:16:01 -0000 1.29 *************** *** 29,32 **** --- 29,34 ---- #include "wxluadebug/include/wxldebug.h" + #include "wx/stedit/stemenum.h" + #include "art/wxlua.xpm" #include "art/open.xpm" *************** *** 38,42 **** DEFINE_LOCAL_EVENT_TYPE(wxEVT_LUASHELL_wxLUA_CREATION) ! DEFINE_LOCAL_EVENT_TYPE(wxEVT_LUACONSOLE_wxLUA_CREATION) //----------------------------------------------------------------------------- --- 40,44 ---- DEFINE_LOCAL_EVENT_TYPE(wxEVT_LUASHELL_wxLUA_CREATION) ! DEFINE_LOCAL_EVENT_TYPE(wxEVT_LUAIDE_wxLUA_CREATION) //----------------------------------------------------------------------------- *************** *** 64,68 **** SetFileName(name, false); ! SetLanguage(wxT("a.lua")); return true; --- 66,70 ---- SetFileName(name, false); ! SetLanguage(wxT("a.lua")); // use the lua lexer return true; *************** *** 146,154 **** } else ! AppendText(wxT("Unsucessfully reset interpreter.\n")); } } else if (m_wxlState.Ok()) ! ret = m_wxlState.RunString(string, wxT("shell")) == 0; else AppendText(wxT("The lua interpreter is not available - try running 'reset'.\n")); --- 148,156 ---- } else ! AppendText(wxT("Unable to reset interpreter.\n")); } } else if (m_wxlState.Ok()) ! ret = m_wxlState.RunString(string, wxT("wxLuaShell")) == 0; else AppendText(wxT("The lua interpreter is not available - try running 'reset'.\n")); *************** *** 179,183 **** else if (event.GetEventType() == wxEVT_LUA_ERROR) { ! AppendText(wxT("\nErr: ") + event.GetString() + wxT("\n")); } } --- 181,185 ---- else if (event.GetEventType() == wxEVT_LUA_ERROR) { ! AppendText(wxT("\nError: ") + event.GetString() + wxT("\n")); } } *************** *** 187,193 **** bool is_running = m_wxlState.Ok() && m_wxlState.IsRunning(); ! wxSTEditorMenuManager::DoEnableItem(menu, menuBar, toolBar, ID_LUACON_RUN_LUA, !is_running); ! wxSTEditorMenuManager::DoEnableItem(menu, menuBar, toolBar, ID_LUACON_BREAK_LUA, is_running); ! wxSTEditorMenuManager::DoEnableItem(menu, menuBar, toolBar, ID_LUACON_SHOW_STACK, m_wxlState.Ok()); wxSTEditor::UpdateItems(menu, menuBar, toolBar); --- 189,195 ---- bool is_running = m_wxlState.Ok() && m_wxlState.IsRunning(); ! wxSTEditorMenuManager::DoEnableItem(menu, menuBar, toolBar, ID_WXLUAIDE_RUN_LUA, !is_running); ! wxSTEditorMenuManager::DoEnableItem(menu, menuBar, toolBar, ID_WXLUAIDE_BREAK_LUA, is_running); ! wxSTEditorMenuManager::DoEnableItem(menu, menuBar, toolBar, ID_WXLUAIDE_SHOW_STACK, m_wxlState.Ok()); wxSTEditor::UpdateItems(menu, menuBar, toolBar); *************** *** 201,210 **** BEGIN_EVENT_TABLE(wxLuaEditor, wxSTEditor) EVT_STC_MARGINCLICK(wxID_ANY, wxLuaEditor::OnMarginClick) ! EVT_MENU(ID_LUACON_TOGGLE_BREAKPOINT, wxLuaEditor::OnMenu) END_EVENT_TABLE() void wxLuaEditor::Init() { ! m_wxluaConsole = NULL; } --- 203,212 ---- BEGIN_EVENT_TABLE(wxLuaEditor, wxSTEditor) EVT_STC_MARGINCLICK(wxID_ANY, wxLuaEditor::OnMarginClick) ! EVT_MENU(ID_WXLUAIDE_TOGGLE_BREAKPOINT, wxLuaEditor::OnMenu) END_EVENT_TABLE() void wxLuaEditor::Init() { ! m_wxluaIDE = NULL; } *************** *** 245,249 **** switch (event.GetId()) { ! case ID_LUACON_TOGGLE_BREAKPOINT : { if (HasBreakpoint(line)) --- 247,251 ---- switch (event.GetId()) { ! case ID_WXLUAIDE_TOGGLE_BREAKPOINT : { if (HasBreakpoint(line)) *************** *** 280,284 **** void wxLuaEditor::AddBreakpoint(int line) { ! if (HasBreakpoint(line) || (line<0) || (line>GetLineCount())) return; --- 282,286 ---- void wxLuaEditor::AddBreakpoint(int line) { ! if ((line < 0) || (line > GetLineCount()) || HasBreakpoint(line)) return; *************** *** 296,307 **** { wxLuaState wxlState; ! if (GetwxLuaConsole()) ! wxlState = GetwxLuaConsole()->GetwxLuaState(); bool is_running = wxlState.Ok() && wxlState.IsRunning(); ! wxSTEditorMenuManager::DoEnableItem(menu, menuBar, toolBar, ID_LUACON_RUN_LUA, !is_running); ! wxSTEditorMenuManager::DoEnableItem(menu, menuBar, toolBar, ID_LUACON_BREAK_LUA, is_running); ! wxSTEditorMenuManager::DoEnableItem(menu, menuBar, toolBar, ID_LUACON_SHOW_STACK, wxlState.Ok()); wxSTEditor::UpdateItems(menu, menuBar, toolBar); --- 298,309 ---- { wxLuaState wxlState; ! if (GetwxLuaIDE()) ! wxlState = GetwxLuaIDE()->GetwxLuaState(); bool is_running = wxlState.Ok() && wxlState.IsRunning(); ! wxSTEditorMenuManager::DoEnableItem(menu, menuBar, toolBar, ID_WXLUAIDE_RUN_LUA, !is_running); ! wxSTEditorMenuManager::DoEnableItem(menu, menuBar, toolBar, ID_WXLUAIDE_BREAK_LUA, is_running); ! wxSTEditorMenuManager::DoEnableItem(menu, menuBar, toolBar, ID_WXLUAIDE_SHOW_STACK, wxlState.Ok()); wxSTEditor::UpdateItems(menu, menuBar, toolBar); *************** *** 309,334 **** //----------------------------------------------------------------------------- ! // wxLuaConsole //----------------------------------------------------------------------------- ! IMPLEMENT_DYNAMIC_CLASS(wxLuaConsole, wxWindow); ! BEGIN_EVENT_TABLE(wxLuaConsole, wxWindow) ! EVT_MENU(ID_LUACON_LOAD_LUA, wxLuaConsole::OnMenu) ! EVT_MENU(ID_LUACON_SAVEAS_LUA, wxLuaConsole::OnMenu) ! EVT_MENU(ID_LUACON_RUN_LUA, wxLuaConsole::OnMenu) ! EVT_MENU(ID_LUACON_BREAK_LUA, wxLuaConsole::OnMenu) ! EVT_MENU(ID_LUACON_SHOW_STACK, wxLuaConsole::OnMenu) ! EVT_STS_CREATE_EDITOR(wxID_ANY, wxLuaConsole::OnCreateEditor) ! EVT_SIZE (wxLuaConsole::OnSize) ! EVT_LUA_PRINT (wxID_ANY, wxLuaConsole::OnLua) ! EVT_LUA_ERROR (wxID_ANY, wxLuaConsole::OnLua) ! EVT_LUA_DEBUG_HOOK (wxID_ANY, wxLuaConsole::OnLua) END_EVENT_TABLE() ! void wxLuaConsole::Init() { m_wxlstate_static = false; --- 311,336 ---- //----------------------------------------------------------------------------- ! // wxLuaIDE //----------------------------------------------------------------------------- ! IMPLEMENT_DYNAMIC_CLASS(wxLuaIDE, wxWindow); ! BEGIN_EVENT_TABLE(wxLuaIDE, wxWindow) ! EVT_MENU(ID_WXLUAIDE_LOAD_LUA, wxLuaIDE::OnMenu) ! EVT_MENU(ID_WXLUAIDE_SAVEAS_LUA, wxLuaIDE::OnMenu) ! EVT_MENU(ID_WXLUAIDE_RUN_LUA, wxLuaIDE::OnMenu) ! EVT_MENU(ID_WXLUAIDE_BREAK_LUA, wxLuaIDE::OnMenu) ! EVT_MENU(ID_WXLUAIDE_SHOW_STACK, wxLuaIDE::OnMenu) ! EVT_STS_CREATE_EDITOR(wxID_ANY, wxLuaIDE::OnCreateEditor) ! EVT_SIZE(wxLuaIDE::OnSize) ! EVT_LUA_PRINT (wxID_ANY, wxLuaIDE::OnLua) ! EVT_LUA_ERROR (wxID_ANY, wxLuaIDE::OnLua) ! EVT_LUA_DEBUG_HOOK (wxID_ANY, wxLuaIDE::OnLua) END_EVENT_TABLE() ! void wxLuaIDE::Init() { m_wxlstate_static = false; *************** *** 345,351 **** } ! bool wxLuaConsole::Create( wxWindow *parent, int id, ! const wxPoint& pos, const wxSize& size, ! long style, long options, const wxString& name) { m_options = options; --- 347,353 ---- } ! bool wxLuaIDE::Create( wxWindow *parent, int id, ! const wxPoint& pos, const wxSize& size, ! long style, long options, const wxString& name) { m_options = options; *************** *** 354,362 **** return false; ! if ((m_options & LUACON_TOOLBAR) != 0) { m_toolBar = new wxToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize); PopulateToolBar(m_toolBar, m_options); ! wxSTEditorMenuManager::DoEnableItem(NULL, GetMenuBar(), GetToolBar(), ID_LUACON_BREAK_LUA, false); } --- 356,364 ---- return false; ! if ((m_options & WXLUAIDE_TOOLBAR) != 0) { m_toolBar = new wxToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize); PopulateToolBar(m_toolBar, m_options); ! wxSTEditorMenuManager::DoEnableItem(NULL, GetMenuBar(), GetToolBar(), ID_WXLUAIDE_BREAK_LUA, false); } *************** *** 373,377 **** m_editorOptions.LoadConfig(*wxConfigBase::Get(false)); ! m_editorNotebook = new wxSTEditorNotebook(m_splitter, ID_LUACON_EDITOR_NOTEBOOK, wxDefaultPosition, wxSize(200,100), wxCLIP_CHILDREN); m_editorNotebook->CreateOptions(m_editorOptions); --- 375,379 ---- m_editorOptions.LoadConfig(*wxConfigBase::Get(false)); ! m_editorNotebook = new wxSTEditorNotebook(m_splitter, ID_WXLUAIDE_EDITOR_NOTEBOOK, wxDefaultPosition, wxSize(200,100), wxCLIP_CHILDREN); m_editorNotebook->CreateOptions(m_editorOptions); *************** *** 392,396 **** m_shellOptions.SetEditorPopupMenu(wxSTEditorMenuManager(0, 0, STE_MENU_EDIT_CUTCOPYPASTE).CreateEditMenu(), false); m_shellOptions.SetToolBar(m_toolBar); ! m_msgNotebook = new wxSTEditorNotebook(m_splitter, ID_LUACON_MSG_NOTEBOOK, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN); m_msgNotebook->CreateOptions(m_shellOptions); --- 394,398 ---- m_shellOptions.SetEditorPopupMenu(wxSTEditorMenuManager(0, 0, STE_MENU_EDIT_CUTCOPYPASTE).CreateEditMenu(), false); m_shellOptions.SetToolBar(m_toolBar); ! m_msgNotebook = new wxSTEditorNotebook(m_splitter, ID_WXLUAIDE_MSG_NOTEBOOK, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN); m_msgNotebook->CreateOptions(m_shellOptions); *************** *** 399,403 **** wxDefaultPosition, wxDefaultSize, wxSP_3D); steSplitter->CreateOptions(m_shellOptions); ! m_luaShell = new wxLuaShell(steSplitter, ID_LUACON_SHELL, wxDefaultPosition, wxDefaultSize, 0); m_luaShell->CreateOptions(m_shellOptions); --- 401,405 ---- wxDefaultPosition, wxDefaultSize, wxSP_3D); steSplitter->CreateOptions(m_shellOptions); ! m_luaShell = new wxLuaShell(steSplitter, ID_WXLUAIDE_SHELL, wxDefaultPosition, wxDefaultSize, 0); m_luaShell->CreateOptions(m_shellOptions); *************** *** 409,416 **** steSplitter = new wxSTEditorSplitter(m_msgNotebook, wxID_ANY, ! wxDefaultPosition, wxDefaultSize, wxSP_3D); steSplitter->CreateOptions(m_shellOptions); ! m_luaOutput = new wxLuaShell(steSplitter, ID_LUACON_OUTPUT_WIN, ! wxDefaultPosition, wxDefaultSize, 0); m_luaOutput->CreateOptions(m_shellOptions); steSplitter->Initialize(m_luaOutput); --- 411,418 ---- steSplitter = new wxSTEditorSplitter(m_msgNotebook, wxID_ANY, ! wxDefaultPosition, wxDefaultSize, wxSP_3D); steSplitter->CreateOptions(m_shellOptions); ! m_luaOutput = new wxLuaShell(steSplitter, ID_WXLUAIDE_OUTPUT_WIN, ! wxDefaultPosition, wxDefaultSize, 0); m_luaOutput->CreateOptions(m_shellOptions); steSplitter->Initialize(m_luaOutput); *************** *** 428,432 **** } ! wxLuaConsole::~wxLuaConsole() { if (m_wxlState.Ok()) --- 430,434 ---- } ! wxLuaIDE::~wxLuaIDE() { if (m_wxlState.Ok()) *************** *** 436,440 **** } ! void wxLuaConsole::OnSize(wxSizeEvent& event) { event.Skip(); --- 438,442 ---- } ! void wxLuaIDE::OnSize(wxSizeEvent& event) { event.Skip(); *************** *** 462,466 **** } ! void wxLuaConsole::SetMenuBar(wxMenuBar *menuBar) { m_editorOptions.SetMenuBar(menuBar); --- 464,468 ---- } ! void wxLuaIDE::SetMenuBar(wxMenuBar *menuBar) { m_editorOptions.SetMenuBar(menuBar); *************** *** 474,481 **** if (!m_wxlState.Ok() || !m_wxlState.IsRunning()) ! wxSTEditorMenuManager::DoEnableItem(NULL, GetMenuBar(), GetToolBar(), ID_LUACON_BREAK_LUA, false); } ! void wxLuaConsole::SetToolBar(wxToolBar *toolBar) { m_editorOptions.SetToolBar(toolBar); --- 476,483 ---- if (!m_wxlState.Ok() || !m_wxlState.IsRunning()) ! wxSTEditorMenuManager::DoEnableItem(NULL, GetMenuBar(), GetToolBar(), ID_WXLUAIDE_BREAK_LUA, false); } ! void wxLuaIDE::SetToolBar(wxToolBar *toolBar) { m_editorOptions.SetToolBar(toolBar); *************** *** 485,528 **** if (!m_wxlState.Ok() || !m_wxlState.IsRunning()) ! wxSTEditorMenuManager::DoEnableItem(NULL, GetMenuBar(), GetToolBar(), ID_LUACON_BREAK_LUA, false); } ! void wxLuaConsole::PopulateToolBar(wxToolBar *toolBar, long options) const { bool add_sep = false; ! if ((options & LUACON_TB_FILE) != 0) { ! toolBar->AddTool( ID_LUACON_LOAD_LUA, wxT("Open file"), wxBitmap(open_xpm), wxT("Open lua program") ); ! toolBar->AddTool( ID_LUACON_SAVEAS_LUA, wxT("Save as..."), wxBitmap(save_xpm), wxT("Save lua program") ); add_sep = true; } ! if ((options & LUACON_TB_LUA) != 0) { if (add_sep) toolBar->AddSeparator(); ! toolBar->AddTool( ID_LUACON_RUN_LUA, wxT("Run wxLua program"), wxBitmap(play_xpm), wxT("Run the wxLua program") ); ! toolBar->AddTool( ID_LUACON_BREAK_LUA, wxT("Stop wxLua program"), wxBitmap(stop_xpm), wxT("Stop the running wxLua program") ); toolBar->AddSeparator(); ! toolBar->AddTool( ID_LUACON_SHOW_STACK, wxT("Show stack tree"), wxBitmap(LUA_xpm), wxT("Show the lua stack tree") ); } toolBar->Realize(); } ! #include "wx/stedit/stemenum.h" ! wxMenu* wxLuaConsole::CreatewxLuaMenu() const { wxSTEditorMenuManager s; wxMenu *wxluaMenu = new wxMenu(); ! wxluaMenu->Append(s.MenuItem(wxluaMenu, ID_LUACON_RUN_LUA, wxT("&Run wxLua program"), wxT("Run the wxLua program") , wxITEM_NORMAL, wxBitmap(play_xpm))); ! wxluaMenu->Append(s.MenuItem(wxluaMenu, ID_LUACON_BREAK_LUA, wxT("&Stop wxLua program"), wxT("Stop the running wxLua program") , wxITEM_NORMAL, wxBitmap(stop_xpm))); wxluaMenu->AppendSeparator(); ! wxluaMenu->Append(s.MenuItem(wxluaMenu, ID_LUACON_SHOW_STACK, wxT("Stack &tree"), wxT("Show the lua stack tree") , wxITEM_NORMAL, wxBitmap(LUA_xpm))); wxluaMenu->AppendSeparator(); ! wxluaMenu->Append(ID_LUACON_TOGGLE_BREAKPOINT, wxT("&Toggle breakpoint")); return wxluaMenu; } ! void wxLuaConsole::SetwxLuaState(const wxLuaState& wxlState, bool is_static) { if (m_wxlState.Ok() && !m_wxlstate_static) --- 487,529 ---- if (!m_wxlState.Ok() || !m_wxlState.IsRunning()) ! wxSTEditorMenuManager::DoEnableItem(NULL, GetMenuBar(), GetToolBar(), ID_WXLUAIDE_BREAK_LUA, false); } ! void wxLuaIDE::PopulateToolBar(wxToolBar *toolBar, long options) const { bool add_sep = false; ! if ((options & WXLUAIDE_TB_FILE) != 0) { ! toolBar->AddTool( ID_WXLUAIDE_LOAD_LUA, wxT("Open file"), wxBitmap(open_xpm), wxT("Open lua program") ); ! toolBar->AddTool( ID_WXLUAIDE_SAVEAS_LUA, wxT("Save as..."), wxBitmap(save_xpm), wxT("Save lua program") ); add_sep = true; } ! if ((options & WXLUAIDE_TB_LUA) != 0) { if (add_sep) toolBar->AddSeparator(); ! toolBar->AddTool( ID_WXLUAIDE_RUN_LUA, wxT("Run wxLua program"), wxBitmap(play_xpm), wxT("Run the wxLua program") ); ! toolBar->AddTool( ID_WXLUAIDE_BREAK_LUA, wxT("Stop wxLua program"), wxBitmap(stop_xpm), wxT("Stop the running wxLua program") ); toolBar->AddSeparator(); ! toolBar->AddTool( ID_WXLUAIDE_SHOW_STACK, wxT("Show stack tree"), wxBitmap(LUA_xpm), wxT("Show the lua stack tree") ); } toolBar->Realize(); } ! wxMenu* wxLuaIDE::CreatewxLuaMenu() const { wxSTEditorMenuManager s; wxMenu *wxluaMenu = new wxMenu(); ! wxluaMenu->Append(s.MenuItem(wxluaMenu, ID_WXLUAIDE_RUN_LUA, wxT("&Run wxLua program"), wxT("Run the wxLua program") , wxITEM_NORMAL, wxBitmap(play_xpm))); ! wxluaMenu->Append(s.MenuItem(wxluaMenu, ID_WXLUAIDE_BREAK_LUA, wxT("&Stop wxLua program"), wxT("Stop the running wxLua program") , wxITEM_NORMAL, wxBitmap(stop_xpm))); wxluaMenu->AppendSeparator(); ! wxluaMenu->Append(s.MenuItem(wxluaMenu, ID_WXLUAIDE_SHOW_STACK, wxT("Stack &tree"), wxT("Show the lua stack tree") , wxITEM_NORMAL, wxBitmap(LUA_xpm))); wxluaMenu->AppendSeparator(); ! wxluaMenu->Append(ID_WXLUAIDE_TOGGLE_BREAKPOINT, wxT("&Toggle breakpoint")); return wxluaMenu; } ! void wxLuaIDE::SetwxLuaState(const wxLuaState& wxlState, bool is_static) { if (m_wxlState.Ok() && !m_wxlstate_static) *************** *** 531,535 **** m_wxlState.DebugHookBreak(); ! m_wxlState.Destroy(); } --- 532,537 ---- m_wxlState.DebugHookBreak(); ! m_wxlState.CloseLuaState(true); // force closing it since we own it ! m_wxlState.Destroy(); // unref it so it's invalid } *************** *** 538,544 **** } ! bool wxLuaConsole::RecreatewxLuaState(wxEvtHandler *wxlStateEvtHandler, int win_id) { ! wxLuaEvent event(wxEVT_LUACONSOLE_wxLUA_CREATION, GetId(), wxNullLuaState); event.SetEventObject(this); event.SetInt(0); --- 540,546 ---- } ! bool wxLuaIDE::RecreatewxLuaState(wxEvtHandler *wxlStateEvtHandler, int win_id) { ! wxLuaEvent event(wxEVT_LUAIDE_wxLUA_CREATION, GetId(), wxNullLuaState); event.SetEventObject(this); event.SetInt(0); *************** *** 558,562 **** } ! void wxLuaConsole::OnCreateEditor(wxCommandEvent &event) { wxWindow *win = (wxWindow*)event.GetEventObject(); --- 560,564 ---- } ! void wxLuaIDE::OnCreateEditor(wxCommandEvent &event) { wxWindow *win = (wxWindow*)event.GetEventObject(); *************** *** 564,572 **** wxDefaultPosition, wxDefaultSize, 0); editor->CreateOptions(m_editorOptions); ! editor->SetwxLuaConsole(this); event.SetEventObject(editor); } ! void wxLuaConsole::OnMenu(wxCommandEvent &event) { //wxSTERecursionGuard guard(m_rGuard_OnMenu); can't have for BREAK --- 566,574 ---- wxDefaultPosition, wxDefaultSize, 0); editor->CreateOptions(m_editorOptions); ! editor->SetwxLuaIDE(this); event.SetEventObject(editor); } ! void wxLuaIDE::OnMenu(wxCommandEvent &event) { //wxSTERecursionGuard guard(m_rGuard_OnMenu); can't have for BREAK *************** *** 577,581 **** } ! bool wxLuaConsole::HandleMenuEvent(wxCommandEvent& event) { //wxSTERecursionGuard guard(m_rGuard_HandleMenuEvent); can't have for BREAK --- 579,583 ---- } ! bool wxLuaIDE::HandleMenuEvent(wxCommandEvent& event) { //wxSTERecursionGuard guard(m_rGuard_HandleMenuEvent); can't have for BREAK *************** *** 587,591 **** switch(event.GetId()) { ! case ID_LUACON_LOAD_LUA : { wxString filename = editor->GetFileName(); --- 589,593 ---- switch(event.GetId()) { ! case ID_WXLUAIDE_LOAD_LUA : { wxString filename = editor->GetFileName(); *************** *** 612,621 **** return true; } ! case ID_LUACON_SAVEAS_LUA : { editor->SaveFile(true); return true; } ! case ID_LUACON_RUN_LUA : { wxString program = editor->GetText(); --- 614,623 ---- return true; } ! case ID_WXLUAIDE_SAVEAS_LUA : { editor->SaveFile(true); return true; } ! case ID_WXLUAIDE_RUN_LUA : { wxString program = editor->GetText(); *************** *** 634,640 **** wxCHECK_MSG(RecreatewxLuaState(GetEventHandler(), editor->GetId()), true, wxT("Can't recreate lua interpreter")); ! wxSTEditorMenuManager::DoEnableItem(NULL, GetMenuBar(), GetToolBar(), ID_LUACON_RUN_LUA, false); ! wxSTEditorMenuManager::DoEnableItem(NULL, GetMenuBar(), GetToolBar(), ID_LUACON_BREAK_LUA, true); ! wxSTEditorMenuManager::DoEnableItem(NULL, GetMenuBar(), GetToolBar(), ID_LUACON_SHOW_STACK, false); editor->MarkerDeleteAll(wxLuaEditor::markerError); --- 636,642 ---- wxCHECK_MSG(RecreatewxLuaState(GetEventHandler(), editor->GetId()), true, wxT("Can't recreate lua interpreter")); ! wxSTEditorMenuManager::DoEnableItem(NULL, GetMenuBar(), GetToolBar(), ID_WXLUAIDE_RUN_LUA, false); ! wxSTEditorMenuManager::DoEnableItem(NULL, GetMenuBar(), GetToolBar(), ID_WXLUAIDE_BREAK_LUA, true); ! wxSTEditorMenuManager::DoEnableItem(NULL, GetMenuBar(), GetToolBar(), ID_WXLUAIDE_SHOW_STACK, false); editor->MarkerDeleteAll(wxLuaEditor::markerError); *************** *** 681,691 **** m_luaOutput->CheckPrompt(true); ! wxSTEditorMenuManager::DoEnableItem(NULL, GetMenuBar(), GetToolBar(), ID_LUACON_RUN_LUA, true); ! wxSTEditorMenuManager::DoEnableItem(NULL, GetMenuBar(), GetToolBar(), ID_LUACON_BREAK_LUA, false); ! wxSTEditorMenuManager::DoEnableItem(NULL, GetMenuBar(), GetToolBar(), ID_LUACON_SHOW_STACK, true); return true; } ! case ID_LUACON_BREAK_LUA : { if (m_wxlState.Ok() && m_wxlState.IsRunning()) --- 683,693 ---- m_luaOutput->CheckPrompt(true); ! wxSTEditorMenuManager::DoEnableItem(NULL, GetMenuBar(), GetToolBar(), ID_WXLUAIDE_RUN_LUA, true); ! wxSTEditorMenuManager::DoEnableItem(NULL, GetMenuBar(), GetToolBar(), ID_WXLUAIDE_BREAK_LUA, false); ! wxSTEditorMenuManager::DoEnableItem(NULL, GetMenuBar(), GetToolBar(), ID_WXLUAIDE_SHOW_STACK, true); return true; } ! case ID_WXLUAIDE_BREAK_LUA : { if (m_wxlState.Ok() && m_wxlState.IsRunning()) *************** *** 700,704 **** return true; } ! case ID_LUACON_SHOW_STACK : { m_show_stack = true; --- 702,706 ---- return true; } ! case ID_WXLUAIDE_SHOW_STACK : { m_show_stack = true; *************** *** 746,750 **** } ! void wxLuaConsole::OnLua(wxLuaEvent &event) { wxLuaShell *outEditor = NULL; --- 748,752 ---- } ! void wxLuaIDE::OnLua(wxLuaEvent &event) { wxLuaShell *outEditor = NULL; *************** *** 758,768 **** } ! void wxLuaConsole::OutputLuaEvent(wxLuaEvent &event, wxLuaShell *outEditor) { // perhaps there was an error at startup, but editor isn't created yet if (outEditor == NULL) - { return; - } if (event.GetEventType() == wxEVT_LUA_DEBUG_HOOK) --- 760,768 ---- } ! void wxLuaIDE::OutputLuaEvent(wxLuaEvent &event, wxLuaShell *outEditor) { // perhaps there was an error at startup, but editor isn't created yet if (outEditor == NULL) return; if (event.GetEventType() == wxEVT_LUA_DEBUG_HOOK) *************** *** 792,799 **** else if (event.GetEventType() == wxEVT_LUA_ERROR) { ! WriteMessage(outEditor, wxT("\nErr: ") + event.GetString() + wxT("\n")); int line = event.GetLineNum(); // Put a marker where the error occurred if ((line >= 0) && (event.GetwxLuaState() == m_wxlState)) --- 792,803 ---- else if (event.GetEventType() == wxEVT_LUA_ERROR) { ! WriteMessage(outEditor, wxT("\nError: ") + event.GetString() + wxT("\n")); int line = event.GetLineNum(); + // the user generated an error from running something in the shell + if (event.GetString().Find(wxT("[string \"wxLuaShell\"]")) != wxNOT_FOUND) + line = -1; + // Put a marker where the error occurred if ((line >= 0) && (event.GetwxLuaState() == m_wxlState)) *************** *** 812,819 **** } ! void wxLuaConsole::WriteMessage(wxLuaShell *outputWin, const wxString& str) { wxCHECK_RET(outputWin, wxT("Invalid wxLuaShell to write message to.")); if (m_msgNotebook) { --- 816,834 ---- } ! void wxLuaIDE::WriteMessage(wxLuaShell *outputWin, const wxString& str) { wxCHECK_RET(outputWin, wxT("Invalid wxLuaShell to write message to.")); + // try to turn the message notebook page to show the message + if (m_msgNotebook) + { + int sel = m_msgNotebook->GetSelection(); + if ((outputWin->GetId() == ID_WXLUAIDE_SHELL) && (sel != 0)) + m_msgNotebook->SetSelection(0); + if ((outputWin->GetId() == ID_WXLUAIDE_OUTPUT_WIN) && (sel != 1)) + m_msgNotebook->SetSelection(1); + } + + /* if (m_msgNotebook) { *************** *** 823,832 **** win = win->GetParent(); ! int sel = GetMsgNotebook()->GetSelection(); ! if (win && ((sel < 0) || (GetMsgNotebook()->GetPage(sel) != win))) { ! int count = m_msgNotebook->GetPageCount(); ! for (int n = 0; n < count; n++) { if ((n != sel) && (m_msgNotebook->GetPage(n) == win)) --- 838,847 ---- win = win->GetParent(); ! int sel = m_msgNotebook->GetSelection(); ! if (win && ((sel < 0) || (m_msgNotebook->GetPage(sel) != win))) { ! int n, count = m_msgNotebook->GetPageCount(); ! for (n = 0; n < count; n++) { if ((n != sel) && (m_msgNotebook->GetPage(n) == win)) *************** *** 838,841 **** --- 853,857 ---- } } + */ outputWin->AppendText(str); |