From: Nicolas Boichat Date: Tue, 27 Apr 2004 16:56:38 +0000 (+0000) Subject: wxbMainFrame : others panels are locked when a command is ran directly by typing... X-Git-Tag: Release-1.34.3~82 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c91fdea6fd688d1d923252f6430ea493dc06231d;p=bacula%2Fbacula wxbMainFrame : others panels are locked when a command is ran directly by typing in the console. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1318 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/wx-console/CHANGELOG b/bacula/src/wx-console/CHANGELOG index b972d01d2a..f05fd755aa 100644 --- a/bacula/src/wx-console/CHANGELOG +++ b/bacula/src/wx-console/CHANGELOG @@ -1,3 +1,7 @@ +27-04-2004 : + - wxbMainFrame : others panels are locked when a command is ran + directly by typing in the console. + 26-04-2004 : - Corrected a bug in Windows which causes wx-console to crash when typing quit before exiting the application. diff --git a/bacula/src/wx-console/wxbmainframe.cpp b/bacula/src/wx-console/wxbmainframe.cpp index 6d52cd0e74..333091a41a 100644 --- a/bacula/src/wx-console/wxbmainframe.cpp +++ b/bacula/src/wx-console/wxbmainframe.cpp @@ -254,6 +254,8 @@ wxbMainFrame::wxbMainFrame(const wxString& title, const wxPoint& pos, const wxSi sizer->SetSizeHints( this ); this->SetSize(size); EnableConsole(false); + + lockedbyconsole = false; } /* @@ -307,6 +309,8 @@ void wxbMainFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void wxbMainFrame::OnEnter(wxCommandEvent& WXUNUSED(event)) { + lockedbyconsole = true; + DisablePanels(); wxString str = typeCtrl->GetValue() + "\n"; Send(str); } @@ -325,6 +329,10 @@ void wxbMainFrame::OnPrint(wxbThreadEvent& event) { */ void wxbMainFrame::Print(wxString str, int status) { + if (lockedbyconsole) { + EnableConsole(false); + } + if (status == CS_TERMINATED) { SetStatusText("Console thread terminated."); ct = NULL; @@ -396,6 +404,10 @@ void wxbMainFrame::Print(wxString str, int status) } if (status == CS_END) { + if (lockedbyconsole) { + EnablePanels(); + lockedbyconsole = false; + } str = "#"; } @@ -407,6 +419,9 @@ void wxbMainFrame::Print(wxString str, int status) } consoleCtrl->AppendText(str); if (status == CS_PROMPT) { + if (lockedbyconsole) { + EnableConsole(true); + } consoleCtrl->AppendText("

"); } @@ -433,11 +448,13 @@ void wxbMainFrame::Print(wxString str, int status) */ void wxbMainFrame::Send(wxString str) { - ct->Write((const char*)str); - typeCtrl->SetValue(""); - consoleCtrl->SetDefaultStyle(wxTextAttr(*wxRED)); - consoleCtrl->AppendText(str); - consoleCtrl->ScrollLines(3); + if (ct != NULL) { + ct->Write((const char*)str); + typeCtrl->SetValue(""); + consoleCtrl->SetDefaultStyle(wxTextAttr(*wxRED)); + consoleCtrl->AppendText(str); + consoleCtrl->ScrollLines(3); + } /* if ((consoleCtrl->GetNumberOfLines()-1) > nlines) { nlines = consoleCtrl->GetNumberOfLines()-1; @@ -472,7 +489,9 @@ void wxbMainFrame::DisablePanels(void* except) { /* Enable or disable console typing */ void wxbMainFrame::EnableConsole(bool enable) { typeCtrl->Enable(enable); - typeCtrl->SetFocus(); + if (enable) { + typeCtrl->SetFocus(); + } } /* diff --git a/bacula/src/wx-console/wxbmainframe.h b/bacula/src/wx-console/wxbmainframe.h index 34c41f0063..568cd44dbb 100644 --- a/bacula/src/wx-console/wxbmainframe.h +++ b/bacula/src/wx-console/wxbmainframe.h @@ -141,6 +141,8 @@ private: static wxbMainFrame *frame; /* this */ + bool lockedbyconsole; /* true if the panels have been locked by something typed in the console */ + // any class wishing to process wxWindows events must use this macro DECLARE_EVENT_TABLE() };