]> git.sur5r.net Git - bacula/bacula/commitdiff
wxbMainFrame : others panels are locked when a command is ran directly by typing...
authorNicolas Boichat <nicolas@boichat.ch>
Tue, 27 Apr 2004 16:56:38 +0000 (16:56 +0000)
committerNicolas Boichat <nicolas@boichat.ch>
Tue, 27 Apr 2004 16:56:38 +0000 (16:56 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1318 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/wx-console/CHANGELOG
bacula/src/wx-console/wxbmainframe.cpp
bacula/src/wx-console/wxbmainframe.h

index b972d01d2a8c9faafc0a58b0cf4ab448e5f501d4..f05fd755aa426475da3dfa69c562f9b0016a4255 100644 (file)
@@ -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.
index 6d52cd0e747b830c829fc1f2004f758ce2df2939..333091a41a2b4b88d47cc5ad8aa83399be6ed320 100644 (file)
@@ -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("<P>");
    }
    
@@ -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();
+   }
 }
 
 /*
index 34c41f00638694ea76cb1db7d288f074244144f3..568cd44dbbb13bab604f9599c22132d1aa0e980f 100644 (file)
@@ -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()
 };