+15-07-2004 :
+ - wxbHistoryTextCtrl : Created a new text control that keep an history
+ of typed commands.
+
+14-07-2004 :
+ - wxbMainFrame : Fixed config file problem when changing the default
+ configuration file (Linux)
+
03-07-2004 :
- wxbConfigPanel : Fixed ?: operator cast problem with gcc 2.95.
#
CONSSRCS = main.cpp console_thread.cpp authenticate.c console_conf.c wxbrestorepanel.cpp \
wxbmainframe.cpp wxbtableparser.cpp wxbtreectrl.cpp wxblistctrl.cpp wxbutils.cpp \
- wxbconfigpanel.cpp wxbconfigfileeditor.cpp
+ wxbconfigpanel.cpp wxbconfigfileeditor.cpp wxbhistorytextctrl.cpp
CONSOBJS = main.o console_thread.o authenticate.o console_conf.o wxbrestorepanel.o \
wxbmainframe.o wxbtableparser.o wxbtreectrl.o wxblistctrl.o wxbutils.o \
- wxbconfigpanel.o wxbconfigfileeditor.o
+ wxbconfigpanel.o wxbconfigfileeditor.o wxbhistorytextctrl.o
win32 = wx-console_private.res
general : Show nice messages boxes when errors occurs.
+wxbRestorePanel : Crashing when there is no backup to show (fresh install)
+
+GTK2 : The console control is not scrolled correctly
+
Win32 : Crash when quitting while trying to connect
Mac OS X : "You must first get a unique identifier for your application,
general : add a tab containing messages
-wxbMainFrame : Implement command history (accessible with up and down keys)
+wxbMainFrame : Implement command completion (tab)
wxbMainFrame : When an unexpected question is in this format (***? (yes/mod/no):),
show a list to choose one of these possibilities.
--- /dev/null
+/*
+ *
+ * Text control with an history of commands typed
+ *
+ * Nicolas Boichat, July 2004
+ *
+ */
+/*
+ Copyright (C) 2004 Kern Sibbald and John Walker
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "wxbhistorytextctrl.h"
+
+BEGIN_EVENT_TABLE(wxbHistoryTextCtrl, wxTextCtrl)
+ EVT_KEY_UP(wxbHistoryTextCtrl::OnKeyUp)
+END_EVENT_TABLE()
+
+wxbHistoryTextCtrl::wxbHistoryTextCtrl(wxWindow* parent, wxWindowID id,
+ const wxString& value, const wxPoint& pos,
+ const wxSize& size ,
+ const wxValidator& validator,
+ const wxString& name):
+ wxTextCtrl(parent, id, value, pos, size,
+ wxTE_PROCESS_ENTER, validator, name) {
+ index = 0;
+ history.Add("");
+}
+
+void wxbHistoryTextCtrl::HistoryAdd(wxString cmd) {
+ if (cmd == "") return;
+ index = history.Count();
+ history[index-1] = cmd;
+ history.Add("");
+}
+
+void wxbHistoryTextCtrl::OnKeyUp(wxKeyEvent& event) {
+ if (event.m_keyCode == WXK_UP) {
+ if (index > 0) {
+ if (index == (history.Count()-1)) {
+ history[index] = GetValue();
+ }
+ index--;
+ SetValue(history[index]);
+ SetInsertionPointEnd();
+ }
+ }
+ else if (event.m_keyCode == WXK_DOWN) {
+ if (index < (history.Count()-1)) {
+ index++;
+ SetValue(history[index]);
+ SetInsertionPointEnd();
+ }
+ }
+ else {
+ event.Skip();
+ }
+}
+
+
--- /dev/null
+/*
+ *
+ * Text control with an history of commands typed
+ *
+ * Nicolas Boichat, July 2004
+ *
+ */
+/*
+ Copyright (C) 2004 Kern Sibbald and John Walker
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef WXBHISTORYTEXTCTRL
+#define WXBHISTORYTEXTCTRL
+
+#include "wx/wxprec.h"
+
+#ifndef WX_PRECOMP
+ #include "wx/wx.h"
+#endif
+
+#include <wx/treectrl.h>
+
+class wxbHistoryTextCtrl: public wxTextCtrl {
+ public:
+ wxbHistoryTextCtrl(wxWindow* parent, wxWindowID id,
+ const wxString& value = "", const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxTextCtrlNameStr);
+
+ void HistoryAdd(wxString cmd);
+ private:
+ wxArrayString history;
+ int index;
+
+ void OnKeyUp(wxKeyEvent& event);
+
+ DECLARE_EVENT_TABLE();
+};
+
+#endif //WXBHISTORYTEXTCTRL
+
*
* Main frame
*
- * Nicolas Boichat, April 2004
+ * Nicolas Boichat, July 2004
*
*/
/*
consoleSizer->AddGrowableCol(0);
consoleSizer->AddGrowableRow(0);
- typeCtrl = new wxTextCtrl(consolePanel,TypeText,"",wxDefaultPosition,wxSize(200,20), wxTE_PROCESS_ENTER);
+ typeCtrl = new wxbHistoryTextCtrl(consolePanel,TypeText,"",wxDefaultPosition,wxSize(200,20));
sendButton = new wxButton(consolePanel, SendButton, "Send");
wxFlexGridSizer *typeSizer = new wxFlexGridSizer(1, 3, 0, 0);
wxYES_NO | wxICON_QUESTION, this);
if (answer == wxYES) {
wxConfigBase::Get()->Write("/ConfigFile", configfile);
+ wxConfigBase::Get()->Flush();
StartConsoleThread("");
return;
}
{
lockedbyconsole = true;
DisablePanels();
+ typeCtrl->HistoryAdd(typeCtrl->GetValue());
wxString str = typeCtrl->GetValue() + "\n";
Send(str);
}
consoleCtrl->AppendText(consoleBuffer);
consoleBuffer = "";
SetStatusText("Console thread terminated.");
+ consoleCtrl->ScrollLines(3);
ct = NULL;
DisablePanels();
int answer = wxMessageBox("Connection to the director lost. Quit program?", "Connection lost",
if (status == CS_DISCONNECTED) {
consoleCtrl->AppendText(consoleBuffer);
consoleBuffer = "";
+ consoleCtrl->ScrollLines(3);
SetStatusText("Disconnected of the director.");
DisablePanels();
return;
if (status == CS_DEBUG) {
consoleCtrl->AppendText(consoleBuffer);
consoleBuffer = "";
+ consoleCtrl->ScrollLines(3);
consoleCtrl->SetDefaultStyle(wxTextAttr(wxColour(0, 128, 0)));
}
else {
*
* Main frame header file
*
- * Nicolas Boichat, April 2004
+ * Nicolas Boichat, July 2004
*
*/
/*
#include "wxbutils.h"
+#include "wxbhistorytextctrl.h"
+
WX_DEFINE_ARRAY(wxbDataParser*, wxbDataParsers);
// ----------------------------------------------------------------------------
wxbMainFrame(const wxString& title, const wxPoint& pos, const wxSize& size, long style);
~wxbMainFrame();
+ static wxbMainFrame *frame; /* this */
+
wxMenu *menuFile;
wxNotebook *notebook; /* main notebook */
wxTextCtrl *consoleCtrl; /* wxTextCtrl containing graphical console */
- wxTextCtrl *typeCtrl; /* wxTextCtrl for console user input */
+ wxbHistoryTextCtrl *typeCtrl; /* wxbHistoryTextCtrl for console user input */
wxButton *sendButton; /* wxButton used to send data */
wxbPanel **panels; /* panels array, contained in the notebook */
wxbPromptParser* promptparser; /* prompt parser catching uncatched questions */
- static wxbMainFrame *frame; /* this */
-
bool lockedbyconsole; /* true if the panels have been locked by something typed in the console */
wxString configfile; /* configfile used */
wxString consoleBuffer; /* Buffer used to print in the console line by line */
-
+
// any class wishing to process wxWindows events must use this macro
DECLARE_EVENT_TABLE()
};