]> Creatis software - bbtk.git/blob - kernel/src/bbtkWxConsole.cxx
Create Black Box bbs + .bat + Bug interface Windows
[bbtk.git] / kernel / src / bbtkWxConsole.cxx
1 /*=========================================================================
2                                                                                 
3   Program:   bbtk
4   Module:    $RCSfile: bbtkWxConsole.cxx,v $
5   Language:  C++
6   Date:      $Date: 2008/03/17 07:04:08 $
7   Version:   $Revision: 1.14 $
8                                                                                 
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details.
12                                                                                 
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16                                                                                 
17 =========================================================================*//**
18  * \brief Short description in one line
19  * 
20  * Long description which 
21  * can span multiple lines
22  */
23 /**
24  * \file 
25  * \brief 
26  */
27 /**
28  * \class bbtk::
29  * \brief 
30  */
31
32
33 #ifdef _USE_WXWIDGETS_
34
35 #include <iostream>     
36 #include "bbtkWxConsole.h"
37 #include "bbtkWxBlackBox.h"
38 #include "bbtkConfigurationFile.h"
39
40 namespace bbtk
41 {
42
43 // On Windows when compiling a dll, wx prevents the compilation
44 // of the class wxStreamToTextRedirector (why ? it is a nightmare...)
45 // The blocking symbol is wxHAS_TEXT_WINDOW_STREAM.
46 // Note also that wxStreamToTextRedirector use the fact that wx is 
47 // compiled with the option WX_USE_STD_STREAMS in which case 
48 // wxTextCtrl inherits from std::streambuf and the redirection 
49 // can be done simply by setting the std::cout buffer to the 
50 // one of the wxTextCtrl. 
51 // So on windows, we have to redirect manually std::cout to mwxTextHistory.  
52 // Finally, on all systems we made our redirection class to redirect both to
53 // the WxConsole and to printf in order to get a console trace when 
54 // the appli crashes (we could also imagine to log in a file...)
55 // This is why we finally wrote our own redirection which is crossplatform
56 // (drawback : not optimal on Unix platform; we could think of 
57 // a particular implementation...).
58
59   //================================================================
60   /// Redirects std::cout to a wxTextCtrl and optionally to printf also
61   class WxTextCtrlStreamRedirector   : public std::streambuf
62   {       
63     
64   public:
65     
66  
67     WxTextCtrlStreamRedirector(std::ostream& redirect,
68                                  wxTextCtrl *text, 
69                                  const wxColour& colour = *wxBLACK,
70                                  bool doprintf=true,
71                                  int bufferSize=1000)
72       : mText(text),
73         mPrintf(doprintf),
74         m_ostr(redirect),
75         mColour(colour)
76     {
77       if (bufferSize)
78         {
79           char *ptr = new char[bufferSize];
80           setp(ptr, ptr + bufferSize);
81         }
82       else
83         setp(0, 0);
84       
85       m_sbufOld = m_ostr.rdbuf();
86       m_ostr.rdbuf(this);
87     }
88     
89     ~WxTextCtrlStreamRedirector()
90     {
91       sync();
92       delete[] pbase();
93       m_ostr.rdbuf(m_sbufOld);
94     }
95   
96    virtual void writeString(const std::string &str) 
97     {
98       const wxTextAttr& style = mText->GetDefaultStyle();
99       mText->SetDefaultStyle(mColour);
100       mText->AppendText(std2wx(str));
101       mText->SetDefaultStyle(style);
102      
103       if (mPrintf) 
104         {
105           printf("%s",str.c_str());
106         }
107     }
108     
109   
110   private:
111     wxTextCtrl* mText;
112     // 
113     bool mPrintf;
114     // the stream we're redirecting
115     std::ostream&   m_ostr;
116     // the old streambuf (before we changed it)
117     std::streambuf *m_sbufOld;
118     //
119     wxColour mColour;
120     
121   private:
122     int overflow(int c)
123     {
124       sync();
125       
126       if (c != EOF)
127         {
128           if (pbase() == epptr())
129             {
130               std::string temp;
131               temp += char(c);
132               writeString(temp);
133             }
134           else
135             sputc(c);
136         }
137       
138       return 0;
139     }
140     
141     int sync()
142     {
143       if (pbase() != pptr())
144         {
145           int len = int(pptr() - pbase());
146           std::string temp(pbase(), len);
147           writeString(temp);
148           setp(pbase(), epptr());
149         }
150       return 0;
151     }
152   };
153   //================================================================
154
155   
156   
157   //================================================================
158   WxConsole::WxConsole( wxWindow *parent, wxString title, wxSize size)
159     : wxFrame((wxFrame *)parent, -1, title, wxDefaultPosition, size)
160   {     
161 //    m_mgr = new wxAuiManager(this);
162         m_mgr.SetManagedWindow(this);
163    
164     mInterpreter = new bbtk::Interpreter();
165     mInterpreter->SetWxConsole(this);
166     mInterpreter->SetCommandLine(true);
167     //==============
168     // Menu
169     wxInitAllImageHandlers();
170     
171     wxMenu *menuFile = new wxMenu;
172     menuFile->Append( ID_Menu_Quit, _T("&Quit") );
173     
174     wxMenu *menuAbout = new wxMenu;
175     menuAbout->Append( ID_Menu_About, _T("&About...") );
176
177     wxMenu *menuTools = new wxMenu;
178     menuTools->Append( ID_Menu_EditConfig, _T("&Edit bbtk config") );
179     menuTools->Append( ID_Menu_CreatePackage, _T("Create &package") );
180     menuTools->Append( ID_Menu_CreateBlackBox, _T("Create &blackbox") );
181     menuTools->Append( ID_Menu_ShowImageGraph, _T("&Show last image graph") );
182     menuTools->Append( ID_Menu_CreateIndex, _T("&Generate index") );
183     
184     
185     wxMenuBar *menuBar = new wxMenuBar;
186     menuBar->Append( menuFile, _T("&File") );
187     menuBar->Append( menuTools, _T("&Tools") );
188     menuBar->Append( menuAbout, _T("About") );
189     
190     SetMenuBar( menuBar );
191     
192     CreateStatusBar();
193     SetStatusText( _T("Welcome to bbi !") );
194     
195     //==============
196     // Notebook
197     
198     //    wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
199     
200 //EED    wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
201 //    mwxNotebook = new wxNotebook(this,-1,wxDefaultPosition, wxDefaultSize, 0);
202     mwxNotebook = new wxAuiNotebook(this,  
203                                     -1,
204                                     wxPoint(0, 0),
205                                     wxSize(500,500),
206                                     wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER);
207     
208     mwxPageCommand = new wxPanel(mwxNotebook,-1);        
209     mwxPageHelp = new wxPanel(mwxNotebook,-1);    
210     
211     
212     wxBoxSizer *cmdsizer = new wxBoxSizer(wxVERTICAL);
213     
214     mwxPageCommand->SetAutoLayout(true);    
215     mwxPageCommand->SetSizer(cmdsizer);
216     cmdsizer->Fit(mwxPageCommand);
217     cmdsizer->SetSizeHints(mwxPageCommand);
218
219     wxBoxSizer *helpsizer = new wxBoxSizer(wxVERTICAL);
220     
221     mwxPageHelp->SetAutoLayout(true);    
222     mwxPageHelp->SetSizer(helpsizer);
223     helpsizer->Fit(mwxPageHelp);
224     helpsizer->SetSizeHints(mwxPageHelp);
225    
226     mwxHtmlWindow = new WxBrowser(mwxPageHelp,
227 //EED                             wxSize(1200,0));
228                                           wxSize(200,0));
229
230     //    mwxHtmlWindow->SetSize(wxSize(800,1000));
231     helpsizer->Add (mwxHtmlWindow,1,   wxGROW |wxLEFT | wxRIGHT | wxBOTTOM  );
232 //    helpsizer->Add ( new wxButton(mwxPageHelp,-1,"perro"), 0,  wxEXPAND  );
233   
234     //==============
235     // Command page 
236
237     mwxTextHistory = 
238       new wxTextCtrl(mwxPageCommand,
239                      ID_Text_History,
240                      _T(""),wxDefaultPosition,
241                      wxDefaultSize, //HistorySize,
242                      wxTE_READONLY |
243                      wxTE_MULTILINE );
244  
245     wxFont* FixedFont = new wxFont(10,
246                                    wxFONTFAMILY_MODERN,
247                                    wxFONTSTYLE_NORMAL,
248                                    wxFONTWEIGHT_NORMAL,
249                                    false);
250
251    mwxTextHistoryAttr = new wxTextAttr;
252    mwxTextHistoryAttr->SetFont(*FixedFont);
253   /* 
254    mwxTextCommand = 
255      new wxTextCtrl(mwxPageCommand,
256                     ID_Text_Command,
257                     _T(""),wxDefaultPosition,
258                     wxDefaultSize,
259                     wxTE_PROCESS_ENTER
260                     | wxTE_PROCESS_TAB 
261                     | wxWANTS_CHARS 
262                     //|  wxTAB_TRAVERSAL
263                     );
264     mwxTextCommandAttr = new wxTextAttr;   
265     mwxTextCommandAttr->SetFont(*FixedFont);
266     mwxTextCommand->SetDefaultStyle(*mwxTextCommandAttr);
267    */
268    mwxTextCommand = 
269      new wxComboBox(mwxPageCommand,
270                     ID_Text_Command,
271                     _T(""),
272                     wxDefaultPosition,
273                     wxDefaultSize,
274                         0, NULL,
275                     wxTE_PROCESS_ENTER
276 //                  | wxTE_PROCESS_TAB 
277 //                  | wxWANTS_CHARS 
278 //                  //|  wxTAB_TRAVERSAL
279                     );
280    
281
282     mwxTextCommand->SetFocus();
283
284     wxPanel *btnsCtrlPanel = CreateBtnsCtrlPanel(mwxPageCommand);
285     
286         wxButton *btnGo         = new wxButton( mwxPageCommand,-1,_T("Go")              );        
287         Connect(btnGo->GetId()  , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxConsole::OnBtnGo    );
288     
289     wxFlexGridSizer *sizerCommand= new wxFlexGridSizer(2);
290     sizerCommand->AddGrowableCol(0);
291     sizerCommand->Add(mwxTextCommand,1,wxGROW);
292     sizerCommand->Add(btnGo);
293     
294     cmdsizer->Add ( mwxTextHistory, 1, wxALL | wxGROW, 10);
295 //EED    cmdsizer->Add ( mwxTextCommand, 0, wxLEFT | wxRIGHT | wxBOTTOM | wxGROW, 10 );
296     cmdsizer->Add ( sizerCommand, 0, wxLEFT | wxRIGHT | wxBOTTOM | wxGROW, 10 );
297     cmdsizer->Add ( btnsCtrlPanel, 0, wxLEFT | wxRIGHT | wxBOTTOM  | wxGROW, 10 );
298
299     
300     //  cmdsizer->AddGrowableCol(0);
301     //  cmdsizer->AddGrowableRow(0);
302     // cmdsizer->AddGrowableRow(1);
303     //  cmdsizer->SetFlexibleDirection(wxBOTH);
304
305     //=============================
306     // Events connection
307     // COMMAND
308     // ENTER
309     Connect( mwxTextCommand->GetId(),
310              wxEVT_COMMAND_TEXT_ENTER,
311              (wxObjectEventFunction)& WxConsole::OnCommandEnter );
312     /*
313     Connect( mwxTextCommand->GetId(),
314              wxEVT_CHAR,
315              //wxEVT_COMMAND_TEXT_UPDATED,
316              (wxObjectEventFunction)& WxConsole::OnCommandChar );
317     */
318     // MENU
319     //    Connect ( 
320
321     // Redirection of std::cout to mwxTextHistory and printf
322     mRedirect_cout = 
323       new WxTextCtrlStreamRedirector(std::cout,mwxTextHistory,*wxBLACK,true);
324     mRedirect_cerr = 
325       new WxTextCtrlStreamRedirector(std::cerr,mwxTextHistory,*wxGREEN,true); 
326         
327     // Creates and sets the parent window of all bbtk windows
328     wxWindow* top = new wxPanel(this,-1);//,_T("top"));
329     top->Hide();
330     //new wxFrame(this,-1,_T("bbtk"),
331     //                         wxDefaultPosition,
332     //                         wxSize(0,0),
333     //                         wxFRAME_TOOL_WINDOW) ;//wxMINIMIZE_BOX);
334
335     Wx::SetTopWindow(top);
336
337     //    top->Show();
338     
339
340     // Layout
341 //EED    SetSizer(sizer);
342
343         mwxNotebook->AddPage( mwxPageCommand, _T("Command"));
344     mwxNotebook->AddPage( mwxPageHelp, _T("Help"));
345         m_mgr.AddPane(mwxNotebook, wxAuiPaneInfo().Name(wxT("notebook_content")).CenterPane().PaneBorder(false)); 
346     m_mgr.Update();
347
348         
349         SetAutoLayout(true);
350     Layout();
351 //    Refresh();
352 //    m_mgr.Update();
353   }
354   //================================================================
355
356  //================================================================
357   WxConsole::~WxConsole()
358   {
359         m_mgr.UnInit();
360     delete mRedirect_cout;
361     delete mRedirect_cerr;
362   }
363   //================================================================
364
365
366   //================================================================
367   void WxConsole::OnCommandEnter(wxCommandEvent& event)
368   {
369     wxString line(mwxTextCommand->GetValue());
370     CommandString(line);
371   }
372   //================================================================
373
374   //================================================================  
375   void WxConsole::OnBtnGo(wxCommandEvent& event)
376   {
377         wxString line(mwxTextCommand->GetValue());
378         CommandString(line);
379   } 
380   //================================================================  
381   
382   //================================================================
383   void WxConsole::CommandString(wxString line )
384   {
385     //printf("WxConsole::CommandString 01 \n");
386     wxString s = _T("> ") + line + _T("\n");
387     mwxTextHistoryAttr->SetTextColour(*wxRED);
388     mwxTextHistory->SetDefaultStyle(*mwxTextHistoryAttr);
389     mwxTextHistory->AppendText(s);
390     // send to standard console also 
391     //printf("WxConsole::CommandString 02 \n");
392     //    printf("%s",wx2std(s).c_str());
393 //EED    mwxTextCommand->Clear();
394     mwxTextCommand->SetValue(_T(""));
395         mwxTextCommand->Append(line);
396     
397 //EED    mwxTextCommand->SetDefaultStyle(*mwxTextCommandAttr);
398     mwxTextHistoryAttr->SetTextColour(*wxBLACK);
399     mwxTextHistory->SetDefaultStyle(*mwxTextHistoryAttr);
400
401     //printf("WxConsole::CommandString 03 \n");
402     try 
403     {
404       bool insideComment = false;
405
406       mInterpreter->InterpretLine( wx2std(line), insideComment );
407     }
408     catch (bbtk::QuitException)
409     {
410        Close(true); 
411     }
412     catch (bbtk::Exception e) 
413     {
414        e.Print();
415     }
416     catch (std::exception& e) 
417     {
418        std::cout << "* ERROR : "<<e.what()<<" (not in bbtk)"<<std::endl;
419     }
420     catch (...)
421     {
422        std::cout << "* UNDEFINED ERROR (not a bbtk nor a std exception)"
423                  << std::endl;
424     }
425     //printf("WxConsole::CommandString 06 \n");
426   }
427   //================================================================
428
429
430   //================================================================
431   void WxConsole::OnMenuQuit(wxCommandEvent& WXUNUSED(event))
432   {
433     Close(true);
434   }
435   //================================================================
436
437
438   //================================================================
439   void WxConsole::OnMenuAbout(wxCommandEvent& WXUNUSED(event))
440   {
441     m_mgr.Update();
442         Refresh();
443     wxMessageBox(_T("  bbi\nThe Black Box Toolkit interpreter\n(c) CREATIS-LRMN 2008"),
444                  _T("About ..."), wxOK | wxICON_INFORMATION,
445                  this);
446   }
447   //================================================================
448
449
450   //================================================================
451   void WxConsole::OnMenuEditConfig(wxCommandEvent& WXUNUSED(event))
452   {
453         std::string commandStr;
454     std::string configFile = ConfigurationFile::GetInstance().Get_config_xml_full_path();
455 #ifdef WIN32
456         commandStr = "notepad.exe ";
457 #else
458         commandStr = "gedit ";
459 #endif 
460         commandStr = commandStr + configFile;
461         std::cout << "system: " << commandStr << std::endl;
462         system ( commandStr.c_str() );
463   }
464   //================================================================
465
466
467   //================================================================
468   void WxConsole::OnMenuCreatePackage(wxCommandEvent& WXUNUSED(event))
469   {
470         std::cout << "bbi: include CreatePackage" << std::endl;
471     Interpreter* I = new Interpreter;    
472         I->InterpretFile("CreatePackage");
473     delete I;
474   }
475   //================================================================
476
477
478   //================================================================
479   void WxConsole::OnMenuCreateBlackBox(wxCommandEvent& WXUNUSED(event))
480   {
481         std::cout << "bbi: include CreateBlackBox" << std::endl;
482     Interpreter* I = new Interpreter;    
483         I->InterpretFile("CreateBlackBox");
484     delete I;
485   }
486   //================================================================
487   
488   //================================================================
489   void WxConsole::OnMenuShowImageGraph(wxCommandEvent& WXUNUSED(event))
490   {
491     std::string default_temp_dir = ConfigurationFile::GetInstance().Get_default_temp_dir();
492
493 #if defined(WIN32)
494     std::string strappli="start ";
495 #else
496     std::string strappli="gnome-open ";
497 #endif
498     std::string strcommand = strappli +default_temp_dir+"/temp_dir/workspace_workspacePrototype.png";
499         std::cout << "system: " << strcommand << std::endl;
500     system ( strcommand.c_str() );
501
502   }
503   //================================================================
504
505
506   //================================================================
507   void WxConsole::OnMenuCreateIndex(wxCommandEvent& WXUNUSED(event))
508   {
509     std::string doc_path = ConfigurationFile::GetInstance().Get_doc_path();
510     std::string filepath = doc_path+"/bbdoc/make-index.bbs";
511     Interpreter* I = new Interpreter;    
512
513 //EED   std::cout << "bbi: include "<<filepath<<std::endl;
514 //EED   I->InterpretFile( filepath );
515
516     bool insideComment = false; // for multiline comment
517         I->InterpretLine( "exec freeze" ,insideComment );
518         I->InterpretLine( "include *" ,insideComment );
519         I->InterpretLine( "index "+doc_path+"/bbdoc/index-alpha.html Initials" ,insideComment );
520         I->InterpretLine( "index "+doc_path+"/bbdoc/index-package.html Packages" ,insideComment );
521         I->InterpretLine( "index "+doc_path+"/bbdoc/index-category.html Categories" ,insideComment );
522         I->InterpretLine( "index "+doc_path+"/bbdoc/index-adaptors.html Adaptors",insideComment  );
523
524     delete I;
525   }
526   //================================================================
527
528
529
530   
531   //================================================================
532   void WxConsole::OnCommandChar(wxCommandEvent& event)
533   {
534     std::cout << "c";
535     /*
536     // Command completion  
537     std::vector<std::string> commands;
538     wxString sline( wx2std ( mwxTextCommand->GetValue() ) );
539     int ind = sline.size();
540     mInterpreter->FindCommandsWithPrefix( sline.c_str(),ind,commands);
541     if (commands.size()==1) 
542       {
543         std::string com = *commands.begin();
544         for (; ind<com.size(); ++ind) 
545           {
546             mwxTextCommand->TextAppend( std2wx ( com[ind]) ); 
547           }
548          mwxTextCommand->TextAppend(_T(" "));
549       }
550     else if (commands.size()>1) 
551       {
552         std::vector<std::string>::iterator i;
553         write(1,"\n",1);
554         for (i=commands.begin();i!=commands.end();++i) 
555           {
556             write(STDOUT_FILENO,(*i).c_str(),strlen((*i).c_str()));
557             PrintChar(' ');
558           }
559         write(STDOUT_FILENO,"\n> ",3);
560         //for (int j=0;j<ind;++j) 
561         //{
562         write(STDOUT_FILENO,line,ind); 
563         //  }
564       }
565     */
566   }
567   //================================================================
568
569   void WxConsole::ShowHtmlPage(std::string& page)
570   {
571     //  std::cout << "WxConsole::ShowHtmlPage('"<<page<<"')"<<std::endl;
572     if (mwxHtmlWindow->GoTo(page)) 
573       {
574 //EED   mwxNotebook->ChangeSelection(1);
575         mwxNotebook->SetSelection(1);
576       }
577     else 
578       {
579          // std::cout << "ERROR html"<<std::endl;
580       }
581   } 
582
583   
584   
585   //================================================================  
586   wxPanel* WxConsole::CreateBtnsCtrlPanel(wxWindow *parent)
587   {
588      wxPanel *btnsCtrlPanel = new wxPanel(parent,-1);
589      wxBoxSizer *btnsSizer      = new wxBoxSizer(wxHORIZONTAL);
590           
591      wxButton *btnInclude  = new wxButton( btnsCtrlPanel,-1,_T("Include")  );
592      wxButton *btnReset    = new wxButton( btnsCtrlPanel,-1,_T("Reset")    );
593      wxButton *btnConfig   = new wxButton( btnsCtrlPanel,-1,_T("Config")   );
594      wxButton *btnGraphS   = new wxButton( btnsCtrlPanel,-1,_T("Graph simple") );
595      wxButton *btnGraphD   = new wxButton( btnsCtrlPanel,-1,_T("Graph detailed") );
596      wxButton *btnHelp     = new wxButton( btnsCtrlPanel,-1,_T("Help")     );
597
598           btnsSizer->Add( btnInclude    );
599           btnsSizer->Add( btnReset              );
600           btnsSizer->Add( btnConfig             );
601           btnsSizer->Add( btnGraphS     );
602           btnsSizer->Add( btnGraphD     );
603           btnsSizer->Add( btnHelp               );
604           btnsCtrlPanel->SetSizer(btnsSizer);
605
606           Connect(btnInclude->GetId()   , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxConsole::OnBtnInclude       );
607           Connect(btnReset->GetId()             , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxConsole::OnBtnReset         );
608           Connect(btnConfig->GetId()    , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxConsole::OnBtnConfig        );
609           Connect(btnGraphS->GetId()    , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxConsole::OnBtnGraphS        );
610           Connect(btnGraphD->GetId()    , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxConsole::OnBtnGraphD        );
611           Connect(btnHelp->GetId()              , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxConsole::OnBtnHelp          );
612           return btnsCtrlPanel;
613   }
614   //================================================================  
615   
616   
617   //================================================================  
618   void WxConsole::OnBtnInclude(wxCommandEvent& event)
619   {
620      std::string default_doc_dir = ConfigurationFile::GetInstance().Get_default_temp_dir();
621      std::string stdDir = default_doc_dir+"/share/bbtk/bbs";
622      wxString defaultDir(stdDir.c_str(), wxConvUTF8);
623
624      wxFileDialog dialog(this, _T("Choose a file"),defaultDir, _T(""), _T("*.bbs"), wxOPEN );
625      if (dialog.ShowModal() == wxID_OK)
626      {
627         // std::string command(_T("include "));
628         // std::string pathfilename = (const char *)(dialog.GetFilename().mb_str());
629         wxString command(_T("include "));
630         wxString pathfilename = dialog.GetPath();
631         command += pathfilename;
632         CommandString( command );
633      }
634
635   }
636   //================================================================  
637
638   
639   //================================================================  
640   void WxConsole::OnBtnReset(wxCommandEvent& event)
641   {
642      CommandString(_T("reset"));
643   }
644   //================================================================  
645
646   
647   //================================================================  
648   void WxConsole::OnBtnConfig(wxCommandEvent& event)
649   {
650      CommandString(_T("config"));
651   }
652   //================================================================  
653
654   
655   
656   //================================================================  
657   void WxConsole::OnBtnGraphS(wxCommandEvent& event)
658   {
659      CommandString(_T("graph"));
660   }
661   //================================================================  
662
663   //================================================================  
664   void WxConsole::OnBtnGraphD(wxCommandEvent& event)
665   {
666      CommandString(_T("graph . 1"));
667   }
668   //================================================================  
669
670   //================================================================  
671   void WxConsole::OnBtnHelp(wxCommandEvent& event)
672   {
673      CommandString(_T("help"));
674   }
675   //================================================================  
676
677   
678   //================================================================  
679   BEGIN_EVENT_TABLE(WxConsole, wxFrame)
680     EVT_MENU(WxConsole::ID_Menu_Quit, WxConsole::OnMenuQuit)
681     EVT_MENU(WxConsole::ID_Menu_About, WxConsole::OnMenuAbout)
682     EVT_MENU(WxConsole::ID_Menu_EditConfig, WxConsole::OnMenuEditConfig)
683     EVT_MENU(WxConsole::ID_Menu_CreatePackage, WxConsole::OnMenuCreatePackage)
684     EVT_MENU(WxConsole::ID_Menu_CreateBlackBox, WxConsole::OnMenuCreateBlackBox)
685     EVT_MENU(WxConsole::ID_Menu_ShowImageGraph, WxConsole::OnMenuShowImageGraph)
686     EVT_MENU(WxConsole::ID_Menu_CreateIndex, WxConsole::OnMenuCreateIndex)
687     EVT_TEXT_ENTER(WxConsole::ID_Text_Command, WxConsole::OnCommandEnter)
688 //      EVT_CHAR(WxConsole::ID_Text_Command, WxConsole::OnCommandChar)
689     END_EVENT_TABLE()
690   //================================================================
691
692 } // namespace bbtk
693
694
695 #endif //_USE_WXWIDGETS_