From: John L. <jr...@us...> - 2006-12-15 00:02:18
|
Update of /cvsroot/wxlua/wxLua/apps/wxluaedit/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv728/wxLua/apps/wxluaedit/src Modified Files: wxledit.cpp wxledit.h Log Message: write message output to appropriate wxLuaShell Index: wxledit.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxluaedit/src/wxledit.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** wxledit.h 12 Dec 2006 01:23:40 -0000 1.14 --- wxledit.h 15 Dec 2006 00:02:13 -0000 1.15 *************** *** 253,258 **** --- 253,263 ---- virtual bool RecreatewxLuaState(wxEvtHandler *wxlStateEvtHandler, int win_id); + // Direct the string output of the wxLuaEvent to the given wxLuaShell virtual void OutputLuaEvent(wxLuaEvent &event, wxLuaShell *outputWin); + // Write the string to the given shell and make it visible if it's in the + // GetMsgNotebook. + virtual void WriteMessage(wxLuaShell *outputWin, const wxString& str); + // Get or adjust the child windows of this control wxSplitterWindow *GetSplitterWin() const { return m_splitter; } Index: wxledit.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/apps/wxluaedit/src/wxledit.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** wxledit.cpp 13 Dec 2006 06:57:48 -0000 1.27 --- wxledit.cpp 15 Dec 2006 00:02:13 -0000 1.28 *************** *** 643,647 **** m_luaOutput->ClearAll(); m_luaOutput->MarkerDeleteAll(wxLuaShell::markerPrompt); ! m_luaOutput->AppendText(wxT("Running lua script : ") + wxNow() + wxT("\n")); wxStopWatch stopWatch; //m_luaOutput->SetReadOnly(true); --- 643,647 ---- m_luaOutput->ClearAll(); m_luaOutput->MarkerDeleteAll(wxLuaShell::markerPrompt); ! WriteMessage(m_luaOutput, wxT("Running lua script : ") + wxNow() + wxT("\n")); wxStopWatch stopWatch; //m_luaOutput->SetReadOnly(true); *************** *** 676,681 **** m_luaOutput->SetReadOnly(false); ! m_luaOutput->AppendText(wxT("End lua script : ") + wxNow() + wxT("\n")); ! m_luaOutput->AppendText(wxString::Format(wxT("Execution time : %.3lf(s)\n"), stopWatch.Time()/1000.0)); m_luaOutput->CheckPrompt(true); --- 676,681 ---- m_luaOutput->SetReadOnly(false); ! WriteMessage(m_luaOutput, wxT("End lua script : ") + wxNow() + wxT("\n")); ! WriteMessage(m_luaOutput, wxString::Format(wxT("Execution time : %.3lf(s)\n"), stopWatch.Time()/1000.0)); m_luaOutput->CheckPrompt(true); *************** *** 788,796 **** else if (event.GetEventType() == wxEVT_LUA_PRINT) { ! outEditor->AppendText(event.GetString() + wxT("\n")); } else if (event.GetEventType() == wxEVT_LUA_ERROR) { ! outEditor->AppendText(wxT("\nErr: ") + event.GetString() + wxT("\n")); int line = event.GetLineNum(); --- 788,796 ---- else if (event.GetEventType() == wxEVT_LUA_PRINT) { ! WriteMessage(outEditor, event.GetString() + wxT("\n")); } else if (event.GetEventType() == wxEVT_LUA_ERROR) { ! WriteMessage(outEditor, wxT("\nErr: ") + event.GetString() + wxT("\n")); int line = event.GetLineNum(); *************** *** 811,812 **** --- 811,842 ---- } } + + void wxLuaConsole::WriteMessage(wxLuaShell *outputWin, const wxString& str) + { + wxCHECK_RET(outputWin, wxT("Invalid wxLuaShell to write message to.")); + + if (m_msgNotebook) + { + // the parent of the wxLuaShell is probably a splitter + wxWindow* win = outputWin; + while (win->GetParent() && (win->GetParent() != m_msgNotebook)) + 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)) + { + m_msgNotebook->SetSelection(n); + break; + } + } + } + } + + outputWin->AppendText(str); + } |